diff options
author | Ingo Molnar <mingo@kernel.org> | 2014-07-16 09:10:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-07-16 09:10:07 -0400 |
commit | d26fad5b38e1c4667d4f2604936e59c837caa54d (patch) | |
tree | 04b524a69a0129c181567445bff18847a1b44721 | |
parent | e720fff6341fe4b95e5a93c939bd3c77fa55ced4 (diff) | |
parent | 1795cd9b3a91d4b5473c97f491d63892442212ab (diff) |
Merge tag 'v3.16-rc5' into sched/core, to refresh the branch before applying bigger tree-wide changes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
1117 files changed, 13905 insertions, 8132 deletions
@@ -9,6 +9,10 @@ | |||
9 | Linus | 9 | Linus |
10 | ---------- | 10 | ---------- |
11 | 11 | ||
12 | M: Matt Mackal | ||
13 | E: mpm@selenic.com | ||
14 | D: SLOB slab allocator | ||
15 | |||
12 | N: Matti Aarnio | 16 | N: Matti Aarnio |
13 | E: mea@nic.funet.fi | 17 | E: mea@nic.funet.fi |
14 | D: Alpha systems hacking, IPv6 and other network related stuff | 18 | D: Alpha systems hacking, IPv6 and other network related stuff |
diff --git a/Documentation/Changes b/Documentation/Changes index 2254db0f00a5..227bec88021e 100644 --- a/Documentation/Changes +++ b/Documentation/Changes | |||
@@ -280,12 +280,9 @@ that is possible. | |||
280 | mcelog | 280 | mcelog |
281 | ------ | 281 | ------ |
282 | 282 | ||
283 | In Linux 2.6.31+ the i386 kernel needs to run the mcelog utility | 283 | On x86 kernels the mcelog utility is needed to process and log machine check |
284 | as a regular cronjob similar to the x86-64 kernel to process and log | 284 | events when CONFIG_X86_MCE is enabled. Machine check events are errors reported |
285 | machine check events when CONFIG_X86_NEW_MCE is enabled. Machine check | 285 | by the CPU. Processing them is strongly encouraged. |
286 | events are errors reported by the CPU. Processing them is strongly encouraged. | ||
287 | All x86-64 kernels since 2.6.4 require the mcelog utility to | ||
288 | process machine checks. | ||
289 | 286 | ||
290 | Getting updated software | 287 | Getting updated software |
291 | ======================== | 288 | ======================== |
diff --git a/Documentation/DocBook/gadget.tmpl b/Documentation/DocBook/gadget.tmpl index 4017f147ba2f..2c425d70f7e2 100644 --- a/Documentation/DocBook/gadget.tmpl +++ b/Documentation/DocBook/gadget.tmpl | |||
@@ -708,7 +708,7 @@ hardware level details could be very different. | |||
708 | 708 | ||
709 | <para>Systems need specialized hardware support to implement OTG, | 709 | <para>Systems need specialized hardware support to implement OTG, |
710 | notably including a special <emphasis>Mini-AB</emphasis> jack | 710 | notably including a special <emphasis>Mini-AB</emphasis> jack |
711 | and associated transciever to support <emphasis>Dual-Role</emphasis> | 711 | and associated transceiver to support <emphasis>Dual-Role</emphasis> |
712 | operation: | 712 | operation: |
713 | they can act either as a host, using the standard | 713 | they can act either as a host, using the standard |
714 | Linux-USB host side driver stack, | 714 | Linux-USB host side driver stack, |
diff --git a/Documentation/DocBook/genericirq.tmpl b/Documentation/DocBook/genericirq.tmpl index 46347f603353..59fb5c077541 100644 --- a/Documentation/DocBook/genericirq.tmpl +++ b/Documentation/DocBook/genericirq.tmpl | |||
@@ -182,7 +182,7 @@ | |||
182 | <para> | 182 | <para> |
183 | Each interrupt is described by an interrupt descriptor structure | 183 | Each interrupt is described by an interrupt descriptor structure |
184 | irq_desc. The interrupt is referenced by an 'unsigned int' numeric | 184 | irq_desc. The interrupt is referenced by an 'unsigned int' numeric |
185 | value which selects the corresponding interrupt decription structure | 185 | value which selects the corresponding interrupt description structure |
186 | in the descriptor structures array. | 186 | in the descriptor structures array. |
187 | The descriptor structure contains status information and pointers | 187 | The descriptor structure contains status information and pointers |
188 | to the interrupt flow method and the interrupt chip structure | 188 | to the interrupt flow method and the interrupt chip structure |
@@ -470,7 +470,7 @@ if (desc->irq_data.chip->irq_eoi) | |||
470 | <para> | 470 | <para> |
471 | To avoid copies of identical implementations of IRQ chips the | 471 | To avoid copies of identical implementations of IRQ chips the |
472 | core provides a configurable generic interrupt chip | 472 | core provides a configurable generic interrupt chip |
473 | implementation. Developers should check carefuly whether the | 473 | implementation. Developers should check carefully whether the |
474 | generic chip fits their needs before implementing the same | 474 | generic chip fits their needs before implementing the same |
475 | functionality slightly differently themselves. | 475 | functionality slightly differently themselves. |
476 | </para> | 476 | </para> |
diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl index 19f2a5a5a5b4..e584ee12a1e7 100644 --- a/Documentation/DocBook/kernel-locking.tmpl +++ b/Documentation/DocBook/kernel-locking.tmpl | |||
@@ -1760,7 +1760,7 @@ as it would be on UP. | |||
1760 | </para> | 1760 | </para> |
1761 | 1761 | ||
1762 | <para> | 1762 | <para> |
1763 | There is a furthur optimization possible here: remember our original | 1763 | There is a further optimization possible here: remember our original |
1764 | cache code, where there were no reference counts and the caller simply | 1764 | cache code, where there were no reference counts and the caller simply |
1765 | held the lock whenever using the object? This is still possible: if | 1765 | held the lock whenever using the object? This is still possible: if |
1766 | you hold the lock, no one can delete the object, so you don't need to | 1766 | you hold the lock, no one can delete the object, so you don't need to |
diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl index deb71baed328..d7fcdc5a4379 100644 --- a/Documentation/DocBook/libata.tmpl +++ b/Documentation/DocBook/libata.tmpl | |||
@@ -677,7 +677,7 @@ and other resources, etc. | |||
677 | 677 | ||
678 | <listitem> | 678 | <listitem> |
679 | <para> | 679 | <para> |
680 | ATA_QCFLAG_ACTIVE is clared from qc->flags. | 680 | ATA_QCFLAG_ACTIVE is cleared from qc->flags. |
681 | </para> | 681 | </para> |
682 | </listitem> | 682 | </listitem> |
683 | 683 | ||
@@ -708,7 +708,7 @@ and other resources, etc. | |||
708 | 708 | ||
709 | <listitem> | 709 | <listitem> |
710 | <para> | 710 | <para> |
711 | qc->waiting is claread & completed (in that order). | 711 | qc->waiting is cleared & completed (in that order). |
712 | </para> | 712 | </para> |
713 | </listitem> | 713 | </listitem> |
714 | 714 | ||
@@ -1163,7 +1163,7 @@ and other resources, etc. | |||
1163 | 1163 | ||
1164 | <para> | 1164 | <para> |
1165 | Once sense data is acquired, this type of errors can be | 1165 | Once sense data is acquired, this type of errors can be |
1166 | handled similary to other SCSI errors. Note that sense data | 1166 | handled similarly to other SCSI errors. Note that sense data |
1167 | may indicate ATA bus error (e.g. Sense Key 04h HARDWARE ERROR | 1167 | may indicate ATA bus error (e.g. Sense Key 04h HARDWARE ERROR |
1168 | && ASC/ASCQ 47h/00h SCSI PARITY ERROR). In such | 1168 | && ASC/ASCQ 47h/00h SCSI PARITY ERROR). In such |
1169 | cases, the error should be considered as an ATA bus error and | 1169 | cases, the error should be considered as an ATA bus error and |
diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index 1d27f0a1abd1..639e74857968 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile | |||
@@ -202,8 +202,8 @@ $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64 | |||
202 | 202 | ||
203 | $(MEDIA_OBJ_DIR)/v4l2.xml: $(OBJIMGFILES) | 203 | $(MEDIA_OBJ_DIR)/v4l2.xml: $(OBJIMGFILES) |
204 | @$($(quiet)gen_xml) | 204 | @$($(quiet)gen_xml) |
205 | @(ln -sf $(MEDIA_SRC_DIR)/v4l/*xml $(MEDIA_OBJ_DIR)/) | 205 | @(ln -sf `cd $(MEDIA_SRC_DIR) && /bin/pwd`/v4l/*xml $(MEDIA_OBJ_DIR)/) |
206 | @(ln -sf $(MEDIA_SRC_DIR)/dvb/*xml $(MEDIA_OBJ_DIR)/) | 206 | @(ln -sf `cd $(MEDIA_SRC_DIR) && /bin/pwd`/dvb/*xml $(MEDIA_OBJ_DIR)/) |
207 | 207 | ||
208 | $(MEDIA_OBJ_DIR)/videodev2.h.xml: $(srctree)/include/uapi/linux/videodev2.h $(MEDIA_OBJ_DIR)/v4l2.xml | 208 | $(MEDIA_OBJ_DIR)/videodev2.h.xml: $(srctree)/include/uapi/linux/videodev2.h $(MEDIA_OBJ_DIR)/v4l2.xml |
209 | @$($(quiet)gen_xml) | 209 | @$($(quiet)gen_xml) |
diff --git a/Documentation/DocBook/media_api.tmpl b/Documentation/DocBook/media_api.tmpl index 4decb46bfa76..03f9a1f8d413 100644 --- a/Documentation/DocBook/media_api.tmpl +++ b/Documentation/DocBook/media_api.tmpl | |||
@@ -68,7 +68,7 @@ | |||
68 | several digital tv standards. While it is called as DVB API, | 68 | several digital tv standards. While it is called as DVB API, |
69 | in fact it covers several different video standards including | 69 | in fact it covers several different video standards including |
70 | DVB-T, DVB-S, DVB-C and ATSC. The API is currently being updated | 70 | DVB-T, DVB-S, DVB-C and ATSC. The API is currently being updated |
71 | to documment support also for DVB-S2, ISDB-T and ISDB-S.</para> | 71 | to document support also for DVB-S2, ISDB-T and ISDB-S.</para> |
72 | <para>The third part covers the Remote Controller API.</para> | 72 | <para>The third part covers the Remote Controller API.</para> |
73 | <para>The fourth part covers the Media Controller API.</para> | 73 | <para>The fourth part covers the Media Controller API.</para> |
74 | <para>For additional information and for the latest development code, | 74 | <para>For additional information and for the latest development code, |
diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl index cd11926e07c7..7da8f0402af5 100644 --- a/Documentation/DocBook/mtdnand.tmpl +++ b/Documentation/DocBook/mtdnand.tmpl | |||
@@ -91,7 +91,7 @@ | |||
91 | <listitem><para> | 91 | <listitem><para> |
92 | [MTD Interface]</para><para> | 92 | [MTD Interface]</para><para> |
93 | These functions provide the interface to the MTD kernel API. | 93 | These functions provide the interface to the MTD kernel API. |
94 | They are not replacable and provide functionality | 94 | They are not replaceable and provide functionality |
95 | which is complete hardware independent. | 95 | which is complete hardware independent. |
96 | </para></listitem> | 96 | </para></listitem> |
97 | <listitem><para> | 97 | <listitem><para> |
@@ -100,14 +100,14 @@ | |||
100 | </para></listitem> | 100 | </para></listitem> |
101 | <listitem><para> | 101 | <listitem><para> |
102 | [GENERIC]</para><para> | 102 | [GENERIC]</para><para> |
103 | Generic functions are not replacable and provide functionality | 103 | Generic functions are not replaceable and provide functionality |
104 | which is complete hardware independent. | 104 | which is complete hardware independent. |
105 | </para></listitem> | 105 | </para></listitem> |
106 | <listitem><para> | 106 | <listitem><para> |
107 | [DEFAULT]</para><para> | 107 | [DEFAULT]</para><para> |
108 | Default functions provide hardware related functionality which is suitable | 108 | Default functions provide hardware related functionality which is suitable |
109 | for most of the implementations. These functions can be replaced by the | 109 | for most of the implementations. These functions can be replaced by the |
110 | board driver if neccecary. Those functions are called via pointers in the | 110 | board driver if necessary. Those functions are called via pointers in the |
111 | NAND chip description structure. The board driver can set the functions which | 111 | NAND chip description structure. The board driver can set the functions which |
112 | should be replaced by board dependent functions before calling nand_scan(). | 112 | should be replaced by board dependent functions before calling nand_scan(). |
113 | If the function pointer is NULL on entry to nand_scan() then the pointer | 113 | If the function pointer is NULL on entry to nand_scan() then the pointer |
@@ -264,7 +264,7 @@ static void board_hwcontrol(struct mtd_info *mtd, int cmd) | |||
264 | is set up nand_scan() is called. This function tries to | 264 | is set up nand_scan() is called. This function tries to |
265 | detect and identify then chip. If a chip is found all the | 265 | detect and identify then chip. If a chip is found all the |
266 | internal data fields are initialized accordingly. | 266 | internal data fields are initialized accordingly. |
267 | The structure(s) have to be zeroed out first and then filled with the neccecary | 267 | The structure(s) have to be zeroed out first and then filled with the necessary |
268 | information about the device. | 268 | information about the device. |
269 | </para> | 269 | </para> |
270 | <programlisting> | 270 | <programlisting> |
@@ -327,7 +327,7 @@ module_init(board_init); | |||
327 | <sect1 id="Exit_function"> | 327 | <sect1 id="Exit_function"> |
328 | <title>Exit function</title> | 328 | <title>Exit function</title> |
329 | <para> | 329 | <para> |
330 | The exit function is only neccecary if the driver is | 330 | The exit function is only necessary if the driver is |
331 | compiled as a module. It releases all resources which | 331 | compiled as a module. It releases all resources which |
332 | are held by the chip driver and unregisters the partitions | 332 | are held by the chip driver and unregisters the partitions |
333 | in the MTD layer. | 333 | in the MTD layer. |
@@ -494,7 +494,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip) | |||
494 | in this case. See rts_from4.c and diskonchip.c for | 494 | in this case. See rts_from4.c and diskonchip.c for |
495 | implementation reference. In those cases we must also | 495 | implementation reference. In those cases we must also |
496 | use bad block tables on FLASH, because the ECC layout is | 496 | use bad block tables on FLASH, because the ECC layout is |
497 | interferring with the bad block marker positions. | 497 | interfering with the bad block marker positions. |
498 | See bad block table support for details. | 498 | See bad block table support for details. |
499 | </para> | 499 | </para> |
500 | </sect2> | 500 | </sect2> |
@@ -542,7 +542,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip) | |||
542 | <para> | 542 | <para> |
543 | nand_scan() calls the function nand_default_bbt(). | 543 | nand_scan() calls the function nand_default_bbt(). |
544 | nand_default_bbt() selects appropriate default | 544 | nand_default_bbt() selects appropriate default |
545 | bad block table desriptors depending on the chip information | 545 | bad block table descriptors depending on the chip information |
546 | which was retrieved by nand_scan(). | 546 | which was retrieved by nand_scan(). |
547 | </para> | 547 | </para> |
548 | <para> | 548 | <para> |
@@ -554,7 +554,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip) | |||
554 | <sect2 id="Flash_based_tables"> | 554 | <sect2 id="Flash_based_tables"> |
555 | <title>Flash based tables</title> | 555 | <title>Flash based tables</title> |
556 | <para> | 556 | <para> |
557 | It may be desired or neccecary to keep a bad block table in FLASH. | 557 | It may be desired or necessary to keep a bad block table in FLASH. |
558 | For AG-AND chips this is mandatory, as they have no factory marked | 558 | For AG-AND chips this is mandatory, as they have no factory marked |
559 | bad blocks. They have factory marked good blocks. The marker pattern | 559 | bad blocks. They have factory marked good blocks. The marker pattern |
560 | is erased when the block is erased to be reused. So in case of | 560 | is erased when the block is erased to be reused. So in case of |
@@ -565,10 +565,10 @@ static void board_select_chip (struct mtd_info *mtd, int chip) | |||
565 | of the blocks. | 565 | of the blocks. |
566 | </para> | 566 | </para> |
567 | <para> | 567 | <para> |
568 | The blocks in which the tables are stored are procteted against | 568 | The blocks in which the tables are stored are protected against |
569 | accidental access by marking them bad in the memory bad block | 569 | accidental access by marking them bad in the memory bad block |
570 | table. The bad block table management functions are allowed | 570 | table. The bad block table management functions are allowed |
571 | to circumvernt this protection. | 571 | to circumvent this protection. |
572 | </para> | 572 | </para> |
573 | <para> | 573 | <para> |
574 | The simplest way to activate the FLASH based bad block table support | 574 | The simplest way to activate the FLASH based bad block table support |
@@ -592,7 +592,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip) | |||
592 | User defined tables are created by filling out a | 592 | User defined tables are created by filling out a |
593 | nand_bbt_descr structure and storing the pointer in the | 593 | nand_bbt_descr structure and storing the pointer in the |
594 | nand_chip structure member bbt_td before calling nand_scan(). | 594 | nand_chip structure member bbt_td before calling nand_scan(). |
595 | If a mirror table is neccecary a second structure must be | 595 | If a mirror table is necessary a second structure must be |
596 | created and a pointer to this structure must be stored | 596 | created and a pointer to this structure must be stored |
597 | in bbt_md inside the nand_chip structure. If the bbt_md | 597 | in bbt_md inside the nand_chip structure. If the bbt_md |
598 | member is set to NULL then only the main table is used | 598 | member is set to NULL then only the main table is used |
@@ -666,7 +666,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip) | |||
666 | <para> | 666 | <para> |
667 | For automatic placement some blocks must be reserved for | 667 | For automatic placement some blocks must be reserved for |
668 | bad block table storage. The number of reserved blocks is defined | 668 | bad block table storage. The number of reserved blocks is defined |
669 | in the maxblocks member of the babd block table description structure. | 669 | in the maxblocks member of the bad block table description structure. |
670 | Reserving 4 blocks for mirrored tables should be a reasonable number. | 670 | Reserving 4 blocks for mirrored tables should be a reasonable number. |
671 | This also limits the number of blocks which are scanned for the bad | 671 | This also limits the number of blocks which are scanned for the bad |
672 | block table ident pattern. | 672 | block table ident pattern. |
@@ -1068,11 +1068,11 @@ in this page</entry> | |||
1068 | <chapter id="filesystems"> | 1068 | <chapter id="filesystems"> |
1069 | <title>Filesystem support</title> | 1069 | <title>Filesystem support</title> |
1070 | <para> | 1070 | <para> |
1071 | The NAND driver provides all neccecary functions for a | 1071 | The NAND driver provides all necessary functions for a |
1072 | filesystem via the MTD interface. | 1072 | filesystem via the MTD interface. |
1073 | </para> | 1073 | </para> |
1074 | <para> | 1074 | <para> |
1075 | Filesystems must be aware of the NAND pecularities and | 1075 | Filesystems must be aware of the NAND peculiarities and |
1076 | restrictions. One major restrictions of NAND Flash is, that you cannot | 1076 | restrictions. One major restrictions of NAND Flash is, that you cannot |
1077 | write as often as you want to a page. The consecutive writes to a page, | 1077 | write as often as you want to a page. The consecutive writes to a page, |
1078 | before erasing it again, are restricted to 1-3 writes, depending on the | 1078 | before erasing it again, are restricted to 1-3 writes, depending on the |
@@ -1222,7 +1222,7 @@ in this page</entry> | |||
1222 | #define NAND_BBT_VERSION 0x00000100 | 1222 | #define NAND_BBT_VERSION 0x00000100 |
1223 | /* Create a bbt if none axists */ | 1223 | /* Create a bbt if none axists */ |
1224 | #define NAND_BBT_CREATE 0x00000200 | 1224 | #define NAND_BBT_CREATE 0x00000200 |
1225 | /* Write bbt if neccecary */ | 1225 | /* Write bbt if necessary */ |
1226 | #define NAND_BBT_WRITE 0x00001000 | 1226 | #define NAND_BBT_WRITE 0x00001000 |
1227 | /* Read and write back block contents when writing bbt */ | 1227 | /* Read and write back block contents when writing bbt */ |
1228 | #define NAND_BBT_SAVECONTENT 0x00002000 | 1228 | #define NAND_BBT_SAVECONTENT 0x00002000 |
diff --git a/Documentation/DocBook/regulator.tmpl b/Documentation/DocBook/regulator.tmpl index 346e552fa2cc..3b08a085d2c7 100644 --- a/Documentation/DocBook/regulator.tmpl +++ b/Documentation/DocBook/regulator.tmpl | |||
@@ -155,7 +155,7 @@ | |||
155 | release regulators. Functions are | 155 | release regulators. Functions are |
156 | provided to <link linkend='API-regulator-enable'>enable</link> | 156 | provided to <link linkend='API-regulator-enable'>enable</link> |
157 | and <link linkend='API-regulator-disable'>disable</link> the | 157 | and <link linkend='API-regulator-disable'>disable</link> the |
158 | reguator and to get and set the runtime parameters of the | 158 | regulator and to get and set the runtime parameters of the |
159 | regulator. | 159 | regulator. |
160 | </para> | 160 | </para> |
161 | <para> | 161 | <para> |
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl index 95618159e29b..bbe9c1fd5cef 100644 --- a/Documentation/DocBook/uio-howto.tmpl +++ b/Documentation/DocBook/uio-howto.tmpl | |||
@@ -766,10 +766,10 @@ framework to set up sysfs files for this region. Simply leave it alone. | |||
766 | <para> | 766 | <para> |
767 | The dynamic memory regions will be allocated when the UIO device file, | 767 | The dynamic memory regions will be allocated when the UIO device file, |
768 | <varname>/dev/uioX</varname> is opened. | 768 | <varname>/dev/uioX</varname> is opened. |
769 | Simiar to static memory resources, the memory region information for | 769 | Similar to static memory resources, the memory region information for |
770 | dynamic regions is then visible via sysfs at | 770 | dynamic regions is then visible via sysfs at |
771 | <varname>/sys/class/uio/uioX/maps/mapY/*</varname>. | 771 | <varname>/sys/class/uio/uioX/maps/mapY/*</varname>. |
772 | The dynmaic memory regions will be freed when the UIO device file is | 772 | The dynamic memory regions will be freed when the UIO device file is |
773 | closed. When no processes are holding the device file open, the address | 773 | closed. When no processes are holding the device file open, the address |
774 | returned to userspace is ~0. | 774 | returned to userspace is ~0. |
775 | </para> | 775 | </para> |
diff --git a/Documentation/DocBook/usb.tmpl b/Documentation/DocBook/usb.tmpl index 8d57c1888dca..85fc0e28576f 100644 --- a/Documentation/DocBook/usb.tmpl +++ b/Documentation/DocBook/usb.tmpl | |||
@@ -153,7 +153,7 @@ | |||
153 | 153 | ||
154 | <listitem><para>The Linux USB API supports synchronous calls for | 154 | <listitem><para>The Linux USB API supports synchronous calls for |
155 | control and bulk messages. | 155 | control and bulk messages. |
156 | It also supports asynchnous calls for all kinds of data transfer, | 156 | It also supports asynchronous calls for all kinds of data transfer, |
157 | using request structures called "URBs" (USB Request Blocks). | 157 | using request structures called "URBs" (USB Request Blocks). |
158 | </para></listitem> | 158 | </para></listitem> |
159 | 159 | ||
diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl index d0056a4e9c53..6f639d9530b5 100644 --- a/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -5696,7 +5696,7 @@ struct _snd_pcm_runtime { | |||
5696 | suspending the PCM operations via | 5696 | suspending the PCM operations via |
5697 | <function>snd_pcm_suspend_all()</function> or | 5697 | <function>snd_pcm_suspend_all()</function> or |
5698 | <function>snd_pcm_suspend()</function>. It means that the PCM | 5698 | <function>snd_pcm_suspend()</function>. It means that the PCM |
5699 | streams are already stoppped when the register snapshot is | 5699 | streams are already stopped when the register snapshot is |
5700 | taken. But, remember that you don't have to restart the PCM | 5700 | taken. But, remember that you don't have to restart the PCM |
5701 | stream in the resume callback. It'll be restarted via | 5701 | stream in the resume callback. It'll be restarted via |
5702 | trigger call with <constant>SNDRV_PCM_TRIGGER_RESUME</constant> | 5702 | trigger call with <constant>SNDRV_PCM_TRIGGER_RESUME</constant> |
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c index c6a06b71594d..f40578026a04 100644 --- a/Documentation/accounting/getdelays.c +++ b/Documentation/accounting/getdelays.c | |||
@@ -314,6 +314,7 @@ int main(int argc, char *argv[]) | |||
314 | break; | 314 | break; |
315 | case 'm': | 315 | case 'm': |
316 | strncpy(cpumask, optarg, sizeof(cpumask)); | 316 | strncpy(cpumask, optarg, sizeof(cpumask)); |
317 | cpumask[sizeof(cpumask) - 1] = '\0'; | ||
317 | maskset = 1; | 318 | maskset = 1; |
318 | printf("cpumask %s maskset %d\n", cpumask, maskset); | 319 | printf("cpumask %s maskset %d\n", cpumask, maskset); |
319 | break; | 320 | break; |
diff --git a/Documentation/cpu-freq/intel-pstate.txt b/Documentation/cpu-freq/intel-pstate.txt index e742d21dbd96..a69ffe1d54d5 100644 --- a/Documentation/cpu-freq/intel-pstate.txt +++ b/Documentation/cpu-freq/intel-pstate.txt | |||
@@ -15,10 +15,13 @@ New sysfs files for controlling P state selection have been added to | |||
15 | /sys/devices/system/cpu/intel_pstate/ | 15 | /sys/devices/system/cpu/intel_pstate/ |
16 | 16 | ||
17 | max_perf_pct: limits the maximum P state that will be requested by | 17 | max_perf_pct: limits the maximum P state that will be requested by |
18 | the driver stated as a percentage of the available performance. | 18 | the driver stated as a percentage of the available performance. The |
19 | available (P states) performance may be reduced by the no_turbo | ||
20 | setting described below. | ||
19 | 21 | ||
20 | min_perf_pct: limits the minimum P state that will be requested by | 22 | min_perf_pct: limits the minimum P state that will be requested by |
21 | the driver stated as a percentage of the available performance. | 23 | the driver stated as a percentage of the max (non-turbo) |
24 | performance level. | ||
22 | 25 | ||
23 | no_turbo: limits the driver to selecting P states below the turbo | 26 | no_turbo: limits the driver to selecting P states below the turbo |
24 | frequency range. | 27 | frequency range. |
diff --git a/Documentation/devicetree/bindings/arm/armada-38x.txt b/Documentation/devicetree/bindings/arm/armada-38x.txt index 11f2330a6554..ad9f8ed4d9bd 100644 --- a/Documentation/devicetree/bindings/arm/armada-38x.txt +++ b/Documentation/devicetree/bindings/arm/armada-38x.txt | |||
@@ -6,5 +6,15 @@ following property: | |||
6 | 6 | ||
7 | Required root node property: | 7 | Required root node property: |
8 | 8 | ||
9 | - compatible: must contain either "marvell,armada380" or | 9 | - compatible: must contain "marvell,armada380" |
10 | "marvell,armada385" depending on the variant of the SoC being used. | 10 | |
11 | In addition, boards using the Marvell Armada 385 SoC shall have the | ||
12 | following property before the previous one: | ||
13 | |||
14 | Required root node property: | ||
15 | |||
16 | compatible: must contain "marvell,armada385" | ||
17 | |||
18 | Example: | ||
19 | |||
20 | compatible = "marvell,a385-rd", "marvell,armada385", "marvell,armada380"; | ||
diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt index 5216b419016a..8b4f7b7fe88b 100644 --- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt +++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt | |||
@@ -9,6 +9,18 @@ Required Properties: | |||
9 | - reg: physical base address of the controller and length of memory mapped | 9 | - reg: physical base address of the controller and length of memory mapped |
10 | region. | 10 | region. |
11 | 11 | ||
12 | Optional Properties: | ||
13 | - clocks: List of clock handles. The parent clocks of the input clocks to the | ||
14 | devices in this power domain are set to oscclk before power gating | ||
15 | and restored back after powering on a domain. This is required for | ||
16 | all domains which are powered on and off and not required for unused | ||
17 | domains. | ||
18 | - clock-names: The following clocks can be specified: | ||
19 | - oscclk: Oscillator clock. | ||
20 | - pclkN, clkN: Pairs of parent of input clock and input clock to the | ||
21 | devices in this power domain. Maximum of 4 pairs (N = 0 to 3) | ||
22 | are supported currently. | ||
23 | |||
12 | Node of a device using power domains must have a samsung,power-domain property | 24 | Node of a device using power domains must have a samsung,power-domain property |
13 | defined with a phandle to respective power domain. | 25 | defined with a phandle to respective power domain. |
14 | 26 | ||
@@ -19,6 +31,14 @@ Example: | |||
19 | reg = <0x10023C00 0x10>; | 31 | reg = <0x10023C00 0x10>; |
20 | }; | 32 | }; |
21 | 33 | ||
34 | mfc_pd: power-domain@10044060 { | ||
35 | compatible = "samsung,exynos4210-pd"; | ||
36 | reg = <0x10044060 0x20>; | ||
37 | clocks = <&clock CLK_FIN_PLL>, <&clock CLK_MOUT_SW_ACLK333>, | ||
38 | <&clock CLK_MOUT_USER_ACLK333>; | ||
39 | clock-names = "oscclk", "pclk0", "clk0"; | ||
40 | }; | ||
41 | |||
22 | Example of the node using power domain: | 42 | Example of the node using power domain: |
23 | 43 | ||
24 | node { | 44 | node { |
diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt index b513cb8196fe..af527ee111c2 100644 --- a/Documentation/devicetree/bindings/arm/l2cc.txt +++ b/Documentation/devicetree/bindings/arm/l2cc.txt | |||
@@ -40,6 +40,9 @@ Optional properties: | |||
40 | - arm,filter-ranges : <start length> Starting address and length of window to | 40 | - arm,filter-ranges : <start length> Starting address and length of window to |
41 | filter. Addresses in the filter window are directed to the M1 port. Other | 41 | filter. Addresses in the filter window are directed to the M1 port. Other |
42 | addresses will go to the M0 port. | 42 | addresses will go to the M0 port. |
43 | - arm,io-coherent : indicates that the system is operating in an hardware | ||
44 | I/O coherent mode. Valid only when the arm,pl310-cache compatible | ||
45 | string is used. | ||
43 | - interrupts : 1 combined interrupt. | 46 | - interrupts : 1 combined interrupt. |
44 | - cache-id-part: cache id part number to be used if it is not present | 47 | - cache-id-part: cache id part number to be used if it is not present |
45 | on hardware | 48 | on hardware |
diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt index 5d49f2b37f68..832fe8cc24d7 100644 --- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt +++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt | |||
@@ -48,7 +48,7 @@ adc@12D10000 { | |||
48 | 48 | ||
49 | /* NTC thermistor is a hwmon device */ | 49 | /* NTC thermistor is a hwmon device */ |
50 | ncp15wb473@0 { | 50 | ncp15wb473@0 { |
51 | compatible = "ntc,ncp15wb473"; | 51 | compatible = "murata,ncp15wb473"; |
52 | pullup-uv = <1800000>; | 52 | pullup-uv = <1800000>; |
53 | pullup-ohm = <47000>; | 53 | pullup-ohm = <47000>; |
54 | pulldown-ohm = <0>; | 54 | pulldown-ohm = <0>; |
diff --git a/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt b/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt index c6f66674f19c..b117b2e9e1a7 100644 --- a/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt +++ b/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt | |||
@@ -3,11 +3,19 @@ NTC Thermistor hwmon sensors | |||
3 | 3 | ||
4 | Requires node properties: | 4 | Requires node properties: |
5 | - "compatible" value : one of | 5 | - "compatible" value : one of |
6 | "ntc,ncp15wb473" | 6 | "murata,ncp15wb473" |
7 | "ntc,ncp18wb473" | 7 | "murata,ncp18wb473" |
8 | "ntc,ncp21wb473" | 8 | "murata,ncp21wb473" |
9 | "ntc,ncp03wb473" | 9 | "murata,ncp03wb473" |
10 | "ntc,ncp15wl333" | 10 | "murata,ncp15wl333" |
11 | |||
12 | /* Usage of vendor name "ntc" is deprecated */ | ||
13 | <DEPRECATED> "ntc,ncp15wb473" | ||
14 | <DEPRECATED> "ntc,ncp18wb473" | ||
15 | <DEPRECATED> "ntc,ncp21wb473" | ||
16 | <DEPRECATED> "ntc,ncp03wb473" | ||
17 | <DEPRECATED> "ntc,ncp15wl333" | ||
18 | |||
11 | - "pullup-uv" Pull up voltage in micro volts | 19 | - "pullup-uv" Pull up voltage in micro volts |
12 | - "pullup-ohm" Pull up resistor value in ohms | 20 | - "pullup-ohm" Pull up resistor value in ohms |
13 | - "pulldown-ohm" Pull down resistor value in ohms | 21 | - "pulldown-ohm" Pull down resistor value in ohms |
@@ -21,7 +29,7 @@ Read more about iio bindings at | |||
21 | 29 | ||
22 | Example: | 30 | Example: |
23 | ncp15wb473@0 { | 31 | ncp15wb473@0 { |
24 | compatible = "ntc,ncp15wb473"; | 32 | compatible = "murata,ncp15wb473"; |
25 | pullup-uv = <1800000>; | 33 | pullup-uv = <1800000>; |
26 | pullup-ohm = <47000>; | 34 | pullup-ohm = <47000>; |
27 | pulldown-ohm = <0>; | 35 | pulldown-ohm = <0>; |
diff --git a/Documentation/devicetree/bindings/i2c/i2c-rk3x.txt b/Documentation/devicetree/bindings/i2c/i2c-rk3x.txt new file mode 100644 index 000000000000..dde6c22ce91a --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-rk3x.txt | |||
@@ -0,0 +1,42 @@ | |||
1 | * Rockchip RK3xxx I2C controller | ||
2 | |||
3 | This driver interfaces with the native I2C controller present in Rockchip | ||
4 | RK3xxx SoCs. | ||
5 | |||
6 | Required properties : | ||
7 | |||
8 | - reg : Offset and length of the register set for the device | ||
9 | - compatible : should be "rockchip,rk3066-i2c", "rockchip,rk3188-i2c" or | ||
10 | "rockchip,rk3288-i2c". | ||
11 | - interrupts : interrupt number | ||
12 | - clocks : parent clock | ||
13 | |||
14 | Required on RK3066, RK3188 : | ||
15 | |||
16 | - rockchip,grf : the phandle of the syscon node for the general register | ||
17 | file (GRF) | ||
18 | - on those SoCs an alias with the correct I2C bus ID (bit offset in the GRF) | ||
19 | is also required. | ||
20 | |||
21 | Optional properties : | ||
22 | |||
23 | - clock-frequency : SCL frequency to use (in Hz). If omitted, 100kHz is used. | ||
24 | |||
25 | Example: | ||
26 | |||
27 | aliases { | ||
28 | i2c0 = &i2c0; | ||
29 | } | ||
30 | |||
31 | i2c0: i2c@2002d000 { | ||
32 | compatible = "rockchip,rk3188-i2c"; | ||
33 | reg = <0x2002d000 0x1000>; | ||
34 | interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; | ||
35 | #address-cells = <1>; | ||
36 | #size-cells = <0>; | ||
37 | |||
38 | rockchip,grf = <&grf>; | ||
39 | |||
40 | clock-names = "i2c"; | ||
41 | clocks = <&cru PCLK_I2C0>; | ||
42 | }; | ||
diff --git a/Documentation/devicetree/bindings/i2c/i2c-sunxi-p2wi.txt b/Documentation/devicetree/bindings/i2c/i2c-sunxi-p2wi.txt new file mode 100644 index 000000000000..6b765485af7d --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-sunxi-p2wi.txt | |||
@@ -0,0 +1,41 @@ | |||
1 | |||
2 | * Allwinner P2WI (Push/Pull 2 Wire Interface) controller | ||
3 | |||
4 | Required properties : | ||
5 | |||
6 | - reg : Offset and length of the register set for the device. | ||
7 | - compatible : Should one of the following: | ||
8 | - "allwinner,sun6i-a31-p2wi" | ||
9 | - interrupts : The interrupt line connected to the P2WI peripheral. | ||
10 | - clocks : The gate clk connected to the P2WI peripheral. | ||
11 | - resets : The reset line connected to the P2WI peripheral. | ||
12 | |||
13 | Optional properties : | ||
14 | |||
15 | - clock-frequency : Desired P2WI bus clock frequency in Hz. If not set the | ||
16 | default frequency is 100kHz | ||
17 | |||
18 | A P2WI may contain one child node encoding a P2WI slave device. | ||
19 | |||
20 | Slave device properties: | ||
21 | Required properties: | ||
22 | - reg : the I2C slave address used during the initialization | ||
23 | process to switch from I2C to P2WI mode | ||
24 | |||
25 | Example: | ||
26 | |||
27 | p2wi@01f03400 { | ||
28 | compatible = "allwinner,sun6i-a31-p2wi"; | ||
29 | reg = <0x01f03400 0x400>; | ||
30 | interrupts = <0 39 4>; | ||
31 | clocks = <&apb0_gates 3>; | ||
32 | clock-frequency = <6000000>; | ||
33 | resets = <&apb0_rst 3>; | ||
34 | |||
35 | axp221: pmic@68 { | ||
36 | compatible = "x-powers,axp221"; | ||
37 | reg = <0x68>; | ||
38 | |||
39 | /* ... */ | ||
40 | }; | ||
41 | }; | ||
diff --git a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt index 64fd7dec1bbc..b3556609a06f 100644 --- a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt +++ b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt | |||
@@ -4,6 +4,13 @@ Required properties: | |||
4 | 4 | ||
5 | - compatible: Must contain one of the following: | 5 | - compatible: Must contain one of the following: |
6 | 6 | ||
7 | - "renesas,scifa-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFA compatible UART. | ||
8 | - "renesas,scifb-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFB compatible UART. | ||
9 | - "renesas,scifa-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFA compatible UART. | ||
10 | - "renesas,scifb-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFB compatible UART. | ||
11 | - "renesas,scifa-r8a7740" for R8A7740 (R-Mobile A1) SCIFA compatible UART. | ||
12 | - "renesas,scifb-r8a7740" for R8A7740 (R-Mobile A1) SCIFB compatible UART. | ||
13 | - "renesas,scif-r8a7778" for R8A7778 (R-Car M1) SCIF compatible UART. | ||
7 | - "renesas,scif-r8a7779" for R8A7779 (R-Car H1) SCIF compatible UART. | 14 | - "renesas,scif-r8a7779" for R8A7779 (R-Car H1) SCIF compatible UART. |
8 | - "renesas,scif-r8a7790" for R8A7790 (R-Car H2) SCIF compatible UART. | 15 | - "renesas,scif-r8a7790" for R8A7790 (R-Car H2) SCIF compatible UART. |
9 | - "renesas,scifa-r8a7790" for R8A7790 (R-Car H2) SCIFA compatible UART. | 16 | - "renesas,scifa-r8a7790" for R8A7790 (R-Car H2) SCIFA compatible UART. |
diff --git a/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt index b82a268f1bd4..bee6ff204baf 100644 --- a/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt +++ b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt | |||
@@ -23,6 +23,12 @@ Optional properties: | |||
23 | - spi-max-frequency: Specifies maximum SPI clock frequency, | 23 | - spi-max-frequency: Specifies maximum SPI clock frequency, |
24 | Units - Hz. Definition as per | 24 | Units - Hz. Definition as per |
25 | Documentation/devicetree/bindings/spi/spi-bus.txt | 25 | Documentation/devicetree/bindings/spi/spi-bus.txt |
26 | - num-cs: total number of chipselects | ||
27 | - cs-gpios: should specify GPIOs used for chipselects. | ||
28 | The gpios will be referred to as reg = <index> in the SPI child | ||
29 | nodes. If unspecified, a single SPI device without a chip | ||
30 | select can be used. | ||
31 | |||
26 | 32 | ||
27 | SPI slave nodes must be children of the SPI master node and can contain | 33 | SPI slave nodes must be children of the SPI master node and can contain |
28 | properties described in Documentation/devicetree/bindings/spi/spi-bus.txt | 34 | properties described in Documentation/devicetree/bindings/spi/spi-bus.txt |
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 4d7f3758d1b4..46a311e728a8 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt | |||
@@ -83,6 +83,7 @@ mosaixtech Mosaix Technologies, Inc. | |||
83 | moxa Moxa | 83 | moxa Moxa |
84 | mpl MPL AG | 84 | mpl MPL AG |
85 | mundoreader Mundo Reader S.L. | 85 | mundoreader Mundo Reader S.L. |
86 | murata Murata Manufacturing Co., Ltd. | ||
86 | mxicy Macronix International Co., Ltd. | 87 | mxicy Macronix International Co., Ltd. |
87 | national National Semiconductor | 88 | national National Semiconductor |
88 | neonode Neonode Inc. | 89 | neonode Neonode Inc. |
diff --git a/Documentation/email-clients.txt b/Documentation/email-clients.txt index 4e30ebaa9e5b..9af538be3751 100644 --- a/Documentation/email-clients.txt +++ b/Documentation/email-clients.txt | |||
@@ -1,6 +1,17 @@ | |||
1 | Email clients info for Linux | 1 | Email clients info for Linux |
2 | ====================================================================== | 2 | ====================================================================== |
3 | 3 | ||
4 | Git | ||
5 | ---------------------------------------------------------------------- | ||
6 | These days most developers use `git send-email` instead of regular | ||
7 | email clients. The man page for this is quite good. On the receiving | ||
8 | end, maintainers use `git am` to apply the patches. | ||
9 | |||
10 | If you are new to git then send your first patch to yourself. Save it | ||
11 | as raw text including all the headers. Run `git am raw_email.txt` and | ||
12 | then review the changelog with `git log`. When that works then send | ||
13 | the patch to the appropriate mailing list(s). | ||
14 | |||
4 | General Preferences | 15 | General Preferences |
5 | ---------------------------------------------------------------------- | 16 | ---------------------------------------------------------------------- |
6 | Patches for the Linux kernel are submitted via email, preferably as | 17 | Patches for the Linux kernel are submitted via email, preferably as |
diff --git a/Documentation/hwmon/ntc_thermistor b/Documentation/hwmon/ntc_thermistor index 3bfda94096fd..057b77029f26 100644 --- a/Documentation/hwmon/ntc_thermistor +++ b/Documentation/hwmon/ntc_thermistor | |||
@@ -1,7 +1,7 @@ | |||
1 | Kernel driver ntc_thermistor | 1 | Kernel driver ntc_thermistor |
2 | ================= | 2 | ================= |
3 | 3 | ||
4 | Supported thermistors: | 4 | Supported thermistors from Murata: |
5 | * Murata NTC Thermistors NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, NCP15WL333 | 5 | * Murata NTC Thermistors NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, NCP15WL333 |
6 | Prefixes: 'ncp15wb473', 'ncp18wb473', 'ncp21wb473', 'ncp03wb473', 'ncp15wl333' | 6 | Prefixes: 'ncp15wb473', 'ncp18wb473', 'ncp21wb473', 'ncp03wb473', 'ncp15wl333' |
7 | Datasheet: Publicly available at Murata | 7 | Datasheet: Publicly available at Murata |
@@ -15,9 +15,9 @@ Authors: | |||
15 | Description | 15 | Description |
16 | ----------- | 16 | ----------- |
17 | 17 | ||
18 | The NTC thermistor is a simple thermistor that requires users to provide the | 18 | The NTC (Negative Temperature Coefficient) thermistor is a simple thermistor |
19 | resistance and lookup the corresponding compensation table to get the | 19 | that requires users to provide the resistance and lookup the corresponding |
20 | temperature input. | 20 | compensation table to get the temperature input. |
21 | 21 | ||
22 | The NTC driver provides lookup tables with a linear approximation function | 22 | The NTC driver provides lookup tables with a linear approximation function |
23 | and four circuit models with an option not to use any of the four models. | 23 | and four circuit models with an option not to use any of the four models. |
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index d567a7cc552b..c600e2f44a62 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -1171,7 +1171,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
1171 | obvious reason. | 1171 | obvious reason. |
1172 | 1172 | ||
1173 | dtc | 1173 | dtc |
1174 | Create flattend device tree blob object suitable for linking | 1174 | Create flattened device tree blob object suitable for linking |
1175 | into vmlinux. Device tree blobs linked into vmlinux are placed | 1175 | into vmlinux. Device tree blobs linked into vmlinux are placed |
1176 | in an init section in the image. Platform code *must* copy the | 1176 | in an init section in the image. Platform code *must* copy the |
1177 | blob to non-init memory prior to calling unflatten_device_tree(). | 1177 | blob to non-init memory prior to calling unflatten_device_tree(). |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 6eaa9cdb7094..c1b9aa8c5a52 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1474,6 +1474,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
1474 | js= [HW,JOY] Analog joystick | 1474 | js= [HW,JOY] Analog joystick |
1475 | See Documentation/input/joystick.txt. | 1475 | See Documentation/input/joystick.txt. |
1476 | 1476 | ||
1477 | kaslr/nokaslr [X86] | ||
1478 | Enable/disable kernel and module base offset ASLR | ||
1479 | (Address Space Layout Randomization) if built into | ||
1480 | the kernel. When CONFIG_HIBERNATION is selected, | ||
1481 | kASLR is disabled by default. When kASLR is enabled, | ||
1482 | hibernation will be disabled. | ||
1483 | |||
1477 | keepinitrd [HW,ARM] | 1484 | keepinitrd [HW,ARM] |
1478 | 1485 | ||
1479 | kernelcore=nn[KMG] [KNL,X86,IA-64,PPC] This parameter | 1486 | kernelcore=nn[KMG] [KNL,X86,IA-64,PPC] This parameter |
@@ -2110,10 +2117,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
2110 | noapic [SMP,APIC] Tells the kernel to not make use of any | 2117 | noapic [SMP,APIC] Tells the kernel to not make use of any |
2111 | IOAPICs that may be present in the system. | 2118 | IOAPICs that may be present in the system. |
2112 | 2119 | ||
2113 | nokaslr [X86] | ||
2114 | Disable kernel and module base offset ASLR (Address | ||
2115 | Space Layout Randomization) if built into the kernel. | ||
2116 | |||
2117 | noautogroup Disable scheduler automatic task group creation. | 2120 | noautogroup Disable scheduler automatic task group creation. |
2118 | 2121 | ||
2119 | nobats [PPC] Do not use BATs for mapping kernel lowmem | 2122 | nobats [PPC] Do not use BATs for mapping kernel lowmem |
@@ -2184,6 +2187,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
2184 | in certain environments such as networked servers or | 2187 | in certain environments such as networked servers or |
2185 | real-time systems. | 2188 | real-time systems. |
2186 | 2189 | ||
2190 | nohibernate [HIBERNATION] Disable hibernation and resume. | ||
2191 | |||
2187 | nohz= [KNL] Boottime enable/disable dynamic ticks | 2192 | nohz= [KNL] Boottime enable/disable dynamic ticks |
2188 | Valid arguments: on, off | 2193 | Valid arguments: on, off |
2189 | Default: on | 2194 | Default: on |
@@ -2980,6 +2985,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
2980 | noresume Don't check if there's a hibernation image | 2985 | noresume Don't check if there's a hibernation image |
2981 | present during boot. | 2986 | present during boot. |
2982 | nocompress Don't compress/decompress hibernation images. | 2987 | nocompress Don't compress/decompress hibernation images. |
2988 | no Disable hibernation and resume. | ||
2983 | 2989 | ||
2984 | retain_initrd [RAM] Keep initrd memory after extraction | 2990 | retain_initrd [RAM] Keep initrd memory after extraction |
2985 | 2991 | ||
@@ -3124,6 +3130,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
3124 | [KNL] Should the soft-lockup detector generate panics. | 3130 | [KNL] Should the soft-lockup detector generate panics. |
3125 | Format: <integer> | 3131 | Format: <integer> |
3126 | 3132 | ||
3133 | softlockup_all_cpu_backtrace= | ||
3134 | [KNL] Should the soft-lockup detector generate | ||
3135 | backtraces on all cpus. | ||
3136 | Format: <integer> | ||
3137 | |||
3127 | sonypi.*= [HW] Sony Programmable I/O Control Device driver | 3138 | sonypi.*= [HW] Sony Programmable I/O Control Device driver |
3128 | See Documentation/laptops/sonypi.txt | 3139 | See Documentation/laptops/sonypi.txt |
3129 | 3140 | ||
diff --git a/Documentation/laptops/00-INDEX b/Documentation/laptops/00-INDEX index d13b9a9a9e00..d399ae1fc724 100644 --- a/Documentation/laptops/00-INDEX +++ b/Documentation/laptops/00-INDEX | |||
@@ -8,8 +8,8 @@ disk-shock-protection.txt | |||
8 | - information on hard disk shock protection. | 8 | - information on hard disk shock protection. |
9 | dslm.c | 9 | dslm.c |
10 | - Simple Disk Sleep Monitor program | 10 | - Simple Disk Sleep Monitor program |
11 | hpfall.c | 11 | freefall.c |
12 | - (HP) laptop accelerometer program for disk protection. | 12 | - (HP/DELL) laptop accelerometer program for disk protection. |
13 | laptop-mode.txt | 13 | laptop-mode.txt |
14 | - how to conserve battery power using laptop-mode. | 14 | - how to conserve battery power using laptop-mode. |
15 | sony-laptop.txt | 15 | sony-laptop.txt |
diff --git a/Documentation/laptops/hpfall.c b/Documentation/laptops/freefall.c index b85dbbac0499..aab2ff09e868 100644 --- a/Documentation/laptops/hpfall.c +++ b/Documentation/laptops/freefall.c | |||
@@ -1,7 +1,9 @@ | |||
1 | /* Disk protection for HP machines. | 1 | /* Disk protection for HP/DELL machines. |
2 | * | 2 | * |
3 | * Copyright 2008 Eric Piel | 3 | * Copyright 2008 Eric Piel |
4 | * Copyright 2009 Pavel Machek <pavel@ucw.cz> | 4 | * Copyright 2009 Pavel Machek <pavel@ucw.cz> |
5 | * Copyright 2012 Sonal Santan | ||
6 | * Copyright 2014 Pali Rohár <pali.rohar@gmail.com> | ||
5 | * | 7 | * |
6 | * GPLv2. | 8 | * GPLv2. |
7 | */ | 9 | */ |
@@ -18,24 +20,31 @@ | |||
18 | #include <signal.h> | 20 | #include <signal.h> |
19 | #include <sys/mman.h> | 21 | #include <sys/mman.h> |
20 | #include <sched.h> | 22 | #include <sched.h> |
23 | #include <syslog.h> | ||
21 | 24 | ||
22 | char unload_heads_path[64]; | 25 | static int noled; |
26 | static char unload_heads_path[64]; | ||
27 | static char device_path[32]; | ||
28 | static const char app_name[] = "FREE FALL"; | ||
23 | 29 | ||
24 | int set_unload_heads_path(char *device) | 30 | static int set_unload_heads_path(char *device) |
25 | { | 31 | { |
26 | char devname[64]; | 32 | char devname[64]; |
27 | 33 | ||
28 | if (strlen(device) <= 5 || strncmp(device, "/dev/", 5) != 0) | 34 | if (strlen(device) <= 5 || strncmp(device, "/dev/", 5) != 0) |
29 | return -EINVAL; | 35 | return -EINVAL; |
30 | strncpy(devname, device + 5, sizeof(devname)); | 36 | strncpy(devname, device + 5, sizeof(devname) - 1); |
37 | strncpy(device_path, device, sizeof(device_path) - 1); | ||
31 | 38 | ||
32 | snprintf(unload_heads_path, sizeof(unload_heads_path) - 1, | 39 | snprintf(unload_heads_path, sizeof(unload_heads_path) - 1, |
33 | "/sys/block/%s/device/unload_heads", devname); | 40 | "/sys/block/%s/device/unload_heads", devname); |
34 | return 0; | 41 | return 0; |
35 | } | 42 | } |
36 | int valid_disk(void) | 43 | |
44 | static int valid_disk(void) | ||
37 | { | 45 | { |
38 | int fd = open(unload_heads_path, O_RDONLY); | 46 | int fd = open(unload_heads_path, O_RDONLY); |
47 | |||
39 | if (fd < 0) { | 48 | if (fd < 0) { |
40 | perror(unload_heads_path); | 49 | perror(unload_heads_path); |
41 | return 0; | 50 | return 0; |
@@ -45,43 +54,54 @@ int valid_disk(void) | |||
45 | return 1; | 54 | return 1; |
46 | } | 55 | } |
47 | 56 | ||
48 | void write_int(char *path, int i) | 57 | static void write_int(char *path, int i) |
49 | { | 58 | { |
50 | char buf[1024]; | 59 | char buf[1024]; |
51 | int fd = open(path, O_RDWR); | 60 | int fd = open(path, O_RDWR); |
61 | |||
52 | if (fd < 0) { | 62 | if (fd < 0) { |
53 | perror("open"); | 63 | perror("open"); |
54 | exit(1); | 64 | exit(1); |
55 | } | 65 | } |
66 | |||
56 | sprintf(buf, "%d", i); | 67 | sprintf(buf, "%d", i); |
68 | |||
57 | if (write(fd, buf, strlen(buf)) != strlen(buf)) { | 69 | if (write(fd, buf, strlen(buf)) != strlen(buf)) { |
58 | perror("write"); | 70 | perror("write"); |
59 | exit(1); | 71 | exit(1); |
60 | } | 72 | } |
73 | |||
61 | close(fd); | 74 | close(fd); |
62 | } | 75 | } |
63 | 76 | ||
64 | void set_led(int on) | 77 | static void set_led(int on) |
65 | { | 78 | { |
79 | if (noled) | ||
80 | return; | ||
66 | write_int("/sys/class/leds/hp::hddprotect/brightness", on); | 81 | write_int("/sys/class/leds/hp::hddprotect/brightness", on); |
67 | } | 82 | } |
68 | 83 | ||
69 | void protect(int seconds) | 84 | static void protect(int seconds) |
70 | { | 85 | { |
86 | const char *str = (seconds == 0) ? "Unparked" : "Parked"; | ||
87 | |||
71 | write_int(unload_heads_path, seconds*1000); | 88 | write_int(unload_heads_path, seconds*1000); |
89 | syslog(LOG_INFO, "%s %s disk head\n", str, device_path); | ||
72 | } | 90 | } |
73 | 91 | ||
74 | int on_ac(void) | 92 | static int on_ac(void) |
75 | { | 93 | { |
76 | // /sys/class/power_supply/AC0/online | 94 | /* /sys/class/power_supply/AC0/online */ |
95 | return 1; | ||
77 | } | 96 | } |
78 | 97 | ||
79 | int lid_open(void) | 98 | static int lid_open(void) |
80 | { | 99 | { |
81 | // /proc/acpi/button/lid/LID/state | 100 | /* /proc/acpi/button/lid/LID/state */ |
101 | return 1; | ||
82 | } | 102 | } |
83 | 103 | ||
84 | void ignore_me(void) | 104 | static void ignore_me(int signum) |
85 | { | 105 | { |
86 | protect(0); | 106 | protect(0); |
87 | set_led(0); | 107 | set_led(0); |
@@ -90,6 +110,7 @@ void ignore_me(void) | |||
90 | int main(int argc, char **argv) | 110 | int main(int argc, char **argv) |
91 | { | 111 | { |
92 | int fd, ret; | 112 | int fd, ret; |
113 | struct stat st; | ||
93 | struct sched_param param; | 114 | struct sched_param param; |
94 | 115 | ||
95 | if (argc == 1) | 116 | if (argc == 1) |
@@ -111,7 +132,16 @@ int main(int argc, char **argv) | |||
111 | return EXIT_FAILURE; | 132 | return EXIT_FAILURE; |
112 | } | 133 | } |
113 | 134 | ||
114 | daemon(0, 0); | 135 | if (stat("/sys/class/leds/hp::hddprotect/brightness", &st)) |
136 | noled = 1; | ||
137 | |||
138 | if (daemon(0, 0) != 0) { | ||
139 | perror("daemon"); | ||
140 | return EXIT_FAILURE; | ||
141 | } | ||
142 | |||
143 | openlog(app_name, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); | ||
144 | |||
115 | param.sched_priority = sched_get_priority_max(SCHED_FIFO); | 145 | param.sched_priority = sched_get_priority_max(SCHED_FIFO); |
116 | sched_setscheduler(0, SCHED_FIFO, ¶m); | 146 | sched_setscheduler(0, SCHED_FIFO, ¶m); |
117 | mlockall(MCL_CURRENT|MCL_FUTURE); | 147 | mlockall(MCL_CURRENT|MCL_FUTURE); |
@@ -141,6 +171,7 @@ int main(int argc, char **argv) | |||
141 | alarm(20); | 171 | alarm(20); |
142 | } | 172 | } |
143 | 173 | ||
174 | closelog(); | ||
144 | close(fd); | 175 | close(fd); |
145 | return EXIT_SUCCESS; | 176 | return EXIT_SUCCESS; |
146 | } | 177 | } |
diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt index f304edb8fbe7..45134dc23854 100644 --- a/Documentation/memory-hotplug.txt +++ b/Documentation/memory-hotplug.txt | |||
@@ -209,15 +209,12 @@ If memory device is found, memory hotplug code will be called. | |||
209 | 209 | ||
210 | 4.2 Notify memory hot-add event by hand | 210 | 4.2 Notify memory hot-add event by hand |
211 | ------------ | 211 | ------------ |
212 | On powerpc, the firmware does not notify a memory hotplug event to the kernel. | 212 | On some architectures, the firmware may not notify the kernel of a memory |
213 | Therefore, "probe" interface is supported to notify the event to the kernel. | 213 | hotplug event. Therefore, the memory "probe" interface is supported to |
214 | This interface depends on CONFIG_ARCH_MEMORY_PROBE. | 214 | explicitly notify the kernel. This interface depends on |
215 | 215 | CONFIG_ARCH_MEMORY_PROBE and can be configured on powerpc, sh, and x86 | |
216 | CONFIG_ARCH_MEMORY_PROBE is supported on powerpc only. On x86, this config | 216 | if hotplug is supported, although for x86 this should be handled by ACPI |
217 | option is disabled by default since ACPI notifies a memory hotplug event to | 217 | notification. |
218 | the kernel, which performs its hotplug operation as the result. Please | ||
219 | enable this option if you need the "probe" interface for testing purposes | ||
220 | on x86. | ||
221 | 218 | ||
222 | Probe interface is located at | 219 | Probe interface is located at |
223 | /sys/devices/system/memory/probe | 220 | /sys/devices/system/memory/probe |
diff --git a/Documentation/ptp/testptp.c b/Documentation/ptp/testptp.c index f1ac2dae999e..ba1d50200c46 100644 --- a/Documentation/ptp/testptp.c +++ b/Documentation/ptp/testptp.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | */ | 19 | */ |
20 | #define _GNU_SOURCE | ||
20 | #include <errno.h> | 21 | #include <errno.h> |
21 | #include <fcntl.h> | 22 | #include <fcntl.h> |
22 | #include <inttypes.h> | 23 | #include <inttypes.h> |
@@ -46,12 +47,14 @@ | |||
46 | #define CLOCK_INVALID -1 | 47 | #define CLOCK_INVALID -1 |
47 | #endif | 48 | #endif |
48 | 49 | ||
49 | /* When glibc offers the syscall, this will go away. */ | 50 | /* clock_adjtime is not available in GLIBC < 2.14 */ |
51 | #if !__GLIBC_PREREQ(2, 14) | ||
50 | #include <sys/syscall.h> | 52 | #include <sys/syscall.h> |
51 | static int clock_adjtime(clockid_t id, struct timex *tx) | 53 | static int clock_adjtime(clockid_t id, struct timex *tx) |
52 | { | 54 | { |
53 | return syscall(__NR_clock_adjtime, id, tx); | 55 | return syscall(__NR_clock_adjtime, id, tx); |
54 | } | 56 | } |
57 | #endif | ||
55 | 58 | ||
56 | static clockid_t get_clockid(int fd) | 59 | static clockid_t get_clockid(int fd) |
57 | { | 60 | { |
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 85c362d8ea34..d1ab5e17eb13 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt | |||
@@ -286,6 +286,11 @@ STAC92HD83* | |||
286 | hp-inv-led HP with broken BIOS for inverted mute LED | 286 | hp-inv-led HP with broken BIOS for inverted mute LED |
287 | auto BIOS setup (default) | 287 | auto BIOS setup (default) |
288 | 288 | ||
289 | STAC92HD95 | ||
290 | ========== | ||
291 | hp-led LED support for HP laptops | ||
292 | hp-bass Bass HPF setup for HP Spectre 13 | ||
293 | |||
289 | STAC9872 | 294 | STAC9872 |
290 | ======== | 295 | ======== |
291 | vaio VAIO laptop without SPDIF | 296 | vaio VAIO laptop without SPDIF |
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt index 708bb7f1b7e0..c14374e71775 100644 --- a/Documentation/sysctl/kernel.txt +++ b/Documentation/sysctl/kernel.txt | |||
@@ -75,6 +75,7 @@ show up in /proc/sys/kernel: | |||
75 | - shmall | 75 | - shmall |
76 | - shmmax [ sysv ipc ] | 76 | - shmmax [ sysv ipc ] |
77 | - shmmni | 77 | - shmmni |
78 | - softlockup_all_cpu_backtrace | ||
78 | - stop-a [ SPARC only ] | 79 | - stop-a [ SPARC only ] |
79 | - sysrq ==> Documentation/sysrq.txt | 80 | - sysrq ==> Documentation/sysrq.txt |
80 | - sysctl_writes_strict | 81 | - sysctl_writes_strict |
@@ -783,6 +784,22 @@ via the /proc/sys interface: | |||
783 | 784 | ||
784 | ============================================================== | 785 | ============================================================== |
785 | 786 | ||
787 | softlockup_all_cpu_backtrace: | ||
788 | |||
789 | This value controls the soft lockup detector thread's behavior | ||
790 | when a soft lockup condition is detected as to whether or not | ||
791 | to gather further debug information. If enabled, each cpu will | ||
792 | be issued an NMI and instructed to capture stack trace. | ||
793 | |||
794 | This feature is only applicable for architectures which support | ||
795 | NMI. | ||
796 | |||
797 | 0: do nothing. This is the default behavior. | ||
798 | |||
799 | 1: on detection capture more debug information. | ||
800 | |||
801 | ============================================================== | ||
802 | |||
786 | tainted: | 803 | tainted: |
787 | 804 | ||
788 | Non-zero if the kernel has been tainted. Numeric values, which | 805 | Non-zero if the kernel has been tainted. Numeric values, which |
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index bd4b34c03738..4415aa915681 100644 --- a/Documentation/sysctl/vm.txt +++ b/Documentation/sysctl/vm.txt | |||
@@ -702,7 +702,8 @@ The batch value of each per cpu pagelist is also updated as a result. It is | |||
702 | set to pcp->high/4. The upper limit of batch is (PAGE_SHIFT * 8) | 702 | set to pcp->high/4. The upper limit of batch is (PAGE_SHIFT * 8) |
703 | 703 | ||
704 | The initial value is zero. Kernel does not use this value at boot time to set | 704 | The initial value is zero. Kernel does not use this value at boot time to set |
705 | the high water marks for each per cpu page list. | 705 | the high water marks for each per cpu page list. If the user writes '0' to this |
706 | sysctl, it will revert to this default behavior. | ||
706 | 707 | ||
707 | ============================================================== | 708 | ============================================================== |
708 | 709 | ||
diff --git a/Documentation/thermal/nouveau_thermal b/Documentation/thermal/nouveau_thermal index efceb7828f54..60bc29357ac3 100644 --- a/Documentation/thermal/nouveau_thermal +++ b/Documentation/thermal/nouveau_thermal | |||
@@ -4,7 +4,7 @@ Kernel driver nouveau | |||
4 | Supported chips: | 4 | Supported chips: |
5 | * NV43+ | 5 | * NV43+ |
6 | 6 | ||
7 | Authors: Martin Peres (mupuf) <martin.peres@labri.fr> | 7 | Authors: Martin Peres (mupuf) <martin.peres@free.fr> |
8 | 8 | ||
9 | Description | 9 | Description |
10 | --------- | 10 | --------- |
@@ -68,8 +68,9 @@ Your fan can be driven in different modes: | |||
68 | 68 | ||
69 | NOTE: Be sure to use the manual mode if you want to drive the fan speed manually | 69 | NOTE: Be sure to use the manual mode if you want to drive the fan speed manually |
70 | 70 | ||
71 | NOTE2: Not all fan management modes may be supported on all chipsets. We are | 71 | NOTE2: When operating in manual mode outside the vbios-defined |
72 | working on it. | 72 | [PWM_min, PWM_max] range, the reported fan speed (RPM) may not be accurate |
73 | depending on your hardware. | ||
73 | 74 | ||
74 | Bug reports | 75 | Bug reports |
75 | --------- | 76 | --------- |
diff --git a/Documentation/trace/postprocess/trace-vmscan-postprocess.pl b/Documentation/trace/postprocess/trace-vmscan-postprocess.pl index 00e425faa2fd..78c9a7b2b58f 100644 --- a/Documentation/trace/postprocess/trace-vmscan-postprocess.pl +++ b/Documentation/trace/postprocess/trace-vmscan-postprocess.pl | |||
@@ -47,7 +47,6 @@ use constant HIGH_KSWAPD_REWAKEUP => 21; | |||
47 | use constant HIGH_NR_SCANNED => 22; | 47 | use constant HIGH_NR_SCANNED => 22; |
48 | use constant HIGH_NR_TAKEN => 23; | 48 | use constant HIGH_NR_TAKEN => 23; |
49 | use constant HIGH_NR_RECLAIMED => 24; | 49 | use constant HIGH_NR_RECLAIMED => 24; |
50 | use constant HIGH_NR_CONTIG_DIRTY => 25; | ||
51 | 50 | ||
52 | my %perprocesspid; | 51 | my %perprocesspid; |
53 | my %perprocess; | 52 | my %perprocess; |
@@ -105,7 +104,7 @@ my $regex_direct_end_default = 'nr_reclaimed=([0-9]*)'; | |||
105 | my $regex_kswapd_wake_default = 'nid=([0-9]*) order=([0-9]*)'; | 104 | my $regex_kswapd_wake_default = 'nid=([0-9]*) order=([0-9]*)'; |
106 | my $regex_kswapd_sleep_default = 'nid=([0-9]*)'; | 105 | my $regex_kswapd_sleep_default = 'nid=([0-9]*)'; |
107 | my $regex_wakeup_kswapd_default = 'nid=([0-9]*) zid=([0-9]*) order=([0-9]*)'; | 106 | my $regex_wakeup_kswapd_default = 'nid=([0-9]*) zid=([0-9]*) order=([0-9]*)'; |
108 | my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_taken=([0-9]*) contig_taken=([0-9]*) contig_dirty=([0-9]*) contig_failed=([0-9]*)'; | 107 | my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_taken=([0-9]*) file=([0-9]*)'; |
109 | my $regex_lru_shrink_inactive_default = 'nid=([0-9]*) zid=([0-9]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) priority=([0-9]*) flags=([A-Z_|]*)'; | 108 | my $regex_lru_shrink_inactive_default = 'nid=([0-9]*) zid=([0-9]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) priority=([0-9]*) flags=([A-Z_|]*)'; |
110 | my $regex_lru_shrink_active_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_rotated=([0-9]*) priority=([0-9]*)'; | 109 | my $regex_lru_shrink_active_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_rotated=([0-9]*) priority=([0-9]*)'; |
111 | my $regex_writepage_default = 'page=([0-9a-f]*) pfn=([0-9]*) flags=([A-Z_|]*)'; | 110 | my $regex_writepage_default = 'page=([0-9a-f]*) pfn=([0-9]*) flags=([A-Z_|]*)'; |
@@ -200,7 +199,7 @@ $regex_lru_isolate = generate_traceevent_regex( | |||
200 | $regex_lru_isolate_default, | 199 | $regex_lru_isolate_default, |
201 | "isolate_mode", "order", | 200 | "isolate_mode", "order", |
202 | "nr_requested", "nr_scanned", "nr_taken", | 201 | "nr_requested", "nr_scanned", "nr_taken", |
203 | "contig_taken", "contig_dirty", "contig_failed"); | 202 | "file"); |
204 | $regex_lru_shrink_inactive = generate_traceevent_regex( | 203 | $regex_lru_shrink_inactive = generate_traceevent_regex( |
205 | "vmscan/mm_vmscan_lru_shrink_inactive", | 204 | "vmscan/mm_vmscan_lru_shrink_inactive", |
206 | $regex_lru_shrink_inactive_default, | 205 | $regex_lru_shrink_inactive_default, |
@@ -375,7 +374,6 @@ EVENT_PROCESS: | |||
375 | } | 374 | } |
376 | my $isolate_mode = $1; | 375 | my $isolate_mode = $1; |
377 | my $nr_scanned = $4; | 376 | my $nr_scanned = $4; |
378 | my $nr_contig_dirty = $7; | ||
379 | 377 | ||
380 | # To closer match vmstat scanning statistics, only count isolate_both | 378 | # To closer match vmstat scanning statistics, only count isolate_both |
381 | # and isolate_inactive as scanning. isolate_active is rotation | 379 | # and isolate_inactive as scanning. isolate_active is rotation |
@@ -385,7 +383,6 @@ EVENT_PROCESS: | |||
385 | if ($isolate_mode != 2) { | 383 | if ($isolate_mode != 2) { |
386 | $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned; | 384 | $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned; |
387 | } | 385 | } |
388 | $perprocesspid{$process_pid}->{HIGH_NR_CONTIG_DIRTY} += $nr_contig_dirty; | ||
389 | } elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") { | 386 | } elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") { |
390 | $details = $6; | 387 | $details = $6; |
391 | if ($details !~ /$regex_lru_shrink_inactive/o) { | 388 | if ($details !~ /$regex_lru_shrink_inactive/o) { |
@@ -539,13 +536,6 @@ sub dump_stats { | |||
539 | } | 536 | } |
540 | } | 537 | } |
541 | } | 538 | } |
542 | if ($stats{$process_pid}->{HIGH_NR_CONTIG_DIRTY}) { | ||
543 | print " "; | ||
544 | my $count = $stats{$process_pid}->{HIGH_NR_CONTIG_DIRTY}; | ||
545 | if ($count != 0) { | ||
546 | print "contig-dirty=$count "; | ||
547 | } | ||
548 | } | ||
549 | 539 | ||
550 | print "\n"; | 540 | print "\n"; |
551 | } | 541 | } |
diff --git a/MAINTAINERS b/MAINTAINERS index 134483f206e4..e31c87474739 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -943,16 +943,10 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | |||
943 | S: Maintained | 943 | S: Maintained |
944 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git | 944 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git |
945 | F: arch/arm/mach-imx/ | 945 | F: arch/arm/mach-imx/ |
946 | F: arch/arm/mach-mxs/ | ||
946 | F: arch/arm/boot/dts/imx* | 947 | F: arch/arm/boot/dts/imx* |
947 | F: arch/arm/configs/imx*_defconfig | 948 | F: arch/arm/configs/imx*_defconfig |
948 | 949 | ||
949 | ARM/FREESCALE MXS ARM ARCHITECTURE | ||
950 | M: Shawn Guo <shawn.guo@linaro.org> | ||
951 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
952 | S: Maintained | ||
953 | T: git git://git.linaro.org/people/shawnguo/linux-2.6.git | ||
954 | F: arch/arm/mach-mxs/ | ||
955 | |||
956 | ARM/GLOMATION GESBC9312SX MACHINE SUPPORT | 950 | ARM/GLOMATION GESBC9312SX MACHINE SUPPORT |
957 | M: Lennert Buytenhek <kernel@wantstofly.org> | 951 | M: Lennert Buytenhek <kernel@wantstofly.org> |
958 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 952 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
@@ -1052,9 +1046,33 @@ M: Santosh Shilimkar <santosh.shilimkar@ti.com> | |||
1052 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1046 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1053 | S: Maintained | 1047 | S: Maintained |
1054 | F: arch/arm/mach-keystone/ | 1048 | F: arch/arm/mach-keystone/ |
1055 | F: drivers/clk/keystone/ | ||
1056 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git | 1049 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git |
1057 | 1050 | ||
1051 | ARM/TEXAS INSTRUMENT KEYSTONE CLOCK FRAMEWORK | ||
1052 | M: Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
1053 | L: linux-kernel@vger.kernel.org | ||
1054 | S: Maintained | ||
1055 | F: drivers/clk/keystone/ | ||
1056 | |||
1057 | ARM/TEXAS INSTRUMENT KEYSTONE ClOCKSOURCE | ||
1058 | M: Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
1059 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
1060 | L: linux-kernel@vger.kernel.org | ||
1061 | S: Maintained | ||
1062 | F: drivers/clocksource/timer-keystone.c | ||
1063 | |||
1064 | ARM/TEXAS INSTRUMENT KEYSTONE RESET DRIVER | ||
1065 | M: Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
1066 | L: linux-kernel@vger.kernel.org | ||
1067 | S: Maintained | ||
1068 | F: drivers/power/reset/keystone-reset.c | ||
1069 | |||
1070 | ARM/TEXAS INSTRUMENT AEMIF/EMIF DRIVERS | ||
1071 | M: Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
1072 | L: linux-kernel@vger.kernel.org | ||
1073 | S: Maintained | ||
1074 | F: drivers/memory/*emif* | ||
1075 | |||
1058 | ARM/LOGICPD PXA270 MACHINE SUPPORT | 1076 | ARM/LOGICPD PXA270 MACHINE SUPPORT |
1059 | M: Lennert Buytenhek <kernel@wantstofly.org> | 1077 | M: Lennert Buytenhek <kernel@wantstofly.org> |
1060 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1078 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
@@ -1296,6 +1314,20 @@ W: http://oss.renesas.com | |||
1296 | Q: http://patchwork.kernel.org/project/linux-sh/list/ | 1314 | Q: http://patchwork.kernel.org/project/linux-sh/list/ |
1297 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git next | 1315 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git next |
1298 | S: Supported | 1316 | S: Supported |
1317 | F: arch/arm/boot/dts/emev2* | ||
1318 | F: arch/arm/boot/dts/r7s* | ||
1319 | F: arch/arm/boot/dts/r8a* | ||
1320 | F: arch/arm/boot/dts/sh* | ||
1321 | F: arch/arm/configs/ape6evm_defconfig | ||
1322 | F: arch/arm/configs/armadillo800eva_defconfig | ||
1323 | F: arch/arm/configs/bockw_defconfig | ||
1324 | F: arch/arm/configs/genmai_defconfig | ||
1325 | F: arch/arm/configs/koelsch_defconfig | ||
1326 | F: arch/arm/configs/kzm9g_defconfig | ||
1327 | F: arch/arm/configs/lager_defconfig | ||
1328 | F: arch/arm/configs/mackerel_defconfig | ||
1329 | F: arch/arm/configs/marzen_defconfig | ||
1330 | F: arch/arm/configs/shmobile_defconfig | ||
1299 | F: arch/arm/mach-shmobile/ | 1331 | F: arch/arm/mach-shmobile/ |
1300 | F: drivers/sh/ | 1332 | F: drivers/sh/ |
1301 | 1333 | ||
@@ -2917,6 +2949,9 @@ L: linux-doc@vger.kernel.org | |||
2917 | T: quilt http://www.infradead.org/~rdunlap/Doc/patches/ | 2949 | T: quilt http://www.infradead.org/~rdunlap/Doc/patches/ |
2918 | S: Maintained | 2950 | S: Maintained |
2919 | F: Documentation/ | 2951 | F: Documentation/ |
2952 | X: Documentation/ABI/ | ||
2953 | X: Documentation/devicetree/ | ||
2954 | X: Documentation/[a-z][a-z]_[A-Z][A-Z]/ | ||
2920 | 2955 | ||
2921 | DOUBLETALK DRIVER | 2956 | DOUBLETALK DRIVER |
2922 | M: "James R. Van Zandt" <jrv@vanzandt.mv.com> | 2957 | M: "James R. Van Zandt" <jrv@vanzandt.mv.com> |
@@ -3189,14 +3224,6 @@ L: linux-scsi@vger.kernel.org | |||
3189 | S: Maintained | 3224 | S: Maintained |
3190 | F: drivers/scsi/eata_pio.* | 3225 | F: drivers/scsi/eata_pio.* |
3191 | 3226 | ||
3192 | EBTABLES | ||
3193 | L: netfilter-devel@vger.kernel.org | ||
3194 | W: http://ebtables.sourceforge.net/ | ||
3195 | S: Orphan | ||
3196 | F: include/linux/netfilter_bridge/ebt_*.h | ||
3197 | F: include/uapi/linux/netfilter_bridge/ebt_*.h | ||
3198 | F: net/bridge/netfilter/ebt*.c | ||
3199 | |||
3200 | EC100 MEDIA DRIVER | 3227 | EC100 MEDIA DRIVER |
3201 | M: Antti Palosaari <crope@iki.fi> | 3228 | M: Antti Palosaari <crope@iki.fi> |
3202 | L: linux-media@vger.kernel.org | 3229 | L: linux-media@vger.kernel.org |
@@ -5517,10 +5544,11 @@ S: Maintained | |||
5517 | F: arch/arm/mach-lpc32xx/ | 5544 | F: arch/arm/mach-lpc32xx/ |
5518 | 5545 | ||
5519 | LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) | 5546 | LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) |
5520 | M: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com> | 5547 | M: Nagalakshmi Nandigama <nagalakshmi.nandigama@avagotech.com> |
5521 | M: Sreekanth Reddy <Sreekanth.Reddy@lsi.com> | 5548 | M: Praveen Krishnamoorthy <praveen.krishnamoorthy@avagotech.com> |
5522 | M: support@lsi.com | 5549 | M: Sreekanth Reddy <sreekanth.reddy@avagotech.com> |
5523 | L: DL-MPTFusionLinux@lsi.com | 5550 | M: Abhijit Mahajan <abhijit.mahajan@avagotech.com> |
5551 | L: MPT-FusionLinux.pdl@avagotech.com | ||
5524 | L: linux-scsi@vger.kernel.org | 5552 | L: linux-scsi@vger.kernel.org |
5525 | W: http://www.lsilogic.com/support | 5553 | W: http://www.lsilogic.com/support |
5526 | S: Supported | 5554 | S: Supported |
@@ -6105,12 +6133,11 @@ F: Documentation/networking/s2io.txt | |||
6105 | F: Documentation/networking/vxge.txt | 6133 | F: Documentation/networking/vxge.txt |
6106 | F: drivers/net/ethernet/neterion/ | 6134 | F: drivers/net/ethernet/neterion/ |
6107 | 6135 | ||
6108 | NETFILTER/IPTABLES | 6136 | NETFILTER ({IP,IP6,ARP,EB,NF}TABLES) |
6109 | M: Pablo Neira Ayuso <pablo@netfilter.org> | 6137 | M: Pablo Neira Ayuso <pablo@netfilter.org> |
6110 | M: Patrick McHardy <kaber@trash.net> | 6138 | M: Patrick McHardy <kaber@trash.net> |
6111 | M: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 6139 | M: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> |
6112 | L: netfilter-devel@vger.kernel.org | 6140 | L: netfilter-devel@vger.kernel.org |
6113 | L: netfilter@vger.kernel.org | ||
6114 | L: coreteam@netfilter.org | 6141 | L: coreteam@netfilter.org |
6115 | W: http://www.netfilter.org/ | 6142 | W: http://www.netfilter.org/ |
6116 | W: http://www.iptables.org/ | 6143 | W: http://www.iptables.org/ |
@@ -6774,7 +6801,7 @@ F: arch/x86/kernel/quirks.c | |||
6774 | 6801 | ||
6775 | PCI DRIVER FOR IMX6 | 6802 | PCI DRIVER FOR IMX6 |
6776 | M: Richard Zhu <r65037@freescale.com> | 6803 | M: Richard Zhu <r65037@freescale.com> |
6777 | M: Shawn Guo <shawn.guo@linaro.org> | 6804 | M: Shawn Guo <shawn.guo@freescale.com> |
6778 | L: linux-pci@vger.kernel.org | 6805 | L: linux-pci@vger.kernel.org |
6779 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 6806 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
6780 | S: Maintained | 6807 | S: Maintained |
@@ -6960,7 +6987,7 @@ PKUNITY SOC DRIVERS | |||
6960 | M: Guan Xuetao <gxt@mprc.pku.edu.cn> | 6987 | M: Guan Xuetao <gxt@mprc.pku.edu.cn> |
6961 | W: http://mprc.pku.edu.cn/~guanxuetao/linux | 6988 | W: http://mprc.pku.edu.cn/~guanxuetao/linux |
6962 | S: Maintained | 6989 | S: Maintained |
6963 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/epip/linux-2.6-unicore32.git | 6990 | T: git git://github.com/gxt/linux.git |
6964 | F: drivers/input/serio/i8042-unicore32io.h | 6991 | F: drivers/input/serio/i8042-unicore32io.h |
6965 | F: drivers/i2c/busses/i2c-puv3.c | 6992 | F: drivers/i2c/busses/i2c-puv3.c |
6966 | F: drivers/video/fb-puv3.c | 6993 | F: drivers/video/fb-puv3.c |
@@ -7948,6 +7975,7 @@ F: drivers/mmc/host/sdhci-spear.c | |||
7948 | 7975 | ||
7949 | SECURITY SUBSYSTEM | 7976 | SECURITY SUBSYSTEM |
7950 | M: James Morris <james.l.morris@oracle.com> | 7977 | M: James Morris <james.l.morris@oracle.com> |
7978 | M: Serge E. Hallyn <serge@hallyn.com> | ||
7951 | L: linux-security-module@vger.kernel.org (suggested Cc:) | 7979 | L: linux-security-module@vger.kernel.org (suggested Cc:) |
7952 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git | 7980 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git |
7953 | W: http://kernsec.org/ | 7981 | W: http://kernsec.org/ |
@@ -8195,13 +8223,15 @@ S: Maintained | |||
8195 | F: drivers/usb/misc/sisusbvga/ | 8223 | F: drivers/usb/misc/sisusbvga/ |
8196 | 8224 | ||
8197 | SLAB ALLOCATOR | 8225 | SLAB ALLOCATOR |
8198 | M: Christoph Lameter <cl@linux-foundation.org> | 8226 | M: Christoph Lameter <cl@linux.com> |
8199 | M: Pekka Enberg <penberg@kernel.org> | 8227 | M: Pekka Enberg <penberg@kernel.org> |
8200 | M: Matt Mackall <mpm@selenic.com> | 8228 | M: David Rientjes <rientjes@google.com> |
8229 | M: Joonsoo Kim <iamjoonsoo.kim@lge.com> | ||
8230 | M: Andrew Morton <akpm@linux-foundation.org> | ||
8201 | L: linux-mm@kvack.org | 8231 | L: linux-mm@kvack.org |
8202 | S: Maintained | 8232 | S: Maintained |
8203 | F: include/linux/sl?b*.h | 8233 | F: include/linux/sl?b*.h |
8204 | F: mm/sl?b.c | 8234 | F: mm/sl?b* |
8205 | 8235 | ||
8206 | SLEEPABLE READ-COPY UPDATE (SRCU) | 8236 | SLEEPABLE READ-COPY UPDATE (SRCU) |
8207 | M: Lai Jiangshan <laijs@cn.fujitsu.com> | 8237 | M: Lai Jiangshan <laijs@cn.fujitsu.com> |
@@ -8968,7 +8998,7 @@ F: drivers/media/radio/radio-raremono.c | |||
8968 | 8998 | ||
8969 | THERMAL | 8999 | THERMAL |
8970 | M: Zhang Rui <rui.zhang@intel.com> | 9000 | M: Zhang Rui <rui.zhang@intel.com> |
8971 | M: Eduardo Valentin <eduardo.valentin@ti.com> | 9001 | M: Eduardo Valentin <edubezval@gmail.com> |
8972 | L: linux-pm@vger.kernel.org | 9002 | L: linux-pm@vger.kernel.org |
8973 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git | 9003 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git |
8974 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git | 9004 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git |
@@ -8995,7 +9025,7 @@ S: Maintained | |||
8995 | F: drivers/platform/x86/thinkpad_acpi.c | 9025 | F: drivers/platform/x86/thinkpad_acpi.c |
8996 | 9026 | ||
8997 | TI BANDGAP AND THERMAL DRIVER | 9027 | TI BANDGAP AND THERMAL DRIVER |
8998 | M: Eduardo Valentin <eduardo.valentin@ti.com> | 9028 | M: Eduardo Valentin <edubezval@gmail.com> |
8999 | L: linux-pm@vger.kernel.org | 9029 | L: linux-pm@vger.kernel.org |
9000 | S: Supported | 9030 | S: Supported |
9001 | F: drivers/thermal/ti-soc-thermal/ | 9031 | F: drivers/thermal/ti-soc-thermal/ |
@@ -9276,7 +9306,7 @@ UNICORE32 ARCHITECTURE: | |||
9276 | M: Guan Xuetao <gxt@mprc.pku.edu.cn> | 9306 | M: Guan Xuetao <gxt@mprc.pku.edu.cn> |
9277 | W: http://mprc.pku.edu.cn/~guanxuetao/linux | 9307 | W: http://mprc.pku.edu.cn/~guanxuetao/linux |
9278 | S: Maintained | 9308 | S: Maintained |
9279 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/epip/linux-2.6-unicore32.git | 9309 | T: git git://github.com/gxt/linux.git |
9280 | F: arch/unicore32/ | 9310 | F: arch/unicore32/ |
9281 | 9311 | ||
9282 | UNIFDEF | 9312 | UNIFDEF |
@@ -9409,12 +9439,6 @@ S: Maintained | |||
9409 | F: drivers/usb/host/isp116x* | 9439 | F: drivers/usb/host/isp116x* |
9410 | F: include/linux/usb/isp116x.h | 9440 | F: include/linux/usb/isp116x.h |
9411 | 9441 | ||
9412 | USB KAWASAKI LSI DRIVER | ||
9413 | M: Oliver Neukum <oliver@neukum.org> | ||
9414 | L: linux-usb@vger.kernel.org | ||
9415 | S: Maintained | ||
9416 | F: drivers/usb/serial/kl5kusb105.* | ||
9417 | |||
9418 | USB MASS STORAGE DRIVER | 9442 | USB MASS STORAGE DRIVER |
9419 | M: Matthew Dharm <mdharm-usb@one-eyed-alien.net> | 9443 | M: Matthew Dharm <mdharm-usb@one-eyed-alien.net> |
9420 | L: linux-usb@vger.kernel.org | 9444 | L: linux-usb@vger.kernel.org |
@@ -9442,12 +9466,6 @@ S: Maintained | |||
9442 | F: Documentation/usb/ohci.txt | 9466 | F: Documentation/usb/ohci.txt |
9443 | F: drivers/usb/host/ohci* | 9467 | F: drivers/usb/host/ohci* |
9444 | 9468 | ||
9445 | USB OPTION-CARD DRIVER | ||
9446 | M: Matthias Urlichs <smurf@smurf.noris.de> | ||
9447 | L: linux-usb@vger.kernel.org | ||
9448 | S: Maintained | ||
9449 | F: drivers/usb/serial/option.c | ||
9450 | |||
9451 | USB PEGASUS DRIVER | 9469 | USB PEGASUS DRIVER |
9452 | M: Petko Manolov <petkan@nucleusys.com> | 9470 | M: Petko Manolov <petkan@nucleusys.com> |
9453 | L: linux-usb@vger.kernel.org | 9471 | L: linux-usb@vger.kernel.org |
@@ -9480,7 +9498,7 @@ S: Maintained | |||
9480 | F: drivers/net/usb/rtl8150.c | 9498 | F: drivers/net/usb/rtl8150.c |
9481 | 9499 | ||
9482 | USB SERIAL SUBSYSTEM | 9500 | USB SERIAL SUBSYSTEM |
9483 | M: Johan Hovold <jhovold@gmail.com> | 9501 | M: Johan Hovold <johan@kernel.org> |
9484 | L: linux-usb@vger.kernel.org | 9502 | L: linux-usb@vger.kernel.org |
9485 | S: Maintained | 9503 | S: Maintained |
9486 | F: Documentation/usb/usb-serial.txt | 9504 | F: Documentation/usb/usb-serial.txt |
@@ -9743,6 +9761,14 @@ L: virtualization@lists.linux-foundation.org | |||
9743 | S: Supported | 9761 | S: Supported |
9744 | F: arch/x86/kernel/cpu/vmware.c | 9762 | F: arch/x86/kernel/cpu/vmware.c |
9745 | 9763 | ||
9764 | VMWARE BALLOON DRIVER | ||
9765 | M: Xavier Deguillard <xdeguillard@vmware.com> | ||
9766 | M: Philip Moltmann <moltmann@vmware.com> | ||
9767 | M: "VMware, Inc." <pv-drivers@vmware.com> | ||
9768 | L: linux-kernel@vger.kernel.org | ||
9769 | S: Maintained | ||
9770 | F: drivers/misc/vmw_balloon.c | ||
9771 | |||
9746 | VMWARE VMXNET3 ETHERNET DRIVER | 9772 | VMWARE VMXNET3 ETHERNET DRIVER |
9747 | M: Shreyas Bhatewara <sbhatewara@vmware.com> | 9773 | M: Shreyas Bhatewara <sbhatewara@vmware.com> |
9748 | M: "VMware, Inc." <pv-drivers@vmware.com> | 9774 | M: "VMware, Inc." <pv-drivers@vmware.com> |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 16 | 2 | PATCHLEVEL = 16 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc1 | 4 | EXTRAVERSION = -rc5 |
5 | NAME = Shuffling Zombie Juror | 5 | NAME = Shuffling Zombie Juror |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -41,6 +41,29 @@ unexport GREP_OPTIONS | |||
41 | # descending is started. They are now explicitly listed as the | 41 | # descending is started. They are now explicitly listed as the |
42 | # prepare rule. | 42 | # prepare rule. |
43 | 43 | ||
44 | # Beautify output | ||
45 | # --------------------------------------------------------------------------- | ||
46 | # | ||
47 | # Normally, we echo the whole command before executing it. By making | ||
48 | # that echo $($(quiet)$(cmd)), we now have the possibility to set | ||
49 | # $(quiet) to choose other forms of output instead, e.g. | ||
50 | # | ||
51 | # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ | ||
52 | # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | ||
53 | # | ||
54 | # If $(quiet) is empty, the whole command will be printed. | ||
55 | # If it is set to "quiet_", only the short version will be printed. | ||
56 | # If it is set to "silent_", nothing will be printed at all, since | ||
57 | # the variable $(silent_cmd_cc_o_c) doesn't exist. | ||
58 | # | ||
59 | # A simple variant is to prefix commands with $(Q) - that's useful | ||
60 | # for commands that shall be hidden in non-verbose mode. | ||
61 | # | ||
62 | # $(Q)ln $@ :< | ||
63 | # | ||
64 | # If KBUILD_VERBOSE equals 0 then the above command will be hidden. | ||
65 | # If KBUILD_VERBOSE equals 1 then the above command is displayed. | ||
66 | # | ||
44 | # To put more focus on warnings, be less verbose as default | 67 | # To put more focus on warnings, be less verbose as default |
45 | # Use 'make V=1' to see the full commands | 68 | # Use 'make V=1' to see the full commands |
46 | 69 | ||
@@ -51,6 +74,29 @@ ifndef KBUILD_VERBOSE | |||
51 | KBUILD_VERBOSE = 0 | 74 | KBUILD_VERBOSE = 0 |
52 | endif | 75 | endif |
53 | 76 | ||
77 | ifeq ($(KBUILD_VERBOSE),1) | ||
78 | quiet = | ||
79 | Q = | ||
80 | else | ||
81 | quiet=quiet_ | ||
82 | Q = @ | ||
83 | endif | ||
84 | |||
85 | # If the user is running make -s (silent mode), suppress echoing of | ||
86 | # commands | ||
87 | |||
88 | ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 | ||
89 | ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) | ||
90 | quiet=silent_ | ||
91 | endif | ||
92 | else # make-3.8x | ||
93 | ifneq ($(filter s% -s%,$(MAKEFLAGS)),) | ||
94 | quiet=silent_ | ||
95 | endif | ||
96 | endif | ||
97 | |||
98 | export quiet Q KBUILD_VERBOSE | ||
99 | |||
54 | # Call a source code checker (by default, "sparse") as part of the | 100 | # Call a source code checker (by default, "sparse") as part of the |
55 | # C compilation. | 101 | # C compilation. |
56 | # | 102 | # |
@@ -126,7 +172,13 @@ PHONY += $(MAKECMDGOALS) sub-make | |||
126 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make | 172 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make |
127 | @: | 173 | @: |
128 | 174 | ||
175 | # Fake the "Entering directory" message once, so that IDEs/editors are | ||
176 | # able to understand relative filenames. | ||
177 | echodir := @echo | ||
178 | quiet_echodir := @echo | ||
179 | silent_echodir := @: | ||
129 | sub-make: FORCE | 180 | sub-make: FORCE |
181 | $($(quiet)echodir) "make[1]: Entering directory \`$(KBUILD_OUTPUT)'" | ||
130 | $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ | 182 | $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ |
131 | KBUILD_SRC=$(CURDIR) \ | 183 | KBUILD_SRC=$(CURDIR) \ |
132 | KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ | 184 | KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ |
@@ -289,52 +341,6 @@ endif | |||
289 | export KBUILD_MODULES KBUILD_BUILTIN | 341 | export KBUILD_MODULES KBUILD_BUILTIN |
290 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD | 342 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD |
291 | 343 | ||
292 | # Beautify output | ||
293 | # --------------------------------------------------------------------------- | ||
294 | # | ||
295 | # Normally, we echo the whole command before executing it. By making | ||
296 | # that echo $($(quiet)$(cmd)), we now have the possibility to set | ||
297 | # $(quiet) to choose other forms of output instead, e.g. | ||
298 | # | ||
299 | # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ | ||
300 | # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | ||
301 | # | ||
302 | # If $(quiet) is empty, the whole command will be printed. | ||
303 | # If it is set to "quiet_", only the short version will be printed. | ||
304 | # If it is set to "silent_", nothing will be printed at all, since | ||
305 | # the variable $(silent_cmd_cc_o_c) doesn't exist. | ||
306 | # | ||
307 | # A simple variant is to prefix commands with $(Q) - that's useful | ||
308 | # for commands that shall be hidden in non-verbose mode. | ||
309 | # | ||
310 | # $(Q)ln $@ :< | ||
311 | # | ||
312 | # If KBUILD_VERBOSE equals 0 then the above command will be hidden. | ||
313 | # If KBUILD_VERBOSE equals 1 then the above command is displayed. | ||
314 | |||
315 | ifeq ($(KBUILD_VERBOSE),1) | ||
316 | quiet = | ||
317 | Q = | ||
318 | else | ||
319 | quiet=quiet_ | ||
320 | Q = @ | ||
321 | endif | ||
322 | |||
323 | # If the user is running make -s (silent mode), suppress echoing of | ||
324 | # commands | ||
325 | |||
326 | ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 | ||
327 | ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) | ||
328 | quiet=silent_ | ||
329 | endif | ||
330 | else # make-3.8x | ||
331 | ifneq ($(filter s% -s%,$(MAKEFLAGS)),) | ||
332 | quiet=silent_ | ||
333 | endif | ||
334 | endif | ||
335 | |||
336 | export quiet Q KBUILD_VERBOSE | ||
337 | |||
338 | ifneq ($(CC),) | 344 | ifneq ($(CC),) |
339 | ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) | 345 | ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) |
340 | COMPILER := clang | 346 | COMPILER := clang |
@@ -1170,7 +1176,7 @@ distclean: mrproper | |||
1170 | # Packaging of the kernel to various formats | 1176 | # Packaging of the kernel to various formats |
1171 | # --------------------------------------------------------------------------- | 1177 | # --------------------------------------------------------------------------- |
1172 | # rpm target kept for backward compatibility | 1178 | # rpm target kept for backward compatibility |
1173 | package-dir := $(srctree)/scripts/package | 1179 | package-dir := scripts/package |
1174 | 1180 | ||
1175 | %src-pkg: FORCE | 1181 | %src-pkg: FORCE |
1176 | $(Q)$(MAKE) $(build)=$(package-dir) $@ | 1182 | $(Q)$(MAKE) $(build)=$(package-dir) $@ |
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h index c1d3d2da1191..b3c750979aa1 100644 --- a/arch/arc/include/asm/cache.h +++ b/arch/arc/include/asm/cache.h | |||
@@ -60,7 +60,7 @@ extern void read_decode_cache_bcr(void); | |||
60 | #define ARC_REG_IC_IVIC 0x10 | 60 | #define ARC_REG_IC_IVIC 0x10 |
61 | #define ARC_REG_IC_CTRL 0x11 | 61 | #define ARC_REG_IC_CTRL 0x11 |
62 | #define ARC_REG_IC_IVIL 0x19 | 62 | #define ARC_REG_IC_IVIL 0x19 |
63 | #if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4) | 63 | #if defined(CONFIG_ARC_MMU_V3) |
64 | #define ARC_REG_IC_PTAG 0x1E | 64 | #define ARC_REG_IC_PTAG 0x1E |
65 | #endif | 65 | #endif |
66 | 66 | ||
@@ -74,7 +74,7 @@ extern void read_decode_cache_bcr(void); | |||
74 | #define ARC_REG_DC_IVDL 0x4A | 74 | #define ARC_REG_DC_IVDL 0x4A |
75 | #define ARC_REG_DC_FLSH 0x4B | 75 | #define ARC_REG_DC_FLSH 0x4B |
76 | #define ARC_REG_DC_FLDL 0x4C | 76 | #define ARC_REG_DC_FLDL 0x4C |
77 | #if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4) | 77 | #if defined(CONFIG_ARC_MMU_V3) |
78 | #define ARC_REG_DC_PTAG 0x5C | 78 | #define ARC_REG_DC_PTAG 0x5C |
79 | #endif | 79 | #endif |
80 | 80 | ||
diff --git a/arch/arc/include/uapi/asm/ptrace.h b/arch/arc/include/uapi/asm/ptrace.h index 2618cc13ba75..76a7739aab1c 100644 --- a/arch/arc/include/uapi/asm/ptrace.h +++ b/arch/arc/include/uapi/asm/ptrace.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #ifndef _UAPI__ASM_ARC_PTRACE_H | 11 | #ifndef _UAPI__ASM_ARC_PTRACE_H |
12 | #define _UAPI__ASM_ARC_PTRACE_H | 12 | #define _UAPI__ASM_ARC_PTRACE_H |
13 | 13 | ||
14 | #define PTRACE_GET_THREAD_AREA 25 | ||
14 | 15 | ||
15 | #ifndef __ASSEMBLY__ | 16 | #ifndef __ASSEMBLY__ |
16 | /* | 17 | /* |
diff --git a/arch/arc/kernel/ctx_sw_asm.S b/arch/arc/kernel/ctx_sw_asm.S index 2ff0347a2fd7..e248594097e7 100644 --- a/arch/arc/kernel/ctx_sw_asm.S +++ b/arch/arc/kernel/ctx_sw_asm.S | |||
@@ -10,9 +10,9 @@ | |||
10 | * -This is the more "natural" hand written assembler | 10 | * -This is the more "natural" hand written assembler |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/linkage.h> | ||
13 | #include <asm/entry.h> /* For the SAVE_* macros */ | 14 | #include <asm/entry.h> /* For the SAVE_* macros */ |
14 | #include <asm/asm-offsets.h> | 15 | #include <asm/asm-offsets.h> |
15 | #include <asm/linkage.h> | ||
16 | 16 | ||
17 | #define KSP_WORD_OFF ((TASK_THREAD + THREAD_KSP) / 4) | 17 | #define KSP_WORD_OFF ((TASK_THREAD + THREAD_KSP) / 4) |
18 | 18 | ||
diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c index 0b3ef4025d89..fffdb5e41b20 100644 --- a/arch/arc/kernel/devtree.c +++ b/arch/arc/kernel/devtree.c | |||
@@ -41,7 +41,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt) | |||
41 | { | 41 | { |
42 | const struct machine_desc *mdesc; | 42 | const struct machine_desc *mdesc; |
43 | unsigned long dt_root; | 43 | unsigned long dt_root; |
44 | void *clk; | 44 | const void *clk; |
45 | int len; | 45 | int len; |
46 | 46 | ||
47 | if (!early_init_dt_scan(dt)) | 47 | if (!early_init_dt_scan(dt)) |
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S index 07a58f2d3077..4d2481bd8b98 100644 --- a/arch/arc/kernel/head.S +++ b/arch/arc/kernel/head.S | |||
@@ -77,10 +77,11 @@ stext: | |||
77 | ; Clear BSS before updating any globals | 77 | ; Clear BSS before updating any globals |
78 | ; XXX: use ZOL here | 78 | ; XXX: use ZOL here |
79 | mov r5, __bss_start | 79 | mov r5, __bss_start |
80 | mov r6, __bss_stop | 80 | sub r6, __bss_stop, r5 |
81 | lsr.f lp_count, r6, 2 | ||
82 | lpnz 1f | ||
83 | st.ab 0, [r5, 4] | ||
81 | 1: | 84 | 1: |
82 | st.ab 0, [r5,4] | ||
83 | brlt r5, r6, 1b | ||
84 | 85 | ||
85 | ; Uboot - kernel ABI | 86 | ; Uboot - kernel ABI |
86 | ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 | 87 | ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 |
diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c index 5d76706139dd..13b3ffb27a38 100644 --- a/arch/arc/kernel/ptrace.c +++ b/arch/arc/kernel/ptrace.c | |||
@@ -146,6 +146,10 @@ long arch_ptrace(struct task_struct *child, long request, | |||
146 | pr_debug("REQ=%ld: ADDR =0x%lx, DATA=0x%lx)\n", request, addr, data); | 146 | pr_debug("REQ=%ld: ADDR =0x%lx, DATA=0x%lx)\n", request, addr, data); |
147 | 147 | ||
148 | switch (request) { | 148 | switch (request) { |
149 | case PTRACE_GET_THREAD_AREA: | ||
150 | ret = put_user(task_thread_info(child)->thr_ptr, | ||
151 | (unsigned long __user *)data); | ||
152 | break; | ||
149 | default: | 153 | default: |
150 | ret = ptrace_request(child, request, addr, data); | 154 | ret = ptrace_request(child, request, addr, data); |
151 | break; | 155 | break; |
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c index cf90b6f4d3e0..c802bb500602 100644 --- a/arch/arc/kernel/smp.c +++ b/arch/arc/kernel/smp.c | |||
@@ -337,8 +337,19 @@ irqreturn_t do_IPI(int irq, void *dev_id) | |||
337 | * API called by platform code to hookup arch-common ISR to their IPI IRQ | 337 | * API called by platform code to hookup arch-common ISR to their IPI IRQ |
338 | */ | 338 | */ |
339 | static DEFINE_PER_CPU(int, ipi_dev); | 339 | static DEFINE_PER_CPU(int, ipi_dev); |
340 | |||
341 | static struct irqaction arc_ipi_irq = { | ||
342 | .name = "IPI Interrupt", | ||
343 | .flags = IRQF_PERCPU, | ||
344 | .handler = do_IPI, | ||
345 | }; | ||
346 | |||
340 | int smp_ipi_irq_setup(int cpu, int irq) | 347 | int smp_ipi_irq_setup(int cpu, int irq) |
341 | { | 348 | { |
342 | int *dev_id = &per_cpu(ipi_dev, smp_processor_id()); | 349 | if (!cpu) |
343 | return request_percpu_irq(irq, do_IPI, "IPI Interrupt", dev_id); | 350 | return setup_irq(irq, &arc_ipi_irq); |
351 | else | ||
352 | arch_unmask_irq(irq); | ||
353 | |||
354 | return 0; | ||
344 | } | 355 | } |
diff --git a/arch/arc/kernel/vmlinux.lds.S b/arch/arc/kernel/vmlinux.lds.S index 2555f5886af6..dd35bde39f69 100644 --- a/arch/arc/kernel/vmlinux.lds.S +++ b/arch/arc/kernel/vmlinux.lds.S | |||
@@ -116,7 +116,7 @@ SECTIONS | |||
116 | 116 | ||
117 | _edata = .; | 117 | _edata = .; |
118 | 118 | ||
119 | BSS_SECTION(0, 0, 0) | 119 | BSS_SECTION(4, 4, 4) |
120 | 120 | ||
121 | #ifdef CONFIG_ARC_DW2_UNWIND | 121 | #ifdef CONFIG_ARC_DW2_UNWIND |
122 | . = ALIGN(PAGE_SIZE); | 122 | . = ALIGN(PAGE_SIZE); |
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c index 1f676c4794e0..353b202c37c9 100644 --- a/arch/arc/mm/cache_arc700.c +++ b/arch/arc/mm/cache_arc700.c | |||
@@ -389,7 +389,7 @@ static inline void __dc_line_op(unsigned long paddr, unsigned long vaddr, | |||
389 | /*********************************************************** | 389 | /*********************************************************** |
390 | * Machine specific helper for per line I-Cache invalidate. | 390 | * Machine specific helper for per line I-Cache invalidate. |
391 | */ | 391 | */ |
392 | static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr, | 392 | static void __ic_line_inv_vaddr_local(unsigned long paddr, unsigned long vaddr, |
393 | unsigned long sz) | 393 | unsigned long sz) |
394 | { | 394 | { |
395 | unsigned long flags; | 395 | unsigned long flags; |
@@ -405,6 +405,23 @@ static inline void __ic_entire_inv(void) | |||
405 | read_aux_reg(ARC_REG_IC_CTRL); /* blocks */ | 405 | read_aux_reg(ARC_REG_IC_CTRL); /* blocks */ |
406 | } | 406 | } |
407 | 407 | ||
408 | struct ic_line_inv_vaddr_ipi { | ||
409 | unsigned long paddr, vaddr; | ||
410 | int sz; | ||
411 | }; | ||
412 | |||
413 | static void __ic_line_inv_vaddr_helper(void *info) | ||
414 | { | ||
415 | struct ic_line_inv_vaddr_ipi *ic_inv = (struct ic_line_inv_vaddr_ipi*) info; | ||
416 | __ic_line_inv_vaddr_local(ic_inv->paddr, ic_inv->vaddr, ic_inv->sz); | ||
417 | } | ||
418 | |||
419 | static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr, | ||
420 | unsigned long sz) | ||
421 | { | ||
422 | struct ic_line_inv_vaddr_ipi ic_inv = { paddr, vaddr , sz}; | ||
423 | on_each_cpu(__ic_line_inv_vaddr_helper, &ic_inv, 1); | ||
424 | } | ||
408 | #else | 425 | #else |
409 | 426 | ||
410 | #define __ic_entire_inv() | 427 | #define __ic_entire_inv() |
@@ -553,12 +570,8 @@ void flush_icache_range(unsigned long kstart, unsigned long kend) | |||
553 | */ | 570 | */ |
554 | void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len) | 571 | void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len) |
555 | { | 572 | { |
556 | unsigned long flags; | ||
557 | |||
558 | local_irq_save(flags); | ||
559 | __ic_line_inv_vaddr(paddr, vaddr, len); | ||
560 | __dc_line_op(paddr, vaddr, len, OP_FLUSH_N_INV); | 573 | __dc_line_op(paddr, vaddr, len, OP_FLUSH_N_INV); |
561 | local_irq_restore(flags); | 574 | __ic_line_inv_vaddr(paddr, vaddr, len); |
562 | } | 575 | } |
563 | 576 | ||
564 | /* wrapper to compile time eliminate alignment checks in flush loop */ | 577 | /* wrapper to compile time eliminate alignment checks in flush loop */ |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 87b63fde06d7..245058b3b0ef 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -175,13 +175,6 @@ config ARCH_HAS_ILOG2_U32 | |||
175 | config ARCH_HAS_ILOG2_U64 | 175 | config ARCH_HAS_ILOG2_U64 |
176 | bool | 176 | bool |
177 | 177 | ||
178 | config ARCH_HAS_CPUFREQ | ||
179 | bool | ||
180 | help | ||
181 | Internal node to signify that the ARCH has CPUFREQ support | ||
182 | and that the relevant menu configurations are displayed for | ||
183 | it. | ||
184 | |||
185 | config ARCH_HAS_BANDGAP | 178 | config ARCH_HAS_BANDGAP |
186 | bool | 179 | bool |
187 | 180 | ||
@@ -318,7 +311,6 @@ config ARCH_MULTIPLATFORM | |||
318 | 311 | ||
319 | config ARCH_INTEGRATOR | 312 | config ARCH_INTEGRATOR |
320 | bool "ARM Ltd. Integrator family" | 313 | bool "ARM Ltd. Integrator family" |
321 | select ARCH_HAS_CPUFREQ | ||
322 | select ARM_AMBA | 314 | select ARM_AMBA |
323 | select ARM_PATCH_PHYS_VIRT | 315 | select ARM_PATCH_PHYS_VIRT |
324 | select AUTO_ZRELADDR | 316 | select AUTO_ZRELADDR |
@@ -538,7 +530,6 @@ config ARCH_DOVE | |||
538 | 530 | ||
539 | config ARCH_KIRKWOOD | 531 | config ARCH_KIRKWOOD |
540 | bool "Marvell Kirkwood" | 532 | bool "Marvell Kirkwood" |
541 | select ARCH_HAS_CPUFREQ | ||
542 | select ARCH_REQUIRE_GPIOLIB | 533 | select ARCH_REQUIRE_GPIOLIB |
543 | select CPU_FEROCEON | 534 | select CPU_FEROCEON |
544 | select GENERIC_CLOCKEVENTS | 535 | select GENERIC_CLOCKEVENTS |
@@ -637,7 +628,6 @@ config ARCH_LPC32XX | |||
637 | config ARCH_PXA | 628 | config ARCH_PXA |
638 | bool "PXA2xx/PXA3xx-based" | 629 | bool "PXA2xx/PXA3xx-based" |
639 | depends on MMU | 630 | depends on MMU |
640 | select ARCH_HAS_CPUFREQ | ||
641 | select ARCH_MTD_XIP | 631 | select ARCH_MTD_XIP |
642 | select ARCH_REQUIRE_GPIOLIB | 632 | select ARCH_REQUIRE_GPIOLIB |
643 | select ARM_CPU_SUSPEND if PM | 633 | select ARM_CPU_SUSPEND if PM |
@@ -707,7 +697,6 @@ config ARCH_RPC | |||
707 | 697 | ||
708 | config ARCH_SA1100 | 698 | config ARCH_SA1100 |
709 | bool "SA1100-based" | 699 | bool "SA1100-based" |
710 | select ARCH_HAS_CPUFREQ | ||
711 | select ARCH_MTD_XIP | 700 | select ARCH_MTD_XIP |
712 | select ARCH_REQUIRE_GPIOLIB | 701 | select ARCH_REQUIRE_GPIOLIB |
713 | select ARCH_SPARSEMEM_ENABLE | 702 | select ARCH_SPARSEMEM_ENABLE |
@@ -725,7 +714,6 @@ config ARCH_SA1100 | |||
725 | 714 | ||
726 | config ARCH_S3C24XX | 715 | config ARCH_S3C24XX |
727 | bool "Samsung S3C24XX SoCs" | 716 | bool "Samsung S3C24XX SoCs" |
728 | select ARCH_HAS_CPUFREQ | ||
729 | select ARCH_REQUIRE_GPIOLIB | 717 | select ARCH_REQUIRE_GPIOLIB |
730 | select ATAGS | 718 | select ATAGS |
731 | select CLKDEV_LOOKUP | 719 | select CLKDEV_LOOKUP |
@@ -746,7 +734,6 @@ config ARCH_S3C24XX | |||
746 | 734 | ||
747 | config ARCH_S3C64XX | 735 | config ARCH_S3C64XX |
748 | bool "Samsung S3C64XX" | 736 | bool "Samsung S3C64XX" |
749 | select ARCH_HAS_CPUFREQ | ||
750 | select ARCH_REQUIRE_GPIOLIB | 737 | select ARCH_REQUIRE_GPIOLIB |
751 | select ARM_AMBA | 738 | select ARM_AMBA |
752 | select ARM_VIC | 739 | select ARM_VIC |
@@ -809,7 +796,6 @@ config ARCH_S5PC100 | |||
809 | 796 | ||
810 | config ARCH_S5PV210 | 797 | config ARCH_S5PV210 |
811 | bool "Samsung S5PV210/S5PC110" | 798 | bool "Samsung S5PV210/S5PC110" |
812 | select ARCH_HAS_CPUFREQ | ||
813 | select ARCH_HAS_HOLES_MEMORYMODEL | 799 | select ARCH_HAS_HOLES_MEMORYMODEL |
814 | select ARCH_SPARSEMEM_ENABLE | 800 | select ARCH_SPARSEMEM_ENABLE |
815 | select ATAGS | 801 | select ATAGS |
@@ -845,7 +831,6 @@ config ARCH_DAVINCI | |||
845 | config ARCH_OMAP1 | 831 | config ARCH_OMAP1 |
846 | bool "TI OMAP1" | 832 | bool "TI OMAP1" |
847 | depends on MMU | 833 | depends on MMU |
848 | select ARCH_HAS_CPUFREQ | ||
849 | select ARCH_HAS_HOLES_MEMORYMODEL | 834 | select ARCH_HAS_HOLES_MEMORYMODEL |
850 | select ARCH_OMAP | 835 | select ARCH_OMAP |
851 | select ARCH_REQUIRE_GPIOLIB | 836 | select ARCH_REQUIRE_GPIOLIB |
@@ -1009,8 +994,6 @@ source "arch/arm/mach-rockchip/Kconfig" | |||
1009 | 994 | ||
1010 | source "arch/arm/mach-sa1100/Kconfig" | 995 | source "arch/arm/mach-sa1100/Kconfig" |
1011 | 996 | ||
1012 | source "arch/arm/plat-samsung/Kconfig" | ||
1013 | |||
1014 | source "arch/arm/mach-socfpga/Kconfig" | 997 | source "arch/arm/mach-socfpga/Kconfig" |
1015 | 998 | ||
1016 | source "arch/arm/mach-spear/Kconfig" | 999 | source "arch/arm/mach-spear/Kconfig" |
@@ -1028,6 +1011,7 @@ source "arch/arm/mach-s5pc100/Kconfig" | |||
1028 | source "arch/arm/mach-s5pv210/Kconfig" | 1011 | source "arch/arm/mach-s5pv210/Kconfig" |
1029 | 1012 | ||
1030 | source "arch/arm/mach-exynos/Kconfig" | 1013 | source "arch/arm/mach-exynos/Kconfig" |
1014 | source "arch/arm/plat-samsung/Kconfig" | ||
1031 | 1015 | ||
1032 | source "arch/arm/mach-shmobile/Kconfig" | 1016 | source "arch/arm/mach-shmobile/Kconfig" |
1033 | 1017 | ||
@@ -2109,9 +2093,7 @@ endmenu | |||
2109 | 2093 | ||
2110 | menu "CPU Power Management" | 2094 | menu "CPU Power Management" |
2111 | 2095 | ||
2112 | if ARCH_HAS_CPUFREQ | ||
2113 | source "drivers/cpufreq/Kconfig" | 2096 | source "drivers/cpufreq/Kconfig" |
2114 | endif | ||
2115 | 2097 | ||
2116 | source "drivers/cpuidle/Kconfig" | 2098 | source "drivers/cpuidle/Kconfig" |
2117 | 2099 | ||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 5986ff63b901..adb5ed9e269e 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -357,7 +357,7 @@ dtb-$(CONFIG_ARCH_STI)+= stih407-b2120.dtb \ | |||
357 | stih415-b2020.dtb \ | 357 | stih415-b2020.dtb \ |
358 | stih416-b2000.dtb \ | 358 | stih416-b2000.dtb \ |
359 | stih416-b2020.dtb \ | 359 | stih416-b2020.dtb \ |
360 | stih416-b2020-revE.dtb | 360 | stih416-b2020e.dtb |
361 | dtb-$(CONFIG_MACH_SUN4I) += \ | 361 | dtb-$(CONFIG_MACH_SUN4I) += \ |
362 | sun4i-a10-a1000.dtb \ | 362 | sun4i-a10-a1000.dtb \ |
363 | sun4i-a10-cubieboard.dtb \ | 363 | sun4i-a10-cubieboard.dtb \ |
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index ecb267767cf5..e2156a583de7 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts | |||
@@ -529,8 +529,8 @@ | |||
529 | serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ | 529 | serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ |
530 | 0 0 1 2 | 530 | 0 0 1 2 |
531 | >; | 531 | >; |
532 | tx-num-evt = <1>; | 532 | tx-num-evt = <32>; |
533 | rx-num-evt = <1>; | 533 | rx-num-evt = <32>; |
534 | }; | 534 | }; |
535 | 535 | ||
536 | &tps { | 536 | &tps { |
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts index ab9a34ce524c..80a3b215e7d6 100644 --- a/arch/arm/boot/dts/am335x-evmsk.dts +++ b/arch/arm/boot/dts/am335x-evmsk.dts | |||
@@ -560,8 +560,8 @@ | |||
560 | serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ | 560 | serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ |
561 | 0 0 1 2 | 561 | 0 0 1 2 |
562 | >; | 562 | >; |
563 | tx-num-evt = <1>; | 563 | tx-num-evt = <32>; |
564 | rx-num-evt = <1>; | 564 | rx-num-evt = <32>; |
565 | }; | 565 | }; |
566 | 566 | ||
567 | &tscadc { | 567 | &tscadc { |
diff --git a/arch/arm/boot/dts/am335x-igep0033.dtsi b/arch/arm/boot/dts/am335x-igep0033.dtsi index 8a0a72dc7dd7..a1a0cc5eb35c 100644 --- a/arch/arm/boot/dts/am335x-igep0033.dtsi +++ b/arch/arm/boot/dts/am335x-igep0033.dtsi | |||
@@ -105,10 +105,16 @@ | |||
105 | 105 | ||
106 | &cpsw_emac0 { | 106 | &cpsw_emac0 { |
107 | phy_id = <&davinci_mdio>, <0>; | 107 | phy_id = <&davinci_mdio>, <0>; |
108 | phy-mode = "rmii"; | ||
108 | }; | 109 | }; |
109 | 110 | ||
110 | &cpsw_emac1 { | 111 | &cpsw_emac1 { |
111 | phy_id = <&davinci_mdio>, <1>; | 112 | phy_id = <&davinci_mdio>, <1>; |
113 | phy-mode = "rmii"; | ||
114 | }; | ||
115 | |||
116 | &phy_sel { | ||
117 | rmii-clock-ext; | ||
112 | }; | 118 | }; |
113 | 119 | ||
114 | &elm { | 120 | &elm { |
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts index 19f1f7e87597..90098f98a5c8 100644 --- a/arch/arm/boot/dts/am43x-epos-evm.dts +++ b/arch/arm/boot/dts/am43x-epos-evm.dts | |||
@@ -319,6 +319,10 @@ | |||
319 | phy-mode = "rmii"; | 319 | phy-mode = "rmii"; |
320 | }; | 320 | }; |
321 | 321 | ||
322 | &phy_sel { | ||
323 | rmii-clock-ext; | ||
324 | }; | ||
325 | |||
322 | &i2c0 { | 326 | &i2c0 { |
323 | status = "okay"; | 327 | status = "okay"; |
324 | pinctrl-names = "default"; | 328 | pinctrl-names = "default"; |
diff --git a/arch/arm/boot/dts/armada-375-db.dts b/arch/arm/boot/dts/armada-375-db.dts index 772fec2d26ce..1e2919d43d78 100644 --- a/arch/arm/boot/dts/armada-375-db.dts +++ b/arch/arm/boot/dts/armada-375-db.dts | |||
@@ -91,6 +91,8 @@ | |||
91 | marvell,nand-keep-config; | 91 | marvell,nand-keep-config; |
92 | marvell,nand-enable-arbiter; | 92 | marvell,nand-enable-arbiter; |
93 | nand-on-flash-bbt; | 93 | nand-on-flash-bbt; |
94 | nand-ecc-strength = <4>; | ||
95 | nand-ecc-step-size = <512>; | ||
94 | 96 | ||
95 | partition@0 { | 97 | partition@0 { |
96 | label = "U-Boot"; | 98 | label = "U-Boot"; |
diff --git a/arch/arm/boot/dts/armada-380.dtsi b/arch/arm/boot/dts/armada-380.dtsi index e69bc6759c39..4173a8ab34e7 100644 --- a/arch/arm/boot/dts/armada-380.dtsi +++ b/arch/arm/boot/dts/armada-380.dtsi | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | / { | 17 | / { |
18 | model = "Marvell Armada 380 family SoC"; | 18 | model = "Marvell Armada 380 family SoC"; |
19 | compatible = "marvell,armada380", "marvell,armada38x"; | 19 | compatible = "marvell,armada380"; |
20 | 20 | ||
21 | cpus { | 21 | cpus { |
22 | #address-cells = <1>; | 22 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/armada-385-db.dts b/arch/arm/boot/dts/armada-385-db.dts index ff9637dd8d0f..1af886f1e486 100644 --- a/arch/arm/boot/dts/armada-385-db.dts +++ b/arch/arm/boot/dts/armada-385-db.dts | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | / { | 17 | / { |
18 | model = "Marvell Armada 385 Development Board"; | 18 | model = "Marvell Armada 385 Development Board"; |
19 | compatible = "marvell,a385-db", "marvell,armada385", "marvell,armada38x"; | 19 | compatible = "marvell,a385-db", "marvell,armada385", "marvell,armada380"; |
20 | 20 | ||
21 | chosen { | 21 | chosen { |
22 | bootargs = "console=ttyS0,115200 earlyprintk"; | 22 | bootargs = "console=ttyS0,115200 earlyprintk"; |
@@ -98,6 +98,8 @@ | |||
98 | marvell,nand-keep-config; | 98 | marvell,nand-keep-config; |
99 | marvell,nand-enable-arbiter; | 99 | marvell,nand-enable-arbiter; |
100 | nand-on-flash-bbt; | 100 | nand-on-flash-bbt; |
101 | nand-ecc-strength = <4>; | ||
102 | nand-ecc-step-size = <512>; | ||
101 | 103 | ||
102 | partition@0 { | 104 | partition@0 { |
103 | label = "U-Boot"; | 105 | label = "U-Boot"; |
diff --git a/arch/arm/boot/dts/armada-385-rd.dts b/arch/arm/boot/dts/armada-385-rd.dts index 40893255a3f0..aaca2861dc87 100644 --- a/arch/arm/boot/dts/armada-385-rd.dts +++ b/arch/arm/boot/dts/armada-385-rd.dts | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | / { | 18 | / { |
19 | model = "Marvell Armada 385 Reference Design"; | 19 | model = "Marvell Armada 385 Reference Design"; |
20 | compatible = "marvell,a385-rd", "marvell,armada385", "marvell,armada38x"; | 20 | compatible = "marvell,a385-rd", "marvell,armada385", "marvell,armada380"; |
21 | 21 | ||
22 | chosen { | 22 | chosen { |
23 | bootargs = "console=ttyS0,115200 earlyprintk"; | 23 | bootargs = "console=ttyS0,115200 earlyprintk"; |
diff --git a/arch/arm/boot/dts/armada-385.dtsi b/arch/arm/boot/dts/armada-385.dtsi index f011009bf4cf..6283d7912f71 100644 --- a/arch/arm/boot/dts/armada-385.dtsi +++ b/arch/arm/boot/dts/armada-385.dtsi | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | / { | 17 | / { |
18 | model = "Marvell Armada 385 family SoC"; | 18 | model = "Marvell Armada 385 family SoC"; |
19 | compatible = "marvell,armada385", "marvell,armada38x"; | 19 | compatible = "marvell,armada385", "marvell,armada380"; |
20 | 20 | ||
21 | cpus { | 21 | cpus { |
22 | #address-cells = <1>; | 22 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi index 3de364e81b52..689fa1a46728 100644 --- a/arch/arm/boot/dts/armada-38x.dtsi +++ b/arch/arm/boot/dts/armada-38x.dtsi | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | / { | 21 | / { |
22 | model = "Marvell Armada 38x family SoC"; | 22 | model = "Marvell Armada 38x family SoC"; |
23 | compatible = "marvell,armada38x"; | 23 | compatible = "marvell,armada380"; |
24 | 24 | ||
25 | aliases { | 25 | aliases { |
26 | gpio0 = &gpio0; | 26 | gpio0 = &gpio0; |
diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts index e5c6a0492ca0..4e5a59ee1501 100644 --- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts +++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | memory { | 26 | memory { |
27 | device_type = "memory"; | 27 | device_type = "memory"; |
28 | reg = <0 0x00000000 0 0xC0000000>; /* 3 GB */ | 28 | reg = <0 0x00000000 0 0x40000000>; /* 1 GB soldered on */ |
29 | }; | 29 | }; |
30 | 30 | ||
31 | soc { | 31 | soc { |
diff --git a/arch/arm/boot/dts/at91sam9261.dtsi b/arch/arm/boot/dts/at91sam9261.dtsi index b309c1c6e848..04927db1d6bf 100644 --- a/arch/arm/boot/dts/at91sam9261.dtsi +++ b/arch/arm/boot/dts/at91sam9261.dtsi | |||
@@ -568,24 +568,17 @@ | |||
568 | #size-cells = <0>; | 568 | #size-cells = <0>; |
569 | #interrupt-cells = <1>; | 569 | #interrupt-cells = <1>; |
570 | 570 | ||
571 | slow_rc_osc: slow_rc_osc { | 571 | main_osc: main_osc { |
572 | compatible = "fixed-clock"; | 572 | compatible = "atmel,at91rm9200-clk-main-osc"; |
573 | #clock-cells = <0>; | 573 | #clock-cells = <0>; |
574 | clock-frequency = <32768>; | 574 | interrupts-extended = <&pmc AT91_PMC_MOSCS>; |
575 | clock-accuracy = <50000000>; | 575 | clocks = <&main_xtal>; |
576 | }; | ||
577 | |||
578 | clk32k: slck { | ||
579 | compatible = "atmel,at91sam9260-clk-slow"; | ||
580 | #clock-cells = <0>; | ||
581 | clocks = <&slow_rc_osc &slow_xtal>; | ||
582 | }; | 576 | }; |
583 | 577 | ||
584 | main: mainck { | 578 | main: mainck { |
585 | compatible = "atmel,at91rm9200-clk-main"; | 579 | compatible = "atmel,at91rm9200-clk-main"; |
586 | #clock-cells = <0>; | 580 | #clock-cells = <0>; |
587 | interrupts-extended = <&pmc AT91_PMC_MOSCS>; | 581 | clocks = <&main_osc>; |
588 | clocks = <&main_xtal>; | ||
589 | }; | 582 | }; |
590 | 583 | ||
591 | plla: pllack { | 584 | plla: pllack { |
@@ -615,7 +608,7 @@ | |||
615 | compatible = "atmel,at91rm9200-clk-master"; | 608 | compatible = "atmel,at91rm9200-clk-master"; |
616 | #clock-cells = <0>; | 609 | #clock-cells = <0>; |
617 | interrupts-extended = <&pmc AT91_PMC_MCKRDY>; | 610 | interrupts-extended = <&pmc AT91_PMC_MCKRDY>; |
618 | clocks = <&clk32k>, <&main>, <&plla>, <&pllb>; | 611 | clocks = <&slow_xtal>, <&main>, <&plla>, <&pllb>; |
619 | atmel,clk-output-range = <0 94000000>; | 612 | atmel,clk-output-range = <0 94000000>; |
620 | atmel,clk-divisors = <1 2 4 0>; | 613 | atmel,clk-divisors = <1 2 4 0>; |
621 | }; | 614 | }; |
@@ -632,7 +625,7 @@ | |||
632 | #address-cells = <1>; | 625 | #address-cells = <1>; |
633 | #size-cells = <0>; | 626 | #size-cells = <0>; |
634 | interrupt-parent = <&pmc>; | 627 | interrupt-parent = <&pmc>; |
635 | clocks = <&clk32k>, <&main>, <&plla>, <&pllb>; | 628 | clocks = <&slow_xtal>, <&main>, <&plla>, <&pllb>; |
636 | 629 | ||
637 | prog0: prog0 { | 630 | prog0: prog0 { |
638 | #clock-cells = <0>; | 631 | #clock-cells = <0>; |
diff --git a/arch/arm/boot/dts/at91sam9261ek.dts b/arch/arm/boot/dts/at91sam9261ek.dts index c6683ea8b743..aa35a7aec9a8 100644 --- a/arch/arm/boot/dts/at91sam9261ek.dts +++ b/arch/arm/boot/dts/at91sam9261ek.dts | |||
@@ -20,6 +20,10 @@ | |||
20 | reg = <0x20000000 0x4000000>; | 20 | reg = <0x20000000 0x4000000>; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | slow_xtal { | ||
24 | clock-frequency = <32768>; | ||
25 | }; | ||
26 | |||
23 | main_xtal { | 27 | main_xtal { |
24 | clock-frequency = <18432000>; | 28 | clock-frequency = <18432000>; |
25 | }; | 29 | }; |
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index d1b82e6635d5..287795985e32 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi | |||
@@ -132,8 +132,8 @@ | |||
132 | <595000000 650000000 3 0>, | 132 | <595000000 650000000 3 0>, |
133 | <545000000 600000000 0 1>, | 133 | <545000000 600000000 0 1>, |
134 | <495000000 555000000 1 1>, | 134 | <495000000 555000000 1 1>, |
135 | <445000000 500000000 1 2>, | 135 | <445000000 500000000 2 1>, |
136 | <400000000 450000000 1 3>; | 136 | <400000000 450000000 3 1>; |
137 | }; | 137 | }; |
138 | 138 | ||
139 | plladiv: plladivck { | 139 | plladiv: plladivck { |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index 1a57298636a5..2ebc42140ea6 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
@@ -140,8 +140,8 @@ | |||
140 | 595000000 650000000 3 0 | 140 | 595000000 650000000 3 0 |
141 | 545000000 600000000 0 1 | 141 | 545000000 600000000 0 1 |
142 | 495000000 555000000 1 1 | 142 | 495000000 555000000 1 1 |
143 | 445000000 500000000 1 2 | 143 | 445000000 500000000 2 1 |
144 | 400000000 450000000 1 3>; | 144 | 400000000 450000000 3 1>; |
145 | }; | 145 | }; |
146 | 146 | ||
147 | plladiv: plladivck { | 147 | plladiv: plladivck { |
@@ -1045,6 +1045,8 @@ | |||
1045 | reg = <0x00500000 0x80000 | 1045 | reg = <0x00500000 0x80000 |
1046 | 0xf803c000 0x400>; | 1046 | 0xf803c000 0x400>; |
1047 | interrupts = <23 IRQ_TYPE_LEVEL_HIGH 0>; | 1047 | interrupts = <23 IRQ_TYPE_LEVEL_HIGH 0>; |
1048 | clocks = <&usb>, <&udphs_clk>; | ||
1049 | clock-names = "hclk", "pclk"; | ||
1048 | status = "disabled"; | 1050 | status = "disabled"; |
1049 | 1051 | ||
1050 | ep0 { | 1052 | ep0 { |
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts index 4adc28039c30..83089540e324 100644 --- a/arch/arm/boot/dts/dra7-evm.dts +++ b/arch/arm/boot/dts/dra7-evm.dts | |||
@@ -240,6 +240,7 @@ | |||
240 | regulator-name = "ldo3"; | 240 | regulator-name = "ldo3"; |
241 | regulator-min-microvolt = <1800000>; | 241 | regulator-min-microvolt = <1800000>; |
242 | regulator-max-microvolt = <1800000>; | 242 | regulator-max-microvolt = <1800000>; |
243 | regulator-always-on; | ||
243 | regulator-boot-on; | 244 | regulator-boot-on; |
244 | }; | 245 | }; |
245 | 246 | ||
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index c29945e07c5a..80127638b379 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi | |||
@@ -773,7 +773,6 @@ | |||
773 | clocks = <&qspi_gfclk_div>; | 773 | clocks = <&qspi_gfclk_div>; |
774 | clock-names = "fck"; | 774 | clock-names = "fck"; |
775 | num-cs = <4>; | 775 | num-cs = <4>; |
776 | interrupts = <0 343 0x4>; | ||
777 | status = "disabled"; | 776 | status = "disabled"; |
778 | }; | 777 | }; |
779 | 778 | ||
@@ -984,6 +983,17 @@ | |||
984 | #size-cells = <1>; | 983 | #size-cells = <1>; |
985 | status = "disabled"; | 984 | status = "disabled"; |
986 | }; | 985 | }; |
986 | |||
987 | atl: atl@4843c000 { | ||
988 | compatible = "ti,dra7-atl"; | ||
989 | reg = <0x4843c000 0x3ff>; | ||
990 | ti,hwmods = "atl"; | ||
991 | ti,provided-clocks = <&atl_clkin0_ck>, <&atl_clkin1_ck>, | ||
992 | <&atl_clkin2_ck>, <&atl_clkin3_ck>; | ||
993 | clocks = <&atl_gfclk_mux>; | ||
994 | clock-names = "fck"; | ||
995 | status = "disabled"; | ||
996 | }; | ||
987 | }; | 997 | }; |
988 | }; | 998 | }; |
989 | 999 | ||
diff --git a/arch/arm/boot/dts/dra7xx-clocks.dtsi b/arch/arm/boot/dts/dra7xx-clocks.dtsi index b03cfe49d22b..dc7a292fe939 100644 --- a/arch/arm/boot/dts/dra7xx-clocks.dtsi +++ b/arch/arm/boot/dts/dra7xx-clocks.dtsi | |||
@@ -10,26 +10,26 @@ | |||
10 | &cm_core_aon_clocks { | 10 | &cm_core_aon_clocks { |
11 | atl_clkin0_ck: atl_clkin0_ck { | 11 | atl_clkin0_ck: atl_clkin0_ck { |
12 | #clock-cells = <0>; | 12 | #clock-cells = <0>; |
13 | compatible = "fixed-clock"; | 13 | compatible = "ti,dra7-atl-clock"; |
14 | clock-frequency = <0>; | 14 | clocks = <&atl_gfclk_mux>; |
15 | }; | 15 | }; |
16 | 16 | ||
17 | atl_clkin1_ck: atl_clkin1_ck { | 17 | atl_clkin1_ck: atl_clkin1_ck { |
18 | #clock-cells = <0>; | 18 | #clock-cells = <0>; |
19 | compatible = "fixed-clock"; | 19 | compatible = "ti,dra7-atl-clock"; |
20 | clock-frequency = <0>; | 20 | clocks = <&atl_gfclk_mux>; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | atl_clkin2_ck: atl_clkin2_ck { | 23 | atl_clkin2_ck: atl_clkin2_ck { |
24 | #clock-cells = <0>; | 24 | #clock-cells = <0>; |
25 | compatible = "fixed-clock"; | 25 | compatible = "ti,dra7-atl-clock"; |
26 | clock-frequency = <0>; | 26 | clocks = <&atl_gfclk_mux>; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | atl_clkin3_ck: atl_clkin3_ck { | 29 | atl_clkin3_ck: atl_clkin3_ck { |
30 | #clock-cells = <0>; | 30 | #clock-cells = <0>; |
31 | compatible = "fixed-clock"; | 31 | compatible = "ti,dra7-atl-clock"; |
32 | clock-frequency = <0>; | 32 | clocks = <&atl_gfclk_mux>; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | hdmi_clkin_ck: hdmi_clkin_ck { | 35 | hdmi_clkin_ck: hdmi_clkin_ck { |
@@ -673,10 +673,12 @@ | |||
673 | 673 | ||
674 | l3_iclk_div: l3_iclk_div { | 674 | l3_iclk_div: l3_iclk_div { |
675 | #clock-cells = <0>; | 675 | #clock-cells = <0>; |
676 | compatible = "fixed-factor-clock"; | 676 | compatible = "ti,divider-clock"; |
677 | ti,max-div = <2>; | ||
678 | ti,bit-shift = <4>; | ||
679 | reg = <0x0100>; | ||
677 | clocks = <&dpll_core_h12x2_ck>; | 680 | clocks = <&dpll_core_h12x2_ck>; |
678 | clock-mult = <1>; | 681 | ti,index-power-of-two; |
679 | clock-div = <1>; | ||
680 | }; | 682 | }; |
681 | 683 | ||
682 | l4_root_clk_div: l4_root_clk_div { | 684 | l4_root_clk_div: l4_root_clk_div { |
@@ -684,7 +686,7 @@ | |||
684 | compatible = "fixed-factor-clock"; | 686 | compatible = "fixed-factor-clock"; |
685 | clocks = <&l3_iclk_div>; | 687 | clocks = <&l3_iclk_div>; |
686 | clock-mult = <1>; | 688 | clock-mult = <1>; |
687 | clock-div = <1>; | 689 | clock-div = <2>; |
688 | }; | 690 | }; |
689 | 691 | ||
690 | video1_clk2_div: video1_clk2_div { | 692 | video1_clk2_div: video1_clk2_div { |
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi index b8ece4be41ca..17b22e9cc2aa 100644 --- a/arch/arm/boot/dts/exynos4.dtsi +++ b/arch/arm/boot/dts/exynos4.dtsi | |||
@@ -113,7 +113,7 @@ | |||
113 | compatible = "arm,cortex-a9-gic"; | 113 | compatible = "arm,cortex-a9-gic"; |
114 | #interrupt-cells = <3>; | 114 | #interrupt-cells = <3>; |
115 | interrupt-controller; | 115 | interrupt-controller; |
116 | reg = <0x10490000 0x1000>, <0x10480000 0x100>; | 116 | reg = <0x10490000 0x10000>, <0x10480000 0x10000>; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | combiner: interrupt-controller@10440000 { | 119 | combiner: interrupt-controller@10440000 { |
@@ -554,7 +554,7 @@ | |||
554 | interrupts = <0 37 0>, <0 38 0>, <0 39 0>, <0 40 0>, <0 41 0>; | 554 | interrupts = <0 37 0>, <0 38 0>, <0 39 0>, <0 40 0>, <0 41 0>; |
555 | clocks = <&clock CLK_PWM>; | 555 | clocks = <&clock CLK_PWM>; |
556 | clock-names = "timers"; | 556 | clock-names = "timers"; |
557 | #pwm-cells = <2>; | 557 | #pwm-cells = <3>; |
558 | status = "disabled"; | 558 | status = "disabled"; |
559 | }; | 559 | }; |
560 | 560 | ||
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi index e38532271ef9..15957227ffda 100644 --- a/arch/arm/boot/dts/exynos5420.dtsi +++ b/arch/arm/boot/dts/exynos5420.dtsi | |||
@@ -167,7 +167,7 @@ | |||
167 | compatible = "samsung,exynos5420-audss-clock"; | 167 | compatible = "samsung,exynos5420-audss-clock"; |
168 | reg = <0x03810000 0x0C>; | 168 | reg = <0x03810000 0x0C>; |
169 | #clock-cells = <1>; | 169 | #clock-cells = <1>; |
170 | clocks = <&clock CLK_FIN_PLL>, <&clock CLK_FOUT_EPLL>, | 170 | clocks = <&clock CLK_FIN_PLL>, <&clock CLK_MAU_EPLL>, |
171 | <&clock CLK_SCLK_MAUDIO0>, <&clock CLK_SCLK_MAUPCM0>; | 171 | <&clock CLK_SCLK_MAUDIO0>, <&clock CLK_SCLK_MAUPCM0>; |
172 | clock-names = "pll_ref", "pll_in", "sclk_audio", "sclk_pcm_in"; | 172 | clock-names = "pll_ref", "pll_in", "sclk_audio", "sclk_pcm_in"; |
173 | }; | 173 | }; |
@@ -260,6 +260,9 @@ | |||
260 | mfc_pd: power-domain@10044060 { | 260 | mfc_pd: power-domain@10044060 { |
261 | compatible = "samsung,exynos4210-pd"; | 261 | compatible = "samsung,exynos4210-pd"; |
262 | reg = <0x10044060 0x20>; | 262 | reg = <0x10044060 0x20>; |
263 | clocks = <&clock CLK_FIN_PLL>, <&clock CLK_MOUT_SW_ACLK333>, | ||
264 | <&clock CLK_MOUT_USER_ACLK333>; | ||
265 | clock-names = "oscclk", "pclk0", "clk0"; | ||
263 | }; | 266 | }; |
264 | 267 | ||
265 | disp_pd: power-domain@100440C0 { | 268 | disp_pd: power-domain@100440C0 { |
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts index 6bc3243a80d3..181d77fa2fa6 100644 --- a/arch/arm/boot/dts/imx51-babbage.dts +++ b/arch/arm/boot/dts/imx51-babbage.dts | |||
@@ -315,15 +315,15 @@ | |||
315 | &esdhc1 { | 315 | &esdhc1 { |
316 | pinctrl-names = "default"; | 316 | pinctrl-names = "default"; |
317 | pinctrl-0 = <&pinctrl_esdhc1>; | 317 | pinctrl-0 = <&pinctrl_esdhc1>; |
318 | fsl,cd-controller; | 318 | cd-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; |
319 | fsl,wp-controller; | 319 | wp-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; |
320 | status = "okay"; | 320 | status = "okay"; |
321 | }; | 321 | }; |
322 | 322 | ||
323 | &esdhc2 { | 323 | &esdhc2 { |
324 | pinctrl-names = "default"; | 324 | pinctrl-names = "default"; |
325 | pinctrl-0 = <&pinctrl_esdhc2>; | 325 | pinctrl-0 = <&pinctrl_esdhc2>; |
326 | cd-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; | 326 | cd-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; |
327 | wp-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; | 327 | wp-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; |
328 | status = "okay"; | 328 | status = "okay"; |
329 | }; | 329 | }; |
@@ -468,8 +468,8 @@ | |||
468 | MX51_PAD_SD1_DATA1__SD1_DATA1 0x20d5 | 468 | MX51_PAD_SD1_DATA1__SD1_DATA1 0x20d5 |
469 | MX51_PAD_SD1_DATA2__SD1_DATA2 0x20d5 | 469 | MX51_PAD_SD1_DATA2__SD1_DATA2 0x20d5 |
470 | MX51_PAD_SD1_DATA3__SD1_DATA3 0x20d5 | 470 | MX51_PAD_SD1_DATA3__SD1_DATA3 0x20d5 |
471 | MX51_PAD_GPIO1_0__SD1_CD 0x20d5 | 471 | MX51_PAD_GPIO1_0__GPIO1_0 0x100 |
472 | MX51_PAD_GPIO1_1__SD1_WP 0x20d5 | 472 | MX51_PAD_GPIO1_1__GPIO1_1 0x100 |
473 | >; | 473 | >; |
474 | }; | 474 | }; |
475 | 475 | ||
diff --git a/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts b/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts index 75e66c9c6144..31cfb7f2b02e 100644 --- a/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts +++ b/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts | |||
@@ -107,7 +107,7 @@ | |||
107 | &esdhc1 { | 107 | &esdhc1 { |
108 | pinctrl-names = "default"; | 108 | pinctrl-names = "default"; |
109 | pinctrl-0 = <&pinctrl_esdhc1 &pinctrl_esdhc1_cd>; | 109 | pinctrl-0 = <&pinctrl_esdhc1 &pinctrl_esdhc1_cd>; |
110 | fsl,cd-controller; | 110 | cd-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; |
111 | status = "okay"; | 111 | status = "okay"; |
112 | }; | 112 | }; |
113 | 113 | ||
@@ -206,7 +206,7 @@ | |||
206 | 206 | ||
207 | pinctrl_esdhc1_cd: esdhc1_cd { | 207 | pinctrl_esdhc1_cd: esdhc1_cd { |
208 | fsl,pins = < | 208 | fsl,pins = < |
209 | MX51_PAD_GPIO1_0__SD1_CD 0x20d5 | 209 | MX51_PAD_GPIO1_0__GPIO1_0 0xd5 |
210 | >; | 210 | >; |
211 | }; | 211 | }; |
212 | 212 | ||
diff --git a/arch/arm/boot/dts/imx53-m53evk.dts b/arch/arm/boot/dts/imx53-m53evk.dts index d5d146a8b149..c4956b0ffb35 100644 --- a/arch/arm/boot/dts/imx53-m53evk.dts +++ b/arch/arm/boot/dts/imx53-m53evk.dts | |||
@@ -21,27 +21,25 @@ | |||
21 | <0xb0000000 0x20000000>; | 21 | <0xb0000000 0x20000000>; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | soc { | 24 | display1: display@di1 { |
25 | display1: display@di1 { | 25 | compatible = "fsl,imx-parallel-display"; |
26 | compatible = "fsl,imx-parallel-display"; | 26 | interface-pix-fmt = "bgr666"; |
27 | interface-pix-fmt = "bgr666"; | 27 | pinctrl-names = "default"; |
28 | pinctrl-names = "default"; | 28 | pinctrl-0 = <&pinctrl_ipu_disp1>; |
29 | pinctrl-0 = <&pinctrl_ipu_disp1>; | 29 | |
30 | 30 | display-timings { | |
31 | display-timings { | 31 | 800x480p60 { |
32 | 800x480p60 { | 32 | native-mode; |
33 | native-mode; | 33 | clock-frequency = <31500000>; |
34 | clock-frequency = <31500000>; | 34 | hactive = <800>; |
35 | hactive = <800>; | 35 | vactive = <480>; |
36 | vactive = <480>; | 36 | hfront-porch = <40>; |
37 | hfront-porch = <40>; | 37 | hback-porch = <88>; |
38 | hback-porch = <88>; | 38 | hsync-len = <128>; |
39 | hsync-len = <128>; | 39 | vback-porch = <33>; |
40 | vback-porch = <33>; | 40 | vfront-porch = <9>; |
41 | vfront-porch = <9>; | 41 | vsync-len = <3>; |
42 | vsync-len = <3>; | 42 | vsync-active = <1>; |
43 | vsync-active = <1>; | ||
44 | }; | ||
45 | }; | 43 | }; |
46 | }; | 44 | }; |
47 | 45 | ||
diff --git a/arch/arm/boot/dts/imx6dl-hummingboard.dts b/arch/arm/boot/dts/imx6dl-hummingboard.dts index 5373a5f2782b..c8e51dd41b8f 100644 --- a/arch/arm/boot/dts/imx6dl-hummingboard.dts +++ b/arch/arm/boot/dts/imx6dl-hummingboard.dts | |||
@@ -143,6 +143,14 @@ | |||
143 | fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0>; | 143 | fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0>; |
144 | }; | 144 | }; |
145 | 145 | ||
146 | pinctrl_hummingboard_usbotg_id: hummingboard-usbotg-id { | ||
147 | /* | ||
148 | * Similar to pinctrl_usbotg_2, but we want it | ||
149 | * pulled down for a fixed host connection. | ||
150 | */ | ||
151 | fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>; | ||
152 | }; | ||
153 | |||
146 | pinctrl_hummingboard_usbotg_vbus: hummingboard-usbotg-vbus { | 154 | pinctrl_hummingboard_usbotg_vbus: hummingboard-usbotg-vbus { |
147 | fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0>; | 155 | fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0>; |
148 | }; | 156 | }; |
@@ -178,6 +186,8 @@ | |||
178 | }; | 186 | }; |
179 | 187 | ||
180 | &usbotg { | 188 | &usbotg { |
189 | pinctrl-names = "default"; | ||
190 | pinctrl-0 = <&pinctrl_hummingboard_usbotg_id>; | ||
181 | vbus-supply = <®_usbotg_vbus>; | 191 | vbus-supply = <®_usbotg_vbus>; |
182 | status = "okay"; | 192 | status = "okay"; |
183 | }; | 193 | }; |
diff --git a/arch/arm/boot/dts/imx6q-gw51xx.dts b/arch/arm/boot/dts/imx6q-gw51xx.dts index af4929aee075..0e1406e58eff 100644 --- a/arch/arm/boot/dts/imx6q-gw51xx.dts +++ b/arch/arm/boot/dts/imx6q-gw51xx.dts | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | /dts-v1/; | 12 | /dts-v1/; |
13 | #include "imx6q.dtsi" | 13 | #include "imx6q.dtsi" |
14 | #include "imx6qdl-gw54xx.dtsi" | 14 | #include "imx6qdl-gw51xx.dtsi" |
15 | 15 | ||
16 | / { | 16 | / { |
17 | model = "Gateworks Ventana i.MX6 Quad GW51XX"; | 17 | model = "Gateworks Ventana i.MX6 Quad GW51XX"; |
diff --git a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi index 25da82a03110..e8e781656b3f 100644 --- a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi +++ b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi | |||
@@ -12,6 +12,19 @@ | |||
12 | pinctrl-0 = <&pinctrl_cubox_i_ir>; | 12 | pinctrl-0 = <&pinctrl_cubox_i_ir>; |
13 | }; | 13 | }; |
14 | 14 | ||
15 | pwmleds { | ||
16 | compatible = "pwm-leds"; | ||
17 | pinctrl-names = "default"; | ||
18 | pinctrl-0 = <&pinctrl_cubox_i_pwm1>; | ||
19 | |||
20 | front { | ||
21 | active-low; | ||
22 | label = "imx6:red:front"; | ||
23 | max-brightness = <248>; | ||
24 | pwms = <&pwm1 0 50000>; | ||
25 | }; | ||
26 | }; | ||
27 | |||
15 | regulators { | 28 | regulators { |
16 | compatible = "simple-bus"; | 29 | compatible = "simple-bus"; |
17 | 30 | ||
@@ -109,6 +122,10 @@ | |||
109 | >; | 122 | >; |
110 | }; | 123 | }; |
111 | 124 | ||
125 | pinctrl_cubox_i_pwm1: cubox-i-pwm1-front-led { | ||
126 | fsl,pins = <MX6QDL_PAD_DISP0_DAT8__PWM1_OUT 0x1b0b0>; | ||
127 | }; | ||
128 | |||
112 | pinctrl_cubox_i_spdif: cubox-i-spdif { | 129 | pinctrl_cubox_i_spdif: cubox-i-spdif { |
113 | fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>; | 130 | fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>; |
114 | }; | 131 | }; |
@@ -117,6 +134,14 @@ | |||
117 | fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>; | 134 | fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>; |
118 | }; | 135 | }; |
119 | 136 | ||
137 | pinctrl_cubox_i_usbotg_id: cubox-i-usbotg-id { | ||
138 | /* | ||
139 | * The Cubox-i pulls this low, but as it's pointless | ||
140 | * leaving it as a pull-up, even if it is just 10uA. | ||
141 | */ | ||
142 | fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>; | ||
143 | }; | ||
144 | |||
120 | pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus { | 145 | pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus { |
121 | fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x4001b0b0>; | 146 | fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x4001b0b0>; |
122 | }; | 147 | }; |
@@ -153,6 +178,8 @@ | |||
153 | }; | 178 | }; |
154 | 179 | ||
155 | &usbotg { | 180 | &usbotg { |
181 | pinctrl-names = "default"; | ||
182 | pinctrl-0 = <&pinctrl_cubox_i_usbotg_id>; | ||
156 | vbus-supply = <®_usbotg_vbus>; | 183 | vbus-supply = <®_usbotg_vbus>; |
157 | status = "okay"; | 184 | status = "okay"; |
158 | }; | 185 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi index 31665adcbf39..0db15af41cb1 100644 --- a/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi | |||
@@ -161,7 +161,7 @@ | |||
161 | status = "okay"; | 161 | status = "okay"; |
162 | 162 | ||
163 | pmic: ltc3676@3c { | 163 | pmic: ltc3676@3c { |
164 | compatible = "ltc,ltc3676"; | 164 | compatible = "lltc,ltc3676"; |
165 | reg = <0x3c>; | 165 | reg = <0x3c>; |
166 | 166 | ||
167 | regulators { | 167 | regulators { |
diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi index 367af3ec9435..744c8a2d81f6 100644 --- a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi | |||
@@ -220,7 +220,7 @@ | |||
220 | }; | 220 | }; |
221 | 221 | ||
222 | pmic: ltc3676@3c { | 222 | pmic: ltc3676@3c { |
223 | compatible = "ltc,ltc3676"; | 223 | compatible = "lltc,ltc3676"; |
224 | reg = <0x3c>; | 224 | reg = <0x3c>; |
225 | 225 | ||
226 | regulators { | 226 | regulators { |
@@ -288,7 +288,7 @@ | |||
288 | codec: sgtl5000@0a { | 288 | codec: sgtl5000@0a { |
289 | compatible = "fsl,sgtl5000"; | 289 | compatible = "fsl,sgtl5000"; |
290 | reg = <0x0a>; | 290 | reg = <0x0a>; |
291 | clocks = <&clks 169>; | 291 | clocks = <&clks 201>; |
292 | VDDA-supply = <®_1p8v>; | 292 | VDDA-supply = <®_1p8v>; |
293 | VDDIO-supply = <®_3p3v>; | 293 | VDDIO-supply = <®_3p3v>; |
294 | }; | 294 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi index c91b5a6c769b..adf150c1be90 100644 --- a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi | |||
@@ -234,7 +234,7 @@ | |||
234 | }; | 234 | }; |
235 | 235 | ||
236 | pmic: ltc3676@3c { | 236 | pmic: ltc3676@3c { |
237 | compatible = "ltc,ltc3676"; | 237 | compatible = "lltc,ltc3676"; |
238 | reg = <0x3c>; | 238 | reg = <0x3c>; |
239 | 239 | ||
240 | regulators { | 240 | regulators { |
diff --git a/arch/arm/boot/dts/imx6qdl-microsom.dtsi b/arch/arm/boot/dts/imx6qdl-microsom.dtsi index d729d0b15f25..79eac6849d4c 100644 --- a/arch/arm/boot/dts/imx6qdl-microsom.dtsi +++ b/arch/arm/boot/dts/imx6qdl-microsom.dtsi | |||
@@ -10,14 +10,6 @@ | |||
10 | MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1 | 10 | MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1 |
11 | >; | 11 | >; |
12 | }; | 12 | }; |
13 | |||
14 | pinctrl_microsom_usbotg: microsom-usbotg { | ||
15 | /* | ||
16 | * Similar to pinctrl_usbotg_2, but we want it | ||
17 | * pulled down for a fixed host connection. | ||
18 | */ | ||
19 | fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>; | ||
20 | }; | ||
21 | }; | 13 | }; |
22 | }; | 14 | }; |
23 | 15 | ||
@@ -26,8 +18,3 @@ | |||
26 | pinctrl-0 = <&pinctrl_microsom_uart1>; | 18 | pinctrl-0 = <&pinctrl_microsom_uart1>; |
27 | status = "okay"; | 19 | status = "okay"; |
28 | }; | 20 | }; |
29 | |||
30 | &usbotg { | ||
31 | pinctrl-names = "default"; | ||
32 | pinctrl-0 = <&pinctrl_microsom_usbotg>; | ||
33 | }; | ||
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index 2d4e5285f3f3..57d4abe03a94 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi | |||
@@ -686,7 +686,7 @@ | |||
686 | compatible = "fsl,imx6sl-fec", "fsl,imx25-fec"; | 686 | compatible = "fsl,imx6sl-fec", "fsl,imx25-fec"; |
687 | reg = <0x02188000 0x4000>; | 687 | reg = <0x02188000 0x4000>; |
688 | interrupts = <0 114 IRQ_TYPE_LEVEL_HIGH>; | 688 | interrupts = <0 114 IRQ_TYPE_LEVEL_HIGH>; |
689 | clocks = <&clks IMX6SL_CLK_ENET_REF>, | 689 | clocks = <&clks IMX6SL_CLK_ENET>, |
690 | <&clks IMX6SL_CLK_ENET_REF>; | 690 | <&clks IMX6SL_CLK_ENET_REF>; |
691 | clock-names = "ipg", "ahb"; | 691 | clock-names = "ipg", "ahb"; |
692 | status = "disabled"; | 692 | status = "disabled"; |
diff --git a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts index c5a1fc75c7a3..b2d9834bf458 100644 --- a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts +++ b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts | |||
@@ -105,7 +105,6 @@ | |||
105 | compatible = "ethernet-phy-id0141.0cb0", | 105 | compatible = "ethernet-phy-id0141.0cb0", |
106 | "ethernet-phy-ieee802.3-c22"; | 106 | "ethernet-phy-ieee802.3-c22"; |
107 | reg = <0>; | 107 | reg = <0>; |
108 | phy-connection-type = "rgmii-id"; | ||
109 | }; | 108 | }; |
110 | 109 | ||
111 | ethphy1: ethernet-phy@1 { | 110 | ethphy1: ethernet-phy@1 { |
@@ -113,7 +112,6 @@ | |||
113 | compatible = "ethernet-phy-id0141.0cb0", | 112 | compatible = "ethernet-phy-id0141.0cb0", |
114 | "ethernet-phy-ieee802.3-c22"; | 113 | "ethernet-phy-ieee802.3-c22"; |
115 | reg = <1>; | 114 | reg = <1>; |
116 | phy-connection-type = "rgmii-id"; | ||
117 | }; | 115 | }; |
118 | }; | 116 | }; |
119 | 117 | ||
@@ -121,6 +119,7 @@ | |||
121 | status = "okay"; | 119 | status = "okay"; |
122 | ethernet0-port@0 { | 120 | ethernet0-port@0 { |
123 | phy-handle = <ðphy0>; | 121 | phy-handle = <ðphy0>; |
122 | phy-connection-type = "rgmii-id"; | ||
124 | }; | 123 | }; |
125 | }; | 124 | }; |
126 | 125 | ||
@@ -128,5 +127,6 @@ | |||
128 | status = "okay"; | 127 | status = "okay"; |
129 | ethernet1-port@0 { | 128 | ethernet1-port@0 { |
130 | phy-handle = <ðphy1>; | 129 | phy-handle = <ðphy1>; |
130 | phy-connection-type = "rgmii-id"; | ||
131 | }; | 131 | }; |
132 | }; | 132 | }; |
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts index cf0be662297e..1becefce821b 100644 --- a/arch/arm/boot/dts/omap3-beagle-xm.dts +++ b/arch/arm/boot/dts/omap3-beagle-xm.dts | |||
@@ -251,6 +251,11 @@ | |||
251 | codec { | 251 | codec { |
252 | }; | 252 | }; |
253 | }; | 253 | }; |
254 | |||
255 | twl_power: power { | ||
256 | compatible = "ti,twl4030-power-beagleboard-xm", "ti,twl4030-power-idle-osc-off"; | ||
257 | ti,use_poweroff; | ||
258 | }; | ||
254 | }; | 259 | }; |
255 | }; | 260 | }; |
256 | 261 | ||
@@ -301,6 +306,7 @@ | |||
301 | }; | 306 | }; |
302 | 307 | ||
303 | &uart3 { | 308 | &uart3 { |
309 | interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>; | ||
304 | pinctrl-names = "default"; | 310 | pinctrl-names = "default"; |
305 | pinctrl-0 = <&uart3_pins>; | 311 | pinctrl-0 = <&uart3_pins>; |
306 | }; | 312 | }; |
diff --git a/arch/arm/boot/dts/omap3-evm-common.dtsi b/arch/arm/boot/dts/omap3-evm-common.dtsi index 8ae8f007c8ad..c8747c7f1cc8 100644 --- a/arch/arm/boot/dts/omap3-evm-common.dtsi +++ b/arch/arm/boot/dts/omap3-evm-common.dtsi | |||
@@ -50,6 +50,13 @@ | |||
50 | gpios = <&twl_gpio 18 GPIO_ACTIVE_LOW>; | 50 | gpios = <&twl_gpio 18 GPIO_ACTIVE_LOW>; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | &twl { | ||
54 | twl_power: power { | ||
55 | compatible = "ti,twl4030-power-omap3-evm", "ti,twl4030-power-idle"; | ||
56 | ti,use_poweroff; | ||
57 | }; | ||
58 | }; | ||
59 | |||
53 | &i2c2 { | 60 | &i2c2 { |
54 | clock-frequency = <400000>; | 61 | clock-frequency = <400000>; |
55 | }; | 62 | }; |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index ae8ae3f4f9bf..1fe45d1f75ec 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
@@ -351,6 +351,11 @@ | |||
351 | compatible = "ti,twl4030-audio"; | 351 | compatible = "ti,twl4030-audio"; |
352 | ti,enable-vibra = <1>; | 352 | ti,enable-vibra = <1>; |
353 | }; | 353 | }; |
354 | |||
355 | twl_power: power { | ||
356 | compatible = "ti,twl4030-power-n900", "ti,twl4030-power-idle-osc-off"; | ||
357 | ti,use_poweroff; | ||
358 | }; | ||
354 | }; | 359 | }; |
355 | 360 | ||
356 | &twl_keypad { | 361 | &twl_keypad { |
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index 3bfda16c8b52..a4ed54988866 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi | |||
@@ -45,7 +45,6 @@ | |||
45 | 45 | ||
46 | operating-points = < | 46 | operating-points = < |
47 | /* kHz uV */ | 47 | /* kHz uV */ |
48 | 500000 880000 | ||
49 | 1000000 1060000 | 48 | 1000000 1060000 |
50 | 1500000 1250000 | 49 | 1500000 1250000 |
51 | >; | 50 | >; |
diff --git a/arch/arm/boot/dts/stih415.dtsi b/arch/arm/boot/dts/stih415.dtsi index d6f254f302fe..a0f6f75fe3b5 100644 --- a/arch/arm/boot/dts/stih415.dtsi +++ b/arch/arm/boot/dts/stih415.dtsi | |||
@@ -169,8 +169,8 @@ | |||
169 | 169 | ||
170 | pinctrl-names = "default"; | 170 | pinctrl-names = "default"; |
171 | pinctrl-0 = <&pinctrl_mii0>; | 171 | pinctrl-0 = <&pinctrl_mii0>; |
172 | clock-names = "stmmaceth"; | 172 | clock-names = "stmmaceth", "sti-ethclk"; |
173 | clocks = <&clk_s_a1_ls CLK_GMAC0_PHY>; | 173 | clocks = <&clk_s_a1_ls CLK_ICN_IF_2>, <&clk_s_a1_ls CLK_GMAC0_PHY>; |
174 | }; | 174 | }; |
175 | 175 | ||
176 | ethernet1: dwmac@fef08000 { | 176 | ethernet1: dwmac@fef08000 { |
@@ -192,8 +192,8 @@ | |||
192 | reset-names = "stmmaceth"; | 192 | reset-names = "stmmaceth"; |
193 | pinctrl-names = "default"; | 193 | pinctrl-names = "default"; |
194 | pinctrl-0 = <&pinctrl_mii1>; | 194 | pinctrl-0 = <&pinctrl_mii1>; |
195 | clock-names = "stmmaceth"; | 195 | clock-names = "stmmaceth", "sti-ethclk"; |
196 | clocks = <&clk_s_a0_ls CLK_ETH1_PHY>; | 196 | clocks = <&clk_s_a0_ls CLK_ICN_REG>, <&clk_s_a0_ls CLK_ETH1_PHY>; |
197 | }; | 197 | }; |
198 | 198 | ||
199 | rc: rc@fe518000 { | 199 | rc: rc@fe518000 { |
diff --git a/arch/arm/boot/dts/stih416-b2020-revE.dts b/arch/arm/boot/dts/stih416-b2020e.dts index ba0fa2caaf18..ba0fa2caaf18 100644 --- a/arch/arm/boot/dts/stih416-b2020-revE.dts +++ b/arch/arm/boot/dts/stih416-b2020e.dts | |||
diff --git a/arch/arm/boot/dts/stih416.dtsi b/arch/arm/boot/dts/stih416.dtsi index 06473c5d9ea9..84758d76d064 100644 --- a/arch/arm/boot/dts/stih416.dtsi +++ b/arch/arm/boot/dts/stih416.dtsi | |||
@@ -175,8 +175,8 @@ | |||
175 | reset-names = "stmmaceth"; | 175 | reset-names = "stmmaceth"; |
176 | pinctrl-names = "default"; | 176 | pinctrl-names = "default"; |
177 | pinctrl-0 = <&pinctrl_mii0>; | 177 | pinctrl-0 = <&pinctrl_mii0>; |
178 | clock-names = "stmmaceth"; | 178 | clock-names = "stmmaceth", "sti-ethclk"; |
179 | clocks = <&clk_s_a1_ls CLK_GMAC0_PHY>; | 179 | clocks = <&clk_s_a1_ls CLK_ICN_IF_2>, <&clk_s_a1_ls CLK_GMAC0_PHY>; |
180 | }; | 180 | }; |
181 | 181 | ||
182 | ethernet1: dwmac@fef08000 { | 182 | ethernet1: dwmac@fef08000 { |
@@ -197,8 +197,8 @@ | |||
197 | reset-names = "stmmaceth"; | 197 | reset-names = "stmmaceth"; |
198 | pinctrl-names = "default"; | 198 | pinctrl-names = "default"; |
199 | pinctrl-0 = <&pinctrl_mii1>; | 199 | pinctrl-0 = <&pinctrl_mii1>; |
200 | clock-names = "stmmaceth"; | 200 | clock-names = "stmmaceth", "sti-ethclk"; |
201 | clocks = <&clk_s_a0_ls CLK_ETH1_PHY>; | 201 | clocks = <&clk_s_a0_ls CLK_ICN_REG>, <&clk_s_a0_ls CLK_ETH1_PHY>; |
202 | }; | 202 | }; |
203 | 203 | ||
204 | rc: rc@fe518000 { | 204 | rc: rc@fe518000 { |
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c index 6ef146edd0cd..a20fa80776d3 100644 --- a/arch/arm/common/scoop.c +++ b/arch/arm/common/scoop.c | |||
@@ -182,7 +182,6 @@ static int scoop_probe(struct platform_device *pdev) | |||
182 | struct scoop_config *inf; | 182 | struct scoop_config *inf; |
183 | struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 183 | struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
184 | int ret; | 184 | int ret; |
185 | int temp; | ||
186 | 185 | ||
187 | if (!mem) | 186 | if (!mem) |
188 | return -EINVAL; | 187 | return -EINVAL; |
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig index 9d13dae99125..4bf72264b175 100644 --- a/arch/arm/configs/bcm_defconfig +++ b/arch/arm/configs/bcm_defconfig | |||
@@ -94,10 +94,10 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y | |||
94 | CONFIG_BACKLIGHT_PWM=y | 94 | CONFIG_BACKLIGHT_PWM=y |
95 | # CONFIG_USB_SUPPORT is not set | 95 | # CONFIG_USB_SUPPORT is not set |
96 | CONFIG_MMC=y | 96 | CONFIG_MMC=y |
97 | CONFIG_MMC_UNSAFE_RESUME=y | ||
98 | CONFIG_MMC_BLOCK_MINORS=32 | 97 | CONFIG_MMC_BLOCK_MINORS=32 |
99 | CONFIG_MMC_TEST=y | 98 | CONFIG_MMC_TEST=y |
100 | CONFIG_MMC_SDHCI=y | 99 | CONFIG_MMC_SDHCI=y |
100 | CONFIG_MMC_SDHCI_PLTFM=y | ||
101 | CONFIG_MMC_SDHCI_BCM_KONA=y | 101 | CONFIG_MMC_SDHCI_BCM_KONA=y |
102 | CONFIG_NEW_LEDS=y | 102 | CONFIG_NEW_LEDS=y |
103 | CONFIG_LEDS_CLASS=y | 103 | CONFIG_LEDS_CLASS=y |
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index ef8815327e5b..59b7e45142d8 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig | |||
@@ -186,6 +186,7 @@ CONFIG_VIDEO_MX3=y | |||
186 | CONFIG_V4L_MEM2MEM_DRIVERS=y | 186 | CONFIG_V4L_MEM2MEM_DRIVERS=y |
187 | CONFIG_VIDEO_CODA=y | 187 | CONFIG_VIDEO_CODA=y |
188 | CONFIG_SOC_CAMERA_OV2640=y | 188 | CONFIG_SOC_CAMERA_OV2640=y |
189 | CONFIG_IMX_IPUV3_CORE=y | ||
189 | CONFIG_DRM=y | 190 | CONFIG_DRM=y |
190 | CONFIG_DRM_PANEL_SIMPLE=y | 191 | CONFIG_DRM_PANEL_SIMPLE=y |
191 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | 192 | CONFIG_BACKLIGHT_LCD_SUPPORT=y |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index e2d62048e198..534836497998 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -223,12 +223,12 @@ CONFIG_POWER_RESET_GPIO=y | |||
223 | CONFIG_POWER_RESET_SUN6I=y | 223 | CONFIG_POWER_RESET_SUN6I=y |
224 | CONFIG_SENSORS_LM90=y | 224 | CONFIG_SENSORS_LM90=y |
225 | CONFIG_THERMAL=y | 225 | CONFIG_THERMAL=y |
226 | CONFIG_DOVE_THERMAL=y | ||
227 | CONFIG_ARMADA_THERMAL=y | 226 | CONFIG_ARMADA_THERMAL=y |
228 | CONFIG_WATCHDOG=y | 227 | CONFIG_WATCHDOG=y |
229 | CONFIG_ORION_WATCHDOG=y | 228 | CONFIG_ORION_WATCHDOG=y |
230 | CONFIG_SUNXI_WATCHDOG=y | 229 | CONFIG_SUNXI_WATCHDOG=y |
231 | CONFIG_MFD_AS3722=y | 230 | CONFIG_MFD_AS3722=y |
231 | CONFIG_MFD_BCM590XX=y | ||
232 | CONFIG_MFD_CROS_EC=y | 232 | CONFIG_MFD_CROS_EC=y |
233 | CONFIG_MFD_CROS_EC_SPI=y | 233 | CONFIG_MFD_CROS_EC_SPI=y |
234 | CONFIG_MFD_MAX8907=y | 234 | CONFIG_MFD_MAX8907=y |
@@ -240,6 +240,7 @@ CONFIG_MFD_TPS65910=y | |||
240 | CONFIG_REGULATOR_VIRTUAL_CONSUMER=y | 240 | CONFIG_REGULATOR_VIRTUAL_CONSUMER=y |
241 | CONFIG_REGULATOR_AB8500=y | 241 | CONFIG_REGULATOR_AB8500=y |
242 | CONFIG_REGULATOR_AS3722=y | 242 | CONFIG_REGULATOR_AS3722=y |
243 | CONFIG_REGULATOR_BCM590XX=y | ||
243 | CONFIG_REGULATOR_GPIO=y | 244 | CONFIG_REGULATOR_GPIO=y |
244 | CONFIG_REGULATOR_MAX8907=y | 245 | CONFIG_REGULATOR_MAX8907=y |
245 | CONFIG_REGULATOR_PALMAS=y | 246 | CONFIG_REGULATOR_PALMAS=y |
@@ -300,6 +301,7 @@ CONFIG_MMC=y | |||
300 | CONFIG_MMC_BLOCK_MINORS=16 | 301 | CONFIG_MMC_BLOCK_MINORS=16 |
301 | CONFIG_MMC_ARMMMCI=y | 302 | CONFIG_MMC_ARMMMCI=y |
302 | CONFIG_MMC_SDHCI=y | 303 | CONFIG_MMC_SDHCI=y |
304 | CONFIG_MMC_SDHCI_PLTFM=y | ||
303 | CONFIG_MMC_SDHCI_OF_ARASAN=y | 305 | CONFIG_MMC_SDHCI_OF_ARASAN=y |
304 | CONFIG_MMC_SDHCI_ESDHC_IMX=y | 306 | CONFIG_MMC_SDHCI_ESDHC_IMX=y |
305 | CONFIG_MMC_SDHCI_DOVE=y | 307 | CONFIG_MMC_SDHCI_DOVE=y |
@@ -352,6 +354,7 @@ CONFIG_MFD_NVEC=y | |||
352 | CONFIG_KEYBOARD_NVEC=y | 354 | CONFIG_KEYBOARD_NVEC=y |
353 | CONFIG_SERIO_NVEC_PS2=y | 355 | CONFIG_SERIO_NVEC_PS2=y |
354 | CONFIG_NVEC_POWER=y | 356 | CONFIG_NVEC_POWER=y |
357 | CONFIG_QCOM_GSBI=y | ||
355 | CONFIG_COMMON_CLK_QCOM=y | 358 | CONFIG_COMMON_CLK_QCOM=y |
356 | CONFIG_MSM_GCC_8660=y | 359 | CONFIG_MSM_GCC_8660=y |
357 | CONFIG_MSM_MMCC_8960=y | 360 | CONFIG_MSM_MMCC_8960=y |
diff --git a/arch/arm/configs/mvebu_v7_defconfig b/arch/arm/configs/mvebu_v7_defconfig index e11170e37442..b0bfefa23902 100644 --- a/arch/arm/configs/mvebu_v7_defconfig +++ b/arch/arm/configs/mvebu_v7_defconfig | |||
@@ -14,6 +14,7 @@ CONFIG_MACH_ARMADA_370=y | |||
14 | CONFIG_MACH_ARMADA_375=y | 14 | CONFIG_MACH_ARMADA_375=y |
15 | CONFIG_MACH_ARMADA_38X=y | 15 | CONFIG_MACH_ARMADA_38X=y |
16 | CONFIG_MACH_ARMADA_XP=y | 16 | CONFIG_MACH_ARMADA_XP=y |
17 | CONFIG_MACH_DOVE=y | ||
17 | CONFIG_NEON=y | 18 | CONFIG_NEON=y |
18 | # CONFIG_CACHE_L2X0 is not set | 19 | # CONFIG_CACHE_L2X0 is not set |
19 | # CONFIG_SWP_EMULATE is not set | 20 | # CONFIG_SWP_EMULATE is not set |
@@ -52,6 +53,7 @@ CONFIG_INPUT_EVDEV=y | |||
52 | CONFIG_KEYBOARD_GPIO=y | 53 | CONFIG_KEYBOARD_GPIO=y |
53 | CONFIG_SERIAL_8250=y | 54 | CONFIG_SERIAL_8250=y |
54 | CONFIG_SERIAL_8250_CONSOLE=y | 55 | CONFIG_SERIAL_8250_CONSOLE=y |
56 | CONFIG_SERIAL_OF_PLATFORM=y | ||
55 | CONFIG_I2C=y | 57 | CONFIG_I2C=y |
56 | CONFIG_SPI=y | 58 | CONFIG_SPI=y |
57 | CONFIG_SPI_ORION=y | 59 | CONFIG_SPI_ORION=y |
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index 59066cf0271a..536a137863cb 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig | |||
@@ -32,6 +32,7 @@ CONFIG_SOC_OMAP5=y | |||
32 | CONFIG_SOC_AM33XX=y | 32 | CONFIG_SOC_AM33XX=y |
33 | CONFIG_SOC_AM43XX=y | 33 | CONFIG_SOC_AM43XX=y |
34 | CONFIG_SOC_DRA7XX=y | 34 | CONFIG_SOC_DRA7XX=y |
35 | CONFIG_CACHE_L2X0=y | ||
35 | CONFIG_ARM_THUMBEE=y | 36 | CONFIG_ARM_THUMBEE=y |
36 | CONFIG_ARM_ERRATA_411920=y | 37 | CONFIG_ARM_ERRATA_411920=y |
37 | CONFIG_SMP=y | 38 | CONFIG_SMP=y |
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h index eb577f4f5f70..39eb16b0066f 100644 --- a/arch/arm/include/asm/ftrace.h +++ b/arch/arm/include/asm/ftrace.h | |||
@@ -52,7 +52,7 @@ extern inline void *return_address(unsigned int level) | |||
52 | 52 | ||
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | #define ftrace_return_addr(n) return_address(n) | 55 | #define ftrace_return_address(n) return_address(n) |
56 | 56 | ||
57 | #endif /* ifndef __ASSEMBLY__ */ | 57 | #endif /* ifndef __ASSEMBLY__ */ |
58 | 58 | ||
diff --git a/arch/arm/include/asm/mcpm.h b/arch/arm/include/asm/mcpm.h index d9702eb0b02b..94060adba174 100644 --- a/arch/arm/include/asm/mcpm.h +++ b/arch/arm/include/asm/mcpm.h | |||
@@ -208,8 +208,6 @@ struct sync_struct { | |||
208 | struct mcpm_sync_struct clusters[MAX_NR_CLUSTERS]; | 208 | struct mcpm_sync_struct clusters[MAX_NR_CLUSTERS]; |
209 | }; | 209 | }; |
210 | 210 | ||
211 | extern unsigned long sync_phys; /* physical address of *mcpm_sync */ | ||
212 | |||
213 | void __mcpm_cpu_going_down(unsigned int cpu, unsigned int cluster); | 211 | void __mcpm_cpu_going_down(unsigned int cpu, unsigned int cluster); |
214 | void __mcpm_cpu_down(unsigned int cpu, unsigned int cluster); | 212 | void __mcpm_cpu_down(unsigned int cpu, unsigned int cluster); |
215 | void __mcpm_outbound_leave_critical(unsigned int cluster, int state); | 213 | void __mcpm_outbound_leave_critical(unsigned int cluster, int state); |
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index f989d7c22dc5..e4e4208a9130 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h | |||
@@ -114,8 +114,14 @@ static inline struct thread_info *current_thread_info(void) | |||
114 | ((unsigned long)(task_thread_info(tsk)->cpu_context.pc)) | 114 | ((unsigned long)(task_thread_info(tsk)->cpu_context.pc)) |
115 | #define thread_saved_sp(tsk) \ | 115 | #define thread_saved_sp(tsk) \ |
116 | ((unsigned long)(task_thread_info(tsk)->cpu_context.sp)) | 116 | ((unsigned long)(task_thread_info(tsk)->cpu_context.sp)) |
117 | |||
118 | #ifndef CONFIG_THUMB2_KERNEL | ||
117 | #define thread_saved_fp(tsk) \ | 119 | #define thread_saved_fp(tsk) \ |
118 | ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) | 120 | ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) |
121 | #else | ||
122 | #define thread_saved_fp(tsk) \ | ||
123 | ((unsigned long)(task_thread_info(tsk)->cpu_context.r7)) | ||
124 | #endif | ||
119 | 125 | ||
120 | extern void crunch_task_disable(struct thread_info *); | 126 | extern void crunch_task_disable(struct thread_info *); |
121 | extern void crunch_task_copy(struct thread_info *, void *); | 127 | extern void crunch_task_copy(struct thread_info *, void *); |
diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c index 9db4b659d03e..cb1424240ff6 100644 --- a/arch/arm/kernel/kprobes-test-arm.c +++ b/arch/arm/kernel/kprobes-test-arm.c | |||
@@ -74,8 +74,6 @@ void kprobe_arm_test_cases(void) | |||
74 | TEST_RRR( op "lt" s " r11, r",11,VAL1,", r",14,N(val),", asr r",7, 6,"")\ | 74 | TEST_RRR( op "lt" s " r11, r",11,VAL1,", r",14,N(val),", asr r",7, 6,"")\ |
75 | TEST_RR( op "gt" s " r12, r13" ", r",14,val, ", ror r",14,7,"")\ | 75 | TEST_RR( op "gt" s " r12, r13" ", r",14,val, ", ror r",14,7,"")\ |
76 | TEST_RR( op "le" s " r14, r",0, val, ", r13" ", lsl r",14,8,"")\ | 76 | TEST_RR( op "le" s " r14, r",0, val, ", r13" ", lsl r",14,8,"")\ |
77 | TEST_RR( op s " r12, pc" ", r",14,val, ", ror r",14,7,"")\ | ||
78 | TEST_RR( op s " r14, r",0, val, ", pc" ", lsl r",14,8,"")\ | ||
79 | TEST_R( op "eq" s " r0, r",11,VAL1,", #0xf5") \ | 77 | TEST_R( op "eq" s " r0, r",11,VAL1,", #0xf5") \ |
80 | TEST_R( op "ne" s " r11, r",0, VAL1,", #0xf5000000") \ | 78 | TEST_R( op "ne" s " r11, r",0, VAL1,", #0xf5000000") \ |
81 | TEST_R( op s " r7, r",8, VAL2,", #0x000af000") \ | 79 | TEST_R( op s " r7, r",8, VAL2,", #0x000af000") \ |
@@ -103,8 +101,6 @@ void kprobe_arm_test_cases(void) | |||
103 | TEST_RRR( op "ge r",11,VAL1,", r",14,N(val),", asr r",7, 6,"") \ | 101 | TEST_RRR( op "ge r",11,VAL1,", r",14,N(val),", asr r",7, 6,"") \ |
104 | TEST_RR( op "le r13" ", r",14,val, ", ror r",14,7,"") \ | 102 | TEST_RR( op "le r13" ", r",14,val, ", ror r",14,7,"") \ |
105 | TEST_RR( op "gt r",0, val, ", r13" ", lsl r",14,8,"") \ | 103 | TEST_RR( op "gt r",0, val, ", r13" ", lsl r",14,8,"") \ |
106 | TEST_RR( op " pc" ", r",14,val, ", ror r",14,7,"") \ | ||
107 | TEST_RR( op " r",0, val, ", pc" ", lsl r",14,8,"") \ | ||
108 | TEST_R( op "eq r",11,VAL1,", #0xf5") \ | 104 | TEST_R( op "eq r",11,VAL1,", #0xf5") \ |
109 | TEST_R( op "ne r",0, VAL1,", #0xf5000000") \ | 105 | TEST_R( op "ne r",0, VAL1,", #0xf5000000") \ |
110 | TEST_R( op " r",8, VAL2,", #0x000af000") | 106 | TEST_R( op " r",8, VAL2,", #0x000af000") |
@@ -125,7 +121,6 @@ void kprobe_arm_test_cases(void) | |||
125 | TEST_RR( op "ge" s " r11, r",11,N(val),", asr r",7, 6,"") \ | 121 | TEST_RR( op "ge" s " r11, r",11,N(val),", asr r",7, 6,"") \ |
126 | TEST_RR( op "lt" s " r12, r",11,val, ", ror r",14,7,"") \ | 122 | TEST_RR( op "lt" s " r12, r",11,val, ", ror r",14,7,"") \ |
127 | TEST_R( op "gt" s " r14, r13" ", lsl r",14,8,"") \ | 123 | TEST_R( op "gt" s " r14, r13" ", lsl r",14,8,"") \ |
128 | TEST_R( op "le" s " r14, pc" ", lsl r",14,8,"") \ | ||
129 | TEST( op "eq" s " r0, #0xf5") \ | 124 | TEST( op "eq" s " r0, #0xf5") \ |
130 | TEST( op "ne" s " r11, #0xf5000000") \ | 125 | TEST( op "ne" s " r11, #0xf5000000") \ |
131 | TEST( op s " r7, #0x000af000") \ | 126 | TEST( op s " r7, #0x000af000") \ |
@@ -159,12 +154,19 @@ void kprobe_arm_test_cases(void) | |||
159 | TEST_SUPPORTED("cmp pc, #0x1000"); | 154 | TEST_SUPPORTED("cmp pc, #0x1000"); |
160 | TEST_SUPPORTED("cmp sp, #0x1000"); | 155 | TEST_SUPPORTED("cmp sp, #0x1000"); |
161 | 156 | ||
162 | /* Data-processing with PC as shift*/ | 157 | /* Data-processing with PC and a shift count in a register */ |
163 | TEST_UNSUPPORTED(__inst_arm(0xe15c0f1e) " @ cmp r12, r14, asl pc") | 158 | TEST_UNSUPPORTED(__inst_arm(0xe15c0f1e) " @ cmp r12, r14, asl pc") |
164 | TEST_UNSUPPORTED(__inst_arm(0xe1a0cf1e) " @ mov r12, r14, asl pc") | 159 | TEST_UNSUPPORTED(__inst_arm(0xe1a0cf1e) " @ mov r12, r14, asl pc") |
165 | TEST_UNSUPPORTED(__inst_arm(0xe08caf1e) " @ add r10, r12, r14, asl pc") | 160 | TEST_UNSUPPORTED(__inst_arm(0xe08caf1e) " @ add r10, r12, r14, asl pc") |
166 | 161 | TEST_UNSUPPORTED(__inst_arm(0xe151021f) " @ cmp r1, pc, lsl r2") | |
167 | /* Data-processing with PC as shift*/ | 162 | TEST_UNSUPPORTED(__inst_arm(0xe17f0211) " @ cmn pc, r1, lsl r2") |
163 | TEST_UNSUPPORTED(__inst_arm(0xe1a0121f) " @ mov r1, pc, lsl r2") | ||
164 | TEST_UNSUPPORTED(__inst_arm(0xe1a0f211) " @ mov pc, r1, lsl r2") | ||
165 | TEST_UNSUPPORTED(__inst_arm(0xe042131f) " @ sub r1, r2, pc, lsl r3") | ||
166 | TEST_UNSUPPORTED(__inst_arm(0xe1cf1312) " @ bic r1, pc, r2, lsl r3") | ||
167 | TEST_UNSUPPORTED(__inst_arm(0xe081f312) " @ add pc, r1, r2, lsl r3") | ||
168 | |||
169 | /* Data-processing with PC as a target and status registers updated */ | ||
168 | TEST_UNSUPPORTED("movs pc, r1") | 170 | TEST_UNSUPPORTED("movs pc, r1") |
169 | TEST_UNSUPPORTED("movs pc, r1, lsl r2") | 171 | TEST_UNSUPPORTED("movs pc, r1, lsl r2") |
170 | TEST_UNSUPPORTED("movs pc, #0x10000") | 172 | TEST_UNSUPPORTED("movs pc, #0x10000") |
@@ -187,14 +189,14 @@ void kprobe_arm_test_cases(void) | |||
187 | TEST_BF_R ("add pc, pc, r",14,2f-1f-8,"") | 189 | TEST_BF_R ("add pc, pc, r",14,2f-1f-8,"") |
188 | TEST_BF_R ("add pc, r",14,2f-1f-8,", pc") | 190 | TEST_BF_R ("add pc, r",14,2f-1f-8,", pc") |
189 | TEST_BF_R ("mov pc, r",0,2f,"") | 191 | TEST_BF_R ("mov pc, r",0,2f,"") |
190 | TEST_BF_RR("mov pc, r",0,2f,", asl r",1,0,"") | 192 | TEST_BF_R ("add pc, pc, r",14,(2f-1f-8)*2,", asr #1") |
191 | TEST_BB( "sub pc, pc, #1b-2b+8") | 193 | TEST_BB( "sub pc, pc, #1b-2b+8") |
192 | #if __LINUX_ARM_ARCH__ == 6 && !defined(CONFIG_CPU_V7) | 194 | #if __LINUX_ARM_ARCH__ == 6 && !defined(CONFIG_CPU_V7) |
193 | TEST_BB( "sub pc, pc, #1b-2b+8-2") /* UNPREDICTABLE before and after ARMv6 */ | 195 | TEST_BB( "sub pc, pc, #1b-2b+8-2") /* UNPREDICTABLE before and after ARMv6 */ |
194 | #endif | 196 | #endif |
195 | TEST_BB_R( "sub pc, pc, r",14, 1f-2f+8,"") | 197 | TEST_BB_R( "sub pc, pc, r",14, 1f-2f+8,"") |
196 | TEST_BB_R( "rsb pc, r",14,1f-2f+8,", pc") | 198 | TEST_BB_R( "rsb pc, r",14,1f-2f+8,", pc") |
197 | TEST_RR( "add pc, pc, r",10,-2,", asl r",11,1,"") | 199 | TEST_R( "add pc, pc, r",10,-2,", asl #1") |
198 | #ifdef CONFIG_THUMB2_KERNEL | 200 | #ifdef CONFIG_THUMB2_KERNEL |
199 | TEST_ARM_TO_THUMB_INTERWORK_R("add pc, pc, r",0,3f-1f-8+1,"") | 201 | TEST_ARM_TO_THUMB_INTERWORK_R("add pc, pc, r",0,3f-1f-8+1,"") |
200 | TEST_ARM_TO_THUMB_INTERWORK_R("sub pc, r",0,3f+8+1,", #8") | 202 | TEST_ARM_TO_THUMB_INTERWORK_R("sub pc, r",0,3f+8+1,", #8") |
@@ -216,6 +218,7 @@ void kprobe_arm_test_cases(void) | |||
216 | TEST_BB_R("bx r",7,2f,"") | 218 | TEST_BB_R("bx r",7,2f,"") |
217 | TEST_BF_R("bxeq r",14,2f,"") | 219 | TEST_BF_R("bxeq r",14,2f,"") |
218 | 220 | ||
221 | #if __LINUX_ARM_ARCH__ >= 5 | ||
219 | TEST_R("clz r0, r",0, 0x0,"") | 222 | TEST_R("clz r0, r",0, 0x0,"") |
220 | TEST_R("clzeq r7, r",14,0x1,"") | 223 | TEST_R("clzeq r7, r",14,0x1,"") |
221 | TEST_R("clz lr, r",7, 0xffffffff,"") | 224 | TEST_R("clz lr, r",7, 0xffffffff,"") |
@@ -337,6 +340,7 @@ void kprobe_arm_test_cases(void) | |||
337 | TEST_UNSUPPORTED(__inst_arm(0xe16f02e1) " @ smultt pc, r1, r2") | 340 | TEST_UNSUPPORTED(__inst_arm(0xe16f02e1) " @ smultt pc, r1, r2") |
338 | TEST_UNSUPPORTED(__inst_arm(0xe16002ef) " @ smultt r0, pc, r2") | 341 | TEST_UNSUPPORTED(__inst_arm(0xe16002ef) " @ smultt r0, pc, r2") |
339 | TEST_UNSUPPORTED(__inst_arm(0xe1600fe1) " @ smultt r0, r1, pc") | 342 | TEST_UNSUPPORTED(__inst_arm(0xe1600fe1) " @ smultt r0, r1, pc") |
343 | #endif | ||
340 | 344 | ||
341 | TEST_GROUP("Multiply and multiply-accumulate") | 345 | TEST_GROUP("Multiply and multiply-accumulate") |
342 | 346 | ||
@@ -559,6 +563,7 @@ void kprobe_arm_test_cases(void) | |||
559 | TEST_UNSUPPORTED("ldrsht r1, [r2], #48") | 563 | TEST_UNSUPPORTED("ldrsht r1, [r2], #48") |
560 | #endif | 564 | #endif |
561 | 565 | ||
566 | #if __LINUX_ARM_ARCH__ >= 5 | ||
562 | TEST_RPR( "strd r",0, VAL1,", [r",1, 48,", -r",2,24,"]") | 567 | TEST_RPR( "strd r",0, VAL1,", [r",1, 48,", -r",2,24,"]") |
563 | TEST_RPR( "strccd r",8, VAL2,", [r",13,0, ", r",12,48,"]") | 568 | TEST_RPR( "strccd r",8, VAL2,", [r",13,0, ", r",12,48,"]") |
564 | TEST_RPR( "strd r",4, VAL1,", [r",2, 24,", r",3, 48,"]!") | 569 | TEST_RPR( "strd r",4, VAL1,", [r",2, 24,", r",3, 48,"]!") |
@@ -595,6 +600,7 @@ void kprobe_arm_test_cases(void) | |||
595 | TEST_UNSUPPORTED(__inst_arm(0xe1efc3d0) " @ ldrd r12, [pc, #48]!") | 600 | TEST_UNSUPPORTED(__inst_arm(0xe1efc3d0) " @ ldrd r12, [pc, #48]!") |
596 | TEST_UNSUPPORTED(__inst_arm(0xe0c9f3d0) " @ ldrd pc, [r9], #48") | 601 | TEST_UNSUPPORTED(__inst_arm(0xe0c9f3d0) " @ ldrd pc, [r9], #48") |
597 | TEST_UNSUPPORTED(__inst_arm(0xe0c9e3d0) " @ ldrd lr, [r9], #48") | 602 | TEST_UNSUPPORTED(__inst_arm(0xe0c9e3d0) " @ ldrd lr, [r9], #48") |
603 | #endif | ||
598 | 604 | ||
599 | TEST_GROUP("Miscellaneous") | 605 | TEST_GROUP("Miscellaneous") |
600 | 606 | ||
@@ -1227,7 +1233,9 @@ void kprobe_arm_test_cases(void) | |||
1227 | TEST_COPROCESSOR( "mrc"two" 0, 0, r0, cr0, cr0, 0") | 1233 | TEST_COPROCESSOR( "mrc"two" 0, 0, r0, cr0, cr0, 0") |
1228 | 1234 | ||
1229 | COPROCESSOR_INSTRUCTIONS_ST_LD("",e) | 1235 | COPROCESSOR_INSTRUCTIONS_ST_LD("",e) |
1236 | #if __LINUX_ARM_ARCH__ >= 5 | ||
1230 | COPROCESSOR_INSTRUCTIONS_MC_MR("",e) | 1237 | COPROCESSOR_INSTRUCTIONS_MC_MR("",e) |
1238 | #endif | ||
1231 | TEST_UNSUPPORTED("svc 0") | 1239 | TEST_UNSUPPORTED("svc 0") |
1232 | TEST_UNSUPPORTED("svc 0xffffff") | 1240 | TEST_UNSUPPORTED("svc 0xffffff") |
1233 | 1241 | ||
@@ -1287,7 +1295,9 @@ void kprobe_arm_test_cases(void) | |||
1287 | TEST( "blx __dummy_thumb_subroutine_odd") | 1295 | TEST( "blx __dummy_thumb_subroutine_odd") |
1288 | #endif /* __LINUX_ARM_ARCH__ >= 6 */ | 1296 | #endif /* __LINUX_ARM_ARCH__ >= 6 */ |
1289 | 1297 | ||
1298 | #if __LINUX_ARM_ARCH__ >= 5 | ||
1290 | COPROCESSOR_INSTRUCTIONS_ST_LD("2",f) | 1299 | COPROCESSOR_INSTRUCTIONS_ST_LD("2",f) |
1300 | #endif | ||
1291 | #if __LINUX_ARM_ARCH__ >= 6 | 1301 | #if __LINUX_ARM_ARCH__ >= 6 |
1292 | COPROCESSOR_INSTRUCTIONS_MC_MR("2",f) | 1302 | COPROCESSOR_INSTRUCTIONS_MC_MR("2",f) |
1293 | #endif | 1303 | #endif |
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c index 379639998d5a..08d731294bcd 100644 --- a/arch/arm/kernel/kprobes-test.c +++ b/arch/arm/kernel/kprobes-test.c | |||
@@ -225,6 +225,7 @@ static int pre_handler_called; | |||
225 | static int post_handler_called; | 225 | static int post_handler_called; |
226 | static int jprobe_func_called; | 226 | static int jprobe_func_called; |
227 | static int kretprobe_handler_called; | 227 | static int kretprobe_handler_called; |
228 | static int tests_failed; | ||
228 | 229 | ||
229 | #define FUNC_ARG1 0x12345678 | 230 | #define FUNC_ARG1 0x12345678 |
230 | #define FUNC_ARG2 0xabcdef | 231 | #define FUNC_ARG2 0xabcdef |
@@ -461,6 +462,13 @@ static int run_api_tests(long (*func)(long, long)) | |||
461 | 462 | ||
462 | pr_info(" jprobe\n"); | 463 | pr_info(" jprobe\n"); |
463 | ret = test_jprobe(func); | 464 | ret = test_jprobe(func); |
465 | #if defined(CONFIG_THUMB2_KERNEL) && !defined(MODULE) | ||
466 | if (ret == -EINVAL) { | ||
467 | pr_err("FAIL: Known longtime bug with jprobe on Thumb kernels\n"); | ||
468 | tests_failed = ret; | ||
469 | ret = 0; | ||
470 | } | ||
471 | #endif | ||
464 | if (ret < 0) | 472 | if (ret < 0) |
465 | return ret; | 473 | return ret; |
466 | 474 | ||
@@ -1672,6 +1680,8 @@ static int __init run_all_tests(void) | |||
1672 | 1680 | ||
1673 | out: | 1681 | out: |
1674 | if (ret == 0) | 1682 | if (ret == 0) |
1683 | ret = tests_failed; | ||
1684 | if (ret == 0) | ||
1675 | pr_info("Finished kprobe tests OK\n"); | 1685 | pr_info("Finished kprobe tests OK\n"); |
1676 | else | 1686 | else |
1677 | pr_err("kprobe tests failed\n"); | 1687 | pr_err("kprobe tests failed\n"); |
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c index 2037f7205987..1d37568c547a 100644 --- a/arch/arm/kernel/perf_event_v7.c +++ b/arch/arm/kernel/perf_event_v7.c | |||
@@ -1924,7 +1924,7 @@ static int krait_pmu_get_event_idx(struct pmu_hw_events *cpuc, | |||
1924 | struct perf_event *event) | 1924 | struct perf_event *event) |
1925 | { | 1925 | { |
1926 | int idx; | 1926 | int idx; |
1927 | int bit; | 1927 | int bit = -1; |
1928 | unsigned int prefix; | 1928 | unsigned int prefix; |
1929 | unsigned int region; | 1929 | unsigned int region; |
1930 | unsigned int code; | 1930 | unsigned int code; |
@@ -1953,7 +1953,7 @@ static int krait_pmu_get_event_idx(struct pmu_hw_events *cpuc, | |||
1953 | } | 1953 | } |
1954 | 1954 | ||
1955 | idx = armv7pmu_get_event_idx(cpuc, event); | 1955 | idx = armv7pmu_get_event_idx(cpuc, event); |
1956 | if (idx < 0 && krait_event) | 1956 | if (idx < 0 && bit >= 0) |
1957 | clear_bit(bit, cpuc->used_mask); | 1957 | clear_bit(bit, cpuc->used_mask); |
1958 | 1958 | ||
1959 | return idx; | 1959 | return idx; |
diff --git a/arch/arm/kernel/probes-arm.c b/arch/arm/kernel/probes-arm.c index 51a13a027989..8eaef81d8344 100644 --- a/arch/arm/kernel/probes-arm.c +++ b/arch/arm/kernel/probes-arm.c | |||
@@ -341,12 +341,12 @@ static const union decode_item arm_cccc_000x_table[] = { | |||
341 | /* CMP (reg-shift reg) cccc 0001 0101 xxxx xxxx xxxx 0xx1 xxxx */ | 341 | /* CMP (reg-shift reg) cccc 0001 0101 xxxx xxxx xxxx 0xx1 xxxx */ |
342 | /* CMN (reg-shift reg) cccc 0001 0111 xxxx xxxx xxxx 0xx1 xxxx */ | 342 | /* CMN (reg-shift reg) cccc 0001 0111 xxxx xxxx xxxx 0xx1 xxxx */ |
343 | DECODE_EMULATEX (0x0f900090, 0x01100010, PROBES_DATA_PROCESSING_REG, | 343 | DECODE_EMULATEX (0x0f900090, 0x01100010, PROBES_DATA_PROCESSING_REG, |
344 | REGS(ANY, 0, NOPC, 0, ANY)), | 344 | REGS(NOPC, 0, NOPC, 0, NOPC)), |
345 | 345 | ||
346 | /* MOV (reg-shift reg) cccc 0001 101x xxxx xxxx xxxx 0xx1 xxxx */ | 346 | /* MOV (reg-shift reg) cccc 0001 101x xxxx xxxx xxxx 0xx1 xxxx */ |
347 | /* MVN (reg-shift reg) cccc 0001 111x xxxx xxxx xxxx 0xx1 xxxx */ | 347 | /* MVN (reg-shift reg) cccc 0001 111x xxxx xxxx xxxx 0xx1 xxxx */ |
348 | DECODE_EMULATEX (0x0fa00090, 0x01a00010, PROBES_DATA_PROCESSING_REG, | 348 | DECODE_EMULATEX (0x0fa00090, 0x01a00010, PROBES_DATA_PROCESSING_REG, |
349 | REGS(0, ANY, NOPC, 0, ANY)), | 349 | REGS(0, NOPC, NOPC, 0, NOPC)), |
350 | 350 | ||
351 | /* AND (reg-shift reg) cccc 0000 000x xxxx xxxx xxxx 0xx1 xxxx */ | 351 | /* AND (reg-shift reg) cccc 0000 000x xxxx xxxx xxxx 0xx1 xxxx */ |
352 | /* EOR (reg-shift reg) cccc 0000 001x xxxx xxxx xxxx 0xx1 xxxx */ | 352 | /* EOR (reg-shift reg) cccc 0000 001x xxxx xxxx xxxx 0xx1 xxxx */ |
@@ -359,7 +359,7 @@ static const union decode_item arm_cccc_000x_table[] = { | |||
359 | /* ORR (reg-shift reg) cccc 0001 100x xxxx xxxx xxxx 0xx1 xxxx */ | 359 | /* ORR (reg-shift reg) cccc 0001 100x xxxx xxxx xxxx 0xx1 xxxx */ |
360 | /* BIC (reg-shift reg) cccc 0001 110x xxxx xxxx xxxx 0xx1 xxxx */ | 360 | /* BIC (reg-shift reg) cccc 0001 110x xxxx xxxx xxxx 0xx1 xxxx */ |
361 | DECODE_EMULATEX (0x0e000090, 0x00000010, PROBES_DATA_PROCESSING_REG, | 361 | DECODE_EMULATEX (0x0e000090, 0x00000010, PROBES_DATA_PROCESSING_REG, |
362 | REGS(ANY, ANY, NOPC, 0, ANY)), | 362 | REGS(NOPC, NOPC, NOPC, 0, NOPC)), |
363 | 363 | ||
364 | DECODE_END | 364 | DECODE_END |
365 | }; | 365 | }; |
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 0dd3b79b15c3..0c27ed6f3f23 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
@@ -908,7 +908,7 @@ enum ptrace_syscall_dir { | |||
908 | PTRACE_SYSCALL_EXIT, | 908 | PTRACE_SYSCALL_EXIT, |
909 | }; | 909 | }; |
910 | 910 | ||
911 | static int tracehook_report_syscall(struct pt_regs *regs, | 911 | static void tracehook_report_syscall(struct pt_regs *regs, |
912 | enum ptrace_syscall_dir dir) | 912 | enum ptrace_syscall_dir dir) |
913 | { | 913 | { |
914 | unsigned long ip; | 914 | unsigned long ip; |
@@ -926,7 +926,6 @@ static int tracehook_report_syscall(struct pt_regs *regs, | |||
926 | current_thread_info()->syscall = -1; | 926 | current_thread_info()->syscall = -1; |
927 | 927 | ||
928 | regs->ARM_ip = ip; | 928 | regs->ARM_ip = ip; |
929 | return current_thread_info()->syscall; | ||
930 | } | 929 | } |
931 | 930 | ||
932 | asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) | 931 | asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) |
@@ -938,7 +937,9 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) | |||
938 | return -1; | 937 | return -1; |
939 | 938 | ||
940 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | 939 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
941 | scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); | 940 | tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); |
941 | |||
942 | scno = current_thread_info()->syscall; | ||
942 | 943 | ||
943 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | 944 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
944 | trace_sys_enter(regs, scno); | 945 | trace_sys_enter(regs, scno); |
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig index 9bc6db1c1348..41c839167e87 100644 --- a/arch/arm/mach-bcm/Kconfig +++ b/arch/arm/mach-bcm/Kconfig | |||
@@ -1,10 +1,9 @@ | |||
1 | config ARCH_BCM | 1 | menuconfig ARCH_BCM |
2 | bool "Broadcom SoC Support" if ARCH_MULTI_V6_V7 | 2 | bool "Broadcom SoC Support" if ARCH_MULTI_V6_V7 |
3 | help | 3 | help |
4 | This enables support for Broadcom ARM based SoC chips | 4 | This enables support for Broadcom ARM based SoC chips |
5 | 5 | ||
6 | menu "Broadcom SoC Selection" | 6 | if ARCH_BCM |
7 | depends on ARCH_BCM | ||
8 | 7 | ||
9 | config ARCH_BCM_MOBILE | 8 | config ARCH_BCM_MOBILE |
10 | bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7 | 9 | bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7 |
@@ -88,4 +87,4 @@ config ARCH_BCM_5301X | |||
88 | different SoC or with the older BCM47XX and BCM53XX based | 87 | different SoC or with the older BCM47XX and BCM53XX based |
89 | network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx | 88 | network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx |
90 | 89 | ||
91 | endmenu | 90 | endif |
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig index 101e0f356730..2631cfc5ab0d 100644 --- a/arch/arm/mach-berlin/Kconfig +++ b/arch/arm/mach-berlin/Kconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | config ARCH_BERLIN | 1 | menuconfig ARCH_BERLIN |
2 | bool "Marvell Berlin SoCs" if ARCH_MULTI_V7 | 2 | bool "Marvell Berlin SoCs" if ARCH_MULTI_V7 |
3 | select ARCH_REQUIRE_GPIOLIB | 3 | select ARCH_REQUIRE_GPIOLIB |
4 | select ARM_GIC | 4 | select ARM_GIC |
@@ -9,8 +9,6 @@ config ARCH_BERLIN | |||
9 | 9 | ||
10 | if ARCH_BERLIN | 10 | if ARCH_BERLIN |
11 | 11 | ||
12 | menu "Marvell Berlin SoC variants" | ||
13 | |||
14 | config MACH_BERLIN_BG2 | 12 | config MACH_BERLIN_BG2 |
15 | bool "Marvell Armada 1500 (BG2)" | 13 | bool "Marvell Armada 1500 (BG2)" |
16 | select CACHE_L2X0 | 14 | select CACHE_L2X0 |
@@ -30,6 +28,4 @@ config MACH_BERLIN_BG2Q | |||
30 | select HAVE_ARM_TWD if SMP | 28 | select HAVE_ARM_TWD if SMP |
31 | select PINCTRL_BERLIN_BG2Q | 29 | select PINCTRL_BERLIN_BG2Q |
32 | 30 | ||
33 | endmenu | ||
34 | |||
35 | endif | 31 | endif |
diff --git a/arch/arm/mach-cns3xxx/Kconfig b/arch/arm/mach-cns3xxx/Kconfig index 66838f42037f..3c22a1990ecd 100644 --- a/arch/arm/mach-cns3xxx/Kconfig +++ b/arch/arm/mach-cns3xxx/Kconfig | |||
@@ -1,12 +1,11 @@ | |||
1 | config ARCH_CNS3XXX | 1 | menuconfig ARCH_CNS3XXX |
2 | bool "Cavium Networks CNS3XXX family" if ARCH_MULTI_V6 | 2 | bool "Cavium Networks CNS3XXX family" if ARCH_MULTI_V6 |
3 | select ARM_GIC | 3 | select ARM_GIC |
4 | select PCI_DOMAINS if PCI | 4 | select PCI_DOMAINS if PCI |
5 | help | 5 | help |
6 | Support for Cavium Networks CNS3XXX platform. | 6 | Support for Cavium Networks CNS3XXX platform. |
7 | 7 | ||
8 | menu "CNS3XXX platform type" | 8 | if ARCH_CNS3XXX |
9 | depends on ARCH_CNS3XXX | ||
10 | 9 | ||
11 | config MACH_CNS3420VB | 10 | config MACH_CNS3420VB |
12 | bool "Support for CNS3420 Validation Board" | 11 | bool "Support for CNS3420 Validation Board" |
@@ -17,4 +16,4 @@ config MACH_CNS3420VB | |||
17 | This is a platform with an on-board ARM11 MPCore and has support | 16 | This is a platform with an on-board ARM11 MPCore and has support |
18 | for USB, USB-OTG, MMC/SD/SDIO, SATA, PCI-E, etc. | 17 | for USB, USB-OTG, MMC/SD/SDIO, SATA, PCI-E, etc. |
19 | 18 | ||
20 | endmenu | 19 | endif |
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig index db18ef866593..584e8d4e2892 100644 --- a/arch/arm/mach-davinci/Kconfig +++ b/arch/arm/mach-davinci/Kconfig | |||
@@ -39,7 +39,6 @@ config ARCH_DAVINCI_DA830 | |||
39 | config ARCH_DAVINCI_DA850 | 39 | config ARCH_DAVINCI_DA850 |
40 | bool "DA850/OMAP-L138/AM18x based system" | 40 | bool "DA850/OMAP-L138/AM18x based system" |
41 | select ARCH_DAVINCI_DA8XX | 41 | select ARCH_DAVINCI_DA8XX |
42 | select ARCH_HAS_CPUFREQ | ||
43 | select CP_INTC | 42 | select CP_INTC |
44 | 43 | ||
45 | config ARCH_DAVINCI_DA8XX | 44 | config ARCH_DAVINCI_DA8XX |
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index d58995c9a95a..8f9b66c4ac78 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig | |||
@@ -7,10 +7,9 @@ | |||
7 | 7 | ||
8 | # Configuration options for the EXYNOS4 | 8 | # Configuration options for the EXYNOS4 |
9 | 9 | ||
10 | config ARCH_EXYNOS | 10 | menuconfig ARCH_EXYNOS |
11 | bool "Samsung EXYNOS" if ARCH_MULTI_V7 | 11 | bool "Samsung EXYNOS" if ARCH_MULTI_V7 |
12 | select ARCH_HAS_BANDGAP | 12 | select ARCH_HAS_BANDGAP |
13 | select ARCH_HAS_CPUFREQ | ||
14 | select ARCH_HAS_HOLES_MEMORYMODEL | 13 | select ARCH_HAS_HOLES_MEMORYMODEL |
15 | select ARCH_REQUIRE_GPIOLIB | 14 | select ARCH_REQUIRE_GPIOLIB |
16 | select ARM_AMBA | 15 | select ARM_AMBA |
@@ -30,8 +29,6 @@ config ARCH_EXYNOS | |||
30 | 29 | ||
31 | if ARCH_EXYNOS | 30 | if ARCH_EXYNOS |
32 | 31 | ||
33 | menu "SAMSUNG EXYNOS SoCs Support" | ||
34 | |||
35 | config ARCH_EXYNOS3 | 32 | config ARCH_EXYNOS3 |
36 | bool "SAMSUNG EXYNOS3" | 33 | bool "SAMSUNG EXYNOS3" |
37 | select ARM_CPU_SUSPEND if PM | 34 | select ARM_CPU_SUSPEND if PM |
@@ -118,8 +115,6 @@ config SOC_EXYNOS5800 | |||
118 | default y | 115 | default y |
119 | depends on SOC_EXYNOS5420 | 116 | depends on SOC_EXYNOS5420 |
120 | 117 | ||
121 | endmenu | ||
122 | |||
123 | config EXYNOS5420_MCPM | 118 | config EXYNOS5420_MCPM |
124 | bool "Exynos5420 Multi-Cluster PM support" | 119 | bool "Exynos5420 Multi-Cluster PM support" |
125 | depends on MCPM && SOC_EXYNOS5420 | 120 | depends on MCPM && SOC_EXYNOS5420 |
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 16617bdb37a9..1ee91763fa7c 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h | |||
@@ -118,6 +118,7 @@ extern void __iomem *sysram_ns_base_addr; | |||
118 | extern void __iomem *sysram_base_addr; | 118 | extern void __iomem *sysram_base_addr; |
119 | void exynos_init_io(void); | 119 | void exynos_init_io(void); |
120 | void exynos_restart(enum reboot_mode mode, const char *cmd); | 120 | void exynos_restart(enum reboot_mode mode, const char *cmd); |
121 | void exynos_sysram_init(void); | ||
121 | void exynos_cpuidle_init(void); | 122 | void exynos_cpuidle_init(void); |
122 | void exynos_cpufreq_init(void); | 123 | void exynos_cpufreq_init(void); |
123 | void exynos_init_late(void); | 124 | void exynos_init_late(void); |
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 90aab4d75d08..46d893fcbe85 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c | |||
@@ -173,10 +173,8 @@ static struct platform_device exynos_cpuidle = { | |||
173 | 173 | ||
174 | void __init exynos_cpuidle_init(void) | 174 | void __init exynos_cpuidle_init(void) |
175 | { | 175 | { |
176 | if (soc_is_exynos5440()) | 176 | if (soc_is_exynos4210() || soc_is_exynos5250()) |
177 | return; | 177 | platform_device_register(&exynos_cpuidle); |
178 | |||
179 | platform_device_register(&exynos_cpuidle); | ||
180 | } | 178 | } |
181 | 179 | ||
182 | void __init exynos_cpufreq_init(void) | 180 | void __init exynos_cpufreq_init(void) |
@@ -184,6 +182,28 @@ void __init exynos_cpufreq_init(void) | |||
184 | platform_device_register_simple("exynos-cpufreq", -1, NULL, 0); | 182 | platform_device_register_simple("exynos-cpufreq", -1, NULL, 0); |
185 | } | 183 | } |
186 | 184 | ||
185 | void __iomem *sysram_base_addr; | ||
186 | void __iomem *sysram_ns_base_addr; | ||
187 | |||
188 | void __init exynos_sysram_init(void) | ||
189 | { | ||
190 | struct device_node *node; | ||
191 | |||
192 | for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") { | ||
193 | if (!of_device_is_available(node)) | ||
194 | continue; | ||
195 | sysram_base_addr = of_iomap(node, 0); | ||
196 | break; | ||
197 | } | ||
198 | |||
199 | for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") { | ||
200 | if (!of_device_is_available(node)) | ||
201 | continue; | ||
202 | sysram_ns_base_addr = of_iomap(node, 0); | ||
203 | break; | ||
204 | } | ||
205 | } | ||
206 | |||
187 | void __init exynos_init_late(void) | 207 | void __init exynos_init_late(void) |
188 | { | 208 | { |
189 | if (of_machine_is_compatible("samsung,exynos5440")) | 209 | if (of_machine_is_compatible("samsung,exynos5440")) |
@@ -198,7 +218,7 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, | |||
198 | int depth, void *data) | 218 | int depth, void *data) |
199 | { | 219 | { |
200 | struct map_desc iodesc; | 220 | struct map_desc iodesc; |
201 | __be32 *reg; | 221 | const __be32 *reg; |
202 | int len; | 222 | int len; |
203 | 223 | ||
204 | if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") && | 224 | if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") && |
@@ -271,6 +291,13 @@ static void __init exynos_dt_machine_init(void) | |||
271 | } | 291 | } |
272 | } | 292 | } |
273 | 293 | ||
294 | /* | ||
295 | * This is called from smp_prepare_cpus if we've built for SMP, but | ||
296 | * we still need to set it up for PM and firmware ops if not. | ||
297 | */ | ||
298 | if (!IS_ENABLED(CONFIG_SMP)) | ||
299 | exynos_sysram_init(); | ||
300 | |||
274 | exynos_cpuidle_init(); | 301 | exynos_cpuidle_init(); |
275 | exynos_cpufreq_init(); | 302 | exynos_cpufreq_init(); |
276 | 303 | ||
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c index eb91d2350f8c..e8797bb78871 100644 --- a/arch/arm/mach-exynos/firmware.c +++ b/arch/arm/mach-exynos/firmware.c | |||
@@ -57,8 +57,13 @@ static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr) | |||
57 | 57 | ||
58 | boot_reg = sysram_ns_base_addr + 0x1c; | 58 | boot_reg = sysram_ns_base_addr + 0x1c; |
59 | 59 | ||
60 | if (!soc_is_exynos4212() && !soc_is_exynos3250()) | 60 | /* |
61 | boot_reg += 4*cpu; | 61 | * Almost all Exynos-series of SoCs that run in secure mode don't need |
62 | * additional offset for every CPU, with Exynos4412 being the only | ||
63 | * exception. | ||
64 | */ | ||
65 | if (soc_is_exynos4412()) | ||
66 | boot_reg += 4 * cpu; | ||
62 | 67 | ||
63 | __raw_writel(boot_addr, boot_reg); | 68 | __raw_writel(boot_addr, boot_reg); |
64 | return 0; | 69 | return 0; |
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index 69fa48397394..8a134d019cb3 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c | |||
@@ -46,13 +46,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) | |||
46 | if (cpu == 1) | 46 | if (cpu == 1) |
47 | exynos_cpu_power_down(cpu); | 47 | exynos_cpu_power_down(cpu); |
48 | 48 | ||
49 | /* | 49 | wfi(); |
50 | * here's the WFI | ||
51 | */ | ||
52 | asm(".word 0xe320f003\n" | ||
53 | : | ||
54 | : | ||
55 | : "memory", "cc"); | ||
56 | 50 | ||
57 | if (pen_release == cpu_logical_map(cpu)) { | 51 | if (pen_release == cpu_logical_map(cpu)) { |
58 | /* | 52 | /* |
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c index 0498d0b887ef..ace0ed617476 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | #define EXYNOS5420_CPUS_PER_CLUSTER 4 | 26 | #define EXYNOS5420_CPUS_PER_CLUSTER 4 |
27 | #define EXYNOS5420_NR_CLUSTERS 2 | 27 | #define EXYNOS5420_NR_CLUSTERS 2 |
28 | #define MCPM_BOOT_ADDR_OFFSET 0x1c | ||
29 | 28 | ||
30 | /* | 29 | /* |
31 | * The common v7_exit_coherency_flush API could not be used because of the | 30 | * The common v7_exit_coherency_flush API could not be used because of the |
@@ -343,11 +342,13 @@ static int __init exynos_mcpm_init(void) | |||
343 | pr_info("Exynos MCPM support installed\n"); | 342 | pr_info("Exynos MCPM support installed\n"); |
344 | 343 | ||
345 | /* | 344 | /* |
346 | * Future entries into the kernel can now go | 345 | * U-Boot SPL is hardcoded to jump to the start of ns_sram_base_addr |
347 | * through the cluster entry vectors. | 346 | * as part of secondary_cpu_start(). Let's redirect it to the |
347 | * mcpm_entry_point(). | ||
348 | */ | 348 | */ |
349 | __raw_writel(virt_to_phys(mcpm_entry_point), | 349 | __raw_writel(0xe59f0000, ns_sram_base_addr); /* ldr r0, [pc, #0] */ |
350 | ns_sram_base_addr + MCPM_BOOT_ADDR_OFFSET); | 350 | __raw_writel(0xe12fff10, ns_sram_base_addr + 4); /* bx r0 */ |
351 | __raw_writel(virt_to_phys(mcpm_entry_point), ns_sram_base_addr + 8); | ||
351 | 352 | ||
352 | iounmap(ns_sram_base_addr); | 353 | iounmap(ns_sram_base_addr); |
353 | 354 | ||
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index ec02422e8499..1c8d31e39520 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c | |||
@@ -32,28 +32,6 @@ | |||
32 | 32 | ||
33 | extern void exynos4_secondary_startup(void); | 33 | extern void exynos4_secondary_startup(void); |
34 | 34 | ||
35 | void __iomem *sysram_base_addr; | ||
36 | void __iomem *sysram_ns_base_addr; | ||
37 | |||
38 | static void __init exynos_smp_prepare_sysram(void) | ||
39 | { | ||
40 | struct device_node *node; | ||
41 | |||
42 | for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") { | ||
43 | if (!of_device_is_available(node)) | ||
44 | continue; | ||
45 | sysram_base_addr = of_iomap(node, 0); | ||
46 | break; | ||
47 | } | ||
48 | |||
49 | for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") { | ||
50 | if (!of_device_is_available(node)) | ||
51 | continue; | ||
52 | sysram_ns_base_addr = of_iomap(node, 0); | ||
53 | break; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | static inline void __iomem *cpu_boot_reg_base(void) | 35 | static inline void __iomem *cpu_boot_reg_base(void) |
58 | { | 36 | { |
59 | if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1) | 37 | if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1) |
@@ -234,11 +212,11 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus) | |||
234 | { | 212 | { |
235 | int i; | 213 | int i; |
236 | 214 | ||
215 | exynos_sysram_init(); | ||
216 | |||
237 | if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) | 217 | if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) |
238 | scu_enable(scu_base_addr()); | 218 | scu_enable(scu_base_addr()); |
239 | 219 | ||
240 | exynos_smp_prepare_sysram(); | ||
241 | |||
242 | /* | 220 | /* |
243 | * Write the address of secondary startup into the | 221 | * Write the address of secondary startup into the |
244 | * system-wide flags register. The boot monitor waits | 222 | * system-wide flags register. The boot monitor waits |
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index 87c0d34c7fba..202ca73e49c4 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c | |||
@@ -300,7 +300,7 @@ static int exynos_pm_suspend(void) | |||
300 | tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0); | 300 | tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0); |
301 | __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION); | 301 | __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION); |
302 | 302 | ||
303 | if (!soc_is_exynos5250()) | 303 | if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) |
304 | exynos_cpu_save_register(); | 304 | exynos_cpu_save_register(); |
305 | 305 | ||
306 | return 0; | 306 | return 0; |
@@ -334,7 +334,7 @@ static void exynos_pm_resume(void) | |||
334 | if (exynos_pm_central_resume()) | 334 | if (exynos_pm_central_resume()) |
335 | goto early_wakeup; | 335 | goto early_wakeup; |
336 | 336 | ||
337 | if (!soc_is_exynos5250()) | 337 | if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) |
338 | exynos_cpu_restore_register(); | 338 | exynos_cpu_restore_register(); |
339 | 339 | ||
340 | /* For release retention */ | 340 | /* For release retention */ |
@@ -353,7 +353,7 @@ static void exynos_pm_resume(void) | |||
353 | 353 | ||
354 | s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save)); | 354 | s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save)); |
355 | 355 | ||
356 | if (!soc_is_exynos5250()) | 356 | if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) |
357 | scu_enable(S5P_VA_SCU); | 357 | scu_enable(S5P_VA_SCU); |
358 | 358 | ||
359 | early_wakeup: | 359 | early_wakeup: |
@@ -440,15 +440,18 @@ static int exynos_cpu_pm_notifier(struct notifier_block *self, | |||
440 | case CPU_PM_ENTER: | 440 | case CPU_PM_ENTER: |
441 | if (cpu == 0) { | 441 | if (cpu == 0) { |
442 | exynos_pm_central_suspend(); | 442 | exynos_pm_central_suspend(); |
443 | exynos_cpu_save_register(); | 443 | if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) |
444 | exynos_cpu_save_register(); | ||
444 | } | 445 | } |
445 | break; | 446 | break; |
446 | 447 | ||
447 | case CPU_PM_EXIT: | 448 | case CPU_PM_EXIT: |
448 | if (cpu == 0) { | 449 | if (cpu == 0) { |
449 | if (!soc_is_exynos5250()) | 450 | if (read_cpuid_part_number() == |
451 | ARM_CPU_PART_CORTEX_A9) { | ||
450 | scu_enable(S5P_VA_SCU); | 452 | scu_enable(S5P_VA_SCU); |
451 | exynos_cpu_restore_register(); | 453 | exynos_cpu_restore_register(); |
454 | } | ||
452 | exynos_pm_central_resume(); | 455 | exynos_pm_central_resume(); |
453 | } | 456 | } |
454 | break; | 457 | break; |
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index fe6570ebbdde..797cb134bfff 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/pm_domain.h> | 19 | #include <linux/pm_domain.h> |
20 | #include <linux/clk.h> | ||
20 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
21 | #include <linux/of_address.h> | 22 | #include <linux/of_address.h> |
22 | #include <linux/of_platform.h> | 23 | #include <linux/of_platform.h> |
@@ -24,6 +25,8 @@ | |||
24 | 25 | ||
25 | #include "regs-pmu.h" | 26 | #include "regs-pmu.h" |
26 | 27 | ||
28 | #define MAX_CLK_PER_DOMAIN 4 | ||
29 | |||
27 | /* | 30 | /* |
28 | * Exynos specific wrapper around the generic power domain | 31 | * Exynos specific wrapper around the generic power domain |
29 | */ | 32 | */ |
@@ -32,6 +35,9 @@ struct exynos_pm_domain { | |||
32 | char const *name; | 35 | char const *name; |
33 | bool is_off; | 36 | bool is_off; |
34 | struct generic_pm_domain pd; | 37 | struct generic_pm_domain pd; |
38 | struct clk *oscclk; | ||
39 | struct clk *clk[MAX_CLK_PER_DOMAIN]; | ||
40 | struct clk *pclk[MAX_CLK_PER_DOMAIN]; | ||
35 | }; | 41 | }; |
36 | 42 | ||
37 | static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) | 43 | static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) |
@@ -44,6 +50,19 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) | |||
44 | pd = container_of(domain, struct exynos_pm_domain, pd); | 50 | pd = container_of(domain, struct exynos_pm_domain, pd); |
45 | base = pd->base; | 51 | base = pd->base; |
46 | 52 | ||
53 | /* Set oscclk before powering off a domain*/ | ||
54 | if (!power_on) { | ||
55 | int i; | ||
56 | |||
57 | for (i = 0; i < MAX_CLK_PER_DOMAIN; i++) { | ||
58 | if (IS_ERR(pd->clk[i])) | ||
59 | break; | ||
60 | if (clk_set_parent(pd->clk[i], pd->oscclk)) | ||
61 | pr_err("%s: error setting oscclk as parent to clock %d\n", | ||
62 | pd->name, i); | ||
63 | } | ||
64 | } | ||
65 | |||
47 | pwr = power_on ? S5P_INT_LOCAL_PWR_EN : 0; | 66 | pwr = power_on ? S5P_INT_LOCAL_PWR_EN : 0; |
48 | __raw_writel(pwr, base); | 67 | __raw_writel(pwr, base); |
49 | 68 | ||
@@ -60,6 +79,20 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) | |||
60 | cpu_relax(); | 79 | cpu_relax(); |
61 | usleep_range(80, 100); | 80 | usleep_range(80, 100); |
62 | } | 81 | } |
82 | |||
83 | /* Restore clocks after powering on a domain*/ | ||
84 | if (power_on) { | ||
85 | int i; | ||
86 | |||
87 | for (i = 0; i < MAX_CLK_PER_DOMAIN; i++) { | ||
88 | if (IS_ERR(pd->clk[i])) | ||
89 | break; | ||
90 | if (clk_set_parent(pd->clk[i], pd->pclk[i])) | ||
91 | pr_err("%s: error setting parent to clock%d\n", | ||
92 | pd->name, i); | ||
93 | } | ||
94 | } | ||
95 | |||
63 | return 0; | 96 | return 0; |
64 | } | 97 | } |
65 | 98 | ||
@@ -152,9 +185,11 @@ static __init int exynos4_pm_init_power_domain(void) | |||
152 | 185 | ||
153 | for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") { | 186 | for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") { |
154 | struct exynos_pm_domain *pd; | 187 | struct exynos_pm_domain *pd; |
155 | int on; | 188 | int on, i; |
189 | struct device *dev; | ||
156 | 190 | ||
157 | pdev = of_find_device_by_node(np); | 191 | pdev = of_find_device_by_node(np); |
192 | dev = &pdev->dev; | ||
158 | 193 | ||
159 | pd = kzalloc(sizeof(*pd), GFP_KERNEL); | 194 | pd = kzalloc(sizeof(*pd), GFP_KERNEL); |
160 | if (!pd) { | 195 | if (!pd) { |
@@ -170,6 +205,30 @@ static __init int exynos4_pm_init_power_domain(void) | |||
170 | pd->pd.power_on = exynos_pd_power_on; | 205 | pd->pd.power_on = exynos_pd_power_on; |
171 | pd->pd.of_node = np; | 206 | pd->pd.of_node = np; |
172 | 207 | ||
208 | pd->oscclk = clk_get(dev, "oscclk"); | ||
209 | if (IS_ERR(pd->oscclk)) | ||
210 | goto no_clk; | ||
211 | |||
212 | for (i = 0; i < MAX_CLK_PER_DOMAIN; i++) { | ||
213 | char clk_name[8]; | ||
214 | |||
215 | snprintf(clk_name, sizeof(clk_name), "clk%d", i); | ||
216 | pd->clk[i] = clk_get(dev, clk_name); | ||
217 | if (IS_ERR(pd->clk[i])) | ||
218 | break; | ||
219 | snprintf(clk_name, sizeof(clk_name), "pclk%d", i); | ||
220 | pd->pclk[i] = clk_get(dev, clk_name); | ||
221 | if (IS_ERR(pd->pclk[i])) { | ||
222 | clk_put(pd->clk[i]); | ||
223 | pd->clk[i] = ERR_PTR(-EINVAL); | ||
224 | break; | ||
225 | } | ||
226 | } | ||
227 | |||
228 | if (IS_ERR(pd->clk[0])) | ||
229 | clk_put(pd->oscclk); | ||
230 | |||
231 | no_clk: | ||
173 | platform_set_drvdata(pdev, pd); | 232 | platform_set_drvdata(pdev, pd); |
174 | 233 | ||
175 | on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN; | 234 | on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN; |
diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig index 830b76e70250..a5960e2ac090 100644 --- a/arch/arm/mach-highbank/Kconfig +++ b/arch/arm/mach-highbank/Kconfig | |||
@@ -1,7 +1,6 @@ | |||
1 | config ARCH_HIGHBANK | 1 | config ARCH_HIGHBANK |
2 | bool "Calxeda ECX-1000/2000 (Highbank/Midway)" if ARCH_MULTI_V7 | 2 | bool "Calxeda ECX-1000/2000 (Highbank/Midway)" if ARCH_MULTI_V7 |
3 | select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE | 3 | select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE |
4 | select ARCH_HAS_CPUFREQ | ||
5 | select ARCH_HAS_HOLES_MEMORYMODEL | 4 | select ARCH_HAS_HOLES_MEMORYMODEL |
6 | select ARCH_HAS_OPP | 5 | select ARCH_HAS_OPP |
7 | select ARCH_SUPPORTS_BIG_ENDIAN | 6 | select ARCH_SUPPORTS_BIG_ENDIAN |
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 8d42eab76d53..4b5185748f74 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -1,6 +1,5 @@ | |||
1 | config ARCH_MXC | 1 | menuconfig ARCH_MXC |
2 | bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7 | 2 | bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7 |
3 | select ARCH_HAS_CPUFREQ | ||
4 | select ARCH_HAS_OPP | 3 | select ARCH_HAS_OPP |
5 | select ARCH_REQUIRE_GPIOLIB | 4 | select ARCH_REQUIRE_GPIOLIB |
6 | select ARM_CPU_SUSPEND if PM | 5 | select ARM_CPU_SUSPEND if PM |
@@ -13,8 +12,7 @@ config ARCH_MXC | |||
13 | help | 12 | help |
14 | Support for Freescale MXC/iMX-based family of processors | 13 | Support for Freescale MXC/iMX-based family of processors |
15 | 14 | ||
16 | menu "Freescale i.MX support" | 15 | if ARCH_MXC |
17 | depends on ARCH_MXC | ||
18 | 16 | ||
19 | config MXC_TZIC | 17 | config MXC_TZIC |
20 | bool | 18 | bool |
@@ -99,7 +97,6 @@ config SOC_IMX25 | |||
99 | 97 | ||
100 | config SOC_IMX27 | 98 | config SOC_IMX27 |
101 | bool | 99 | bool |
102 | select ARCH_HAS_CPUFREQ | ||
103 | select ARCH_HAS_OPP | 100 | select ARCH_HAS_OPP |
104 | select CPU_ARM926T | 101 | select CPU_ARM926T |
105 | select IMX_HAVE_IOMUX_V1 | 102 | select IMX_HAVE_IOMUX_V1 |
@@ -124,7 +121,6 @@ config SOC_IMX35 | |||
124 | 121 | ||
125 | config SOC_IMX5 | 122 | config SOC_IMX5 |
126 | bool | 123 | bool |
127 | select ARCH_HAS_CPUFREQ | ||
128 | select ARCH_HAS_OPP | 124 | select ARCH_HAS_OPP |
129 | select ARCH_MXC_IOMUX_V3 | 125 | select ARCH_MXC_IOMUX_V3 |
130 | select MXC_TZIC | 126 | select MXC_TZIC |
@@ -738,9 +734,9 @@ config SOC_IMX6 | |||
738 | select HAVE_IMX_MMDC | 734 | select HAVE_IMX_MMDC |
739 | select HAVE_IMX_SRC | 735 | select HAVE_IMX_SRC |
740 | select MFD_SYSCON | 736 | select MFD_SYSCON |
741 | select PL310_ERRATA_588369 if CACHE_PL310 | 737 | select PL310_ERRATA_588369 if CACHE_L2X0 |
742 | select PL310_ERRATA_727915 if CACHE_PL310 | 738 | select PL310_ERRATA_727915 if CACHE_L2X0 |
743 | select PL310_ERRATA_769419 if CACHE_PL310 | 739 | select PL310_ERRATA_769419 if CACHE_L2X0 |
744 | 740 | ||
745 | config SOC_IMX6Q | 741 | config SOC_IMX6Q |
746 | bool "i.MX6 Quad/DualLite support" | 742 | bool "i.MX6 Quad/DualLite support" |
@@ -775,9 +771,9 @@ config SOC_VF610 | |||
775 | select ARM_GIC | 771 | select ARM_GIC |
776 | select PINCTRL_VF610 | 772 | select PINCTRL_VF610 |
777 | select VF_PIT_TIMER | 773 | select VF_PIT_TIMER |
778 | select PL310_ERRATA_588369 if CACHE_PL310 | 774 | select PL310_ERRATA_588369 if CACHE_L2X0 |
779 | select PL310_ERRATA_727915 if CACHE_PL310 | 775 | select PL310_ERRATA_727915 if CACHE_L2X0 |
780 | select PL310_ERRATA_769419 if CACHE_PL310 | 776 | select PL310_ERRATA_769419 if CACHE_L2X0 |
781 | 777 | ||
782 | help | 778 | help |
783 | This enable support for Freescale Vybrid VF610 processor. | 779 | This enable support for Freescale Vybrid VF610 processor. |
@@ -786,4 +782,4 @@ endif | |||
786 | 782 | ||
787 | source "arch/arm/mach-imx/devices/Kconfig" | 783 | source "arch/arm/mach-imx/devices/Kconfig" |
788 | 784 | ||
789 | endmenu | 785 | endif |
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c index 4ba587da89d2..84acdfd1d715 100644 --- a/arch/arm/mach-imx/clk-gate2.c +++ b/arch/arm/mach-imx/clk-gate2.c | |||
@@ -67,8 +67,12 @@ static void clk_gate2_disable(struct clk_hw *hw) | |||
67 | 67 | ||
68 | spin_lock_irqsave(gate->lock, flags); | 68 | spin_lock_irqsave(gate->lock, flags); |
69 | 69 | ||
70 | if (gate->share_count && --(*gate->share_count) > 0) | 70 | if (gate->share_count) { |
71 | goto out; | 71 | if (WARN_ON(*gate->share_count == 0)) |
72 | goto out; | ||
73 | else if (--(*gate->share_count) > 0) | ||
74 | goto out; | ||
75 | } | ||
72 | 76 | ||
73 | reg = readl(gate->reg); | 77 | reg = readl(gate->reg); |
74 | reg &= ~(3 << gate->bit_idx); | 78 | reg &= ~(3 << gate->bit_idx); |
@@ -78,19 +82,26 @@ out: | |||
78 | spin_unlock_irqrestore(gate->lock, flags); | 82 | spin_unlock_irqrestore(gate->lock, flags); |
79 | } | 83 | } |
80 | 84 | ||
81 | static int clk_gate2_is_enabled(struct clk_hw *hw) | 85 | static int clk_gate2_reg_is_enabled(void __iomem *reg, u8 bit_idx) |
82 | { | 86 | { |
83 | u32 reg; | 87 | u32 val = readl(reg); |
84 | struct clk_gate2 *gate = to_clk_gate2(hw); | ||
85 | 88 | ||
86 | reg = readl(gate->reg); | 89 | if (((val >> bit_idx) & 1) == 1) |
87 | |||
88 | if (((reg >> gate->bit_idx) & 1) == 1) | ||
89 | return 1; | 90 | return 1; |
90 | 91 | ||
91 | return 0; | 92 | return 0; |
92 | } | 93 | } |
93 | 94 | ||
95 | static int clk_gate2_is_enabled(struct clk_hw *hw) | ||
96 | { | ||
97 | struct clk_gate2 *gate = to_clk_gate2(hw); | ||
98 | |||
99 | if (gate->share_count) | ||
100 | return !!(*gate->share_count); | ||
101 | else | ||
102 | return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); | ||
103 | } | ||
104 | |||
94 | static struct clk_ops clk_gate2_ops = { | 105 | static struct clk_ops clk_gate2_ops = { |
95 | .enable = clk_gate2_enable, | 106 | .enable = clk_gate2_enable, |
96 | .disable = clk_gate2_disable, | 107 | .disable = clk_gate2_disable, |
@@ -116,6 +127,10 @@ struct clk *clk_register_gate2(struct device *dev, const char *name, | |||
116 | gate->bit_idx = bit_idx; | 127 | gate->bit_idx = bit_idx; |
117 | gate->flags = clk_gate2_flags; | 128 | gate->flags = clk_gate2_flags; |
118 | gate->lock = lock; | 129 | gate->lock = lock; |
130 | |||
131 | /* Initialize share_count per hardware state */ | ||
132 | if (share_count) | ||
133 | *share_count = clk_gate2_reg_is_enabled(reg, bit_idx) ? 1 : 0; | ||
119 | gate->share_count = share_count; | 134 | gate->share_count = share_count; |
120 | 135 | ||
121 | init.name = name; | 136 | init.name = name; |
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c index 21cf06cebade..5408ca70c8d6 100644 --- a/arch/arm/mach-imx/clk-imx6sl.c +++ b/arch/arm/mach-imx/clk-imx6sl.c | |||
@@ -312,6 +312,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node) | |||
312 | clks[IMX6SL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2); | 312 | clks[IMX6SL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2); |
313 | clks[IMX6SL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4); | 313 | clks[IMX6SL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4); |
314 | clks[IMX6SL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6); | 314 | clks[IMX6SL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6); |
315 | clks[IMX6SL_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x6c, 10); | ||
315 | clks[IMX6SL_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12); | 316 | clks[IMX6SL_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12); |
316 | clks[IMX6SL_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14); | 317 | clks[IMX6SL_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14); |
317 | clks[IMX6SL_CLK_EXTERN_AUDIO] = imx_clk_gate2("extern_audio", "extern_audio_podf", base + 0x6c, 16); | 318 | clks[IMX6SL_CLK_EXTERN_AUDIO] = imx_clk_gate2("extern_audio", "extern_audio_podf", base + 0x6c, 16); |
diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig index ba43321001d8..64f8e2564a37 100644 --- a/arch/arm/mach-integrator/Kconfig +++ b/arch/arm/mach-integrator/Kconfig | |||
@@ -28,7 +28,7 @@ config ARCH_CINTEGRATOR | |||
28 | bool | 28 | bool |
29 | 29 | ||
30 | config INTEGRATOR_IMPD1 | 30 | config INTEGRATOR_IMPD1 |
31 | tristate "Include support for Integrator/IM-PD1" | 31 | bool "Include support for Integrator/IM-PD1" |
32 | depends on ARCH_INTEGRATOR_AP | 32 | depends on ARCH_INTEGRATOR_AP |
33 | select ARCH_REQUIRE_GPIOLIB | 33 | select ARCH_REQUIRE_GPIOLIB |
34 | select ARM_VIC | 34 | select ARM_VIC |
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c index 0e870ea818c4..3ce880729cff 100644 --- a/arch/arm/mach-integrator/impd1.c +++ b/arch/arm/mach-integrator/impd1.c | |||
@@ -308,7 +308,12 @@ static struct impd1_device impd1_devs[] = { | |||
308 | */ | 308 | */ |
309 | #define IMPD1_VALID_IRQS 0x00000bffU | 309 | #define IMPD1_VALID_IRQS 0x00000bffU |
310 | 310 | ||
311 | static int __init impd1_probe(struct lm_device *dev) | 311 | /* |
312 | * As this module is bool, it is OK to have this as __init_refok() - no | ||
313 | * probe calls will be done after the initial system bootup, as devices | ||
314 | * are discovered as part of the machine startup. | ||
315 | */ | ||
316 | static int __init_refok impd1_probe(struct lm_device *dev) | ||
312 | { | 317 | { |
313 | struct impd1_module *impd1; | 318 | struct impd1_module *impd1; |
314 | int irq_base; | 319 | int irq_base; |
@@ -397,6 +402,11 @@ static void impd1_remove(struct lm_device *dev) | |||
397 | static struct lm_driver impd1_driver = { | 402 | static struct lm_driver impd1_driver = { |
398 | .drv = { | 403 | .drv = { |
399 | .name = "impd1", | 404 | .name = "impd1", |
405 | /* | ||
406 | * As we're dropping the probe() function, suppress driver | ||
407 | * binding from sysfs. | ||
408 | */ | ||
409 | .suppress_bind_attrs = true, | ||
400 | }, | 410 | }, |
401 | .probe = impd1_probe, | 411 | .probe = impd1_probe, |
402 | .remove = impd1_remove, | 412 | .remove = impd1_remove, |
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index dd0cc677d596..660ca6feff40 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c | |||
@@ -480,25 +480,18 @@ static const struct of_device_id ebi_match[] = { | |||
480 | static void __init ap_init_of(void) | 480 | static void __init ap_init_of(void) |
481 | { | 481 | { |
482 | unsigned long sc_dec; | 482 | unsigned long sc_dec; |
483 | struct device_node *root; | ||
484 | struct device_node *syscon; | 483 | struct device_node *syscon; |
485 | struct device_node *ebi; | 484 | struct device_node *ebi; |
486 | struct device *parent; | 485 | struct device *parent; |
487 | struct soc_device *soc_dev; | 486 | struct soc_device *soc_dev; |
488 | struct soc_device_attribute *soc_dev_attr; | 487 | struct soc_device_attribute *soc_dev_attr; |
489 | u32 ap_sc_id; | 488 | u32 ap_sc_id; |
490 | int err; | ||
491 | int i; | 489 | int i; |
492 | 490 | ||
493 | /* Here we create an SoC device for the root node */ | 491 | syscon = of_find_matching_node(NULL, ap_syscon_match); |
494 | root = of_find_node_by_path("/"); | ||
495 | if (!root) | ||
496 | return; | ||
497 | |||
498 | syscon = of_find_matching_node(root, ap_syscon_match); | ||
499 | if (!syscon) | 492 | if (!syscon) |
500 | return; | 493 | return; |
501 | ebi = of_find_matching_node(root, ebi_match); | 494 | ebi = of_find_matching_node(NULL, ebi_match); |
502 | if (!ebi) | 495 | if (!ebi) |
503 | return; | 496 | return; |
504 | 497 | ||
@@ -509,19 +502,17 @@ static void __init ap_init_of(void) | |||
509 | if (!ebi_base) | 502 | if (!ebi_base) |
510 | return; | 503 | return; |
511 | 504 | ||
505 | of_platform_populate(NULL, of_default_bus_match_table, | ||
506 | ap_auxdata_lookup, NULL); | ||
507 | |||
512 | ap_sc_id = readl(ap_syscon_base); | 508 | ap_sc_id = readl(ap_syscon_base); |
513 | 509 | ||
514 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); | 510 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); |
515 | if (!soc_dev_attr) | 511 | if (!soc_dev_attr) |
516 | return; | 512 | return; |
517 | 513 | ||
518 | err = of_property_read_string(root, "compatible", | 514 | soc_dev_attr->soc_id = "XVC"; |
519 | &soc_dev_attr->soc_id); | 515 | soc_dev_attr->machine = "Integrator/AP"; |
520 | if (err) | ||
521 | return; | ||
522 | err = of_property_read_string(root, "model", &soc_dev_attr->machine); | ||
523 | if (err) | ||
524 | return; | ||
525 | soc_dev_attr->family = "Integrator"; | 516 | soc_dev_attr->family = "Integrator"; |
526 | soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", | 517 | soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", |
527 | 'A' + (ap_sc_id & 0x0f)); | 518 | 'A' + (ap_sc_id & 0x0f)); |
@@ -536,9 +527,6 @@ static void __init ap_init_of(void) | |||
536 | parent = soc_device_to_device(soc_dev); | 527 | parent = soc_device_to_device(soc_dev); |
537 | integrator_init_sysfs(parent, ap_sc_id); | 528 | integrator_init_sysfs(parent, ap_sc_id); |
538 | 529 | ||
539 | of_platform_populate(root, of_default_bus_match_table, | ||
540 | ap_auxdata_lookup, parent); | ||
541 | |||
542 | sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); | 530 | sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); |
543 | for (i = 0; i < 4; i++) { | 531 | for (i = 0; i < 4; i++) { |
544 | struct lm_device *lmdev; | 532 | struct lm_device *lmdev; |
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index a938242b0c95..0e57f8f820a5 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c | |||
@@ -279,20 +279,13 @@ static const struct of_device_id intcp_syscon_match[] = { | |||
279 | 279 | ||
280 | static void __init intcp_init_of(void) | 280 | static void __init intcp_init_of(void) |
281 | { | 281 | { |
282 | struct device_node *root; | ||
283 | struct device_node *cpcon; | 282 | struct device_node *cpcon; |
284 | struct device *parent; | 283 | struct device *parent; |
285 | struct soc_device *soc_dev; | 284 | struct soc_device *soc_dev; |
286 | struct soc_device_attribute *soc_dev_attr; | 285 | struct soc_device_attribute *soc_dev_attr; |
287 | u32 intcp_sc_id; | 286 | u32 intcp_sc_id; |
288 | int err; | ||
289 | 287 | ||
290 | /* Here we create an SoC device for the root node */ | 288 | cpcon = of_find_matching_node(NULL, intcp_syscon_match); |
291 | root = of_find_node_by_path("/"); | ||
292 | if (!root) | ||
293 | return; | ||
294 | |||
295 | cpcon = of_find_matching_node(root, intcp_syscon_match); | ||
296 | if (!cpcon) | 289 | if (!cpcon) |
297 | return; | 290 | return; |
298 | 291 | ||
@@ -300,19 +293,17 @@ static void __init intcp_init_of(void) | |||
300 | if (!intcp_con_base) | 293 | if (!intcp_con_base) |
301 | return; | 294 | return; |
302 | 295 | ||
296 | of_platform_populate(NULL, of_default_bus_match_table, | ||
297 | intcp_auxdata_lookup, NULL); | ||
298 | |||
303 | intcp_sc_id = readl(intcp_con_base); | 299 | intcp_sc_id = readl(intcp_con_base); |
304 | 300 | ||
305 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); | 301 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); |
306 | if (!soc_dev_attr) | 302 | if (!soc_dev_attr) |
307 | return; | 303 | return; |
308 | 304 | ||
309 | err = of_property_read_string(root, "compatible", | 305 | soc_dev_attr->soc_id = "XCV"; |
310 | &soc_dev_attr->soc_id); | 306 | soc_dev_attr->machine = "Integrator/CP"; |
311 | if (err) | ||
312 | return; | ||
313 | err = of_property_read_string(root, "model", &soc_dev_attr->machine); | ||
314 | if (err) | ||
315 | return; | ||
316 | soc_dev_attr->family = "Integrator"; | 307 | soc_dev_attr->family = "Integrator"; |
317 | soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", | 308 | soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", |
318 | 'A' + (intcp_sc_id & 0x0f)); | 309 | 'A' + (intcp_sc_id & 0x0f)); |
@@ -326,8 +317,6 @@ static void __init intcp_init_of(void) | |||
326 | 317 | ||
327 | parent = soc_device_to_device(soc_dev); | 318 | parent = soc_device_to_device(soc_dev); |
328 | integrator_init_sysfs(parent, intcp_sc_id); | 319 | integrator_init_sysfs(parent, intcp_sc_id); |
329 | of_platform_populate(root, of_default_bus_match_table, | ||
330 | intcp_auxdata_lookup, parent); | ||
331 | } | 320 | } |
332 | 321 | ||
333 | static const char * intcp_dt_board_compat[] = { | 322 | static const char * intcp_dt_board_compat[] = { |
diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig index f50bc936cb84..98a156afaa94 100644 --- a/arch/arm/mach-keystone/Kconfig +++ b/arch/arm/mach-keystone/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config ARCH_KEYSTONE | 1 | config ARCH_KEYSTONE |
2 | bool "Texas Instruments Keystone Devices" | 2 | bool "Texas Instruments Keystone Devices" |
3 | depends on ARCH_MULTI_V7 | 3 | depends on ARCH_MULTI_V7 |
4 | depends on ARM_PATCH_PHYS_VIRT | ||
4 | select ARM_GIC | 5 | select ARM_GIC |
5 | select HAVE_ARM_ARCH_TIMER | 6 | select HAVE_ARM_ARCH_TIMER |
6 | select CLKSRC_MMIO | 7 | select CLKSRC_MMIO |
diff --git a/arch/arm/mach-moxart/Kconfig b/arch/arm/mach-moxart/Kconfig index 82a4ba8578a2..f49328c39bef 100644 --- a/arch/arm/mach-moxart/Kconfig +++ b/arch/arm/mach-moxart/Kconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | config ARCH_MOXART | 1 | menuconfig ARCH_MOXART |
2 | bool "MOXA ART SoC" if ARCH_MULTI_V4 | 2 | bool "MOXA ART SoC" if ARCH_MULTI_V4 |
3 | select CPU_FA526 | 3 | select CPU_FA526 |
4 | select ARM_DMA_MEM_BUFFERABLE | 4 | select ARM_DMA_MEM_BUFFERABLE |
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 6090b9eb00c8..b9bc599a5fd0 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | config ARCH_MVEBU | 1 | menuconfig ARCH_MVEBU |
2 | bool "Marvell Engineering Business Unit (MVEBU) SoCs" if (ARCH_MULTI_V7 || ARCH_MULTI_V5) | 2 | bool "Marvell Engineering Business Unit (MVEBU) SoCs" if (ARCH_MULTI_V7 || ARCH_MULTI_V5) |
3 | select ARCH_SUPPORTS_BIG_ENDIAN | 3 | select ARCH_SUPPORTS_BIG_ENDIAN |
4 | select CLKSRC_MMIO | 4 | select CLKSRC_MMIO |
@@ -10,15 +10,15 @@ config ARCH_MVEBU | |||
10 | select ZONE_DMA if ARM_LPAE | 10 | select ZONE_DMA if ARM_LPAE |
11 | select ARCH_REQUIRE_GPIOLIB | 11 | select ARCH_REQUIRE_GPIOLIB |
12 | select PCI_QUIRKS if PCI | 12 | select PCI_QUIRKS if PCI |
13 | select OF_ADDRESS_PCI | ||
13 | 14 | ||
14 | if ARCH_MVEBU | 15 | if ARCH_MVEBU |
15 | 16 | ||
16 | menu "Marvell EBU SoC variants" | ||
17 | |||
18 | config MACH_MVEBU_V7 | 17 | config MACH_MVEBU_V7 |
19 | bool | 18 | bool |
20 | select ARMADA_370_XP_TIMER | 19 | select ARMADA_370_XP_TIMER |
21 | select CACHE_L2X0 | 20 | select CACHE_L2X0 |
21 | select ARM_CPU_SUSPEND | ||
22 | 22 | ||
23 | config MACH_ARMADA_370 | 23 | config MACH_ARMADA_370 |
24 | bool "Marvell Armada 370 boards" if ARCH_MULTI_V7 | 24 | bool "Marvell Armada 370 boards" if ARCH_MULTI_V7 |
@@ -84,7 +84,6 @@ config MACH_DOVE | |||
84 | 84 | ||
85 | config MACH_KIRKWOOD | 85 | config MACH_KIRKWOOD |
86 | bool "Marvell Kirkwood boards" if ARCH_MULTI_V5 | 86 | bool "Marvell Kirkwood boards" if ARCH_MULTI_V5 |
87 | select ARCH_HAS_CPUFREQ | ||
88 | select ARCH_REQUIRE_GPIOLIB | 87 | select ARCH_REQUIRE_GPIOLIB |
89 | select CPU_FEROCEON | 88 | select CPU_FEROCEON |
90 | select KIRKWOOD_CLK | 89 | select KIRKWOOD_CLK |
@@ -97,6 +96,4 @@ config MACH_KIRKWOOD | |||
97 | Say 'Y' here if you want your kernel to support boards based | 96 | Say 'Y' here if you want your kernel to support boards based |
98 | on the Marvell Kirkwood device tree. | 97 | on the Marvell Kirkwood device tree. |
99 | 98 | ||
100 | endmenu | ||
101 | |||
102 | endif | 99 | endif |
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index 2ecb828e4a8b..1636cdbef01a 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile | |||
@@ -7,7 +7,7 @@ CFLAGS_pmsu.o := -march=armv7-a | |||
7 | obj-y += system-controller.o mvebu-soc-id.o | 7 | obj-y += system-controller.o mvebu-soc-id.o |
8 | 8 | ||
9 | ifeq ($(CONFIG_MACH_MVEBU_V7),y) | 9 | ifeq ($(CONFIG_MACH_MVEBU_V7),y) |
10 | obj-y += cpu-reset.o board-v7.o coherency.o coherency_ll.o pmsu.o | 10 | obj-y += cpu-reset.o board-v7.o coherency.o coherency_ll.o pmsu.o pmsu_ll.o |
11 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o | 11 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o |
12 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 12 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
13 | endif | 13 | endif |
diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c index 8bb742fdf5ca..b2524d689f21 100644 --- a/arch/arm/mach-mvebu/board-v7.c +++ b/arch/arm/mach-mvebu/board-v7.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/mbus.h> | 23 | #include <linux/mbus.h> |
24 | #include <linux/signal.h> | 24 | #include <linux/signal.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/irqchip.h> | ||
26 | #include <asm/hardware/cache-l2x0.h> | 27 | #include <asm/hardware/cache-l2x0.h> |
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
28 | #include <asm/mach/map.h> | 29 | #include <asm/mach/map.h> |
@@ -71,17 +72,23 @@ static int armada_375_external_abort_wa(unsigned long addr, unsigned int fsr, | |||
71 | return 1; | 72 | return 1; |
72 | } | 73 | } |
73 | 74 | ||
74 | static void __init mvebu_timer_and_clk_init(void) | 75 | static void __init mvebu_init_irq(void) |
75 | { | 76 | { |
76 | of_clk_init(NULL); | 77 | irqchip_init(); |
77 | clocksource_of_init(); | ||
78 | mvebu_scu_enable(); | 78 | mvebu_scu_enable(); |
79 | coherency_init(); | 79 | coherency_init(); |
80 | BUG_ON(mvebu_mbus_dt_init(coherency_available())); | 80 | BUG_ON(mvebu_mbus_dt_init(coherency_available())); |
81 | } | ||
82 | |||
83 | static void __init external_abort_quirk(void) | ||
84 | { | ||
85 | u32 dev, rev; | ||
81 | 86 | ||
82 | if (of_machine_is_compatible("marvell,armada375")) | 87 | if (mvebu_get_soc_id(&dev, &rev) == 0 && rev > ARMADA_375_Z1_REV) |
83 | hook_fault_code(16 + 6, armada_375_external_abort_wa, SIGBUS, 0, | 88 | return; |
84 | "imprecise external abort"); | 89 | |
90 | hook_fault_code(16 + 6, armada_375_external_abort_wa, SIGBUS, 0, | ||
91 | "imprecise external abort"); | ||
85 | } | 92 | } |
86 | 93 | ||
87 | static void __init i2c_quirk(void) | 94 | static void __init i2c_quirk(void) |
@@ -169,8 +176,10 @@ static void __init mvebu_dt_init(void) | |||
169 | { | 176 | { |
170 | if (of_machine_is_compatible("plathome,openblocks-ax3-4")) | 177 | if (of_machine_is_compatible("plathome,openblocks-ax3-4")) |
171 | i2c_quirk(); | 178 | i2c_quirk(); |
172 | if (of_machine_is_compatible("marvell,a375-db")) | 179 | if (of_machine_is_compatible("marvell,a375-db")) { |
180 | external_abort_quirk(); | ||
173 | thermal_quirk(); | 181 | thermal_quirk(); |
182 | } | ||
174 | 183 | ||
175 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 184 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
176 | } | 185 | } |
@@ -185,7 +194,7 @@ DT_MACHINE_START(ARMADA_370_XP_DT, "Marvell Armada 370/XP (Device Tree)") | |||
185 | .l2c_aux_mask = ~0, | 194 | .l2c_aux_mask = ~0, |
186 | .smp = smp_ops(armada_xp_smp_ops), | 195 | .smp = smp_ops(armada_xp_smp_ops), |
187 | .init_machine = mvebu_dt_init, | 196 | .init_machine = mvebu_dt_init, |
188 | .init_time = mvebu_timer_and_clk_init, | 197 | .init_irq = mvebu_init_irq, |
189 | .restart = mvebu_restart, | 198 | .restart = mvebu_restart, |
190 | .dt_compat = armada_370_xp_dt_compat, | 199 | .dt_compat = armada_370_xp_dt_compat, |
191 | MACHINE_END | 200 | MACHINE_END |
@@ -198,7 +207,7 @@ static const char * const armada_375_dt_compat[] = { | |||
198 | DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)") | 207 | DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)") |
199 | .l2c_aux_val = 0, | 208 | .l2c_aux_val = 0, |
200 | .l2c_aux_mask = ~0, | 209 | .l2c_aux_mask = ~0, |
201 | .init_time = mvebu_timer_and_clk_init, | 210 | .init_irq = mvebu_init_irq, |
202 | .init_machine = mvebu_dt_init, | 211 | .init_machine = mvebu_dt_init, |
203 | .restart = mvebu_restart, | 212 | .restart = mvebu_restart, |
204 | .dt_compat = armada_375_dt_compat, | 213 | .dt_compat = armada_375_dt_compat, |
@@ -213,7 +222,7 @@ static const char * const armada_38x_dt_compat[] = { | |||
213 | DT_MACHINE_START(ARMADA_38X_DT, "Marvell Armada 380/385 (Device Tree)") | 222 | DT_MACHINE_START(ARMADA_38X_DT, "Marvell Armada 380/385 (Device Tree)") |
214 | .l2c_aux_val = 0, | 223 | .l2c_aux_val = 0, |
215 | .l2c_aux_mask = ~0, | 224 | .l2c_aux_mask = ~0, |
216 | .init_time = mvebu_timer_and_clk_init, | 225 | .init_irq = mvebu_init_irq, |
217 | .restart = mvebu_restart, | 226 | .restart = mvebu_restart, |
218 | .dt_compat = armada_38x_dt_compat, | 227 | .dt_compat = armada_38x_dt_compat, |
219 | MACHINE_END | 228 | MACHINE_END |
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c index 53a55c8520bf..a1d407c0febe 100644 --- a/arch/arm/mach-mvebu/pmsu.c +++ b/arch/arm/mach-mvebu/pmsu.c | |||
@@ -66,6 +66,8 @@ static void __iomem *pmsu_mp_base; | |||
66 | extern void ll_disable_coherency(void); | 66 | extern void ll_disable_coherency(void); |
67 | extern void ll_enable_coherency(void); | 67 | extern void ll_enable_coherency(void); |
68 | 68 | ||
69 | extern void armada_370_xp_cpu_resume(void); | ||
70 | |||
69 | static struct platform_device armada_xp_cpuidle_device = { | 71 | static struct platform_device armada_xp_cpuidle_device = { |
70 | .name = "cpuidle-armada-370-xp", | 72 | .name = "cpuidle-armada-370-xp", |
71 | }; | 73 | }; |
@@ -140,13 +142,6 @@ static void armada_370_xp_pmsu_enable_l2_powerdown_onidle(void) | |||
140 | writel(reg, pmsu_mp_base + L2C_NFABRIC_PM_CTL); | 142 | writel(reg, pmsu_mp_base + L2C_NFABRIC_PM_CTL); |
141 | } | 143 | } |
142 | 144 | ||
143 | static void armada_370_xp_cpu_resume(void) | ||
144 | { | ||
145 | asm volatile("bl ll_add_cpu_to_smp_group\n\t" | ||
146 | "bl ll_enable_coherency\n\t" | ||
147 | "b cpu_resume\n\t"); | ||
148 | } | ||
149 | |||
150 | /* No locking is needed because we only access per-CPU registers */ | 145 | /* No locking is needed because we only access per-CPU registers */ |
151 | void armada_370_xp_pmsu_idle_prepare(bool deepidle) | 146 | void armada_370_xp_pmsu_idle_prepare(bool deepidle) |
152 | { | 147 | { |
diff --git a/arch/arm/mach-mvebu/pmsu_ll.S b/arch/arm/mach-mvebu/pmsu_ll.S new file mode 100644 index 000000000000..fc3de68d8c54 --- /dev/null +++ b/arch/arm/mach-mvebu/pmsu_ll.S | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Marvell | ||
3 | * | ||
4 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | ||
5 | * Gregory Clement <gregory.clement@free-electrons.com> | ||
6 | * | ||
7 | * This file is licensed under the terms of the GNU General Public | ||
8 | * License version 2. This program is licensed "as is" without any | ||
9 | * warranty of any kind, whether express or implied. | ||
10 | */ | ||
11 | |||
12 | #include <linux/linkage.h> | ||
13 | #include <asm/assembler.h> | ||
14 | |||
15 | /* | ||
16 | * This is the entry point through which CPUs exiting cpuidle deep | ||
17 | * idle state are going. | ||
18 | */ | ||
19 | ENTRY(armada_370_xp_cpu_resume) | ||
20 | ARM_BE8(setend be ) @ go BE8 if entered LE | ||
21 | bl ll_add_cpu_to_smp_group | ||
22 | bl ll_enable_coherency | ||
23 | b cpu_resume | ||
24 | ENDPROC(armada_370_xp_cpu_resume) | ||
25 | |||
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig index 486d301f43fd..3c61096c8627 100644 --- a/arch/arm/mach-nomadik/Kconfig +++ b/arch/arm/mach-nomadik/Kconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | config ARCH_NOMADIK | 1 | menuconfig ARCH_NOMADIK |
2 | bool "ST-Ericsson Nomadik" | 2 | bool "ST-Ericsson Nomadik" |
3 | depends on ARCH_MULTI_V5 | 3 | depends on ARCH_MULTI_V5 |
4 | select ARCH_REQUIRE_GPIOLIB | 4 | select ARCH_REQUIRE_GPIOLIB |
@@ -15,7 +15,6 @@ config ARCH_NOMADIK | |||
15 | Support for the Nomadik platform by ST-Ericsson | 15 | Support for the Nomadik platform by ST-Ericsson |
16 | 16 | ||
17 | if ARCH_NOMADIK | 17 | if ARCH_NOMADIK |
18 | menu "Nomadik boards" | ||
19 | 18 | ||
20 | config MACH_NOMADIK_8815NHK | 19 | config MACH_NOMADIK_8815NHK |
21 | bool "ST 8815 Nomadik Hardware Kit (evaluation board)" | 20 | bool "ST 8815 Nomadik Hardware Kit (evaluation board)" |
@@ -24,7 +23,6 @@ config MACH_NOMADIK_8815NHK | |||
24 | select I2C_ALGOBIT | 23 | select I2C_ALGOBIT |
25 | select I2C_NOMADIK | 24 | select I2C_NOMADIK |
26 | 25 | ||
27 | endmenu | ||
28 | endif | 26 | endif |
29 | 27 | ||
30 | config NOMADIK_8815 | 28 | config NOMADIK_8815 |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 0ba482638ebf..1c1ed737f7ab 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -1,3 +1,6 @@ | |||
1 | menu "TI OMAP/AM/DM/DRA Family" | ||
2 | depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 | ||
3 | |||
1 | config ARCH_OMAP | 4 | config ARCH_OMAP |
2 | bool | 5 | bool |
3 | 6 | ||
@@ -28,12 +31,11 @@ config ARCH_OMAP4 | |||
28 | select ARM_CPU_SUSPEND if PM | 31 | select ARM_CPU_SUSPEND if PM |
29 | select ARM_ERRATA_720789 | 32 | select ARM_ERRATA_720789 |
30 | select ARM_GIC | 33 | select ARM_GIC |
31 | select CACHE_L2X0 | ||
32 | select HAVE_ARM_SCU if SMP | 34 | select HAVE_ARM_SCU if SMP |
33 | select HAVE_ARM_TWD if SMP | 35 | select HAVE_ARM_TWD if SMP |
34 | select OMAP_INTERCONNECT | 36 | select OMAP_INTERCONNECT |
35 | select PL310_ERRATA_588369 | 37 | select PL310_ERRATA_588369 if CACHE_L2X0 |
36 | select PL310_ERRATA_727915 | 38 | select PL310_ERRATA_727915 if CACHE_L2X0 |
37 | select PM_OPP if PM | 39 | select PM_OPP if PM |
38 | select PM_RUNTIME if CPU_IDLE | 40 | select PM_RUNTIME if CPU_IDLE |
39 | select ARM_ERRATA_754322 | 41 | select ARM_ERRATA_754322 |
@@ -80,7 +82,6 @@ config SOC_DRA7XX | |||
80 | config ARCH_OMAP2PLUS | 82 | config ARCH_OMAP2PLUS |
81 | bool | 83 | bool |
82 | select ARCH_HAS_BANDGAP | 84 | select ARCH_HAS_BANDGAP |
83 | select ARCH_HAS_CPUFREQ | ||
84 | select ARCH_HAS_HOLES_MEMORYMODEL | 85 | select ARCH_HAS_HOLES_MEMORYMODEL |
85 | select ARCH_OMAP | 86 | select ARCH_OMAP |
86 | select ARCH_REQUIRE_GPIOLIB | 87 | select ARCH_REQUIRE_GPIOLIB |
@@ -343,3 +344,5 @@ config OMAP4_ERRATA_I688 | |||
343 | endmenu | 344 | endmenu |
344 | 345 | ||
345 | endif | 346 | endif |
347 | |||
348 | endmenu | ||
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 8421f38cf445..8ca99e9321e3 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -110,14 +110,16 @@ obj-y += prm_common.o cm_common.o | |||
110 | obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o | 110 | obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o |
111 | obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o | 111 | obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o |
112 | obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o | 112 | obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o |
113 | obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o | ||
114 | omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ | 113 | omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ |
115 | prcm_mpu44xx.o prminst44xx.o \ | 114 | prcm_mpu44xx.o prminst44xx.o \ |
116 | vc44xx_data.o vp44xx_data.o | 115 | vc44xx_data.o vp44xx_data.o |
117 | obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) | 116 | obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) |
118 | obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common) | 117 | obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common) |
119 | obj-$(CONFIG_SOC_DRA7XX) += $(omap-prcm-4-5-common) | 118 | obj-$(CONFIG_SOC_DRA7XX) += $(omap-prcm-4-5-common) |
120 | obj-$(CONFIG_SOC_AM43XX) += $(omap-prcm-4-5-common) | 119 | am33xx-43xx-prcm-common += prm33xx.o cm33xx.o |
120 | obj-$(CONFIG_SOC_AM33XX) += $(am33xx-43xx-prcm-common) | ||
121 | obj-$(CONFIG_SOC_AM43XX) += $(omap-prcm-4-5-common) \ | ||
122 | $(am33xx-43xx-prcm-common) | ||
121 | 123 | ||
122 | # OMAP voltage domains | 124 | # OMAP voltage domains |
123 | voltagedomain-common := voltage.o vc.o vp.o | 125 | voltagedomain-common := voltage.o vc.o vp.o |
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c index 332af927f4d3..67fd26a18441 100644 --- a/arch/arm/mach-omap2/clkt_dpll.c +++ b/arch/arm/mach-omap2/clkt_dpll.c | |||
@@ -76,7 +76,7 @@ | |||
76 | * (assuming that it is counting N upwards), or -2 if the enclosing loop | 76 | * (assuming that it is counting N upwards), or -2 if the enclosing loop |
77 | * should skip to the next iteration (again assuming N is increasing). | 77 | * should skip to the next iteration (again assuming N is increasing). |
78 | */ | 78 | */ |
79 | static int _dpll_test_fint(struct clk_hw_omap *clk, u8 n) | 79 | static int _dpll_test_fint(struct clk_hw_omap *clk, unsigned int n) |
80 | { | 80 | { |
81 | struct dpll_data *dd; | 81 | struct dpll_data *dd; |
82 | long fint, fint_min, fint_max; | 82 | long fint, fint_min, fint_max; |
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h index 04dab2fcf862..ee6c784cd6b7 100644 --- a/arch/arm/mach-omap2/cm-regbits-34xx.h +++ b/arch/arm/mach-omap2/cm-regbits-34xx.h | |||
@@ -26,11 +26,14 @@ | |||
26 | #define OMAP3430_EN_WDT3_SHIFT 12 | 26 | #define OMAP3430_EN_WDT3_SHIFT 12 |
27 | #define OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_MASK (1 << 0) | 27 | #define OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_MASK (1 << 0) |
28 | #define OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT 0 | 28 | #define OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT 0 |
29 | #define OMAP3430_IVA2_DPLL_FREQSEL_SHIFT 4 | ||
29 | #define OMAP3430_IVA2_DPLL_FREQSEL_MASK (0xf << 4) | 30 | #define OMAP3430_IVA2_DPLL_FREQSEL_MASK (0xf << 4) |
30 | #define OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT 3 | 31 | #define OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT 3 |
32 | #define OMAP3430_EN_IVA2_DPLL_SHIFT 0 | ||
31 | #define OMAP3430_EN_IVA2_DPLL_MASK (0x7 << 0) | 33 | #define OMAP3430_EN_IVA2_DPLL_MASK (0x7 << 0) |
32 | #define OMAP3430_ST_IVA2_SHIFT 0 | 34 | #define OMAP3430_ST_IVA2_SHIFT 0 |
33 | #define OMAP3430_ST_IVA2_CLK_MASK (1 << 0) | 35 | #define OMAP3430_ST_IVA2_CLK_MASK (1 << 0) |
36 | #define OMAP3430_AUTO_IVA2_DPLL_SHIFT 0 | ||
34 | #define OMAP3430_AUTO_IVA2_DPLL_MASK (0x7 << 0) | 37 | #define OMAP3430_AUTO_IVA2_DPLL_MASK (0x7 << 0) |
35 | #define OMAP3430_IVA2_CLK_SRC_SHIFT 19 | 38 | #define OMAP3430_IVA2_CLK_SRC_SHIFT 19 |
36 | #define OMAP3430_IVA2_CLK_SRC_WIDTH 3 | 39 | #define OMAP3430_IVA2_CLK_SRC_WIDTH 3 |
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h index 15a778ce7707..bd2441790779 100644 --- a/arch/arm/mach-omap2/cm33xx.h +++ b/arch/arm/mach-omap2/cm33xx.h | |||
@@ -380,7 +380,7 @@ void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs); | |||
380 | void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs); | 380 | void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs); |
381 | void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs); | 381 | void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs); |
382 | 382 | ||
383 | #ifdef CONFIG_SOC_AM33XX | 383 | #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) |
384 | extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, | 384 | extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, |
385 | u16 clkctrl_offs); | 385 | u16 clkctrl_offs); |
386 | extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs, | 386 | extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs, |
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index ff029737c8f0..dc571f1d3b8a 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
@@ -91,7 +91,14 @@ extern void omap3_sync32k_timer_init(void); | |||
91 | extern void omap3_secure_sync32k_timer_init(void); | 91 | extern void omap3_secure_sync32k_timer_init(void); |
92 | extern void omap3_gptimer_timer_init(void); | 92 | extern void omap3_gptimer_timer_init(void); |
93 | extern void omap4_local_timer_init(void); | 93 | extern void omap4_local_timer_init(void); |
94 | #ifdef CONFIG_CACHE_L2X0 | ||
94 | int omap_l2_cache_init(void); | 95 | int omap_l2_cache_init(void); |
96 | #else | ||
97 | static inline int omap_l2_cache_init(void) | ||
98 | { | ||
99 | return 0; | ||
100 | } | ||
101 | #endif | ||
95 | extern void omap5_realtime_timer_init(void); | 102 | extern void omap5_realtime_timer_init(void); |
96 | 103 | ||
97 | void omap2420_init_early(void); | 104 | void omap2420_init_early(void); |
@@ -155,7 +162,8 @@ static inline void omap3xxx_restart(enum reboot_mode mode, const char *cmd) | |||
155 | } | 162 | } |
156 | #endif | 163 | #endif |
157 | 164 | ||
158 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) | 165 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ |
166 | defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM43XX) | ||
159 | void omap44xx_restart(enum reboot_mode mode, const char *cmd); | 167 | void omap44xx_restart(enum reboot_mode mode, const char *cmd); |
160 | #else | 168 | #else |
161 | static inline void omap44xx_restart(enum reboot_mode mode, const char *cmd) | 169 | static inline void omap44xx_restart(enum reboot_mode mode, const char *cmd) |
@@ -241,7 +249,6 @@ static inline void __iomem *omap4_get_scu_base(void) | |||
241 | } | 249 | } |
242 | #endif | 250 | #endif |
243 | 251 | ||
244 | extern void __init gic_init_irq(void); | ||
245 | extern void gic_dist_disable(void); | 252 | extern void gic_dist_disable(void); |
246 | extern void gic_dist_enable(void); | 253 | extern void gic_dist_enable(void); |
247 | extern bool gic_dist_disabled(void); | 254 | extern bool gic_dist_disabled(void); |
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 592ba0a0ecf3..b6f8f348296e 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -297,33 +297,6 @@ static void omap_init_audio(void) | |||
297 | static inline void omap_init_audio(void) {} | 297 | static inline void omap_init_audio(void) {} |
298 | #endif | 298 | #endif |
299 | 299 | ||
300 | #if defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI) || \ | ||
301 | defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI_MODULE) | ||
302 | |||
303 | static struct platform_device omap_hdmi_audio = { | ||
304 | .name = "omap-hdmi-audio", | ||
305 | .id = -1, | ||
306 | }; | ||
307 | |||
308 | static void __init omap_init_hdmi_audio(void) | ||
309 | { | ||
310 | struct omap_hwmod *oh; | ||
311 | struct platform_device *pdev; | ||
312 | |||
313 | oh = omap_hwmod_lookup("dss_hdmi"); | ||
314 | if (!oh) | ||
315 | return; | ||
316 | |||
317 | pdev = omap_device_build("omap-hdmi-audio-dai", -1, oh, NULL, 0); | ||
318 | WARN(IS_ERR(pdev), | ||
319 | "Can't build omap_device for omap-hdmi-audio-dai.\n"); | ||
320 | |||
321 | platform_device_register(&omap_hdmi_audio); | ||
322 | } | ||
323 | #else | ||
324 | static inline void omap_init_hdmi_audio(void) {} | ||
325 | #endif | ||
326 | |||
327 | #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE) | 300 | #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE) |
328 | 301 | ||
329 | #include <linux/platform_data/spi-omap2-mcspi.h> | 302 | #include <linux/platform_data/spi-omap2-mcspi.h> |
@@ -459,7 +432,6 @@ static int __init omap2_init_devices(void) | |||
459 | */ | 432 | */ |
460 | omap_init_audio(); | 433 | omap_init_audio(); |
461 | omap_init_camera(); | 434 | omap_init_camera(); |
462 | omap_init_hdmi_audio(); | ||
463 | omap_init_mbox(); | 435 | omap_init_mbox(); |
464 | /* If dtb is there, the devices will be created dynamically */ | 436 | /* If dtb is there, the devices will be created dynamically */ |
465 | if (!of_have_populated_dt()) { | 437 | if (!of_have_populated_dt()) { |
diff --git a/arch/arm/mach-omap2/dsp.c b/arch/arm/mach-omap2/dsp.c index b8208b4b1bd9..f7492df1cbba 100644 --- a/arch/arm/mach-omap2/dsp.c +++ b/arch/arm/mach-omap2/dsp.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #ifdef CONFIG_TIDSPBRIDGE_DVFS | 29 | #ifdef CONFIG_TIDSPBRIDGE_DVFS |
30 | #include "omap-pm.h" | 30 | #include "omap-pm.h" |
31 | #endif | 31 | #endif |
32 | #include "soc.h" | ||
32 | 33 | ||
33 | #include <linux/platform_data/dsp-omap.h> | 34 | #include <linux/platform_data/dsp-omap.h> |
34 | 35 | ||
@@ -59,6 +60,9 @@ void __init omap_dsp_reserve_sdram_memblock(void) | |||
59 | phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE; | 60 | phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE; |
60 | phys_addr_t paddr; | 61 | phys_addr_t paddr; |
61 | 62 | ||
63 | if (!cpu_is_omap34xx()) | ||
64 | return; | ||
65 | |||
62 | if (!size) | 66 | if (!size) |
63 | return; | 67 | return; |
64 | 68 | ||
@@ -83,6 +87,9 @@ static int __init omap_dsp_init(void) | |||
83 | int err = -ENOMEM; | 87 | int err = -ENOMEM; |
84 | struct omap_dsp_platform_data *pdata = &omap_dsp_pdata; | 88 | struct omap_dsp_platform_data *pdata = &omap_dsp_pdata; |
85 | 89 | ||
90 | if (!cpu_is_omap34xx()) | ||
91 | return 0; | ||
92 | |||
86 | pdata->phys_mempool_base = omap_dsp_get_mempool_base(); | 93 | pdata->phys_mempool_base = omap_dsp_get_mempool_base(); |
87 | 94 | ||
88 | if (pdata->phys_mempool_base) { | 95 | if (pdata->phys_mempool_base) { |
@@ -115,6 +122,9 @@ module_init(omap_dsp_init); | |||
115 | 122 | ||
116 | static void __exit omap_dsp_exit(void) | 123 | static void __exit omap_dsp_exit(void) |
117 | { | 124 | { |
125 | if (!cpu_is_omap34xx()) | ||
126 | return; | ||
127 | |||
118 | platform_device_unregister(omap_dsp_pdev); | 128 | platform_device_unregister(omap_dsp_pdev); |
119 | } | 129 | } |
120 | module_exit(omap_dsp_exit); | 130 | module_exit(omap_dsp_exit); |
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 2c0c2816900f..8bc13380f0a0 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -1615,7 +1615,7 @@ static int gpmc_probe_dt(struct platform_device *pdev) | |||
1615 | return ret; | 1615 | return ret; |
1616 | } | 1616 | } |
1617 | 1617 | ||
1618 | for_each_child_of_node(pdev->dev.of_node, child) { | 1618 | for_each_available_child_of_node(pdev->dev.of_node, child) { |
1619 | 1619 | ||
1620 | if (!child->name) | 1620 | if (!child->name) |
1621 | continue; | 1621 | continue; |
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index 43969da5d50b..d42022f2a71e 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c | |||
@@ -649,6 +649,18 @@ void __init dra7xxx_check_revision(void) | |||
649 | } | 649 | } |
650 | break; | 650 | break; |
651 | 651 | ||
652 | case 0xb9bc: | ||
653 | switch (rev) { | ||
654 | case 0: | ||
655 | omap_revision = DRA722_REV_ES1_0; | ||
656 | break; | ||
657 | default: | ||
658 | /* If we have no new revisions */ | ||
659 | omap_revision = DRA722_REV_ES1_0; | ||
660 | break; | ||
661 | } | ||
662 | break; | ||
663 | |||
652 | default: | 664 | default: |
653 | /* Unknown default to latest silicon rev as default*/ | 665 | /* Unknown default to latest silicon rev as default*/ |
654 | pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%d)\n", | 666 | pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%d)\n", |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index fd88edeb027f..f62f7537d899 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -183,8 +183,10 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition, | |||
183 | m0_entry = mux->muxnames[0]; | 183 | m0_entry = mux->muxnames[0]; |
184 | 184 | ||
185 | /* First check for full name in mode0.muxmode format */ | 185 | /* First check for full name in mode0.muxmode format */ |
186 | if (mode0_len && strncmp(muxname, m0_entry, mode0_len)) | 186 | if (mode0_len) |
187 | continue; | 187 | if (strncmp(muxname, m0_entry, mode0_len) || |
188 | (strlen(m0_entry) != mode0_len)) | ||
189 | continue; | ||
188 | 190 | ||
189 | /* Then check for muxmode only */ | 191 | /* Then check for muxmode only */ |
190 | for (i = 0; i < OMAP_MUX_NR_MODES; i++) { | 192 | for (i = 0; i < OMAP_MUX_NR_MODES; i++) { |
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c index 326cd982a3cb..539e8106eb96 100644 --- a/arch/arm/mach-omap2/omap4-common.c +++ b/arch/arm/mach-omap2/omap4-common.c | |||
@@ -102,26 +102,6 @@ void __init omap_barriers_init(void) | |||
102 | {} | 102 | {} |
103 | #endif | 103 | #endif |
104 | 104 | ||
105 | void __init gic_init_irq(void) | ||
106 | { | ||
107 | void __iomem *omap_irq_base; | ||
108 | |||
109 | /* Static mapping, never released */ | ||
110 | gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K); | ||
111 | BUG_ON(!gic_dist_base_addr); | ||
112 | |||
113 | twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_4K); | ||
114 | BUG_ON(!twd_base); | ||
115 | |||
116 | /* Static mapping, never released */ | ||
117 | omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512); | ||
118 | BUG_ON(!omap_irq_base); | ||
119 | |||
120 | omap_wakeupgen_init(); | ||
121 | |||
122 | gic_init(0, 29, gic_dist_base_addr, omap_irq_base); | ||
123 | } | ||
124 | |||
125 | void gic_dist_disable(void) | 105 | void gic_dist_disable(void) |
126 | { | 106 | { |
127 | if (gic_dist_base_addr) | 107 | if (gic_dist_base_addr) |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index f7bb435bb543..6c074f37cdd2 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -4251,9 +4251,9 @@ void __init omap_hwmod_init(void) | |||
4251 | soc_ops.enable_module = _omap4_enable_module; | 4251 | soc_ops.enable_module = _omap4_enable_module; |
4252 | soc_ops.disable_module = _omap4_disable_module; | 4252 | soc_ops.disable_module = _omap4_disable_module; |
4253 | soc_ops.wait_target_ready = _omap4_wait_target_ready; | 4253 | soc_ops.wait_target_ready = _omap4_wait_target_ready; |
4254 | soc_ops.assert_hardreset = _omap4_assert_hardreset; | 4254 | soc_ops.assert_hardreset = _am33xx_assert_hardreset; |
4255 | soc_ops.deassert_hardreset = _omap4_deassert_hardreset; | 4255 | soc_ops.deassert_hardreset = _am33xx_deassert_hardreset; |
4256 | soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; | 4256 | soc_ops.is_hardreset_asserted = _am33xx_is_hardreset_asserted; |
4257 | soc_ops.init_clkdm = _init_clkdm; | 4257 | soc_ops.init_clkdm = _init_clkdm; |
4258 | } else if (soc_is_am33xx()) { | 4258 | } else if (soc_is_am33xx()) { |
4259 | soc_ops.enable_module = _am33xx_enable_module; | 4259 | soc_ops.enable_module = _am33xx_enable_module; |
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c index 290213f2cbe3..1103aa0e0d29 100644 --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c | |||
@@ -2020,6 +2020,77 @@ static struct omap_hwmod omap54xx_wd_timer2_hwmod = { | |||
2020 | }, | 2020 | }, |
2021 | }; | 2021 | }; |
2022 | 2022 | ||
2023 | /* | ||
2024 | * 'ocp2scp' class | ||
2025 | * bridge to transform ocp interface protocol to scp (serial control port) | ||
2026 | * protocol | ||
2027 | */ | ||
2028 | /* ocp2scp3 */ | ||
2029 | static struct omap_hwmod omap54xx_ocp2scp3_hwmod; | ||
2030 | /* l4_cfg -> ocp2scp3 */ | ||
2031 | static struct omap_hwmod_ocp_if omap54xx_l4_cfg__ocp2scp3 = { | ||
2032 | .master = &omap54xx_l4_cfg_hwmod, | ||
2033 | .slave = &omap54xx_ocp2scp3_hwmod, | ||
2034 | .clk = "l4_root_clk_div", | ||
2035 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
2036 | }; | ||
2037 | |||
2038 | static struct omap_hwmod omap54xx_ocp2scp3_hwmod = { | ||
2039 | .name = "ocp2scp3", | ||
2040 | .class = &omap54xx_ocp2scp_hwmod_class, | ||
2041 | .clkdm_name = "l3init_clkdm", | ||
2042 | .prcm = { | ||
2043 | .omap4 = { | ||
2044 | .clkctrl_offs = OMAP54XX_CM_L3INIT_OCP2SCP3_CLKCTRL_OFFSET, | ||
2045 | .context_offs = OMAP54XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET, | ||
2046 | .modulemode = MODULEMODE_HWCTRL, | ||
2047 | }, | ||
2048 | }, | ||
2049 | }; | ||
2050 | |||
2051 | /* | ||
2052 | * 'sata' class | ||
2053 | * sata: serial ata interface gen2 compliant ( 1 rx/ 1 tx) | ||
2054 | */ | ||
2055 | |||
2056 | static struct omap_hwmod_class_sysconfig omap54xx_sata_sysc = { | ||
2057 | .sysc_offs = 0x0000, | ||
2058 | .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE), | ||
2059 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | ||
2060 | SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | | ||
2061 | MSTANDBY_SMART | MSTANDBY_SMART_WKUP), | ||
2062 | .sysc_fields = &omap_hwmod_sysc_type2, | ||
2063 | }; | ||
2064 | |||
2065 | static struct omap_hwmod_class omap54xx_sata_hwmod_class = { | ||
2066 | .name = "sata", | ||
2067 | .sysc = &omap54xx_sata_sysc, | ||
2068 | }; | ||
2069 | |||
2070 | /* sata */ | ||
2071 | static struct omap_hwmod omap54xx_sata_hwmod = { | ||
2072 | .name = "sata", | ||
2073 | .class = &omap54xx_sata_hwmod_class, | ||
2074 | .clkdm_name = "l3init_clkdm", | ||
2075 | .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, | ||
2076 | .main_clk = "func_48m_fclk", | ||
2077 | .mpu_rt_idx = 1, | ||
2078 | .prcm = { | ||
2079 | .omap4 = { | ||
2080 | .clkctrl_offs = OMAP54XX_CM_L3INIT_SATA_CLKCTRL_OFFSET, | ||
2081 | .context_offs = OMAP54XX_RM_L3INIT_SATA_CONTEXT_OFFSET, | ||
2082 | .modulemode = MODULEMODE_SWCTRL, | ||
2083 | }, | ||
2084 | }, | ||
2085 | }; | ||
2086 | |||
2087 | /* l4_cfg -> sata */ | ||
2088 | static struct omap_hwmod_ocp_if omap54xx_l4_cfg__sata = { | ||
2089 | .master = &omap54xx_l4_cfg_hwmod, | ||
2090 | .slave = &omap54xx_sata_hwmod, | ||
2091 | .clk = "l3_iclk_div", | ||
2092 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
2093 | }; | ||
2023 | 2094 | ||
2024 | /* | 2095 | /* |
2025 | * Interfaces | 2096 | * Interfaces |
@@ -2765,6 +2836,8 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = { | |||
2765 | &omap54xx_l4_cfg__usb_tll_hs, | 2836 | &omap54xx_l4_cfg__usb_tll_hs, |
2766 | &omap54xx_l4_cfg__usb_otg_ss, | 2837 | &omap54xx_l4_cfg__usb_otg_ss, |
2767 | &omap54xx_l4_wkup__wd_timer2, | 2838 | &omap54xx_l4_wkup__wd_timer2, |
2839 | &omap54xx_l4_cfg__ocp2scp3, | ||
2840 | &omap54xx_l4_cfg__sata, | ||
2768 | NULL, | 2841 | NULL, |
2769 | }; | 2842 | }; |
2770 | 2843 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c index 20b4398cec05..284324f2b98a 100644 --- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c | |||
@@ -1268,9 +1268,6 @@ static struct omap_hwmod_class dra7xx_sata_hwmod_class = { | |||
1268 | }; | 1268 | }; |
1269 | 1269 | ||
1270 | /* sata */ | 1270 | /* sata */ |
1271 | static struct omap_hwmod_opt_clk sata_opt_clks[] = { | ||
1272 | { .role = "ref_clk", .clk = "sata_ref_clk" }, | ||
1273 | }; | ||
1274 | 1271 | ||
1275 | static struct omap_hwmod dra7xx_sata_hwmod = { | 1272 | static struct omap_hwmod dra7xx_sata_hwmod = { |
1276 | .name = "sata", | 1273 | .name = "sata", |
@@ -1278,6 +1275,7 @@ static struct omap_hwmod dra7xx_sata_hwmod = { | |||
1278 | .clkdm_name = "l3init_clkdm", | 1275 | .clkdm_name = "l3init_clkdm", |
1279 | .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, | 1276 | .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, |
1280 | .main_clk = "func_48m_fclk", | 1277 | .main_clk = "func_48m_fclk", |
1278 | .mpu_rt_idx = 1, | ||
1281 | .prcm = { | 1279 | .prcm = { |
1282 | .omap4 = { | 1280 | .omap4 = { |
1283 | .clkctrl_offs = DRA7XX_CM_L3INIT_SATA_CLKCTRL_OFFSET, | 1281 | .clkctrl_offs = DRA7XX_CM_L3INIT_SATA_CLKCTRL_OFFSET, |
@@ -1285,8 +1283,6 @@ static struct omap_hwmod dra7xx_sata_hwmod = { | |||
1285 | .modulemode = MODULEMODE_SWCTRL, | 1283 | .modulemode = MODULEMODE_SWCTRL, |
1286 | }, | 1284 | }, |
1287 | }, | 1285 | }, |
1288 | .opt_clks = sata_opt_clks, | ||
1289 | .opt_clks_cnt = ARRAY_SIZE(sata_opt_clks), | ||
1290 | }; | 1286 | }; |
1291 | 1287 | ||
1292 | /* | 1288 | /* |
@@ -1731,8 +1727,20 @@ static struct omap_hwmod dra7xx_uart6_hwmod = { | |||
1731 | * | 1727 | * |
1732 | */ | 1728 | */ |
1733 | 1729 | ||
1730 | static struct omap_hwmod_class_sysconfig dra7xx_usb_otg_ss_sysc = { | ||
1731 | .rev_offs = 0x0000, | ||
1732 | .sysc_offs = 0x0010, | ||
1733 | .sysc_flags = (SYSC_HAS_DMADISABLE | SYSC_HAS_MIDLEMODE | | ||
1734 | SYSC_HAS_SIDLEMODE), | ||
1735 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | ||
1736 | SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | | ||
1737 | MSTANDBY_SMART | MSTANDBY_SMART_WKUP), | ||
1738 | .sysc_fields = &omap_hwmod_sysc_type2, | ||
1739 | }; | ||
1740 | |||
1734 | static struct omap_hwmod_class dra7xx_usb_otg_ss_hwmod_class = { | 1741 | static struct omap_hwmod_class dra7xx_usb_otg_ss_hwmod_class = { |
1735 | .name = "usb_otg_ss", | 1742 | .name = "usb_otg_ss", |
1743 | .sysc = &dra7xx_usb_otg_ss_sysc, | ||
1736 | }; | 1744 | }; |
1737 | 1745 | ||
1738 | /* usb_otg_ss1 */ | 1746 | /* usb_otg_ss1 */ |
diff --git a/arch/arm/mach-omap2/prm-regbits-34xx.h b/arch/arm/mach-omap2/prm-regbits-34xx.h index 106132db532b..cbefbd7cfdb5 100644 --- a/arch/arm/mach-omap2/prm-regbits-34xx.h +++ b/arch/arm/mach-omap2/prm-regbits-34xx.h | |||
@@ -35,6 +35,8 @@ | |||
35 | #define OMAP3430_LOGICSTATEST_MASK (1 << 2) | 35 | #define OMAP3430_LOGICSTATEST_MASK (1 << 2) |
36 | #define OMAP3430_LASTLOGICSTATEENTERED_MASK (1 << 2) | 36 | #define OMAP3430_LASTLOGICSTATEENTERED_MASK (1 << 2) |
37 | #define OMAP3430_LASTPOWERSTATEENTERED_MASK (0x3 << 0) | 37 | #define OMAP3430_LASTPOWERSTATEENTERED_MASK (0x3 << 0) |
38 | #define OMAP3430_GRPSEL_MCBSP5_MASK (1 << 10) | ||
39 | #define OMAP3430_GRPSEL_MCBSP1_MASK (1 << 9) | ||
38 | #define OMAP3630_GRPSEL_UART4_MASK (1 << 18) | 40 | #define OMAP3630_GRPSEL_UART4_MASK (1 << 18) |
39 | #define OMAP3430_GRPSEL_GPIO6_MASK (1 << 17) | 41 | #define OMAP3430_GRPSEL_GPIO6_MASK (1 << 17) |
40 | #define OMAP3430_GRPSEL_GPIO5_MASK (1 << 16) | 42 | #define OMAP3430_GRPSEL_GPIO5_MASK (1 << 16) |
@@ -42,6 +44,10 @@ | |||
42 | #define OMAP3430_GRPSEL_GPIO3_MASK (1 << 14) | 44 | #define OMAP3430_GRPSEL_GPIO3_MASK (1 << 14) |
43 | #define OMAP3430_GRPSEL_GPIO2_MASK (1 << 13) | 45 | #define OMAP3430_GRPSEL_GPIO2_MASK (1 << 13) |
44 | #define OMAP3430_GRPSEL_UART3_MASK (1 << 11) | 46 | #define OMAP3430_GRPSEL_UART3_MASK (1 << 11) |
47 | #define OMAP3430_GRPSEL_GPT8_MASK (1 << 9) | ||
48 | #define OMAP3430_GRPSEL_GPT7_MASK (1 << 8) | ||
49 | #define OMAP3430_GRPSEL_GPT6_MASK (1 << 7) | ||
50 | #define OMAP3430_GRPSEL_GPT5_MASK (1 << 6) | ||
45 | #define OMAP3430_GRPSEL_MCBSP4_MASK (1 << 2) | 51 | #define OMAP3430_GRPSEL_MCBSP4_MASK (1 << 2) |
46 | #define OMAP3430_GRPSEL_MCBSP3_MASK (1 << 1) | 52 | #define OMAP3430_GRPSEL_MCBSP3_MASK (1 << 1) |
47 | #define OMAP3430_GRPSEL_MCBSP2_MASK (1 << 0) | 53 | #define OMAP3430_GRPSEL_MCBSP2_MASK (1 << 0) |
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h index de2a34c423a7..01ca8086fb6c 100644 --- a/arch/arm/mach-omap2/soc.h +++ b/arch/arm/mach-omap2/soc.h | |||
@@ -462,6 +462,7 @@ IS_OMAP_TYPE(3430, 0x3430) | |||
462 | #define DRA7XX_CLASS 0x07000000 | 462 | #define DRA7XX_CLASS 0x07000000 |
463 | #define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8)) | 463 | #define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8)) |
464 | #define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8)) | 464 | #define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8)) |
465 | #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8)) | ||
465 | 466 | ||
466 | void omap2xxx_check_revision(void); | 467 | void omap2xxx_check_revision(void); |
467 | void omap3xxx_check_revision(void); | 468 | void omap3xxx_check_revision(void); |
diff --git a/arch/arm/mach-prima2/Kconfig b/arch/arm/mach-prima2/Kconfig index e4e505f52ba0..042f693ef423 100644 --- a/arch/arm/mach-prima2/Kconfig +++ b/arch/arm/mach-prima2/Kconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | config ARCH_SIRF | 1 | menuconfig ARCH_SIRF |
2 | bool "CSR SiRF" if ARCH_MULTI_V7 | 2 | bool "CSR SiRF" if ARCH_MULTI_V7 |
3 | select ARCH_HAS_RESET_CONTROLLER | 3 | select ARCH_HAS_RESET_CONTROLLER |
4 | select ARCH_REQUIRE_GPIOLIB | 4 | select ARCH_REQUIRE_GPIOLIB |
@@ -11,7 +11,7 @@ config ARCH_SIRF | |||
11 | 11 | ||
12 | if ARCH_SIRF | 12 | if ARCH_SIRF |
13 | 13 | ||
14 | menu "CSR SiRF atlas6/primaII/Marco/Polo Specific Features" | 14 | comment "CSR SiRF atlas6/primaII/Marco/Polo Specific Features" |
15 | 15 | ||
16 | config ARCH_ATLAS6 | 16 | config ARCH_ATLAS6 |
17 | bool "CSR SiRFSoC ATLAS6 ARM Cortex A9 Platform" | 17 | bool "CSR SiRFSoC ATLAS6 ARM Cortex A9 Platform" |
@@ -37,8 +37,6 @@ config ARCH_MARCO | |||
37 | help | 37 | help |
38 | Support for CSR SiRFSoC ARM Cortex A9 Platform | 38 | Support for CSR SiRFSoC ARM Cortex A9 Platform |
39 | 39 | ||
40 | endmenu | ||
41 | |||
42 | config SIRF_IRQ | 40 | config SIRF_IRQ |
43 | bool | 41 | bool |
44 | 42 | ||
diff --git a/arch/arm/mach-qcom/Kconfig b/arch/arm/mach-qcom/Kconfig index fd2b99dceb89..ee5697ba05bc 100644 --- a/arch/arm/mach-qcom/Kconfig +++ b/arch/arm/mach-qcom/Kconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | config ARCH_QCOM | 1 | menuconfig ARCH_QCOM |
2 | bool "Qualcomm Support" if ARCH_MULTI_V7 | 2 | bool "Qualcomm Support" if ARCH_MULTI_V7 |
3 | select ARCH_REQUIRE_GPIOLIB | 3 | select ARCH_REQUIRE_GPIOLIB |
4 | select ARM_GIC | 4 | select ARM_GIC |
@@ -11,8 +11,6 @@ config ARCH_QCOM | |||
11 | 11 | ||
12 | if ARCH_QCOM | 12 | if ARCH_QCOM |
13 | 13 | ||
14 | menu "Qualcomm SoC Selection" | ||
15 | |||
16 | config ARCH_MSM8X60 | 14 | config ARCH_MSM8X60 |
17 | bool "Enable support for MSM8X60" | 15 | bool "Enable support for MSM8X60" |
18 | select CLKSRC_QCOM | 16 | select CLKSRC_QCOM |
@@ -25,8 +23,6 @@ config ARCH_MSM8974 | |||
25 | bool "Enable support for MSM8974" | 23 | bool "Enable support for MSM8974" |
26 | select HAVE_ARM_ARCH_TIMER | 24 | select HAVE_ARM_ARCH_TIMER |
27 | 25 | ||
28 | endmenu | ||
29 | |||
30 | config QCOM_SCM | 26 | config QCOM_SCM |
31 | bool | 27 | bool |
32 | 28 | ||
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig index 04284de7aca5..ad5316ae524e 100644 --- a/arch/arm/mach-s3c24xx/Kconfig +++ b/arch/arm/mach-s3c24xx/Kconfig | |||
@@ -117,7 +117,7 @@ config S3C24XX_SETUP_TS | |||
117 | Compile in platform device definition for Samsung TouchScreen. | 117 | Compile in platform device definition for Samsung TouchScreen. |
118 | 118 | ||
119 | config S3C24XX_DMA | 119 | config S3C24XX_DMA |
120 | bool "S3C2410 DMA support" | 120 | bool "S3C2410 DMA support (deprecated)" |
121 | select S3C_DMA | 121 | select S3C_DMA |
122 | help | 122 | help |
123 | S3C2410 DMA support. This is needed for drivers like sound which | 123 | S3C2410 DMA support. This is needed for drivers like sound which |
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig index 3136d86b0d6e..26ca2427e53d 100644 --- a/arch/arm/mach-s3c64xx/Kconfig +++ b/arch/arm/mach-s3c64xx/Kconfig | |||
@@ -18,9 +18,9 @@ config CPU_S3C6410 | |||
18 | Enable S3C6410 CPU support | 18 | Enable S3C6410 CPU support |
19 | 19 | ||
20 | config S3C64XX_PL080 | 20 | config S3C64XX_PL080 |
21 | bool "S3C64XX DMA using generic PL08x driver" | 21 | def_bool DMADEVICES |
22 | select ARM_AMBA | ||
22 | select AMBA_PL08X | 23 | select AMBA_PL08X |
23 | select SAMSUNG_DMADEV | ||
24 | 24 | ||
25 | config S3C64XX_SETUP_SDHCI | 25 | config S3C64XX_SETUP_SDHCI |
26 | bool | 26 | bool |
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig index bb2111b3751e..26003e23796d 100644 --- a/arch/arm/mach-s5p64x0/Kconfig +++ b/arch/arm/mach-s5p64x0/Kconfig | |||
@@ -9,16 +9,18 @@ if ARCH_S5P64X0 | |||
9 | 9 | ||
10 | config CPU_S5P6440 | 10 | config CPU_S5P6440 |
11 | bool | 11 | bool |
12 | select ARM_AMBA | ||
13 | select PL330_DMA if DMADEVICES | ||
12 | select S5P_SLEEP if PM | 14 | select S5P_SLEEP if PM |
13 | select SAMSUNG_DMADEV | ||
14 | select SAMSUNG_WAKEMASK if PM | 15 | select SAMSUNG_WAKEMASK if PM |
15 | help | 16 | help |
16 | Enable S5P6440 CPU support | 17 | Enable S5P6440 CPU support |
17 | 18 | ||
18 | config CPU_S5P6450 | 19 | config CPU_S5P6450 |
19 | bool | 20 | bool |
21 | select ARM_AMBA | ||
22 | select PL330_DMA if DMADEVICES | ||
20 | select S5P_SLEEP if PM | 23 | select S5P_SLEEP if PM |
21 | select SAMSUNG_DMADEV | ||
22 | select SAMSUNG_WAKEMASK if PM | 24 | select SAMSUNG_WAKEMASK if PM |
23 | help | 25 | help |
24 | Enable S5P6450 CPU support | 26 | Enable S5P6450 CPU support |
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig index 15170be97a74..c5e3a969b063 100644 --- a/arch/arm/mach-s5pc100/Kconfig +++ b/arch/arm/mach-s5pc100/Kconfig | |||
@@ -9,8 +9,9 @@ if ARCH_S5PC100 | |||
9 | 9 | ||
10 | config CPU_S5PC100 | 10 | config CPU_S5PC100 |
11 | bool | 11 | bool |
12 | select ARM_AMBA | ||
13 | select PL330_DMA if DMADEVICES | ||
12 | select S5P_EXT_INT | 14 | select S5P_EXT_INT |
13 | select SAMSUNG_DMADEV | ||
14 | help | 15 | help |
15 | Enable S5PC100 CPU support | 16 | Enable S5PC100 CPU support |
16 | 17 | ||
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig index 8c3abe521757..f60f2862856d 100644 --- a/arch/arm/mach-s5pv210/Kconfig +++ b/arch/arm/mach-s5pv210/Kconfig | |||
@@ -11,10 +11,11 @@ if ARCH_S5PV210 | |||
11 | 11 | ||
12 | config CPU_S5PV210 | 12 | config CPU_S5PV210 |
13 | bool | 13 | bool |
14 | select ARM_AMBA | ||
15 | select PL330_DMA if DMADEVICES | ||
14 | select S5P_EXT_INT | 16 | select S5P_EXT_INT |
15 | select S5P_PM if PM | 17 | select S5P_PM if PM |
16 | select S5P_SLEEP if PM | 18 | select S5P_SLEEP if PM |
17 | select SAMSUNG_DMADEV | ||
18 | help | 19 | help |
19 | Enable S5PV210 CPU support | 20 | Enable S5PV210 CPU support |
20 | 21 | ||
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index f9874ba60cc8..108939f8d053 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
@@ -329,6 +329,11 @@ static struct mtd_partition collie_partitions[] = { | |||
329 | .name = "rootfs", | 329 | .name = "rootfs", |
330 | .offset = MTDPART_OFS_APPEND, | 330 | .offset = MTDPART_OFS_APPEND, |
331 | .size = 0x00e20000, | 331 | .size = 0x00e20000, |
332 | }, { | ||
333 | .name = "bootblock", | ||
334 | .offset = MTDPART_OFS_APPEND, | ||
335 | .size = 0x00020000, | ||
336 | .mask_flags = MTD_WRITEABLE | ||
332 | } | 337 | } |
333 | }; | 338 | }; |
334 | 339 | ||
@@ -356,7 +361,7 @@ static void collie_flash_exit(void) | |||
356 | } | 361 | } |
357 | 362 | ||
358 | static struct flash_platform_data collie_flash_data = { | 363 | static struct flash_platform_data collie_flash_data = { |
359 | .map_name = "jedec_probe", | 364 | .map_name = "cfi_probe", |
360 | .init = collie_flash_init, | 365 | .init = collie_flash_init, |
361 | .set_vpp = collie_set_vpp, | 366 | .set_vpp = collie_set_vpp, |
362 | .exit = collie_flash_exit, | 367 | .exit = collie_flash_exit, |
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index dbd954e61aa7..798073057e51 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config ARCH_SHMOBILE | 1 | config ARCH_SHMOBILE |
2 | bool | 2 | bool |
3 | 3 | ||
4 | config ARCH_SHMOBILE_MULTI | 4 | menuconfig ARCH_SHMOBILE_MULTI |
5 | bool "Renesas ARM SoCs" if ARCH_MULTI_V7 | 5 | bool "Renesas ARM SoCs" if ARCH_MULTI_V7 |
6 | depends on MMU | 6 | depends on MMU |
7 | select ARCH_SHMOBILE | 7 | select ARCH_SHMOBILE |
@@ -15,7 +15,7 @@ config ARCH_SHMOBILE_MULTI | |||
15 | 15 | ||
16 | if ARCH_SHMOBILE_MULTI | 16 | if ARCH_SHMOBILE_MULTI |
17 | 17 | ||
18 | comment "Renesas ARM SoCs System Type" | 18 | #comment "Renesas ARM SoCs System Type" |
19 | 19 | ||
20 | config ARCH_EMEV2 | 20 | config ARCH_EMEV2 |
21 | bool "Emma Mobile EV2" | 21 | bool "Emma Mobile EV2" |
@@ -85,7 +85,6 @@ config ARCH_R8A73A4 | |||
85 | select CPU_V7 | 85 | select CPU_V7 |
86 | select SH_CLK_CPG | 86 | select SH_CLK_CPG |
87 | select RENESAS_IRQC | 87 | select RENESAS_IRQC |
88 | select ARCH_HAS_CPUFREQ | ||
89 | select ARCH_HAS_OPP | 88 | select ARCH_HAS_OPP |
90 | select SYS_SUPPORTS_SH_CMT | 89 | select SYS_SUPPORTS_SH_CMT |
91 | select SYS_SUPPORTS_SH_TMU | 90 | select SYS_SUPPORTS_SH_TMU |
@@ -264,7 +263,6 @@ config MACH_KOELSCH | |||
264 | config MACH_KZM9G | 263 | config MACH_KZM9G |
265 | bool "KZM-A9-GT board" | 264 | bool "KZM-A9-GT board" |
266 | depends on ARCH_SH73A0 | 265 | depends on ARCH_SH73A0 |
267 | select ARCH_HAS_CPUFREQ | ||
268 | select ARCH_HAS_OPP | 266 | select ARCH_HAS_OPP |
269 | select ARCH_REQUIRE_GPIOLIB | 267 | select ARCH_REQUIRE_GPIOLIB |
270 | select REGULATOR_FIXED_VOLTAGE if REGULATOR | 268 | select REGULATOR_FIXED_VOLTAGE if REGULATOR |
diff --git a/arch/arm/mach-spear/Kconfig b/arch/arm/mach-spear/Kconfig index 0786249b2832..90df2022276a 100644 --- a/arch/arm/mach-spear/Kconfig +++ b/arch/arm/mach-spear/Kconfig | |||
@@ -14,7 +14,6 @@ if PLAT_SPEAR | |||
14 | config ARCH_SPEAR13XX | 14 | config ARCH_SPEAR13XX |
15 | bool "ST SPEAr13xx" | 15 | bool "ST SPEAr13xx" |
16 | depends on ARCH_MULTI_V7 || PLAT_SPEAR_SINGLE | 16 | depends on ARCH_MULTI_V7 || PLAT_SPEAR_SINGLE |
17 | select ARCH_HAS_CPUFREQ | ||
18 | select ARM_GIC | 17 | select ARM_GIC |
19 | select GPIO_SPEAR_SPICS | 18 | select GPIO_SPEAR_SPICS |
20 | select HAVE_ARM_SCU if SMP | 19 | select HAVE_ARM_SCU if SMP |
diff --git a/arch/arm/mach-sti/Kconfig b/arch/arm/mach-sti/Kconfig index abf9ee9bbc3f..878e9ec97d0f 100644 --- a/arch/arm/mach-sti/Kconfig +++ b/arch/arm/mach-sti/Kconfig | |||
@@ -1,5 +1,5 @@ | |||
1 | menuconfig ARCH_STI | 1 | menuconfig ARCH_STI |
2 | bool "STMicroelectronics Consumer Electronics SOCs with Device Trees" if ARCH_MULTI_V7 | 2 | bool "STMicroelectronics Consumer Electronics SOCs" if ARCH_MULTI_V7 |
3 | select ARM_GIC | 3 | select ARM_GIC |
4 | select ARM_GLOBAL_TIMER | 4 | select ARM_GLOBAL_TIMER |
5 | select PINCTRL | 5 | select PINCTRL |
@@ -11,8 +11,8 @@ menuconfig ARCH_STI | |||
11 | select ARM_ERRATA_754322 | 11 | select ARM_ERRATA_754322 |
12 | select ARM_ERRATA_764369 if SMP | 12 | select ARM_ERRATA_764369 if SMP |
13 | select ARM_ERRATA_775420 | 13 | select ARM_ERRATA_775420 |
14 | select PL310_ERRATA_753970 if CACHE_PL310 | 14 | select PL310_ERRATA_753970 if CACHE_L2X0 |
15 | select PL310_ERRATA_769419 if CACHE_PL310 | 15 | select PL310_ERRATA_769419 if CACHE_L2X0 |
16 | help | 16 | help |
17 | Include support for STiH41x SOCs like STiH415/416 using the device tree | 17 | Include support for STiH41x SOCs like STiH415/416 using the device tree |
18 | for discovery | 18 | for discovery |
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c index 3f9587bb51f6..b6085084e0ff 100644 --- a/arch/arm/mach-sunxi/sunxi.c +++ b/arch/arm/mach-sunxi/sunxi.c | |||
@@ -12,8 +12,81 @@ | |||
12 | 12 | ||
13 | #include <linux/clk-provider.h> | 13 | #include <linux/clk-provider.h> |
14 | #include <linux/clocksource.h> | 14 | #include <linux/clocksource.h> |
15 | #include <linux/delay.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/of_address.h> | ||
19 | #include <linux/of_irq.h> | ||
20 | #include <linux/of_platform.h> | ||
21 | #include <linux/io.h> | ||
22 | #include <linux/reboot.h> | ||
15 | 23 | ||
16 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
25 | #include <asm/mach/map.h> | ||
26 | #include <asm/system_misc.h> | ||
27 | |||
28 | #define SUN4I_WATCHDOG_CTRL_REG 0x00 | ||
29 | #define SUN4I_WATCHDOG_CTRL_RESTART BIT(0) | ||
30 | #define SUN4I_WATCHDOG_MODE_REG 0x04 | ||
31 | #define SUN4I_WATCHDOG_MODE_ENABLE BIT(0) | ||
32 | #define SUN4I_WATCHDOG_MODE_RESET_ENABLE BIT(1) | ||
33 | |||
34 | #define SUN6I_WATCHDOG1_IRQ_REG 0x00 | ||
35 | #define SUN6I_WATCHDOG1_CTRL_REG 0x10 | ||
36 | #define SUN6I_WATCHDOG1_CTRL_RESTART BIT(0) | ||
37 | #define SUN6I_WATCHDOG1_CONFIG_REG 0x14 | ||
38 | #define SUN6I_WATCHDOG1_CONFIG_RESTART BIT(0) | ||
39 | #define SUN6I_WATCHDOG1_CONFIG_IRQ BIT(1) | ||
40 | #define SUN6I_WATCHDOG1_MODE_REG 0x18 | ||
41 | #define SUN6I_WATCHDOG1_MODE_ENABLE BIT(0) | ||
42 | |||
43 | static void __iomem *wdt_base; | ||
44 | |||
45 | static void sun4i_restart(enum reboot_mode mode, const char *cmd) | ||
46 | { | ||
47 | if (!wdt_base) | ||
48 | return; | ||
49 | |||
50 | /* Enable timer and set reset bit in the watchdog */ | ||
51 | writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE, | ||
52 | wdt_base + SUN4I_WATCHDOG_MODE_REG); | ||
53 | |||
54 | /* | ||
55 | * Restart the watchdog. The default (and lowest) interval | ||
56 | * value for the watchdog is 0.5s. | ||
57 | */ | ||
58 | writel(SUN4I_WATCHDOG_CTRL_RESTART, wdt_base + SUN4I_WATCHDOG_CTRL_REG); | ||
59 | |||
60 | while (1) { | ||
61 | mdelay(5); | ||
62 | writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE, | ||
63 | wdt_base + SUN4I_WATCHDOG_MODE_REG); | ||
64 | } | ||
65 | } | ||
66 | |||
67 | static struct of_device_id sunxi_restart_ids[] = { | ||
68 | { .compatible = "allwinner,sun4i-a10-wdt" }, | ||
69 | { /*sentinel*/ } | ||
70 | }; | ||
71 | |||
72 | static void sunxi_setup_restart(void) | ||
73 | { | ||
74 | struct device_node *np; | ||
75 | |||
76 | np = of_find_matching_node(NULL, sunxi_restart_ids); | ||
77 | if (WARN(!np, "unable to setup watchdog restart")) | ||
78 | return; | ||
79 | |||
80 | wdt_base = of_iomap(np, 0); | ||
81 | WARN(!wdt_base, "failed to map watchdog base address"); | ||
82 | } | ||
83 | |||
84 | static void __init sunxi_dt_init(void) | ||
85 | { | ||
86 | sunxi_setup_restart(); | ||
87 | |||
88 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
89 | } | ||
17 | 90 | ||
18 | static const char * const sunxi_board_dt_compat[] = { | 91 | static const char * const sunxi_board_dt_compat[] = { |
19 | "allwinner,sun4i-a10", | 92 | "allwinner,sun4i-a10", |
@@ -23,7 +96,9 @@ static const char * const sunxi_board_dt_compat[] = { | |||
23 | }; | 96 | }; |
24 | 97 | ||
25 | DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") | 98 | DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") |
99 | .init_machine = sunxi_dt_init, | ||
26 | .dt_compat = sunxi_board_dt_compat, | 100 | .dt_compat = sunxi_board_dt_compat, |
101 | .restart = sun4i_restart, | ||
27 | MACHINE_END | 102 | MACHINE_END |
28 | 103 | ||
29 | static const char * const sun6i_board_dt_compat[] = { | 104 | static const char * const sun6i_board_dt_compat[] = { |
@@ -51,5 +126,7 @@ static const char * const sun7i_board_dt_compat[] = { | |||
51 | }; | 126 | }; |
52 | 127 | ||
53 | DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family") | 128 | DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family") |
129 | .init_machine = sunxi_dt_init, | ||
54 | .dt_compat = sun7i_board_dt_compat, | 130 | .dt_compat = sun7i_board_dt_compat, |
131 | .restart = sun4i_restart, | ||
55 | MACHINE_END | 132 | MACHINE_END |
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index e16999e5b735..095399618ca5 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig | |||
@@ -1,6 +1,5 @@ | |||
1 | config ARCH_TEGRA | 1 | menuconfig ARCH_TEGRA |
2 | bool "NVIDIA Tegra" if ARCH_MULTI_V7 | 2 | bool "NVIDIA Tegra" if ARCH_MULTI_V7 |
3 | select ARCH_HAS_CPUFREQ | ||
4 | select ARCH_REQUIRE_GPIOLIB | 3 | select ARCH_REQUIRE_GPIOLIB |
5 | select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS | 4 | select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS |
6 | select ARM_GIC | 5 | select ARM_GIC |
@@ -16,8 +15,7 @@ config ARCH_TEGRA | |||
16 | help | 15 | help |
17 | This enables support for NVIDIA Tegra based systems. | 16 | This enables support for NVIDIA Tegra based systems. |
18 | 17 | ||
19 | menu "NVIDIA Tegra options" | 18 | if ARCH_TEGRA |
20 | depends on ARCH_TEGRA | ||
21 | 19 | ||
22 | config ARCH_TEGRA_2x_SOC | 20 | config ARCH_TEGRA_2x_SOC |
23 | bool "Enable support for Tegra20 family" | 21 | bool "Enable support for Tegra20 family" |
@@ -69,4 +67,4 @@ config TEGRA_AHB | |||
69 | which controls AHB bus master arbitration and some | 67 | which controls AHB bus master arbitration and some |
70 | performance parameters(priority, prefech size). | 68 | performance parameters(priority, prefech size). |
71 | 69 | ||
72 | endmenu | 70 | endif |
diff --git a/arch/arm/mach-u300/Kconfig b/arch/arm/mach-u300/Kconfig index e3a96d7302e9..bc51a71394af 100644 --- a/arch/arm/mach-u300/Kconfig +++ b/arch/arm/mach-u300/Kconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | config ARCH_U300 | 1 | menuconfig ARCH_U300 |
2 | bool "ST-Ericsson U300 Series" if ARCH_MULTI_V5 | 2 | bool "ST-Ericsson U300 Series" if ARCH_MULTI_V5 |
3 | depends on MMU | 3 | depends on MMU |
4 | select ARCH_REQUIRE_GPIOLIB | 4 | select ARCH_REQUIRE_GPIOLIB |
@@ -16,8 +16,6 @@ config ARCH_U300 | |||
16 | 16 | ||
17 | if ARCH_U300 | 17 | if ARCH_U300 |
18 | 18 | ||
19 | menu "ST-Ericsson AB U300/U335 Platform" | ||
20 | |||
21 | config MACH_U300 | 19 | config MACH_U300 |
22 | depends on ARCH_U300 | 20 | depends on ARCH_U300 |
23 | bool "U300" | 21 | bool "U300" |
@@ -43,6 +41,4 @@ config MACH_U300_SPIDUMMY | |||
43 | you don't need it. Selecting this will activate the | 41 | you don't need it. Selecting this will activate the |
44 | SPI framework and ARM PL022 support. | 42 | SPI framework and ARM PL022 support. |
45 | 43 | ||
46 | endmenu | ||
47 | |||
48 | endif | 44 | endif |
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig index b41a42da1505..699e8601dbf0 100644 --- a/arch/arm/mach-ux500/Kconfig +++ b/arch/arm/mach-ux500/Kconfig | |||
@@ -1,9 +1,8 @@ | |||
1 | config ARCH_U8500 | 1 | menuconfig ARCH_U8500 |
2 | bool "ST-Ericsson U8500 Series" if ARCH_MULTI_V7 | 2 | bool "ST-Ericsson U8500 Series" if ARCH_MULTI_V7 |
3 | depends on MMU | 3 | depends on MMU |
4 | select AB8500_CORE | 4 | select AB8500_CORE |
5 | select ABX500_CORE | 5 | select ABX500_CORE |
6 | select ARCH_HAS_CPUFREQ | ||
7 | select ARCH_REQUIRE_GPIOLIB | 6 | select ARCH_REQUIRE_GPIOLIB |
8 | select ARM_AMBA | 7 | select ARM_AMBA |
9 | select ARM_ERRATA_754322 | 8 | select ARM_ERRATA_754322 |
@@ -16,7 +15,7 @@ config ARCH_U8500 | |||
16 | select PINCTRL | 15 | select PINCTRL |
17 | select PINCTRL_ABX500 | 16 | select PINCTRL_ABX500 |
18 | select PINCTRL_NOMADIK | 17 | select PINCTRL_NOMADIK |
19 | select PL310_ERRATA_753970 if CACHE_PL310 | 18 | select PL310_ERRATA_753970 if CACHE_L2X0 |
20 | help | 19 | help |
21 | Support for ST-Ericsson's Ux500 architecture | 20 | Support for ST-Ericsson's Ux500 architecture |
22 | 21 | ||
@@ -34,8 +33,6 @@ config UX500_SOC_DB8500 | |||
34 | select REGULATOR | 33 | select REGULATOR |
35 | select REGULATOR_DB8500_PRCMU | 34 | select REGULATOR_DB8500_PRCMU |
36 | 35 | ||
37 | menu "Ux500 target platform (boards)" | ||
38 | |||
39 | config MACH_MOP500 | 36 | config MACH_MOP500 |
40 | bool "U8500 Development platform, MOP500 versions" | 37 | bool "U8500 Development platform, MOP500 versions" |
41 | select I2C | 38 | select I2C |
@@ -68,8 +65,6 @@ config UX500_AUTO_PLATFORM | |||
68 | a working kernel. If everything else is disabled, this | 65 | a working kernel. If everything else is disabled, this |
69 | automatically enables MACH_MOP500. | 66 | automatically enables MACH_MOP500. |
70 | 67 | ||
71 | endmenu | ||
72 | |||
73 | config UX500_DEBUG_UART | 68 | config UX500_DEBUG_UART |
74 | int "Ux500 UART to use for low-level debug" | 69 | int "Ux500 UART to use for low-level debug" |
75 | default 2 | 70 | default 2 |
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig index 90249cfc37b3..d8b9330f896a 100644 --- a/arch/arm/mach-vexpress/Kconfig +++ b/arch/arm/mach-vexpress/Kconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | config ARCH_VEXPRESS | 1 | menuconfig ARCH_VEXPRESS |
2 | bool "ARM Ltd. Versatile Express family" if ARCH_MULTI_V7 | 2 | bool "ARM Ltd. Versatile Express family" if ARCH_MULTI_V7 |
3 | select ARCH_REQUIRE_GPIOLIB | 3 | select ARCH_REQUIRE_GPIOLIB |
4 | select ARCH_SUPPORTS_BIG_ENDIAN | 4 | select ARCH_SUPPORTS_BIG_ENDIAN |
@@ -37,14 +37,13 @@ config ARCH_VEXPRESS | |||
37 | platforms. The traditional (ATAGs) boot method is not usable on | 37 | platforms. The traditional (ATAGs) boot method is not usable on |
38 | these boards with this option. | 38 | these boards with this option. |
39 | 39 | ||
40 | menu "Versatile Express platform type" | 40 | if ARCH_VEXPRESS |
41 | depends on ARCH_VEXPRESS | ||
42 | 41 | ||
43 | config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA | 42 | config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA |
44 | bool "Enable A5 and A9 only errata work-arounds" | 43 | bool "Enable A5 and A9 only errata work-arounds" |
45 | default y | 44 | default y |
46 | select ARM_ERRATA_720789 | 45 | select ARM_ERRATA_720789 |
47 | select PL310_ERRATA_753970 if CACHE_PL310 | 46 | select PL310_ERRATA_753970 if CACHE_L2X0 |
48 | help | 47 | help |
49 | Provides common dependencies for Versatile Express platforms | 48 | Provides common dependencies for Versatile Express platforms |
50 | based on Cortex-A5 and Cortex-A9 processors. In order to | 49 | based on Cortex-A5 and Cortex-A9 processors. In order to |
@@ -65,7 +64,6 @@ config ARCH_VEXPRESS_DCSCB | |||
65 | 64 | ||
66 | config ARCH_VEXPRESS_SPC | 65 | config ARCH_VEXPRESS_SPC |
67 | bool "Versatile Express Serial Power Controller (SPC)" | 66 | bool "Versatile Express Serial Power Controller (SPC)" |
68 | select ARCH_HAS_CPUFREQ | ||
69 | select ARCH_HAS_OPP | 67 | select ARCH_HAS_OPP |
70 | select PM_OPP | 68 | select PM_OPP |
71 | help | 69 | help |
@@ -83,4 +81,4 @@ config ARCH_VEXPRESS_TC2_PM | |||
83 | Support for CPU and cluster power management on Versatile Express | 81 | Support for CPU and cluster power management on Versatile Express |
84 | with a TC2 (A15x2 A7x3) big.LITTLE core tile. | 82 | with a TC2 (A15x2 A7x3) big.LITTLE core tile. |
85 | 83 | ||
86 | endmenu | 84 | endif |
diff --git a/arch/arm/mach-vt8500/Kconfig b/arch/arm/mach-vt8500/Kconfig index 08f56a41cb55..aaaa24fe4d71 100644 --- a/arch/arm/mach-vt8500/Kconfig +++ b/arch/arm/mach-vt8500/Kconfig | |||
@@ -1,6 +1,5 @@ | |||
1 | config ARCH_VT8500 | 1 | config ARCH_VT8500 |
2 | bool | 2 | bool |
3 | select ARCH_HAS_CPUFREQ | ||
4 | select ARCH_REQUIRE_GPIOLIB | 3 | select ARCH_REQUIRE_GPIOLIB |
5 | select CLKDEV_LOOKUP | 4 | select CLKDEV_LOOKUP |
6 | select VT8500_TIMER | 5 | select VT8500_TIMER |
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig index 573e0db1d0f0..0c164f81e72d 100644 --- a/arch/arm/mach-zynq/Kconfig +++ b/arch/arm/mach-zynq/Kconfig | |||
@@ -1,6 +1,5 @@ | |||
1 | config ARCH_ZYNQ | 1 | config ARCH_ZYNQ |
2 | bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7 | 2 | bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7 |
3 | select ARCH_HAS_CPUFREQ | ||
4 | select ARCH_HAS_OPP | 3 | select ARCH_HAS_OPP |
5 | select ARCH_SUPPORTS_BIG_ENDIAN | 4 | select ARCH_SUPPORTS_BIG_ENDIAN |
6 | select ARM_AMBA | 5 | select ARM_AMBA |
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index eda0dd0ab97b..c348eaee7ee2 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -889,9 +889,10 @@ config CACHE_L2X0 | |||
889 | help | 889 | help |
890 | This option enables the L2x0 PrimeCell. | 890 | This option enables the L2x0 PrimeCell. |
891 | 891 | ||
892 | if CACHE_L2X0 | ||
893 | |||
892 | config CACHE_PL310 | 894 | config CACHE_PL310 |
893 | bool | 895 | bool |
894 | depends on CACHE_L2X0 | ||
895 | default y if CPU_V7 && !(CPU_V6 || CPU_V6K) | 896 | default y if CPU_V7 && !(CPU_V6 || CPU_V6K) |
896 | help | 897 | help |
897 | This option enables optimisations for the PL310 cache | 898 | This option enables optimisations for the PL310 cache |
@@ -899,7 +900,6 @@ config CACHE_PL310 | |||
899 | 900 | ||
900 | config PL310_ERRATA_588369 | 901 | config PL310_ERRATA_588369 |
901 | bool "PL310 errata: Clean & Invalidate maintenance operations do not invalidate clean lines" | 902 | bool "PL310 errata: Clean & Invalidate maintenance operations do not invalidate clean lines" |
902 | depends on CACHE_L2X0 | ||
903 | help | 903 | help |
904 | The PL310 L2 cache controller implements three types of Clean & | 904 | The PL310 L2 cache controller implements three types of Clean & |
905 | Invalidate maintenance operations: by Physical Address | 905 | Invalidate maintenance operations: by Physical Address |
@@ -912,7 +912,6 @@ config PL310_ERRATA_588369 | |||
912 | 912 | ||
913 | config PL310_ERRATA_727915 | 913 | config PL310_ERRATA_727915 |
914 | bool "PL310 errata: Background Clean & Invalidate by Way operation can cause data corruption" | 914 | bool "PL310 errata: Background Clean & Invalidate by Way operation can cause data corruption" |
915 | depends on CACHE_L2X0 | ||
916 | help | 915 | help |
917 | PL310 implements the Clean & Invalidate by Way L2 cache maintenance | 916 | PL310 implements the Clean & Invalidate by Way L2 cache maintenance |
918 | operation (offset 0x7FC). This operation runs in background so that | 917 | operation (offset 0x7FC). This operation runs in background so that |
@@ -923,7 +922,6 @@ config PL310_ERRATA_727915 | |||
923 | 922 | ||
924 | config PL310_ERRATA_753970 | 923 | config PL310_ERRATA_753970 |
925 | bool "PL310 errata: cache sync operation may be faulty" | 924 | bool "PL310 errata: cache sync operation may be faulty" |
926 | depends on CACHE_PL310 | ||
927 | help | 925 | help |
928 | This option enables the workaround for the 753970 PL310 (r3p0) erratum. | 926 | This option enables the workaround for the 753970 PL310 (r3p0) erratum. |
929 | 927 | ||
@@ -938,7 +936,6 @@ config PL310_ERRATA_753970 | |||
938 | 936 | ||
939 | config PL310_ERRATA_769419 | 937 | config PL310_ERRATA_769419 |
940 | bool "PL310 errata: no automatic Store Buffer drain" | 938 | bool "PL310 errata: no automatic Store Buffer drain" |
941 | depends on CACHE_L2X0 | ||
942 | help | 939 | help |
943 | On revisions of the PL310 prior to r3p2, the Store Buffer does | 940 | On revisions of the PL310 prior to r3p2, the Store Buffer does |
944 | not automatically drain. This can cause normal, non-cacheable | 941 | not automatically drain. This can cause normal, non-cacheable |
@@ -948,6 +945,8 @@ config PL310_ERRATA_769419 | |||
948 | on systems with an outer cache, the store buffer is drained | 945 | on systems with an outer cache, the store buffer is drained |
949 | explicitly. | 946 | explicitly. |
950 | 947 | ||
948 | endif | ||
949 | |||
951 | config CACHE_TAUROS2 | 950 | config CACHE_TAUROS2 |
952 | bool "Enable the Tauros2 L2 cache controller" | 951 | bool "Enable the Tauros2 L2 cache controller" |
953 | depends on (ARCH_DOVE || ARCH_MMP || CPU_PJ4) | 952 | depends on (ARCH_DOVE || ARCH_MMP || CPU_PJ4) |
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index efc5cabf70e0..7c3fb41a462e 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
@@ -664,7 +664,7 @@ static int l2c310_cpu_enable_flz(struct notifier_block *nb, unsigned long act, v | |||
664 | 664 | ||
665 | static void __init l2c310_enable(void __iomem *base, u32 aux, unsigned num_lock) | 665 | static void __init l2c310_enable(void __iomem *base, u32 aux, unsigned num_lock) |
666 | { | 666 | { |
667 | unsigned rev = readl_relaxed(base + L2X0_CACHE_ID) & L2X0_CACHE_ID_PART_MASK; | 667 | unsigned rev = readl_relaxed(base + L2X0_CACHE_ID) & L2X0_CACHE_ID_RTL_MASK; |
668 | bool cortex_a9 = read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9; | 668 | bool cortex_a9 = read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9; |
669 | 669 | ||
670 | if (rev >= L310_CACHE_ID_RTL_R2P0) { | 670 | if (rev >= L310_CACHE_ID_RTL_R2P0) { |
@@ -1069,6 +1069,33 @@ static const struct l2c_init_data of_l2c310_data __initconst = { | |||
1069 | }; | 1069 | }; |
1070 | 1070 | ||
1071 | /* | 1071 | /* |
1072 | * This is a variant of the of_l2c310_data with .sync set to | ||
1073 | * NULL. Outer sync operations are not needed when the system is I/O | ||
1074 | * coherent, and potentially harmful in certain situations (PCIe/PL310 | ||
1075 | * deadlock on Armada 375/38x due to hardware I/O coherency). The | ||
1076 | * other operations are kept because they are infrequent (therefore do | ||
1077 | * not cause the deadlock in practice) and needed for secondary CPU | ||
1078 | * boot and other power management activities. | ||
1079 | */ | ||
1080 | static const struct l2c_init_data of_l2c310_coherent_data __initconst = { | ||
1081 | .type = "L2C-310 Coherent", | ||
1082 | .way_size_0 = SZ_8K, | ||
1083 | .num_lock = 8, | ||
1084 | .of_parse = l2c310_of_parse, | ||
1085 | .enable = l2c310_enable, | ||
1086 | .fixup = l2c310_fixup, | ||
1087 | .save = l2c310_save, | ||
1088 | .outer_cache = { | ||
1089 | .inv_range = l2c210_inv_range, | ||
1090 | .clean_range = l2c210_clean_range, | ||
1091 | .flush_range = l2c210_flush_range, | ||
1092 | .flush_all = l2c210_flush_all, | ||
1093 | .disable = l2c310_disable, | ||
1094 | .resume = l2c310_resume, | ||
1095 | }, | ||
1096 | }; | ||
1097 | |||
1098 | /* | ||
1072 | * Note that the end addresses passed to Linux primitives are | 1099 | * Note that the end addresses passed to Linux primitives are |
1073 | * noninclusive, while the hardware cache range operations use | 1100 | * noninclusive, while the hardware cache range operations use |
1074 | * inclusive start and end addresses. | 1101 | * inclusive start and end addresses. |
@@ -1487,6 +1514,10 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask) | |||
1487 | 1514 | ||
1488 | data = of_match_node(l2x0_ids, np)->data; | 1515 | data = of_match_node(l2x0_ids, np)->data; |
1489 | 1516 | ||
1517 | if (of_device_is_compatible(np, "arm,pl310-cache") && | ||
1518 | of_property_read_bool(np, "arm,io-coherent")) | ||
1519 | data = &of_l2c310_coherent_data; | ||
1520 | |||
1490 | old_aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); | 1521 | old_aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); |
1491 | if (old_aux != ((old_aux & aux_mask) | aux_val)) { | 1522 | if (old_aux != ((old_aux & aux_mask) | aux_val)) { |
1492 | pr_warn("L2C: platform modifies aux control register: 0x%08x -> 0x%08x\n", | 1523 | pr_warn("L2C: platform modifies aux control register: 0x%08x -> 0x%08x\n", |
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index da1874f9f8cf..a014dfacd5ca 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c | |||
@@ -300,6 +300,7 @@ void __init sanity_check_meminfo(void) | |||
300 | sanity_check_meminfo_mpu(); | 300 | sanity_check_meminfo_mpu(); |
301 | end = memblock_end_of_DRAM(); | 301 | end = memblock_end_of_DRAM(); |
302 | high_memory = __va(end - 1) + 1; | 302 | high_memory = __va(end - 1) + 1; |
303 | memblock_set_current_limit(end); | ||
303 | } | 304 | } |
304 | 305 | ||
305 | /* | 306 | /* |
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S index 97448c3acf38..ba0d58e1a2a2 100644 --- a/arch/arm/mm/proc-arm925.S +++ b/arch/arm/mm/proc-arm925.S | |||
@@ -502,6 +502,7 @@ __\name\()_proc_info: | |||
502 | .long \cpu_val | 502 | .long \cpu_val |
503 | .long \cpu_mask | 503 | .long \cpu_mask |
504 | .long PMD_TYPE_SECT | \ | 504 | .long PMD_TYPE_SECT | \ |
505 | PMD_SECT_CACHEABLE | \ | ||
505 | PMD_BIT4 | \ | 506 | PMD_BIT4 | \ |
506 | PMD_SECT_AP_WRITE | \ | 507 | PMD_SECT_AP_WRITE | \ |
507 | PMD_SECT_AP_READ | 508 | PMD_SECT_AP_READ |
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 243dfcb2ca0e..301b892d97d9 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -35,27 +35,15 @@ config SAMSUNG_PM | |||
35 | Base platform power management code for samsung code | 35 | Base platform power management code for samsung code |
36 | 36 | ||
37 | if PLAT_SAMSUNG | 37 | if PLAT_SAMSUNG |
38 | menu "Samsung Common options" | ||
38 | 39 | ||
39 | # boot configurations | 40 | # boot configurations |
40 | 41 | ||
41 | comment "Boot options" | 42 | comment "Boot options" |
42 | 43 | ||
43 | config S3C_BOOT_ERROR_RESET | ||
44 | bool "S3C Reboot on decompression error" | ||
45 | help | ||
46 | Say y here to use the watchdog to reset the system if the | ||
47 | kernel decompressor detects an error during decompression. | ||
48 | |||
49 | config S3C_BOOT_UART_FORCE_FIFO | ||
50 | bool "Force UART FIFO on during boot process" | ||
51 | default y | ||
52 | help | ||
53 | Say Y here to force the UART FIFOs on during the kernel | ||
54 | uncompressor | ||
55 | |||
56 | |||
57 | config S3C_LOWLEVEL_UART_PORT | 44 | config S3C_LOWLEVEL_UART_PORT |
58 | int "S3C UART to use for low-level messages" | 45 | int "S3C UART to use for low-level messages" |
46 | depends on ARCH_S3C64XX | ||
59 | default 0 | 47 | default 0 |
60 | help | 48 | help |
61 | Choice of which UART port to use for the low-level messages, | 49 | Choice of which UART port to use for the low-level messages, |
@@ -407,17 +395,16 @@ config SAMSUNG_PM_GPIO | |||
407 | Include legacy GPIO power management code for platforms not using | 395 | Include legacy GPIO power management code for platforms not using |
408 | pinctrl-samsung driver. | 396 | pinctrl-samsung driver. |
409 | 397 | ||
410 | endif | ||
411 | |||
412 | config SAMSUNG_DMADEV | 398 | config SAMSUNG_DMADEV |
413 | bool | 399 | bool "Use legacy Samsung DMA abstraction" |
414 | select ARM_AMBA | 400 | depends on CPU_S5PV210 || CPU_S5PC100 || ARCH_S5P64X0 || ARCH_S3C64XX |
415 | select DMADEVICES | 401 | select DMADEVICES |
416 | select PL330_DMA if (ARCH_EXYNOS5 || ARCH_EXYNOS4 || CPU_S5PV210 || CPU_S5PC100 || \ | 402 | default y |
417 | CPU_S5P6450 || CPU_S5P6440) | ||
418 | help | 403 | help |
419 | Use DMA device engine for PL330 DMAC. | 404 | Use DMA device engine for PL330 DMAC. |
420 | 405 | ||
406 | endif | ||
407 | |||
421 | config S5P_DEV_MFC | 408 | config S5P_DEV_MFC |
422 | bool | 409 | bool |
423 | help | 410 | help |
@@ -503,4 +490,5 @@ config DEBUG_S3C_UART | |||
503 | default "2" if DEBUG_S3C_UART2 | 490 | default "2" if DEBUG_S3C_UART2 |
504 | default "3" if DEBUG_S3C_UART3 | 491 | default "3" if DEBUG_S3C_UART3 |
505 | 492 | ||
493 | endmenu | ||
506 | endif | 494 | endif |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 7295419165e1..a474de346be6 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -1,8 +1,9 @@ | |||
1 | config ARM64 | 1 | config ARM64 |
2 | def_bool y | 2 | def_bool y |
3 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE | 3 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE |
4 | select ARCH_USE_CMPXCHG_LOCKREF | 4 | select ARCH_HAS_OPP |
5 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST | 5 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST |
6 | select ARCH_USE_CMPXCHG_LOCKREF | ||
6 | select ARCH_WANT_OPTIONAL_GPIOLIB | 7 | select ARCH_WANT_OPTIONAL_GPIOLIB |
7 | select ARCH_WANT_COMPAT_IPC_PARSE_VERSION | 8 | select ARCH_WANT_COMPAT_IPC_PARSE_VERSION |
8 | select ARCH_WANT_FRAME_POINTERS | 9 | select ARCH_WANT_FRAME_POINTERS |
diff --git a/arch/arm64/boot/dts/apm-mustang.dts b/arch/arm64/boot/dts/apm-mustang.dts index 1247ca1200b1..6541962f5d70 100644 --- a/arch/arm64/boot/dts/apm-mustang.dts +++ b/arch/arm64/boot/dts/apm-mustang.dts | |||
@@ -24,3 +24,7 @@ | |||
24 | reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */ | 24 | reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */ |
25 | }; | 25 | }; |
26 | }; | 26 | }; |
27 | |||
28 | &serial0 { | ||
29 | status = "ok"; | ||
30 | }; | ||
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi index c5f0a47a1375..40aa96ce13c4 100644 --- a/arch/arm64/boot/dts/apm-storm.dtsi +++ b/arch/arm64/boot/dts/apm-storm.dtsi | |||
@@ -273,8 +273,9 @@ | |||
273 | }; | 273 | }; |
274 | 274 | ||
275 | serial0: serial@1c020000 { | 275 | serial0: serial@1c020000 { |
276 | status = "disabled"; | ||
276 | device_type = "serial"; | 277 | device_type = "serial"; |
277 | compatible = "ns16550"; | 278 | compatible = "ns16550a"; |
278 | reg = <0 0x1c020000 0x0 0x1000>; | 279 | reg = <0 0x1c020000 0x0 0x1000>; |
279 | reg-shift = <2>; | 280 | reg-shift = <2>; |
280 | clock-frequency = <10000000>; /* Updated by bootloader */ | 281 | clock-frequency = <10000000>; /* Updated by bootloader */ |
@@ -282,6 +283,39 @@ | |||
282 | interrupts = <0x0 0x4c 0x4>; | 283 | interrupts = <0x0 0x4c 0x4>; |
283 | }; | 284 | }; |
284 | 285 | ||
286 | serial1: serial@1c021000 { | ||
287 | status = "disabled"; | ||
288 | device_type = "serial"; | ||
289 | compatible = "ns16550a"; | ||
290 | reg = <0 0x1c021000 0x0 0x1000>; | ||
291 | reg-shift = <2>; | ||
292 | clock-frequency = <10000000>; /* Updated by bootloader */ | ||
293 | interrupt-parent = <&gic>; | ||
294 | interrupts = <0x0 0x4d 0x4>; | ||
295 | }; | ||
296 | |||
297 | serial2: serial@1c022000 { | ||
298 | status = "disabled"; | ||
299 | device_type = "serial"; | ||
300 | compatible = "ns16550a"; | ||
301 | reg = <0 0x1c022000 0x0 0x1000>; | ||
302 | reg-shift = <2>; | ||
303 | clock-frequency = <10000000>; /* Updated by bootloader */ | ||
304 | interrupt-parent = <&gic>; | ||
305 | interrupts = <0x0 0x4e 0x4>; | ||
306 | }; | ||
307 | |||
308 | serial3: serial@1c023000 { | ||
309 | status = "disabled"; | ||
310 | device_type = "serial"; | ||
311 | compatible = "ns16550a"; | ||
312 | reg = <0 0x1c023000 0x0 0x1000>; | ||
313 | reg-shift = <2>; | ||
314 | clock-frequency = <10000000>; /* Updated by bootloader */ | ||
315 | interrupt-parent = <&gic>; | ||
316 | interrupts = <0x0 0x4f 0x4>; | ||
317 | }; | ||
318 | |||
285 | phy1: phy@1f21a000 { | 319 | phy1: phy@1f21a000 { |
286 | compatible = "apm,xgene-phy"; | 320 | compatible = "apm,xgene-phy"; |
287 | reg = <0x0 0x1f21a000 0x0 0x100>; | 321 | reg = <0x0 0x1f21a000 0x0 0x100>; |
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 157e1d8d9a47..3421f316f5dc 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
@@ -6,9 +6,18 @@ CONFIG_NO_HZ_IDLE=y | |||
6 | CONFIG_HIGH_RES_TIMERS=y | 6 | CONFIG_HIGH_RES_TIMERS=y |
7 | CONFIG_BSD_PROCESS_ACCT=y | 7 | CONFIG_BSD_PROCESS_ACCT=y |
8 | CONFIG_BSD_PROCESS_ACCT_V3=y | 8 | CONFIG_BSD_PROCESS_ACCT_V3=y |
9 | CONFIG_TASKSTATS=y | ||
10 | CONFIG_TASK_DELAY_ACCT=y | ||
11 | CONFIG_TASK_XACCT=y | ||
12 | CONFIG_TASK_IO_ACCOUNTING=y | ||
9 | CONFIG_IKCONFIG=y | 13 | CONFIG_IKCONFIG=y |
10 | CONFIG_IKCONFIG_PROC=y | 14 | CONFIG_IKCONFIG_PROC=y |
11 | CONFIG_LOG_BUF_SHIFT=14 | 15 | CONFIG_LOG_BUF_SHIFT=14 |
16 | CONFIG_RESOURCE_COUNTERS=y | ||
17 | CONFIG_MEMCG=y | ||
18 | CONFIG_MEMCG_SWAP=y | ||
19 | CONFIG_MEMCG_KMEM=y | ||
20 | CONFIG_CGROUP_HUGETLB=y | ||
12 | # CONFIG_UTS_NS is not set | 21 | # CONFIG_UTS_NS is not set |
13 | # CONFIG_IPC_NS is not set | 22 | # CONFIG_IPC_NS is not set |
14 | # CONFIG_PID_NS is not set | 23 | # CONFIG_PID_NS is not set |
@@ -27,6 +36,7 @@ CONFIG_ARCH_VEXPRESS=y | |||
27 | CONFIG_ARCH_XGENE=y | 36 | CONFIG_ARCH_XGENE=y |
28 | CONFIG_SMP=y | 37 | CONFIG_SMP=y |
29 | CONFIG_PREEMPT=y | 38 | CONFIG_PREEMPT=y |
39 | CONFIG_KSM=y | ||
30 | CONFIG_TRANSPARENT_HUGEPAGE=y | 40 | CONFIG_TRANSPARENT_HUGEPAGE=y |
31 | CONFIG_CMA=y | 41 | CONFIG_CMA=y |
32 | CONFIG_CMDLINE="console=ttyAMA0" | 42 | CONFIG_CMDLINE="console=ttyAMA0" |
@@ -45,6 +55,7 @@ CONFIG_IP_PNP_BOOTP=y | |||
45 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 55 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
46 | CONFIG_DEVTMPFS=y | 56 | CONFIG_DEVTMPFS=y |
47 | CONFIG_DMA_CMA=y | 57 | CONFIG_DMA_CMA=y |
58 | CONFIG_BLK_DEV_LOOP=y | ||
48 | CONFIG_VIRTIO_BLK=y | 59 | CONFIG_VIRTIO_BLK=y |
49 | # CONFIG_SCSI_PROC_FS is not set | 60 | # CONFIG_SCSI_PROC_FS is not set |
50 | CONFIG_BLK_DEV_SD=y | 61 | CONFIG_BLK_DEV_SD=y |
@@ -53,6 +64,7 @@ CONFIG_ATA=y | |||
53 | CONFIG_PATA_PLATFORM=y | 64 | CONFIG_PATA_PLATFORM=y |
54 | CONFIG_PATA_OF_PLATFORM=y | 65 | CONFIG_PATA_OF_PLATFORM=y |
55 | CONFIG_NETDEVICES=y | 66 | CONFIG_NETDEVICES=y |
67 | CONFIG_TUN=y | ||
56 | CONFIG_SMC91X=y | 68 | CONFIG_SMC91X=y |
57 | CONFIG_SMSC911X=y | 69 | CONFIG_SMSC911X=y |
58 | # CONFIG_WLAN is not set | 70 | # CONFIG_WLAN is not set |
@@ -85,6 +97,8 @@ CONFIG_EXT3_FS=y | |||
85 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 97 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
86 | # CONFIG_EXT3_FS_XATTR is not set | 98 | # CONFIG_EXT3_FS_XATTR is not set |
87 | CONFIG_EXT4_FS=y | 99 | CONFIG_EXT4_FS=y |
100 | CONFIG_FANOTIFY=y | ||
101 | CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y | ||
88 | CONFIG_FUSE_FS=y | 102 | CONFIG_FUSE_FS=y |
89 | CONFIG_CUSE=y | 103 | CONFIG_CUSE=y |
90 | CONFIG_VFAT_FS=y | 104 | CONFIG_VFAT_FS=y |
@@ -104,6 +118,7 @@ CONFIG_DEBUG_KERNEL=y | |||
104 | CONFIG_LOCKUP_DETECTOR=y | 118 | CONFIG_LOCKUP_DETECTOR=y |
105 | # CONFIG_SCHED_DEBUG is not set | 119 | # CONFIG_SCHED_DEBUG is not set |
106 | # CONFIG_FTRACE is not set | 120 | # CONFIG_FTRACE is not set |
121 | CONFIG_SECURITY=y | ||
107 | CONFIG_CRYPTO_ANSI_CPRNG=y | 122 | CONFIG_CRYPTO_ANSI_CPRNG=y |
108 | CONFIG_ARM64_CRYPTO=y | 123 | CONFIG_ARM64_CRYPTO=y |
109 | CONFIG_CRYPTO_SHA1_ARM64_CE=y | 124 | CONFIG_CRYPTO_SHA1_ARM64_CE=y |
diff --git a/arch/arm64/crypto/ghash-ce-core.S b/arch/arm64/crypto/ghash-ce-core.S index b9e6eaf41c9b..dc457015884e 100644 --- a/arch/arm64/crypto/ghash-ce-core.S +++ b/arch/arm64/crypto/ghash-ce-core.S | |||
@@ -3,14 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org> | 4 | * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org> |
5 | * | 5 | * |
6 | * Based on arch/x86/crypto/ghash-pmullni-intel_asm.S | ||
7 | * | ||
8 | * Copyright (c) 2009 Intel Corp. | ||
9 | * Author: Huang Ying <ying.huang@intel.com> | ||
10 | * Vinodh Gopal | ||
11 | * Erdinc Ozturk | ||
12 | * Deniz Karakoyunlu | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
15 | * under the terms of the GNU General Public License version 2 as published | 7 | * under the terms of the GNU General Public License version 2 as published |
16 | * by the Free Software Foundation. | 8 | * by the Free Software Foundation. |
@@ -19,13 +11,15 @@ | |||
19 | #include <linux/linkage.h> | 11 | #include <linux/linkage.h> |
20 | #include <asm/assembler.h> | 12 | #include <asm/assembler.h> |
21 | 13 | ||
22 | DATA .req v0 | 14 | SHASH .req v0 |
23 | SHASH .req v1 | 15 | SHASH2 .req v1 |
24 | IN1 .req v2 | ||
25 | T1 .req v2 | 16 | T1 .req v2 |
26 | T2 .req v3 | 17 | T2 .req v3 |
27 | T3 .req v4 | 18 | MASK .req v4 |
28 | VZR .req v5 | 19 | XL .req v5 |
20 | XM .req v6 | ||
21 | XH .req v7 | ||
22 | IN1 .req v7 | ||
29 | 23 | ||
30 | .text | 24 | .text |
31 | .arch armv8-a+crypto | 25 | .arch armv8-a+crypto |
@@ -35,61 +29,51 @@ | |||
35 | * struct ghash_key const *k, const char *head) | 29 | * struct ghash_key const *k, const char *head) |
36 | */ | 30 | */ |
37 | ENTRY(pmull_ghash_update) | 31 | ENTRY(pmull_ghash_update) |
38 | ld1 {DATA.16b}, [x1] | ||
39 | ld1 {SHASH.16b}, [x3] | 32 | ld1 {SHASH.16b}, [x3] |
40 | eor VZR.16b, VZR.16b, VZR.16b | 33 | ld1 {XL.16b}, [x1] |
34 | movi MASK.16b, #0xe1 | ||
35 | ext SHASH2.16b, SHASH.16b, SHASH.16b, #8 | ||
36 | shl MASK.2d, MASK.2d, #57 | ||
37 | eor SHASH2.16b, SHASH2.16b, SHASH.16b | ||
41 | 38 | ||
42 | /* do the head block first, if supplied */ | 39 | /* do the head block first, if supplied */ |
43 | cbz x4, 0f | 40 | cbz x4, 0f |
44 | ld1 {IN1.2d}, [x4] | 41 | ld1 {T1.2d}, [x4] |
45 | b 1f | 42 | b 1f |
46 | 43 | ||
47 | 0: ld1 {IN1.2d}, [x2], #16 | 44 | 0: ld1 {T1.2d}, [x2], #16 |
48 | sub w0, w0, #1 | 45 | sub w0, w0, #1 |
49 | 1: ext IN1.16b, IN1.16b, IN1.16b, #8 | ||
50 | CPU_LE( rev64 IN1.16b, IN1.16b ) | ||
51 | eor DATA.16b, DATA.16b, IN1.16b | ||
52 | 46 | ||
53 | /* multiply DATA by SHASH in GF(2^128) */ | 47 | 1: /* multiply XL by SHASH in GF(2^128) */ |
54 | ext T2.16b, DATA.16b, DATA.16b, #8 | 48 | CPU_LE( rev64 T1.16b, T1.16b ) |
55 | ext T3.16b, SHASH.16b, SHASH.16b, #8 | ||
56 | eor T2.16b, T2.16b, DATA.16b | ||
57 | eor T3.16b, T3.16b, SHASH.16b | ||
58 | 49 | ||
59 | pmull2 T1.1q, SHASH.2d, DATA.2d // a1 * b1 | 50 | ext T2.16b, XL.16b, XL.16b, #8 |
60 | pmull DATA.1q, SHASH.1d, DATA.1d // a0 * b0 | 51 | ext IN1.16b, T1.16b, T1.16b, #8 |
61 | pmull T2.1q, T2.1d, T3.1d // (a1 + a0)(b1 + b0) | 52 | eor T1.16b, T1.16b, T2.16b |
62 | eor T2.16b, T2.16b, T1.16b // (a0 * b1) + (a1 * b0) | 53 | eor XL.16b, XL.16b, IN1.16b |
63 | eor T2.16b, T2.16b, DATA.16b | ||
64 | 54 | ||
65 | ext T3.16b, VZR.16b, T2.16b, #8 | 55 | pmull2 XH.1q, SHASH.2d, XL.2d // a1 * b1 |
66 | ext T2.16b, T2.16b, VZR.16b, #8 | 56 | eor T1.16b, T1.16b, XL.16b |
67 | eor DATA.16b, DATA.16b, T3.16b | 57 | pmull XL.1q, SHASH.1d, XL.1d // a0 * b0 |
68 | eor T1.16b, T1.16b, T2.16b // <T1:DATA> is result of | 58 | pmull XM.1q, SHASH2.1d, T1.1d // (a1 + a0)(b1 + b0) |
69 | // carry-less multiplication | ||
70 | 59 | ||
71 | /* first phase of the reduction */ | 60 | ext T1.16b, XL.16b, XH.16b, #8 |
72 | shl T3.2d, DATA.2d, #1 | 61 | eor T2.16b, XL.16b, XH.16b |
73 | eor T3.16b, T3.16b, DATA.16b | 62 | eor XM.16b, XM.16b, T1.16b |
74 | shl T3.2d, T3.2d, #5 | 63 | eor XM.16b, XM.16b, T2.16b |
75 | eor T3.16b, T3.16b, DATA.16b | 64 | pmull T2.1q, XL.1d, MASK.1d |
76 | shl T3.2d, T3.2d, #57 | ||
77 | ext T2.16b, VZR.16b, T3.16b, #8 | ||
78 | ext T3.16b, T3.16b, VZR.16b, #8 | ||
79 | eor DATA.16b, DATA.16b, T2.16b | ||
80 | eor T1.16b, T1.16b, T3.16b | ||
81 | 65 | ||
82 | /* second phase of the reduction */ | 66 | mov XH.d[0], XM.d[1] |
83 | ushr T2.2d, DATA.2d, #5 | 67 | mov XM.d[1], XL.d[0] |
84 | eor T2.16b, T2.16b, DATA.16b | 68 | |
85 | ushr T2.2d, T2.2d, #1 | 69 | eor XL.16b, XM.16b, T2.16b |
86 | eor T2.16b, T2.16b, DATA.16b | 70 | ext T2.16b, XL.16b, XL.16b, #8 |
87 | ushr T2.2d, T2.2d, #1 | 71 | pmull XL.1q, XL.1d, MASK.1d |
88 | eor T1.16b, T1.16b, T2.16b | 72 | eor T2.16b, T2.16b, XH.16b |
89 | eor DATA.16b, DATA.16b, T1.16b | 73 | eor XL.16b, XL.16b, T2.16b |
90 | 74 | ||
91 | cbnz w0, 0b | 75 | cbnz w0, 0b |
92 | 76 | ||
93 | st1 {DATA.16b}, [x1] | 77 | st1 {XL.16b}, [x1] |
94 | ret | 78 | ret |
95 | ENDPROC(pmull_ghash_update) | 79 | ENDPROC(pmull_ghash_update) |
diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c index b92baf3f68c7..833ec1e3f3e9 100644 --- a/arch/arm64/crypto/ghash-ce-glue.c +++ b/arch/arm64/crypto/ghash-ce-glue.c | |||
@@ -67,11 +67,12 @@ static int ghash_update(struct shash_desc *desc, const u8 *src, | |||
67 | blocks = len / GHASH_BLOCK_SIZE; | 67 | blocks = len / GHASH_BLOCK_SIZE; |
68 | len %= GHASH_BLOCK_SIZE; | 68 | len %= GHASH_BLOCK_SIZE; |
69 | 69 | ||
70 | kernel_neon_begin_partial(6); | 70 | kernel_neon_begin_partial(8); |
71 | pmull_ghash_update(blocks, ctx->digest, src, key, | 71 | pmull_ghash_update(blocks, ctx->digest, src, key, |
72 | partial ? ctx->buf : NULL); | 72 | partial ? ctx->buf : NULL); |
73 | kernel_neon_end(); | 73 | kernel_neon_end(); |
74 | src += blocks * GHASH_BLOCK_SIZE; | 74 | src += blocks * GHASH_BLOCK_SIZE; |
75 | partial = 0; | ||
75 | } | 76 | } |
76 | if (len) | 77 | if (len) |
77 | memcpy(ctx->buf + partial, src, len); | 78 | memcpy(ctx->buf + partial, src, len); |
@@ -88,7 +89,7 @@ static int ghash_final(struct shash_desc *desc, u8 *dst) | |||
88 | 89 | ||
89 | memset(ctx->buf + partial, 0, GHASH_BLOCK_SIZE - partial); | 90 | memset(ctx->buf + partial, 0, GHASH_BLOCK_SIZE - partial); |
90 | 91 | ||
91 | kernel_neon_begin_partial(6); | 92 | kernel_neon_begin_partial(8); |
92 | pmull_ghash_update(1, ctx->digest, ctx->buf, key, NULL); | 93 | pmull_ghash_update(1, ctx->digest, ctx->buf, key, NULL); |
93 | kernel_neon_end(); | 94 | kernel_neon_end(); |
94 | } | 95 | } |
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild index 42c7eecd2bb6..0b3fcf86e6ba 100644 --- a/arch/arm64/include/asm/Kbuild +++ b/arch/arm64/include/asm/Kbuild | |||
@@ -30,7 +30,6 @@ generic-y += msgbuf.h | |||
30 | generic-y += mutex.h | 30 | generic-y += mutex.h |
31 | generic-y += pci.h | 31 | generic-y += pci.h |
32 | generic-y += poll.h | 32 | generic-y += poll.h |
33 | generic-y += posix_types.h | ||
34 | generic-y += preempt.h | 33 | generic-y += preempt.h |
35 | generic-y += resource.h | 34 | generic-y += resource.h |
36 | generic-y += rwsem.h | 35 | generic-y += rwsem.h |
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index 3a4572ec3273..dc82e52acdb3 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h | |||
@@ -26,8 +26,6 @@ | |||
26 | #include <xen/xen.h> | 26 | #include <xen/xen.h> |
27 | #include <asm/xen/hypervisor.h> | 27 | #include <asm/xen/hypervisor.h> |
28 | 28 | ||
29 | #define ARCH_HAS_DMA_GET_REQUIRED_MASK | ||
30 | |||
31 | #define DMA_ERROR_CODE (~(dma_addr_t)0) | 29 | #define DMA_ERROR_CODE (~(dma_addr_t)0) |
32 | extern struct dma_map_ops *dma_ops; | 30 | extern struct dma_map_ops *dma_ops; |
33 | extern struct dma_map_ops coherent_swiotlb_dma_ops; | 31 | extern struct dma_map_ops coherent_swiotlb_dma_ops; |
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 993bce527b85..902eb708804a 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h | |||
@@ -56,6 +56,8 @@ | |||
56 | #define TASK_SIZE_32 UL(0x100000000) | 56 | #define TASK_SIZE_32 UL(0x100000000) |
57 | #define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ | 57 | #define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ |
58 | TASK_SIZE_32 : TASK_SIZE_64) | 58 | TASK_SIZE_32 : TASK_SIZE_64) |
59 | #define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \ | ||
60 | TASK_SIZE_32 : TASK_SIZE_64) | ||
59 | #else | 61 | #else |
60 | #define TASK_SIZE TASK_SIZE_64 | 62 | #define TASK_SIZE TASK_SIZE_64 |
61 | #endif /* CONFIG_COMPAT */ | 63 | #endif /* CONFIG_COMPAT */ |
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 598cc384fc1c..e0ccceb317d9 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h | |||
@@ -246,7 +246,7 @@ static inline pmd_t pte_pmd(pte_t pte) | |||
246 | #define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd))) | 246 | #define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd))) |
247 | #define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd))) | 247 | #define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd))) |
248 | #define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd))) | 248 | #define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd))) |
249 | #define pmd_mknotpresent(pmd) (__pmd(pmd_val(pmd) &= ~PMD_TYPE_MASK)) | 249 | #define pmd_mknotpresent(pmd) (__pmd(pmd_val(pmd) & ~PMD_TYPE_MASK)) |
250 | 250 | ||
251 | #define __HAVE_ARCH_PMD_WRITE | 251 | #define __HAVE_ARCH_PMD_WRITE |
252 | #define pmd_write(pmd) pte_write(pmd_pte(pmd)) | 252 | #define pmd_write(pmd) pte_write(pmd_pte(pmd)) |
@@ -292,7 +292,7 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | |||
292 | #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ | 292 | #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ |
293 | PMD_TYPE_SECT) | 293 | PMD_TYPE_SECT) |
294 | 294 | ||
295 | #ifdef ARM64_64K_PAGES | 295 | #ifdef CONFIG_ARM64_64K_PAGES |
296 | #define pud_sect(pud) (0) | 296 | #define pud_sect(pud) (0) |
297 | #else | 297 | #else |
298 | #define pud_sect(pud) ((pud_val(pud) & PUD_TYPE_MASK) == \ | 298 | #define pud_sect(pud) ((pud_val(pud) & PUD_TYPE_MASK) == \ |
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h index a429b5940be2..501000fadb6f 100644 --- a/arch/arm64/include/asm/ptrace.h +++ b/arch/arm64/include/asm/ptrace.h | |||
@@ -21,6 +21,10 @@ | |||
21 | 21 | ||
22 | #include <uapi/asm/ptrace.h> | 22 | #include <uapi/asm/ptrace.h> |
23 | 23 | ||
24 | /* Current Exception Level values, as contained in CurrentEL */ | ||
25 | #define CurrentEL_EL1 (1 << 2) | ||
26 | #define CurrentEL_EL2 (2 << 2) | ||
27 | |||
24 | /* AArch32-specific ptrace requests */ | 28 | /* AArch32-specific ptrace requests */ |
25 | #define COMPAT_PTRACE_GETREGS 12 | 29 | #define COMPAT_PTRACE_GETREGS 12 |
26 | #define COMPAT_PTRACE_SETREGS 13 | 30 | #define COMPAT_PTRACE_SETREGS 13 |
diff --git a/arch/arm64/include/uapi/asm/posix_types.h b/arch/arm64/include/uapi/asm/posix_types.h new file mode 100644 index 000000000000..7985ff60ca3f --- /dev/null +++ b/arch/arm64/include/uapi/asm/posix_types.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __ASM_POSIX_TYPES_H | ||
2 | #define __ASM_POSIX_TYPES_H | ||
3 | |||
4 | typedef unsigned short __kernel_old_uid_t; | ||
5 | typedef unsigned short __kernel_old_gid_t; | ||
6 | #define __kernel_old_uid_t __kernel_old_uid_t | ||
7 | |||
8 | #include <asm-generic/posix_types.h> | ||
9 | |||
10 | #endif /* __ASM_POSIX_TYPES_H */ | ||
diff --git a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h index b72cf405b3fe..ee469be1ae1d 100644 --- a/arch/arm64/include/uapi/asm/sigcontext.h +++ b/arch/arm64/include/uapi/asm/sigcontext.h | |||
@@ -58,7 +58,7 @@ struct fpsimd_context { | |||
58 | 58 | ||
59 | struct esr_context { | 59 | struct esr_context { |
60 | struct _aarch64_ctx head; | 60 | struct _aarch64_ctx head; |
61 | u64 esr; | 61 | __u64 esr; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | #endif /* _UAPI__ASM_SIGCONTEXT_H */ | 64 | #endif /* _UAPI__ASM_SIGCONTEXT_H */ |
diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S index 66716c9b9e5f..619b1dd7bcde 100644 --- a/arch/arm64/kernel/efi-entry.S +++ b/arch/arm64/kernel/efi-entry.S | |||
@@ -78,8 +78,7 @@ ENTRY(efi_stub_entry) | |||
78 | 78 | ||
79 | /* Turn off Dcache and MMU */ | 79 | /* Turn off Dcache and MMU */ |
80 | mrs x0, CurrentEL | 80 | mrs x0, CurrentEL |
81 | cmp x0, #PSR_MODE_EL2t | 81 | cmp x0, #CurrentEL_EL2 |
82 | ccmp x0, #PSR_MODE_EL2h, #0x4, ne | ||
83 | b.ne 1f | 82 | b.ne 1f |
84 | mrs x0, sctlr_el2 | 83 | mrs x0, sctlr_el2 |
85 | bic x0, x0, #1 << 0 // clear SCTLR.M | 84 | bic x0, x0, #1 << 0 // clear SCTLR.M |
diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S index b051871f2965..aa5f9fcbf9ee 100644 --- a/arch/arm64/kernel/entry-ftrace.S +++ b/arch/arm64/kernel/entry-ftrace.S | |||
@@ -205,7 +205,7 @@ ENDPROC(ftrace_graph_caller) | |||
205 | * | 205 | * |
206 | * Run ftrace_return_to_handler() before going back to parent. | 206 | * Run ftrace_return_to_handler() before going back to parent. |
207 | * @fp is checked against the value passed by ftrace_graph_caller() | 207 | * @fp is checked against the value passed by ftrace_graph_caller() |
208 | * only when CONFIG_FUNCTION_GRAPH_FP_TEST is enabled. | 208 | * only when CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST is enabled. |
209 | */ | 209 | */ |
210 | ENTRY(return_to_handler) | 210 | ENTRY(return_to_handler) |
211 | str x0, [sp, #-16]! | 211 | str x0, [sp, #-16]! |
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index bf017f4ffb4f..9ce04ba6bcb0 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S | |||
@@ -279,7 +279,6 @@ el1_sp_pc: | |||
279 | */ | 279 | */ |
280 | mrs x0, far_el1 | 280 | mrs x0, far_el1 |
281 | enable_dbg | 281 | enable_dbg |
282 | mov x1, x25 | ||
283 | mov x2, sp | 282 | mov x2, sp |
284 | b do_sp_pc_abort | 283 | b do_sp_pc_abort |
285 | el1_undef: | 284 | el1_undef: |
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index a96d3a6a63f6..a2c1195abb7f 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S | |||
@@ -270,8 +270,7 @@ ENDPROC(stext) | |||
270 | */ | 270 | */ |
271 | ENTRY(el2_setup) | 271 | ENTRY(el2_setup) |
272 | mrs x0, CurrentEL | 272 | mrs x0, CurrentEL |
273 | cmp x0, #PSR_MODE_EL2t | 273 | cmp x0, #CurrentEL_EL2 |
274 | ccmp x0, #PSR_MODE_EL2h, #0x4, ne | ||
275 | b.ne 1f | 274 | b.ne 1f |
276 | mrs x0, sctlr_el2 | 275 | mrs x0, sctlr_el2 |
277 | CPU_BE( orr x0, x0, #(1 << 25) ) // Set the EE bit for EL2 | 276 | CPU_BE( orr x0, x0, #(1 << 25) ) // Set the EE bit for EL2 |
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 3e926b9c0641..9fde010c945f 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c | |||
@@ -655,11 +655,16 @@ static int compat_gpr_get(struct task_struct *target, | |||
655 | reg = task_pt_regs(target)->regs[idx]; | 655 | reg = task_pt_regs(target)->regs[idx]; |
656 | } | 656 | } |
657 | 657 | ||
658 | ret = copy_to_user(ubuf, ®, sizeof(reg)); | 658 | if (kbuf) { |
659 | if (ret) | 659 | memcpy(kbuf, ®, sizeof(reg)); |
660 | break; | 660 | kbuf += sizeof(reg); |
661 | 661 | } else { | |
662 | ubuf += sizeof(reg); | 662 | ret = copy_to_user(ubuf, ®, sizeof(reg)); |
663 | if (ret) | ||
664 | break; | ||
665 | |||
666 | ubuf += sizeof(reg); | ||
667 | } | ||
663 | } | 668 | } |
664 | 669 | ||
665 | return ret; | 670 | return ret; |
@@ -689,11 +694,16 @@ static int compat_gpr_set(struct task_struct *target, | |||
689 | unsigned int idx = start + i; | 694 | unsigned int idx = start + i; |
690 | compat_ulong_t reg; | 695 | compat_ulong_t reg; |
691 | 696 | ||
692 | ret = copy_from_user(®, ubuf, sizeof(reg)); | 697 | if (kbuf) { |
693 | if (ret) | 698 | memcpy(®, kbuf, sizeof(reg)); |
694 | return ret; | 699 | kbuf += sizeof(reg); |
700 | } else { | ||
701 | ret = copy_from_user(®, ubuf, sizeof(reg)); | ||
702 | if (ret) | ||
703 | return ret; | ||
695 | 704 | ||
696 | ubuf += sizeof(reg); | 705 | ubuf += sizeof(reg); |
706 | } | ||
697 | 707 | ||
698 | switch (idx) { | 708 | switch (idx) { |
699 | case 15: | 709 | case 15: |
@@ -827,6 +837,7 @@ static int compat_ptrace_write_user(struct task_struct *tsk, compat_ulong_t off, | |||
827 | compat_ulong_t val) | 837 | compat_ulong_t val) |
828 | { | 838 | { |
829 | int ret; | 839 | int ret; |
840 | mm_segment_t old_fs = get_fs(); | ||
830 | 841 | ||
831 | if (off & 3 || off >= COMPAT_USER_SZ) | 842 | if (off & 3 || off >= COMPAT_USER_SZ) |
832 | return -EIO; | 843 | return -EIO; |
@@ -834,10 +845,13 @@ static int compat_ptrace_write_user(struct task_struct *tsk, compat_ulong_t off, | |||
834 | if (off >= sizeof(compat_elf_gregset_t)) | 845 | if (off >= sizeof(compat_elf_gregset_t)) |
835 | return 0; | 846 | return 0; |
836 | 847 | ||
848 | set_fs(KERNEL_DS); | ||
837 | ret = copy_regset_from_user(tsk, &user_aarch32_view, | 849 | ret = copy_regset_from_user(tsk, &user_aarch32_view, |
838 | REGSET_COMPAT_GPR, off, | 850 | REGSET_COMPAT_GPR, off, |
839 | sizeof(compat_ulong_t), | 851 | sizeof(compat_ulong_t), |
840 | &val); | 852 | &val); |
853 | set_fs(old_fs); | ||
854 | |||
841 | return ret; | 855 | return ret; |
842 | } | 856 | } |
843 | 857 | ||
diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c index 9aecbace4128..13bbc3be6f5a 100644 --- a/arch/arm64/mm/copypage.c +++ b/arch/arm64/mm/copypage.c | |||
@@ -27,8 +27,10 @@ void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr) | |||
27 | copy_page(kto, kfrom); | 27 | copy_page(kto, kfrom); |
28 | __flush_dcache_area(kto, PAGE_SIZE); | 28 | __flush_dcache_area(kto, PAGE_SIZE); |
29 | } | 29 | } |
30 | EXPORT_SYMBOL_GPL(__cpu_copy_user_page); | ||
30 | 31 | ||
31 | void __cpu_clear_user_page(void *kaddr, unsigned long vaddr) | 32 | void __cpu_clear_user_page(void *kaddr, unsigned long vaddr) |
32 | { | 33 | { |
33 | clear_page(kaddr); | 34 | clear_page(kaddr); |
34 | } | 35 | } |
36 | EXPORT_SYMBOL_GPL(__cpu_clear_user_page); | ||
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index e4193e3adc7f..0d64089d28b5 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c | |||
@@ -79,7 +79,8 @@ void __sync_icache_dcache(pte_t pte, unsigned long addr) | |||
79 | return; | 79 | return; |
80 | 80 | ||
81 | if (!test_and_set_bit(PG_dcache_clean, &page->flags)) { | 81 | if (!test_and_set_bit(PG_dcache_clean, &page->flags)) { |
82 | __flush_dcache_area(page_address(page), PAGE_SIZE); | 82 | __flush_dcache_area(page_address(page), |
83 | PAGE_SIZE << compound_order(page)); | ||
83 | __flush_icache_all(); | 84 | __flush_icache_all(); |
84 | } else if (icache_is_aivivt()) { | 85 | } else if (icache_is_aivivt()) { |
85 | __flush_icache_all(); | 86 | __flush_icache_all(); |
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 091d428d64ac..f43db8a69262 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c | |||
@@ -71,7 +71,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) | |||
71 | /* 4GB maximum for 32-bit only capable devices */ | 71 | /* 4GB maximum for 32-bit only capable devices */ |
72 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { | 72 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { |
73 | unsigned long max_dma_phys = | 73 | unsigned long max_dma_phys = |
74 | (unsigned long)dma_to_phys(NULL, DMA_BIT_MASK(32) + 1); | 74 | (unsigned long)(dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1); |
75 | max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT)); | 75 | max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT)); |
76 | zone_size[ZONE_DMA] = max_dma - min; | 76 | zone_size[ZONE_DMA] = max_dma - min; |
77 | } | 77 | } |
@@ -126,6 +126,8 @@ static void arm64_memory_present(void) | |||
126 | 126 | ||
127 | void __init arm64_memblock_init(void) | 127 | void __init arm64_memblock_init(void) |
128 | { | 128 | { |
129 | phys_addr_t dma_phys_limit = 0; | ||
130 | |||
129 | /* Register the kernel text, kernel data and initrd with memblock */ | 131 | /* Register the kernel text, kernel data and initrd with memblock */ |
130 | memblock_reserve(__pa(_text), _end - _text); | 132 | memblock_reserve(__pa(_text), _end - _text); |
131 | #ifdef CONFIG_BLK_DEV_INITRD | 133 | #ifdef CONFIG_BLK_DEV_INITRD |
@@ -141,7 +143,11 @@ void __init arm64_memblock_init(void) | |||
141 | memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE); | 143 | memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE); |
142 | 144 | ||
143 | early_init_fdt_scan_reserved_mem(); | 145 | early_init_fdt_scan_reserved_mem(); |
144 | dma_contiguous_reserve(0); | 146 | |
147 | /* 4GB maximum for 32-bit only capable devices */ | ||
148 | if (IS_ENABLED(CONFIG_ZONE_DMA)) | ||
149 | dma_phys_limit = dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1; | ||
150 | dma_contiguous_reserve(dma_phys_limit); | ||
145 | 151 | ||
146 | memblock_allow_resize(); | 152 | memblock_allow_resize(); |
147 | memblock_dump_all(); | 153 | memblock_dump_all(); |
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index 1a871b78e570..344387a55406 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -242,7 +242,7 @@ struct ioc { | |||
242 | struct pci_dev *sac_only_dev; | 242 | struct pci_dev *sac_only_dev; |
243 | }; | 243 | }; |
244 | 244 | ||
245 | static struct ioc *ioc_list; | 245 | static struct ioc *ioc_list, *ioc_found; |
246 | static int reserve_sba_gart = 1; | 246 | static int reserve_sba_gart = 1; |
247 | 247 | ||
248 | static SBA_INLINE void sba_mark_invalid(struct ioc *, dma_addr_t, size_t); | 248 | static SBA_INLINE void sba_mark_invalid(struct ioc *, dma_addr_t, size_t); |
@@ -1809,20 +1809,13 @@ static struct ioc_iommu ioc_iommu_info[] __initdata = { | |||
1809 | { SX2000_IOC_ID, "sx2000", NULL }, | 1809 | { SX2000_IOC_ID, "sx2000", NULL }, |
1810 | }; | 1810 | }; |
1811 | 1811 | ||
1812 | static struct ioc * | 1812 | static void ioc_init(unsigned long hpa, struct ioc *ioc) |
1813 | ioc_init(unsigned long hpa, void *handle) | ||
1814 | { | 1813 | { |
1815 | struct ioc *ioc; | ||
1816 | struct ioc_iommu *info; | 1814 | struct ioc_iommu *info; |
1817 | 1815 | ||
1818 | ioc = kzalloc(sizeof(*ioc), GFP_KERNEL); | ||
1819 | if (!ioc) | ||
1820 | return NULL; | ||
1821 | |||
1822 | ioc->next = ioc_list; | 1816 | ioc->next = ioc_list; |
1823 | ioc_list = ioc; | 1817 | ioc_list = ioc; |
1824 | 1818 | ||
1825 | ioc->handle = handle; | ||
1826 | ioc->ioc_hpa = ioremap(hpa, 0x1000); | 1819 | ioc->ioc_hpa = ioremap(hpa, 0x1000); |
1827 | 1820 | ||
1828 | ioc->func_id = READ_REG(ioc->ioc_hpa + IOC_FUNC_ID); | 1821 | ioc->func_id = READ_REG(ioc->ioc_hpa + IOC_FUNC_ID); |
@@ -1863,8 +1856,6 @@ ioc_init(unsigned long hpa, void *handle) | |||
1863 | "%s %d.%d HPA 0x%lx IOVA space %dMb at 0x%lx\n", | 1856 | "%s %d.%d HPA 0x%lx IOVA space %dMb at 0x%lx\n", |
1864 | ioc->name, (ioc->rev >> 4) & 0xF, ioc->rev & 0xF, | 1857 | ioc->name, (ioc->rev >> 4) & 0xF, ioc->rev & 0xF, |
1865 | hpa, ioc->iov_size >> 20, ioc->ibase); | 1858 | hpa, ioc->iov_size >> 20, ioc->ibase); |
1866 | |||
1867 | return ioc; | ||
1868 | } | 1859 | } |
1869 | 1860 | ||
1870 | 1861 | ||
@@ -2031,22 +2022,21 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle) | |||
2031 | #endif | 2022 | #endif |
2032 | } | 2023 | } |
2033 | 2024 | ||
2034 | static int | 2025 | static void acpi_sba_ioc_add(struct ioc *ioc) |
2035 | acpi_sba_ioc_add(struct acpi_device *device, | ||
2036 | const struct acpi_device_id *not_used) | ||
2037 | { | 2026 | { |
2038 | struct ioc *ioc; | 2027 | acpi_handle handle = ioc->handle; |
2039 | acpi_status status; | 2028 | acpi_status status; |
2040 | u64 hpa, length; | 2029 | u64 hpa, length; |
2041 | struct acpi_device_info *adi; | 2030 | struct acpi_device_info *adi; |
2042 | 2031 | ||
2043 | status = hp_acpi_csr_space(device->handle, &hpa, &length); | 2032 | ioc_found = ioc->next; |
2033 | status = hp_acpi_csr_space(handle, &hpa, &length); | ||
2044 | if (ACPI_FAILURE(status)) | 2034 | if (ACPI_FAILURE(status)) |
2045 | return 1; | 2035 | goto err; |
2046 | 2036 | ||
2047 | status = acpi_get_object_info(device->handle, &adi); | 2037 | status = acpi_get_object_info(handle, &adi); |
2048 | if (ACPI_FAILURE(status)) | 2038 | if (ACPI_FAILURE(status)) |
2049 | return 1; | 2039 | goto err; |
2050 | 2040 | ||
2051 | /* | 2041 | /* |
2052 | * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI | 2042 | * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI |
@@ -2067,13 +2057,13 @@ acpi_sba_ioc_add(struct acpi_device *device, | |||
2067 | if (!iovp_shift) | 2057 | if (!iovp_shift) |
2068 | iovp_shift = 12; | 2058 | iovp_shift = 12; |
2069 | 2059 | ||
2070 | ioc = ioc_init(hpa, device->handle); | 2060 | ioc_init(hpa, ioc); |
2071 | if (!ioc) | ||
2072 | return 1; | ||
2073 | |||
2074 | /* setup NUMA node association */ | 2061 | /* setup NUMA node association */ |
2075 | sba_map_ioc_to_node(ioc, device->handle); | 2062 | sba_map_ioc_to_node(ioc, handle); |
2076 | return 0; | 2063 | return; |
2064 | |||
2065 | err: | ||
2066 | kfree(ioc); | ||
2077 | } | 2067 | } |
2078 | 2068 | ||
2079 | static const struct acpi_device_id hp_ioc_iommu_device_ids[] = { | 2069 | static const struct acpi_device_id hp_ioc_iommu_device_ids[] = { |
@@ -2081,9 +2071,26 @@ static const struct acpi_device_id hp_ioc_iommu_device_ids[] = { | |||
2081 | {"HWP0004", 0}, | 2071 | {"HWP0004", 0}, |
2082 | {"", 0}, | 2072 | {"", 0}, |
2083 | }; | 2073 | }; |
2074 | |||
2075 | static int acpi_sba_ioc_attach(struct acpi_device *device, | ||
2076 | const struct acpi_device_id *not_used) | ||
2077 | { | ||
2078 | struct ioc *ioc; | ||
2079 | |||
2080 | ioc = kzalloc(sizeof(*ioc), GFP_KERNEL); | ||
2081 | if (!ioc) | ||
2082 | return -ENOMEM; | ||
2083 | |||
2084 | ioc->next = ioc_found; | ||
2085 | ioc_found = ioc; | ||
2086 | ioc->handle = device->handle; | ||
2087 | return 1; | ||
2088 | } | ||
2089 | |||
2090 | |||
2084 | static struct acpi_scan_handler acpi_sba_ioc_handler = { | 2091 | static struct acpi_scan_handler acpi_sba_ioc_handler = { |
2085 | .ids = hp_ioc_iommu_device_ids, | 2092 | .ids = hp_ioc_iommu_device_ids, |
2086 | .attach = acpi_sba_ioc_add, | 2093 | .attach = acpi_sba_ioc_attach, |
2087 | }; | 2094 | }; |
2088 | 2095 | ||
2089 | static int __init acpi_sba_ioc_init_acpi(void) | 2096 | static int __init acpi_sba_ioc_init_acpi(void) |
@@ -2118,9 +2125,12 @@ sba_init(void) | |||
2118 | #endif | 2125 | #endif |
2119 | 2126 | ||
2120 | /* | 2127 | /* |
2121 | * ioc_list should be populated by the acpi_sba_ioc_handler's .attach() | 2128 | * ioc_found should be populated by the acpi_sba_ioc_handler's .attach() |
2122 | * routine, but that only happens if acpi_scan_init() has already run. | 2129 | * routine, but that only happens if acpi_scan_init() has already run. |
2123 | */ | 2130 | */ |
2131 | while (ioc_found) | ||
2132 | acpi_sba_ioc_add(ioc_found); | ||
2133 | |||
2124 | if (!ioc_list) { | 2134 | if (!ioc_list) { |
2125 | #ifdef CONFIG_IA64_GENERIC | 2135 | #ifdef CONFIG_IA64_GENERIC |
2126 | /* | 2136 | /* |
diff --git a/arch/ia64/include/uapi/asm/fcntl.h b/arch/ia64/include/uapi/asm/fcntl.h index 1dd275dc8f65..7b485876cad4 100644 --- a/arch/ia64/include/uapi/asm/fcntl.h +++ b/arch/ia64/include/uapi/asm/fcntl.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #define force_o_largefile() \ | 8 | #define force_o_largefile() \ |
9 | (personality(current->personality) != PER_LINUX32) | 9 | (personality(current->personality) != PER_LINUX32) |
10 | 10 | ||
11 | #include <linux/personality.h> | ||
11 | #include <asm-generic/fcntl.h> | 12 | #include <asm-generic/fcntl.h> |
12 | 13 | ||
13 | #endif /* _ASM_IA64_FCNTL_H */ | 14 | #endif /* _ASM_IA64_FCNTL_H */ |
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S index dbb118e1a4e0..a54788458ca3 100644 --- a/arch/m68k/kernel/head.S +++ b/arch/m68k/kernel/head.S | |||
@@ -921,7 +921,8 @@ L(nocon): | |||
921 | jls 1f | 921 | jls 1f |
922 | lsrl #1,%d1 | 922 | lsrl #1,%d1 |
923 | 1: | 923 | 1: |
924 | movel %d1,m68k_init_mapped_size | 924 | lea %pc@(m68k_init_mapped_size),%a0 |
925 | movel %d1,%a0@ | ||
925 | mmu_map #PAGE_OFFSET,%pc@(L(phys_kernel_start)),%d1,\ | 926 | mmu_map #PAGE_OFFSET,%pc@(L(phys_kernel_start)),%d1,\ |
926 | %pc@(m68k_supervisor_cachemode) | 927 | %pc@(m68k_supervisor_cachemode) |
927 | 928 | ||
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c index 958f1adb9d0c..3857737e3958 100644 --- a/arch/m68k/kernel/time.c +++ b/arch/m68k/kernel/time.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
14 | #include <linux/export.h> | ||
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
@@ -30,6 +31,7 @@ | |||
30 | 31 | ||
31 | 32 | ||
32 | unsigned long (*mach_random_get_entropy)(void); | 33 | unsigned long (*mach_random_get_entropy)(void); |
34 | EXPORT_SYMBOL_GPL(mach_random_get_entropy); | ||
33 | 35 | ||
34 | 36 | ||
35 | /* | 37 | /* |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 7a469acee33c..4e238e6e661c 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -269,6 +269,7 @@ config LANTIQ | |||
269 | config LASAT | 269 | config LASAT |
270 | bool "LASAT Networks platforms" | 270 | bool "LASAT Networks platforms" |
271 | select CEVT_R4K | 271 | select CEVT_R4K |
272 | select CRC32 | ||
272 | select CSRC_R4K | 273 | select CSRC_R4K |
273 | select DMA_NONCOHERENT | 274 | select DMA_NONCOHERENT |
274 | select SYS_HAS_EARLY_PRINTK | 275 | select SYS_HAS_EARLY_PRINTK |
diff --git a/arch/mips/include/asm/sigcontext.h b/arch/mips/include/asm/sigcontext.h index f54bdbe85c0d..eeeb0f48c767 100644 --- a/arch/mips/include/asm/sigcontext.h +++ b/arch/mips/include/asm/sigcontext.h | |||
@@ -32,8 +32,6 @@ struct sigcontext32 { | |||
32 | __u32 sc_lo2; | 32 | __u32 sc_lo2; |
33 | __u32 sc_hi3; | 33 | __u32 sc_hi3; |
34 | __u32 sc_lo3; | 34 | __u32 sc_lo3; |
35 | __u64 sc_msaregs[32]; /* Most significant 64 bits */ | ||
36 | __u32 sc_msa_csr; | ||
37 | }; | 35 | }; |
38 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */ | 36 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */ |
39 | #endif /* _ASM_SIGCONTEXT_H */ | 37 | #endif /* _ASM_SIGCONTEXT_H */ |
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h index f8d63b3b40b4..708c5d414905 100644 --- a/arch/mips/include/asm/uasm.h +++ b/arch/mips/include/asm/uasm.h | |||
@@ -67,6 +67,9 @@ void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c) | |||
67 | #define Ip_u2s3u1(op) \ | 67 | #define Ip_u2s3u1(op) \ |
68 | void ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c) | 68 | void ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c) |
69 | 69 | ||
70 | #define Ip_s3s1s2(op) \ | ||
71 | void ISAOPC(op)(u32 **buf, int a, int b, int c) | ||
72 | |||
70 | #define Ip_u2u1s3(op) \ | 73 | #define Ip_u2u1s3(op) \ |
71 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c) | 74 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c) |
72 | 75 | ||
@@ -147,6 +150,7 @@ Ip_u2s3u1(_scd); | |||
147 | Ip_u2s3u1(_sd); | 150 | Ip_u2s3u1(_sd); |
148 | Ip_u2u1u3(_sll); | 151 | Ip_u2u1u3(_sll); |
149 | Ip_u3u2u1(_sllv); | 152 | Ip_u3u2u1(_sllv); |
153 | Ip_s3s1s2(_slt); | ||
150 | Ip_u2u1s3(_sltiu); | 154 | Ip_u2u1s3(_sltiu); |
151 | Ip_u3u1u2(_sltu); | 155 | Ip_u3u1u2(_sltu); |
152 | Ip_u2u1u3(_sra); | 156 | Ip_u2u1u3(_sra); |
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h index 4b7160259292..4bfdb9d4c186 100644 --- a/arch/mips/include/uapi/asm/inst.h +++ b/arch/mips/include/uapi/asm/inst.h | |||
@@ -273,6 +273,7 @@ enum mm_32a_minor_op { | |||
273 | mm_and_op = 0x250, | 273 | mm_and_op = 0x250, |
274 | mm_or32_op = 0x290, | 274 | mm_or32_op = 0x290, |
275 | mm_xor32_op = 0x310, | 275 | mm_xor32_op = 0x310, |
276 | mm_slt_op = 0x350, | ||
276 | mm_sltu_op = 0x390, | 277 | mm_sltu_op = 0x390, |
277 | }; | 278 | }; |
278 | 279 | ||
diff --git a/arch/mips/include/uapi/asm/sigcontext.h b/arch/mips/include/uapi/asm/sigcontext.h index 681c17603a48..6c9906f59c6e 100644 --- a/arch/mips/include/uapi/asm/sigcontext.h +++ b/arch/mips/include/uapi/asm/sigcontext.h | |||
@@ -12,10 +12,6 @@ | |||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <asm/sgidefs.h> | 13 | #include <asm/sgidefs.h> |
14 | 14 | ||
15 | /* Bits which may be set in sc_used_math */ | ||
16 | #define USEDMATH_FP (1 << 0) | ||
17 | #define USEDMATH_MSA (1 << 1) | ||
18 | |||
19 | #if _MIPS_SIM == _MIPS_SIM_ABI32 | 15 | #if _MIPS_SIM == _MIPS_SIM_ABI32 |
20 | 16 | ||
21 | /* | 17 | /* |
@@ -41,8 +37,6 @@ struct sigcontext { | |||
41 | unsigned long sc_lo2; | 37 | unsigned long sc_lo2; |
42 | unsigned long sc_hi3; | 38 | unsigned long sc_hi3; |
43 | unsigned long sc_lo3; | 39 | unsigned long sc_lo3; |
44 | unsigned long long sc_msaregs[32]; /* Most significant 64 bits */ | ||
45 | unsigned long sc_msa_csr; | ||
46 | }; | 40 | }; |
47 | 41 | ||
48 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ | 42 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
@@ -76,8 +70,6 @@ struct sigcontext { | |||
76 | __u32 sc_used_math; | 70 | __u32 sc_used_math; |
77 | __u32 sc_dsp; | 71 | __u32 sc_dsp; |
78 | __u32 sc_reserved; | 72 | __u32 sc_reserved; |
79 | __u64 sc_msaregs[32]; | ||
80 | __u32 sc_msa_csr; | ||
81 | }; | 73 | }; |
82 | 74 | ||
83 | 75 | ||
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c index 02f075df8f2e..4bb5107511e2 100644 --- a/arch/mips/kernel/asm-offsets.c +++ b/arch/mips/kernel/asm-offsets.c | |||
@@ -293,7 +293,6 @@ void output_sc_defines(void) | |||
293 | OFFSET(SC_LO2, sigcontext, sc_lo2); | 293 | OFFSET(SC_LO2, sigcontext, sc_lo2); |
294 | OFFSET(SC_HI3, sigcontext, sc_hi3); | 294 | OFFSET(SC_HI3, sigcontext, sc_hi3); |
295 | OFFSET(SC_LO3, sigcontext, sc_lo3); | 295 | OFFSET(SC_LO3, sigcontext, sc_lo3); |
296 | OFFSET(SC_MSAREGS, sigcontext, sc_msaregs); | ||
297 | BLANK(); | 296 | BLANK(); |
298 | } | 297 | } |
299 | #endif | 298 | #endif |
@@ -308,7 +307,6 @@ void output_sc_defines(void) | |||
308 | OFFSET(SC_MDLO, sigcontext, sc_mdlo); | 307 | OFFSET(SC_MDLO, sigcontext, sc_mdlo); |
309 | OFFSET(SC_PC, sigcontext, sc_pc); | 308 | OFFSET(SC_PC, sigcontext, sc_pc); |
310 | OFFSET(SC_FPC_CSR, sigcontext, sc_fpc_csr); | 309 | OFFSET(SC_FPC_CSR, sigcontext, sc_fpc_csr); |
311 | OFFSET(SC_MSAREGS, sigcontext, sc_msaregs); | ||
312 | BLANK(); | 310 | BLANK(); |
313 | } | 311 | } |
314 | #endif | 312 | #endif |
@@ -320,7 +318,6 @@ void output_sc32_defines(void) | |||
320 | OFFSET(SC32_FPREGS, sigcontext32, sc_fpregs); | 318 | OFFSET(SC32_FPREGS, sigcontext32, sc_fpregs); |
321 | OFFSET(SC32_FPC_CSR, sigcontext32, sc_fpc_csr); | 319 | OFFSET(SC32_FPC_CSR, sigcontext32, sc_fpc_csr); |
322 | OFFSET(SC32_FPC_EIR, sigcontext32, sc_fpc_eir); | 320 | OFFSET(SC32_FPC_EIR, sigcontext32, sc_fpc_eir); |
323 | OFFSET(SC32_MSAREGS, sigcontext32, sc_msaregs); | ||
324 | BLANK(); | 321 | BLANK(); |
325 | } | 322 | } |
326 | #endif | 323 | #endif |
diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c index 4858642d543d..a734b2c2f9ea 100644 --- a/arch/mips/kernel/irq-msc01.c +++ b/arch/mips/kernel/irq-msc01.c | |||
@@ -126,7 +126,7 @@ void __init init_msc_irqs(unsigned long icubase, unsigned int irqbase, msc_irqma | |||
126 | 126 | ||
127 | board_bind_eic_interrupt = &msc_bind_eic_interrupt; | 127 | board_bind_eic_interrupt = &msc_bind_eic_interrupt; |
128 | 128 | ||
129 | for (; nirq >= 0; nirq--, imp++) { | 129 | for (; nirq > 0; nirq--, imp++) { |
130 | int n = imp->im_irq; | 130 | int n = imp->im_irq; |
131 | 131 | ||
132 | switch (imp->im_type) { | 132 | switch (imp->im_type) { |
diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c index 5aa4c6f8cf83..c4c2069d3a20 100644 --- a/arch/mips/kernel/pm-cps.c +++ b/arch/mips/kernel/pm-cps.c | |||
@@ -101,7 +101,7 @@ static void coupled_barrier(atomic_t *a, unsigned online) | |||
101 | if (!coupled_coherence) | 101 | if (!coupled_coherence) |
102 | return; | 102 | return; |
103 | 103 | ||
104 | smp_mb__before_atomic_inc(); | 104 | smp_mb__before_atomic(); |
105 | atomic_inc(a); | 105 | atomic_inc(a); |
106 | 106 | ||
107 | while (atomic_read(a) < online) | 107 | while (atomic_read(a) < online) |
@@ -158,7 +158,7 @@ int cps_pm_enter_state(enum cps_pm_state state) | |||
158 | 158 | ||
159 | /* Indicate that this CPU might not be coherent */ | 159 | /* Indicate that this CPU might not be coherent */ |
160 | cpumask_clear_cpu(cpu, &cpu_coherent_mask); | 160 | cpumask_clear_cpu(cpu, &cpu_coherent_mask); |
161 | smp_mb__after_clear_bit(); | 161 | smp_mb__after_atomic(); |
162 | 162 | ||
163 | /* Create a non-coherent mapping of the core ready_count */ | 163 | /* Create a non-coherent mapping of the core ready_count */ |
164 | core_ready_count = per_cpu(ready_count, core); | 164 | core_ready_count = per_cpu(ready_count, core); |
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S index 71814272d148..8352523568e6 100644 --- a/arch/mips/kernel/r4k_fpu.S +++ b/arch/mips/kernel/r4k_fpu.S | |||
@@ -13,7 +13,6 @@ | |||
13 | * Copyright (C) 1999, 2001 Silicon Graphics, Inc. | 13 | * Copyright (C) 1999, 2001 Silicon Graphics, Inc. |
14 | */ | 14 | */ |
15 | #include <asm/asm.h> | 15 | #include <asm/asm.h> |
16 | #include <asm/asmmacro.h> | ||
17 | #include <asm/errno.h> | 16 | #include <asm/errno.h> |
18 | #include <asm/fpregdef.h> | 17 | #include <asm/fpregdef.h> |
19 | #include <asm/mipsregs.h> | 18 | #include <asm/mipsregs.h> |
@@ -246,218 +245,6 @@ LEAF(_restore_fp_context32) | |||
246 | END(_restore_fp_context32) | 245 | END(_restore_fp_context32) |
247 | #endif | 246 | #endif |
248 | 247 | ||
249 | #ifdef CONFIG_CPU_HAS_MSA | ||
250 | |||
251 | .macro save_sc_msareg wr, off, sc, tmp | ||
252 | #ifdef CONFIG_64BIT | ||
253 | copy_u_d \tmp, \wr, 1 | ||
254 | EX sd \tmp, (\off+(\wr*8))(\sc) | ||
255 | #elif defined(CONFIG_CPU_LITTLE_ENDIAN) | ||
256 | copy_u_w \tmp, \wr, 2 | ||
257 | EX sw \tmp, (\off+(\wr*8)+0)(\sc) | ||
258 | copy_u_w \tmp, \wr, 3 | ||
259 | EX sw \tmp, (\off+(\wr*8)+4)(\sc) | ||
260 | #else /* CONFIG_CPU_BIG_ENDIAN */ | ||
261 | copy_u_w \tmp, \wr, 2 | ||
262 | EX sw \tmp, (\off+(\wr*8)+4)(\sc) | ||
263 | copy_u_w \tmp, \wr, 3 | ||
264 | EX sw \tmp, (\off+(\wr*8)+0)(\sc) | ||
265 | #endif | ||
266 | .endm | ||
267 | |||
268 | /* | ||
269 | * int _save_msa_context(struct sigcontext *sc) | ||
270 | * | ||
271 | * Save the upper 64 bits of each vector register along with the MSA_CSR | ||
272 | * register into sc. Returns zero on success, else non-zero. | ||
273 | */ | ||
274 | LEAF(_save_msa_context) | ||
275 | save_sc_msareg 0, SC_MSAREGS, a0, t0 | ||
276 | save_sc_msareg 1, SC_MSAREGS, a0, t0 | ||
277 | save_sc_msareg 2, SC_MSAREGS, a0, t0 | ||
278 | save_sc_msareg 3, SC_MSAREGS, a0, t0 | ||
279 | save_sc_msareg 4, SC_MSAREGS, a0, t0 | ||
280 | save_sc_msareg 5, SC_MSAREGS, a0, t0 | ||
281 | save_sc_msareg 6, SC_MSAREGS, a0, t0 | ||
282 | save_sc_msareg 7, SC_MSAREGS, a0, t0 | ||
283 | save_sc_msareg 8, SC_MSAREGS, a0, t0 | ||
284 | save_sc_msareg 9, SC_MSAREGS, a0, t0 | ||
285 | save_sc_msareg 10, SC_MSAREGS, a0, t0 | ||
286 | save_sc_msareg 11, SC_MSAREGS, a0, t0 | ||
287 | save_sc_msareg 12, SC_MSAREGS, a0, t0 | ||
288 | save_sc_msareg 13, SC_MSAREGS, a0, t0 | ||
289 | save_sc_msareg 14, SC_MSAREGS, a0, t0 | ||
290 | save_sc_msareg 15, SC_MSAREGS, a0, t0 | ||
291 | save_sc_msareg 16, SC_MSAREGS, a0, t0 | ||
292 | save_sc_msareg 17, SC_MSAREGS, a0, t0 | ||
293 | save_sc_msareg 18, SC_MSAREGS, a0, t0 | ||
294 | save_sc_msareg 19, SC_MSAREGS, a0, t0 | ||
295 | save_sc_msareg 20, SC_MSAREGS, a0, t0 | ||
296 | save_sc_msareg 21, SC_MSAREGS, a0, t0 | ||
297 | save_sc_msareg 22, SC_MSAREGS, a0, t0 | ||
298 | save_sc_msareg 23, SC_MSAREGS, a0, t0 | ||
299 | save_sc_msareg 24, SC_MSAREGS, a0, t0 | ||
300 | save_sc_msareg 25, SC_MSAREGS, a0, t0 | ||
301 | save_sc_msareg 26, SC_MSAREGS, a0, t0 | ||
302 | save_sc_msareg 27, SC_MSAREGS, a0, t0 | ||
303 | save_sc_msareg 28, SC_MSAREGS, a0, t0 | ||
304 | save_sc_msareg 29, SC_MSAREGS, a0, t0 | ||
305 | save_sc_msareg 30, SC_MSAREGS, a0, t0 | ||
306 | save_sc_msareg 31, SC_MSAREGS, a0, t0 | ||
307 | jr ra | ||
308 | li v0, 0 | ||
309 | END(_save_msa_context) | ||
310 | |||
311 | #ifdef CONFIG_MIPS32_COMPAT | ||
312 | |||
313 | /* | ||
314 | * int _save_msa_context32(struct sigcontext32 *sc) | ||
315 | * | ||
316 | * Save the upper 64 bits of each vector register along with the MSA_CSR | ||
317 | * register into sc. Returns zero on success, else non-zero. | ||
318 | */ | ||
319 | LEAF(_save_msa_context32) | ||
320 | save_sc_msareg 0, SC32_MSAREGS, a0, t0 | ||
321 | save_sc_msareg 1, SC32_MSAREGS, a0, t0 | ||
322 | save_sc_msareg 2, SC32_MSAREGS, a0, t0 | ||
323 | save_sc_msareg 3, SC32_MSAREGS, a0, t0 | ||
324 | save_sc_msareg 4, SC32_MSAREGS, a0, t0 | ||
325 | save_sc_msareg 5, SC32_MSAREGS, a0, t0 | ||
326 | save_sc_msareg 6, SC32_MSAREGS, a0, t0 | ||
327 | save_sc_msareg 7, SC32_MSAREGS, a0, t0 | ||
328 | save_sc_msareg 8, SC32_MSAREGS, a0, t0 | ||
329 | save_sc_msareg 9, SC32_MSAREGS, a0, t0 | ||
330 | save_sc_msareg 10, SC32_MSAREGS, a0, t0 | ||
331 | save_sc_msareg 11, SC32_MSAREGS, a0, t0 | ||
332 | save_sc_msareg 12, SC32_MSAREGS, a0, t0 | ||
333 | save_sc_msareg 13, SC32_MSAREGS, a0, t0 | ||
334 | save_sc_msareg 14, SC32_MSAREGS, a0, t0 | ||
335 | save_sc_msareg 15, SC32_MSAREGS, a0, t0 | ||
336 | save_sc_msareg 16, SC32_MSAREGS, a0, t0 | ||
337 | save_sc_msareg 17, SC32_MSAREGS, a0, t0 | ||
338 | save_sc_msareg 18, SC32_MSAREGS, a0, t0 | ||
339 | save_sc_msareg 19, SC32_MSAREGS, a0, t0 | ||
340 | save_sc_msareg 20, SC32_MSAREGS, a0, t0 | ||
341 | save_sc_msareg 21, SC32_MSAREGS, a0, t0 | ||
342 | save_sc_msareg 22, SC32_MSAREGS, a0, t0 | ||
343 | save_sc_msareg 23, SC32_MSAREGS, a0, t0 | ||
344 | save_sc_msareg 24, SC32_MSAREGS, a0, t0 | ||
345 | save_sc_msareg 25, SC32_MSAREGS, a0, t0 | ||
346 | save_sc_msareg 26, SC32_MSAREGS, a0, t0 | ||
347 | save_sc_msareg 27, SC32_MSAREGS, a0, t0 | ||
348 | save_sc_msareg 28, SC32_MSAREGS, a0, t0 | ||
349 | save_sc_msareg 29, SC32_MSAREGS, a0, t0 | ||
350 | save_sc_msareg 30, SC32_MSAREGS, a0, t0 | ||
351 | save_sc_msareg 31, SC32_MSAREGS, a0, t0 | ||
352 | jr ra | ||
353 | li v0, 0 | ||
354 | END(_save_msa_context32) | ||
355 | |||
356 | #endif /* CONFIG_MIPS32_COMPAT */ | ||
357 | |||
358 | .macro restore_sc_msareg wr, off, sc, tmp | ||
359 | #ifdef CONFIG_64BIT | ||
360 | EX ld \tmp, (\off+(\wr*8))(\sc) | ||
361 | insert_d \wr, 1, \tmp | ||
362 | #elif defined(CONFIG_CPU_LITTLE_ENDIAN) | ||
363 | EX lw \tmp, (\off+(\wr*8)+0)(\sc) | ||
364 | insert_w \wr, 2, \tmp | ||
365 | EX lw \tmp, (\off+(\wr*8)+4)(\sc) | ||
366 | insert_w \wr, 3, \tmp | ||
367 | #else /* CONFIG_CPU_BIG_ENDIAN */ | ||
368 | EX lw \tmp, (\off+(\wr*8)+4)(\sc) | ||
369 | insert_w \wr, 2, \tmp | ||
370 | EX lw \tmp, (\off+(\wr*8)+0)(\sc) | ||
371 | insert_w \wr, 3, \tmp | ||
372 | #endif | ||
373 | .endm | ||
374 | |||
375 | /* | ||
376 | * int _restore_msa_context(struct sigcontext *sc) | ||
377 | */ | ||
378 | LEAF(_restore_msa_context) | ||
379 | restore_sc_msareg 0, SC_MSAREGS, a0, t0 | ||
380 | restore_sc_msareg 1, SC_MSAREGS, a0, t0 | ||
381 | restore_sc_msareg 2, SC_MSAREGS, a0, t0 | ||
382 | restore_sc_msareg 3, SC_MSAREGS, a0, t0 | ||
383 | restore_sc_msareg 4, SC_MSAREGS, a0, t0 | ||
384 | restore_sc_msareg 5, SC_MSAREGS, a0, t0 | ||
385 | restore_sc_msareg 6, SC_MSAREGS, a0, t0 | ||
386 | restore_sc_msareg 7, SC_MSAREGS, a0, t0 | ||
387 | restore_sc_msareg 8, SC_MSAREGS, a0, t0 | ||
388 | restore_sc_msareg 9, SC_MSAREGS, a0, t0 | ||
389 | restore_sc_msareg 10, SC_MSAREGS, a0, t0 | ||
390 | restore_sc_msareg 11, SC_MSAREGS, a0, t0 | ||
391 | restore_sc_msareg 12, SC_MSAREGS, a0, t0 | ||
392 | restore_sc_msareg 13, SC_MSAREGS, a0, t0 | ||
393 | restore_sc_msareg 14, SC_MSAREGS, a0, t0 | ||
394 | restore_sc_msareg 15, SC_MSAREGS, a0, t0 | ||
395 | restore_sc_msareg 16, SC_MSAREGS, a0, t0 | ||
396 | restore_sc_msareg 17, SC_MSAREGS, a0, t0 | ||
397 | restore_sc_msareg 18, SC_MSAREGS, a0, t0 | ||
398 | restore_sc_msareg 19, SC_MSAREGS, a0, t0 | ||
399 | restore_sc_msareg 20, SC_MSAREGS, a0, t0 | ||
400 | restore_sc_msareg 21, SC_MSAREGS, a0, t0 | ||
401 | restore_sc_msareg 22, SC_MSAREGS, a0, t0 | ||
402 | restore_sc_msareg 23, SC_MSAREGS, a0, t0 | ||
403 | restore_sc_msareg 24, SC_MSAREGS, a0, t0 | ||
404 | restore_sc_msareg 25, SC_MSAREGS, a0, t0 | ||
405 | restore_sc_msareg 26, SC_MSAREGS, a0, t0 | ||
406 | restore_sc_msareg 27, SC_MSAREGS, a0, t0 | ||
407 | restore_sc_msareg 28, SC_MSAREGS, a0, t0 | ||
408 | restore_sc_msareg 29, SC_MSAREGS, a0, t0 | ||
409 | restore_sc_msareg 30, SC_MSAREGS, a0, t0 | ||
410 | restore_sc_msareg 31, SC_MSAREGS, a0, t0 | ||
411 | jr ra | ||
412 | li v0, 0 | ||
413 | END(_restore_msa_context) | ||
414 | |||
415 | #ifdef CONFIG_MIPS32_COMPAT | ||
416 | |||
417 | /* | ||
418 | * int _restore_msa_context32(struct sigcontext32 *sc) | ||
419 | */ | ||
420 | LEAF(_restore_msa_context32) | ||
421 | restore_sc_msareg 0, SC32_MSAREGS, a0, t0 | ||
422 | restore_sc_msareg 1, SC32_MSAREGS, a0, t0 | ||
423 | restore_sc_msareg 2, SC32_MSAREGS, a0, t0 | ||
424 | restore_sc_msareg 3, SC32_MSAREGS, a0, t0 | ||
425 | restore_sc_msareg 4, SC32_MSAREGS, a0, t0 | ||
426 | restore_sc_msareg 5, SC32_MSAREGS, a0, t0 | ||
427 | restore_sc_msareg 6, SC32_MSAREGS, a0, t0 | ||
428 | restore_sc_msareg 7, SC32_MSAREGS, a0, t0 | ||
429 | restore_sc_msareg 8, SC32_MSAREGS, a0, t0 | ||
430 | restore_sc_msareg 9, SC32_MSAREGS, a0, t0 | ||
431 | restore_sc_msareg 10, SC32_MSAREGS, a0, t0 | ||
432 | restore_sc_msareg 11, SC32_MSAREGS, a0, t0 | ||
433 | restore_sc_msareg 12, SC32_MSAREGS, a0, t0 | ||
434 | restore_sc_msareg 13, SC32_MSAREGS, a0, t0 | ||
435 | restore_sc_msareg 14, SC32_MSAREGS, a0, t0 | ||
436 | restore_sc_msareg 15, SC32_MSAREGS, a0, t0 | ||
437 | restore_sc_msareg 16, SC32_MSAREGS, a0, t0 | ||
438 | restore_sc_msareg 17, SC32_MSAREGS, a0, t0 | ||
439 | restore_sc_msareg 18, SC32_MSAREGS, a0, t0 | ||
440 | restore_sc_msareg 19, SC32_MSAREGS, a0, t0 | ||
441 | restore_sc_msareg 20, SC32_MSAREGS, a0, t0 | ||
442 | restore_sc_msareg 21, SC32_MSAREGS, a0, t0 | ||
443 | restore_sc_msareg 22, SC32_MSAREGS, a0, t0 | ||
444 | restore_sc_msareg 23, SC32_MSAREGS, a0, t0 | ||
445 | restore_sc_msareg 24, SC32_MSAREGS, a0, t0 | ||
446 | restore_sc_msareg 25, SC32_MSAREGS, a0, t0 | ||
447 | restore_sc_msareg 26, SC32_MSAREGS, a0, t0 | ||
448 | restore_sc_msareg 27, SC32_MSAREGS, a0, t0 | ||
449 | restore_sc_msareg 28, SC32_MSAREGS, a0, t0 | ||
450 | restore_sc_msareg 29, SC32_MSAREGS, a0, t0 | ||
451 | restore_sc_msareg 30, SC32_MSAREGS, a0, t0 | ||
452 | restore_sc_msareg 31, SC32_MSAREGS, a0, t0 | ||
453 | jr ra | ||
454 | li v0, 0 | ||
455 | END(_restore_msa_context32) | ||
456 | |||
457 | #endif /* CONFIG_MIPS32_COMPAT */ | ||
458 | |||
459 | #endif /* CONFIG_CPU_HAS_MSA */ | ||
460 | |||
461 | .set reorder | 248 | .set reorder |
462 | 249 | ||
463 | .type fault@function | 250 | .type fault@function |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 33133d3df3e5..9e60d117e41e 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/bitops.h> | 31 | #include <linux/bitops.h> |
32 | #include <asm/cacheflush.h> | 32 | #include <asm/cacheflush.h> |
33 | #include <asm/fpu.h> | 33 | #include <asm/fpu.h> |
34 | #include <asm/msa.h> | ||
35 | #include <asm/sim.h> | 34 | #include <asm/sim.h> |
36 | #include <asm/ucontext.h> | 35 | #include <asm/ucontext.h> |
37 | #include <asm/cpu-features.h> | 36 | #include <asm/cpu-features.h> |
@@ -48,9 +47,6 @@ static int (*restore_fp_context)(struct sigcontext __user *sc); | |||
48 | extern asmlinkage int _save_fp_context(struct sigcontext __user *sc); | 47 | extern asmlinkage int _save_fp_context(struct sigcontext __user *sc); |
49 | extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc); | 48 | extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc); |
50 | 49 | ||
51 | extern asmlinkage int _save_msa_context(struct sigcontext __user *sc); | ||
52 | extern asmlinkage int _restore_msa_context(struct sigcontext __user *sc); | ||
53 | |||
54 | struct sigframe { | 50 | struct sigframe { |
55 | u32 sf_ass[4]; /* argument save space for o32 */ | 51 | u32 sf_ass[4]; /* argument save space for o32 */ |
56 | u32 sf_pad[2]; /* Was: signal trampoline */ | 52 | u32 sf_pad[2]; /* Was: signal trampoline */ |
@@ -100,60 +96,20 @@ static int copy_fp_from_sigcontext(struct sigcontext __user *sc) | |||
100 | } | 96 | } |
101 | 97 | ||
102 | /* | 98 | /* |
103 | * These functions will save only the upper 64 bits of the vector registers, | ||
104 | * since the lower 64 bits have already been saved as the scalar FP context. | ||
105 | */ | ||
106 | static int copy_msa_to_sigcontext(struct sigcontext __user *sc) | ||
107 | { | ||
108 | int i; | ||
109 | int err = 0; | ||
110 | |||
111 | for (i = 0; i < NUM_FPU_REGS; i++) { | ||
112 | err |= | ||
113 | __put_user(get_fpr64(¤t->thread.fpu.fpr[i], 1), | ||
114 | &sc->sc_msaregs[i]); | ||
115 | } | ||
116 | err |= __put_user(current->thread.fpu.msacsr, &sc->sc_msa_csr); | ||
117 | |||
118 | return err; | ||
119 | } | ||
120 | |||
121 | static int copy_msa_from_sigcontext(struct sigcontext __user *sc) | ||
122 | { | ||
123 | int i; | ||
124 | int err = 0; | ||
125 | u64 val; | ||
126 | |||
127 | for (i = 0; i < NUM_FPU_REGS; i++) { | ||
128 | err |= __get_user(val, &sc->sc_msaregs[i]); | ||
129 | set_fpr64(¤t->thread.fpu.fpr[i], 1, val); | ||
130 | } | ||
131 | err |= __get_user(current->thread.fpu.msacsr, &sc->sc_msa_csr); | ||
132 | |||
133 | return err; | ||
134 | } | ||
135 | |||
136 | /* | ||
137 | * Helper routines | 99 | * Helper routines |
138 | */ | 100 | */ |
139 | static int protected_save_fp_context(struct sigcontext __user *sc, | 101 | static int protected_save_fp_context(struct sigcontext __user *sc) |
140 | unsigned used_math) | ||
141 | { | 102 | { |
142 | int err; | 103 | int err; |
143 | bool save_msa = cpu_has_msa && (used_math & USEDMATH_MSA); | ||
144 | #ifndef CONFIG_EVA | 104 | #ifndef CONFIG_EVA |
145 | while (1) { | 105 | while (1) { |
146 | lock_fpu_owner(); | 106 | lock_fpu_owner(); |
147 | if (is_fpu_owner()) { | 107 | if (is_fpu_owner()) { |
148 | err = save_fp_context(sc); | 108 | err = save_fp_context(sc); |
149 | if (save_msa && !err) | ||
150 | err = _save_msa_context(sc); | ||
151 | unlock_fpu_owner(); | 109 | unlock_fpu_owner(); |
152 | } else { | 110 | } else { |
153 | unlock_fpu_owner(); | 111 | unlock_fpu_owner(); |
154 | err = copy_fp_to_sigcontext(sc); | 112 | err = copy_fp_to_sigcontext(sc); |
155 | if (save_msa && !err) | ||
156 | err = copy_msa_to_sigcontext(sc); | ||
157 | } | 113 | } |
158 | if (likely(!err)) | 114 | if (likely(!err)) |
159 | break; | 115 | break; |
@@ -169,38 +125,24 @@ static int protected_save_fp_context(struct sigcontext __user *sc, | |||
169 | * EVA does not have FPU EVA instructions so saving fpu context directly | 125 | * EVA does not have FPU EVA instructions so saving fpu context directly |
170 | * does not work. | 126 | * does not work. |
171 | */ | 127 | */ |
172 | disable_msa(); | ||
173 | lose_fpu(1); | 128 | lose_fpu(1); |
174 | err = save_fp_context(sc); /* this might fail */ | 129 | err = save_fp_context(sc); /* this might fail */ |
175 | if (save_msa && !err) | ||
176 | err = copy_msa_to_sigcontext(sc); | ||
177 | #endif | 130 | #endif |
178 | return err; | 131 | return err; |
179 | } | 132 | } |
180 | 133 | ||
181 | static int protected_restore_fp_context(struct sigcontext __user *sc, | 134 | static int protected_restore_fp_context(struct sigcontext __user *sc) |
182 | unsigned used_math) | ||
183 | { | 135 | { |
184 | int err, tmp __maybe_unused; | 136 | int err, tmp __maybe_unused; |
185 | bool restore_msa = cpu_has_msa && (used_math & USEDMATH_MSA); | ||
186 | #ifndef CONFIG_EVA | 137 | #ifndef CONFIG_EVA |
187 | while (1) { | 138 | while (1) { |
188 | lock_fpu_owner(); | 139 | lock_fpu_owner(); |
189 | if (is_fpu_owner()) { | 140 | if (is_fpu_owner()) { |
190 | err = restore_fp_context(sc); | 141 | err = restore_fp_context(sc); |
191 | if (restore_msa && !err) { | ||
192 | enable_msa(); | ||
193 | err = _restore_msa_context(sc); | ||
194 | } else { | ||
195 | /* signal handler may have used MSA */ | ||
196 | disable_msa(); | ||
197 | } | ||
198 | unlock_fpu_owner(); | 142 | unlock_fpu_owner(); |
199 | } else { | 143 | } else { |
200 | unlock_fpu_owner(); | 144 | unlock_fpu_owner(); |
201 | err = copy_fp_from_sigcontext(sc); | 145 | err = copy_fp_from_sigcontext(sc); |
202 | if (!err && (used_math & USEDMATH_MSA)) | ||
203 | err = copy_msa_from_sigcontext(sc); | ||
204 | } | 146 | } |
205 | if (likely(!err)) | 147 | if (likely(!err)) |
206 | break; | 148 | break; |
@@ -216,11 +158,8 @@ static int protected_restore_fp_context(struct sigcontext __user *sc, | |||
216 | * EVA does not have FPU EVA instructions so restoring fpu context | 158 | * EVA does not have FPU EVA instructions so restoring fpu context |
217 | * directly does not work. | 159 | * directly does not work. |
218 | */ | 160 | */ |
219 | enable_msa(); | ||
220 | lose_fpu(0); | 161 | lose_fpu(0); |
221 | err = restore_fp_context(sc); /* this might fail */ | 162 | err = restore_fp_context(sc); /* this might fail */ |
222 | if (restore_msa && !err) | ||
223 | err = copy_msa_from_sigcontext(sc); | ||
224 | #endif | 163 | #endif |
225 | return err; | 164 | return err; |
226 | } | 165 | } |
@@ -252,8 +191,7 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
252 | err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); | 191 | err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); |
253 | } | 192 | } |
254 | 193 | ||
255 | used_math = used_math() ? USEDMATH_FP : 0; | 194 | used_math = !!used_math(); |
256 | used_math |= thread_msa_context_live() ? USEDMATH_MSA : 0; | ||
257 | err |= __put_user(used_math, &sc->sc_used_math); | 195 | err |= __put_user(used_math, &sc->sc_used_math); |
258 | 196 | ||
259 | if (used_math) { | 197 | if (used_math) { |
@@ -261,7 +199,7 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
261 | * Save FPU state to signal context. Signal handler | 199 | * Save FPU state to signal context. Signal handler |
262 | * will "inherit" current FPU state. | 200 | * will "inherit" current FPU state. |
263 | */ | 201 | */ |
264 | err |= protected_save_fp_context(sc, used_math); | 202 | err |= protected_save_fp_context(sc); |
265 | } | 203 | } |
266 | return err; | 204 | return err; |
267 | } | 205 | } |
@@ -286,14 +224,14 @@ int fpcsr_pending(unsigned int __user *fpcsr) | |||
286 | } | 224 | } |
287 | 225 | ||
288 | static int | 226 | static int |
289 | check_and_restore_fp_context(struct sigcontext __user *sc, unsigned used_math) | 227 | check_and_restore_fp_context(struct sigcontext __user *sc) |
290 | { | 228 | { |
291 | int err, sig; | 229 | int err, sig; |
292 | 230 | ||
293 | err = sig = fpcsr_pending(&sc->sc_fpc_csr); | 231 | err = sig = fpcsr_pending(&sc->sc_fpc_csr); |
294 | if (err > 0) | 232 | if (err > 0) |
295 | err = 0; | 233 | err = 0; |
296 | err |= protected_restore_fp_context(sc, used_math); | 234 | err |= protected_restore_fp_context(sc); |
297 | return err ?: sig; | 235 | return err ?: sig; |
298 | } | 236 | } |
299 | 237 | ||
@@ -333,10 +271,9 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
333 | if (used_math) { | 271 | if (used_math) { |
334 | /* restore fpu context if we have used it before */ | 272 | /* restore fpu context if we have used it before */ |
335 | if (!err) | 273 | if (!err) |
336 | err = check_and_restore_fp_context(sc, used_math); | 274 | err = check_and_restore_fp_context(sc); |
337 | } else { | 275 | } else { |
338 | /* signal handler may have used FPU or MSA. Disable them. */ | 276 | /* signal handler may have used FPU. Give it up. */ |
339 | disable_msa(); | ||
340 | lose_fpu(0); | 277 | lose_fpu(0); |
341 | } | 278 | } |
342 | 279 | ||
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index 299f956e4db3..bae2e6ee2109 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <asm/sim.h> | 30 | #include <asm/sim.h> |
31 | #include <asm/ucontext.h> | 31 | #include <asm/ucontext.h> |
32 | #include <asm/fpu.h> | 32 | #include <asm/fpu.h> |
33 | #include <asm/msa.h> | ||
34 | #include <asm/war.h> | 33 | #include <asm/war.h> |
35 | #include <asm/vdso.h> | 34 | #include <asm/vdso.h> |
36 | #include <asm/dsp.h> | 35 | #include <asm/dsp.h> |
@@ -43,9 +42,6 @@ static int (*restore_fp_context32)(struct sigcontext32 __user *sc); | |||
43 | extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc); | 42 | extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc); |
44 | extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc); | 43 | extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc); |
45 | 44 | ||
46 | extern asmlinkage int _save_msa_context32(struct sigcontext32 __user *sc); | ||
47 | extern asmlinkage int _restore_msa_context32(struct sigcontext32 __user *sc); | ||
48 | |||
49 | /* | 45 | /* |
50 | * Including <asm/unistd.h> would give use the 64-bit syscall numbers ... | 46 | * Including <asm/unistd.h> would give use the 64-bit syscall numbers ... |
51 | */ | 47 | */ |
@@ -115,59 +111,19 @@ static int copy_fp_from_sigcontext32(struct sigcontext32 __user *sc) | |||
115 | } | 111 | } |
116 | 112 | ||
117 | /* | 113 | /* |
118 | * These functions will save only the upper 64 bits of the vector registers, | ||
119 | * since the lower 64 bits have already been saved as the scalar FP context. | ||
120 | */ | ||
121 | static int copy_msa_to_sigcontext32(struct sigcontext32 __user *sc) | ||
122 | { | ||
123 | int i; | ||
124 | int err = 0; | ||
125 | |||
126 | for (i = 0; i < NUM_FPU_REGS; i++) { | ||
127 | err |= | ||
128 | __put_user(get_fpr64(¤t->thread.fpu.fpr[i], 1), | ||
129 | &sc->sc_msaregs[i]); | ||
130 | } | ||
131 | err |= __put_user(current->thread.fpu.msacsr, &sc->sc_msa_csr); | ||
132 | |||
133 | return err; | ||
134 | } | ||
135 | |||
136 | static int copy_msa_from_sigcontext32(struct sigcontext32 __user *sc) | ||
137 | { | ||
138 | int i; | ||
139 | int err = 0; | ||
140 | u64 val; | ||
141 | |||
142 | for (i = 0; i < NUM_FPU_REGS; i++) { | ||
143 | err |= __get_user(val, &sc->sc_msaregs[i]); | ||
144 | set_fpr64(¤t->thread.fpu.fpr[i], 1, val); | ||
145 | } | ||
146 | err |= __get_user(current->thread.fpu.msacsr, &sc->sc_msa_csr); | ||
147 | |||
148 | return err; | ||
149 | } | ||
150 | |||
151 | /* | ||
152 | * sigcontext handlers | 114 | * sigcontext handlers |
153 | */ | 115 | */ |
154 | static int protected_save_fp_context32(struct sigcontext32 __user *sc, | 116 | static int protected_save_fp_context32(struct sigcontext32 __user *sc) |
155 | unsigned used_math) | ||
156 | { | 117 | { |
157 | int err; | 118 | int err; |
158 | bool save_msa = cpu_has_msa && (used_math & USEDMATH_MSA); | ||
159 | while (1) { | 119 | while (1) { |
160 | lock_fpu_owner(); | 120 | lock_fpu_owner(); |
161 | if (is_fpu_owner()) { | 121 | if (is_fpu_owner()) { |
162 | err = save_fp_context32(sc); | 122 | err = save_fp_context32(sc); |
163 | if (save_msa && !err) | ||
164 | err = _save_msa_context32(sc); | ||
165 | unlock_fpu_owner(); | 123 | unlock_fpu_owner(); |
166 | } else { | 124 | } else { |
167 | unlock_fpu_owner(); | 125 | unlock_fpu_owner(); |
168 | err = copy_fp_to_sigcontext32(sc); | 126 | err = copy_fp_to_sigcontext32(sc); |
169 | if (save_msa && !err) | ||
170 | err = copy_msa_to_sigcontext32(sc); | ||
171 | } | 127 | } |
172 | if (likely(!err)) | 128 | if (likely(!err)) |
173 | break; | 129 | break; |
@@ -181,28 +137,17 @@ static int protected_save_fp_context32(struct sigcontext32 __user *sc, | |||
181 | return err; | 137 | return err; |
182 | } | 138 | } |
183 | 139 | ||
184 | static int protected_restore_fp_context32(struct sigcontext32 __user *sc, | 140 | static int protected_restore_fp_context32(struct sigcontext32 __user *sc) |
185 | unsigned used_math) | ||
186 | { | 141 | { |
187 | int err, tmp __maybe_unused; | 142 | int err, tmp __maybe_unused; |
188 | bool restore_msa = cpu_has_msa && (used_math & USEDMATH_MSA); | ||
189 | while (1) { | 143 | while (1) { |
190 | lock_fpu_owner(); | 144 | lock_fpu_owner(); |
191 | if (is_fpu_owner()) { | 145 | if (is_fpu_owner()) { |
192 | err = restore_fp_context32(sc); | 146 | err = restore_fp_context32(sc); |
193 | if (restore_msa && !err) { | ||
194 | enable_msa(); | ||
195 | err = _restore_msa_context32(sc); | ||
196 | } else { | ||
197 | /* signal handler may have used MSA */ | ||
198 | disable_msa(); | ||
199 | } | ||
200 | unlock_fpu_owner(); | 147 | unlock_fpu_owner(); |
201 | } else { | 148 | } else { |
202 | unlock_fpu_owner(); | 149 | unlock_fpu_owner(); |
203 | err = copy_fp_from_sigcontext32(sc); | 150 | err = copy_fp_from_sigcontext32(sc); |
204 | if (restore_msa && !err) | ||
205 | err = copy_msa_from_sigcontext32(sc); | ||
206 | } | 151 | } |
207 | if (likely(!err)) | 152 | if (likely(!err)) |
208 | break; | 153 | break; |
@@ -241,8 +186,7 @@ static int setup_sigcontext32(struct pt_regs *regs, | |||
241 | err |= __put_user(mflo3(), &sc->sc_lo3); | 186 | err |= __put_user(mflo3(), &sc->sc_lo3); |
242 | } | 187 | } |
243 | 188 | ||
244 | used_math = used_math() ? USEDMATH_FP : 0; | 189 | used_math = !!used_math(); |
245 | used_math |= thread_msa_context_live() ? USEDMATH_MSA : 0; | ||
246 | err |= __put_user(used_math, &sc->sc_used_math); | 190 | err |= __put_user(used_math, &sc->sc_used_math); |
247 | 191 | ||
248 | if (used_math) { | 192 | if (used_math) { |
@@ -250,21 +194,20 @@ static int setup_sigcontext32(struct pt_regs *regs, | |||
250 | * Save FPU state to signal context. Signal handler | 194 | * Save FPU state to signal context. Signal handler |
251 | * will "inherit" current FPU state. | 195 | * will "inherit" current FPU state. |
252 | */ | 196 | */ |
253 | err |= protected_save_fp_context32(sc, used_math); | 197 | err |= protected_save_fp_context32(sc); |
254 | } | 198 | } |
255 | return err; | 199 | return err; |
256 | } | 200 | } |
257 | 201 | ||
258 | static int | 202 | static int |
259 | check_and_restore_fp_context32(struct sigcontext32 __user *sc, | 203 | check_and_restore_fp_context32(struct sigcontext32 __user *sc) |
260 | unsigned used_math) | ||
261 | { | 204 | { |
262 | int err, sig; | 205 | int err, sig; |
263 | 206 | ||
264 | err = sig = fpcsr_pending(&sc->sc_fpc_csr); | 207 | err = sig = fpcsr_pending(&sc->sc_fpc_csr); |
265 | if (err > 0) | 208 | if (err > 0) |
266 | err = 0; | 209 | err = 0; |
267 | err |= protected_restore_fp_context32(sc, used_math); | 210 | err |= protected_restore_fp_context32(sc); |
268 | return err ?: sig; | 211 | return err ?: sig; |
269 | } | 212 | } |
270 | 213 | ||
@@ -301,10 +244,9 @@ static int restore_sigcontext32(struct pt_regs *regs, | |||
301 | if (used_math) { | 244 | if (used_math) { |
302 | /* restore fpu context if we have used it before */ | 245 | /* restore fpu context if we have used it before */ |
303 | if (!err) | 246 | if (!err) |
304 | err = check_and_restore_fp_context32(sc, used_math); | 247 | err = check_and_restore_fp_context32(sc); |
305 | } else { | 248 | } else { |
306 | /* signal handler may have used FPU or MSA. Disable them. */ | 249 | /* signal handler may have used FPU. Give it up. */ |
307 | disable_msa(); | ||
308 | lose_fpu(0); | 250 | lose_fpu(0); |
309 | } | 251 | } |
310 | 252 | ||
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c index df0598d9bfdd..949f2c6827a0 100644 --- a/arch/mips/kernel/smp-cps.c +++ b/arch/mips/kernel/smp-cps.c | |||
@@ -301,7 +301,7 @@ static int cps_cpu_disable(void) | |||
301 | 301 | ||
302 | core_cfg = &mips_cps_core_bootcfg[current_cpu_data.core]; | 302 | core_cfg = &mips_cps_core_bootcfg[current_cpu_data.core]; |
303 | atomic_sub(1 << cpu_vpe_id(¤t_cpu_data), &core_cfg->vpe_mask); | 303 | atomic_sub(1 << cpu_vpe_id(¤t_cpu_data), &core_cfg->vpe_mask); |
304 | smp_mb__after_atomic_dec(); | 304 | smp_mb__after_atomic(); |
305 | set_cpu_online(cpu, false); | 305 | set_cpu_online(cpu, false); |
306 | cpu_clear(cpu, cpu_callin_map); | 306 | cpu_clear(cpu, cpu_callin_map); |
307 | 307 | ||
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index cd5e4f568439..f3c56a182fd8 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c | |||
@@ -384,6 +384,7 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) | |||
384 | 384 | ||
385 | kfree(vcpu->arch.guest_ebase); | 385 | kfree(vcpu->arch.guest_ebase); |
386 | kfree(vcpu->arch.kseg0_commpage); | 386 | kfree(vcpu->arch.kseg0_commpage); |
387 | kfree(vcpu); | ||
387 | } | 388 | } |
388 | 389 | ||
389 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) | 390 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) |
diff --git a/arch/mips/math-emu/ieee754.c b/arch/mips/math-emu/ieee754.c index 53f1d2287084..8e97acbbe22c 100644 --- a/arch/mips/math-emu/ieee754.c +++ b/arch/mips/math-emu/ieee754.c | |||
@@ -34,13 +34,22 @@ | |||
34 | * Special constants | 34 | * Special constants |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #define DPCNST(s, b, m) \ | 37 | /* |
38 | * Older GCC requires the inner braces for initialization of union ieee754dp's | ||
39 | * anonymous struct member. Without an error will result. | ||
40 | */ | ||
41 | #define xPCNST(s, b, m, ebias) \ | ||
38 | { \ | 42 | { \ |
39 | .sign = (s), \ | 43 | { \ |
40 | .bexp = (b) + DP_EBIAS, \ | 44 | .sign = (s), \ |
41 | .mant = (m) \ | 45 | .bexp = (b) + ebias, \ |
46 | .mant = (m) \ | ||
47 | } \ | ||
42 | } | 48 | } |
43 | 49 | ||
50 | #define DPCNST(s, b, m) \ | ||
51 | xPCNST(s, b, m, DP_EBIAS) | ||
52 | |||
44 | const union ieee754dp __ieee754dp_spcvals[] = { | 53 | const union ieee754dp __ieee754dp_spcvals[] = { |
45 | DPCNST(0, DP_EMIN - 1, 0x0000000000000ULL), /* + zero */ | 54 | DPCNST(0, DP_EMIN - 1, 0x0000000000000ULL), /* + zero */ |
46 | DPCNST(1, DP_EMIN - 1, 0x0000000000000ULL), /* - zero */ | 55 | DPCNST(1, DP_EMIN - 1, 0x0000000000000ULL), /* - zero */ |
@@ -62,11 +71,7 @@ const union ieee754dp __ieee754dp_spcvals[] = { | |||
62 | }; | 71 | }; |
63 | 72 | ||
64 | #define SPCNST(s, b, m) \ | 73 | #define SPCNST(s, b, m) \ |
65 | { \ | 74 | xPCNST(s, b, m, SP_EBIAS) |
66 | .sign = (s), \ | ||
67 | .bexp = (b) + SP_EBIAS, \ | ||
68 | .mant = (m) \ | ||
69 | } | ||
70 | 75 | ||
71 | const union ieee754sp __ieee754sp_spcvals[] = { | 76 | const union ieee754sp __ieee754sp_spcvals[] = { |
72 | SPCNST(0, SP_EMIN - 1, 0x000000), /* + zero */ | 77 | SPCNST(0, SP_EMIN - 1, 0x000000), /* + zero */ |
diff --git a/arch/mips/mm/uasm-micromips.c b/arch/mips/mm/uasm-micromips.c index 775c2800cba2..8399ddf03a02 100644 --- a/arch/mips/mm/uasm-micromips.c +++ b/arch/mips/mm/uasm-micromips.c | |||
@@ -102,6 +102,7 @@ static struct insn insn_table_MM[] = { | |||
102 | { insn_sd, 0, 0 }, | 102 | { insn_sd, 0, 0 }, |
103 | { insn_sll, M(mm_pool32a_op, 0, 0, 0, 0, mm_sll32_op), RT | RS | RD }, | 103 | { insn_sll, M(mm_pool32a_op, 0, 0, 0, 0, mm_sll32_op), RT | RS | RD }, |
104 | { insn_sllv, M(mm_pool32a_op, 0, 0, 0, 0, mm_sllv32_op), RT | RS | RD }, | 104 | { insn_sllv, M(mm_pool32a_op, 0, 0, 0, 0, mm_sllv32_op), RT | RS | RD }, |
105 | { insn_slt, M(mm_pool32a_op, 0, 0, 0, 0, mm_slt_op), RT | RS | RD }, | ||
105 | { insn_sltiu, M(mm_sltiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM }, | 106 | { insn_sltiu, M(mm_sltiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM }, |
106 | { insn_sltu, M(mm_pool32a_op, 0, 0, 0, 0, mm_sltu_op), RT | RS | RD }, | 107 | { insn_sltu, M(mm_pool32a_op, 0, 0, 0, 0, mm_sltu_op), RT | RS | RD }, |
107 | { insn_sra, M(mm_pool32a_op, 0, 0, 0, 0, mm_sra_op), RT | RS | RD }, | 108 | { insn_sra, M(mm_pool32a_op, 0, 0, 0, 0, mm_sra_op), RT | RS | RD }, |
diff --git a/arch/mips/mm/uasm-mips.c b/arch/mips/mm/uasm-mips.c index 38792c2364f5..6708a2dbf934 100644 --- a/arch/mips/mm/uasm-mips.c +++ b/arch/mips/mm/uasm-mips.c | |||
@@ -89,7 +89,7 @@ static struct insn insn_table[] = { | |||
89 | { insn_lb, M(lb_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 89 | { insn_lb, M(lb_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
90 | { insn_ld, M(ld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 90 | { insn_ld, M(ld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
91 | { insn_ldx, M(spec3_op, 0, 0, 0, ldx_op, lx_op), RS | RT | RD }, | 91 | { insn_ldx, M(spec3_op, 0, 0, 0, ldx_op, lx_op), RS | RT | RD }, |
92 | { insn_lh, M(lw_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 92 | { insn_lh, M(lh_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
93 | { insn_lld, M(lld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 93 | { insn_lld, M(lld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
94 | { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 94 | { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
95 | { insn_lui, M(lui_op, 0, 0, 0, 0, 0), RT | SIMM }, | 95 | { insn_lui, M(lui_op, 0, 0, 0, 0, 0), RT | SIMM }, |
@@ -110,6 +110,7 @@ static struct insn insn_table[] = { | |||
110 | { insn_sd, M(sd_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 110 | { insn_sd, M(sd_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
111 | { insn_sll, M(spec_op, 0, 0, 0, 0, sll_op), RT | RD | RE }, | 111 | { insn_sll, M(spec_op, 0, 0, 0, 0, sll_op), RT | RD | RE }, |
112 | { insn_sllv, M(spec_op, 0, 0, 0, 0, sllv_op), RS | RT | RD }, | 112 | { insn_sllv, M(spec_op, 0, 0, 0, 0, sllv_op), RS | RT | RD }, |
113 | { insn_slt, M(spec_op, 0, 0, 0, 0, slt_op), RS | RT | RD }, | ||
113 | { insn_sltiu, M(sltiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 114 | { insn_sltiu, M(sltiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
114 | { insn_sltu, M(spec_op, 0, 0, 0, 0, sltu_op), RS | RT | RD }, | 115 | { insn_sltu, M(spec_op, 0, 0, 0, 0, sltu_op), RS | RT | RD }, |
115 | { insn_sra, M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE }, | 116 | { insn_sra, M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE }, |
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c index 00515805fe41..a01b0d6cedd2 100644 --- a/arch/mips/mm/uasm.c +++ b/arch/mips/mm/uasm.c | |||
@@ -53,7 +53,7 @@ enum opcode { | |||
53 | insn_ld, insn_ldx, insn_lh, insn_ll, insn_lld, insn_lui, insn_lw, | 53 | insn_ld, insn_ldx, insn_lh, insn_ll, insn_lld, insn_lui, insn_lw, |
54 | insn_lwx, insn_mfc0, insn_mfhi, insn_mflo, insn_mtc0, insn_mul, | 54 | insn_lwx, insn_mfc0, insn_mfhi, insn_mflo, insn_mtc0, insn_mul, |
55 | insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sc, insn_scd, | 55 | insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sc, insn_scd, |
56 | insn_sd, insn_sll, insn_sllv, insn_sltiu, insn_sltu, insn_sra, | 56 | insn_sd, insn_sll, insn_sllv, insn_slt, insn_sltiu, insn_sltu, insn_sra, |
57 | insn_srl, insn_srlv, insn_subu, insn_sw, insn_sync, insn_syscall, | 57 | insn_srl, insn_srlv, insn_subu, insn_sw, insn_sync, insn_syscall, |
58 | insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_wait, insn_wsbh, | 58 | insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_wait, insn_wsbh, |
59 | insn_xor, insn_xori, insn_yield, | 59 | insn_xor, insn_xori, insn_yield, |
@@ -139,6 +139,13 @@ Ip_u1u2u3(op) \ | |||
139 | } \ | 139 | } \ |
140 | UASM_EXPORT_SYMBOL(uasm_i##op); | 140 | UASM_EXPORT_SYMBOL(uasm_i##op); |
141 | 141 | ||
142 | #define I_s3s1s2(op) \ | ||
143 | Ip_s3s1s2(op) \ | ||
144 | { \ | ||
145 | build_insn(buf, insn##op, b, c, a); \ | ||
146 | } \ | ||
147 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
148 | |||
142 | #define I_u2u1u3(op) \ | 149 | #define I_u2u1u3(op) \ |
143 | Ip_u2u1u3(op) \ | 150 | Ip_u2u1u3(op) \ |
144 | { \ | 151 | { \ |
@@ -289,6 +296,7 @@ I_u2s3u1(_scd) | |||
289 | I_u2s3u1(_sd) | 296 | I_u2s3u1(_sd) |
290 | I_u2u1u3(_sll) | 297 | I_u2u1u3(_sll) |
291 | I_u3u2u1(_sllv) | 298 | I_u3u2u1(_sllv) |
299 | I_s3s1s2(_slt) | ||
292 | I_u2u1s3(_sltiu) | 300 | I_u2u1s3(_sltiu) |
293 | I_u3u1u2(_sltu) | 301 | I_u3u1u2(_sltu) |
294 | I_u2u1u3(_sra) | 302 | I_u2u1u3(_sra) |
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c index a67b9753330b..b87390a56a2f 100644 --- a/arch/mips/net/bpf_jit.c +++ b/arch/mips/net/bpf_jit.c | |||
@@ -119,8 +119,6 @@ | |||
119 | /* Arguments used by JIT */ | 119 | /* Arguments used by JIT */ |
120 | #define ARGS_USED_BY_JIT 2 /* only applicable to 64-bit */ | 120 | #define ARGS_USED_BY_JIT 2 /* only applicable to 64-bit */ |
121 | 121 | ||
122 | #define FLAG_NEED_X_RESET (1 << 0) | ||
123 | |||
124 | #define SBIT(x) (1 << (x)) /* Signed version of BIT() */ | 122 | #define SBIT(x) (1 << (x)) /* Signed version of BIT() */ |
125 | 123 | ||
126 | /** | 124 | /** |
@@ -153,6 +151,8 @@ static inline int optimize_div(u32 *k) | |||
153 | return 0; | 151 | return 0; |
154 | } | 152 | } |
155 | 153 | ||
154 | static inline void emit_jit_reg_move(ptr dst, ptr src, struct jit_ctx *ctx); | ||
155 | |||
156 | /* Simply emit the instruction if the JIT memory space has been allocated */ | 156 | /* Simply emit the instruction if the JIT memory space has been allocated */ |
157 | #define emit_instr(ctx, func, ...) \ | 157 | #define emit_instr(ctx, func, ...) \ |
158 | do { \ | 158 | do { \ |
@@ -166,9 +166,7 @@ do { \ | |||
166 | /* Determine if immediate is within the 16-bit signed range */ | 166 | /* Determine if immediate is within the 16-bit signed range */ |
167 | static inline bool is_range16(s32 imm) | 167 | static inline bool is_range16(s32 imm) |
168 | { | 168 | { |
169 | if (imm >= SBIT(15) || imm < -SBIT(15)) | 169 | return !(imm >= SBIT(15) || imm < -SBIT(15)); |
170 | return true; | ||
171 | return false; | ||
172 | } | 170 | } |
173 | 171 | ||
174 | static inline void emit_addu(unsigned int dst, unsigned int src1, | 172 | static inline void emit_addu(unsigned int dst, unsigned int src1, |
@@ -187,7 +185,7 @@ static inline void emit_load_imm(unsigned int dst, u32 imm, struct jit_ctx *ctx) | |||
187 | { | 185 | { |
188 | if (ctx->target != NULL) { | 186 | if (ctx->target != NULL) { |
189 | /* addiu can only handle s16 */ | 187 | /* addiu can only handle s16 */ |
190 | if (is_range16(imm)) { | 188 | if (!is_range16(imm)) { |
191 | u32 *p = &ctx->target[ctx->idx]; | 189 | u32 *p = &ctx->target[ctx->idx]; |
192 | uasm_i_lui(&p, r_tmp_imm, (s32)imm >> 16); | 190 | uasm_i_lui(&p, r_tmp_imm, (s32)imm >> 16); |
193 | p = &ctx->target[ctx->idx + 1]; | 191 | p = &ctx->target[ctx->idx + 1]; |
@@ -199,7 +197,7 @@ static inline void emit_load_imm(unsigned int dst, u32 imm, struct jit_ctx *ctx) | |||
199 | } | 197 | } |
200 | ctx->idx++; | 198 | ctx->idx++; |
201 | 199 | ||
202 | if (is_range16(imm)) | 200 | if (!is_range16(imm)) |
203 | ctx->idx++; | 201 | ctx->idx++; |
204 | } | 202 | } |
205 | 203 | ||
@@ -240,7 +238,7 @@ static inline void emit_daddiu(unsigned int dst, unsigned int src, | |||
240 | static inline void emit_addiu(unsigned int dst, unsigned int src, | 238 | static inline void emit_addiu(unsigned int dst, unsigned int src, |
241 | u32 imm, struct jit_ctx *ctx) | 239 | u32 imm, struct jit_ctx *ctx) |
242 | { | 240 | { |
243 | if (is_range16(imm)) { | 241 | if (!is_range16(imm)) { |
244 | emit_load_imm(r_tmp, imm, ctx); | 242 | emit_load_imm(r_tmp, imm, ctx); |
245 | emit_addu(dst, r_tmp, src, ctx); | 243 | emit_addu(dst, r_tmp, src, ctx); |
246 | } else { | 244 | } else { |
@@ -313,8 +311,11 @@ static inline void emit_sll(unsigned int dst, unsigned int src, | |||
313 | unsigned int sa, struct jit_ctx *ctx) | 311 | unsigned int sa, struct jit_ctx *ctx) |
314 | { | 312 | { |
315 | /* sa is 5-bits long */ | 313 | /* sa is 5-bits long */ |
316 | BUG_ON(sa >= BIT(5)); | 314 | if (sa >= BIT(5)) |
317 | emit_instr(ctx, sll, dst, src, sa); | 315 | /* Shifting >= 32 results in zero */ |
316 | emit_jit_reg_move(dst, r_zero, ctx); | ||
317 | else | ||
318 | emit_instr(ctx, sll, dst, src, sa); | ||
318 | } | 319 | } |
319 | 320 | ||
320 | static inline void emit_srlv(unsigned int dst, unsigned int src, | 321 | static inline void emit_srlv(unsigned int dst, unsigned int src, |
@@ -327,8 +328,17 @@ static inline void emit_srl(unsigned int dst, unsigned int src, | |||
327 | unsigned int sa, struct jit_ctx *ctx) | 328 | unsigned int sa, struct jit_ctx *ctx) |
328 | { | 329 | { |
329 | /* sa is 5-bits long */ | 330 | /* sa is 5-bits long */ |
330 | BUG_ON(sa >= BIT(5)); | 331 | if (sa >= BIT(5)) |
331 | emit_instr(ctx, srl, dst, src, sa); | 332 | /* Shifting >= 32 results in zero */ |
333 | emit_jit_reg_move(dst, r_zero, ctx); | ||
334 | else | ||
335 | emit_instr(ctx, srl, dst, src, sa); | ||
336 | } | ||
337 | |||
338 | static inline void emit_slt(unsigned int dst, unsigned int src1, | ||
339 | unsigned int src2, struct jit_ctx *ctx) | ||
340 | { | ||
341 | emit_instr(ctx, slt, dst, src1, src2); | ||
332 | } | 342 | } |
333 | 343 | ||
334 | static inline void emit_sltu(unsigned int dst, unsigned int src1, | 344 | static inline void emit_sltu(unsigned int dst, unsigned int src1, |
@@ -341,7 +351,7 @@ static inline void emit_sltiu(unsigned dst, unsigned int src, | |||
341 | unsigned int imm, struct jit_ctx *ctx) | 351 | unsigned int imm, struct jit_ctx *ctx) |
342 | { | 352 | { |
343 | /* 16 bit immediate */ | 353 | /* 16 bit immediate */ |
344 | if (is_range16((s32)imm)) { | 354 | if (!is_range16((s32)imm)) { |
345 | emit_load_imm(r_tmp, imm, ctx); | 355 | emit_load_imm(r_tmp, imm, ctx); |
346 | emit_sltu(dst, src, r_tmp, ctx); | 356 | emit_sltu(dst, src, r_tmp, ctx); |
347 | } else { | 357 | } else { |
@@ -408,7 +418,7 @@ static inline void emit_div(unsigned int dst, unsigned int src, | |||
408 | u32 *p = &ctx->target[ctx->idx]; | 418 | u32 *p = &ctx->target[ctx->idx]; |
409 | uasm_i_divu(&p, dst, src); | 419 | uasm_i_divu(&p, dst, src); |
410 | p = &ctx->target[ctx->idx + 1]; | 420 | p = &ctx->target[ctx->idx + 1]; |
411 | uasm_i_mfhi(&p, dst); | 421 | uasm_i_mflo(&p, dst); |
412 | } | 422 | } |
413 | ctx->idx += 2; /* 2 insts */ | 423 | ctx->idx += 2; /* 2 insts */ |
414 | } | 424 | } |
@@ -443,6 +453,17 @@ static inline void emit_wsbh(unsigned int dst, unsigned int src, | |||
443 | emit_instr(ctx, wsbh, dst, src); | 453 | emit_instr(ctx, wsbh, dst, src); |
444 | } | 454 | } |
445 | 455 | ||
456 | /* load pointer to register */ | ||
457 | static inline void emit_load_ptr(unsigned int dst, unsigned int src, | ||
458 | int imm, struct jit_ctx *ctx) | ||
459 | { | ||
460 | /* src contains the base addr of the 32/64-pointer */ | ||
461 | if (config_enabled(CONFIG_64BIT)) | ||
462 | emit_instr(ctx, ld, dst, imm, src); | ||
463 | else | ||
464 | emit_instr(ctx, lw, dst, imm, src); | ||
465 | } | ||
466 | |||
446 | /* load a function pointer to register */ | 467 | /* load a function pointer to register */ |
447 | static inline void emit_load_func(unsigned int reg, ptr imm, | 468 | static inline void emit_load_func(unsigned int reg, ptr imm, |
448 | struct jit_ctx *ctx) | 469 | struct jit_ctx *ctx) |
@@ -545,29 +566,13 @@ static inline u16 align_sp(unsigned int num) | |||
545 | return num; | 566 | return num; |
546 | } | 567 | } |
547 | 568 | ||
548 | static inline void update_on_xread(struct jit_ctx *ctx) | ||
549 | { | ||
550 | if (!(ctx->flags & SEEN_X)) | ||
551 | ctx->flags |= FLAG_NEED_X_RESET; | ||
552 | |||
553 | ctx->flags |= SEEN_X; | ||
554 | } | ||
555 | |||
556 | static bool is_load_to_a(u16 inst) | 569 | static bool is_load_to_a(u16 inst) |
557 | { | 570 | { |
558 | switch (inst) { | 571 | switch (inst) { |
559 | case BPF_S_LD_W_LEN: | 572 | case BPF_LD | BPF_W | BPF_LEN: |
560 | case BPF_S_LD_W_ABS: | 573 | case BPF_LD | BPF_W | BPF_ABS: |
561 | case BPF_S_LD_H_ABS: | 574 | case BPF_LD | BPF_H | BPF_ABS: |
562 | case BPF_S_LD_B_ABS: | 575 | case BPF_LD | BPF_B | BPF_ABS: |
563 | case BPF_S_ANC_CPU: | ||
564 | case BPF_S_ANC_IFINDEX: | ||
565 | case BPF_S_ANC_MARK: | ||
566 | case BPF_S_ANC_PROTOCOL: | ||
567 | case BPF_S_ANC_RXHASH: | ||
568 | case BPF_S_ANC_VLAN_TAG: | ||
569 | case BPF_S_ANC_VLAN_TAG_PRESENT: | ||
570 | case BPF_S_ANC_QUEUE: | ||
571 | return true; | 576 | return true; |
572 | default: | 577 | default: |
573 | return false; | 578 | return false; |
@@ -618,7 +623,10 @@ static void save_bpf_jit_regs(struct jit_ctx *ctx, unsigned offset) | |||
618 | if (ctx->flags & SEEN_MEM) { | 623 | if (ctx->flags & SEEN_MEM) { |
619 | if (real_off % (RSIZE * 2)) | 624 | if (real_off % (RSIZE * 2)) |
620 | real_off += RSIZE; | 625 | real_off += RSIZE; |
621 | emit_addiu(r_M, r_sp, real_off, ctx); | 626 | if (config_enabled(CONFIG_64BIT)) |
627 | emit_daddiu(r_M, r_sp, real_off, ctx); | ||
628 | else | ||
629 | emit_addiu(r_M, r_sp, real_off, ctx); | ||
622 | } | 630 | } |
623 | } | 631 | } |
624 | 632 | ||
@@ -705,11 +713,11 @@ static void build_prologue(struct jit_ctx *ctx) | |||
705 | if (ctx->flags & SEEN_SKB) | 713 | if (ctx->flags & SEEN_SKB) |
706 | emit_reg_move(r_skb, MIPS_R_A0, ctx); | 714 | emit_reg_move(r_skb, MIPS_R_A0, ctx); |
707 | 715 | ||
708 | if (ctx->flags & FLAG_NEED_X_RESET) | 716 | if (ctx->flags & SEEN_X) |
709 | emit_jit_reg_move(r_X, r_zero, ctx); | 717 | emit_jit_reg_move(r_X, r_zero, ctx); |
710 | 718 | ||
711 | /* Do not leak kernel data to userspace */ | 719 | /* Do not leak kernel data to userspace */ |
712 | if ((first_inst != BPF_S_RET_K) && !(is_load_to_a(first_inst))) | 720 | if ((first_inst != (BPF_RET | BPF_K)) && !(is_load_to_a(first_inst))) |
713 | emit_jit_reg_move(r_A, r_zero, ctx); | 721 | emit_jit_reg_move(r_A, r_zero, ctx); |
714 | } | 722 | } |
715 | 723 | ||
@@ -757,13 +765,17 @@ static u64 jit_get_skb_w(struct sk_buff *skb, unsigned offset) | |||
757 | return (u64)err << 32 | ntohl(ret); | 765 | return (u64)err << 32 | ntohl(ret); |
758 | } | 766 | } |
759 | 767 | ||
760 | #define PKT_TYPE_MAX 7 | 768 | #ifdef __BIG_ENDIAN_BITFIELD |
769 | #define PKT_TYPE_MAX (7 << 5) | ||
770 | #else | ||
771 | #define PKT_TYPE_MAX 7 | ||
772 | #endif | ||
761 | static int pkt_type_offset(void) | 773 | static int pkt_type_offset(void) |
762 | { | 774 | { |
763 | struct sk_buff skb_probe = { | 775 | struct sk_buff skb_probe = { |
764 | .pkt_type = ~0, | 776 | .pkt_type = ~0, |
765 | }; | 777 | }; |
766 | char *ct = (char *)&skb_probe; | 778 | u8 *ct = (u8 *)&skb_probe; |
767 | unsigned int off; | 779 | unsigned int off; |
768 | 780 | ||
769 | for (off = 0; off < sizeof(struct sk_buff); off++) { | 781 | for (off = 0; off < sizeof(struct sk_buff); off++) { |
@@ -783,46 +795,62 @@ static int build_body(struct jit_ctx *ctx) | |||
783 | u32 k, b_off __maybe_unused; | 795 | u32 k, b_off __maybe_unused; |
784 | 796 | ||
785 | for (i = 0; i < prog->len; i++) { | 797 | for (i = 0; i < prog->len; i++) { |
798 | u16 code; | ||
799 | |||
786 | inst = &(prog->insns[i]); | 800 | inst = &(prog->insns[i]); |
787 | pr_debug("%s: code->0x%02x, jt->0x%x, jf->0x%x, k->0x%x\n", | 801 | pr_debug("%s: code->0x%02x, jt->0x%x, jf->0x%x, k->0x%x\n", |
788 | __func__, inst->code, inst->jt, inst->jf, inst->k); | 802 | __func__, inst->code, inst->jt, inst->jf, inst->k); |
789 | k = inst->k; | 803 | k = inst->k; |
804 | code = bpf_anc_helper(inst); | ||
790 | 805 | ||
791 | if (ctx->target == NULL) | 806 | if (ctx->target == NULL) |
792 | ctx->offsets[i] = ctx->idx * 4; | 807 | ctx->offsets[i] = ctx->idx * 4; |
793 | 808 | ||
794 | switch (inst->code) { | 809 | switch (code) { |
795 | case BPF_S_LD_IMM: | 810 | case BPF_LD | BPF_IMM: |
796 | /* A <- k ==> li r_A, k */ | 811 | /* A <- k ==> li r_A, k */ |
797 | ctx->flags |= SEEN_A; | 812 | ctx->flags |= SEEN_A; |
798 | emit_load_imm(r_A, k, ctx); | 813 | emit_load_imm(r_A, k, ctx); |
799 | break; | 814 | break; |
800 | case BPF_S_LD_W_LEN: | 815 | case BPF_LD | BPF_W | BPF_LEN: |
801 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4); | 816 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4); |
802 | /* A <- len ==> lw r_A, offset(skb) */ | 817 | /* A <- len ==> lw r_A, offset(skb) */ |
803 | ctx->flags |= SEEN_SKB | SEEN_A; | 818 | ctx->flags |= SEEN_SKB | SEEN_A; |
804 | off = offsetof(struct sk_buff, len); | 819 | off = offsetof(struct sk_buff, len); |
805 | emit_load(r_A, r_skb, off, ctx); | 820 | emit_load(r_A, r_skb, off, ctx); |
806 | break; | 821 | break; |
807 | case BPF_S_LD_MEM: | 822 | case BPF_LD | BPF_MEM: |
808 | /* A <- M[k] ==> lw r_A, offset(M) */ | 823 | /* A <- M[k] ==> lw r_A, offset(M) */ |
809 | ctx->flags |= SEEN_MEM | SEEN_A; | 824 | ctx->flags |= SEEN_MEM | SEEN_A; |
810 | emit_load(r_A, r_M, SCRATCH_OFF(k), ctx); | 825 | emit_load(r_A, r_M, SCRATCH_OFF(k), ctx); |
811 | break; | 826 | break; |
812 | case BPF_S_LD_W_ABS: | 827 | case BPF_LD | BPF_W | BPF_ABS: |
813 | /* A <- P[k:4] */ | 828 | /* A <- P[k:4] */ |
814 | load_order = 2; | 829 | load_order = 2; |
815 | goto load; | 830 | goto load; |
816 | case BPF_S_LD_H_ABS: | 831 | case BPF_LD | BPF_H | BPF_ABS: |
817 | /* A <- P[k:2] */ | 832 | /* A <- P[k:2] */ |
818 | load_order = 1; | 833 | load_order = 1; |
819 | goto load; | 834 | goto load; |
820 | case BPF_S_LD_B_ABS: | 835 | case BPF_LD | BPF_B | BPF_ABS: |
821 | /* A <- P[k:1] */ | 836 | /* A <- P[k:1] */ |
822 | load_order = 0; | 837 | load_order = 0; |
823 | load: | 838 | load: |
839 | /* the interpreter will deal with the negative K */ | ||
840 | if ((int)k < 0) | ||
841 | return -ENOTSUPP; | ||
842 | |||
824 | emit_load_imm(r_off, k, ctx); | 843 | emit_load_imm(r_off, k, ctx); |
825 | load_common: | 844 | load_common: |
845 | /* | ||
846 | * We may got here from the indirect loads so | ||
847 | * return if offset is negative. | ||
848 | */ | ||
849 | emit_slt(r_s0, r_off, r_zero, ctx); | ||
850 | emit_bcond(MIPS_COND_NE, r_s0, r_zero, | ||
851 | b_imm(prog->len, ctx), ctx); | ||
852 | emit_reg_move(r_ret, r_zero, ctx); | ||
853 | |||
826 | ctx->flags |= SEEN_CALL | SEEN_OFF | SEEN_S0 | | 854 | ctx->flags |= SEEN_CALL | SEEN_OFF | SEEN_S0 | |
827 | SEEN_SKB | SEEN_A; | 855 | SEEN_SKB | SEEN_A; |
828 | 856 | ||
@@ -852,39 +880,42 @@ load_common: | |||
852 | emit_b(b_imm(prog->len, ctx), ctx); | 880 | emit_b(b_imm(prog->len, ctx), ctx); |
853 | emit_reg_move(r_ret, r_zero, ctx); | 881 | emit_reg_move(r_ret, r_zero, ctx); |
854 | break; | 882 | break; |
855 | case BPF_S_LD_W_IND: | 883 | case BPF_LD | BPF_W | BPF_IND: |
856 | /* A <- P[X + k:4] */ | 884 | /* A <- P[X + k:4] */ |
857 | load_order = 2; | 885 | load_order = 2; |
858 | goto load_ind; | 886 | goto load_ind; |
859 | case BPF_S_LD_H_IND: | 887 | case BPF_LD | BPF_H | BPF_IND: |
860 | /* A <- P[X + k:2] */ | 888 | /* A <- P[X + k:2] */ |
861 | load_order = 1; | 889 | load_order = 1; |
862 | goto load_ind; | 890 | goto load_ind; |
863 | case BPF_S_LD_B_IND: | 891 | case BPF_LD | BPF_B | BPF_IND: |
864 | /* A <- P[X + k:1] */ | 892 | /* A <- P[X + k:1] */ |
865 | load_order = 0; | 893 | load_order = 0; |
866 | load_ind: | 894 | load_ind: |
867 | update_on_xread(ctx); | ||
868 | ctx->flags |= SEEN_OFF | SEEN_X; | 895 | ctx->flags |= SEEN_OFF | SEEN_X; |
869 | emit_addiu(r_off, r_X, k, ctx); | 896 | emit_addiu(r_off, r_X, k, ctx); |
870 | goto load_common; | 897 | goto load_common; |
871 | case BPF_S_LDX_IMM: | 898 | case BPF_LDX | BPF_IMM: |
872 | /* X <- k */ | 899 | /* X <- k */ |
873 | ctx->flags |= SEEN_X; | 900 | ctx->flags |= SEEN_X; |
874 | emit_load_imm(r_X, k, ctx); | 901 | emit_load_imm(r_X, k, ctx); |
875 | break; | 902 | break; |
876 | case BPF_S_LDX_MEM: | 903 | case BPF_LDX | BPF_MEM: |
877 | /* X <- M[k] */ | 904 | /* X <- M[k] */ |
878 | ctx->flags |= SEEN_X | SEEN_MEM; | 905 | ctx->flags |= SEEN_X | SEEN_MEM; |
879 | emit_load(r_X, r_M, SCRATCH_OFF(k), ctx); | 906 | emit_load(r_X, r_M, SCRATCH_OFF(k), ctx); |
880 | break; | 907 | break; |
881 | case BPF_S_LDX_W_LEN: | 908 | case BPF_LDX | BPF_W | BPF_LEN: |
882 | /* X <- len */ | 909 | /* X <- len */ |
883 | ctx->flags |= SEEN_X | SEEN_SKB; | 910 | ctx->flags |= SEEN_X | SEEN_SKB; |
884 | off = offsetof(struct sk_buff, len); | 911 | off = offsetof(struct sk_buff, len); |
885 | emit_load(r_X, r_skb, off, ctx); | 912 | emit_load(r_X, r_skb, off, ctx); |
886 | break; | 913 | break; |
887 | case BPF_S_LDX_B_MSH: | 914 | case BPF_LDX | BPF_B | BPF_MSH: |
915 | /* the interpreter will deal with the negative K */ | ||
916 | if ((int)k < 0) | ||
917 | return -ENOTSUPP; | ||
918 | |||
888 | /* X <- 4 * (P[k:1] & 0xf) */ | 919 | /* X <- 4 * (P[k:1] & 0xf) */ |
889 | ctx->flags |= SEEN_X | SEEN_CALL | SEEN_S0 | SEEN_SKB; | 920 | ctx->flags |= SEEN_X | SEEN_CALL | SEEN_S0 | SEEN_SKB; |
890 | /* Load offset to a1 */ | 921 | /* Load offset to a1 */ |
@@ -917,50 +948,49 @@ load_ind: | |||
917 | emit_b(b_imm(prog->len, ctx), ctx); | 948 | emit_b(b_imm(prog->len, ctx), ctx); |
918 | emit_load_imm(r_ret, 0, ctx); /* delay slot */ | 949 | emit_load_imm(r_ret, 0, ctx); /* delay slot */ |
919 | break; | 950 | break; |
920 | case BPF_S_ST: | 951 | case BPF_ST: |
921 | /* M[k] <- A */ | 952 | /* M[k] <- A */ |
922 | ctx->flags |= SEEN_MEM | SEEN_A; | 953 | ctx->flags |= SEEN_MEM | SEEN_A; |
923 | emit_store(r_A, r_M, SCRATCH_OFF(k), ctx); | 954 | emit_store(r_A, r_M, SCRATCH_OFF(k), ctx); |
924 | break; | 955 | break; |
925 | case BPF_S_STX: | 956 | case BPF_STX: |
926 | /* M[k] <- X */ | 957 | /* M[k] <- X */ |
927 | ctx->flags |= SEEN_MEM | SEEN_X; | 958 | ctx->flags |= SEEN_MEM | SEEN_X; |
928 | emit_store(r_X, r_M, SCRATCH_OFF(k), ctx); | 959 | emit_store(r_X, r_M, SCRATCH_OFF(k), ctx); |
929 | break; | 960 | break; |
930 | case BPF_S_ALU_ADD_K: | 961 | case BPF_ALU | BPF_ADD | BPF_K: |
931 | /* A += K */ | 962 | /* A += K */ |
932 | ctx->flags |= SEEN_A; | 963 | ctx->flags |= SEEN_A; |
933 | emit_addiu(r_A, r_A, k, ctx); | 964 | emit_addiu(r_A, r_A, k, ctx); |
934 | break; | 965 | break; |
935 | case BPF_S_ALU_ADD_X: | 966 | case BPF_ALU | BPF_ADD | BPF_X: |
936 | /* A += X */ | 967 | /* A += X */ |
937 | ctx->flags |= SEEN_A | SEEN_X; | 968 | ctx->flags |= SEEN_A | SEEN_X; |
938 | emit_addu(r_A, r_A, r_X, ctx); | 969 | emit_addu(r_A, r_A, r_X, ctx); |
939 | break; | 970 | break; |
940 | case BPF_S_ALU_SUB_K: | 971 | case BPF_ALU | BPF_SUB | BPF_K: |
941 | /* A -= K */ | 972 | /* A -= K */ |
942 | ctx->flags |= SEEN_A; | 973 | ctx->flags |= SEEN_A; |
943 | emit_addiu(r_A, r_A, -k, ctx); | 974 | emit_addiu(r_A, r_A, -k, ctx); |
944 | break; | 975 | break; |
945 | case BPF_S_ALU_SUB_X: | 976 | case BPF_ALU | BPF_SUB | BPF_X: |
946 | /* A -= X */ | 977 | /* A -= X */ |
947 | ctx->flags |= SEEN_A | SEEN_X; | 978 | ctx->flags |= SEEN_A | SEEN_X; |
948 | emit_subu(r_A, r_A, r_X, ctx); | 979 | emit_subu(r_A, r_A, r_X, ctx); |
949 | break; | 980 | break; |
950 | case BPF_S_ALU_MUL_K: | 981 | case BPF_ALU | BPF_MUL | BPF_K: |
951 | /* A *= K */ | 982 | /* A *= K */ |
952 | /* Load K to scratch register before MUL */ | 983 | /* Load K to scratch register before MUL */ |
953 | ctx->flags |= SEEN_A | SEEN_S0; | 984 | ctx->flags |= SEEN_A | SEEN_S0; |
954 | emit_load_imm(r_s0, k, ctx); | 985 | emit_load_imm(r_s0, k, ctx); |
955 | emit_mul(r_A, r_A, r_s0, ctx); | 986 | emit_mul(r_A, r_A, r_s0, ctx); |
956 | break; | 987 | break; |
957 | case BPF_S_ALU_MUL_X: | 988 | case BPF_ALU | BPF_MUL | BPF_X: |
958 | /* A *= X */ | 989 | /* A *= X */ |
959 | update_on_xread(ctx); | ||
960 | ctx->flags |= SEEN_A | SEEN_X; | 990 | ctx->flags |= SEEN_A | SEEN_X; |
961 | emit_mul(r_A, r_A, r_X, ctx); | 991 | emit_mul(r_A, r_A, r_X, ctx); |
962 | break; | 992 | break; |
963 | case BPF_S_ALU_DIV_K: | 993 | case BPF_ALU | BPF_DIV | BPF_K: |
964 | /* A /= k */ | 994 | /* A /= k */ |
965 | if (k == 1) | 995 | if (k == 1) |
966 | break; | 996 | break; |
@@ -973,7 +1003,7 @@ load_ind: | |||
973 | emit_load_imm(r_s0, k, ctx); | 1003 | emit_load_imm(r_s0, k, ctx); |
974 | emit_div(r_A, r_s0, ctx); | 1004 | emit_div(r_A, r_s0, ctx); |
975 | break; | 1005 | break; |
976 | case BPF_S_ALU_MOD_K: | 1006 | case BPF_ALU | BPF_MOD | BPF_K: |
977 | /* A %= k */ | 1007 | /* A %= k */ |
978 | if (k == 1 || optimize_div(&k)) { | 1008 | if (k == 1 || optimize_div(&k)) { |
979 | ctx->flags |= SEEN_A; | 1009 | ctx->flags |= SEEN_A; |
@@ -984,9 +1014,8 @@ load_ind: | |||
984 | emit_mod(r_A, r_s0, ctx); | 1014 | emit_mod(r_A, r_s0, ctx); |
985 | } | 1015 | } |
986 | break; | 1016 | break; |
987 | case BPF_S_ALU_DIV_X: | 1017 | case BPF_ALU | BPF_DIV | BPF_X: |
988 | /* A /= X */ | 1018 | /* A /= X */ |
989 | update_on_xread(ctx); | ||
990 | ctx->flags |= SEEN_X | SEEN_A; | 1019 | ctx->flags |= SEEN_X | SEEN_A; |
991 | /* Check if r_X is zero */ | 1020 | /* Check if r_X is zero */ |
992 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, | 1021 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, |
@@ -994,9 +1023,8 @@ load_ind: | |||
994 | emit_load_imm(r_val, 0, ctx); /* delay slot */ | 1023 | emit_load_imm(r_val, 0, ctx); /* delay slot */ |
995 | emit_div(r_A, r_X, ctx); | 1024 | emit_div(r_A, r_X, ctx); |
996 | break; | 1025 | break; |
997 | case BPF_S_ALU_MOD_X: | 1026 | case BPF_ALU | BPF_MOD | BPF_X: |
998 | /* A %= X */ | 1027 | /* A %= X */ |
999 | update_on_xread(ctx); | ||
1000 | ctx->flags |= SEEN_X | SEEN_A; | 1028 | ctx->flags |= SEEN_X | SEEN_A; |
1001 | /* Check if r_X is zero */ | 1029 | /* Check if r_X is zero */ |
1002 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, | 1030 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, |
@@ -1004,94 +1032,89 @@ load_ind: | |||
1004 | emit_load_imm(r_val, 0, ctx); /* delay slot */ | 1032 | emit_load_imm(r_val, 0, ctx); /* delay slot */ |
1005 | emit_mod(r_A, r_X, ctx); | 1033 | emit_mod(r_A, r_X, ctx); |
1006 | break; | 1034 | break; |
1007 | case BPF_S_ALU_OR_K: | 1035 | case BPF_ALU | BPF_OR | BPF_K: |
1008 | /* A |= K */ | 1036 | /* A |= K */ |
1009 | ctx->flags |= SEEN_A; | 1037 | ctx->flags |= SEEN_A; |
1010 | emit_ori(r_A, r_A, k, ctx); | 1038 | emit_ori(r_A, r_A, k, ctx); |
1011 | break; | 1039 | break; |
1012 | case BPF_S_ALU_OR_X: | 1040 | case BPF_ALU | BPF_OR | BPF_X: |
1013 | /* A |= X */ | 1041 | /* A |= X */ |
1014 | update_on_xread(ctx); | ||
1015 | ctx->flags |= SEEN_A; | 1042 | ctx->flags |= SEEN_A; |
1016 | emit_ori(r_A, r_A, r_X, ctx); | 1043 | emit_ori(r_A, r_A, r_X, ctx); |
1017 | break; | 1044 | break; |
1018 | case BPF_S_ALU_XOR_K: | 1045 | case BPF_ALU | BPF_XOR | BPF_K: |
1019 | /* A ^= k */ | 1046 | /* A ^= k */ |
1020 | ctx->flags |= SEEN_A; | 1047 | ctx->flags |= SEEN_A; |
1021 | emit_xori(r_A, r_A, k, ctx); | 1048 | emit_xori(r_A, r_A, k, ctx); |
1022 | break; | 1049 | break; |
1023 | case BPF_S_ANC_ALU_XOR_X: | 1050 | case BPF_ANC | SKF_AD_ALU_XOR_X: |
1024 | case BPF_S_ALU_XOR_X: | 1051 | case BPF_ALU | BPF_XOR | BPF_X: |
1025 | /* A ^= X */ | 1052 | /* A ^= X */ |
1026 | update_on_xread(ctx); | ||
1027 | ctx->flags |= SEEN_A; | 1053 | ctx->flags |= SEEN_A; |
1028 | emit_xor(r_A, r_A, r_X, ctx); | 1054 | emit_xor(r_A, r_A, r_X, ctx); |
1029 | break; | 1055 | break; |
1030 | case BPF_S_ALU_AND_K: | 1056 | case BPF_ALU | BPF_AND | BPF_K: |
1031 | /* A &= K */ | 1057 | /* A &= K */ |
1032 | ctx->flags |= SEEN_A; | 1058 | ctx->flags |= SEEN_A; |
1033 | emit_andi(r_A, r_A, k, ctx); | 1059 | emit_andi(r_A, r_A, k, ctx); |
1034 | break; | 1060 | break; |
1035 | case BPF_S_ALU_AND_X: | 1061 | case BPF_ALU | BPF_AND | BPF_X: |
1036 | /* A &= X */ | 1062 | /* A &= X */ |
1037 | update_on_xread(ctx); | ||
1038 | ctx->flags |= SEEN_A | SEEN_X; | 1063 | ctx->flags |= SEEN_A | SEEN_X; |
1039 | emit_and(r_A, r_A, r_X, ctx); | 1064 | emit_and(r_A, r_A, r_X, ctx); |
1040 | break; | 1065 | break; |
1041 | case BPF_S_ALU_LSH_K: | 1066 | case BPF_ALU | BPF_LSH | BPF_K: |
1042 | /* A <<= K */ | 1067 | /* A <<= K */ |
1043 | ctx->flags |= SEEN_A; | 1068 | ctx->flags |= SEEN_A; |
1044 | emit_sll(r_A, r_A, k, ctx); | 1069 | emit_sll(r_A, r_A, k, ctx); |
1045 | break; | 1070 | break; |
1046 | case BPF_S_ALU_LSH_X: | 1071 | case BPF_ALU | BPF_LSH | BPF_X: |
1047 | /* A <<= X */ | 1072 | /* A <<= X */ |
1048 | ctx->flags |= SEEN_A | SEEN_X; | 1073 | ctx->flags |= SEEN_A | SEEN_X; |
1049 | update_on_xread(ctx); | ||
1050 | emit_sllv(r_A, r_A, r_X, ctx); | 1074 | emit_sllv(r_A, r_A, r_X, ctx); |
1051 | break; | 1075 | break; |
1052 | case BPF_S_ALU_RSH_K: | 1076 | case BPF_ALU | BPF_RSH | BPF_K: |
1053 | /* A >>= K */ | 1077 | /* A >>= K */ |
1054 | ctx->flags |= SEEN_A; | 1078 | ctx->flags |= SEEN_A; |
1055 | emit_srl(r_A, r_A, k, ctx); | 1079 | emit_srl(r_A, r_A, k, ctx); |
1056 | break; | 1080 | break; |
1057 | case BPF_S_ALU_RSH_X: | 1081 | case BPF_ALU | BPF_RSH | BPF_X: |
1058 | ctx->flags |= SEEN_A | SEEN_X; | 1082 | ctx->flags |= SEEN_A | SEEN_X; |
1059 | update_on_xread(ctx); | ||
1060 | emit_srlv(r_A, r_A, r_X, ctx); | 1083 | emit_srlv(r_A, r_A, r_X, ctx); |
1061 | break; | 1084 | break; |
1062 | case BPF_S_ALU_NEG: | 1085 | case BPF_ALU | BPF_NEG: |
1063 | /* A = -A */ | 1086 | /* A = -A */ |
1064 | ctx->flags |= SEEN_A; | 1087 | ctx->flags |= SEEN_A; |
1065 | emit_neg(r_A, ctx); | 1088 | emit_neg(r_A, ctx); |
1066 | break; | 1089 | break; |
1067 | case BPF_S_JMP_JA: | 1090 | case BPF_JMP | BPF_JA: |
1068 | /* pc += K */ | 1091 | /* pc += K */ |
1069 | emit_b(b_imm(i + k + 1, ctx), ctx); | 1092 | emit_b(b_imm(i + k + 1, ctx), ctx); |
1070 | emit_nop(ctx); | 1093 | emit_nop(ctx); |
1071 | break; | 1094 | break; |
1072 | case BPF_S_JMP_JEQ_K: | 1095 | case BPF_JMP | BPF_JEQ | BPF_K: |
1073 | /* pc += ( A == K ) ? pc->jt : pc->jf */ | 1096 | /* pc += ( A == K ) ? pc->jt : pc->jf */ |
1074 | condt = MIPS_COND_EQ | MIPS_COND_K; | 1097 | condt = MIPS_COND_EQ | MIPS_COND_K; |
1075 | goto jmp_cmp; | 1098 | goto jmp_cmp; |
1076 | case BPF_S_JMP_JEQ_X: | 1099 | case BPF_JMP | BPF_JEQ | BPF_X: |
1077 | ctx->flags |= SEEN_X; | 1100 | ctx->flags |= SEEN_X; |
1078 | /* pc += ( A == X ) ? pc->jt : pc->jf */ | 1101 | /* pc += ( A == X ) ? pc->jt : pc->jf */ |
1079 | condt = MIPS_COND_EQ | MIPS_COND_X; | 1102 | condt = MIPS_COND_EQ | MIPS_COND_X; |
1080 | goto jmp_cmp; | 1103 | goto jmp_cmp; |
1081 | case BPF_S_JMP_JGE_K: | 1104 | case BPF_JMP | BPF_JGE | BPF_K: |
1082 | /* pc += ( A >= K ) ? pc->jt : pc->jf */ | 1105 | /* pc += ( A >= K ) ? pc->jt : pc->jf */ |
1083 | condt = MIPS_COND_GE | MIPS_COND_K; | 1106 | condt = MIPS_COND_GE | MIPS_COND_K; |
1084 | goto jmp_cmp; | 1107 | goto jmp_cmp; |
1085 | case BPF_S_JMP_JGE_X: | 1108 | case BPF_JMP | BPF_JGE | BPF_X: |
1086 | ctx->flags |= SEEN_X; | 1109 | ctx->flags |= SEEN_X; |
1087 | /* pc += ( A >= X ) ? pc->jt : pc->jf */ | 1110 | /* pc += ( A >= X ) ? pc->jt : pc->jf */ |
1088 | condt = MIPS_COND_GE | MIPS_COND_X; | 1111 | condt = MIPS_COND_GE | MIPS_COND_X; |
1089 | goto jmp_cmp; | 1112 | goto jmp_cmp; |
1090 | case BPF_S_JMP_JGT_K: | 1113 | case BPF_JMP | BPF_JGT | BPF_K: |
1091 | /* pc += ( A > K ) ? pc->jt : pc->jf */ | 1114 | /* pc += ( A > K ) ? pc->jt : pc->jf */ |
1092 | condt = MIPS_COND_GT | MIPS_COND_K; | 1115 | condt = MIPS_COND_GT | MIPS_COND_K; |
1093 | goto jmp_cmp; | 1116 | goto jmp_cmp; |
1094 | case BPF_S_JMP_JGT_X: | 1117 | case BPF_JMP | BPF_JGT | BPF_X: |
1095 | ctx->flags |= SEEN_X; | 1118 | ctx->flags |= SEEN_X; |
1096 | /* pc += ( A > X ) ? pc->jt : pc->jf */ | 1119 | /* pc += ( A > X ) ? pc->jt : pc->jf */ |
1097 | condt = MIPS_COND_GT | MIPS_COND_X; | 1120 | condt = MIPS_COND_GT | MIPS_COND_X; |
@@ -1109,7 +1132,7 @@ jmp_cmp: | |||
1109 | } | 1132 | } |
1110 | /* A < (K|X) ? r_scrach = 1 */ | 1133 | /* A < (K|X) ? r_scrach = 1 */ |
1111 | b_off = b_imm(i + inst->jf + 1, ctx); | 1134 | b_off = b_imm(i + inst->jf + 1, ctx); |
1112 | emit_bcond(MIPS_COND_GT, r_s0, r_zero, b_off, | 1135 | emit_bcond(MIPS_COND_NE, r_s0, r_zero, b_off, |
1113 | ctx); | 1136 | ctx); |
1114 | emit_nop(ctx); | 1137 | emit_nop(ctx); |
1115 | /* A > (K|X) ? scratch = 0 */ | 1138 | /* A > (K|X) ? scratch = 0 */ |
@@ -1167,7 +1190,7 @@ jmp_cmp: | |||
1167 | } | 1190 | } |
1168 | } | 1191 | } |
1169 | break; | 1192 | break; |
1170 | case BPF_S_JMP_JSET_K: | 1193 | case BPF_JMP | BPF_JSET | BPF_K: |
1171 | ctx->flags |= SEEN_S0 | SEEN_S1 | SEEN_A; | 1194 | ctx->flags |= SEEN_S0 | SEEN_S1 | SEEN_A; |
1172 | /* pc += (A & K) ? pc -> jt : pc -> jf */ | 1195 | /* pc += (A & K) ? pc -> jt : pc -> jf */ |
1173 | emit_load_imm(r_s1, k, ctx); | 1196 | emit_load_imm(r_s1, k, ctx); |
@@ -1181,7 +1204,7 @@ jmp_cmp: | |||
1181 | emit_b(b_off, ctx); | 1204 | emit_b(b_off, ctx); |
1182 | emit_nop(ctx); | 1205 | emit_nop(ctx); |
1183 | break; | 1206 | break; |
1184 | case BPF_S_JMP_JSET_X: | 1207 | case BPF_JMP | BPF_JSET | BPF_X: |
1185 | ctx->flags |= SEEN_S0 | SEEN_X | SEEN_A; | 1208 | ctx->flags |= SEEN_S0 | SEEN_X | SEEN_A; |
1186 | /* pc += (A & X) ? pc -> jt : pc -> jf */ | 1209 | /* pc += (A & X) ? pc -> jt : pc -> jf */ |
1187 | emit_and(r_s0, r_A, r_X, ctx); | 1210 | emit_and(r_s0, r_A, r_X, ctx); |
@@ -1194,7 +1217,7 @@ jmp_cmp: | |||
1194 | emit_b(b_off, ctx); | 1217 | emit_b(b_off, ctx); |
1195 | emit_nop(ctx); | 1218 | emit_nop(ctx); |
1196 | break; | 1219 | break; |
1197 | case BPF_S_RET_A: | 1220 | case BPF_RET | BPF_A: |
1198 | ctx->flags |= SEEN_A; | 1221 | ctx->flags |= SEEN_A; |
1199 | if (i != prog->len - 1) | 1222 | if (i != prog->len - 1) |
1200 | /* | 1223 | /* |
@@ -1204,7 +1227,7 @@ jmp_cmp: | |||
1204 | emit_b(b_imm(prog->len, ctx), ctx); | 1227 | emit_b(b_imm(prog->len, ctx), ctx); |
1205 | emit_reg_move(r_ret, r_A, ctx); /* delay slot */ | 1228 | emit_reg_move(r_ret, r_A, ctx); /* delay slot */ |
1206 | break; | 1229 | break; |
1207 | case BPF_S_RET_K: | 1230 | case BPF_RET | BPF_K: |
1208 | /* | 1231 | /* |
1209 | * It can emit two instructions so it does not fit on | 1232 | * It can emit two instructions so it does not fit on |
1210 | * the delay slot. | 1233 | * the delay slot. |
@@ -1219,19 +1242,18 @@ jmp_cmp: | |||
1219 | emit_nop(ctx); | 1242 | emit_nop(ctx); |
1220 | } | 1243 | } |
1221 | break; | 1244 | break; |
1222 | case BPF_S_MISC_TAX: | 1245 | case BPF_MISC | BPF_TAX: |
1223 | /* X = A */ | 1246 | /* X = A */ |
1224 | ctx->flags |= SEEN_X | SEEN_A; | 1247 | ctx->flags |= SEEN_X | SEEN_A; |
1225 | emit_jit_reg_move(r_X, r_A, ctx); | 1248 | emit_jit_reg_move(r_X, r_A, ctx); |
1226 | break; | 1249 | break; |
1227 | case BPF_S_MISC_TXA: | 1250 | case BPF_MISC | BPF_TXA: |
1228 | /* A = X */ | 1251 | /* A = X */ |
1229 | ctx->flags |= SEEN_A | SEEN_X; | 1252 | ctx->flags |= SEEN_A | SEEN_X; |
1230 | update_on_xread(ctx); | ||
1231 | emit_jit_reg_move(r_A, r_X, ctx); | 1253 | emit_jit_reg_move(r_A, r_X, ctx); |
1232 | break; | 1254 | break; |
1233 | /* AUX */ | 1255 | /* AUX */ |
1234 | case BPF_S_ANC_PROTOCOL: | 1256 | case BPF_ANC | SKF_AD_PROTOCOL: |
1235 | /* A = ntohs(skb->protocol */ | 1257 | /* A = ntohs(skb->protocol */ |
1236 | ctx->flags |= SEEN_SKB | SEEN_OFF | SEEN_A; | 1258 | ctx->flags |= SEEN_SKB | SEEN_OFF | SEEN_A; |
1237 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | 1259 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
@@ -1256,7 +1278,7 @@ jmp_cmp: | |||
1256 | } | 1278 | } |
1257 | #endif | 1279 | #endif |
1258 | break; | 1280 | break; |
1259 | case BPF_S_ANC_CPU: | 1281 | case BPF_ANC | SKF_AD_CPU: |
1260 | ctx->flags |= SEEN_A | SEEN_OFF; | 1282 | ctx->flags |= SEEN_A | SEEN_OFF; |
1261 | /* A = current_thread_info()->cpu */ | 1283 | /* A = current_thread_info()->cpu */ |
1262 | BUILD_BUG_ON(FIELD_SIZEOF(struct thread_info, | 1284 | BUILD_BUG_ON(FIELD_SIZEOF(struct thread_info, |
@@ -1265,11 +1287,12 @@ jmp_cmp: | |||
1265 | /* $28/gp points to the thread_info struct */ | 1287 | /* $28/gp points to the thread_info struct */ |
1266 | emit_load(r_A, 28, off, ctx); | 1288 | emit_load(r_A, 28, off, ctx); |
1267 | break; | 1289 | break; |
1268 | case BPF_S_ANC_IFINDEX: | 1290 | case BPF_ANC | SKF_AD_IFINDEX: |
1269 | /* A = skb->dev->ifindex */ | 1291 | /* A = skb->dev->ifindex */ |
1270 | ctx->flags |= SEEN_SKB | SEEN_A | SEEN_S0; | 1292 | ctx->flags |= SEEN_SKB | SEEN_A | SEEN_S0; |
1271 | off = offsetof(struct sk_buff, dev); | 1293 | off = offsetof(struct sk_buff, dev); |
1272 | emit_load(r_s0, r_skb, off, ctx); | 1294 | /* Load *dev pointer */ |
1295 | emit_load_ptr(r_s0, r_skb, off, ctx); | ||
1273 | /* error (0) in the delay slot */ | 1296 | /* error (0) in the delay slot */ |
1274 | emit_bcond(MIPS_COND_EQ, r_s0, r_zero, | 1297 | emit_bcond(MIPS_COND_EQ, r_s0, r_zero, |
1275 | b_imm(prog->len, ctx), ctx); | 1298 | b_imm(prog->len, ctx), ctx); |
@@ -1279,31 +1302,36 @@ jmp_cmp: | |||
1279 | off = offsetof(struct net_device, ifindex); | 1302 | off = offsetof(struct net_device, ifindex); |
1280 | emit_load(r_A, r_s0, off, ctx); | 1303 | emit_load(r_A, r_s0, off, ctx); |
1281 | break; | 1304 | break; |
1282 | case BPF_S_ANC_MARK: | 1305 | case BPF_ANC | SKF_AD_MARK: |
1283 | ctx->flags |= SEEN_SKB | SEEN_A; | 1306 | ctx->flags |= SEEN_SKB | SEEN_A; |
1284 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4); | 1307 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4); |
1285 | off = offsetof(struct sk_buff, mark); | 1308 | off = offsetof(struct sk_buff, mark); |
1286 | emit_load(r_A, r_skb, off, ctx); | 1309 | emit_load(r_A, r_skb, off, ctx); |
1287 | break; | 1310 | break; |
1288 | case BPF_S_ANC_RXHASH: | 1311 | case BPF_ANC | SKF_AD_RXHASH: |
1289 | ctx->flags |= SEEN_SKB | SEEN_A; | 1312 | ctx->flags |= SEEN_SKB | SEEN_A; |
1290 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4); | 1313 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4); |
1291 | off = offsetof(struct sk_buff, hash); | 1314 | off = offsetof(struct sk_buff, hash); |
1292 | emit_load(r_A, r_skb, off, ctx); | 1315 | emit_load(r_A, r_skb, off, ctx); |
1293 | break; | 1316 | break; |
1294 | case BPF_S_ANC_VLAN_TAG: | 1317 | case BPF_ANC | SKF_AD_VLAN_TAG: |
1295 | case BPF_S_ANC_VLAN_TAG_PRESENT: | 1318 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: |
1296 | ctx->flags |= SEEN_SKB | SEEN_S0 | SEEN_A; | 1319 | ctx->flags |= SEEN_SKB | SEEN_S0 | SEEN_A; |
1297 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | 1320 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
1298 | vlan_tci) != 2); | 1321 | vlan_tci) != 2); |
1299 | off = offsetof(struct sk_buff, vlan_tci); | 1322 | off = offsetof(struct sk_buff, vlan_tci); |
1300 | emit_half_load(r_s0, r_skb, off, ctx); | 1323 | emit_half_load(r_s0, r_skb, off, ctx); |
1301 | if (inst->code == BPF_S_ANC_VLAN_TAG) | 1324 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) { |
1302 | emit_and(r_A, r_s0, VLAN_VID_MASK, ctx); | 1325 | emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx); |
1303 | else | 1326 | } else { |
1304 | emit_and(r_A, r_s0, VLAN_TAG_PRESENT, ctx); | 1327 | emit_andi(r_A, r_s0, VLAN_TAG_PRESENT, ctx); |
1328 | /* return 1 if present */ | ||
1329 | emit_sltu(r_A, r_zero, r_A, ctx); | ||
1330 | } | ||
1305 | break; | 1331 | break; |
1306 | case BPF_S_ANC_PKTTYPE: | 1332 | case BPF_ANC | SKF_AD_PKTTYPE: |
1333 | ctx->flags |= SEEN_SKB; | ||
1334 | |||
1307 | off = pkt_type_offset(); | 1335 | off = pkt_type_offset(); |
1308 | 1336 | ||
1309 | if (off < 0) | 1337 | if (off < 0) |
@@ -1311,8 +1339,12 @@ jmp_cmp: | |||
1311 | emit_load_byte(r_tmp, r_skb, off, ctx); | 1339 | emit_load_byte(r_tmp, r_skb, off, ctx); |
1312 | /* Keep only the last 3 bits */ | 1340 | /* Keep only the last 3 bits */ |
1313 | emit_andi(r_A, r_tmp, PKT_TYPE_MAX, ctx); | 1341 | emit_andi(r_A, r_tmp, PKT_TYPE_MAX, ctx); |
1342 | #ifdef __BIG_ENDIAN_BITFIELD | ||
1343 | /* Get the actual packet type to the lower 3 bits */ | ||
1344 | emit_srl(r_A, r_A, 5, ctx); | ||
1345 | #endif | ||
1314 | break; | 1346 | break; |
1315 | case BPF_S_ANC_QUEUE: | 1347 | case BPF_ANC | SKF_AD_QUEUE: |
1316 | ctx->flags |= SEEN_SKB | SEEN_A; | 1348 | ctx->flags |= SEEN_SKB | SEEN_A; |
1317 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | 1349 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
1318 | queue_mapping) != 2); | 1350 | queue_mapping) != 2); |
@@ -1322,8 +1354,8 @@ jmp_cmp: | |||
1322 | emit_half_load(r_A, r_skb, off, ctx); | 1354 | emit_half_load(r_A, r_skb, off, ctx); |
1323 | break; | 1355 | break; |
1324 | default: | 1356 | default: |
1325 | pr_warn("%s: Unhandled opcode: 0x%02x\n", __FILE__, | 1357 | pr_debug("%s: Unhandled opcode: 0x%02x\n", __FILE__, |
1326 | inst->code); | 1358 | inst->code); |
1327 | return -1; | 1359 | return -1; |
1328 | } | 1360 | } |
1329 | } | 1361 | } |
diff --git a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c index 608716f8496b..af3bc359dc70 100644 --- a/arch/parisc/kernel/hardware.c +++ b/arch/parisc/kernel/hardware.c | |||
@@ -1210,7 +1210,8 @@ static struct hp_hardware hp_hardware_list[] = { | |||
1210 | {HPHW_FIO, 0x004, 0x00320, 0x0, "Metheus Frame Buffer"}, | 1210 | {HPHW_FIO, 0x004, 0x00320, 0x0, "Metheus Frame Buffer"}, |
1211 | {HPHW_FIO, 0x004, 0x00340, 0x0, "BARCO CX4500 VME Grphx Cnsl"}, | 1211 | {HPHW_FIO, 0x004, 0x00340, 0x0, "BARCO CX4500 VME Grphx Cnsl"}, |
1212 | {HPHW_FIO, 0x004, 0x00360, 0x0, "Hughes TOG VME FDDI"}, | 1212 | {HPHW_FIO, 0x004, 0x00360, 0x0, "Hughes TOG VME FDDI"}, |
1213 | {HPHW_FIO, 0x076, 0x000AD, 0x00, "Crestone Peak RS-232"}, | 1213 | {HPHW_FIO, 0x076, 0x000AD, 0x0, "Crestone Peak Core RS-232"}, |
1214 | {HPHW_FIO, 0x077, 0x000AD, 0x0, "Crestone Peak Fast? Core RS-232"}, | ||
1214 | {HPHW_IOA, 0x185, 0x0000B, 0x00, "Java BC Summit Port"}, | 1215 | {HPHW_IOA, 0x185, 0x0000B, 0x00, "Java BC Summit Port"}, |
1215 | {HPHW_IOA, 0x1FF, 0x0000B, 0x00, "Hitachi Ghostview Summit Port"}, | 1216 | {HPHW_IOA, 0x1FF, 0x0000B, 0x00, "Hitachi Ghostview Summit Port"}, |
1216 | {HPHW_IOA, 0x580, 0x0000B, 0x10, "U2-IOA BC Runway Port"}, | 1217 | {HPHW_IOA, 0x580, 0x0000B, 0x10, "U2-IOA BC Runway Port"}, |
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c index bb9f3b64de55..93c1963d76fe 100644 --- a/arch/parisc/kernel/sys_parisc32.c +++ b/arch/parisc/kernel/sys_parisc32.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 2000-2001 Hewlett Packard Company | 4 | * Copyright (C) 2000-2001 Hewlett Packard Company |
5 | * Copyright (C) 2000 John Marvin | 5 | * Copyright (C) 2000 John Marvin |
6 | * Copyright (C) 2001 Matthew Wilcox | 6 | * Copyright (C) 2001 Matthew Wilcox |
7 | * Copyright (C) 2014 Helge Deller <deller@gmx.de> | ||
7 | * | 8 | * |
8 | * These routines maintain argument size conversion between 32bit and 64bit | 9 | * These routines maintain argument size conversion between 32bit and 64bit |
9 | * environment. Based heavily on sys_ia32.c and sys_sparc32.c. | 10 | * environment. Based heavily on sys_ia32.c and sys_sparc32.c. |
@@ -11,44 +12,8 @@ | |||
11 | 12 | ||
12 | #include <linux/compat.h> | 13 | #include <linux/compat.h> |
13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
14 | #include <linux/sched.h> | ||
15 | #include <linux/fs.h> | ||
16 | #include <linux/mm.h> | ||
17 | #include <linux/file.h> | ||
18 | #include <linux/signal.h> | ||
19 | #include <linux/resource.h> | ||
20 | #include <linux/times.h> | ||
21 | #include <linux/time.h> | ||
22 | #include <linux/smp.h> | ||
23 | #include <linux/sem.h> | ||
24 | #include <linux/shm.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/uio.h> | ||
27 | #include <linux/ncp_fs.h> | ||
28 | #include <linux/poll.h> | ||
29 | #include <linux/personality.h> | ||
30 | #include <linux/stat.h> | ||
31 | #include <linux/highmem.h> | ||
32 | #include <linux/highuid.h> | ||
33 | #include <linux/mman.h> | ||
34 | #include <linux/binfmts.h> | ||
35 | #include <linux/namei.h> | ||
36 | #include <linux/vfs.h> | ||
37 | #include <linux/ptrace.h> | ||
38 | #include <linux/swap.h> | ||
39 | #include <linux/syscalls.h> | 15 | #include <linux/syscalls.h> |
40 | 16 | ||
41 | #include <asm/types.h> | ||
42 | #include <asm/uaccess.h> | ||
43 | #include <asm/mmu_context.h> | ||
44 | |||
45 | #undef DEBUG | ||
46 | |||
47 | #ifdef DEBUG | ||
48 | #define DBG(x) printk x | ||
49 | #else | ||
50 | #define DBG(x) | ||
51 | #endif | ||
52 | 17 | ||
53 | asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23, | 18 | asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23, |
54 | int r22, int r21, int r20) | 19 | int r22, int r21, int r20) |
@@ -57,3 +22,12 @@ asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23, | |||
57 | current->comm, current->pid, r20); | 22 | current->comm, current->pid, r20); |
58 | return -ENOSYS; | 23 | return -ENOSYS; |
59 | } | 24 | } |
25 | |||
26 | asmlinkage long sys32_fanotify_mark(compat_int_t fanotify_fd, compat_uint_t flags, | ||
27 | compat_uint_t mask0, compat_uint_t mask1, compat_int_t dfd, | ||
28 | const char __user * pathname) | ||
29 | { | ||
30 | return sys_fanotify_mark(fanotify_fd, flags, | ||
31 | ((__u64)mask1 << 32) | mask0, | ||
32 | dfd, pathname); | ||
33 | } | ||
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index c5fa7a697fba..84c5d3a58fa1 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
@@ -418,7 +418,7 @@ | |||
418 | ENTRY_SAME(accept4) /* 320 */ | 418 | ENTRY_SAME(accept4) /* 320 */ |
419 | ENTRY_SAME(prlimit64) | 419 | ENTRY_SAME(prlimit64) |
420 | ENTRY_SAME(fanotify_init) | 420 | ENTRY_SAME(fanotify_init) |
421 | ENTRY_COMP(fanotify_mark) | 421 | ENTRY_DIFF(fanotify_mark) |
422 | ENTRY_COMP(clock_adjtime) | 422 | ENTRY_COMP(clock_adjtime) |
423 | ENTRY_SAME(name_to_handle_at) /* 325 */ | 423 | ENTRY_SAME(name_to_handle_at) /* 325 */ |
424 | ENTRY_COMP(open_by_handle_at) | 424 | ENTRY_COMP(open_by_handle_at) |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index bd6dd6ed3a9f..fefe7c8bf05f 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -414,7 +414,7 @@ config KEXEC | |||
414 | config CRASH_DUMP | 414 | config CRASH_DUMP |
415 | bool "Build a kdump crash kernel" | 415 | bool "Build a kdump crash kernel" |
416 | depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP) | 416 | depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP) |
417 | select RELOCATABLE if PPC64 || 44x || FSL_BOOKE | 417 | select RELOCATABLE if (PPC64 && !COMPILE_TEST) || 44x || FSL_BOOKE |
418 | help | 418 | help |
419 | Build a kernel suitable for use as a kdump capture kernel. | 419 | Build a kernel suitable for use as a kdump capture kernel. |
420 | The same kernel binary can be used as production kernel and dump | 420 | The same kernel binary can be used as production kernel and dump |
@@ -1017,6 +1017,7 @@ endmenu | |||
1017 | if PPC64 | 1017 | if PPC64 |
1018 | config RELOCATABLE | 1018 | config RELOCATABLE |
1019 | bool "Build a relocatable kernel" | 1019 | bool "Build a relocatable kernel" |
1020 | depends on !COMPILE_TEST | ||
1020 | select NONSTATIC_KERNEL | 1021 | select NONSTATIC_KERNEL |
1021 | help | 1022 | help |
1022 | This builds a kernel image that is capable of running anywhere | 1023 | This builds a kernel image that is capable of running anywhere |
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug index 790352f93700..35d16bd2760b 100644 --- a/arch/powerpc/Kconfig.debug +++ b/arch/powerpc/Kconfig.debug | |||
@@ -303,7 +303,6 @@ config PPC_EARLY_DEBUG_OPAL_VTERMNO | |||
303 | This correspond to which /dev/hvcN you want to use for early | 303 | This correspond to which /dev/hvcN you want to use for early |
304 | debug. | 304 | debug. |
305 | 305 | ||
306 | On OPAL v1 (takeover) this should always be 0 | ||
307 | On OPAL v2, this will be 0 for network console and 1 or 2 for | 306 | On OPAL v2, this will be 0 for network console and 1 or 2 for |
308 | the machine built-in serial ports. | 307 | the machine built-in serial ports. |
309 | 308 | ||
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h index 37991e154ef8..840a5509b3f1 100644 --- a/arch/powerpc/include/asm/code-patching.h +++ b/arch/powerpc/include/asm/code-patching.h | |||
@@ -88,4 +88,15 @@ static inline unsigned long ppc_function_entry(void *func) | |||
88 | #endif | 88 | #endif |
89 | } | 89 | } |
90 | 90 | ||
91 | static inline unsigned long ppc_global_function_entry(void *func) | ||
92 | { | ||
93 | #if defined(CONFIG_PPC64) && defined(_CALL_ELF) && _CALL_ELF == 2 | ||
94 | /* PPC64 ABIv2 the global entry point is at the address */ | ||
95 | return (unsigned long)func; | ||
96 | #else | ||
97 | /* All other cases there is no change vs ppc_function_entry() */ | ||
98 | return ppc_function_entry(func); | ||
99 | #endif | ||
100 | } | ||
101 | |||
91 | #endif /* _ASM_POWERPC_CODE_PATCHING_H */ | 102 | #endif /* _ASM_POWERPC_CODE_PATCHING_H */ |
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index f8d1d6dcf7db..e61f24ed4e65 100644 --- a/arch/powerpc/include/asm/mmu.h +++ b/arch/powerpc/include/asm/mmu.h | |||
@@ -19,8 +19,7 @@ | |||
19 | #define MMU_FTR_TYPE_40x ASM_CONST(0x00000004) | 19 | #define MMU_FTR_TYPE_40x ASM_CONST(0x00000004) |
20 | #define MMU_FTR_TYPE_44x ASM_CONST(0x00000008) | 20 | #define MMU_FTR_TYPE_44x ASM_CONST(0x00000008) |
21 | #define MMU_FTR_TYPE_FSL_E ASM_CONST(0x00000010) | 21 | #define MMU_FTR_TYPE_FSL_E ASM_CONST(0x00000010) |
22 | #define MMU_FTR_TYPE_3E ASM_CONST(0x00000020) | 22 | #define MMU_FTR_TYPE_47x ASM_CONST(0x00000020) |
23 | #define MMU_FTR_TYPE_47x ASM_CONST(0x00000040) | ||
24 | 23 | ||
25 | /* | 24 | /* |
26 | * This is individual features | 25 | * This is individual features |
@@ -106,13 +105,6 @@ | |||
106 | MMU_FTR_CI_LARGE_PAGE | 105 | MMU_FTR_CI_LARGE_PAGE |
107 | #define MMU_FTRS_PA6T MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ | 106 | #define MMU_FTRS_PA6T MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ |
108 | MMU_FTR_CI_LARGE_PAGE | MMU_FTR_NO_SLBIE_B | 107 | MMU_FTR_CI_LARGE_PAGE | MMU_FTR_NO_SLBIE_B |
109 | #define MMU_FTRS_A2 MMU_FTR_TYPE_3E | MMU_FTR_USE_TLBILX | \ | ||
110 | MMU_FTR_USE_TLBIVAX_BCAST | \ | ||
111 | MMU_FTR_LOCK_BCAST_INVAL | \ | ||
112 | MMU_FTR_USE_TLBRSRV | \ | ||
113 | MMU_FTR_USE_PAIRED_MAS | \ | ||
114 | MMU_FTR_TLBIEL | \ | ||
115 | MMU_FTR_16M_PAGE | ||
116 | #ifndef __ASSEMBLY__ | 108 | #ifndef __ASSEMBLY__ |
117 | #include <asm/cputable.h> | 109 | #include <asm/cputable.h> |
118 | 110 | ||
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 460018889ba9..0da1dbd42e02 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
@@ -12,27 +12,7 @@ | |||
12 | #ifndef __OPAL_H | 12 | #ifndef __OPAL_H |
13 | #define __OPAL_H | 13 | #define __OPAL_H |
14 | 14 | ||
15 | /****** Takeover interface ********/ | ||
16 | |||
17 | /* PAPR H-Call used to querty the HAL existence and/or instanciate | ||
18 | * it from within pHyp (tech preview only). | ||
19 | * | ||
20 | * This is exclusively used in prom_init.c | ||
21 | */ | ||
22 | |||
23 | #ifndef __ASSEMBLY__ | 15 | #ifndef __ASSEMBLY__ |
24 | |||
25 | struct opal_takeover_args { | ||
26 | u64 k_image; /* r4 */ | ||
27 | u64 k_size; /* r5 */ | ||
28 | u64 k_entry; /* r6 */ | ||
29 | u64 k_entry2; /* r7 */ | ||
30 | u64 hal_addr; /* r8 */ | ||
31 | u64 rd_image; /* r9 */ | ||
32 | u64 rd_size; /* r10 */ | ||
33 | u64 rd_loc; /* r11 */ | ||
34 | }; | ||
35 | |||
36 | /* | 16 | /* |
37 | * SG entry | 17 | * SG entry |
38 | * | 18 | * |
@@ -55,15 +35,6 @@ struct opal_sg_list { | |||
55 | /* We calculate number of sg entries based on PAGE_SIZE */ | 35 | /* We calculate number of sg entries based on PAGE_SIZE */ |
56 | #define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry)) | 36 | #define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry)) |
57 | 37 | ||
58 | extern long opal_query_takeover(u64 *hal_size, u64 *hal_align); | ||
59 | |||
60 | extern long opal_do_takeover(struct opal_takeover_args *args); | ||
61 | |||
62 | struct rtas_args; | ||
63 | extern int opal_enter_rtas(struct rtas_args *args, | ||
64 | unsigned long data, | ||
65 | unsigned long entry); | ||
66 | |||
67 | #endif /* __ASSEMBLY__ */ | 38 | #endif /* __ASSEMBLY__ */ |
68 | 39 | ||
69 | /****** OPAL APIs ******/ | 40 | /****** OPAL APIs ******/ |
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h index 9ed737146dbb..b3e936027b26 100644 --- a/arch/powerpc/include/asm/perf_event_server.h +++ b/arch/powerpc/include/asm/perf_event_server.h | |||
@@ -61,8 +61,7 @@ struct power_pmu { | |||
61 | #define PPMU_SIAR_VALID 0x00000010 /* Processor has SIAR Valid bit */ | 61 | #define PPMU_SIAR_VALID 0x00000010 /* Processor has SIAR Valid bit */ |
62 | #define PPMU_HAS_SSLOT 0x00000020 /* Has sampled slot in MMCRA */ | 62 | #define PPMU_HAS_SSLOT 0x00000020 /* Has sampled slot in MMCRA */ |
63 | #define PPMU_HAS_SIER 0x00000040 /* Has SIER */ | 63 | #define PPMU_HAS_SIER 0x00000040 /* Has SIER */ |
64 | #define PPMU_BHRB 0x00000080 /* has BHRB feature enabled */ | 64 | #define PPMU_ARCH_207S 0x00000080 /* PMC is architecture v2.07S */ |
65 | #define PPMU_EBB 0x00000100 /* supports event based branch */ | ||
66 | 65 | ||
67 | /* | 66 | /* |
68 | * Values for flags to get_alternatives() | 67 | * Values for flags to get_alternatives() |
diff --git a/arch/powerpc/include/asm/swab.h b/arch/powerpc/include/asm/swab.h index b9bd1ca944d0..96f59de61855 100644 --- a/arch/powerpc/include/asm/swab.h +++ b/arch/powerpc/include/asm/swab.h | |||
@@ -9,10 +9,6 @@ | |||
9 | 9 | ||
10 | #include <uapi/asm/swab.h> | 10 | #include <uapi/asm/swab.h> |
11 | 11 | ||
12 | #ifdef __GNUC__ | ||
13 | #ifndef __powerpc64__ | ||
14 | #endif /* __powerpc64__ */ | ||
15 | |||
16 | static __inline__ __u16 ld_le16(const volatile __u16 *addr) | 12 | static __inline__ __u16 ld_le16(const volatile __u16 *addr) |
17 | { | 13 | { |
18 | __u16 val; | 14 | __u16 val; |
@@ -20,19 +16,12 @@ static __inline__ __u16 ld_le16(const volatile __u16 *addr) | |||
20 | __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); | 16 | __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); |
21 | return val; | 17 | return val; |
22 | } | 18 | } |
23 | #define __arch_swab16p ld_le16 | ||
24 | 19 | ||
25 | static __inline__ void st_le16(volatile __u16 *addr, const __u16 val) | 20 | static __inline__ void st_le16(volatile __u16 *addr, const __u16 val) |
26 | { | 21 | { |
27 | __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); | 22 | __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); |
28 | } | 23 | } |
29 | 24 | ||
30 | static inline void __arch_swab16s(__u16 *addr) | ||
31 | { | ||
32 | st_le16(addr, *addr); | ||
33 | } | ||
34 | #define __arch_swab16s __arch_swab16s | ||
35 | |||
36 | static __inline__ __u32 ld_le32(const volatile __u32 *addr) | 25 | static __inline__ __u32 ld_le32(const volatile __u32 *addr) |
37 | { | 26 | { |
38 | __u32 val; | 27 | __u32 val; |
@@ -40,42 +29,10 @@ static __inline__ __u32 ld_le32(const volatile __u32 *addr) | |||
40 | __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); | 29 | __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); |
41 | return val; | 30 | return val; |
42 | } | 31 | } |
43 | #define __arch_swab32p ld_le32 | ||
44 | 32 | ||
45 | static __inline__ void st_le32(volatile __u32 *addr, const __u32 val) | 33 | static __inline__ void st_le32(volatile __u32 *addr, const __u32 val) |
46 | { | 34 | { |
47 | __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); | 35 | __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); |
48 | } | 36 | } |
49 | 37 | ||
50 | static inline void __arch_swab32s(__u32 *addr) | ||
51 | { | ||
52 | st_le32(addr, *addr); | ||
53 | } | ||
54 | #define __arch_swab32s __arch_swab32s | ||
55 | |||
56 | static inline __attribute_const__ __u16 __arch_swab16(__u16 value) | ||
57 | { | ||
58 | __u16 result; | ||
59 | |||
60 | __asm__("rlwimi %0,%1,8,16,23" | ||
61 | : "=r" (result) | ||
62 | : "r" (value), "0" (value >> 8)); | ||
63 | return result; | ||
64 | } | ||
65 | #define __arch_swab16 __arch_swab16 | ||
66 | |||
67 | static inline __attribute_const__ __u32 __arch_swab32(__u32 value) | ||
68 | { | ||
69 | __u32 result; | ||
70 | |||
71 | __asm__("rlwimi %0,%1,24,16,23\n\t" | ||
72 | "rlwimi %0,%1,8,8,15\n\t" | ||
73 | "rlwimi %0,%1,24,0,7" | ||
74 | : "=r" (result) | ||
75 | : "r" (value), "0" (value >> 24)); | ||
76 | return result; | ||
77 | } | ||
78 | #define __arch_swab32 __arch_swab32 | ||
79 | |||
80 | #endif /* __GNUC__ */ | ||
81 | #endif /* _ASM_POWERPC_SWAB_H */ | 38 | #endif /* _ASM_POWERPC_SWAB_H */ |
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index f202d0731b06..d178834fe508 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/kernel/ftrace.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define pr_fmt(fmt) "ftrace-powerpc: " fmt | ||
14 | |||
13 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
14 | #include <linux/hardirq.h> | 16 | #include <linux/hardirq.h> |
15 | #include <linux/uaccess.h> | 17 | #include <linux/uaccess.h> |
@@ -105,7 +107,7 @@ __ftrace_make_nop(struct module *mod, | |||
105 | struct dyn_ftrace *rec, unsigned long addr) | 107 | struct dyn_ftrace *rec, unsigned long addr) |
106 | { | 108 | { |
107 | unsigned int op; | 109 | unsigned int op; |
108 | unsigned long ptr; | 110 | unsigned long entry, ptr; |
109 | unsigned long ip = rec->ip; | 111 | unsigned long ip = rec->ip; |
110 | void *tramp; | 112 | void *tramp; |
111 | 113 | ||
@@ -115,7 +117,7 @@ __ftrace_make_nop(struct module *mod, | |||
115 | 117 | ||
116 | /* Make sure that that this is still a 24bit jump */ | 118 | /* Make sure that that this is still a 24bit jump */ |
117 | if (!is_bl_op(op)) { | 119 | if (!is_bl_op(op)) { |
118 | printk(KERN_ERR "Not expected bl: opcode is %x\n", op); | 120 | pr_err("Not expected bl: opcode is %x\n", op); |
119 | return -EINVAL; | 121 | return -EINVAL; |
120 | } | 122 | } |
121 | 123 | ||
@@ -125,21 +127,21 @@ __ftrace_make_nop(struct module *mod, | |||
125 | pr_devel("ip:%lx jumps to %p", ip, tramp); | 127 | pr_devel("ip:%lx jumps to %p", ip, tramp); |
126 | 128 | ||
127 | if (!is_module_trampoline(tramp)) { | 129 | if (!is_module_trampoline(tramp)) { |
128 | printk(KERN_ERR "Not a trampoline\n"); | 130 | pr_err("Not a trampoline\n"); |
129 | return -EINVAL; | 131 | return -EINVAL; |
130 | } | 132 | } |
131 | 133 | ||
132 | if (module_trampoline_target(mod, tramp, &ptr)) { | 134 | if (module_trampoline_target(mod, tramp, &ptr)) { |
133 | printk(KERN_ERR "Failed to get trampoline target\n"); | 135 | pr_err("Failed to get trampoline target\n"); |
134 | return -EFAULT; | 136 | return -EFAULT; |
135 | } | 137 | } |
136 | 138 | ||
137 | pr_devel("trampoline target %lx", ptr); | 139 | pr_devel("trampoline target %lx", ptr); |
138 | 140 | ||
141 | entry = ppc_global_function_entry((void *)addr); | ||
139 | /* This should match what was called */ | 142 | /* This should match what was called */ |
140 | if (ptr != ppc_function_entry((void *)addr)) { | 143 | if (ptr != entry) { |
141 | printk(KERN_ERR "addr %lx does not match expected %lx\n", | 144 | pr_err("addr %lx does not match expected %lx\n", ptr, entry); |
142 | ptr, ppc_function_entry((void *)addr)); | ||
143 | return -EINVAL; | 145 | return -EINVAL; |
144 | } | 146 | } |
145 | 147 | ||
@@ -179,7 +181,7 @@ __ftrace_make_nop(struct module *mod, | |||
179 | 181 | ||
180 | /* Make sure that that this is still a 24bit jump */ | 182 | /* Make sure that that this is still a 24bit jump */ |
181 | if (!is_bl_op(op)) { | 183 | if (!is_bl_op(op)) { |
182 | printk(KERN_ERR "Not expected bl: opcode is %x\n", op); | 184 | pr_err("Not expected bl: opcode is %x\n", op); |
183 | return -EINVAL; | 185 | return -EINVAL; |
184 | } | 186 | } |
185 | 187 | ||
@@ -198,7 +200,7 @@ __ftrace_make_nop(struct module *mod, | |||
198 | 200 | ||
199 | /* Find where the trampoline jumps to */ | 201 | /* Find where the trampoline jumps to */ |
200 | if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) { | 202 | if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) { |
201 | printk(KERN_ERR "Failed to read %lx\n", tramp); | 203 | pr_err("Failed to read %lx\n", tramp); |
202 | return -EFAULT; | 204 | return -EFAULT; |
203 | } | 205 | } |
204 | 206 | ||
@@ -209,7 +211,7 @@ __ftrace_make_nop(struct module *mod, | |||
209 | ((jmp[1] & 0xffff0000) != 0x398c0000) || | 211 | ((jmp[1] & 0xffff0000) != 0x398c0000) || |
210 | (jmp[2] != 0x7d8903a6) || | 212 | (jmp[2] != 0x7d8903a6) || |
211 | (jmp[3] != 0x4e800420)) { | 213 | (jmp[3] != 0x4e800420)) { |
212 | printk(KERN_ERR "Not a trampoline\n"); | 214 | pr_err("Not a trampoline\n"); |
213 | return -EINVAL; | 215 | return -EINVAL; |
214 | } | 216 | } |
215 | 217 | ||
@@ -221,8 +223,7 @@ __ftrace_make_nop(struct module *mod, | |||
221 | pr_devel(" %lx ", tramp); | 223 | pr_devel(" %lx ", tramp); |
222 | 224 | ||
223 | if (tramp != addr) { | 225 | if (tramp != addr) { |
224 | printk(KERN_ERR | 226 | pr_err("Trampoline location %08lx does not match addr\n", |
225 | "Trampoline location %08lx does not match addr\n", | ||
226 | tramp); | 227 | tramp); |
227 | return -EINVAL; | 228 | return -EINVAL; |
228 | } | 229 | } |
@@ -263,15 +264,13 @@ int ftrace_make_nop(struct module *mod, | |||
263 | */ | 264 | */ |
264 | if (!rec->arch.mod) { | 265 | if (!rec->arch.mod) { |
265 | if (!mod) { | 266 | if (!mod) { |
266 | printk(KERN_ERR "No module loaded addr=%lx\n", | 267 | pr_err("No module loaded addr=%lx\n", addr); |
267 | addr); | ||
268 | return -EFAULT; | 268 | return -EFAULT; |
269 | } | 269 | } |
270 | rec->arch.mod = mod; | 270 | rec->arch.mod = mod; |
271 | } else if (mod) { | 271 | } else if (mod) { |
272 | if (mod != rec->arch.mod) { | 272 | if (mod != rec->arch.mod) { |
273 | printk(KERN_ERR | 273 | pr_err("Record mod %p not equal to passed in mod %p\n", |
274 | "Record mod %p not equal to passed in mod %p\n", | ||
275 | rec->arch.mod, mod); | 274 | rec->arch.mod, mod); |
276 | return -EINVAL; | 275 | return -EINVAL; |
277 | } | 276 | } |
@@ -307,26 +306,25 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
307 | * The load offset is different depending on the ABI. For simplicity | 306 | * The load offset is different depending on the ABI. For simplicity |
308 | * just mask it out when doing the compare. | 307 | * just mask it out when doing the compare. |
309 | */ | 308 | */ |
310 | if ((op[0] != 0x48000008) || ((op[1] & 0xffff00000) != 0xe8410000)) { | 309 | if ((op[0] != 0x48000008) || ((op[1] & 0xffff0000) != 0xe8410000)) { |
311 | printk(KERN_ERR "Unexpected call sequence: %x %x\n", | 310 | pr_err("Unexpected call sequence: %x %x\n", op[0], op[1]); |
312 | op[0], op[1]); | ||
313 | return -EINVAL; | 311 | return -EINVAL; |
314 | } | 312 | } |
315 | 313 | ||
316 | /* If we never set up a trampoline to ftrace_caller, then bail */ | 314 | /* If we never set up a trampoline to ftrace_caller, then bail */ |
317 | if (!rec->arch.mod->arch.tramp) { | 315 | if (!rec->arch.mod->arch.tramp) { |
318 | printk(KERN_ERR "No ftrace trampoline\n"); | 316 | pr_err("No ftrace trampoline\n"); |
319 | return -EINVAL; | 317 | return -EINVAL; |
320 | } | 318 | } |
321 | 319 | ||
322 | /* Ensure branch is within 24 bits */ | 320 | /* Ensure branch is within 24 bits */ |
323 | if (create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { | 321 | if (!create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { |
324 | printk(KERN_ERR "Branch out of range"); | 322 | pr_err("Branch out of range\n"); |
325 | return -EINVAL; | 323 | return -EINVAL; |
326 | } | 324 | } |
327 | 325 | ||
328 | if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { | 326 | if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { |
329 | printk(KERN_ERR "REL24 out of range!\n"); | 327 | pr_err("REL24 out of range!\n"); |
330 | return -EINVAL; | 328 | return -EINVAL; |
331 | } | 329 | } |
332 | 330 | ||
@@ -345,13 +343,13 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
345 | 343 | ||
346 | /* It should be pointing to a nop */ | 344 | /* It should be pointing to a nop */ |
347 | if (op != PPC_INST_NOP) { | 345 | if (op != PPC_INST_NOP) { |
348 | printk(KERN_ERR "Expected NOP but have %x\n", op); | 346 | pr_err("Expected NOP but have %x\n", op); |
349 | return -EINVAL; | 347 | return -EINVAL; |
350 | } | 348 | } |
351 | 349 | ||
352 | /* If we never set up a trampoline to ftrace_caller, then bail */ | 350 | /* If we never set up a trampoline to ftrace_caller, then bail */ |
353 | if (!rec->arch.mod->arch.tramp) { | 351 | if (!rec->arch.mod->arch.tramp) { |
354 | printk(KERN_ERR "No ftrace trampoline\n"); | 352 | pr_err("No ftrace trampoline\n"); |
355 | return -EINVAL; | 353 | return -EINVAL; |
356 | } | 354 | } |
357 | 355 | ||
@@ -359,7 +357,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
359 | op = create_branch((unsigned int *)ip, | 357 | op = create_branch((unsigned int *)ip, |
360 | rec->arch.mod->arch.tramp, BRANCH_SET_LINK); | 358 | rec->arch.mod->arch.tramp, BRANCH_SET_LINK); |
361 | if (!op) { | 359 | if (!op) { |
362 | printk(KERN_ERR "REL24 out of range!\n"); | 360 | pr_err("REL24 out of range!\n"); |
363 | return -EINVAL; | 361 | return -EINVAL; |
364 | } | 362 | } |
365 | 363 | ||
@@ -397,7 +395,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
397 | * already have a module defined. | 395 | * already have a module defined. |
398 | */ | 396 | */ |
399 | if (!rec->arch.mod) { | 397 | if (!rec->arch.mod) { |
400 | printk(KERN_ERR "No module loaded\n"); | 398 | pr_err("No module loaded\n"); |
401 | return -EINVAL; | 399 | return -EINVAL; |
402 | } | 400 | } |
403 | 401 | ||
diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S index 2480256272d4..5cf3d367190d 100644 --- a/arch/powerpc/kernel/idle_power7.S +++ b/arch/powerpc/kernel/idle_power7.S | |||
@@ -131,7 +131,7 @@ _GLOBAL(power7_nap) | |||
131 | 131 | ||
132 | _GLOBAL(power7_sleep) | 132 | _GLOBAL(power7_sleep) |
133 | li r3,1 | 133 | li r3,1 |
134 | li r4,0 | 134 | li r4,1 |
135 | b power7_powersave_common | 135 | b power7_powersave_common |
136 | /* No return */ | 136 | /* No return */ |
137 | 137 | ||
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c index b82227e7e21b..12e48d56f771 100644 --- a/arch/powerpc/kernel/iomap.c +++ b/arch/powerpc/kernel/iomap.c | |||
@@ -23,7 +23,7 @@ unsigned int ioread16(void __iomem *addr) | |||
23 | } | 23 | } |
24 | unsigned int ioread16be(void __iomem *addr) | 24 | unsigned int ioread16be(void __iomem *addr) |
25 | { | 25 | { |
26 | return in_be16(addr); | 26 | return readw_be(addr); |
27 | } | 27 | } |
28 | unsigned int ioread32(void __iomem *addr) | 28 | unsigned int ioread32(void __iomem *addr) |
29 | { | 29 | { |
@@ -31,7 +31,7 @@ unsigned int ioread32(void __iomem *addr) | |||
31 | } | 31 | } |
32 | unsigned int ioread32be(void __iomem *addr) | 32 | unsigned int ioread32be(void __iomem *addr) |
33 | { | 33 | { |
34 | return in_be32(addr); | 34 | return readl_be(addr); |
35 | } | 35 | } |
36 | EXPORT_SYMBOL(ioread8); | 36 | EXPORT_SYMBOL(ioread8); |
37 | EXPORT_SYMBOL(ioread16); | 37 | EXPORT_SYMBOL(ioread16); |
@@ -49,7 +49,7 @@ void iowrite16(u16 val, void __iomem *addr) | |||
49 | } | 49 | } |
50 | void iowrite16be(u16 val, void __iomem *addr) | 50 | void iowrite16be(u16 val, void __iomem *addr) |
51 | { | 51 | { |
52 | out_be16(addr, val); | 52 | writew_be(val, addr); |
53 | } | 53 | } |
54 | void iowrite32(u32 val, void __iomem *addr) | 54 | void iowrite32(u32 val, void __iomem *addr) |
55 | { | 55 | { |
@@ -57,7 +57,7 @@ void iowrite32(u32 val, void __iomem *addr) | |||
57 | } | 57 | } |
58 | void iowrite32be(u32 val, void __iomem *addr) | 58 | void iowrite32be(u32 val, void __iomem *addr) |
59 | { | 59 | { |
60 | out_be32(addr, val); | 60 | writel_be(val, addr); |
61 | } | 61 | } |
62 | EXPORT_SYMBOL(iowrite8); | 62 | EXPORT_SYMBOL(iowrite8); |
63 | EXPORT_SYMBOL(iowrite16); | 63 | EXPORT_SYMBOL(iowrite16); |
@@ -75,15 +75,15 @@ EXPORT_SYMBOL(iowrite32be); | |||
75 | */ | 75 | */ |
76 | void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) | 76 | void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) |
77 | { | 77 | { |
78 | _insb((u8 __iomem *) addr, dst, count); | 78 | readsb(addr, dst, count); |
79 | } | 79 | } |
80 | void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) | 80 | void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) |
81 | { | 81 | { |
82 | _insw_ns((u16 __iomem *) addr, dst, count); | 82 | readsw(addr, dst, count); |
83 | } | 83 | } |
84 | void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) | 84 | void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) |
85 | { | 85 | { |
86 | _insl_ns((u32 __iomem *) addr, dst, count); | 86 | readsl(addr, dst, count); |
87 | } | 87 | } |
88 | EXPORT_SYMBOL(ioread8_rep); | 88 | EXPORT_SYMBOL(ioread8_rep); |
89 | EXPORT_SYMBOL(ioread16_rep); | 89 | EXPORT_SYMBOL(ioread16_rep); |
@@ -91,15 +91,15 @@ EXPORT_SYMBOL(ioread32_rep); | |||
91 | 91 | ||
92 | void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) | 92 | void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) |
93 | { | 93 | { |
94 | _outsb((u8 __iomem *) addr, src, count); | 94 | writesb(addr, src, count); |
95 | } | 95 | } |
96 | void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) | 96 | void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) |
97 | { | 97 | { |
98 | _outsw_ns((u16 __iomem *) addr, src, count); | 98 | writesw(addr, src, count); |
99 | } | 99 | } |
100 | void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) | 100 | void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) |
101 | { | 101 | { |
102 | _outsl_ns((u32 __iomem *) addr, src, count); | 102 | writesl(addr, src, count); |
103 | } | 103 | } |
104 | EXPORT_SYMBOL(iowrite8_rep); | 104 | EXPORT_SYMBOL(iowrite8_rep); |
105 | EXPORT_SYMBOL(iowrite16_rep); | 105 | EXPORT_SYMBOL(iowrite16_rep); |
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 90fab64d911d..2f72af82513c 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/kdebug.h> | 33 | #include <linux/kdebug.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <asm/code-patching.h> | ||
35 | #include <asm/cacheflush.h> | 36 | #include <asm/cacheflush.h> |
36 | #include <asm/sstep.h> | 37 | #include <asm/sstep.h> |
37 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
@@ -491,12 +492,10 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, | |||
491 | return ret; | 492 | return ret; |
492 | } | 493 | } |
493 | 494 | ||
494 | #ifdef CONFIG_PPC64 | ||
495 | unsigned long arch_deref_entry_point(void *entry) | 495 | unsigned long arch_deref_entry_point(void *entry) |
496 | { | 496 | { |
497 | return ((func_descr_t *)entry)->entry; | 497 | return ppc_global_function_entry(entry); |
498 | } | 498 | } |
499 | #endif | ||
500 | 499 | ||
501 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | 500 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) |
502 | { | 501 | { |
@@ -508,8 +507,12 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | |||
508 | /* setup return addr to the jprobe handler routine */ | 507 | /* setup return addr to the jprobe handler routine */ |
509 | regs->nip = arch_deref_entry_point(jp->entry); | 508 | regs->nip = arch_deref_entry_point(jp->entry); |
510 | #ifdef CONFIG_PPC64 | 509 | #ifdef CONFIG_PPC64 |
510 | #if defined(_CALL_ELF) && _CALL_ELF == 2 | ||
511 | regs->gpr[12] = (unsigned long)jp->entry; | ||
512 | #else | ||
511 | regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc); | 513 | regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc); |
512 | #endif | 514 | #endif |
515 | #endif | ||
513 | 516 | ||
514 | return 1; | 517 | return 1; |
515 | } | 518 | } |
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index 077d2ce6c5a7..d807ee626af9 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c | |||
@@ -315,8 +315,17 @@ static void dedotify_versions(struct modversion_info *vers, | |||
315 | struct modversion_info *end; | 315 | struct modversion_info *end; |
316 | 316 | ||
317 | for (end = (void *)vers + size; vers < end; vers++) | 317 | for (end = (void *)vers + size; vers < end; vers++) |
318 | if (vers->name[0] == '.') | 318 | if (vers->name[0] == '.') { |
319 | memmove(vers->name, vers->name+1, strlen(vers->name)); | 319 | memmove(vers->name, vers->name+1, strlen(vers->name)); |
320 | #ifdef ARCH_RELOCATES_KCRCTAB | ||
321 | /* The TOC symbol has no CRC computed. To avoid CRC | ||
322 | * check failing, we must force it to the expected | ||
323 | * value (see CRC check in module.c). | ||
324 | */ | ||
325 | if (!strcmp(vers->name, "TOC.")) | ||
326 | vers->crc = -(unsigned long)reloc_start; | ||
327 | #endif | ||
328 | } | ||
320 | } | 329 | } |
321 | 330 | ||
322 | /* Undefined symbols which refer to .funcname, hack to funcname (or .TOC.) */ | 331 | /* Undefined symbols which refer to .funcname, hack to funcname (or .TOC.) */ |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 613a860a203c..b694b0730971 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -662,13 +662,6 @@ void __init early_init_devtree(void *params) | |||
662 | of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL); | 662 | of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL); |
663 | #endif | 663 | #endif |
664 | 664 | ||
665 | /* Pre-initialize the cmd_line with the content of boot_commmand_line, | ||
666 | * which will be empty except when the content of the variable has | ||
667 | * been overriden by a bootloading mechanism. This happens typically | ||
668 | * with HAL takeover | ||
669 | */ | ||
670 | strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE); | ||
671 | |||
672 | /* Retrieve various informations from the /chosen node of the | 665 | /* Retrieve various informations from the /chosen node of the |
673 | * device-tree, including the platform type, initrd location and | 666 | * device-tree, including the platform type, initrd location and |
674 | * size, TCE reserve, and more ... | 667 | * size, TCE reserve, and more ... |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 078145acf7fb..1a85d8f96739 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -1268,201 +1268,6 @@ static u64 __initdata prom_opal_base; | |||
1268 | static u64 __initdata prom_opal_entry; | 1268 | static u64 __initdata prom_opal_entry; |
1269 | #endif | 1269 | #endif |
1270 | 1270 | ||
1271 | #ifdef __BIG_ENDIAN__ | ||
1272 | /* XXX Don't change this structure without updating opal-takeover.S */ | ||
1273 | static struct opal_secondary_data { | ||
1274 | s64 ack; /* 0 */ | ||
1275 | u64 go; /* 8 */ | ||
1276 | struct opal_takeover_args args; /* 16 */ | ||
1277 | } opal_secondary_data; | ||
1278 | |||
1279 | static u64 __initdata prom_opal_align; | ||
1280 | static u64 __initdata prom_opal_size; | ||
1281 | static int __initdata prom_rtas_start_cpu; | ||
1282 | static u64 __initdata prom_rtas_data; | ||
1283 | static u64 __initdata prom_rtas_entry; | ||
1284 | |||
1285 | extern char opal_secondary_entry; | ||
1286 | |||
1287 | static void __init prom_query_opal(void) | ||
1288 | { | ||
1289 | long rc; | ||
1290 | |||
1291 | /* We must not query for OPAL presence on a machine that | ||
1292 | * supports TNK takeover (970 blades), as this uses the same | ||
1293 | * h-call with different arguments and will crash | ||
1294 | */ | ||
1295 | if (PHANDLE_VALID(call_prom("finddevice", 1, 1, | ||
1296 | ADDR("/tnk-memory-map")))) { | ||
1297 | prom_printf("TNK takeover detected, skipping OPAL check\n"); | ||
1298 | return; | ||
1299 | } | ||
1300 | |||
1301 | prom_printf("Querying for OPAL presence... "); | ||
1302 | |||
1303 | rc = opal_query_takeover(&prom_opal_size, | ||
1304 | &prom_opal_align); | ||
1305 | prom_debug("(rc = %ld) ", rc); | ||
1306 | if (rc != 0) { | ||
1307 | prom_printf("not there.\n"); | ||
1308 | return; | ||
1309 | } | ||
1310 | of_platform = PLATFORM_OPAL; | ||
1311 | prom_printf(" there !\n"); | ||
1312 | prom_debug(" opal_size = 0x%lx\n", prom_opal_size); | ||
1313 | prom_debug(" opal_align = 0x%lx\n", prom_opal_align); | ||
1314 | if (prom_opal_align < 0x10000) | ||
1315 | prom_opal_align = 0x10000; | ||
1316 | } | ||
1317 | |||
1318 | static int __init prom_rtas_call(int token, int nargs, int nret, | ||
1319 | int *outputs, ...) | ||
1320 | { | ||
1321 | struct rtas_args rtas_args; | ||
1322 | va_list list; | ||
1323 | int i; | ||
1324 | |||
1325 | rtas_args.token = token; | ||
1326 | rtas_args.nargs = nargs; | ||
1327 | rtas_args.nret = nret; | ||
1328 | rtas_args.rets = (rtas_arg_t *)&(rtas_args.args[nargs]); | ||
1329 | va_start(list, outputs); | ||
1330 | for (i = 0; i < nargs; ++i) | ||
1331 | rtas_args.args[i] = va_arg(list, rtas_arg_t); | ||
1332 | va_end(list); | ||
1333 | |||
1334 | for (i = 0; i < nret; ++i) | ||
1335 | rtas_args.rets[i] = 0; | ||
1336 | |||
1337 | opal_enter_rtas(&rtas_args, prom_rtas_data, | ||
1338 | prom_rtas_entry); | ||
1339 | |||
1340 | if (nret > 1 && outputs != NULL) | ||
1341 | for (i = 0; i < nret-1; ++i) | ||
1342 | outputs[i] = rtas_args.rets[i+1]; | ||
1343 | return (nret > 0)? rtas_args.rets[0]: 0; | ||
1344 | } | ||
1345 | |||
1346 | static void __init prom_opal_hold_cpus(void) | ||
1347 | { | ||
1348 | int i, cnt, cpu, rc; | ||
1349 | long j; | ||
1350 | phandle node; | ||
1351 | char type[64]; | ||
1352 | u32 servers[8]; | ||
1353 | void *entry = (unsigned long *)&opal_secondary_entry; | ||
1354 | struct opal_secondary_data *data = &opal_secondary_data; | ||
1355 | |||
1356 | prom_debug("prom_opal_hold_cpus: start...\n"); | ||
1357 | prom_debug(" - entry = 0x%x\n", entry); | ||
1358 | prom_debug(" - data = 0x%x\n", data); | ||
1359 | |||
1360 | data->ack = -1; | ||
1361 | data->go = 0; | ||
1362 | |||
1363 | /* look for cpus */ | ||
1364 | for (node = 0; prom_next_node(&node); ) { | ||
1365 | type[0] = 0; | ||
1366 | prom_getprop(node, "device_type", type, sizeof(type)); | ||
1367 | if (strcmp(type, "cpu") != 0) | ||
1368 | continue; | ||
1369 | |||
1370 | /* Skip non-configured cpus. */ | ||
1371 | if (prom_getprop(node, "status", type, sizeof(type)) > 0) | ||
1372 | if (strcmp(type, "okay") != 0) | ||
1373 | continue; | ||
1374 | |||
1375 | cnt = prom_getprop(node, "ibm,ppc-interrupt-server#s", servers, | ||
1376 | sizeof(servers)); | ||
1377 | if (cnt == PROM_ERROR) | ||
1378 | break; | ||
1379 | cnt >>= 2; | ||
1380 | for (i = 0; i < cnt; i++) { | ||
1381 | cpu = servers[i]; | ||
1382 | prom_debug("CPU %d ... ", cpu); | ||
1383 | if (cpu == prom.cpu) { | ||
1384 | prom_debug("booted !\n"); | ||
1385 | continue; | ||
1386 | } | ||
1387 | prom_debug("starting ... "); | ||
1388 | |||
1389 | /* Init the acknowledge var which will be reset by | ||
1390 | * the secondary cpu when it awakens from its OF | ||
1391 | * spinloop. | ||
1392 | */ | ||
1393 | data->ack = -1; | ||
1394 | rc = prom_rtas_call(prom_rtas_start_cpu, 3, 1, | ||
1395 | NULL, cpu, entry, data); | ||
1396 | prom_debug("rtas rc=%d ...", rc); | ||
1397 | |||
1398 | for (j = 0; j < 100000000 && data->ack == -1; j++) { | ||
1399 | HMT_low(); | ||
1400 | mb(); | ||
1401 | } | ||
1402 | HMT_medium(); | ||
1403 | if (data->ack != -1) | ||
1404 | prom_debug("done, PIR=0x%x\n", data->ack); | ||
1405 | else | ||
1406 | prom_debug("timeout !\n"); | ||
1407 | } | ||
1408 | } | ||
1409 | prom_debug("prom_opal_hold_cpus: end...\n"); | ||
1410 | } | ||
1411 | |||
1412 | static void __init prom_opal_takeover(void) | ||
1413 | { | ||
1414 | struct opal_secondary_data *data = &opal_secondary_data; | ||
1415 | struct opal_takeover_args *args = &data->args; | ||
1416 | u64 align = prom_opal_align; | ||
1417 | u64 top_addr, opal_addr; | ||
1418 | |||
1419 | args->k_image = (u64)_stext; | ||
1420 | args->k_size = _end - _stext; | ||
1421 | args->k_entry = 0; | ||
1422 | args->k_entry2 = 0x60; | ||
1423 | |||
1424 | top_addr = _ALIGN_UP(args->k_size, align); | ||
1425 | |||
1426 | if (prom_initrd_start != 0) { | ||
1427 | args->rd_image = prom_initrd_start; | ||
1428 | args->rd_size = prom_initrd_end - args->rd_image; | ||
1429 | args->rd_loc = top_addr; | ||
1430 | top_addr = _ALIGN_UP(args->rd_loc + args->rd_size, align); | ||
1431 | } | ||
1432 | |||
1433 | /* Pickup an address for the HAL. We want to go really high | ||
1434 | * up to avoid problem with future kexecs. On the other hand | ||
1435 | * we don't want to be all over the TCEs on P5IOC2 machines | ||
1436 | * which are going to be up there too. We assume the machine | ||
1437 | * has plenty of memory, and we ask for the HAL for now to | ||
1438 | * be just below the 1G point, or above the initrd | ||
1439 | */ | ||
1440 | opal_addr = _ALIGN_DOWN(0x40000000 - prom_opal_size, align); | ||
1441 | if (opal_addr < top_addr) | ||
1442 | opal_addr = top_addr; | ||
1443 | args->hal_addr = opal_addr; | ||
1444 | |||
1445 | /* Copy the command line to the kernel image */ | ||
1446 | strlcpy(boot_command_line, prom_cmd_line, | ||
1447 | COMMAND_LINE_SIZE); | ||
1448 | |||
1449 | prom_debug(" k_image = 0x%lx\n", args->k_image); | ||
1450 | prom_debug(" k_size = 0x%lx\n", args->k_size); | ||
1451 | prom_debug(" k_entry = 0x%lx\n", args->k_entry); | ||
1452 | prom_debug(" k_entry2 = 0x%lx\n", args->k_entry2); | ||
1453 | prom_debug(" hal_addr = 0x%lx\n", args->hal_addr); | ||
1454 | prom_debug(" rd_image = 0x%lx\n", args->rd_image); | ||
1455 | prom_debug(" rd_size = 0x%lx\n", args->rd_size); | ||
1456 | prom_debug(" rd_loc = 0x%lx\n", args->rd_loc); | ||
1457 | prom_printf("Performing OPAL takeover,this can take a few minutes..\n"); | ||
1458 | prom_close_stdin(); | ||
1459 | mb(); | ||
1460 | data->go = 1; | ||
1461 | for (;;) | ||
1462 | opal_do_takeover(args); | ||
1463 | } | ||
1464 | #endif /* __BIG_ENDIAN__ */ | ||
1465 | |||
1466 | /* | 1271 | /* |
1467 | * Allocate room for and instantiate OPAL | 1272 | * Allocate room for and instantiate OPAL |
1468 | */ | 1273 | */ |
@@ -1597,12 +1402,6 @@ static void __init prom_instantiate_rtas(void) | |||
1597 | &val, sizeof(val)) != PROM_ERROR) | 1402 | &val, sizeof(val)) != PROM_ERROR) |
1598 | rtas_has_query_cpu_stopped = true; | 1403 | rtas_has_query_cpu_stopped = true; |
1599 | 1404 | ||
1600 | #if defined(CONFIG_PPC_POWERNV) && defined(__BIG_ENDIAN__) | ||
1601 | /* PowerVN takeover hack */ | ||
1602 | prom_rtas_data = base; | ||
1603 | prom_rtas_entry = entry; | ||
1604 | prom_getprop(rtas_node, "start-cpu", &prom_rtas_start_cpu, 4); | ||
1605 | #endif | ||
1606 | prom_debug("rtas base = 0x%x\n", base); | 1405 | prom_debug("rtas base = 0x%x\n", base); |
1607 | prom_debug("rtas entry = 0x%x\n", entry); | 1406 | prom_debug("rtas entry = 0x%x\n", entry); |
1608 | prom_debug("rtas size = 0x%x\n", (long)size); | 1407 | prom_debug("rtas size = 0x%x\n", (long)size); |
@@ -3027,16 +2826,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
3027 | prom_instantiate_rtas(); | 2826 | prom_instantiate_rtas(); |
3028 | 2827 | ||
3029 | #ifdef CONFIG_PPC_POWERNV | 2828 | #ifdef CONFIG_PPC_POWERNV |
3030 | #ifdef __BIG_ENDIAN__ | ||
3031 | /* Detect HAL and try instanciating it & doing takeover */ | ||
3032 | if (of_platform == PLATFORM_PSERIES_LPAR) { | ||
3033 | prom_query_opal(); | ||
3034 | if (of_platform == PLATFORM_OPAL) { | ||
3035 | prom_opal_hold_cpus(); | ||
3036 | prom_opal_takeover(); | ||
3037 | } | ||
3038 | } else | ||
3039 | #endif /* __BIG_ENDIAN__ */ | ||
3040 | if (of_platform == PLATFORM_OPAL) | 2829 | if (of_platform == PLATFORM_OPAL) |
3041 | prom_instantiate_opal(); | 2830 | prom_instantiate_opal(); |
3042 | #endif /* CONFIG_PPC_POWERNV */ | 2831 | #endif /* CONFIG_PPC_POWERNV */ |
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh index 77aa1e95e904..fe8e54b9ef7d 100644 --- a/arch/powerpc/kernel/prom_init_check.sh +++ b/arch/powerpc/kernel/prom_init_check.sh | |||
@@ -21,9 +21,7 @@ _end enter_prom memcpy memset reloc_offset __secondary_hold | |||
21 | __secondary_hold_acknowledge __secondary_hold_spinloop __start | 21 | __secondary_hold_acknowledge __secondary_hold_spinloop __start |
22 | strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224 | 22 | strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224 |
23 | reloc_got2 kernstart_addr memstart_addr linux_banner _stext | 23 | reloc_got2 kernstart_addr memstart_addr linux_banner _stext |
24 | opal_query_takeover opal_do_takeover opal_enter_rtas opal_secondary_entry | 24 | __prom_init_toc_start __prom_init_toc_end btext_setup_display TOC." |
25 | boot_command_line __prom_init_toc_start __prom_init_toc_end | ||
26 | btext_setup_display TOC." | ||
27 | 25 | ||
28 | NM="$1" | 26 | NM="$1" |
29 | OBJ="$2" | 27 | OBJ="$2" |
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index e239df3768ac..e5b022c55ccd 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -469,9 +469,17 @@ void __init smp_setup_cpu_maps(void) | |||
469 | } | 469 | } |
470 | 470 | ||
471 | for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) { | 471 | for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) { |
472 | bool avail; | ||
473 | |||
472 | DBG(" thread %d -> cpu %d (hard id %d)\n", | 474 | DBG(" thread %d -> cpu %d (hard id %d)\n", |
473 | j, cpu, be32_to_cpu(intserv[j])); | 475 | j, cpu, be32_to_cpu(intserv[j])); |
474 | set_cpu_present(cpu, of_device_is_available(dn)); | 476 | |
477 | avail = of_device_is_available(dn); | ||
478 | if (!avail) | ||
479 | avail = !of_property_match_string(dn, | ||
480 | "enable-method", "spin-table"); | ||
481 | |||
482 | set_cpu_present(cpu, avail); | ||
475 | set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j])); | 483 | set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j])); |
476 | set_cpu_possible(cpu, true); | 484 | set_cpu_possible(cpu, true); |
477 | cpu++; | 485 | cpu++; |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 4e47db686b5d..1bc5a1755ed4 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -54,7 +54,6 @@ | |||
54 | 54 | ||
55 | #include "signal.h" | 55 | #include "signal.h" |
56 | 56 | ||
57 | #undef DEBUG_SIG | ||
58 | 57 | ||
59 | #ifdef CONFIG_PPC64 | 58 | #ifdef CONFIG_PPC64 |
60 | #define sys_rt_sigreturn compat_sys_rt_sigreturn | 59 | #define sys_rt_sigreturn compat_sys_rt_sigreturn |
@@ -1063,10 +1062,6 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka, | |||
1063 | return 1; | 1062 | return 1; |
1064 | 1063 | ||
1065 | badframe: | 1064 | badframe: |
1066 | #ifdef DEBUG_SIG | ||
1067 | printk("badframe in handle_rt_signal, regs=%p frame=%p newsp=%lx\n", | ||
1068 | regs, frame, newsp); | ||
1069 | #endif | ||
1070 | if (show_unhandled_signals) | 1065 | if (show_unhandled_signals) |
1071 | printk_ratelimited(KERN_INFO | 1066 | printk_ratelimited(KERN_INFO |
1072 | "%s[%d]: bad frame in handle_rt_signal32: " | 1067 | "%s[%d]: bad frame in handle_rt_signal32: " |
@@ -1484,10 +1479,6 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka, | |||
1484 | return 1; | 1479 | return 1; |
1485 | 1480 | ||
1486 | badframe: | 1481 | badframe: |
1487 | #ifdef DEBUG_SIG | ||
1488 | printk("badframe in handle_signal, regs=%p frame=%p newsp=%lx\n", | ||
1489 | regs, frame, newsp); | ||
1490 | #endif | ||
1491 | if (show_unhandled_signals) | 1482 | if (show_unhandled_signals) |
1492 | printk_ratelimited(KERN_INFO | 1483 | printk_ratelimited(KERN_INFO |
1493 | "%s[%d]: bad frame in handle_signal32: " | 1484 | "%s[%d]: bad frame in handle_signal32: " |
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index d501dc4dc3e6..97c1e4b683fc 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
@@ -38,7 +38,6 @@ | |||
38 | 38 | ||
39 | #include "signal.h" | 39 | #include "signal.h" |
40 | 40 | ||
41 | #define DEBUG_SIG 0 | ||
42 | 41 | ||
43 | #define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs)) | 42 | #define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs)) |
44 | #define FP_REGS_SIZE sizeof(elf_fpregset_t) | 43 | #define FP_REGS_SIZE sizeof(elf_fpregset_t) |
@@ -700,10 +699,6 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5, | |||
700 | return 0; | 699 | return 0; |
701 | 700 | ||
702 | badframe: | 701 | badframe: |
703 | #if DEBUG_SIG | ||
704 | printk("badframe in sys_rt_sigreturn, regs=%p uc=%p &uc->uc_mcontext=%p\n", | ||
705 | regs, uc, &uc->uc_mcontext); | ||
706 | #endif | ||
707 | if (show_unhandled_signals) | 702 | if (show_unhandled_signals) |
708 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, | 703 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, |
709 | current->comm, current->pid, "rt_sigreturn", | 704 | current->comm, current->pid, "rt_sigreturn", |
@@ -809,10 +804,6 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info, | |||
809 | return 1; | 804 | return 1; |
810 | 805 | ||
811 | badframe: | 806 | badframe: |
812 | #if DEBUG_SIG | ||
813 | printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n", | ||
814 | regs, frame, newsp); | ||
815 | #endif | ||
816 | if (show_unhandled_signals) | 807 | if (show_unhandled_signals) |
817 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, | 808 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, |
818 | current->comm, current->pid, "setup_rt_frame", | 809 | current->comm, current->pid, "setup_rt_frame", |
diff --git a/arch/powerpc/kvm/book3s_hv_interrupts.S b/arch/powerpc/kvm/book3s_hv_interrupts.S index 8c86422a1e37..731be7478b27 100644 --- a/arch/powerpc/kvm/book3s_hv_interrupts.S +++ b/arch/powerpc/kvm/book3s_hv_interrupts.S | |||
@@ -127,11 +127,6 @@ BEGIN_FTR_SECTION | |||
127 | stw r10, HSTATE_PMC + 24(r13) | 127 | stw r10, HSTATE_PMC + 24(r13) |
128 | stw r11, HSTATE_PMC + 28(r13) | 128 | stw r11, HSTATE_PMC + 28(r13) |
129 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) | 129 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) |
130 | BEGIN_FTR_SECTION | ||
131 | mfspr r9, SPRN_SIER | ||
132 | std r8, HSTATE_MMCR + 40(r13) | ||
133 | std r9, HSTATE_MMCR + 48(r13) | ||
134 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | ||
135 | 31: | 130 | 31: |
136 | 131 | ||
137 | /* | 132 | /* |
diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c index af3d78e19302..928ebe79668b 100644 --- a/arch/powerpc/mm/mmu_context_nohash.c +++ b/arch/powerpc/mm/mmu_context_nohash.c | |||
@@ -410,17 +410,7 @@ void __init mmu_context_init(void) | |||
410 | } else if (mmu_has_feature(MMU_FTR_TYPE_47x)) { | 410 | } else if (mmu_has_feature(MMU_FTR_TYPE_47x)) { |
411 | first_context = 1; | 411 | first_context = 1; |
412 | last_context = 65535; | 412 | last_context = 65535; |
413 | } else | 413 | } else { |
414 | #ifdef CONFIG_PPC_BOOK3E_MMU | ||
415 | if (mmu_has_feature(MMU_FTR_TYPE_3E)) { | ||
416 | u32 mmucfg = mfspr(SPRN_MMUCFG); | ||
417 | u32 pid_bits = (mmucfg & MMUCFG_PIDSIZE_MASK) | ||
418 | >> MMUCFG_PIDSIZE_SHIFT; | ||
419 | first_context = 1; | ||
420 | last_context = (1UL << (pid_bits + 1)) - 1; | ||
421 | } else | ||
422 | #endif | ||
423 | { | ||
424 | first_context = 1; | 414 | first_context = 1; |
425 | last_context = 255; | 415 | last_context = 255; |
426 | } | 416 | } |
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 4520c9356b54..6b0641c3f03f 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c | |||
@@ -485,7 +485,7 @@ static bool is_ebb_event(struct perf_event *event) | |||
485 | * check that the PMU supports EBB, meaning those that don't can still | 485 | * check that the PMU supports EBB, meaning those that don't can still |
486 | * use bit 63 of the event code for something else if they wish. | 486 | * use bit 63 of the event code for something else if they wish. |
487 | */ | 487 | */ |
488 | return (ppmu->flags & PPMU_EBB) && | 488 | return (ppmu->flags & PPMU_ARCH_207S) && |
489 | ((event->attr.config >> PERF_EVENT_CONFIG_EBB_SHIFT) & 1); | 489 | ((event->attr.config >> PERF_EVENT_CONFIG_EBB_SHIFT) & 1); |
490 | } | 490 | } |
491 | 491 | ||
@@ -777,7 +777,7 @@ void perf_event_print_debug(void) | |||
777 | if (ppmu->flags & PPMU_HAS_SIER) | 777 | if (ppmu->flags & PPMU_HAS_SIER) |
778 | sier = mfspr(SPRN_SIER); | 778 | sier = mfspr(SPRN_SIER); |
779 | 779 | ||
780 | if (ppmu->flags & PPMU_EBB) { | 780 | if (ppmu->flags & PPMU_ARCH_207S) { |
781 | pr_info("MMCR2: %016lx EBBHR: %016lx\n", | 781 | pr_info("MMCR2: %016lx EBBHR: %016lx\n", |
782 | mfspr(SPRN_MMCR2), mfspr(SPRN_EBBHR)); | 782 | mfspr(SPRN_MMCR2), mfspr(SPRN_EBBHR)); |
783 | pr_info("EBBRR: %016lx BESCR: %016lx\n", | 783 | pr_info("EBBRR: %016lx BESCR: %016lx\n", |
@@ -996,7 +996,22 @@ static void power_pmu_read(struct perf_event *event) | |||
996 | } while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev); | 996 | } while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev); |
997 | 997 | ||
998 | local64_add(delta, &event->count); | 998 | local64_add(delta, &event->count); |
999 | local64_sub(delta, &event->hw.period_left); | 999 | |
1000 | /* | ||
1001 | * A number of places program the PMC with (0x80000000 - period_left). | ||
1002 | * We never want period_left to be less than 1 because we will program | ||
1003 | * the PMC with a value >= 0x800000000 and an edge detected PMC will | ||
1004 | * roll around to 0 before taking an exception. We have seen this | ||
1005 | * on POWER8. | ||
1006 | * | ||
1007 | * To fix this, clamp the minimum value of period_left to 1. | ||
1008 | */ | ||
1009 | do { | ||
1010 | prev = local64_read(&event->hw.period_left); | ||
1011 | val = prev - delta; | ||
1012 | if (val < 1) | ||
1013 | val = 1; | ||
1014 | } while (local64_cmpxchg(&event->hw.period_left, prev, val) != prev); | ||
1000 | } | 1015 | } |
1001 | 1016 | ||
1002 | /* | 1017 | /* |
@@ -1300,6 +1315,9 @@ static void power_pmu_enable(struct pmu *pmu) | |||
1300 | 1315 | ||
1301 | write_mmcr0(cpuhw, mmcr0); | 1316 | write_mmcr0(cpuhw, mmcr0); |
1302 | 1317 | ||
1318 | if (ppmu->flags & PPMU_ARCH_207S) | ||
1319 | mtspr(SPRN_MMCR2, 0); | ||
1320 | |||
1303 | /* | 1321 | /* |
1304 | * Enable instruction sampling if necessary | 1322 | * Enable instruction sampling if necessary |
1305 | */ | 1323 | */ |
@@ -1696,7 +1714,7 @@ static int power_pmu_event_init(struct perf_event *event) | |||
1696 | 1714 | ||
1697 | if (has_branch_stack(event)) { | 1715 | if (has_branch_stack(event)) { |
1698 | /* PMU has BHRB enabled */ | 1716 | /* PMU has BHRB enabled */ |
1699 | if (!(ppmu->flags & PPMU_BHRB)) | 1717 | if (!(ppmu->flags & PPMU_ARCH_207S)) |
1700 | return -EOPNOTSUPP; | 1718 | return -EOPNOTSUPP; |
1701 | } | 1719 | } |
1702 | 1720 | ||
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c index fe2763b6e039..639cd9156585 100644 --- a/arch/powerpc/perf/power8-pmu.c +++ b/arch/powerpc/perf/power8-pmu.c | |||
@@ -792,7 +792,7 @@ static struct power_pmu power8_pmu = { | |||
792 | .get_constraint = power8_get_constraint, | 792 | .get_constraint = power8_get_constraint, |
793 | .get_alternatives = power8_get_alternatives, | 793 | .get_alternatives = power8_get_alternatives, |
794 | .disable_pmc = power8_disable_pmc, | 794 | .disable_pmc = power8_disable_pmc, |
795 | .flags = PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_BHRB | PPMU_EBB, | 795 | .flags = PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_ARCH_207S, |
796 | .n_generic = ARRAY_SIZE(power8_generic_events), | 796 | .n_generic = ARRAY_SIZE(power8_generic_events), |
797 | .generic_events = power8_generic_events, | 797 | .generic_events = power8_generic_events, |
798 | .cache_events = &power8_cache_events, | 798 | .cache_events = &power8_cache_events, |
diff --git a/arch/powerpc/platforms/cell/cbe_thermal.c b/arch/powerpc/platforms/cell/cbe_thermal.c index 94560db788bf..2c15ff094483 100644 --- a/arch/powerpc/platforms/cell/cbe_thermal.c +++ b/arch/powerpc/platforms/cell/cbe_thermal.c | |||
@@ -125,7 +125,7 @@ static ssize_t show_throttle(struct cbe_pmd_regs __iomem *pmd_regs, char *buf, i | |||
125 | static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char *buf, size_t size, int pos) | 125 | static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char *buf, size_t size, int pos) |
126 | { | 126 | { |
127 | u64 reg_value; | 127 | u64 reg_value; |
128 | int temp; | 128 | unsigned int temp; |
129 | u64 new_value; | 129 | u64 new_value; |
130 | int ret; | 130 | int ret; |
131 | 131 | ||
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c index 38e0a1a5cec3..5e6e0bad6db6 100644 --- a/arch/powerpc/platforms/cell/spu_syscalls.c +++ b/arch/powerpc/platforms/cell/spu_syscalls.c | |||
@@ -111,6 +111,7 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus) | |||
111 | return ret; | 111 | return ret; |
112 | } | 112 | } |
113 | 113 | ||
114 | #ifdef CONFIG_COREDUMP | ||
114 | int elf_coredump_extra_notes_size(void) | 115 | int elf_coredump_extra_notes_size(void) |
115 | { | 116 | { |
116 | struct spufs_calls *calls; | 117 | struct spufs_calls *calls; |
@@ -142,6 +143,7 @@ int elf_coredump_extra_notes_write(struct coredump_params *cprm) | |||
142 | 143 | ||
143 | return ret; | 144 | return ret; |
144 | } | 145 | } |
146 | #endif | ||
145 | 147 | ||
146 | void notify_spus_active(void) | 148 | void notify_spus_active(void) |
147 | { | 149 | { |
diff --git a/arch/powerpc/platforms/cell/spufs/Makefile b/arch/powerpc/platforms/cell/spufs/Makefile index b9d5d678aa44..52a7d2596d30 100644 --- a/arch/powerpc/platforms/cell/spufs/Makefile +++ b/arch/powerpc/platforms/cell/spufs/Makefile | |||
@@ -1,8 +1,9 @@ | |||
1 | 1 | ||
2 | obj-$(CONFIG_SPU_FS) += spufs.o | 2 | obj-$(CONFIG_SPU_FS) += spufs.o |
3 | spufs-y += inode.o file.o context.o syscalls.o coredump.o | 3 | spufs-y += inode.o file.o context.o syscalls.o |
4 | spufs-y += sched.o backing_ops.o hw_ops.o run.o gang.o | 4 | spufs-y += sched.o backing_ops.o hw_ops.o run.o gang.o |
5 | spufs-y += switch.o fault.o lscsa_alloc.o | 5 | spufs-y += switch.o fault.o lscsa_alloc.o |
6 | spufs-$(CONFIG_COREDUMP) += coredump.o | ||
6 | 7 | ||
7 | # magic for the trace events | 8 | # magic for the trace events |
8 | CFLAGS_sched.o := -I$(src) | 9 | CFLAGS_sched.o := -I$(src) |
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c index b045fdda4845..a87200a535fa 100644 --- a/arch/powerpc/platforms/cell/spufs/syscalls.c +++ b/arch/powerpc/platforms/cell/spufs/syscalls.c | |||
@@ -79,8 +79,10 @@ static long do_spu_create(const char __user *pathname, unsigned int flags, | |||
79 | struct spufs_calls spufs_calls = { | 79 | struct spufs_calls spufs_calls = { |
80 | .create_thread = do_spu_create, | 80 | .create_thread = do_spu_create, |
81 | .spu_run = do_spu_run, | 81 | .spu_run = do_spu_run, |
82 | .coredump_extra_notes_size = spufs_coredump_extra_notes_size, | ||
83 | .coredump_extra_notes_write = spufs_coredump_extra_notes_write, | ||
84 | .notify_spus_active = do_notify_spus_active, | 82 | .notify_spus_active = do_notify_spus_active, |
85 | .owner = THIS_MODULE, | 83 | .owner = THIS_MODULE, |
84 | #ifdef CONFIG_COREDUMP | ||
85 | .coredump_extra_notes_size = spufs_coredump_extra_notes_size, | ||
86 | .coredump_extra_notes_write = spufs_coredump_extra_notes_write, | ||
87 | #endif | ||
86 | }; | 88 | }; |
diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile index d55891f89a2c..4ad227d04c1a 100644 --- a/arch/powerpc/platforms/powernv/Makefile +++ b/arch/powerpc/platforms/powernv/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | obj-y += setup.o opal-takeover.o opal-wrappers.o opal.o opal-async.o | 1 | obj-y += setup.o opal-wrappers.o opal.o opal-async.o |
2 | obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o | 2 | obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o |
3 | obj-y += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o | 3 | obj-y += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o |
4 | obj-y += opal-msglog.o | 4 | obj-y += opal-msglog.o |
diff --git a/arch/powerpc/platforms/powernv/opal-takeover.S b/arch/powerpc/platforms/powernv/opal-takeover.S deleted file mode 100644 index 11a3169ee583..000000000000 --- a/arch/powerpc/platforms/powernv/opal-takeover.S +++ /dev/null | |||
@@ -1,140 +0,0 @@ | |||
1 | /* | ||
2 | * PowerNV OPAL takeover assembly code, for use by prom_init.c | ||
3 | * | ||
4 | * Copyright 2011 IBM Corp. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <asm/ppc_asm.h> | ||
13 | #include <asm/hvcall.h> | ||
14 | #include <asm/asm-offsets.h> | ||
15 | #include <asm/opal.h> | ||
16 | |||
17 | #define H_HAL_TAKEOVER 0x5124 | ||
18 | #define H_HAL_TAKEOVER_QUERY_MAGIC -1 | ||
19 | |||
20 | .text | ||
21 | _GLOBAL(opal_query_takeover) | ||
22 | mfcr r0 | ||
23 | stw r0,8(r1) | ||
24 | stdu r1,-STACKFRAMESIZE(r1) | ||
25 | std r3,STK_PARAM(R3)(r1) | ||
26 | std r4,STK_PARAM(R4)(r1) | ||
27 | li r3,H_HAL_TAKEOVER | ||
28 | li r4,H_HAL_TAKEOVER_QUERY_MAGIC | ||
29 | HVSC | ||
30 | addi r1,r1,STACKFRAMESIZE | ||
31 | ld r10,STK_PARAM(R3)(r1) | ||
32 | std r4,0(r10) | ||
33 | ld r10,STK_PARAM(R4)(r1) | ||
34 | std r5,0(r10) | ||
35 | lwz r0,8(r1) | ||
36 | mtcrf 0xff,r0 | ||
37 | blr | ||
38 | |||
39 | _GLOBAL(opal_do_takeover) | ||
40 | mfcr r0 | ||
41 | stw r0,8(r1) | ||
42 | mflr r0 | ||
43 | std r0,16(r1) | ||
44 | bl __opal_do_takeover | ||
45 | ld r0,16(r1) | ||
46 | mtlr r0 | ||
47 | lwz r0,8(r1) | ||
48 | mtcrf 0xff,r0 | ||
49 | blr | ||
50 | |||
51 | __opal_do_takeover: | ||
52 | ld r4,0(r3) | ||
53 | ld r5,0x8(r3) | ||
54 | ld r6,0x10(r3) | ||
55 | ld r7,0x18(r3) | ||
56 | ld r8,0x20(r3) | ||
57 | ld r9,0x28(r3) | ||
58 | ld r10,0x30(r3) | ||
59 | ld r11,0x38(r3) | ||
60 | li r3,H_HAL_TAKEOVER | ||
61 | HVSC | ||
62 | blr | ||
63 | |||
64 | .globl opal_secondary_entry | ||
65 | opal_secondary_entry: | ||
66 | mr r31,r3 | ||
67 | mfmsr r11 | ||
68 | li r12,(MSR_SF | MSR_ISF)@highest | ||
69 | sldi r12,r12,48 | ||
70 | or r11,r11,r12 | ||
71 | mtmsrd r11 | ||
72 | isync | ||
73 | mfspr r4,SPRN_PIR | ||
74 | std r4,0(r3) | ||
75 | 1: HMT_LOW | ||
76 | ld r4,8(r3) | ||
77 | cmpli cr0,r4,0 | ||
78 | beq 1b | ||
79 | HMT_MEDIUM | ||
80 | 1: addi r3,r31,16 | ||
81 | bl __opal_do_takeover | ||
82 | b 1b | ||
83 | |||
84 | _GLOBAL(opal_enter_rtas) | ||
85 | mflr r0 | ||
86 | std r0,16(r1) | ||
87 | stdu r1,-PROM_FRAME_SIZE(r1) /* Save SP and create stack space */ | ||
88 | |||
89 | /* Because PROM is running in 32b mode, it clobbers the high order half | ||
90 | * of all registers that it saves. We therefore save those registers | ||
91 | * PROM might touch to the stack. (r0, r3-r13 are caller saved) | ||
92 | */ | ||
93 | SAVE_GPR(2, r1) | ||
94 | SAVE_GPR(13, r1) | ||
95 | SAVE_8GPRS(14, r1) | ||
96 | SAVE_10GPRS(22, r1) | ||
97 | mfcr r10 | ||
98 | mfmsr r11 | ||
99 | std r10,_CCR(r1) | ||
100 | std r11,_MSR(r1) | ||
101 | |||
102 | /* Get the PROM entrypoint */ | ||
103 | mtlr r5 | ||
104 | |||
105 | /* Switch MSR to 32 bits mode | ||
106 | */ | ||
107 | li r12,1 | ||
108 | rldicr r12,r12,MSR_SF_LG,(63-MSR_SF_LG) | ||
109 | andc r11,r11,r12 | ||
110 | li r12,1 | ||
111 | rldicr r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG) | ||
112 | andc r11,r11,r12 | ||
113 | mtmsrd r11 | ||
114 | isync | ||
115 | |||
116 | /* Enter RTAS here... */ | ||
117 | blrl | ||
118 | |||
119 | /* Just make sure that r1 top 32 bits didn't get | ||
120 | * corrupt by OF | ||
121 | */ | ||
122 | rldicl r1,r1,0,32 | ||
123 | |||
124 | /* Restore the MSR (back to 64 bits) */ | ||
125 | ld r0,_MSR(r1) | ||
126 | MTMSRD(r0) | ||
127 | isync | ||
128 | |||
129 | /* Restore other registers */ | ||
130 | REST_GPR(2, r1) | ||
131 | REST_GPR(13, r1) | ||
132 | REST_8GPRS(14, r1) | ||
133 | REST_10GPRS(22, r1) | ||
134 | ld r4,_CCR(r1) | ||
135 | mtcr r4 | ||
136 | |||
137 | addi r1,r1,PROM_FRAME_SIZE | ||
138 | ld r0,16(r1) | ||
139 | mtlr r0 | ||
140 | blr | ||
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 62c47bb76517..9e5353ff6d1b 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c | |||
@@ -476,6 +476,11 @@ void __init alloc_dart_table(void) | |||
476 | */ | 476 | */ |
477 | dart_tablebase = (unsigned long) | 477 | dart_tablebase = (unsigned long) |
478 | __va(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); | 478 | __va(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); |
479 | /* | ||
480 | * The DART space is later unmapped from the kernel linear mapping and | ||
481 | * accessing dart_tablebase during kmemleak scanning will fault. | ||
482 | */ | ||
483 | kmemleak_no_scan((void *)dart_tablebase); | ||
479 | 484 | ||
480 | printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase); | 485 | printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase); |
481 | } | 486 | } |
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig index 8df022c43af7..fd09a10a2b53 100644 --- a/arch/s390/configs/default_defconfig +++ b/arch/s390/configs/default_defconfig | |||
@@ -45,7 +45,8 @@ CONFIG_SOLARIS_X86_PARTITION=y | |||
45 | CONFIG_UNIXWARE_DISKLABEL=y | 45 | CONFIG_UNIXWARE_DISKLABEL=y |
46 | CONFIG_CFQ_GROUP_IOSCHED=y | 46 | CONFIG_CFQ_GROUP_IOSCHED=y |
47 | CONFIG_DEFAULT_DEADLINE=y | 47 | CONFIG_DEFAULT_DEADLINE=y |
48 | CONFIG_MARCH_Z9_109=y | 48 | CONFIG_MARCH_Z196=y |
49 | CONFIG_TUNE_ZEC12=y | ||
49 | CONFIG_NR_CPUS=256 | 50 | CONFIG_NR_CPUS=256 |
50 | CONFIG_PREEMPT=y | 51 | CONFIG_PREEMPT=y |
51 | CONFIG_HZ_100=y | 52 | CONFIG_HZ_100=y |
@@ -240,7 +241,6 @@ CONFIG_IP_VS_PE_SIP=m | |||
240 | CONFIG_NF_CONNTRACK_IPV4=m | 241 | CONFIG_NF_CONNTRACK_IPV4=m |
241 | # CONFIG_NF_CONNTRACK_PROC_COMPAT is not set | 242 | # CONFIG_NF_CONNTRACK_PROC_COMPAT is not set |
242 | CONFIG_NF_TABLES_IPV4=m | 243 | CONFIG_NF_TABLES_IPV4=m |
243 | CONFIG_NFT_REJECT_IPV4=m | ||
244 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m | 244 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
245 | CONFIG_NFT_CHAIN_NAT_IPV4=m | 245 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
246 | CONFIG_NF_TABLES_ARP=m | 246 | CONFIG_NF_TABLES_ARP=m |
@@ -456,6 +456,7 @@ CONFIG_TN3270_FS=y | |||
456 | CONFIG_WATCHDOG=y | 456 | CONFIG_WATCHDOG=y |
457 | CONFIG_WATCHDOG_NOWAYOUT=y | 457 | CONFIG_WATCHDOG_NOWAYOUT=y |
458 | CONFIG_SOFT_WATCHDOG=m | 458 | CONFIG_SOFT_WATCHDOG=m |
459 | CONFIG_DIAG288_WATCHDOG=m | ||
459 | # CONFIG_HID is not set | 460 | # CONFIG_HID is not set |
460 | # CONFIG_USB_SUPPORT is not set | 461 | # CONFIG_USB_SUPPORT is not set |
461 | CONFIG_INFINIBAND=m | 462 | CONFIG_INFINIBAND=m |
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig index c81a74e3e25a..b061180d3544 100644 --- a/arch/s390/configs/gcov_defconfig +++ b/arch/s390/configs/gcov_defconfig | |||
@@ -45,7 +45,8 @@ CONFIG_SOLARIS_X86_PARTITION=y | |||
45 | CONFIG_UNIXWARE_DISKLABEL=y | 45 | CONFIG_UNIXWARE_DISKLABEL=y |
46 | CONFIG_CFQ_GROUP_IOSCHED=y | 46 | CONFIG_CFQ_GROUP_IOSCHED=y |
47 | CONFIG_DEFAULT_DEADLINE=y | 47 | CONFIG_DEFAULT_DEADLINE=y |
48 | CONFIG_MARCH_Z9_109=y | 48 | CONFIG_MARCH_Z196=y |
49 | CONFIG_TUNE_ZEC12=y | ||
49 | CONFIG_NR_CPUS=256 | 50 | CONFIG_NR_CPUS=256 |
50 | CONFIG_HZ_100=y | 51 | CONFIG_HZ_100=y |
51 | CONFIG_MEMORY_HOTPLUG=y | 52 | CONFIG_MEMORY_HOTPLUG=y |
@@ -238,7 +239,6 @@ CONFIG_IP_VS_PE_SIP=m | |||
238 | CONFIG_NF_CONNTRACK_IPV4=m | 239 | CONFIG_NF_CONNTRACK_IPV4=m |
239 | # CONFIG_NF_CONNTRACK_PROC_COMPAT is not set | 240 | # CONFIG_NF_CONNTRACK_PROC_COMPAT is not set |
240 | CONFIG_NF_TABLES_IPV4=m | 241 | CONFIG_NF_TABLES_IPV4=m |
241 | CONFIG_NFT_REJECT_IPV4=m | ||
242 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m | 242 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
243 | CONFIG_NFT_CHAIN_NAT_IPV4=m | 243 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
244 | CONFIG_NF_TABLES_ARP=m | 244 | CONFIG_NF_TABLES_ARP=m |
@@ -453,6 +453,7 @@ CONFIG_TN3270_FS=y | |||
453 | CONFIG_WATCHDOG=y | 453 | CONFIG_WATCHDOG=y |
454 | CONFIG_WATCHDOG_NOWAYOUT=y | 454 | CONFIG_WATCHDOG_NOWAYOUT=y |
455 | CONFIG_SOFT_WATCHDOG=m | 455 | CONFIG_SOFT_WATCHDOG=m |
456 | CONFIG_DIAG288_WATCHDOG=m | ||
456 | # CONFIG_HID is not set | 457 | # CONFIG_HID is not set |
457 | # CONFIG_USB_SUPPORT is not set | 458 | # CONFIG_USB_SUPPORT is not set |
458 | CONFIG_INFINIBAND=m | 459 | CONFIG_INFINIBAND=m |
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig index b5ba8fe1cc64..d279baa08014 100644 --- a/arch/s390/configs/performance_defconfig +++ b/arch/s390/configs/performance_defconfig | |||
@@ -43,7 +43,8 @@ CONFIG_SOLARIS_X86_PARTITION=y | |||
43 | CONFIG_UNIXWARE_DISKLABEL=y | 43 | CONFIG_UNIXWARE_DISKLABEL=y |
44 | CONFIG_CFQ_GROUP_IOSCHED=y | 44 | CONFIG_CFQ_GROUP_IOSCHED=y |
45 | CONFIG_DEFAULT_DEADLINE=y | 45 | CONFIG_DEFAULT_DEADLINE=y |
46 | CONFIG_MARCH_Z9_109=y | 46 | CONFIG_MARCH_Z196=y |
47 | CONFIG_TUNE_ZEC12=y | ||
47 | CONFIG_NR_CPUS=256 | 48 | CONFIG_NR_CPUS=256 |
48 | CONFIG_HZ_100=y | 49 | CONFIG_HZ_100=y |
49 | CONFIG_MEMORY_HOTPLUG=y | 50 | CONFIG_MEMORY_HOTPLUG=y |
@@ -236,7 +237,6 @@ CONFIG_IP_VS_PE_SIP=m | |||
236 | CONFIG_NF_CONNTRACK_IPV4=m | 237 | CONFIG_NF_CONNTRACK_IPV4=m |
237 | # CONFIG_NF_CONNTRACK_PROC_COMPAT is not set | 238 | # CONFIG_NF_CONNTRACK_PROC_COMPAT is not set |
238 | CONFIG_NF_TABLES_IPV4=m | 239 | CONFIG_NF_TABLES_IPV4=m |
239 | CONFIG_NFT_REJECT_IPV4=m | ||
240 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m | 240 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
241 | CONFIG_NFT_CHAIN_NAT_IPV4=m | 241 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
242 | CONFIG_NF_TABLES_ARP=m | 242 | CONFIG_NF_TABLES_ARP=m |
@@ -451,6 +451,7 @@ CONFIG_TN3270_FS=y | |||
451 | CONFIG_WATCHDOG=y | 451 | CONFIG_WATCHDOG=y |
452 | CONFIG_WATCHDOG_NOWAYOUT=y | 452 | CONFIG_WATCHDOG_NOWAYOUT=y |
453 | CONFIG_SOFT_WATCHDOG=m | 453 | CONFIG_SOFT_WATCHDOG=m |
454 | CONFIG_DIAG288_WATCHDOG=m | ||
454 | # CONFIG_HID is not set | 455 | # CONFIG_HID is not set |
455 | # CONFIG_USB_SUPPORT is not set | 456 | # CONFIG_USB_SUPPORT is not set |
456 | CONFIG_INFINIBAND=m | 457 | CONFIG_INFINIBAND=m |
diff --git a/arch/s390/configs/zfcpdump_defconfig b/arch/s390/configs/zfcpdump_defconfig index cef073ca1f07..948e0e057a23 100644 --- a/arch/s390/configs/zfcpdump_defconfig +++ b/arch/s390/configs/zfcpdump_defconfig | |||
@@ -8,7 +8,8 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y | |||
8 | CONFIG_PARTITION_ADVANCED=y | 8 | CONFIG_PARTITION_ADVANCED=y |
9 | CONFIG_IBM_PARTITION=y | 9 | CONFIG_IBM_PARTITION=y |
10 | CONFIG_DEFAULT_DEADLINE=y | 10 | CONFIG_DEFAULT_DEADLINE=y |
11 | CONFIG_MARCH_Z9_109=y | 11 | CONFIG_MARCH_Z196=y |
12 | CONFIG_TUNE_ZEC12=y | ||
12 | # CONFIG_COMPAT is not set | 13 | # CONFIG_COMPAT is not set |
13 | CONFIG_NR_CPUS=2 | 14 | CONFIG_NR_CPUS=2 |
14 | # CONFIG_HOTPLUG_CPU is not set | 15 | # CONFIG_HOTPLUG_CPU is not set |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index 4557cb7ffddf..2e56498a40df 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -135,8 +135,8 @@ CONFIG_PROVE_LOCKING=y | |||
135 | CONFIG_LOCK_STAT=y | 135 | CONFIG_LOCK_STAT=y |
136 | CONFIG_DEBUG_LOCKDEP=y | 136 | CONFIG_DEBUG_LOCKDEP=y |
137 | CONFIG_DEBUG_ATOMIC_SLEEP=y | 137 | CONFIG_DEBUG_ATOMIC_SLEEP=y |
138 | CONFIG_DEBUG_WRITECOUNT=y | ||
139 | CONFIG_DEBUG_LIST=y | 138 | CONFIG_DEBUG_LIST=y |
139 | CONFIG_DEBUG_PI_LIST=y | ||
140 | CONFIG_DEBUG_SG=y | 140 | CONFIG_DEBUG_SG=y |
141 | CONFIG_DEBUG_NOTIFIERS=y | 141 | CONFIG_DEBUG_NOTIFIERS=y |
142 | CONFIG_PROVE_RCU=y | 142 | CONFIG_PROVE_RCU=y |
@@ -199,4 +199,10 @@ CONFIG_CRYPTO_SHA512_S390=m | |||
199 | CONFIG_CRYPTO_DES_S390=m | 199 | CONFIG_CRYPTO_DES_S390=m |
200 | CONFIG_CRYPTO_AES_S390=m | 200 | CONFIG_CRYPTO_AES_S390=m |
201 | CONFIG_CRC7=m | 201 | CONFIG_CRC7=m |
202 | # CONFIG_XZ_DEC_X86 is not set | ||
203 | # CONFIG_XZ_DEC_POWERPC is not set | ||
204 | # CONFIG_XZ_DEC_IA64 is not set | ||
205 | # CONFIG_XZ_DEC_ARM is not set | ||
206 | # CONFIG_XZ_DEC_ARMTHUMB is not set | ||
207 | # CONFIG_XZ_DEC_SPARC is not set | ||
202 | CONFIG_CMM=m | 208 | CONFIG_CMM=m |
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h index c28f32a45af5..3815bfea1b2d 100644 --- a/arch/s390/include/asm/mmu_context.h +++ b/arch/s390/include/asm/mmu_context.h | |||
@@ -33,10 +33,9 @@ static inline int init_new_context(struct task_struct *tsk, | |||
33 | 33 | ||
34 | static inline void set_user_asce(struct mm_struct *mm) | 34 | static inline void set_user_asce(struct mm_struct *mm) |
35 | { | 35 | { |
36 | pgd_t *pgd = mm->pgd; | 36 | S390_lowcore.user_asce = mm->context.asce_bits | __pa(mm->pgd); |
37 | 37 | if (current->thread.mm_segment.ar4) | |
38 | S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd); | 38 | __ctl_load(S390_lowcore.user_asce, 7, 7); |
39 | set_fs(current->thread.mm_segment); | ||
40 | set_cpu_flag(CIF_ASCE); | 39 | set_cpu_flag(CIF_ASCE); |
41 | } | 40 | } |
42 | 41 | ||
@@ -70,12 +69,11 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
70 | /* Clear old ASCE by loading the kernel ASCE. */ | 69 | /* Clear old ASCE by loading the kernel ASCE. */ |
71 | __ctl_load(S390_lowcore.kernel_asce, 1, 1); | 70 | __ctl_load(S390_lowcore.kernel_asce, 1, 1); |
72 | __ctl_load(S390_lowcore.kernel_asce, 7, 7); | 71 | __ctl_load(S390_lowcore.kernel_asce, 7, 7); |
73 | /* Delay loading of the new ASCE to control registers CR1 & CR7 */ | ||
74 | set_cpu_flag(CIF_ASCE); | ||
75 | atomic_inc(&next->context.attach_count); | 72 | atomic_inc(&next->context.attach_count); |
76 | atomic_dec(&prev->context.attach_count); | 73 | atomic_dec(&prev->context.attach_count); |
77 | if (MACHINE_HAS_TLB_LC) | 74 | if (MACHINE_HAS_TLB_LC) |
78 | cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); | 75 | cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); |
76 | S390_lowcore.user_asce = next->context.asce_bits | __pa(next->pgd); | ||
79 | } | 77 | } |
80 | 78 | ||
81 | #define finish_arch_post_lock_switch finish_arch_post_lock_switch | 79 | #define finish_arch_post_lock_switch finish_arch_post_lock_switch |
@@ -84,17 +82,18 @@ static inline void finish_arch_post_lock_switch(void) | |||
84 | struct task_struct *tsk = current; | 82 | struct task_struct *tsk = current; |
85 | struct mm_struct *mm = tsk->mm; | 83 | struct mm_struct *mm = tsk->mm; |
86 | 84 | ||
87 | if (!mm) | 85 | load_kernel_asce(); |
88 | return; | 86 | if (mm) { |
89 | preempt_disable(); | 87 | preempt_disable(); |
90 | while (atomic_read(&mm->context.attach_count) >> 16) | 88 | while (atomic_read(&mm->context.attach_count) >> 16) |
91 | cpu_relax(); | 89 | cpu_relax(); |
92 | 90 | ||
93 | cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm)); | 91 | cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm)); |
94 | set_user_asce(mm); | 92 | if (mm->context.flush_mm) |
95 | if (mm->context.flush_mm) | 93 | __tlb_flush_mm(mm); |
96 | __tlb_flush_mm(mm); | 94 | preempt_enable(); |
97 | preempt_enable(); | 95 | } |
96 | set_fs(current->thread.mm_segment); | ||
98 | } | 97 | } |
99 | 98 | ||
100 | #define enter_lazy_tlb(mm,tsk) do { } while (0) | 99 | #define enter_lazy_tlb(mm,tsk) do { } while (0) |
diff --git a/arch/s390/include/asm/switch_to.h b/arch/s390/include/asm/switch_to.h index 29c81f82705e..df38c70cd59e 100644 --- a/arch/s390/include/asm/switch_to.h +++ b/arch/s390/include/asm/switch_to.h | |||
@@ -134,8 +134,4 @@ static inline void restore_access_regs(unsigned int *acrs) | |||
134 | prev = __switch_to(prev,next); \ | 134 | prev = __switch_to(prev,next); \ |
135 | } while (0) | 135 | } while (0) |
136 | 136 | ||
137 | #define finish_arch_switch(prev) do { \ | ||
138 | set_fs(current->thread.mm_segment); \ | ||
139 | } while (0) | ||
140 | |||
141 | #endif /* __ASM_SWITCH_TO_H */ | 137 | #endif /* __ASM_SWITCH_TO_H */ |
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild index 6a9a9eb645f5..736637363d31 100644 --- a/arch/s390/include/uapi/asm/Kbuild +++ b/arch/s390/include/uapi/asm/Kbuild | |||
@@ -36,6 +36,7 @@ header-y += signal.h | |||
36 | header-y += socket.h | 36 | header-y += socket.h |
37 | header-y += sockios.h | 37 | header-y += sockios.h |
38 | header-y += sclp_ctl.h | 38 | header-y += sclp_ctl.h |
39 | header-y += sie.h | ||
39 | header-y += stat.h | 40 | header-y += stat.h |
40 | header-y += statfs.h | 41 | header-y += statfs.h |
41 | header-y += swab.h | 42 | header-y += swab.h |
diff --git a/arch/s390/include/uapi/asm/sie.h b/arch/s390/include/uapi/asm/sie.h index 3d97f610198d..5d9cc19462c4 100644 --- a/arch/s390/include/uapi/asm/sie.h +++ b/arch/s390/include/uapi/asm/sie.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _UAPI_ASM_S390_SIE_H | 1 | #ifndef _UAPI_ASM_S390_SIE_H |
2 | #define _UAPI_ASM_S390_SIE_H | 2 | #define _UAPI_ASM_S390_SIE_H |
3 | 3 | ||
4 | #include <asm/sigp.h> | ||
5 | |||
6 | #define diagnose_codes \ | 4 | #define diagnose_codes \ |
7 | { 0x10, "DIAG (0x10) release pages" }, \ | 5 | { 0x10, "DIAG (0x10) release pages" }, \ |
8 | { 0x44, "DIAG (0x44) time slice end" }, \ | 6 | { 0x44, "DIAG (0x44) time slice end" }, \ |
@@ -13,18 +11,18 @@ | |||
13 | { 0x500, "DIAG (0x500) KVM virtio functions" }, \ | 11 | { 0x500, "DIAG (0x500) KVM virtio functions" }, \ |
14 | { 0x501, "DIAG (0x501) KVM breakpoint" } | 12 | { 0x501, "DIAG (0x501) KVM breakpoint" } |
15 | 13 | ||
16 | #define sigp_order_codes \ | 14 | #define sigp_order_codes \ |
17 | { SIGP_SENSE, "SIGP sense" }, \ | 15 | { 0x01, "SIGP sense" }, \ |
18 | { SIGP_EXTERNAL_CALL, "SIGP external call" }, \ | 16 | { 0x02, "SIGP external call" }, \ |
19 | { SIGP_EMERGENCY_SIGNAL, "SIGP emergency signal" }, \ | 17 | { 0x03, "SIGP emergency signal" }, \ |
20 | { SIGP_STOP, "SIGP stop" }, \ | 18 | { 0x05, "SIGP stop" }, \ |
21 | { SIGP_STOP_AND_STORE_STATUS, "SIGP stop and store status" }, \ | 19 | { 0x06, "SIGP restart" }, \ |
22 | { SIGP_SET_ARCHITECTURE, "SIGP set architecture" }, \ | 20 | { 0x09, "SIGP stop and store status" }, \ |
23 | { SIGP_SET_PREFIX, "SIGP set prefix" }, \ | 21 | { 0x0b, "SIGP initial cpu reset" }, \ |
24 | { SIGP_SENSE_RUNNING, "SIGP sense running" }, \ | 22 | { 0x0d, "SIGP set prefix" }, \ |
25 | { SIGP_RESTART, "SIGP restart" }, \ | 23 | { 0x0e, "SIGP store status at address" }, \ |
26 | { SIGP_INITIAL_CPU_RESET, "SIGP initial cpu reset" }, \ | 24 | { 0x12, "SIGP set architecture" }, \ |
27 | { SIGP_STORE_STATUS_AT_ADDRESS, "SIGP store status at address" } | 25 | { 0x15, "SIGP sense running" } |
28 | 26 | ||
29 | #define icpt_prog_codes \ | 27 | #define icpt_prog_codes \ |
30 | { 0x0001, "Prog Operation" }, \ | 28 | { 0x0001, "Prog Operation" }, \ |
diff --git a/arch/s390/include/uapi/asm/ucontext.h b/arch/s390/include/uapi/asm/ucontext.h index 200e06325c6a..3e077b2a4705 100644 --- a/arch/s390/include/uapi/asm/ucontext.h +++ b/arch/s390/include/uapi/asm/ucontext.h | |||
@@ -16,7 +16,9 @@ struct ucontext_extended { | |||
16 | struct ucontext *uc_link; | 16 | struct ucontext *uc_link; |
17 | stack_t uc_stack; | 17 | stack_t uc_stack; |
18 | _sigregs uc_mcontext; | 18 | _sigregs uc_mcontext; |
19 | unsigned long uc_sigmask[2]; | 19 | sigset_t uc_sigmask; |
20 | /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */ | ||
21 | unsigned char __unused[128 - sizeof(sigset_t)]; | ||
20 | unsigned long uc_gprs_high[16]; | 22 | unsigned long uc_gprs_high[16]; |
21 | }; | 23 | }; |
22 | 24 | ||
@@ -27,7 +29,9 @@ struct ucontext { | |||
27 | struct ucontext *uc_link; | 29 | struct ucontext *uc_link; |
28 | stack_t uc_stack; | 30 | stack_t uc_stack; |
29 | _sigregs uc_mcontext; | 31 | _sigregs uc_mcontext; |
30 | sigset_t uc_sigmask; /* mask last for extensibility */ | 32 | sigset_t uc_sigmask; |
33 | /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */ | ||
34 | unsigned char __unused[128 - sizeof(sigset_t)]; | ||
31 | }; | 35 | }; |
32 | 36 | ||
33 | #endif /* !_ASM_S390_UCONTEXT_H */ | 37 | #endif /* !_ASM_S390_UCONTEXT_H */ |
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h index 39ddfdb40ae8..70d4b7c4beaa 100644 --- a/arch/s390/kernel/compat_linux.h +++ b/arch/s390/kernel/compat_linux.h | |||
@@ -69,7 +69,9 @@ struct ucontext32 { | |||
69 | __u32 uc_link; /* pointer */ | 69 | __u32 uc_link; /* pointer */ |
70 | compat_stack_t uc_stack; | 70 | compat_stack_t uc_stack; |
71 | _sigregs32 uc_mcontext; | 71 | _sigregs32 uc_mcontext; |
72 | compat_sigset_t uc_sigmask; /* mask last for extensibility */ | 72 | compat_sigset_t uc_sigmask; |
73 | /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */ | ||
74 | unsigned char __unused[128 - sizeof(compat_sigset_t)]; | ||
73 | }; | 75 | }; |
74 | 76 | ||
75 | struct stat64_emu31; | 77 | struct stat64_emu31; |
diff --git a/arch/sparc/crypto/aes_glue.c b/arch/sparc/crypto/aes_glue.c index 503e6d96ad4e..df922f52d76d 100644 --- a/arch/sparc/crypto/aes_glue.c +++ b/arch/sparc/crypto/aes_glue.c | |||
@@ -124,7 +124,7 @@ extern void aes_sparc64_ctr_crypt_256(const u64 *key, const u64 *input, | |||
124 | u64 *output, unsigned int len, | 124 | u64 *output, unsigned int len, |
125 | u64 *iv); | 125 | u64 *iv); |
126 | 126 | ||
127 | struct aes_ops aes128_ops = { | 127 | static struct aes_ops aes128_ops = { |
128 | .encrypt = aes_sparc64_encrypt_128, | 128 | .encrypt = aes_sparc64_encrypt_128, |
129 | .decrypt = aes_sparc64_decrypt_128, | 129 | .decrypt = aes_sparc64_decrypt_128, |
130 | .load_encrypt_keys = aes_sparc64_load_encrypt_keys_128, | 130 | .load_encrypt_keys = aes_sparc64_load_encrypt_keys_128, |
@@ -136,7 +136,7 @@ struct aes_ops aes128_ops = { | |||
136 | .ctr_crypt = aes_sparc64_ctr_crypt_128, | 136 | .ctr_crypt = aes_sparc64_ctr_crypt_128, |
137 | }; | 137 | }; |
138 | 138 | ||
139 | struct aes_ops aes192_ops = { | 139 | static struct aes_ops aes192_ops = { |
140 | .encrypt = aes_sparc64_encrypt_192, | 140 | .encrypt = aes_sparc64_encrypt_192, |
141 | .decrypt = aes_sparc64_decrypt_192, | 141 | .decrypt = aes_sparc64_decrypt_192, |
142 | .load_encrypt_keys = aes_sparc64_load_encrypt_keys_192, | 142 | .load_encrypt_keys = aes_sparc64_load_encrypt_keys_192, |
@@ -148,7 +148,7 @@ struct aes_ops aes192_ops = { | |||
148 | .ctr_crypt = aes_sparc64_ctr_crypt_192, | 148 | .ctr_crypt = aes_sparc64_ctr_crypt_192, |
149 | }; | 149 | }; |
150 | 150 | ||
151 | struct aes_ops aes256_ops = { | 151 | static struct aes_ops aes256_ops = { |
152 | .encrypt = aes_sparc64_encrypt_256, | 152 | .encrypt = aes_sparc64_encrypt_256, |
153 | .decrypt = aes_sparc64_decrypt_256, | 153 | .decrypt = aes_sparc64_decrypt_256, |
154 | .load_encrypt_keys = aes_sparc64_load_encrypt_keys_256, | 154 | .load_encrypt_keys = aes_sparc64_load_encrypt_keys_256, |
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index f08fe51b264d..7aed2be45b44 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h | |||
@@ -20,11 +20,11 @@ | |||
20 | 20 | ||
21 | #define ATOMIC_INIT(i) { (i) } | 21 | #define ATOMIC_INIT(i) { (i) } |
22 | 22 | ||
23 | extern int __atomic_add_return(int, atomic_t *); | 23 | int __atomic_add_return(int, atomic_t *); |
24 | extern int atomic_cmpxchg(atomic_t *, int, int); | 24 | int atomic_cmpxchg(atomic_t *, int, int); |
25 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | 25 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) |
26 | extern int __atomic_add_unless(atomic_t *, int, int); | 26 | int __atomic_add_unless(atomic_t *, int, int); |
27 | extern void atomic_set(atomic_t *, int); | 27 | void atomic_set(atomic_t *, int); |
28 | 28 | ||
29 | #define atomic_read(v) (*(volatile int *)&(v)->counter) | 29 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
30 | 30 | ||
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h index 8b2f1bde2889..bb894c8bec56 100644 --- a/arch/sparc/include/asm/atomic_64.h +++ b/arch/sparc/include/asm/atomic_64.h | |||
@@ -20,15 +20,15 @@ | |||
20 | #define atomic_set(v, i) (((v)->counter) = i) | 20 | #define atomic_set(v, i) (((v)->counter) = i) |
21 | #define atomic64_set(v, i) (((v)->counter) = i) | 21 | #define atomic64_set(v, i) (((v)->counter) = i) |
22 | 22 | ||
23 | extern void atomic_add(int, atomic_t *); | 23 | void atomic_add(int, atomic_t *); |
24 | extern void atomic64_add(long, atomic64_t *); | 24 | void atomic64_add(long, atomic64_t *); |
25 | extern void atomic_sub(int, atomic_t *); | 25 | void atomic_sub(int, atomic_t *); |
26 | extern void atomic64_sub(long, atomic64_t *); | 26 | void atomic64_sub(long, atomic64_t *); |
27 | 27 | ||
28 | extern int atomic_add_ret(int, atomic_t *); | 28 | int atomic_add_ret(int, atomic_t *); |
29 | extern long atomic64_add_ret(long, atomic64_t *); | 29 | long atomic64_add_ret(long, atomic64_t *); |
30 | extern int atomic_sub_ret(int, atomic_t *); | 30 | int atomic_sub_ret(int, atomic_t *); |
31 | extern long atomic64_sub_ret(long, atomic64_t *); | 31 | long atomic64_sub_ret(long, atomic64_t *); |
32 | 32 | ||
33 | #define atomic_dec_return(v) atomic_sub_ret(1, v) | 33 | #define atomic_dec_return(v) atomic_sub_ret(1, v) |
34 | #define atomic64_dec_return(v) atomic64_sub_ret(1, v) | 34 | #define atomic64_dec_return(v) atomic64_sub_ret(1, v) |
@@ -107,6 +107,6 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u) | |||
107 | 107 | ||
108 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) | 108 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) |
109 | 109 | ||
110 | extern long atomic64_dec_if_positive(atomic64_t *v); | 110 | long atomic64_dec_if_positive(atomic64_t *v); |
111 | 111 | ||
112 | #endif /* !(__ARCH_SPARC64_ATOMIC__) */ | 112 | #endif /* !(__ARCH_SPARC64_ATOMIC__) */ |
diff --git a/arch/sparc/include/asm/auxio.h b/arch/sparc/include/asm/auxio.h index 13dc67f03011..3e09a07b77e9 100644 --- a/arch/sparc/include/asm/auxio.h +++ b/arch/sparc/include/asm/auxio.h | |||
@@ -1,5 +1,12 @@ | |||
1 | #ifndef ___ASM_SPARC_AUXIO_H | 1 | #ifndef ___ASM_SPARC_AUXIO_H |
2 | #define ___ASM_SPARC_AUXIO_H | 2 | #define ___ASM_SPARC_AUXIO_H |
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | |||
6 | extern void __iomem *auxio_register; | ||
7 | |||
8 | #endif /* ifndef __ASSEMBLY__ */ | ||
9 | |||
3 | #if defined(__sparc__) && defined(__arch64__) | 10 | #if defined(__sparc__) && defined(__arch64__) |
4 | #include <asm/auxio_64.h> | 11 | #include <asm/auxio_64.h> |
5 | #else | 12 | #else |
diff --git a/arch/sparc/include/asm/auxio_32.h b/arch/sparc/include/asm/auxio_32.h index 3a319775ae37..5d685df427b4 100644 --- a/arch/sparc/include/asm/auxio_32.h +++ b/arch/sparc/include/asm/auxio_32.h | |||
@@ -34,8 +34,8 @@ | |||
34 | * NOTE: these routines are implementation dependent-- | 34 | * NOTE: these routines are implementation dependent-- |
35 | * understand the hardware you are querying! | 35 | * understand the hardware you are querying! |
36 | */ | 36 | */ |
37 | extern void set_auxio(unsigned char bits_on, unsigned char bits_off); | 37 | void set_auxio(unsigned char bits_on, unsigned char bits_off); |
38 | extern unsigned char get_auxio(void); /* .../asm/floppy.h */ | 38 | unsigned char get_auxio(void); /* .../asm/floppy.h */ |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * The following routines are provided for driver-compatibility | 41 | * The following routines are provided for driver-compatibility |
@@ -78,7 +78,7 @@ do { \ | |||
78 | 78 | ||
79 | 79 | ||
80 | /* AUXIO2 (Power Off Control) */ | 80 | /* AUXIO2 (Power Off Control) */ |
81 | extern __volatile__ unsigned char * auxio_power_register; | 81 | extern volatile u8 __iomem *auxio_power_register; |
82 | 82 | ||
83 | #define AUXIO_POWER_DETECT_FAILURE 32 | 83 | #define AUXIO_POWER_DETECT_FAILURE 32 |
84 | #define AUXIO_POWER_CLEAR_FAILURE 2 | 84 | #define AUXIO_POWER_CLEAR_FAILURE 2 |
diff --git a/arch/sparc/include/asm/auxio_64.h b/arch/sparc/include/asm/auxio_64.h index f61cd1e3e395..6079e59a7ad1 100644 --- a/arch/sparc/include/asm/auxio_64.h +++ b/arch/sparc/include/asm/auxio_64.h | |||
@@ -75,8 +75,6 @@ | |||
75 | 75 | ||
76 | #ifndef __ASSEMBLY__ | 76 | #ifndef __ASSEMBLY__ |
77 | 77 | ||
78 | extern void __iomem *auxio_register; | ||
79 | |||
80 | #define AUXIO_LTE_ON 1 | 78 | #define AUXIO_LTE_ON 1 |
81 | #define AUXIO_LTE_OFF 0 | 79 | #define AUXIO_LTE_OFF 0 |
82 | 80 | ||
@@ -84,7 +82,7 @@ extern void __iomem *auxio_register; | |||
84 | * | 82 | * |
85 | * on - AUXIO_LTE_ON or AUXIO_LTE_OFF | 83 | * on - AUXIO_LTE_ON or AUXIO_LTE_OFF |
86 | */ | 84 | */ |
87 | extern void auxio_set_lte(int on); | 85 | void auxio_set_lte(int on); |
88 | 86 | ||
89 | #define AUXIO_LED_ON 1 | 87 | #define AUXIO_LED_ON 1 |
90 | #define AUXIO_LED_OFF 0 | 88 | #define AUXIO_LED_OFF 0 |
@@ -93,7 +91,7 @@ extern void auxio_set_lte(int on); | |||
93 | * | 91 | * |
94 | * on - AUXIO_LED_ON or AUXIO_LED_OFF | 92 | * on - AUXIO_LED_ON or AUXIO_LED_OFF |
95 | */ | 93 | */ |
96 | extern void auxio_set_led(int on); | 94 | void auxio_set_led(int on); |
97 | 95 | ||
98 | #endif /* ifndef __ASSEMBLY__ */ | 96 | #endif /* ifndef __ASSEMBLY__ */ |
99 | 97 | ||
diff --git a/arch/sparc/include/asm/bitext.h b/arch/sparc/include/asm/bitext.h index 297b2f2fcb49..9c988bf3adb6 100644 --- a/arch/sparc/include/asm/bitext.h +++ b/arch/sparc/include/asm/bitext.h | |||
@@ -20,8 +20,8 @@ struct bit_map { | |||
20 | int num_colors; | 20 | int num_colors; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | extern int bit_map_string_get(struct bit_map *t, int len, int align); | 23 | int bit_map_string_get(struct bit_map *t, int len, int align); |
24 | extern void bit_map_clear(struct bit_map *t, int offset, int len); | 24 | void bit_map_clear(struct bit_map *t, int offset, int len); |
25 | extern void bit_map_init(struct bit_map *t, unsigned long *map, int size); | 25 | void bit_map_init(struct bit_map *t, unsigned long *map, int size); |
26 | 26 | ||
27 | #endif /* defined(_SPARC_BITEXT_H) */ | 27 | #endif /* defined(_SPARC_BITEXT_H) */ |
diff --git a/arch/sparc/include/asm/bitops_32.h b/arch/sparc/include/asm/bitops_32.h index 88c9a962502c..600ed1d9c8c8 100644 --- a/arch/sparc/include/asm/bitops_32.h +++ b/arch/sparc/include/asm/bitops_32.h | |||
@@ -18,9 +18,9 @@ | |||
18 | #error only <linux/bitops.h> can be included directly | 18 | #error only <linux/bitops.h> can be included directly |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | extern unsigned long ___set_bit(unsigned long *addr, unsigned long mask); | 21 | unsigned long ___set_bit(unsigned long *addr, unsigned long mask); |
22 | extern unsigned long ___clear_bit(unsigned long *addr, unsigned long mask); | 22 | unsigned long ___clear_bit(unsigned long *addr, unsigned long mask); |
23 | extern unsigned long ___change_bit(unsigned long *addr, unsigned long mask); | 23 | unsigned long ___change_bit(unsigned long *addr, unsigned long mask); |
24 | 24 | ||
25 | /* | 25 | /* |
26 | * Set bit 'nr' in 32-bit quantity at address 'addr' where bit '0' | 26 | * Set bit 'nr' in 32-bit quantity at address 'addr' where bit '0' |
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h index f1a051ca301a..2d522402a937 100644 --- a/arch/sparc/include/asm/bitops_64.h +++ b/arch/sparc/include/asm/bitops_64.h | |||
@@ -15,12 +15,12 @@ | |||
15 | #include <asm/byteorder.h> | 15 | #include <asm/byteorder.h> |
16 | #include <asm/barrier.h> | 16 | #include <asm/barrier.h> |
17 | 17 | ||
18 | extern int test_and_set_bit(unsigned long nr, volatile unsigned long *addr); | 18 | int test_and_set_bit(unsigned long nr, volatile unsigned long *addr); |
19 | extern int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr); | 19 | int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr); |
20 | extern int test_and_change_bit(unsigned long nr, volatile unsigned long *addr); | 20 | int test_and_change_bit(unsigned long nr, volatile unsigned long *addr); |
21 | extern void set_bit(unsigned long nr, volatile unsigned long *addr); | 21 | void set_bit(unsigned long nr, volatile unsigned long *addr); |
22 | extern void clear_bit(unsigned long nr, volatile unsigned long *addr); | 22 | void clear_bit(unsigned long nr, volatile unsigned long *addr); |
23 | extern void change_bit(unsigned long nr, volatile unsigned long *addr); | 23 | void change_bit(unsigned long nr, volatile unsigned long *addr); |
24 | 24 | ||
25 | #include <asm-generic/bitops/non-atomic.h> | 25 | #include <asm-generic/bitops/non-atomic.h> |
26 | 26 | ||
@@ -30,8 +30,8 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr); | |||
30 | 30 | ||
31 | #ifdef __KERNEL__ | 31 | #ifdef __KERNEL__ |
32 | 32 | ||
33 | extern int ffs(int x); | 33 | int ffs(int x); |
34 | extern unsigned long __ffs(unsigned long); | 34 | unsigned long __ffs(unsigned long); |
35 | 35 | ||
36 | #include <asm-generic/bitops/ffz.h> | 36 | #include <asm-generic/bitops/ffz.h> |
37 | #include <asm-generic/bitops/sched.h> | 37 | #include <asm-generic/bitops/sched.h> |
@@ -41,10 +41,10 @@ extern unsigned long __ffs(unsigned long); | |||
41 | * of bits set) of a N-bit word | 41 | * of bits set) of a N-bit word |
42 | */ | 42 | */ |
43 | 43 | ||
44 | extern unsigned long __arch_hweight64(__u64 w); | 44 | unsigned long __arch_hweight64(__u64 w); |
45 | extern unsigned int __arch_hweight32(unsigned int w); | 45 | unsigned int __arch_hweight32(unsigned int w); |
46 | extern unsigned int __arch_hweight16(unsigned int w); | 46 | unsigned int __arch_hweight16(unsigned int w); |
47 | extern unsigned int __arch_hweight8(unsigned int w); | 47 | unsigned int __arch_hweight8(unsigned int w); |
48 | 48 | ||
49 | #include <asm-generic/bitops/const_hweight.h> | 49 | #include <asm-generic/bitops/const_hweight.h> |
50 | #include <asm-generic/bitops/lock.h> | 50 | #include <asm-generic/bitops/lock.h> |
diff --git a/arch/sparc/include/asm/btext.h b/arch/sparc/include/asm/btext.h index 9b2bc6b6ed0a..75a32b109e15 100644 --- a/arch/sparc/include/asm/btext.h +++ b/arch/sparc/include/asm/btext.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef _SPARC_BTEXT_H | 1 | #ifndef _SPARC_BTEXT_H |
2 | #define _SPARC_BTEXT_H | 2 | #define _SPARC_BTEXT_H |
3 | 3 | ||
4 | extern int btext_find_display(void); | 4 | int btext_find_display(void); |
5 | 5 | ||
6 | #endif /* _SPARC_BTEXT_H */ | 6 | #endif /* _SPARC_BTEXT_H */ |
diff --git a/arch/sparc/include/asm/bug.h b/arch/sparc/include/asm/bug.h index 6bd9f43cb5a5..eaa8f8d38125 100644 --- a/arch/sparc/include/asm/bug.h +++ b/arch/sparc/include/asm/bug.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/compiler.h> | 5 | #include <linux/compiler.h> |
6 | 6 | ||
7 | #ifdef CONFIG_DEBUG_BUGVERBOSE | 7 | #ifdef CONFIG_DEBUG_BUGVERBOSE |
8 | extern void do_BUG(const char *file, int line); | 8 | void do_BUG(const char *file, int line); |
9 | #define BUG() do { \ | 9 | #define BUG() do { \ |
10 | do_BUG(__FILE__, __LINE__); \ | 10 | do_BUG(__FILE__, __LINE__); \ |
11 | __builtin_trap(); \ | 11 | __builtin_trap(); \ |
@@ -20,6 +20,6 @@ extern void do_BUG(const char *file, int line); | |||
20 | #include <asm-generic/bug.h> | 20 | #include <asm-generic/bug.h> |
21 | 21 | ||
22 | struct pt_regs; | 22 | struct pt_regs; |
23 | extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn)); | 23 | void __noreturn die_if_kernel(char *str, struct pt_regs *regs); |
24 | 24 | ||
25 | #endif | 25 | #endif |
diff --git a/arch/sparc/include/asm/cacheflush_32.h b/arch/sparc/include/asm/cacheflush_32.h index bb014c24f318..12164006181c 100644 --- a/arch/sparc/include/asm/cacheflush_32.h +++ b/arch/sparc/include/asm/cacheflush_32.h | |||
@@ -36,7 +36,7 @@ | |||
36 | #define flush_page_for_dma(addr) \ | 36 | #define flush_page_for_dma(addr) \ |
37 | sparc32_cachetlb_ops->page_for_dma(addr) | 37 | sparc32_cachetlb_ops->page_for_dma(addr) |
38 | 38 | ||
39 | extern void sparc_flush_page_to_ram(struct page *page); | 39 | void sparc_flush_page_to_ram(struct page *page); |
40 | 40 | ||
41 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | 41 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 |
42 | #define flush_dcache_page(page) sparc_flush_page_to_ram(page) | 42 | #define flush_dcache_page(page) sparc_flush_page_to_ram(page) |
@@ -51,8 +51,8 @@ extern void sparc_flush_page_to_ram(struct page *page); | |||
51 | * way the windows are all clean for the next process and the stack | 51 | * way the windows are all clean for the next process and the stack |
52 | * frames are up to date. | 52 | * frames are up to date. |
53 | */ | 53 | */ |
54 | extern void flush_user_windows(void); | 54 | void flush_user_windows(void); |
55 | extern void kill_user_windows(void); | 55 | void kill_user_windows(void); |
56 | extern void flushw_all(void); | 56 | void flushw_all(void); |
57 | 57 | ||
58 | #endif /* _SPARC_CACHEFLUSH_H */ | 58 | #endif /* _SPARC_CACHEFLUSH_H */ |
diff --git a/arch/sparc/include/asm/cacheflush_64.h b/arch/sparc/include/asm/cacheflush_64.h index 301736d9e7a1..38965379e350 100644 --- a/arch/sparc/include/asm/cacheflush_64.h +++ b/arch/sparc/include/asm/cacheflush_64.h | |||
@@ -10,7 +10,7 @@ | |||
10 | /* Cache flush operations. */ | 10 | /* Cache flush operations. */ |
11 | #define flushw_all() __asm__ __volatile__("flushw") | 11 | #define flushw_all() __asm__ __volatile__("flushw") |
12 | 12 | ||
13 | extern void __flushw_user(void); | 13 | void __flushw_user(void); |
14 | #define flushw_user() __flushw_user() | 14 | #define flushw_user() __flushw_user() |
15 | 15 | ||
16 | #define flush_user_windows flushw_user | 16 | #define flush_user_windows flushw_user |
@@ -30,29 +30,29 @@ extern void __flushw_user(void); | |||
30 | * use block commit stores (which invalidate icache lines) during | 30 | * use block commit stores (which invalidate icache lines) during |
31 | * module load, so we need this. | 31 | * module load, so we need this. |
32 | */ | 32 | */ |
33 | extern void flush_icache_range(unsigned long start, unsigned long end); | 33 | void flush_icache_range(unsigned long start, unsigned long end); |
34 | extern void __flush_icache_page(unsigned long); | 34 | void __flush_icache_page(unsigned long); |
35 | 35 | ||
36 | extern void __flush_dcache_page(void *addr, int flush_icache); | 36 | void __flush_dcache_page(void *addr, int flush_icache); |
37 | extern void flush_dcache_page_impl(struct page *page); | 37 | void flush_dcache_page_impl(struct page *page); |
38 | #ifdef CONFIG_SMP | 38 | #ifdef CONFIG_SMP |
39 | extern void smp_flush_dcache_page_impl(struct page *page, int cpu); | 39 | void smp_flush_dcache_page_impl(struct page *page, int cpu); |
40 | extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page); | 40 | void flush_dcache_page_all(struct mm_struct *mm, struct page *page); |
41 | #else | 41 | #else |
42 | #define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page) | 42 | #define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page) |
43 | #define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page) | 43 | #define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page) |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | extern void __flush_dcache_range(unsigned long start, unsigned long end); | 46 | void __flush_dcache_range(unsigned long start, unsigned long end); |
47 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | 47 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 |
48 | extern void flush_dcache_page(struct page *page); | 48 | void flush_dcache_page(struct page *page); |
49 | 49 | ||
50 | #define flush_icache_page(vma, pg) do { } while(0) | 50 | #define flush_icache_page(vma, pg) do { } while(0) |
51 | #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) | 51 | #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) |
52 | 52 | ||
53 | extern void flush_ptrace_access(struct vm_area_struct *, struct page *, | 53 | void flush_ptrace_access(struct vm_area_struct *, struct page *, |
54 | unsigned long uaddr, void *kaddr, | 54 | unsigned long uaddr, void *kaddr, |
55 | unsigned long len, int write); | 55 | unsigned long len, int write); |
56 | 56 | ||
57 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | 57 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ |
58 | do { \ | 58 | do { \ |
diff --git a/arch/sparc/include/asm/checksum_32.h b/arch/sparc/include/asm/checksum_32.h index 04471dc64847..426b2389a1c2 100644 --- a/arch/sparc/include/asm/checksum_32.h +++ b/arch/sparc/include/asm/checksum_32.h | |||
@@ -29,7 +29,7 @@ | |||
29 | * | 29 | * |
30 | * it's best to have buff aligned on a 32-bit boundary | 30 | * it's best to have buff aligned on a 32-bit boundary |
31 | */ | 31 | */ |
32 | extern __wsum csum_partial(const void *buff, int len, __wsum sum); | 32 | __wsum csum_partial(const void *buff, int len, __wsum sum); |
33 | 33 | ||
34 | /* the same as csum_partial, but copies from fs:src while it | 34 | /* the same as csum_partial, but copies from fs:src while it |
35 | * checksums | 35 | * checksums |
@@ -38,7 +38,7 @@ extern __wsum csum_partial(const void *buff, int len, __wsum sum); | |||
38 | * better 64-bit) boundary | 38 | * better 64-bit) boundary |
39 | */ | 39 | */ |
40 | 40 | ||
41 | extern unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *); | 41 | unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *); |
42 | 42 | ||
43 | static inline __wsum | 43 | static inline __wsum |
44 | csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) | 44 | csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) |
diff --git a/arch/sparc/include/asm/checksum_64.h b/arch/sparc/include/asm/checksum_64.h index 2ff81ae8f3af..b8779a6a5911 100644 --- a/arch/sparc/include/asm/checksum_64.h +++ b/arch/sparc/include/asm/checksum_64.h | |||
@@ -29,7 +29,7 @@ | |||
29 | * | 29 | * |
30 | * it's best to have buff aligned on a 32-bit boundary | 30 | * it's best to have buff aligned on a 32-bit boundary |
31 | */ | 31 | */ |
32 | extern __wsum csum_partial(const void * buff, int len, __wsum sum); | 32 | __wsum csum_partial(const void * buff, int len, __wsum sum); |
33 | 33 | ||
34 | /* the same as csum_partial, but copies from user space while it | 34 | /* the same as csum_partial, but copies from user space while it |
35 | * checksums | 35 | * checksums |
@@ -37,12 +37,12 @@ extern __wsum csum_partial(const void * buff, int len, __wsum sum); | |||
37 | * here even more important to align src and dst on a 32-bit (or even | 37 | * here even more important to align src and dst on a 32-bit (or even |
38 | * better 64-bit) boundary | 38 | * better 64-bit) boundary |
39 | */ | 39 | */ |
40 | extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, | 40 | __wsum csum_partial_copy_nocheck(const void *src, void *dst, |
41 | int len, __wsum sum); | 41 | int len, __wsum sum); |
42 | 42 | ||
43 | extern long __csum_partial_copy_from_user(const void __user *src, | 43 | long __csum_partial_copy_from_user(const void __user *src, |
44 | void *dst, int len, | 44 | void *dst, int len, |
45 | __wsum sum); | 45 | __wsum sum); |
46 | 46 | ||
47 | static inline __wsum | 47 | static inline __wsum |
48 | csum_partial_copy_from_user(const void __user *src, | 48 | csum_partial_copy_from_user(const void __user *src, |
@@ -59,9 +59,9 @@ csum_partial_copy_from_user(const void __user *src, | |||
59 | * Copy and checksum to user | 59 | * Copy and checksum to user |
60 | */ | 60 | */ |
61 | #define HAVE_CSUM_COPY_USER | 61 | #define HAVE_CSUM_COPY_USER |
62 | extern long __csum_partial_copy_to_user(const void *src, | 62 | long __csum_partial_copy_to_user(const void *src, |
63 | void __user *dst, int len, | 63 | void __user *dst, int len, |
64 | __wsum sum); | 64 | __wsum sum); |
65 | 65 | ||
66 | static inline __wsum | 66 | static inline __wsum |
67 | csum_and_copy_to_user(const void *src, | 67 | csum_and_copy_to_user(const void *src, |
@@ -77,7 +77,7 @@ csum_and_copy_to_user(const void *src, | |||
77 | /* ihl is always 5 or greater, almost always is 5, and iph is word aligned | 77 | /* ihl is always 5 or greater, almost always is 5, and iph is word aligned |
78 | * the majority of the time. | 78 | * the majority of the time. |
79 | */ | 79 | */ |
80 | extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); | 80 | __sum16 ip_fast_csum(const void *iph, unsigned int ihl); |
81 | 81 | ||
82 | /* Fold a partial checksum without adding pseudo headers. */ | 82 | /* Fold a partial checksum without adding pseudo headers. */ |
83 | static inline __sum16 csum_fold(__wsum sum) | 83 | static inline __sum16 csum_fold(__wsum sum) |
@@ -96,9 +96,9 @@ static inline __sum16 csum_fold(__wsum sum) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, | 98 | static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, |
99 | unsigned int len, | 99 | unsigned int len, |
100 | unsigned short proto, | 100 | unsigned short proto, |
101 | __wsum sum) | 101 | __wsum sum) |
102 | { | 102 | { |
103 | __asm__ __volatile__( | 103 | __asm__ __volatile__( |
104 | " addcc %1, %0, %0\n" | 104 | " addcc %1, %0, %0\n" |
@@ -116,9 +116,9 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, | |||
116 | * returns a 16-bit checksum, already complemented | 116 | * returns a 16-bit checksum, already complemented |
117 | */ | 117 | */ |
118 | static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, | 118 | static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, |
119 | unsigned short len, | 119 | unsigned short len, |
120 | unsigned short proto, | 120 | unsigned short proto, |
121 | __wsum sum) | 121 | __wsum sum) |
122 | { | 122 | { |
123 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | 123 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); |
124 | } | 124 | } |
diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h index 1fae1a02e3c2..32c29a133f9d 100644 --- a/arch/sparc/include/asm/cmpxchg_32.h +++ b/arch/sparc/include/asm/cmpxchg_32.h | |||
@@ -20,7 +20,7 @@ static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned lon | |||
20 | return val; | 20 | return val; |
21 | } | 21 | } |
22 | 22 | ||
23 | extern void __xchg_called_with_bad_pointer(void); | 23 | void __xchg_called_with_bad_pointer(void); |
24 | 24 | ||
25 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) | 25 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) |
26 | { | 26 | { |
@@ -45,9 +45,9 @@ static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int | |||
45 | #define __HAVE_ARCH_CMPXCHG 1 | 45 | #define __HAVE_ARCH_CMPXCHG 1 |
46 | 46 | ||
47 | /* bug catcher for when unsupported size is used - won't link */ | 47 | /* bug catcher for when unsupported size is used - won't link */ |
48 | extern void __cmpxchg_called_with_bad_pointer(void); | 48 | void __cmpxchg_called_with_bad_pointer(void); |
49 | /* we only need to support cmpxchg of a u32 on sparc */ | 49 | /* we only need to support cmpxchg of a u32 on sparc */ |
50 | extern unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); | 50 | unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); |
51 | 51 | ||
52 | /* don't worry...optimizer will get rid of most of this */ | 52 | /* don't worry...optimizer will get rid of most of this */ |
53 | static inline unsigned long | 53 | static inline unsigned long |
diff --git a/arch/sparc/include/asm/cmpxchg_64.h b/arch/sparc/include/asm/cmpxchg_64.h index 4adefe8e2885..0e1ed6cfbf68 100644 --- a/arch/sparc/include/asm/cmpxchg_64.h +++ b/arch/sparc/include/asm/cmpxchg_64.h | |||
@@ -42,7 +42,7 @@ static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long | |||
42 | 42 | ||
43 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | 43 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) |
44 | 44 | ||
45 | extern void __xchg_called_with_bad_pointer(void); | 45 | void __xchg_called_with_bad_pointer(void); |
46 | 46 | ||
47 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, | 47 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, |
48 | int size) | 48 | int size) |
@@ -91,7 +91,7 @@ __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) | |||
91 | 91 | ||
92 | /* This function doesn't exist, so you'll get a linker error | 92 | /* This function doesn't exist, so you'll get a linker error |
93 | if something tries to do an invalid cmpxchg(). */ | 93 | if something tries to do an invalid cmpxchg(). */ |
94 | extern void __cmpxchg_called_with_bad_pointer(void); | 94 | void __cmpxchg_called_with_bad_pointer(void); |
95 | 95 | ||
96 | static inline unsigned long | 96 | static inline unsigned long |
97 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | 97 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) |
diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h index b5976de7cacd..128b56b08676 100644 --- a/arch/sparc/include/asm/cpudata.h +++ b/arch/sparc/include/asm/cpudata.h | |||
@@ -1,5 +1,15 @@ | |||
1 | #ifndef ___ASM_SPARC_CPUDATA_H | 1 | #ifndef ___ASM_SPARC_CPUDATA_H |
2 | #define ___ASM_SPARC_CPUDATA_H | 2 | #define ___ASM_SPARC_CPUDATA_H |
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | |||
6 | #include <linux/threads.h> | ||
7 | #include <linux/percpu.h> | ||
8 | |||
9 | extern const struct seq_operations cpuinfo_op; | ||
10 | |||
11 | #endif /* !(__ASSEMBLY__) */ | ||
12 | |||
3 | #if defined(__sparc__) && defined(__arch64__) | 13 | #if defined(__sparc__) && defined(__arch64__) |
4 | #include <asm/cpudata_64.h> | 14 | #include <asm/cpudata_64.h> |
5 | #else | 15 | #else |
diff --git a/arch/sparc/include/asm/cpudata_64.h b/arch/sparc/include/asm/cpudata_64.h index 050ef35b9dcf..0e594076912c 100644 --- a/arch/sparc/include/asm/cpudata_64.h +++ b/arch/sparc/include/asm/cpudata_64.h | |||
@@ -8,9 +8,6 @@ | |||
8 | 8 | ||
9 | #ifndef __ASSEMBLY__ | 9 | #ifndef __ASSEMBLY__ |
10 | 10 | ||
11 | #include <linux/percpu.h> | ||
12 | #include <linux/threads.h> | ||
13 | |||
14 | typedef struct { | 11 | typedef struct { |
15 | /* Dcache line 1 */ | 12 | /* Dcache line 1 */ |
16 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ | 13 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ |
@@ -35,8 +32,6 @@ DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); | |||
35 | #define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu)) | 32 | #define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu)) |
36 | #define local_cpu_data() __get_cpu_var(__cpu_data) | 33 | #define local_cpu_data() __get_cpu_var(__cpu_data) |
37 | 34 | ||
38 | extern const struct seq_operations cpuinfo_op; | ||
39 | |||
40 | #endif /* !(__ASSEMBLY__) */ | 35 | #endif /* !(__ASSEMBLY__) */ |
41 | 36 | ||
42 | #include <asm/trap_block.h> | 37 | #include <asm/trap_block.h> |
diff --git a/arch/sparc/include/asm/delay_32.h b/arch/sparc/include/asm/delay_32.h index bc9aba2bead6..3fb8ca144b4f 100644 --- a/arch/sparc/include/asm/delay_32.h +++ b/arch/sparc/include/asm/delay_32.h | |||
@@ -20,8 +20,8 @@ static inline void __delay(unsigned long loops) | |||
20 | } | 20 | } |
21 | 21 | ||
22 | /* This is too messy with inline asm on the Sparc. */ | 22 | /* This is too messy with inline asm on the Sparc. */ |
23 | extern void __udelay(unsigned long usecs, unsigned long lpj); | 23 | void __udelay(unsigned long usecs, unsigned long lpj); |
24 | extern void __ndelay(unsigned long nsecs, unsigned long lpj); | 24 | void __ndelay(unsigned long nsecs, unsigned long lpj); |
25 | 25 | ||
26 | #ifdef CONFIG_SMP | 26 | #ifdef CONFIG_SMP |
27 | #define __udelay_val cpu_data(smp_processor_id()).udelay_val | 27 | #define __udelay_val cpu_data(smp_processor_id()).udelay_val |
diff --git a/arch/sparc/include/asm/delay_64.h b/arch/sparc/include/asm/delay_64.h index a77aa622d762..0ba5424856d8 100644 --- a/arch/sparc/include/asm/delay_64.h +++ b/arch/sparc/include/asm/delay_64.h | |||
@@ -8,8 +8,8 @@ | |||
8 | 8 | ||
9 | #ifndef __ASSEMBLY__ | 9 | #ifndef __ASSEMBLY__ |
10 | 10 | ||
11 | extern void __delay(unsigned long loops); | 11 | void __delay(unsigned long loops); |
12 | extern void udelay(unsigned long usecs); | 12 | void udelay(unsigned long usecs); |
13 | #define mdelay(n) udelay((n) * 1000) | 13 | #define mdelay(n) udelay((n) * 1000) |
14 | 14 | ||
15 | #endif /* !__ASSEMBLY__ */ | 15 | #endif /* !__ASSEMBLY__ */ |
diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h index daa6a8a5e9cd..bb3f0b0c6754 100644 --- a/arch/sparc/include/asm/device.h +++ b/arch/sparc/include/asm/device.h | |||
@@ -19,7 +19,7 @@ struct dev_archdata { | |||
19 | int numa_node; | 19 | int numa_node; |
20 | }; | 20 | }; |
21 | 21 | ||
22 | extern void of_propagate_archdata(struct platform_device *bus); | 22 | void of_propagate_archdata(struct platform_device *bus); |
23 | 23 | ||
24 | struct pdev_archdata { | 24 | struct pdev_archdata { |
25 | struct resource resource[PROMREG_MAX]; | 25 | struct resource resource[PROMREG_MAX]; |
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h index 05fe53f5346e..1ee02710b2dc 100644 --- a/arch/sparc/include/asm/dma-mapping.h +++ b/arch/sparc/include/asm/dma-mapping.h | |||
@@ -7,7 +7,7 @@ | |||
7 | 7 | ||
8 | #define DMA_ERROR_CODE (~(dma_addr_t)0x0) | 8 | #define DMA_ERROR_CODE (~(dma_addr_t)0x0) |
9 | 9 | ||
10 | extern int dma_supported(struct device *dev, u64 mask); | 10 | int dma_supported(struct device *dev, u64 mask); |
11 | 11 | ||
12 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | 12 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
13 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | 13 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) |
diff --git a/arch/sparc/include/asm/ebus_dma.h b/arch/sparc/include/asm/ebus_dma.h index f07a5b541c98..fcfb4948147f 100644 --- a/arch/sparc/include/asm/ebus_dma.h +++ b/arch/sparc/include/asm/ebus_dma.h | |||
@@ -22,14 +22,14 @@ struct ebus_dma_info { | |||
22 | unsigned char name[64]; | 22 | unsigned char name[64]; |
23 | }; | 23 | }; |
24 | 24 | ||
25 | extern int ebus_dma_register(struct ebus_dma_info *p); | 25 | int ebus_dma_register(struct ebus_dma_info *p); |
26 | extern int ebus_dma_irq_enable(struct ebus_dma_info *p, int on); | 26 | int ebus_dma_irq_enable(struct ebus_dma_info *p, int on); |
27 | extern void ebus_dma_unregister(struct ebus_dma_info *p); | 27 | void ebus_dma_unregister(struct ebus_dma_info *p); |
28 | extern int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr, | 28 | int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr, |
29 | size_t len); | 29 | size_t len); |
30 | extern void ebus_dma_prepare(struct ebus_dma_info *p, int write); | 30 | void ebus_dma_prepare(struct ebus_dma_info *p, int write); |
31 | extern unsigned int ebus_dma_residue(struct ebus_dma_info *p); | 31 | unsigned int ebus_dma_residue(struct ebus_dma_info *p); |
32 | extern unsigned int ebus_dma_addr(struct ebus_dma_info *p); | 32 | unsigned int ebus_dma_addr(struct ebus_dma_info *p); |
33 | extern void ebus_dma_enable(struct ebus_dma_info *p, int on); | 33 | void ebus_dma_enable(struct ebus_dma_info *p, int on); |
34 | 34 | ||
35 | #endif /* __ASM_SPARC_EBUS_DMA_H */ | 35 | #endif /* __ASM_SPARC_EBUS_DMA_H */ |
diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h index fb3f16954c69..071b83e52f15 100644 --- a/arch/sparc/include/asm/floppy_32.h +++ b/arch/sparc/include/asm/floppy_32.h | |||
@@ -9,11 +9,12 @@ | |||
9 | #include <linux/of.h> | 9 | #include <linux/of.h> |
10 | #include <linux/of_device.h> | 10 | #include <linux/of_device.h> |
11 | 11 | ||
12 | #include <asm/page.h> | ||
13 | #include <asm/pgtable.h> | 12 | #include <asm/pgtable.h> |
14 | #include <asm/idprom.h> | 13 | #include <asm/idprom.h> |
15 | #include <asm/oplib.h> | 14 | #include <asm/oplib.h> |
16 | #include <asm/auxio.h> | 15 | #include <asm/auxio.h> |
16 | #include <asm/setup.h> | ||
17 | #include <asm/page.h> | ||
17 | #include <asm/irq.h> | 18 | #include <asm/irq.h> |
18 | 19 | ||
19 | /* We don't need no stinkin' I/O port allocation crap. */ | 20 | /* We don't need no stinkin' I/O port allocation crap. */ |
@@ -49,7 +50,6 @@ struct sun_flpy_controller { | |||
49 | 50 | ||
50 | /* You'll only ever find one controller on a SparcStation anyways. */ | 51 | /* You'll only ever find one controller on a SparcStation anyways. */ |
51 | static struct sun_flpy_controller *sun_fdc = NULL; | 52 | static struct sun_flpy_controller *sun_fdc = NULL; |
52 | extern volatile unsigned char *fdc_status; | ||
53 | 53 | ||
54 | struct sun_floppy_ops { | 54 | struct sun_floppy_ops { |
55 | unsigned char (*fd_inb)(int port); | 55 | unsigned char (*fd_inb)(int port); |
@@ -212,13 +212,6 @@ static void sun_82077_fd_outb(unsigned char value, int port) | |||
212 | * underruns. If non-zero, doing_pdma encodes the direction of | 212 | * underruns. If non-zero, doing_pdma encodes the direction of |
213 | * the transfer for debugging. 1=read 2=write | 213 | * the transfer for debugging. 1=read 2=write |
214 | */ | 214 | */ |
215 | extern char *pdma_vaddr; | ||
216 | extern unsigned long pdma_size; | ||
217 | extern volatile int doing_pdma; | ||
218 | |||
219 | /* This is software state */ | ||
220 | extern char *pdma_base; | ||
221 | extern unsigned long pdma_areasize; | ||
222 | 215 | ||
223 | /* Common routines to all controller types on the Sparc. */ | 216 | /* Common routines to all controller types on the Sparc. */ |
224 | static inline void virtual_dma_init(void) | 217 | static inline void virtual_dma_init(void) |
@@ -263,8 +256,7 @@ static inline void sun_fd_enable_dma(void) | |||
263 | pdma_areasize = pdma_size; | 256 | pdma_areasize = pdma_size; |
264 | } | 257 | } |
265 | 258 | ||
266 | extern int sparc_floppy_request_irq(unsigned int irq, | 259 | int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler); |
267 | irq_handler_t irq_handler); | ||
268 | 260 | ||
269 | static int sun_fd_request_irq(void) | 261 | static int sun_fd_request_irq(void) |
270 | { | 262 | { |
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h index 7c90c50c200d..625756406a7e 100644 --- a/arch/sparc/include/asm/floppy_64.h +++ b/arch/sparc/include/asm/floppy_64.h | |||
@@ -296,7 +296,7 @@ struct sun_pci_dma_op { | |||
296 | static struct sun_pci_dma_op sun_pci_dma_current = { -1U, 0, 0, NULL}; | 296 | static struct sun_pci_dma_op sun_pci_dma_current = { -1U, 0, 0, NULL}; |
297 | static struct sun_pci_dma_op sun_pci_dma_pending = { -1U, 0, 0, NULL}; | 297 | static struct sun_pci_dma_op sun_pci_dma_pending = { -1U, 0, 0, NULL}; |
298 | 298 | ||
299 | extern irqreturn_t floppy_interrupt(int irq, void *dev_id); | 299 | irqreturn_t floppy_interrupt(int irq, void *dev_id); |
300 | 300 | ||
301 | static unsigned char sun_pci_fd_inb(unsigned long port) | 301 | static unsigned char sun_pci_fd_inb(unsigned long port) |
302 | { | 302 | { |
diff --git a/arch/sparc/include/asm/ftrace.h b/arch/sparc/include/asm/ftrace.h index b0f18e9893db..9ec94ad116fb 100644 --- a/arch/sparc/include/asm/ftrace.h +++ b/arch/sparc/include/asm/ftrace.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ | 6 | #define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ |
7 | 7 | ||
8 | #ifndef __ASSEMBLY__ | 8 | #ifndef __ASSEMBLY__ |
9 | extern void _mcount(void); | 9 | void _mcount(void); |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #endif | 12 | #endif |
@@ -22,4 +22,8 @@ struct dyn_arch_ftrace { | |||
22 | }; | 22 | }; |
23 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 23 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
24 | 24 | ||
25 | unsigned long prepare_ftrace_return(unsigned long parent, | ||
26 | unsigned long self_addr, | ||
27 | unsigned long frame_pointer); | ||
28 | |||
25 | #endif /* _ASM_SPARC64_FTRACE */ | 29 | #endif /* _ASM_SPARC64_FTRACE */ |
diff --git a/arch/sparc/include/asm/highmem.h b/arch/sparc/include/asm/highmem.h index 4f9e15c757e2..92ded294a4ec 100644 --- a/arch/sparc/include/asm/highmem.h +++ b/arch/sparc/include/asm/highmem.h | |||
@@ -31,7 +31,7 @@ extern unsigned long highstart_pfn, highend_pfn; | |||
31 | extern pgprot_t kmap_prot; | 31 | extern pgprot_t kmap_prot; |
32 | extern pte_t *pkmap_page_table; | 32 | extern pte_t *pkmap_page_table; |
33 | 33 | ||
34 | extern void kmap_init(void) __init; | 34 | void kmap_init(void) __init; |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * Right now we initialize only a single pte table. It can be extended | 37 | * Right now we initialize only a single pte table. It can be extended |
@@ -49,8 +49,8 @@ extern void kmap_init(void) __init; | |||
49 | 49 | ||
50 | #define PKMAP_END (PKMAP_ADDR(LAST_PKMAP)) | 50 | #define PKMAP_END (PKMAP_ADDR(LAST_PKMAP)) |
51 | 51 | ||
52 | extern void *kmap_high(struct page *page); | 52 | void *kmap_high(struct page *page); |
53 | extern void kunmap_high(struct page *page); | 53 | void kunmap_high(struct page *page); |
54 | 54 | ||
55 | static inline void *kmap(struct page *page) | 55 | static inline void *kmap(struct page *page) |
56 | { | 56 | { |
@@ -68,8 +68,8 @@ static inline void kunmap(struct page *page) | |||
68 | kunmap_high(page); | 68 | kunmap_high(page); |
69 | } | 69 | } |
70 | 70 | ||
71 | extern void *kmap_atomic(struct page *page); | 71 | void *kmap_atomic(struct page *page); |
72 | extern void __kunmap_atomic(void *kvaddr); | 72 | void __kunmap_atomic(void *kvaddr); |
73 | 73 | ||
74 | #define flush_cache_kmaps() flush_cache_all() | 74 | #define flush_cache_kmaps() flush_cache_all() |
75 | 75 | ||
diff --git a/arch/sparc/include/asm/hvtramp.h b/arch/sparc/include/asm/hvtramp.h index b2b9b947b3a4..04b56f862bbe 100644 --- a/arch/sparc/include/asm/hvtramp.h +++ b/arch/sparc/include/asm/hvtramp.h | |||
@@ -19,7 +19,7 @@ struct hvtramp_descr { | |||
19 | struct hvtramp_mapping maps[1]; | 19 | struct hvtramp_mapping maps[1]; |
20 | }; | 20 | }; |
21 | 21 | ||
22 | extern void hv_cpu_startup(unsigned long hvdescr_pa); | 22 | void hv_cpu_startup(unsigned long hvdescr_pa); |
23 | 23 | ||
24 | #endif | 24 | #endif |
25 | 25 | ||
diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h index ca121f0fa3ec..94b39caea3eb 100644 --- a/arch/sparc/include/asm/hypervisor.h +++ b/arch/sparc/include/asm/hypervisor.h | |||
@@ -98,7 +98,7 @@ | |||
98 | #define HV_FAST_MACH_EXIT 0x00 | 98 | #define HV_FAST_MACH_EXIT 0x00 |
99 | 99 | ||
100 | #ifndef __ASSEMBLY__ | 100 | #ifndef __ASSEMBLY__ |
101 | extern void sun4v_mach_exit(unsigned long exit_code); | 101 | void sun4v_mach_exit(unsigned long exit_code); |
102 | #endif | 102 | #endif |
103 | 103 | ||
104 | /* Domain services. */ | 104 | /* Domain services. */ |
@@ -127,9 +127,9 @@ extern void sun4v_mach_exit(unsigned long exit_code); | |||
127 | #define HV_FAST_MACH_DESC 0x01 | 127 | #define HV_FAST_MACH_DESC 0x01 |
128 | 128 | ||
129 | #ifndef __ASSEMBLY__ | 129 | #ifndef __ASSEMBLY__ |
130 | extern unsigned long sun4v_mach_desc(unsigned long buffer_pa, | 130 | unsigned long sun4v_mach_desc(unsigned long buffer_pa, |
131 | unsigned long buf_len, | 131 | unsigned long buf_len, |
132 | unsigned long *real_buf_len); | 132 | unsigned long *real_buf_len); |
133 | #endif | 133 | #endif |
134 | 134 | ||
135 | /* mach_sir() | 135 | /* mach_sir() |
@@ -148,7 +148,7 @@ extern unsigned long sun4v_mach_desc(unsigned long buffer_pa, | |||
148 | #define HV_FAST_MACH_SIR 0x02 | 148 | #define HV_FAST_MACH_SIR 0x02 |
149 | 149 | ||
150 | #ifndef __ASSEMBLY__ | 150 | #ifndef __ASSEMBLY__ |
151 | extern void sun4v_mach_sir(void); | 151 | void sun4v_mach_sir(void); |
152 | #endif | 152 | #endif |
153 | 153 | ||
154 | /* mach_set_watchdog() | 154 | /* mach_set_watchdog() |
@@ -204,8 +204,8 @@ extern void sun4v_mach_sir(void); | |||
204 | #define HV_FAST_MACH_SET_WATCHDOG 0x05 | 204 | #define HV_FAST_MACH_SET_WATCHDOG 0x05 |
205 | 205 | ||
206 | #ifndef __ASSEMBLY__ | 206 | #ifndef __ASSEMBLY__ |
207 | extern unsigned long sun4v_mach_set_watchdog(unsigned long timeout, | 207 | unsigned long sun4v_mach_set_watchdog(unsigned long timeout, |
208 | unsigned long *orig_timeout); | 208 | unsigned long *orig_timeout); |
209 | #endif | 209 | #endif |
210 | 210 | ||
211 | /* CPU services. | 211 | /* CPU services. |
@@ -250,10 +250,10 @@ extern unsigned long sun4v_mach_set_watchdog(unsigned long timeout, | |||
250 | #define HV_FAST_CPU_START 0x10 | 250 | #define HV_FAST_CPU_START 0x10 |
251 | 251 | ||
252 | #ifndef __ASSEMBLY__ | 252 | #ifndef __ASSEMBLY__ |
253 | extern unsigned long sun4v_cpu_start(unsigned long cpuid, | 253 | unsigned long sun4v_cpu_start(unsigned long cpuid, |
254 | unsigned long pc, | 254 | unsigned long pc, |
255 | unsigned long rtba, | 255 | unsigned long rtba, |
256 | unsigned long arg0); | 256 | unsigned long arg0); |
257 | #endif | 257 | #endif |
258 | 258 | ||
259 | /* cpu_stop() | 259 | /* cpu_stop() |
@@ -278,7 +278,7 @@ extern unsigned long sun4v_cpu_start(unsigned long cpuid, | |||
278 | #define HV_FAST_CPU_STOP 0x11 | 278 | #define HV_FAST_CPU_STOP 0x11 |
279 | 279 | ||
280 | #ifndef __ASSEMBLY__ | 280 | #ifndef __ASSEMBLY__ |
281 | extern unsigned long sun4v_cpu_stop(unsigned long cpuid); | 281 | unsigned long sun4v_cpu_stop(unsigned long cpuid); |
282 | #endif | 282 | #endif |
283 | 283 | ||
284 | /* cpu_yield() | 284 | /* cpu_yield() |
@@ -295,7 +295,7 @@ extern unsigned long sun4v_cpu_stop(unsigned long cpuid); | |||
295 | #define HV_FAST_CPU_YIELD 0x12 | 295 | #define HV_FAST_CPU_YIELD 0x12 |
296 | 296 | ||
297 | #ifndef __ASSEMBLY__ | 297 | #ifndef __ASSEMBLY__ |
298 | extern unsigned long sun4v_cpu_yield(void); | 298 | unsigned long sun4v_cpu_yield(void); |
299 | #endif | 299 | #endif |
300 | 300 | ||
301 | /* cpu_qconf() | 301 | /* cpu_qconf() |
@@ -341,9 +341,9 @@ extern unsigned long sun4v_cpu_yield(void); | |||
341 | #define HV_CPU_QUEUE_NONRES_ERROR 0x3f | 341 | #define HV_CPU_QUEUE_NONRES_ERROR 0x3f |
342 | 342 | ||
343 | #ifndef __ASSEMBLY__ | 343 | #ifndef __ASSEMBLY__ |
344 | extern unsigned long sun4v_cpu_qconf(unsigned long type, | 344 | unsigned long sun4v_cpu_qconf(unsigned long type, |
345 | unsigned long queue_paddr, | 345 | unsigned long queue_paddr, |
346 | unsigned long num_queue_entries); | 346 | unsigned long num_queue_entries); |
347 | #endif | 347 | #endif |
348 | 348 | ||
349 | /* cpu_qinfo() | 349 | /* cpu_qinfo() |
@@ -394,7 +394,9 @@ extern unsigned long sun4v_cpu_qconf(unsigned long type, | |||
394 | #define HV_FAST_CPU_MONDO_SEND 0x42 | 394 | #define HV_FAST_CPU_MONDO_SEND 0x42 |
395 | 395 | ||
396 | #ifndef __ASSEMBLY__ | 396 | #ifndef __ASSEMBLY__ |
397 | extern unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count, unsigned long cpu_list_pa, unsigned long mondo_block_pa); | 397 | unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count, |
398 | unsigned long cpu_list_pa, | ||
399 | unsigned long mondo_block_pa); | ||
398 | #endif | 400 | #endif |
399 | 401 | ||
400 | /* cpu_myid() | 402 | /* cpu_myid() |
@@ -425,7 +427,7 @@ extern unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count, unsigned long | |||
425 | #define HV_CPU_STATE_ERROR 0x03 | 427 | #define HV_CPU_STATE_ERROR 0x03 |
426 | 428 | ||
427 | #ifndef __ASSEMBLY__ | 429 | #ifndef __ASSEMBLY__ |
428 | extern long sun4v_cpu_state(unsigned long cpuid); | 430 | long sun4v_cpu_state(unsigned long cpuid); |
429 | #endif | 431 | #endif |
430 | 432 | ||
431 | /* cpu_set_rtba() | 433 | /* cpu_set_rtba() |
@@ -625,8 +627,8 @@ struct hv_fault_status { | |||
625 | #define HV_FAST_MMU_TSB_CTX0 0x20 | 627 | #define HV_FAST_MMU_TSB_CTX0 0x20 |
626 | 628 | ||
627 | #ifndef __ASSEMBLY__ | 629 | #ifndef __ASSEMBLY__ |
628 | extern unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions, | 630 | unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions, |
629 | unsigned long tsb_desc_ra); | 631 | unsigned long tsb_desc_ra); |
630 | #endif | 632 | #endif |
631 | 633 | ||
632 | /* mmu_tsb_ctxnon0() | 634 | /* mmu_tsb_ctxnon0() |
@@ -710,7 +712,7 @@ extern unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions, | |||
710 | #define HV_FAST_MMU_DEMAP_ALL 0x24 | 712 | #define HV_FAST_MMU_DEMAP_ALL 0x24 |
711 | 713 | ||
712 | #ifndef __ASSEMBLY__ | 714 | #ifndef __ASSEMBLY__ |
713 | extern void sun4v_mmu_demap_all(void); | 715 | void sun4v_mmu_demap_all(void); |
714 | #endif | 716 | #endif |
715 | 717 | ||
716 | /* mmu_map_perm_addr() | 718 | /* mmu_map_perm_addr() |
@@ -740,10 +742,10 @@ extern void sun4v_mmu_demap_all(void); | |||
740 | #define HV_FAST_MMU_MAP_PERM_ADDR 0x25 | 742 | #define HV_FAST_MMU_MAP_PERM_ADDR 0x25 |
741 | 743 | ||
742 | #ifndef __ASSEMBLY__ | 744 | #ifndef __ASSEMBLY__ |
743 | extern unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr, | 745 | unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr, |
744 | unsigned long set_to_zero, | 746 | unsigned long set_to_zero, |
745 | unsigned long tte, | 747 | unsigned long tte, |
746 | unsigned long flags); | 748 | unsigned long flags); |
747 | #endif | 749 | #endif |
748 | 750 | ||
749 | /* mmu_fault_area_conf() | 751 | /* mmu_fault_area_conf() |
@@ -945,7 +947,7 @@ extern unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr, | |||
945 | #define HV_FAST_TOD_GET 0x50 | 947 | #define HV_FAST_TOD_GET 0x50 |
946 | 948 | ||
947 | #ifndef __ASSEMBLY__ | 949 | #ifndef __ASSEMBLY__ |
948 | extern unsigned long sun4v_tod_get(unsigned long *time); | 950 | unsigned long sun4v_tod_get(unsigned long *time); |
949 | #endif | 951 | #endif |
950 | 952 | ||
951 | /* tod_set() | 953 | /* tod_set() |
@@ -962,7 +964,7 @@ extern unsigned long sun4v_tod_get(unsigned long *time); | |||
962 | #define HV_FAST_TOD_SET 0x51 | 964 | #define HV_FAST_TOD_SET 0x51 |
963 | 965 | ||
964 | #ifndef __ASSEMBLY__ | 966 | #ifndef __ASSEMBLY__ |
965 | extern unsigned long sun4v_tod_set(unsigned long time); | 967 | unsigned long sun4v_tod_set(unsigned long time); |
966 | #endif | 968 | #endif |
967 | 969 | ||
968 | /* Console services */ | 970 | /* Console services */ |
@@ -1038,14 +1040,14 @@ extern unsigned long sun4v_tod_set(unsigned long time); | |||
1038 | #define HV_FAST_CONS_WRITE 0x63 | 1040 | #define HV_FAST_CONS_WRITE 0x63 |
1039 | 1041 | ||
1040 | #ifndef __ASSEMBLY__ | 1042 | #ifndef __ASSEMBLY__ |
1041 | extern long sun4v_con_getchar(long *status); | 1043 | long sun4v_con_getchar(long *status); |
1042 | extern long sun4v_con_putchar(long c); | 1044 | long sun4v_con_putchar(long c); |
1043 | extern long sun4v_con_read(unsigned long buffer, | 1045 | long sun4v_con_read(unsigned long buffer, |
1044 | unsigned long size, | 1046 | unsigned long size, |
1045 | unsigned long *bytes_read); | 1047 | unsigned long *bytes_read); |
1046 | extern unsigned long sun4v_con_write(unsigned long buffer, | 1048 | unsigned long sun4v_con_write(unsigned long buffer, |
1047 | unsigned long size, | 1049 | unsigned long size, |
1048 | unsigned long *bytes_written); | 1050 | unsigned long *bytes_written); |
1049 | #endif | 1051 | #endif |
1050 | 1052 | ||
1051 | /* mach_set_soft_state() | 1053 | /* mach_set_soft_state() |
@@ -1080,8 +1082,8 @@ extern unsigned long sun4v_con_write(unsigned long buffer, | |||
1080 | #define HV_SOFT_STATE_TRANSITION 0x02 | 1082 | #define HV_SOFT_STATE_TRANSITION 0x02 |
1081 | 1083 | ||
1082 | #ifndef __ASSEMBLY__ | 1084 | #ifndef __ASSEMBLY__ |
1083 | extern unsigned long sun4v_mach_set_soft_state(unsigned long soft_state, | 1085 | unsigned long sun4v_mach_set_soft_state(unsigned long soft_state, |
1084 | unsigned long msg_string_ra); | 1086 | unsigned long msg_string_ra); |
1085 | #endif | 1087 | #endif |
1086 | 1088 | ||
1087 | /* mach_get_soft_state() | 1089 | /* mach_get_soft_state() |
@@ -1159,20 +1161,20 @@ extern unsigned long sun4v_mach_set_soft_state(unsigned long soft_state, | |||
1159 | #define HV_FAST_SVC_CLRSTATUS 0x84 | 1161 | #define HV_FAST_SVC_CLRSTATUS 0x84 |
1160 | 1162 | ||
1161 | #ifndef __ASSEMBLY__ | 1163 | #ifndef __ASSEMBLY__ |
1162 | extern unsigned long sun4v_svc_send(unsigned long svc_id, | 1164 | unsigned long sun4v_svc_send(unsigned long svc_id, |
1163 | unsigned long buffer, | 1165 | unsigned long buffer, |
1164 | unsigned long buffer_size, | 1166 | unsigned long buffer_size, |
1165 | unsigned long *sent_bytes); | 1167 | unsigned long *sent_bytes); |
1166 | extern unsigned long sun4v_svc_recv(unsigned long svc_id, | 1168 | unsigned long sun4v_svc_recv(unsigned long svc_id, |
1167 | unsigned long buffer, | 1169 | unsigned long buffer, |
1168 | unsigned long buffer_size, | 1170 | unsigned long buffer_size, |
1169 | unsigned long *recv_bytes); | 1171 | unsigned long *recv_bytes); |
1170 | extern unsigned long sun4v_svc_getstatus(unsigned long svc_id, | 1172 | unsigned long sun4v_svc_getstatus(unsigned long svc_id, |
1171 | unsigned long *status_bits); | 1173 | unsigned long *status_bits); |
1172 | extern unsigned long sun4v_svc_setstatus(unsigned long svc_id, | 1174 | unsigned long sun4v_svc_setstatus(unsigned long svc_id, |
1173 | unsigned long status_bits); | 1175 | unsigned long status_bits); |
1174 | extern unsigned long sun4v_svc_clrstatus(unsigned long svc_id, | 1176 | unsigned long sun4v_svc_clrstatus(unsigned long svc_id, |
1175 | unsigned long status_bits); | 1177 | unsigned long status_bits); |
1176 | #endif | 1178 | #endif |
1177 | 1179 | ||
1178 | /* Trap trace services. | 1180 | /* Trap trace services. |
@@ -1458,8 +1460,8 @@ struct hv_trap_trace_entry { | |||
1458 | #define HV_FAST_INTR_DEVINO2SYSINO 0xa0 | 1460 | #define HV_FAST_INTR_DEVINO2SYSINO 0xa0 |
1459 | 1461 | ||
1460 | #ifndef __ASSEMBLY__ | 1462 | #ifndef __ASSEMBLY__ |
1461 | extern unsigned long sun4v_devino_to_sysino(unsigned long devhandle, | 1463 | unsigned long sun4v_devino_to_sysino(unsigned long devhandle, |
1462 | unsigned long devino); | 1464 | unsigned long devino); |
1463 | #endif | 1465 | #endif |
1464 | 1466 | ||
1465 | /* intr_getenabled() | 1467 | /* intr_getenabled() |
@@ -1476,7 +1478,7 @@ extern unsigned long sun4v_devino_to_sysino(unsigned long devhandle, | |||
1476 | #define HV_FAST_INTR_GETENABLED 0xa1 | 1478 | #define HV_FAST_INTR_GETENABLED 0xa1 |
1477 | 1479 | ||
1478 | #ifndef __ASSEMBLY__ | 1480 | #ifndef __ASSEMBLY__ |
1479 | extern unsigned long sun4v_intr_getenabled(unsigned long sysino); | 1481 | unsigned long sun4v_intr_getenabled(unsigned long sysino); |
1480 | #endif | 1482 | #endif |
1481 | 1483 | ||
1482 | /* intr_setenabled() | 1484 | /* intr_setenabled() |
@@ -1492,7 +1494,8 @@ extern unsigned long sun4v_intr_getenabled(unsigned long sysino); | |||
1492 | #define HV_FAST_INTR_SETENABLED 0xa2 | 1494 | #define HV_FAST_INTR_SETENABLED 0xa2 |
1493 | 1495 | ||
1494 | #ifndef __ASSEMBLY__ | 1496 | #ifndef __ASSEMBLY__ |
1495 | extern unsigned long sun4v_intr_setenabled(unsigned long sysino, unsigned long intr_enabled); | 1497 | unsigned long sun4v_intr_setenabled(unsigned long sysino, |
1498 | unsigned long intr_enabled); | ||
1496 | #endif | 1499 | #endif |
1497 | 1500 | ||
1498 | /* intr_getstate() | 1501 | /* intr_getstate() |
@@ -1508,7 +1511,7 @@ extern unsigned long sun4v_intr_setenabled(unsigned long sysino, unsigned long i | |||
1508 | #define HV_FAST_INTR_GETSTATE 0xa3 | 1511 | #define HV_FAST_INTR_GETSTATE 0xa3 |
1509 | 1512 | ||
1510 | #ifndef __ASSEMBLY__ | 1513 | #ifndef __ASSEMBLY__ |
1511 | extern unsigned long sun4v_intr_getstate(unsigned long sysino); | 1514 | unsigned long sun4v_intr_getstate(unsigned long sysino); |
1512 | #endif | 1515 | #endif |
1513 | 1516 | ||
1514 | /* intr_setstate() | 1517 | /* intr_setstate() |
@@ -1528,7 +1531,7 @@ extern unsigned long sun4v_intr_getstate(unsigned long sysino); | |||
1528 | #define HV_FAST_INTR_SETSTATE 0xa4 | 1531 | #define HV_FAST_INTR_SETSTATE 0xa4 |
1529 | 1532 | ||
1530 | #ifndef __ASSEMBLY__ | 1533 | #ifndef __ASSEMBLY__ |
1531 | extern unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long intr_state); | 1534 | unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long intr_state); |
1532 | #endif | 1535 | #endif |
1533 | 1536 | ||
1534 | /* intr_gettarget() | 1537 | /* intr_gettarget() |
@@ -1546,7 +1549,7 @@ extern unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long int | |||
1546 | #define HV_FAST_INTR_GETTARGET 0xa5 | 1549 | #define HV_FAST_INTR_GETTARGET 0xa5 |
1547 | 1550 | ||
1548 | #ifndef __ASSEMBLY__ | 1551 | #ifndef __ASSEMBLY__ |
1549 | extern unsigned long sun4v_intr_gettarget(unsigned long sysino); | 1552 | unsigned long sun4v_intr_gettarget(unsigned long sysino); |
1550 | #endif | 1553 | #endif |
1551 | 1554 | ||
1552 | /* intr_settarget() | 1555 | /* intr_settarget() |
@@ -1563,7 +1566,7 @@ extern unsigned long sun4v_intr_gettarget(unsigned long sysino); | |||
1563 | #define HV_FAST_INTR_SETTARGET 0xa6 | 1566 | #define HV_FAST_INTR_SETTARGET 0xa6 |
1564 | 1567 | ||
1565 | #ifndef __ASSEMBLY__ | 1568 | #ifndef __ASSEMBLY__ |
1566 | extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid); | 1569 | unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid); |
1567 | #endif | 1570 | #endif |
1568 | 1571 | ||
1569 | /* vintr_get_cookie() | 1572 | /* vintr_get_cookie() |
@@ -1647,30 +1650,30 @@ extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cp | |||
1647 | #define HV_FAST_VINTR_SET_TARGET 0xae | 1650 | #define HV_FAST_VINTR_SET_TARGET 0xae |
1648 | 1651 | ||
1649 | #ifndef __ASSEMBLY__ | 1652 | #ifndef __ASSEMBLY__ |
1650 | extern unsigned long sun4v_vintr_get_cookie(unsigned long dev_handle, | 1653 | unsigned long sun4v_vintr_get_cookie(unsigned long dev_handle, |
1651 | unsigned long dev_ino, | 1654 | unsigned long dev_ino, |
1652 | unsigned long *cookie); | 1655 | unsigned long *cookie); |
1653 | extern unsigned long sun4v_vintr_set_cookie(unsigned long dev_handle, | 1656 | unsigned long sun4v_vintr_set_cookie(unsigned long dev_handle, |
1654 | unsigned long dev_ino, | 1657 | unsigned long dev_ino, |
1655 | unsigned long cookie); | 1658 | unsigned long cookie); |
1656 | extern unsigned long sun4v_vintr_get_valid(unsigned long dev_handle, | 1659 | unsigned long sun4v_vintr_get_valid(unsigned long dev_handle, |
1657 | unsigned long dev_ino, | 1660 | unsigned long dev_ino, |
1658 | unsigned long *valid); | 1661 | unsigned long *valid); |
1659 | extern unsigned long sun4v_vintr_set_valid(unsigned long dev_handle, | 1662 | unsigned long sun4v_vintr_set_valid(unsigned long dev_handle, |
1660 | unsigned long dev_ino, | 1663 | unsigned long dev_ino, |
1661 | unsigned long valid); | 1664 | unsigned long valid); |
1662 | extern unsigned long sun4v_vintr_get_state(unsigned long dev_handle, | 1665 | unsigned long sun4v_vintr_get_state(unsigned long dev_handle, |
1663 | unsigned long dev_ino, | 1666 | unsigned long dev_ino, |
1664 | unsigned long *state); | 1667 | unsigned long *state); |
1665 | extern unsigned long sun4v_vintr_set_state(unsigned long dev_handle, | 1668 | unsigned long sun4v_vintr_set_state(unsigned long dev_handle, |
1666 | unsigned long dev_ino, | 1669 | unsigned long dev_ino, |
1667 | unsigned long state); | 1670 | unsigned long state); |
1668 | extern unsigned long sun4v_vintr_get_target(unsigned long dev_handle, | 1671 | unsigned long sun4v_vintr_get_target(unsigned long dev_handle, |
1669 | unsigned long dev_ino, | 1672 | unsigned long dev_ino, |
1670 | unsigned long *cpuid); | 1673 | unsigned long *cpuid); |
1671 | extern unsigned long sun4v_vintr_set_target(unsigned long dev_handle, | 1674 | unsigned long sun4v_vintr_set_target(unsigned long dev_handle, |
1672 | unsigned long dev_ino, | 1675 | unsigned long dev_ino, |
1673 | unsigned long cpuid); | 1676 | unsigned long cpuid); |
1674 | #endif | 1677 | #endif |
1675 | 1678 | ||
1676 | /* PCI IO services. | 1679 | /* PCI IO services. |
@@ -2627,50 +2630,50 @@ struct ldc_mtable_entry { | |||
2627 | #define HV_FAST_LDC_REVOKE 0xef | 2630 | #define HV_FAST_LDC_REVOKE 0xef |
2628 | 2631 | ||
2629 | #ifndef __ASSEMBLY__ | 2632 | #ifndef __ASSEMBLY__ |
2630 | extern unsigned long sun4v_ldc_tx_qconf(unsigned long channel, | 2633 | unsigned long sun4v_ldc_tx_qconf(unsigned long channel, |
2631 | unsigned long ra, | 2634 | unsigned long ra, |
2632 | unsigned long num_entries); | 2635 | unsigned long num_entries); |
2633 | extern unsigned long sun4v_ldc_tx_qinfo(unsigned long channel, | 2636 | unsigned long sun4v_ldc_tx_qinfo(unsigned long channel, |
2634 | unsigned long *ra, | 2637 | unsigned long *ra, |
2635 | unsigned long *num_entries); | 2638 | unsigned long *num_entries); |
2636 | extern unsigned long sun4v_ldc_tx_get_state(unsigned long channel, | 2639 | unsigned long sun4v_ldc_tx_get_state(unsigned long channel, |
2637 | unsigned long *head_off, | 2640 | unsigned long *head_off, |
2638 | unsigned long *tail_off, | 2641 | unsigned long *tail_off, |
2639 | unsigned long *chan_state); | 2642 | unsigned long *chan_state); |
2640 | extern unsigned long sun4v_ldc_tx_set_qtail(unsigned long channel, | 2643 | unsigned long sun4v_ldc_tx_set_qtail(unsigned long channel, |
2641 | unsigned long tail_off); | 2644 | unsigned long tail_off); |
2642 | extern unsigned long sun4v_ldc_rx_qconf(unsigned long channel, | 2645 | unsigned long sun4v_ldc_rx_qconf(unsigned long channel, |
2643 | unsigned long ra, | 2646 | unsigned long ra, |
2644 | unsigned long num_entries); | 2647 | unsigned long num_entries); |
2645 | extern unsigned long sun4v_ldc_rx_qinfo(unsigned long channel, | 2648 | unsigned long sun4v_ldc_rx_qinfo(unsigned long channel, |
2646 | unsigned long *ra, | 2649 | unsigned long *ra, |
2647 | unsigned long *num_entries); | 2650 | unsigned long *num_entries); |
2648 | extern unsigned long sun4v_ldc_rx_get_state(unsigned long channel, | 2651 | unsigned long sun4v_ldc_rx_get_state(unsigned long channel, |
2649 | unsigned long *head_off, | 2652 | unsigned long *head_off, |
2650 | unsigned long *tail_off, | 2653 | unsigned long *tail_off, |
2651 | unsigned long *chan_state); | 2654 | unsigned long *chan_state); |
2652 | extern unsigned long sun4v_ldc_rx_set_qhead(unsigned long channel, | 2655 | unsigned long sun4v_ldc_rx_set_qhead(unsigned long channel, |
2653 | unsigned long head_off); | 2656 | unsigned long head_off); |
2654 | extern unsigned long sun4v_ldc_set_map_table(unsigned long channel, | 2657 | unsigned long sun4v_ldc_set_map_table(unsigned long channel, |
2655 | unsigned long ra, | 2658 | unsigned long ra, |
2656 | unsigned long num_entries); | 2659 | unsigned long num_entries); |
2657 | extern unsigned long sun4v_ldc_get_map_table(unsigned long channel, | 2660 | unsigned long sun4v_ldc_get_map_table(unsigned long channel, |
2658 | unsigned long *ra, | 2661 | unsigned long *ra, |
2659 | unsigned long *num_entries); | 2662 | unsigned long *num_entries); |
2660 | extern unsigned long sun4v_ldc_copy(unsigned long channel, | 2663 | unsigned long sun4v_ldc_copy(unsigned long channel, |
2661 | unsigned long dir_code, | 2664 | unsigned long dir_code, |
2662 | unsigned long tgt_raddr, | 2665 | unsigned long tgt_raddr, |
2663 | unsigned long lcl_raddr, | 2666 | unsigned long lcl_raddr, |
2664 | unsigned long len, | 2667 | unsigned long len, |
2665 | unsigned long *actual_len); | 2668 | unsigned long *actual_len); |
2666 | extern unsigned long sun4v_ldc_mapin(unsigned long channel, | 2669 | unsigned long sun4v_ldc_mapin(unsigned long channel, |
2667 | unsigned long cookie, | 2670 | unsigned long cookie, |
2668 | unsigned long *ra, | 2671 | unsigned long *ra, |
2669 | unsigned long *perm); | 2672 | unsigned long *perm); |
2670 | extern unsigned long sun4v_ldc_unmap(unsigned long ra); | 2673 | unsigned long sun4v_ldc_unmap(unsigned long ra); |
2671 | extern unsigned long sun4v_ldc_revoke(unsigned long channel, | 2674 | unsigned long sun4v_ldc_revoke(unsigned long channel, |
2672 | unsigned long cookie, | 2675 | unsigned long cookie, |
2673 | unsigned long mte_cookie); | 2676 | unsigned long mte_cookie); |
2674 | #endif | 2677 | #endif |
2675 | 2678 | ||
2676 | /* Performance counter services. */ | 2679 | /* Performance counter services. */ |
@@ -2727,14 +2730,14 @@ extern unsigned long sun4v_ldc_revoke(unsigned long channel, | |||
2727 | #define HV_FAST_N2_SET_PERFREG 0x105 | 2730 | #define HV_FAST_N2_SET_PERFREG 0x105 |
2728 | 2731 | ||
2729 | #ifndef __ASSEMBLY__ | 2732 | #ifndef __ASSEMBLY__ |
2730 | extern unsigned long sun4v_niagara_getperf(unsigned long reg, | 2733 | unsigned long sun4v_niagara_getperf(unsigned long reg, |
2731 | unsigned long *val); | 2734 | unsigned long *val); |
2732 | extern unsigned long sun4v_niagara_setperf(unsigned long reg, | 2735 | unsigned long sun4v_niagara_setperf(unsigned long reg, |
2733 | unsigned long val); | 2736 | unsigned long val); |
2734 | extern unsigned long sun4v_niagara2_getperf(unsigned long reg, | 2737 | unsigned long sun4v_niagara2_getperf(unsigned long reg, |
2735 | unsigned long *val); | 2738 | unsigned long *val); |
2736 | extern unsigned long sun4v_niagara2_setperf(unsigned long reg, | 2739 | unsigned long sun4v_niagara2_setperf(unsigned long reg, |
2737 | unsigned long val); | 2740 | unsigned long val); |
2738 | #endif | 2741 | #endif |
2739 | 2742 | ||
2740 | /* MMU statistics services. | 2743 | /* MMU statistics services. |
@@ -2829,8 +2832,8 @@ struct hv_mmu_statistics { | |||
2829 | #define HV_FAST_MMUSTAT_INFO 0x103 | 2832 | #define HV_FAST_MMUSTAT_INFO 0x103 |
2830 | 2833 | ||
2831 | #ifndef __ASSEMBLY__ | 2834 | #ifndef __ASSEMBLY__ |
2832 | extern unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra); | 2835 | unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra); |
2833 | extern unsigned long sun4v_mmustat_info(unsigned long *ra); | 2836 | unsigned long sun4v_mmustat_info(unsigned long *ra); |
2834 | #endif | 2837 | #endif |
2835 | 2838 | ||
2836 | /* NCS crypto services */ | 2839 | /* NCS crypto services */ |
@@ -2919,9 +2922,9 @@ struct hv_ncs_qtail_update_arg { | |||
2919 | #define HV_FAST_NCS_REQUEST 0x110 | 2922 | #define HV_FAST_NCS_REQUEST 0x110 |
2920 | 2923 | ||
2921 | #ifndef __ASSEMBLY__ | 2924 | #ifndef __ASSEMBLY__ |
2922 | extern unsigned long sun4v_ncs_request(unsigned long request, | 2925 | unsigned long sun4v_ncs_request(unsigned long request, |
2923 | unsigned long arg_ra, | 2926 | unsigned long arg_ra, |
2924 | unsigned long arg_size); | 2927 | unsigned long arg_size); |
2925 | #endif | 2928 | #endif |
2926 | 2929 | ||
2927 | #define HV_FAST_FIRE_GET_PERFREG 0x120 | 2930 | #define HV_FAST_FIRE_GET_PERFREG 0x120 |
@@ -2930,18 +2933,18 @@ extern unsigned long sun4v_ncs_request(unsigned long request, | |||
2930 | #define HV_FAST_REBOOT_DATA_SET 0x172 | 2933 | #define HV_FAST_REBOOT_DATA_SET 0x172 |
2931 | 2934 | ||
2932 | #ifndef __ASSEMBLY__ | 2935 | #ifndef __ASSEMBLY__ |
2933 | extern unsigned long sun4v_reboot_data_set(unsigned long ra, | 2936 | unsigned long sun4v_reboot_data_set(unsigned long ra, |
2934 | unsigned long len); | 2937 | unsigned long len); |
2935 | #endif | 2938 | #endif |
2936 | 2939 | ||
2937 | #define HV_FAST_VT_GET_PERFREG 0x184 | 2940 | #define HV_FAST_VT_GET_PERFREG 0x184 |
2938 | #define HV_FAST_VT_SET_PERFREG 0x185 | 2941 | #define HV_FAST_VT_SET_PERFREG 0x185 |
2939 | 2942 | ||
2940 | #ifndef __ASSEMBLY__ | 2943 | #ifndef __ASSEMBLY__ |
2941 | extern unsigned long sun4v_vt_get_perfreg(unsigned long reg_num, | 2944 | unsigned long sun4v_vt_get_perfreg(unsigned long reg_num, |
2942 | unsigned long *reg_val); | 2945 | unsigned long *reg_val); |
2943 | extern unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, | 2946 | unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, |
2944 | unsigned long reg_val); | 2947 | unsigned long reg_val); |
2945 | #endif | 2948 | #endif |
2946 | 2949 | ||
2947 | /* Function numbers for HV_CORE_TRAP. */ | 2950 | /* Function numbers for HV_CORE_TRAP. */ |
@@ -2978,21 +2981,21 @@ extern unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, | |||
2978 | #define HV_GRP_DIAG 0x0300 | 2981 | #define HV_GRP_DIAG 0x0300 |
2979 | 2982 | ||
2980 | #ifndef __ASSEMBLY__ | 2983 | #ifndef __ASSEMBLY__ |
2981 | extern unsigned long sun4v_get_version(unsigned long group, | 2984 | unsigned long sun4v_get_version(unsigned long group, |
2982 | unsigned long *major, | 2985 | unsigned long *major, |
2983 | unsigned long *minor); | 2986 | unsigned long *minor); |
2984 | extern unsigned long sun4v_set_version(unsigned long group, | 2987 | unsigned long sun4v_set_version(unsigned long group, |
2985 | unsigned long major, | 2988 | unsigned long major, |
2986 | unsigned long minor, | 2989 | unsigned long minor, |
2987 | unsigned long *actual_minor); | 2990 | unsigned long *actual_minor); |
2988 | 2991 | ||
2989 | extern int sun4v_hvapi_register(unsigned long group, unsigned long major, | 2992 | int sun4v_hvapi_register(unsigned long group, unsigned long major, |
2990 | unsigned long *minor); | 2993 | unsigned long *minor); |
2991 | extern void sun4v_hvapi_unregister(unsigned long group); | 2994 | void sun4v_hvapi_unregister(unsigned long group); |
2992 | extern int sun4v_hvapi_get(unsigned long group, | 2995 | int sun4v_hvapi_get(unsigned long group, |
2993 | unsigned long *major, | 2996 | unsigned long *major, |
2994 | unsigned long *minor); | 2997 | unsigned long *minor); |
2995 | extern void sun4v_hvapi_init(void); | 2998 | void sun4v_hvapi_init(void); |
2996 | #endif | 2999 | #endif |
2997 | 3000 | ||
2998 | #endif /* !(_SPARC64_HYPERVISOR_H) */ | 3001 | #endif /* !(_SPARC64_HYPERVISOR_H) */ |
diff --git a/arch/sparc/include/asm/idprom.h b/arch/sparc/include/asm/idprom.h index 6976aa2439c6..3793f7f91c42 100644 --- a/arch/sparc/include/asm/idprom.h +++ b/arch/sparc/include/asm/idprom.h | |||
@@ -20,6 +20,6 @@ struct idprom { | |||
20 | }; | 20 | }; |
21 | 21 | ||
22 | extern struct idprom *idprom; | 22 | extern struct idprom *idprom; |
23 | extern void idprom_init(void); | 23 | void idprom_init(void); |
24 | 24 | ||
25 | #endif /* !(_SPARC_IDPROM_H) */ | 25 | #endif /* !(_SPARC_IDPROM_H) */ |
diff --git a/arch/sparc/include/asm/io-unit.h b/arch/sparc/include/asm/io-unit.h index 01ab2f613e91..04a9701e7202 100644 --- a/arch/sparc/include/asm/io-unit.h +++ b/arch/sparc/include/asm/io-unit.h | |||
@@ -43,7 +43,7 @@ | |||
43 | struct iounit_struct { | 43 | struct iounit_struct { |
44 | unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)]; | 44 | unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)]; |
45 | spinlock_t lock; | 45 | spinlock_t lock; |
46 | iopte_t *page_table; | 46 | iopte_t __iomem *page_table; |
47 | unsigned long rotor[3]; | 47 | unsigned long rotor[3]; |
48 | unsigned long limit[4]; | 48 | unsigned long limit[4]; |
49 | }; | 49 | }; |
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h index c1acbd891cbc..9f532902627c 100644 --- a/arch/sparc/include/asm/io_32.h +++ b/arch/sparc/include/asm/io_32.h | |||
@@ -2,191 +2,94 @@ | |||
2 | #define __SPARC_IO_H | 2 | #define __SPARC_IO_H |
3 | 3 | ||
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <linux/types.h> | ||
6 | #include <linux/ioport.h> /* struct resource */ | 5 | #include <linux/ioport.h> /* struct resource */ |
7 | 6 | ||
8 | #include <asm/page.h> /* IO address mapping routines need this */ | 7 | #define readb_relaxed(__addr) readb(__addr) |
9 | #include <asm-generic/pci_iomap.h> | 8 | #define readw_relaxed(__addr) readw(__addr) |
10 | 9 | #define readl_relaxed(__addr) readl(__addr) | |
11 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | ||
12 | |||
13 | static inline u32 flip_dword (u32 l) | ||
14 | { | ||
15 | return ((l&0xff)<<24) | (((l>>8)&0xff)<<16) | (((l>>16)&0xff)<<8)| ((l>>24)&0xff); | ||
16 | } | ||
17 | |||
18 | static inline u16 flip_word (u16 w) | ||
19 | { | ||
20 | return ((w&0xff) << 8) | ((w>>8)&0xff); | ||
21 | } | ||
22 | |||
23 | #define mmiowb() | ||
24 | |||
25 | /* | ||
26 | * Memory mapped I/O to PCI | ||
27 | */ | ||
28 | |||
29 | static inline u8 __raw_readb(const volatile void __iomem *addr) | ||
30 | { | ||
31 | return *(__force volatile u8 *)addr; | ||
32 | } | ||
33 | |||
34 | static inline u16 __raw_readw(const volatile void __iomem *addr) | ||
35 | { | ||
36 | return *(__force volatile u16 *)addr; | ||
37 | } | ||
38 | |||
39 | static inline u32 __raw_readl(const volatile void __iomem *addr) | ||
40 | { | ||
41 | return *(__force volatile u32 *)addr; | ||
42 | } | ||
43 | 10 | ||
44 | static inline void __raw_writeb(u8 b, volatile void __iomem *addr) | 11 | #define IO_SPACE_LIMIT 0xffffffff |
45 | { | ||
46 | *(__force volatile u8 *)addr = b; | ||
47 | } | ||
48 | 12 | ||
49 | static inline void __raw_writew(u16 w, volatile void __iomem *addr) | 13 | #define memset_io(d,c,sz) _memset_io(d,c,sz) |
50 | { | 14 | #define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz) |
51 | *(__force volatile u16 *)addr = w; | 15 | #define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz) |
52 | } | ||
53 | 16 | ||
54 | static inline void __raw_writel(u32 l, volatile void __iomem *addr) | 17 | #include <asm-generic/io.h> |
55 | { | ||
56 | *(__force volatile u32 *)addr = l; | ||
57 | } | ||
58 | 18 | ||
59 | static inline u8 __readb(const volatile void __iomem *addr) | 19 | static inline void _memset_io(volatile void __iomem *dst, |
20 | int c, __kernel_size_t n) | ||
60 | { | 21 | { |
61 | return *(__force volatile u8 *)addr; | 22 | volatile void __iomem *d = dst; |
62 | } | ||
63 | 23 | ||
64 | static inline u16 __readw(const volatile void __iomem *addr) | 24 | while (n--) { |
65 | { | 25 | writeb(c, d); |
66 | return flip_word(*(__force volatile u16 *)addr); | 26 | d++; |
27 | } | ||
67 | } | 28 | } |
68 | 29 | ||
69 | static inline u32 __readl(const volatile void __iomem *addr) | 30 | static inline void _memcpy_fromio(void *dst, const volatile void __iomem *src, |
31 | __kernel_size_t n) | ||
70 | { | 32 | { |
71 | return flip_dword(*(__force volatile u32 *)addr); | 33 | char *d = dst; |
72 | } | ||
73 | 34 | ||
74 | static inline void __writeb(u8 b, volatile void __iomem *addr) | 35 | while (n--) { |
75 | { | 36 | char tmp = readb(src); |
76 | *(__force volatile u8 *)addr = b; | 37 | *d++ = tmp; |
38 | src++; | ||
39 | } | ||
77 | } | 40 | } |
78 | 41 | ||
79 | static inline void __writew(u16 w, volatile void __iomem *addr) | 42 | static inline void _memcpy_toio(volatile void __iomem *dst, const void *src, |
43 | __kernel_size_t n) | ||
80 | { | 44 | { |
81 | *(__force volatile u16 *)addr = flip_word(w); | 45 | const char *s = src; |
82 | } | 46 | volatile void __iomem *d = dst; |
83 | 47 | ||
84 | static inline void __writel(u32 l, volatile void __iomem *addr) | 48 | while (n--) { |
85 | { | 49 | char tmp = *s++; |
86 | *(__force volatile u32 *)addr = flip_dword(l); | 50 | writeb(tmp, d); |
51 | d++; | ||
52 | } | ||
87 | } | 53 | } |
88 | 54 | ||
89 | #define readb(__addr) __readb(__addr) | ||
90 | #define readw(__addr) __readw(__addr) | ||
91 | #define readl(__addr) __readl(__addr) | ||
92 | #define readb_relaxed(__addr) readb(__addr) | ||
93 | #define readw_relaxed(__addr) readw(__addr) | ||
94 | #define readl_relaxed(__addr) readl(__addr) | ||
95 | |||
96 | #define writeb(__b, __addr) __writeb((__b),(__addr)) | ||
97 | #define writew(__w, __addr) __writew((__w),(__addr)) | ||
98 | #define writel(__l, __addr) __writel((__l),(__addr)) | ||
99 | |||
100 | /* | ||
101 | * I/O space operations | ||
102 | * | ||
103 | * Arrangement on a Sun is somewhat complicated. | ||
104 | * | ||
105 | * First of all, we want to use standard Linux drivers | ||
106 | * for keyboard, PC serial, etc. These drivers think | ||
107 | * they access I/O space and use inb/outb. | ||
108 | * On the other hand, EBus bridge accepts PCI *memory* | ||
109 | * cycles and converts them into ISA *I/O* cycles. | ||
110 | * Ergo, we want inb & outb to generate PCI memory cycles. | ||
111 | * | ||
112 | * If we want to issue PCI *I/O* cycles, we do this | ||
113 | * with a low 64K fixed window in PCIC. This window gets | ||
114 | * mapped somewhere into virtual kernel space and we | ||
115 | * can use inb/outb again. | ||
116 | */ | ||
117 | #define inb_local(__addr) __readb((void __iomem *)(unsigned long)(__addr)) | ||
118 | #define inb(__addr) __readb((void __iomem *)(unsigned long)(__addr)) | ||
119 | #define inw(__addr) __readw((void __iomem *)(unsigned long)(__addr)) | ||
120 | #define inl(__addr) __readl((void __iomem *)(unsigned long)(__addr)) | ||
121 | |||
122 | #define outb_local(__b, __addr) __writeb(__b, (void __iomem *)(unsigned long)(__addr)) | ||
123 | #define outb(__b, __addr) __writeb(__b, (void __iomem *)(unsigned long)(__addr)) | ||
124 | #define outw(__w, __addr) __writew(__w, (void __iomem *)(unsigned long)(__addr)) | ||
125 | #define outl(__l, __addr) __writel(__l, (void __iomem *)(unsigned long)(__addr)) | ||
126 | |||
127 | #define inb_p(__addr) inb(__addr) | ||
128 | #define outb_p(__b, __addr) outb(__b, __addr) | ||
129 | #define inw_p(__addr) inw(__addr) | ||
130 | #define outw_p(__w, __addr) outw(__w, __addr) | ||
131 | #define inl_p(__addr) inl(__addr) | ||
132 | #define outl_p(__l, __addr) outl(__l, __addr) | ||
133 | |||
134 | void outsb(unsigned long addr, const void *src, unsigned long cnt); | ||
135 | void outsw(unsigned long addr, const void *src, unsigned long cnt); | ||
136 | void outsl(unsigned long addr, const void *src, unsigned long cnt); | ||
137 | void insb(unsigned long addr, void *dst, unsigned long count); | ||
138 | void insw(unsigned long addr, void *dst, unsigned long count); | ||
139 | void insl(unsigned long addr, void *dst, unsigned long count); | ||
140 | |||
141 | #define IO_SPACE_LIMIT 0xffffffff | ||
142 | |||
143 | /* | 55 | /* |
144 | * SBus accessors. | 56 | * SBus accessors. |
145 | * | 57 | * |
146 | * SBus has only one, memory mapped, I/O space. | 58 | * SBus has only one, memory mapped, I/O space. |
147 | * We do not need to flip bytes for SBus of course. | 59 | * We do not need to flip bytes for SBus of course. |
148 | */ | 60 | */ |
149 | static inline u8 _sbus_readb(const volatile void __iomem *addr) | 61 | static inline u8 sbus_readb(const volatile void __iomem *addr) |
150 | { | 62 | { |
151 | return *(__force volatile u8 *)addr; | 63 | return *(__force volatile u8 *)addr; |
152 | } | 64 | } |
153 | 65 | ||
154 | static inline u16 _sbus_readw(const volatile void __iomem *addr) | 66 | static inline u16 sbus_readw(const volatile void __iomem *addr) |
155 | { | 67 | { |
156 | return *(__force volatile u16 *)addr; | 68 | return *(__force volatile u16 *)addr; |
157 | } | 69 | } |
158 | 70 | ||
159 | static inline u32 _sbus_readl(const volatile void __iomem *addr) | 71 | static inline u32 sbus_readl(const volatile void __iomem *addr) |
160 | { | 72 | { |
161 | return *(__force volatile u32 *)addr; | 73 | return *(__force volatile u32 *)addr; |
162 | } | 74 | } |
163 | 75 | ||
164 | static inline void _sbus_writeb(u8 b, volatile void __iomem *addr) | 76 | static inline void sbus_writeb(u8 b, volatile void __iomem *addr) |
165 | { | 77 | { |
166 | *(__force volatile u8 *)addr = b; | 78 | *(__force volatile u8 *)addr = b; |
167 | } | 79 | } |
168 | 80 | ||
169 | static inline void _sbus_writew(u16 w, volatile void __iomem *addr) | 81 | static inline void sbus_writew(u16 w, volatile void __iomem *addr) |
170 | { | 82 | { |
171 | *(__force volatile u16 *)addr = w; | 83 | *(__force volatile u16 *)addr = w; |
172 | } | 84 | } |
173 | 85 | ||
174 | static inline void _sbus_writel(u32 l, volatile void __iomem *addr) | 86 | static inline void sbus_writel(u32 l, volatile void __iomem *addr) |
175 | { | 87 | { |
176 | *(__force volatile u32 *)addr = l; | 88 | *(__force volatile u32 *)addr = l; |
177 | } | 89 | } |
178 | 90 | ||
179 | /* | 91 | static inline void sbus_memset_io(volatile void __iomem *__dst, int c, |
180 | * The only reason for #define's is to hide casts to unsigned long. | 92 | __kernel_size_t n) |
181 | */ | ||
182 | #define sbus_readb(__addr) _sbus_readb(__addr) | ||
183 | #define sbus_readw(__addr) _sbus_readw(__addr) | ||
184 | #define sbus_readl(__addr) _sbus_readl(__addr) | ||
185 | #define sbus_writeb(__b, __addr) _sbus_writeb(__b, __addr) | ||
186 | #define sbus_writew(__w, __addr) _sbus_writew(__w, __addr) | ||
187 | #define sbus_writel(__l, __addr) _sbus_writel(__l, __addr) | ||
188 | |||
189 | static inline void sbus_memset_io(volatile void __iomem *__dst, int c, __kernel_size_t n) | ||
190 | { | 93 | { |
191 | while(n--) { | 94 | while(n--) { |
192 | sbus_writeb(c, __dst); | 95 | sbus_writeb(c, __dst); |
@@ -194,22 +97,9 @@ static inline void sbus_memset_io(volatile void __iomem *__dst, int c, __kernel_ | |||
194 | } | 97 | } |
195 | } | 98 | } |
196 | 99 | ||
197 | static inline void | 100 | static inline void sbus_memcpy_fromio(void *dst, |
198 | _memset_io(volatile void __iomem *dst, int c, __kernel_size_t n) | 101 | const volatile void __iomem *src, |
199 | { | 102 | __kernel_size_t n) |
200 | volatile void __iomem *d = dst; | ||
201 | |||
202 | while (n--) { | ||
203 | writeb(c, d); | ||
204 | d++; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | #define memset_io(d,c,sz) _memset_io(d,c,sz) | ||
209 | |||
210 | static inline void | ||
211 | _sbus_memcpy_fromio(void *dst, const volatile void __iomem *src, | ||
212 | __kernel_size_t n) | ||
213 | { | 103 | { |
214 | char *d = dst; | 104 | char *d = dst; |
215 | 105 | ||
@@ -220,25 +110,9 @@ _sbus_memcpy_fromio(void *dst, const volatile void __iomem *src, | |||
220 | } | 110 | } |
221 | } | 111 | } |
222 | 112 | ||
223 | #define sbus_memcpy_fromio(d, s, sz) _sbus_memcpy_fromio(d, s, sz) | 113 | static inline void sbus_memcpy_toio(volatile void __iomem *dst, |
224 | 114 | const void *src, | |
225 | static inline void | 115 | __kernel_size_t n) |
226 | _memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n) | ||
227 | { | ||
228 | char *d = dst; | ||
229 | |||
230 | while (n--) { | ||
231 | char tmp = readb(src); | ||
232 | *d++ = tmp; | ||
233 | src++; | ||
234 | } | ||
235 | } | ||
236 | |||
237 | #define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz) | ||
238 | |||
239 | static inline void | ||
240 | _sbus_memcpy_toio(volatile void __iomem *dst, const void *src, | ||
241 | __kernel_size_t n) | ||
242 | { | 116 | { |
243 | const char *s = src; | 117 | const char *s = src; |
244 | volatile void __iomem *d = dst; | 118 | volatile void __iomem *d = dst; |
@@ -250,81 +124,26 @@ _sbus_memcpy_toio(volatile void __iomem *dst, const void *src, | |||
250 | } | 124 | } |
251 | } | 125 | } |
252 | 126 | ||
253 | #define sbus_memcpy_toio(d, s, sz) _sbus_memcpy_toio(d, s, sz) | ||
254 | |||
255 | static inline void | ||
256 | _memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n) | ||
257 | { | ||
258 | const char *s = src; | ||
259 | volatile void __iomem *d = dst; | ||
260 | |||
261 | while (n--) { | ||
262 | char tmp = *s++; | ||
263 | writeb(tmp, d); | ||
264 | d++; | ||
265 | } | ||
266 | } | ||
267 | |||
268 | #define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz) | ||
269 | |||
270 | #ifdef __KERNEL__ | 127 | #ifdef __KERNEL__ |
271 | 128 | ||
272 | /* | 129 | /* |
273 | * Bus number may be embedded in the higher bits of the physical address. | 130 | * Bus number may be embedded in the higher bits of the physical address. |
274 | * This is why we have no bus number argument to ioremap(). | 131 | * This is why we have no bus number argument to ioremap(). |
275 | */ | 132 | */ |
276 | extern void __iomem *ioremap(unsigned long offset, unsigned long size); | 133 | void __iomem *ioremap(unsigned long offset, unsigned long size); |
277 | #define ioremap_nocache(X,Y) ioremap((X),(Y)) | 134 | #define ioremap_nocache(X,Y) ioremap((X),(Y)) |
278 | #define ioremap_wc(X,Y) ioremap((X),(Y)) | 135 | #define ioremap_wc(X,Y) ioremap((X),(Y)) |
279 | extern void iounmap(volatile void __iomem *addr); | 136 | void iounmap(volatile void __iomem *addr); |
280 | |||
281 | #define ioread8(X) readb(X) | ||
282 | #define ioread16(X) readw(X) | ||
283 | #define ioread16be(X) __raw_readw(X) | ||
284 | #define ioread32(X) readl(X) | ||
285 | #define ioread32be(X) __raw_readl(X) | ||
286 | #define iowrite8(val,X) writeb(val,X) | ||
287 | #define iowrite16(val,X) writew(val,X) | ||
288 | #define iowrite16be(val,X) __raw_writew(val,X) | ||
289 | #define iowrite32(val,X) writel(val,X) | ||
290 | #define iowrite32be(val,X) __raw_writel(val,X) | ||
291 | |||
292 | static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count) | ||
293 | { | ||
294 | insb((unsigned long __force)port, buf, count); | ||
295 | } | ||
296 | static inline void ioread16_rep(void __iomem *port, void *buf, unsigned long count) | ||
297 | { | ||
298 | insw((unsigned long __force)port, buf, count); | ||
299 | } | ||
300 | |||
301 | static inline void ioread32_rep(void __iomem *port, void *buf, unsigned long count) | ||
302 | { | ||
303 | insl((unsigned long __force)port, buf, count); | ||
304 | } | ||
305 | |||
306 | static inline void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count) | ||
307 | { | ||
308 | outsb((unsigned long __force)port, buf, count); | ||
309 | } | ||
310 | |||
311 | static inline void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count) | ||
312 | { | ||
313 | outsw((unsigned long __force)port, buf, count); | ||
314 | } | ||
315 | |||
316 | static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count) | ||
317 | { | ||
318 | outsl((unsigned long __force)port, buf, count); | ||
319 | } | ||
320 | 137 | ||
321 | /* Create a virtual mapping cookie for an IO port range */ | 138 | /* Create a virtual mapping cookie for an IO port range */ |
322 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr); | 139 | void __iomem *ioport_map(unsigned long port, unsigned int nr); |
323 | extern void ioport_unmap(void __iomem *); | 140 | void ioport_unmap(void __iomem *); |
324 | 141 | ||
325 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | 142 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ |
326 | struct pci_dev; | 143 | struct pci_dev; |
327 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *); | 144 | void pci_iounmap(struct pci_dev *dev, void __iomem *); |
145 | |||
146 | |||
328 | 147 | ||
329 | /* | 148 | /* |
330 | * At the moment, we do not use CMOS_READ anywhere outside of rtc.c, | 149 | * At the moment, we do not use CMOS_READ anywhere outside of rtc.c, |
@@ -343,21 +162,11 @@ static inline int sbus_can_burst64(void) | |||
343 | return 0; /* actually, sparc_cpu_model==sun4d */ | 162 | return 0; /* actually, sparc_cpu_model==sun4d */ |
344 | } | 163 | } |
345 | struct device; | 164 | struct device; |
346 | extern void sbus_set_sbus64(struct device *, int); | 165 | void sbus_set_sbus64(struct device *, int); |
347 | 166 | ||
348 | #endif | 167 | #endif |
349 | 168 | ||
350 | #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1 | 169 | #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1 |
351 | 170 | ||
352 | /* | ||
353 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
354 | * access | ||
355 | */ | ||
356 | #define xlate_dev_mem_ptr(p) __va(p) | ||
357 | |||
358 | /* | ||
359 | * Convert a virtual cached pointer to an uncached pointer | ||
360 | */ | ||
361 | #define xlate_dev_kmem_ptr(p) p | ||
362 | 171 | ||
363 | #endif /* !(__SPARC_IO_H) */ | 172 | #endif /* !(__SPARC_IO_H) */ |
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h index 09b0b88aeb2a..05381c3a4228 100644 --- a/arch/sparc/include/asm/io_64.h +++ b/arch/sparc/include/asm/io_64.h | |||
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | /* BIO layer definitions. */ | 16 | /* BIO layer definitions. */ |
17 | extern unsigned long kern_base, kern_size; | 17 | extern unsigned long kern_base, kern_size; |
18 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | ||
19 | 18 | ||
20 | static inline u8 _inb(unsigned long addr) | 19 | static inline u8 _inb(unsigned long addr) |
21 | { | 20 | { |
@@ -91,12 +90,12 @@ static inline void _outl(u32 l, unsigned long addr) | |||
91 | #define inl_p(__addr) inl(__addr) | 90 | #define inl_p(__addr) inl(__addr) |
92 | #define outl_p(__l, __addr) outl(__l, __addr) | 91 | #define outl_p(__l, __addr) outl(__l, __addr) |
93 | 92 | ||
94 | extern void outsb(unsigned long, const void *, unsigned long); | 93 | void outsb(unsigned long, const void *, unsigned long); |
95 | extern void outsw(unsigned long, const void *, unsigned long); | 94 | void outsw(unsigned long, const void *, unsigned long); |
96 | extern void outsl(unsigned long, const void *, unsigned long); | 95 | void outsl(unsigned long, const void *, unsigned long); |
97 | extern void insb(unsigned long, void *, unsigned long); | 96 | void insb(unsigned long, void *, unsigned long); |
98 | extern void insw(unsigned long, void *, unsigned long); | 97 | void insw(unsigned long, void *, unsigned long); |
99 | extern void insl(unsigned long, void *, unsigned long); | 98 | void insl(unsigned long, void *, unsigned long); |
100 | 99 | ||
101 | static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count) | 100 | static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count) |
102 | { | 101 | { |
@@ -509,12 +508,12 @@ static inline void iounmap(volatile void __iomem *addr) | |||
509 | #define iowrite32be(val,X) __raw_writel(val,X) | 508 | #define iowrite32be(val,X) __raw_writel(val,X) |
510 | 509 | ||
511 | /* Create a virtual mapping cookie for an IO port range */ | 510 | /* Create a virtual mapping cookie for an IO port range */ |
512 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr); | 511 | void __iomem *ioport_map(unsigned long port, unsigned int nr); |
513 | extern void ioport_unmap(void __iomem *); | 512 | void ioport_unmap(void __iomem *); |
514 | 513 | ||
515 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | 514 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ |
516 | struct pci_dev; | 515 | struct pci_dev; |
517 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *); | 516 | void pci_iounmap(struct pci_dev *dev, void __iomem *); |
518 | 517 | ||
519 | static inline int sbus_can_dma_64bit(void) | 518 | static inline int sbus_can_dma_64bit(void) |
520 | { | 519 | { |
@@ -525,7 +524,7 @@ static inline int sbus_can_burst64(void) | |||
525 | return 1; | 524 | return 1; |
526 | } | 525 | } |
527 | struct device; | 526 | struct device; |
528 | extern void sbus_set_sbus64(struct device *, int); | 527 | void sbus_set_sbus64(struct device *, int); |
529 | 528 | ||
530 | /* | 529 | /* |
531 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | 530 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem |
diff --git a/arch/sparc/include/asm/iommu_32.h b/arch/sparc/include/asm/iommu_32.h index 70c589c05a10..f6c066b52fd6 100644 --- a/arch/sparc/include/asm/iommu_32.h +++ b/arch/sparc/include/asm/iommu_32.h | |||
@@ -99,7 +99,7 @@ struct iommu_regs { | |||
99 | #define IOPTE_WAZ 0x00000001 /* Write as zeros */ | 99 | #define IOPTE_WAZ 0x00000001 /* Write as zeros */ |
100 | 100 | ||
101 | struct iommu_struct { | 101 | struct iommu_struct { |
102 | struct iommu_regs *regs; | 102 | struct iommu_regs __iomem *regs; |
103 | iopte_t *page_table; | 103 | iopte_t *page_table; |
104 | /* For convenience */ | 104 | /* For convenience */ |
105 | unsigned long start; /* First managed virtual address */ | 105 | unsigned long start; /* First managed virtual address */ |
@@ -108,14 +108,14 @@ struct iommu_struct { | |||
108 | struct bit_map usemap; | 108 | struct bit_map usemap; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | static inline void iommu_invalidate(struct iommu_regs *regs) | 111 | static inline void iommu_invalidate(struct iommu_regs __iomem *regs) |
112 | { | 112 | { |
113 | regs->tlbflush = 0; | 113 | sbus_writel(0, ®s->tlbflush); |
114 | } | 114 | } |
115 | 115 | ||
116 | static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba) | 116 | static inline void iommu_invalidate_page(struct iommu_regs __iomem *regs, unsigned long ba) |
117 | { | 117 | { |
118 | regs->pageflush = (ba & PAGE_MASK); | 118 | sbus_writel(ba & PAGE_MASK, ®s->pageflush); |
119 | } | 119 | } |
120 | 120 | ||
121 | #endif /* !(_SPARC_IOMMU_H) */ | 121 | #endif /* !(_SPARC_IOMMU_H) */ |
diff --git a/arch/sparc/include/asm/iommu_64.h b/arch/sparc/include/asm/iommu_64.h index caf798b56191..2b9321ab064d 100644 --- a/arch/sparc/include/asm/iommu_64.h +++ b/arch/sparc/include/asm/iommu_64.h | |||
@@ -58,8 +58,8 @@ struct strbuf { | |||
58 | volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)]; | 58 | volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)]; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | extern int iommu_table_init(struct iommu *iommu, int tsbsize, | 61 | int iommu_table_init(struct iommu *iommu, int tsbsize, |
62 | u32 dma_offset, u32 dma_addr_mask, | 62 | u32 dma_offset, u32 dma_addr_mask, |
63 | int numa_node); | 63 | int numa_node); |
64 | 64 | ||
65 | #endif /* !(_SPARC64_IOMMU_H) */ | 65 | #endif /* !(_SPARC64_IOMMU_H) */ |
diff --git a/arch/sparc/include/asm/irq_32.h b/arch/sparc/include/asm/irq_32.h index 2ae3acaeb1b3..eecd3d8442c9 100644 --- a/arch/sparc/include/asm/irq_32.h +++ b/arch/sparc/include/asm/irq_32.h | |||
@@ -16,7 +16,8 @@ | |||
16 | 16 | ||
17 | #define irq_canonicalize(irq) (irq) | 17 | #define irq_canonicalize(irq) (irq) |
18 | 18 | ||
19 | extern void __init init_IRQ(void); | 19 | void __init init_IRQ(void); |
20 | void __init sun4d_init_sbi_irq(void); | ||
20 | 21 | ||
21 | #define NO_IRQ 0xffffffff | 22 | #define NO_IRQ 0xffffffff |
22 | 23 | ||
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h index abf6afe82ca8..91d219381306 100644 --- a/arch/sparc/include/asm/irq_64.h +++ b/arch/sparc/include/asm/irq_64.h | |||
@@ -39,32 +39,32 @@ | |||
39 | */ | 39 | */ |
40 | #define NR_IRQS 255 | 40 | #define NR_IRQS 255 |
41 | 41 | ||
42 | extern void irq_install_pre_handler(int irq, | 42 | void irq_install_pre_handler(int irq, |
43 | void (*func)(unsigned int, void *, void *), | 43 | void (*func)(unsigned int, void *, void *), |
44 | void *arg1, void *arg2); | 44 | void *arg1, void *arg2); |
45 | #define irq_canonicalize(irq) (irq) | 45 | #define irq_canonicalize(irq) (irq) |
46 | extern unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap); | 46 | unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap); |
47 | extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino); | 47 | unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino); |
48 | extern unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino); | 48 | unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino); |
49 | extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *irq_p, | 49 | unsigned int sun4v_build_msi(u32 devhandle, unsigned int *irq_p, |
50 | unsigned int msi_devino_start, | 50 | unsigned int msi_devino_start, |
51 | unsigned int msi_devino_end); | 51 | unsigned int msi_devino_end); |
52 | extern void sun4v_destroy_msi(unsigned int irq); | 52 | void sun4v_destroy_msi(unsigned int irq); |
53 | extern unsigned int sun4u_build_msi(u32 portid, unsigned int *irq_p, | 53 | unsigned int sun4u_build_msi(u32 portid, unsigned int *irq_p, |
54 | unsigned int msi_devino_start, | 54 | unsigned int msi_devino_start, |
55 | unsigned int msi_devino_end, | 55 | unsigned int msi_devino_end, |
56 | unsigned long imap_base, | 56 | unsigned long imap_base, |
57 | unsigned long iclr_base); | 57 | unsigned long iclr_base); |
58 | extern void sun4u_destroy_msi(unsigned int irq); | 58 | void sun4u_destroy_msi(unsigned int irq); |
59 | 59 | ||
60 | extern unsigned char irq_alloc(unsigned int dev_handle, | 60 | unsigned char irq_alloc(unsigned int dev_handle, |
61 | unsigned int dev_ino); | 61 | unsigned int dev_ino); |
62 | #ifdef CONFIG_PCI_MSI | 62 | #ifdef CONFIG_PCI_MSI |
63 | extern void irq_free(unsigned int irq); | 63 | void irq_free(unsigned int irq); |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | extern void __init init_IRQ(void); | 66 | void __init init_IRQ(void); |
67 | extern void fixup_irqs(void); | 67 | void fixup_irqs(void); |
68 | 68 | ||
69 | static inline void set_softint(unsigned long bits) | 69 | static inline void set_softint(unsigned long bits) |
70 | { | 70 | { |
@@ -89,7 +89,7 @@ static inline unsigned long get_softint(void) | |||
89 | return retval; | 89 | return retval; |
90 | } | 90 | } |
91 | 91 | ||
92 | void arch_trigger_all_cpu_backtrace(void); | 92 | void arch_trigger_all_cpu_backtrace(bool); |
93 | #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace | 93 | #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace |
94 | 94 | ||
95 | extern void *hardirq_stack[NR_CPUS]; | 95 | extern void *hardirq_stack[NR_CPUS]; |
diff --git a/arch/sparc/include/asm/irqflags_32.h b/arch/sparc/include/asm/irqflags_32.h index e414c06615c1..71cc284f55c5 100644 --- a/arch/sparc/include/asm/irqflags_32.h +++ b/arch/sparc/include/asm/irqflags_32.h | |||
@@ -15,9 +15,9 @@ | |||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <asm/psr.h> | 16 | #include <asm/psr.h> |
17 | 17 | ||
18 | extern void arch_local_irq_restore(unsigned long); | 18 | void arch_local_irq_restore(unsigned long); |
19 | extern unsigned long arch_local_irq_save(void); | 19 | unsigned long arch_local_irq_save(void); |
20 | extern void arch_local_irq_enable(void); | 20 | void arch_local_irq_enable(void); |
21 | 21 | ||
22 | static inline notrace unsigned long arch_local_save_flags(void) | 22 | static inline notrace unsigned long arch_local_save_flags(void) |
23 | { | 23 | { |
diff --git a/arch/sparc/include/asm/kdebug_64.h b/arch/sparc/include/asm/kdebug_64.h index feb3578e12c4..04465de8f3b5 100644 --- a/arch/sparc/include/asm/kdebug_64.h +++ b/arch/sparc/include/asm/kdebug_64.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | struct pt_regs; | 4 | struct pt_regs; |
5 | 5 | ||
6 | extern void bad_trap(struct pt_regs *, long); | 6 | void bad_trap(struct pt_regs *, long); |
7 | 7 | ||
8 | /* Grossly misnamed. */ | 8 | /* Grossly misnamed. */ |
9 | enum die_val { | 9 | enum die_val { |
diff --git a/arch/sparc/include/asm/kgdb.h b/arch/sparc/include/asm/kgdb.h index b6ef301d05bf..47366af7a589 100644 --- a/arch/sparc/include/asm/kgdb.h +++ b/arch/sparc/include/asm/kgdb.h | |||
@@ -28,9 +28,12 @@ enum regnames { | |||
28 | #define NUMREGBYTES ((GDB_CSR + 1) * 4) | 28 | #define NUMREGBYTES ((GDB_CSR + 1) * 4) |
29 | #else | 29 | #else |
30 | #define NUMREGBYTES ((GDB_Y + 1) * 8) | 30 | #define NUMREGBYTES ((GDB_Y + 1) * 8) |
31 | |||
32 | struct pt_regs; | ||
33 | asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs); | ||
31 | #endif | 34 | #endif |
32 | 35 | ||
33 | extern void arch_kgdb_breakpoint(void); | 36 | void arch_kgdb_breakpoint(void); |
34 | 37 | ||
35 | #define BREAK_INSTR_SIZE 4 | 38 | #define BREAK_INSTR_SIZE 4 |
36 | #define CACHE_FLUSH_IS_SAFE 1 | 39 | #define CACHE_FLUSH_IS_SAFE 1 |
diff --git a/arch/sparc/include/asm/kprobes.h b/arch/sparc/include/asm/kprobes.h index 5879d71afdaa..a145d798e112 100644 --- a/arch/sparc/include/asm/kprobes.h +++ b/arch/sparc/include/asm/kprobes.h | |||
@@ -43,7 +43,9 @@ struct kprobe_ctlblk { | |||
43 | struct prev_kprobe prev_kprobe; | 43 | struct prev_kprobe prev_kprobe; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | extern int kprobe_exceptions_notify(struct notifier_block *self, | 46 | int kprobe_exceptions_notify(struct notifier_block *self, |
47 | unsigned long val, void *data); | 47 | unsigned long val, void *data); |
48 | extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); | 48 | int kprobe_fault_handler(struct pt_regs *regs, int trapnr); |
49 | asmlinkage void __kprobes kprobe_trap(unsigned long trap_level, | ||
50 | struct pt_regs *regs); | ||
49 | #endif /* _SPARC64_KPROBES_H */ | 51 | #endif /* _SPARC64_KPROBES_H */ |
diff --git a/arch/sparc/include/asm/ldc.h b/arch/sparc/include/asm/ldc.h index bdb524a7b814..c8c67f621f4f 100644 --- a/arch/sparc/include/asm/ldc.h +++ b/arch/sparc/include/asm/ldc.h | |||
@@ -4,9 +4,9 @@ | |||
4 | #include <asm/hypervisor.h> | 4 | #include <asm/hypervisor.h> |
5 | 5 | ||
6 | extern int ldom_domaining_enabled; | 6 | extern int ldom_domaining_enabled; |
7 | extern void ldom_set_var(const char *var, const char *value); | 7 | void ldom_set_var(const char *var, const char *value); |
8 | extern void ldom_reboot(const char *boot_command); | 8 | void ldom_reboot(const char *boot_command); |
9 | extern void ldom_power_off(void); | 9 | void ldom_power_off(void); |
10 | 10 | ||
11 | /* The event handler will be evoked when link state changes | 11 | /* The event handler will be evoked when link state changes |
12 | * or data becomes available on the receive side. | 12 | * or data becomes available on the receive side. |
@@ -51,30 +51,30 @@ struct ldc_channel_config { | |||
51 | struct ldc_channel; | 51 | struct ldc_channel; |
52 | 52 | ||
53 | /* Allocate state for a channel. */ | 53 | /* Allocate state for a channel. */ |
54 | extern struct ldc_channel *ldc_alloc(unsigned long id, | 54 | struct ldc_channel *ldc_alloc(unsigned long id, |
55 | const struct ldc_channel_config *cfgp, | 55 | const struct ldc_channel_config *cfgp, |
56 | void *event_arg); | 56 | void *event_arg); |
57 | 57 | ||
58 | /* Shut down and free state for a channel. */ | 58 | /* Shut down and free state for a channel. */ |
59 | extern void ldc_free(struct ldc_channel *lp); | 59 | void ldc_free(struct ldc_channel *lp); |
60 | 60 | ||
61 | /* Register TX and RX queues of the link with the hypervisor. */ | 61 | /* Register TX and RX queues of the link with the hypervisor. */ |
62 | extern int ldc_bind(struct ldc_channel *lp, const char *name); | 62 | int ldc_bind(struct ldc_channel *lp, const char *name); |
63 | 63 | ||
64 | /* For non-RAW protocols we need to complete a handshake before | 64 | /* For non-RAW protocols we need to complete a handshake before |
65 | * communication can proceed. ldc_connect() does that, if the | 65 | * communication can proceed. ldc_connect() does that, if the |
66 | * handshake completes successfully, an LDC_EVENT_UP event will | 66 | * handshake completes successfully, an LDC_EVENT_UP event will |
67 | * be sent up to the driver. | 67 | * be sent up to the driver. |
68 | */ | 68 | */ |
69 | extern int ldc_connect(struct ldc_channel *lp); | 69 | int ldc_connect(struct ldc_channel *lp); |
70 | extern int ldc_disconnect(struct ldc_channel *lp); | 70 | int ldc_disconnect(struct ldc_channel *lp); |
71 | 71 | ||
72 | extern int ldc_state(struct ldc_channel *lp); | 72 | int ldc_state(struct ldc_channel *lp); |
73 | 73 | ||
74 | /* Read and write operations. Only valid when the link is up. */ | 74 | /* Read and write operations. Only valid when the link is up. */ |
75 | extern int ldc_write(struct ldc_channel *lp, const void *buf, | 75 | int ldc_write(struct ldc_channel *lp, const void *buf, |
76 | unsigned int size); | 76 | unsigned int size); |
77 | extern int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size); | 77 | int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size); |
78 | 78 | ||
79 | #define LDC_MAP_SHADOW 0x01 | 79 | #define LDC_MAP_SHADOW 0x01 |
80 | #define LDC_MAP_DIRECT 0x02 | 80 | #define LDC_MAP_DIRECT 0x02 |
@@ -92,22 +92,22 @@ struct ldc_trans_cookie { | |||
92 | }; | 92 | }; |
93 | 93 | ||
94 | struct scatterlist; | 94 | struct scatterlist; |
95 | extern int ldc_map_sg(struct ldc_channel *lp, | 95 | int ldc_map_sg(struct ldc_channel *lp, |
96 | struct scatterlist *sg, int num_sg, | 96 | struct scatterlist *sg, int num_sg, |
97 | struct ldc_trans_cookie *cookies, int ncookies, | 97 | struct ldc_trans_cookie *cookies, int ncookies, |
98 | unsigned int map_perm); | 98 | unsigned int map_perm); |
99 | 99 | ||
100 | extern int ldc_map_single(struct ldc_channel *lp, | 100 | int ldc_map_single(struct ldc_channel *lp, |
101 | void *buf, unsigned int len, | 101 | void *buf, unsigned int len, |
102 | struct ldc_trans_cookie *cookies, int ncookies, | 102 | struct ldc_trans_cookie *cookies, int ncookies, |
103 | unsigned int map_perm); | 103 | unsigned int map_perm); |
104 | 104 | ||
105 | extern void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies, | 105 | void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies, |
106 | int ncookies); | 106 | int ncookies); |
107 | 107 | ||
108 | extern int ldc_copy(struct ldc_channel *lp, int copy_dir, | 108 | int ldc_copy(struct ldc_channel *lp, int copy_dir, |
109 | void *buf, unsigned int len, unsigned long offset, | 109 | void *buf, unsigned int len, unsigned long offset, |
110 | struct ldc_trans_cookie *cookies, int ncookies); | 110 | struct ldc_trans_cookie *cookies, int ncookies); |
111 | 111 | ||
112 | static inline int ldc_get_dring_entry(struct ldc_channel *lp, | 112 | static inline int ldc_get_dring_entry(struct ldc_channel *lp, |
113 | void *buf, unsigned int len, | 113 | void *buf, unsigned int len, |
@@ -127,12 +127,12 @@ static inline int ldc_put_dring_entry(struct ldc_channel *lp, | |||
127 | return ldc_copy(lp, LDC_COPY_OUT, buf, len, offset, cookies, ncookies); | 127 | return ldc_copy(lp, LDC_COPY_OUT, buf, len, offset, cookies, ncookies); |
128 | } | 128 | } |
129 | 129 | ||
130 | extern void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len, | 130 | void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len, |
131 | struct ldc_trans_cookie *cookies, | 131 | struct ldc_trans_cookie *cookies, |
132 | int *ncookies, unsigned int map_perm); | 132 | int *ncookies, unsigned int map_perm); |
133 | 133 | ||
134 | extern void ldc_free_exp_dring(struct ldc_channel *lp, void *buf, | 134 | void ldc_free_exp_dring(struct ldc_channel *lp, void *buf, |
135 | unsigned int len, | 135 | unsigned int len, |
136 | struct ldc_trans_cookie *cookies, int ncookies); | 136 | struct ldc_trans_cookie *cookies, int ncookies); |
137 | 137 | ||
138 | #endif /* _SPARC64_LDC_H */ | 138 | #endif /* _SPARC64_LDC_H */ |
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h index c2f6ff6d7a35..204771cd74a5 100644 --- a/arch/sparc/include/asm/leon.h +++ b/arch/sparc/include/asm/leon.h | |||
@@ -82,8 +82,8 @@ static inline unsigned long leon_load_reg(unsigned long paddr) | |||
82 | #define LEON_BYPASS_LOAD_PA(x) leon_load_reg((unsigned long)(x)) | 82 | #define LEON_BYPASS_LOAD_PA(x) leon_load_reg((unsigned long)(x)) |
83 | #define LEON_BYPASS_STORE_PA(x, v) leon_store_reg((unsigned long)(x), (unsigned long)(v)) | 83 | #define LEON_BYPASS_STORE_PA(x, v) leon_store_reg((unsigned long)(x), (unsigned long)(v)) |
84 | 84 | ||
85 | extern void leon_switch_mm(void); | 85 | void leon_switch_mm(void); |
86 | extern void leon_init_IRQ(void); | 86 | void leon_init_IRQ(void); |
87 | 87 | ||
88 | static inline unsigned long sparc_leon3_get_dcachecfg(void) | 88 | static inline unsigned long sparc_leon3_get_dcachecfg(void) |
89 | { | 89 | { |
@@ -196,14 +196,14 @@ static inline int sparc_leon3_cpuid(void) | |||
196 | #ifndef __ASSEMBLY__ | 196 | #ifndef __ASSEMBLY__ |
197 | struct vm_area_struct; | 197 | struct vm_area_struct; |
198 | 198 | ||
199 | extern unsigned long leon_swprobe(unsigned long vaddr, unsigned long *paddr); | 199 | unsigned long leon_swprobe(unsigned long vaddr, unsigned long *paddr); |
200 | extern void leon_flush_icache_all(void); | 200 | void leon_flush_icache_all(void); |
201 | extern void leon_flush_dcache_all(void); | 201 | void leon_flush_dcache_all(void); |
202 | extern void leon_flush_cache_all(void); | 202 | void leon_flush_cache_all(void); |
203 | extern void leon_flush_tlb_all(void); | 203 | void leon_flush_tlb_all(void); |
204 | extern int leon_flush_during_switch; | 204 | extern int leon_flush_during_switch; |
205 | extern int leon_flush_needed(void); | 205 | int leon_flush_needed(void); |
206 | extern void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page); | 206 | void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page); |
207 | 207 | ||
208 | /* struct that hold LEON3 cache configuration registers */ | 208 | /* struct that hold LEON3 cache configuration registers */ |
209 | struct leon3_cacheregs { | 209 | struct leon3_cacheregs { |
@@ -217,29 +217,29 @@ struct leon3_cacheregs { | |||
217 | 217 | ||
218 | struct device_node; | 218 | struct device_node; |
219 | struct task_struct; | 219 | struct task_struct; |
220 | extern unsigned int leon_build_device_irq(unsigned int real_irq, | 220 | unsigned int leon_build_device_irq(unsigned int real_irq, |
221 | irq_flow_handler_t flow_handler, | 221 | irq_flow_handler_t flow_handler, |
222 | const char *name, int do_ack); | 222 | const char *name, int do_ack); |
223 | extern void leon_update_virq_handling(unsigned int virq, | 223 | void leon_update_virq_handling(unsigned int virq, |
224 | irq_flow_handler_t flow_handler, | 224 | irq_flow_handler_t flow_handler, |
225 | const char *name, int do_ack); | 225 | const char *name, int do_ack); |
226 | extern void leon_init_timers(void); | 226 | void leon_init_timers(void); |
227 | extern void leon_trans_init(struct device_node *dp); | 227 | void leon_trans_init(struct device_node *dp); |
228 | extern void leon_node_init(struct device_node *dp, struct device_node ***nextp); | 228 | void leon_node_init(struct device_node *dp, struct device_node ***nextp); |
229 | extern void init_leon(void); | 229 | void init_leon(void); |
230 | extern void poke_leonsparc(void); | 230 | void poke_leonsparc(void); |
231 | extern void leon3_getCacheRegs(struct leon3_cacheregs *regs); | 231 | void leon3_getCacheRegs(struct leon3_cacheregs *regs); |
232 | extern int leon3_ticker_irq; | 232 | extern int leon3_ticker_irq; |
233 | 233 | ||
234 | #ifdef CONFIG_SMP | 234 | #ifdef CONFIG_SMP |
235 | extern int leon_smp_nrcpus(void); | 235 | int leon_smp_nrcpus(void); |
236 | extern void leon_clear_profile_irq(int cpu); | 236 | void leon_clear_profile_irq(int cpu); |
237 | extern void leon_smp_done(void); | 237 | void leon_smp_done(void); |
238 | extern void leon_boot_cpus(void); | 238 | void leon_boot_cpus(void); |
239 | extern int leon_boot_one_cpu(int i, struct task_struct *); | 239 | int leon_boot_one_cpu(int i, struct task_struct *); |
240 | void leon_init_smp(void); | 240 | void leon_init_smp(void); |
241 | void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu); | 241 | void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu); |
242 | extern irqreturn_t leon_percpu_timer_interrupt(int irq, void *unused); | 242 | irqreturn_t leon_percpu_timer_interrupt(int irq, void *unused); |
243 | 243 | ||
244 | extern unsigned int smpleon_ipi[]; | 244 | extern unsigned int smpleon_ipi[]; |
245 | extern unsigned int linux_trap_ipi15_leon[]; | 245 | extern unsigned int linux_trap_ipi15_leon[]; |
diff --git a/arch/sparc/include/asm/leon_pci.h b/arch/sparc/include/asm/leon_pci.h index bfd3ab3092b5..049d067ed8be 100644 --- a/arch/sparc/include/asm/leon_pci.h +++ b/arch/sparc/include/asm/leon_pci.h | |||
@@ -16,7 +16,7 @@ struct leon_pci_info { | |||
16 | int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); | 16 | int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); |
17 | }; | 17 | }; |
18 | 18 | ||
19 | extern void leon_pci_init(struct platform_device *ofdev, | 19 | void leon_pci_init(struct platform_device *ofdev, |
20 | struct leon_pci_info *info); | 20 | struct leon_pci_info *info); |
21 | 21 | ||
22 | #endif /* _ASM_LEON_PCI_H_ */ | 22 | #endif /* _ASM_LEON_PCI_H_ */ |
diff --git a/arch/sparc/include/asm/mc146818rtc.h b/arch/sparc/include/asm/mc146818rtc.h index 67ed9e3a0235..d8e72f37dc4b 100644 --- a/arch/sparc/include/asm/mc146818rtc.h +++ b/arch/sparc/include/asm/mc146818rtc.h | |||
@@ -1,5 +1,10 @@ | |||
1 | #ifndef ___ASM_SPARC_MC146818RTC_H | 1 | #ifndef ___ASM_SPARC_MC146818RTC_H |
2 | #define ___ASM_SPARC_MC146818RTC_H | 2 | #define ___ASM_SPARC_MC146818RTC_H |
3 | |||
4 | #include <linux/spinlock.h> | ||
5 | |||
6 | extern spinlock_t rtc_lock; | ||
7 | |||
3 | #if defined(__sparc__) && defined(__arch64__) | 8 | #if defined(__sparc__) && defined(__arch64__) |
4 | #include <asm/mc146818rtc_64.h> | 9 | #include <asm/mc146818rtc_64.h> |
5 | #else | 10 | #else |
diff --git a/arch/sparc/include/asm/mdesc.h b/arch/sparc/include/asm/mdesc.h index 139097f3a67b..aebeb88f70db 100644 --- a/arch/sparc/include/asm/mdesc.h +++ b/arch/sparc/include/asm/mdesc.h | |||
@@ -12,13 +12,13 @@ struct mdesc_handle; | |||
12 | * the first argument to all of the operational calls that work | 12 | * the first argument to all of the operational calls that work |
13 | * on mdescs. | 13 | * on mdescs. |
14 | */ | 14 | */ |
15 | extern struct mdesc_handle *mdesc_grab(void); | 15 | struct mdesc_handle *mdesc_grab(void); |
16 | extern void mdesc_release(struct mdesc_handle *); | 16 | void mdesc_release(struct mdesc_handle *); |
17 | 17 | ||
18 | #define MDESC_NODE_NULL (~(u64)0) | 18 | #define MDESC_NODE_NULL (~(u64)0) |
19 | 19 | ||
20 | extern u64 mdesc_node_by_name(struct mdesc_handle *handle, | 20 | u64 mdesc_node_by_name(struct mdesc_handle *handle, |
21 | u64 from_node, const char *name); | 21 | u64 from_node, const char *name); |
22 | #define mdesc_for_each_node_by_name(__hdl, __node, __name) \ | 22 | #define mdesc_for_each_node_by_name(__hdl, __node, __name) \ |
23 | for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \ | 23 | for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \ |
24 | (__node) != MDESC_NODE_NULL; \ | 24 | (__node) != MDESC_NODE_NULL; \ |
@@ -34,9 +34,9 @@ extern u64 mdesc_node_by_name(struct mdesc_handle *handle, | |||
34 | * | 34 | * |
35 | * These same rules apply to mdesc_node_name(). | 35 | * These same rules apply to mdesc_node_name(). |
36 | */ | 36 | */ |
37 | extern const void *mdesc_get_property(struct mdesc_handle *handle, | 37 | const void *mdesc_get_property(struct mdesc_handle *handle, |
38 | u64 node, const char *name, int *lenp); | 38 | u64 node, const char *name, int *lenp); |
39 | extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node); | 39 | const char *mdesc_node_name(struct mdesc_handle *hp, u64 node); |
40 | 40 | ||
41 | /* MD arc iteration, the standard sequence is: | 41 | /* MD arc iteration, the standard sequence is: |
42 | * | 42 | * |
@@ -50,16 +50,16 @@ extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node); | |||
50 | #define MDESC_ARC_TYPE_FWD "fwd" | 50 | #define MDESC_ARC_TYPE_FWD "fwd" |
51 | #define MDESC_ARC_TYPE_BACK "back" | 51 | #define MDESC_ARC_TYPE_BACK "back" |
52 | 52 | ||
53 | extern u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from, | 53 | u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from, |
54 | const char *arc_type); | 54 | const char *arc_type); |
55 | #define mdesc_for_each_arc(__arc, __hdl, __node, __type) \ | 55 | #define mdesc_for_each_arc(__arc, __hdl, __node, __type) \ |
56 | for (__arc = mdesc_next_arc(__hdl, __node, __type); \ | 56 | for (__arc = mdesc_next_arc(__hdl, __node, __type); \ |
57 | (__arc) != MDESC_NODE_NULL; \ | 57 | (__arc) != MDESC_NODE_NULL; \ |
58 | __arc = mdesc_next_arc(__hdl, __arc, __type)) | 58 | __arc = mdesc_next_arc(__hdl, __arc, __type)) |
59 | 59 | ||
60 | extern u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc); | 60 | u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc); |
61 | 61 | ||
62 | extern void mdesc_update(void); | 62 | void mdesc_update(void); |
63 | 63 | ||
64 | struct mdesc_notifier_client { | 64 | struct mdesc_notifier_client { |
65 | void (*add)(struct mdesc_handle *handle, u64 node); | 65 | void (*add)(struct mdesc_handle *handle, u64 node); |
@@ -69,12 +69,12 @@ struct mdesc_notifier_client { | |||
69 | struct mdesc_notifier_client *next; | 69 | struct mdesc_notifier_client *next; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | extern void mdesc_register_notifier(struct mdesc_notifier_client *client); | 72 | void mdesc_register_notifier(struct mdesc_notifier_client *client); |
73 | 73 | ||
74 | extern void mdesc_fill_in_cpu_data(cpumask_t *mask); | 74 | void mdesc_fill_in_cpu_data(cpumask_t *mask); |
75 | extern void mdesc_populate_present_mask(cpumask_t *mask); | 75 | void mdesc_populate_present_mask(cpumask_t *mask); |
76 | extern void mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask); | 76 | void mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask); |
77 | 77 | ||
78 | extern void sun4v_mdesc_init(void); | 78 | void sun4v_mdesc_init(void); |
79 | 79 | ||
80 | #endif | 80 | #endif |
diff --git a/arch/sparc/include/asm/mmu_64.h b/arch/sparc/include/asm/mmu_64.h index f668797ae234..70067ce184b1 100644 --- a/arch/sparc/include/asm/mmu_64.h +++ b/arch/sparc/include/asm/mmu_64.h | |||
@@ -67,9 +67,9 @@ struct tsb { | |||
67 | unsigned long pte; | 67 | unsigned long pte; |
68 | } __attribute__((aligned(TSB_ENTRY_ALIGNMENT))); | 68 | } __attribute__((aligned(TSB_ENTRY_ALIGNMENT))); |
69 | 69 | ||
70 | extern void __tsb_insert(unsigned long ent, unsigned long tag, unsigned long pte); | 70 | void __tsb_insert(unsigned long ent, unsigned long tag, unsigned long pte); |
71 | extern void tsb_flush(unsigned long ent, unsigned long tag); | 71 | void tsb_flush(unsigned long ent, unsigned long tag); |
72 | extern void tsb_init(struct tsb *tsb, unsigned long size); | 72 | void tsb_init(struct tsb *tsb, unsigned long size); |
73 | 73 | ||
74 | struct tsb_config { | 74 | struct tsb_config { |
75 | struct tsb *tsb; | 75 | struct tsb *tsb; |
diff --git a/arch/sparc/include/asm/mmu_context_64.h b/arch/sparc/include/asm/mmu_context_64.h index 3d528f06e4b0..b84be675e507 100644 --- a/arch/sparc/include/asm/mmu_context_64.h +++ b/arch/sparc/include/asm/mmu_context_64.h | |||
@@ -17,20 +17,20 @@ extern spinlock_t ctx_alloc_lock; | |||
17 | extern unsigned long tlb_context_cache; | 17 | extern unsigned long tlb_context_cache; |
18 | extern unsigned long mmu_context_bmap[]; | 18 | extern unsigned long mmu_context_bmap[]; |
19 | 19 | ||
20 | extern void get_new_mmu_context(struct mm_struct *mm); | 20 | void get_new_mmu_context(struct mm_struct *mm); |
21 | #ifdef CONFIG_SMP | 21 | #ifdef CONFIG_SMP |
22 | extern void smp_new_mmu_context_version(void); | 22 | void smp_new_mmu_context_version(void); |
23 | #else | 23 | #else |
24 | #define smp_new_mmu_context_version() do { } while (0) | 24 | #define smp_new_mmu_context_version() do { } while (0) |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); | 27 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm); |
28 | extern void destroy_context(struct mm_struct *mm); | 28 | void destroy_context(struct mm_struct *mm); |
29 | 29 | ||
30 | extern void __tsb_context_switch(unsigned long pgd_pa, | 30 | void __tsb_context_switch(unsigned long pgd_pa, |
31 | struct tsb_config *tsb_base, | 31 | struct tsb_config *tsb_base, |
32 | struct tsb_config *tsb_huge, | 32 | struct tsb_config *tsb_huge, |
33 | unsigned long tsb_descr_pa); | 33 | unsigned long tsb_descr_pa); |
34 | 34 | ||
35 | static inline void tsb_context_switch(struct mm_struct *mm) | 35 | static inline void tsb_context_switch(struct mm_struct *mm) |
36 | { | 36 | { |
@@ -46,9 +46,11 @@ static inline void tsb_context_switch(struct mm_struct *mm) | |||
46 | , __pa(&mm->context.tsb_descr[0])); | 46 | , __pa(&mm->context.tsb_descr[0])); |
47 | } | 47 | } |
48 | 48 | ||
49 | extern void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long mm_rss); | 49 | void tsb_grow(struct mm_struct *mm, |
50 | unsigned long tsb_index, | ||
51 | unsigned long mm_rss); | ||
50 | #ifdef CONFIG_SMP | 52 | #ifdef CONFIG_SMP |
51 | extern void smp_tsb_sync(struct mm_struct *mm); | 53 | void smp_tsb_sync(struct mm_struct *mm); |
52 | #else | 54 | #else |
53 | #define smp_tsb_sync(__mm) do { } while (0) | 55 | #define smp_tsb_sync(__mm) do { } while (0) |
54 | #endif | 56 | #endif |
@@ -66,7 +68,7 @@ extern void smp_tsb_sync(struct mm_struct *mm); | |||
66 | : "r" (CTX_HWBITS((__mm)->context)), \ | 68 | : "r" (CTX_HWBITS((__mm)->context)), \ |
67 | "r" (SECONDARY_CONTEXT), "i" (ASI_DMMU), "i" (ASI_MMU)) | 69 | "r" (SECONDARY_CONTEXT), "i" (ASI_DMMU), "i" (ASI_MMU)) |
68 | 70 | ||
69 | extern void __flush_tlb_mm(unsigned long, unsigned long); | 71 | void __flush_tlb_mm(unsigned long, unsigned long); |
70 | 72 | ||
71 | /* Switch the current MM context. */ | 73 | /* Switch the current MM context. */ |
72 | static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk) | 74 | static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk) |
diff --git a/arch/sparc/include/asm/nmi.h b/arch/sparc/include/asm/nmi.h index 72e6500e7ab0..26ad2b2607c6 100644 --- a/arch/sparc/include/asm/nmi.h +++ b/arch/sparc/include/asm/nmi.h | |||
@@ -1,13 +1,13 @@ | |||
1 | #ifndef __NMI_H | 1 | #ifndef __NMI_H |
2 | #define __NMI_H | 2 | #define __NMI_H |
3 | 3 | ||
4 | extern int __init nmi_init(void); | 4 | int __init nmi_init(void); |
5 | extern void perfctr_irq(int irq, struct pt_regs *regs); | 5 | void perfctr_irq(int irq, struct pt_regs *regs); |
6 | extern void nmi_adjust_hz(unsigned int new_hz); | 6 | void nmi_adjust_hz(unsigned int new_hz); |
7 | 7 | ||
8 | extern atomic_t nmi_active; | 8 | extern atomic_t nmi_active; |
9 | 9 | ||
10 | extern void start_nmi_watchdog(void *unused); | 10 | void start_nmi_watchdog(void *unused); |
11 | extern void stop_nmi_watchdog(void *unused); | 11 | void stop_nmi_watchdog(void *unused); |
12 | 12 | ||
13 | #endif /* __NMI_H */ | 13 | #endif /* __NMI_H */ |
diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h index c72f3045820c..56a09b9d7b1b 100644 --- a/arch/sparc/include/asm/oplib_32.h +++ b/arch/sparc/include/asm/oplib_32.h | |||
@@ -43,28 +43,28 @@ extern struct linux_nodeops *prom_nodeops; | |||
43 | /* You must call prom_init() before using any of the library services, | 43 | /* You must call prom_init() before using any of the library services, |
44 | * preferably as early as possible. Pass it the romvec pointer. | 44 | * preferably as early as possible. Pass it the romvec pointer. |
45 | */ | 45 | */ |
46 | extern void prom_init(struct linux_romvec *rom_ptr); | 46 | void prom_init(struct linux_romvec *rom_ptr); |
47 | 47 | ||
48 | /* Boot argument acquisition, returns the boot command line string. */ | 48 | /* Boot argument acquisition, returns the boot command line string. */ |
49 | extern char *prom_getbootargs(void); | 49 | char *prom_getbootargs(void); |
50 | 50 | ||
51 | /* Miscellaneous routines, don't really fit in any category per se. */ | 51 | /* Miscellaneous routines, don't really fit in any category per se. */ |
52 | 52 | ||
53 | /* Reboot the machine with the command line passed. */ | 53 | /* Reboot the machine with the command line passed. */ |
54 | extern void prom_reboot(char *boot_command); | 54 | void prom_reboot(char *boot_command); |
55 | 55 | ||
56 | /* Evaluate the forth string passed. */ | 56 | /* Evaluate the forth string passed. */ |
57 | extern void prom_feval(char *forth_string); | 57 | void prom_feval(char *forth_string); |
58 | 58 | ||
59 | /* Enter the prom, with possibility of continuation with the 'go' | 59 | /* Enter the prom, with possibility of continuation with the 'go' |
60 | * command in newer proms. | 60 | * command in newer proms. |
61 | */ | 61 | */ |
62 | extern void prom_cmdline(void); | 62 | void prom_cmdline(void); |
63 | 63 | ||
64 | /* Enter the prom, with no chance of continuation for the stand-alone | 64 | /* Enter the prom, with no chance of continuation for the stand-alone |
65 | * which calls this. | 65 | * which calls this. |
66 | */ | 66 | */ |
67 | extern void __noreturn prom_halt(void); | 67 | void __noreturn prom_halt(void); |
68 | 68 | ||
69 | /* Set the PROM 'sync' callback function to the passed function pointer. | 69 | /* Set the PROM 'sync' callback function to the passed function pointer. |
70 | * When the user gives the 'sync' command at the prom prompt while the | 70 | * When the user gives the 'sync' command at the prom prompt while the |
@@ -73,37 +73,37 @@ extern void __noreturn prom_halt(void); | |||
73 | * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX | 73 | * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX |
74 | */ | 74 | */ |
75 | typedef void (*sync_func_t)(void); | 75 | typedef void (*sync_func_t)(void); |
76 | extern void prom_setsync(sync_func_t func_ptr); | 76 | void prom_setsync(sync_func_t func_ptr); |
77 | 77 | ||
78 | /* Acquire the IDPROM of the root node in the prom device tree. This | 78 | /* Acquire the IDPROM of the root node in the prom device tree. This |
79 | * gets passed a buffer where you would like it stuffed. The return value | 79 | * gets passed a buffer where you would like it stuffed. The return value |
80 | * is the format type of this idprom or 0xff on error. | 80 | * is the format type of this idprom or 0xff on error. |
81 | */ | 81 | */ |
82 | extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); | 82 | unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); |
83 | 83 | ||
84 | /* Get the prom major version. */ | 84 | /* Get the prom major version. */ |
85 | extern int prom_version(void); | 85 | int prom_version(void); |
86 | 86 | ||
87 | /* Get the prom plugin revision. */ | 87 | /* Get the prom plugin revision. */ |
88 | extern int prom_getrev(void); | 88 | int prom_getrev(void); |
89 | 89 | ||
90 | /* Get the prom firmware revision. */ | 90 | /* Get the prom firmware revision. */ |
91 | extern int prom_getprev(void); | 91 | int prom_getprev(void); |
92 | 92 | ||
93 | /* Write a buffer of characters to the console. */ | 93 | /* Write a buffer of characters to the console. */ |
94 | extern void prom_console_write_buf(const char *buf, int len); | 94 | void prom_console_write_buf(const char *buf, int len); |
95 | 95 | ||
96 | /* Prom's internal routines, don't use in kernel/boot code. */ | 96 | /* Prom's internal routines, don't use in kernel/boot code. */ |
97 | extern __printf(1, 2) void prom_printf(const char *fmt, ...); | 97 | __printf(1, 2) void prom_printf(const char *fmt, ...); |
98 | extern void prom_write(const char *buf, unsigned int len); | 98 | void prom_write(const char *buf, unsigned int len); |
99 | 99 | ||
100 | /* Multiprocessor operations... */ | 100 | /* Multiprocessor operations... */ |
101 | 101 | ||
102 | /* Start the CPU with the given device tree node, context table, and context | 102 | /* Start the CPU with the given device tree node, context table, and context |
103 | * at the passed program counter. | 103 | * at the passed program counter. |
104 | */ | 104 | */ |
105 | extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table, | 105 | int prom_startcpu(int cpunode, struct linux_prom_registers *context_table, |
106 | int context, char *program_counter); | 106 | int context, char *program_counter); |
107 | 107 | ||
108 | /* Initialize the memory lists based upon the prom version. */ | 108 | /* Initialize the memory lists based upon the prom version. */ |
109 | void prom_meminit(void); | 109 | void prom_meminit(void); |
@@ -111,65 +111,65 @@ void prom_meminit(void); | |||
111 | /* PROM device tree traversal functions... */ | 111 | /* PROM device tree traversal functions... */ |
112 | 112 | ||
113 | /* Get the child node of the given node, or zero if no child exists. */ | 113 | /* Get the child node of the given node, or zero if no child exists. */ |
114 | extern phandle prom_getchild(phandle parent_node); | 114 | phandle prom_getchild(phandle parent_node); |
115 | 115 | ||
116 | /* Get the next sibling node of the given node, or zero if no further | 116 | /* Get the next sibling node of the given node, or zero if no further |
117 | * siblings exist. | 117 | * siblings exist. |
118 | */ | 118 | */ |
119 | extern phandle prom_getsibling(phandle node); | 119 | phandle prom_getsibling(phandle node); |
120 | 120 | ||
121 | /* Get the length, at the passed node, of the given property type. | 121 | /* Get the length, at the passed node, of the given property type. |
122 | * Returns -1 on error (ie. no such property at this node). | 122 | * Returns -1 on error (ie. no such property at this node). |
123 | */ | 123 | */ |
124 | extern int prom_getproplen(phandle thisnode, const char *property); | 124 | int prom_getproplen(phandle thisnode, const char *property); |
125 | 125 | ||
126 | /* Fetch the requested property using the given buffer. Returns | 126 | /* Fetch the requested property using the given buffer. Returns |
127 | * the number of bytes the prom put into your buffer or -1 on error. | 127 | * the number of bytes the prom put into your buffer or -1 on error. |
128 | */ | 128 | */ |
129 | extern int __must_check prom_getproperty(phandle thisnode, const char *property, | 129 | int __must_check prom_getproperty(phandle thisnode, const char *property, |
130 | char *prop_buffer, int propbuf_size); | 130 | char *prop_buffer, int propbuf_size); |
131 | 131 | ||
132 | /* Acquire an integer property. */ | 132 | /* Acquire an integer property. */ |
133 | extern int prom_getint(phandle node, char *property); | 133 | int prom_getint(phandle node, char *property); |
134 | 134 | ||
135 | /* Acquire an integer property, with a default value. */ | 135 | /* Acquire an integer property, with a default value. */ |
136 | extern int prom_getintdefault(phandle node, char *property, int defval); | 136 | int prom_getintdefault(phandle node, char *property, int defval); |
137 | 137 | ||
138 | /* Acquire a boolean property, 0=FALSE 1=TRUE. */ | 138 | /* Acquire a boolean property, 0=FALSE 1=TRUE. */ |
139 | extern int prom_getbool(phandle node, char *prop); | 139 | int prom_getbool(phandle node, char *prop); |
140 | 140 | ||
141 | /* Acquire a string property, null string on error. */ | 141 | /* Acquire a string property, null string on error. */ |
142 | extern void prom_getstring(phandle node, char *prop, char *buf, int bufsize); | 142 | void prom_getstring(phandle node, char *prop, char *buf, int bufsize); |
143 | 143 | ||
144 | /* Search all siblings starting at the passed node for "name" matching | 144 | /* Search all siblings starting at the passed node for "name" matching |
145 | * the given string. Returns the node on success, zero on failure. | 145 | * the given string. Returns the node on success, zero on failure. |
146 | */ | 146 | */ |
147 | extern phandle prom_searchsiblings(phandle node_start, char *name); | 147 | phandle prom_searchsiblings(phandle node_start, char *name); |
148 | 148 | ||
149 | /* Returns the next property after the passed property for the given | 149 | /* Returns the next property after the passed property for the given |
150 | * node. Returns null string on failure. | 150 | * node. Returns null string on failure. |
151 | */ | 151 | */ |
152 | extern char *prom_nextprop(phandle node, char *prev_property, char *buffer); | 152 | char *prom_nextprop(phandle node, char *prev_property, char *buffer); |
153 | 153 | ||
154 | /* Returns phandle of the path specified */ | 154 | /* Returns phandle of the path specified */ |
155 | extern phandle prom_finddevice(char *name); | 155 | phandle prom_finddevice(char *name); |
156 | 156 | ||
157 | /* Set the indicated property at the given node with the passed value. | 157 | /* Set the indicated property at the given node with the passed value. |
158 | * Returns the number of bytes of your value that the prom took. | 158 | * Returns the number of bytes of your value that the prom took. |
159 | */ | 159 | */ |
160 | extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, | 160 | int prom_setprop(phandle node, const char *prop_name, char *prop_value, |
161 | int value_size); | 161 | int value_size); |
162 | 162 | ||
163 | extern phandle prom_inst2pkg(int); | 163 | phandle prom_inst2pkg(int); |
164 | 164 | ||
165 | /* Dorking with Bus ranges... */ | 165 | /* Dorking with Bus ranges... */ |
166 | 166 | ||
167 | /* Apply promlib probes OBIO ranges to registers. */ | 167 | /* Apply promlib probes OBIO ranges to registers. */ |
168 | extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs); | 168 | void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs); |
169 | 169 | ||
170 | /* Apply ranges of any prom node (and optionally parent node as well) to registers. */ | 170 | /* Apply ranges of any prom node (and optionally parent node as well) to registers. */ |
171 | extern void prom_apply_generic_ranges(phandle node, phandle parent, | 171 | void prom_apply_generic_ranges(phandle node, phandle parent, |
172 | struct linux_prom_registers *sbusregs, int nregs); | 172 | struct linux_prom_registers *sbusregs, int nregs); |
173 | 173 | ||
174 | void prom_ranges_init(void); | 174 | void prom_ranges_init(void); |
175 | 175 | ||
diff --git a/arch/sparc/include/asm/oplib_64.h b/arch/sparc/include/asm/oplib_64.h index a12dbe3b7762..f34682430fcf 100644 --- a/arch/sparc/include/asm/oplib_64.h +++ b/arch/sparc/include/asm/oplib_64.h | |||
@@ -62,100 +62,100 @@ struct linux_mem_p1275 { | |||
62 | /* You must call prom_init() before using any of the library services, | 62 | /* You must call prom_init() before using any of the library services, |
63 | * preferably as early as possible. Pass it the romvec pointer. | 63 | * preferably as early as possible. Pass it the romvec pointer. |
64 | */ | 64 | */ |
65 | extern void prom_init(void *cif_handler, void *cif_stack); | 65 | void prom_init(void *cif_handler, void *cif_stack); |
66 | 66 | ||
67 | /* Boot argument acquisition, returns the boot command line string. */ | 67 | /* Boot argument acquisition, returns the boot command line string. */ |
68 | extern char *prom_getbootargs(void); | 68 | char *prom_getbootargs(void); |
69 | 69 | ||
70 | /* Miscellaneous routines, don't really fit in any category per se. */ | 70 | /* Miscellaneous routines, don't really fit in any category per se. */ |
71 | 71 | ||
72 | /* Reboot the machine with the command line passed. */ | 72 | /* Reboot the machine with the command line passed. */ |
73 | extern void prom_reboot(const char *boot_command); | 73 | void prom_reboot(const char *boot_command); |
74 | 74 | ||
75 | /* Evaluate the forth string passed. */ | 75 | /* Evaluate the forth string passed. */ |
76 | extern void prom_feval(const char *forth_string); | 76 | void prom_feval(const char *forth_string); |
77 | 77 | ||
78 | /* Enter the prom, with possibility of continuation with the 'go' | 78 | /* Enter the prom, with possibility of continuation with the 'go' |
79 | * command in newer proms. | 79 | * command in newer proms. |
80 | */ | 80 | */ |
81 | extern void prom_cmdline(void); | 81 | void prom_cmdline(void); |
82 | 82 | ||
83 | /* Enter the prom, with no chance of continuation for the stand-alone | 83 | /* Enter the prom, with no chance of continuation for the stand-alone |
84 | * which calls this. | 84 | * which calls this. |
85 | */ | 85 | */ |
86 | extern void prom_halt(void) __attribute__ ((noreturn)); | 86 | void prom_halt(void) __attribute__ ((noreturn)); |
87 | 87 | ||
88 | /* Halt and power-off the machine. */ | 88 | /* Halt and power-off the machine. */ |
89 | extern void prom_halt_power_off(void) __attribute__ ((noreturn)); | 89 | void prom_halt_power_off(void) __attribute__ ((noreturn)); |
90 | 90 | ||
91 | /* Acquire the IDPROM of the root node in the prom device tree. This | 91 | /* Acquire the IDPROM of the root node in the prom device tree. This |
92 | * gets passed a buffer where you would like it stuffed. The return value | 92 | * gets passed a buffer where you would like it stuffed. The return value |
93 | * is the format type of this idprom or 0xff on error. | 93 | * is the format type of this idprom or 0xff on error. |
94 | */ | 94 | */ |
95 | extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); | 95 | unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); |
96 | 96 | ||
97 | /* Write a buffer of characters to the console. */ | 97 | /* Write a buffer of characters to the console. */ |
98 | extern void prom_console_write_buf(const char *buf, int len); | 98 | void prom_console_write_buf(const char *buf, int len); |
99 | 99 | ||
100 | /* Prom's internal routines, don't use in kernel/boot code. */ | 100 | /* Prom's internal routines, don't use in kernel/boot code. */ |
101 | extern __printf(1, 2) void prom_printf(const char *fmt, ...); | 101 | __printf(1, 2) void prom_printf(const char *fmt, ...); |
102 | extern void prom_write(const char *buf, unsigned int len); | 102 | void prom_write(const char *buf, unsigned int len); |
103 | 103 | ||
104 | /* Multiprocessor operations... */ | 104 | /* Multiprocessor operations... */ |
105 | #ifdef CONFIG_SMP | 105 | #ifdef CONFIG_SMP |
106 | /* Start the CPU with the given device tree node at the passed program | 106 | /* Start the CPU with the given device tree node at the passed program |
107 | * counter with the given arg passed in via register %o0. | 107 | * counter with the given arg passed in via register %o0. |
108 | */ | 108 | */ |
109 | extern void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg); | 109 | void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg); |
110 | 110 | ||
111 | /* Start the CPU with the given cpu ID at the passed program | 111 | /* Start the CPU with the given cpu ID at the passed program |
112 | * counter with the given arg passed in via register %o0. | 112 | * counter with the given arg passed in via register %o0. |
113 | */ | 113 | */ |
114 | extern void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg); | 114 | void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg); |
115 | 115 | ||
116 | /* Stop the CPU with the given cpu ID. */ | 116 | /* Stop the CPU with the given cpu ID. */ |
117 | extern void prom_stopcpu_cpuid(int cpuid); | 117 | void prom_stopcpu_cpuid(int cpuid); |
118 | 118 | ||
119 | /* Stop the current CPU. */ | 119 | /* Stop the current CPU. */ |
120 | extern void prom_stopself(void); | 120 | void prom_stopself(void); |
121 | 121 | ||
122 | /* Idle the current CPU. */ | 122 | /* Idle the current CPU. */ |
123 | extern void prom_idleself(void); | 123 | void prom_idleself(void); |
124 | 124 | ||
125 | /* Resume the CPU with the passed device tree node. */ | 125 | /* Resume the CPU with the passed device tree node. */ |
126 | extern void prom_resumecpu(int cpunode); | 126 | void prom_resumecpu(int cpunode); |
127 | #endif | 127 | #endif |
128 | 128 | ||
129 | /* Power management interfaces. */ | 129 | /* Power management interfaces. */ |
130 | 130 | ||
131 | /* Put the current CPU to sleep. */ | 131 | /* Put the current CPU to sleep. */ |
132 | extern void prom_sleepself(void); | 132 | void prom_sleepself(void); |
133 | 133 | ||
134 | /* Put the entire system to sleep. */ | 134 | /* Put the entire system to sleep. */ |
135 | extern int prom_sleepsystem(void); | 135 | int prom_sleepsystem(void); |
136 | 136 | ||
137 | /* Initiate a wakeup event. */ | 137 | /* Initiate a wakeup event. */ |
138 | extern int prom_wakeupsystem(void); | 138 | int prom_wakeupsystem(void); |
139 | 139 | ||
140 | /* MMU and memory related OBP interfaces. */ | 140 | /* MMU and memory related OBP interfaces. */ |
141 | 141 | ||
142 | /* Get unique string identifying SIMM at given physical address. */ | 142 | /* Get unique string identifying SIMM at given physical address. */ |
143 | extern int prom_getunumber(int syndrome_code, | 143 | int prom_getunumber(int syndrome_code, |
144 | unsigned long phys_addr, | 144 | unsigned long phys_addr, |
145 | char *buf, int buflen); | 145 | char *buf, int buflen); |
146 | 146 | ||
147 | /* Retain physical memory to the caller across soft resets. */ | 147 | /* Retain physical memory to the caller across soft resets. */ |
148 | extern int prom_retain(const char *name, unsigned long size, | 148 | int prom_retain(const char *name, unsigned long size, |
149 | unsigned long align, unsigned long *paddr); | 149 | unsigned long align, unsigned long *paddr); |
150 | 150 | ||
151 | /* Load explicit I/D TLB entries into the calling processor. */ | 151 | /* Load explicit I/D TLB entries into the calling processor. */ |
152 | extern long prom_itlb_load(unsigned long index, | 152 | long prom_itlb_load(unsigned long index, |
153 | unsigned long tte_data, | 153 | unsigned long tte_data, |
154 | unsigned long vaddr); | 154 | unsigned long vaddr); |
155 | 155 | ||
156 | extern long prom_dtlb_load(unsigned long index, | 156 | long prom_dtlb_load(unsigned long index, |
157 | unsigned long tte_data, | 157 | unsigned long tte_data, |
158 | unsigned long vaddr); | 158 | unsigned long vaddr); |
159 | 159 | ||
160 | /* Map/Unmap client program address ranges. First the format of | 160 | /* Map/Unmap client program address ranges. First the format of |
161 | * the mapping mode argument. | 161 | * the mapping mode argument. |
@@ -170,81 +170,81 @@ extern long prom_dtlb_load(unsigned long index, | |||
170 | #define PROM_MAP_IE 0x0100 /* Invert-Endianness */ | 170 | #define PROM_MAP_IE 0x0100 /* Invert-Endianness */ |
171 | #define PROM_MAP_DEFAULT (PROM_MAP_WRITE | PROM_MAP_READ | PROM_MAP_EXEC | PROM_MAP_CACHED) | 171 | #define PROM_MAP_DEFAULT (PROM_MAP_WRITE | PROM_MAP_READ | PROM_MAP_EXEC | PROM_MAP_CACHED) |
172 | 172 | ||
173 | extern int prom_map(int mode, unsigned long size, | 173 | int prom_map(int mode, unsigned long size, |
174 | unsigned long vaddr, unsigned long paddr); | 174 | unsigned long vaddr, unsigned long paddr); |
175 | extern void prom_unmap(unsigned long size, unsigned long vaddr); | 175 | void prom_unmap(unsigned long size, unsigned long vaddr); |
176 | 176 | ||
177 | 177 | ||
178 | /* PROM device tree traversal functions... */ | 178 | /* PROM device tree traversal functions... */ |
179 | 179 | ||
180 | /* Get the child node of the given node, or zero if no child exists. */ | 180 | /* Get the child node of the given node, or zero if no child exists. */ |
181 | extern phandle prom_getchild(phandle parent_node); | 181 | phandle prom_getchild(phandle parent_node); |
182 | 182 | ||
183 | /* Get the next sibling node of the given node, or zero if no further | 183 | /* Get the next sibling node of the given node, or zero if no further |
184 | * siblings exist. | 184 | * siblings exist. |
185 | */ | 185 | */ |
186 | extern phandle prom_getsibling(phandle node); | 186 | phandle prom_getsibling(phandle node); |
187 | 187 | ||
188 | /* Get the length, at the passed node, of the given property type. | 188 | /* Get the length, at the passed node, of the given property type. |
189 | * Returns -1 on error (ie. no such property at this node). | 189 | * Returns -1 on error (ie. no such property at this node). |
190 | */ | 190 | */ |
191 | extern int prom_getproplen(phandle thisnode, const char *property); | 191 | int prom_getproplen(phandle thisnode, const char *property); |
192 | 192 | ||
193 | /* Fetch the requested property using the given buffer. Returns | 193 | /* Fetch the requested property using the given buffer. Returns |
194 | * the number of bytes the prom put into your buffer or -1 on error. | 194 | * the number of bytes the prom put into your buffer or -1 on error. |
195 | */ | 195 | */ |
196 | extern int prom_getproperty(phandle thisnode, const char *property, | 196 | int prom_getproperty(phandle thisnode, const char *property, |
197 | char *prop_buffer, int propbuf_size); | 197 | char *prop_buffer, int propbuf_size); |
198 | 198 | ||
199 | /* Acquire an integer property. */ | 199 | /* Acquire an integer property. */ |
200 | extern int prom_getint(phandle node, const char *property); | 200 | int prom_getint(phandle node, const char *property); |
201 | 201 | ||
202 | /* Acquire an integer property, with a default value. */ | 202 | /* Acquire an integer property, with a default value. */ |
203 | extern int prom_getintdefault(phandle node, const char *property, int defval); | 203 | int prom_getintdefault(phandle node, const char *property, int defval); |
204 | 204 | ||
205 | /* Acquire a boolean property, 0=FALSE 1=TRUE. */ | 205 | /* Acquire a boolean property, 0=FALSE 1=TRUE. */ |
206 | extern int prom_getbool(phandle node, const char *prop); | 206 | int prom_getbool(phandle node, const char *prop); |
207 | 207 | ||
208 | /* Acquire a string property, null string on error. */ | 208 | /* Acquire a string property, null string on error. */ |
209 | extern void prom_getstring(phandle node, const char *prop, char *buf, | 209 | void prom_getstring(phandle node, const char *prop, char *buf, |
210 | int bufsize); | 210 | int bufsize); |
211 | 211 | ||
212 | /* Does the passed node have the given "name"? YES=1 NO=0 */ | 212 | /* Does the passed node have the given "name"? YES=1 NO=0 */ |
213 | extern int prom_nodematch(phandle thisnode, const char *name); | 213 | int prom_nodematch(phandle thisnode, const char *name); |
214 | 214 | ||
215 | /* Search all siblings starting at the passed node for "name" matching | 215 | /* Search all siblings starting at the passed node for "name" matching |
216 | * the given string. Returns the node on success, zero on failure. | 216 | * the given string. Returns the node on success, zero on failure. |
217 | */ | 217 | */ |
218 | extern phandle prom_searchsiblings(phandle node_start, const char *name); | 218 | phandle prom_searchsiblings(phandle node_start, const char *name); |
219 | 219 | ||
220 | /* Return the first property type, as a string, for the given node. | 220 | /* Return the first property type, as a string, for the given node. |
221 | * Returns a null string on error. Buffer should be at least 32B long. | 221 | * Returns a null string on error. Buffer should be at least 32B long. |
222 | */ | 222 | */ |
223 | extern char *prom_firstprop(phandle node, char *buffer); | 223 | char *prom_firstprop(phandle node, char *buffer); |
224 | 224 | ||
225 | /* Returns the next property after the passed property for the given | 225 | /* Returns the next property after the passed property for the given |
226 | * node. Returns null string on failure. Buffer should be at least 32B long. | 226 | * node. Returns null string on failure. Buffer should be at least 32B long. |
227 | */ | 227 | */ |
228 | extern char *prom_nextprop(phandle node, const char *prev_property, char *buf); | 228 | char *prom_nextprop(phandle node, const char *prev_property, char *buf); |
229 | 229 | ||
230 | /* Returns 1 if the specified node has given property. */ | 230 | /* Returns 1 if the specified node has given property. */ |
231 | extern int prom_node_has_property(phandle node, const char *property); | 231 | int prom_node_has_property(phandle node, const char *property); |
232 | 232 | ||
233 | /* Returns phandle of the path specified */ | 233 | /* Returns phandle of the path specified */ |
234 | extern phandle prom_finddevice(const char *name); | 234 | phandle prom_finddevice(const char *name); |
235 | 235 | ||
236 | /* Set the indicated property at the given node with the passed value. | 236 | /* Set the indicated property at the given node with the passed value. |
237 | * Returns the number of bytes of your value that the prom took. | 237 | * Returns the number of bytes of your value that the prom took. |
238 | */ | 238 | */ |
239 | extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, | 239 | int prom_setprop(phandle node, const char *prop_name, char *prop_value, |
240 | int value_size); | 240 | int value_size); |
241 | 241 | ||
242 | extern phandle prom_inst2pkg(int); | 242 | phandle prom_inst2pkg(int); |
243 | extern void prom_sun4v_guest_soft_state(void); | 243 | void prom_sun4v_guest_soft_state(void); |
244 | 244 | ||
245 | extern int prom_ihandle2path(int handle, char *buffer, int bufsize); | 245 | int prom_ihandle2path(int handle, char *buffer, int bufsize); |
246 | 246 | ||
247 | /* Client interface level routines. */ | 247 | /* Client interface level routines. */ |
248 | extern void p1275_cmd_direct(unsigned long *); | 248 | void p1275_cmd_direct(unsigned long *); |
249 | 249 | ||
250 | #endif /* !(__SPARC64_OPLIB_H) */ | 250 | #endif /* !(__SPARC64_OPLIB_H) */ |
diff --git a/arch/sparc/include/asm/page.h b/arch/sparc/include/asm/page.h index f21de0349025..1be2fdec6268 100644 --- a/arch/sparc/include/asm/page.h +++ b/arch/sparc/include/asm/page.h | |||
@@ -1,5 +1,8 @@ | |||
1 | #ifndef ___ASM_SPARC_PAGE_H | 1 | #ifndef ___ASM_SPARC_PAGE_H |
2 | #define ___ASM_SPARC_PAGE_H | 2 | #define ___ASM_SPARC_PAGE_H |
3 | |||
4 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | ||
5 | |||
3 | #if defined(__sparc__) && defined(__arch64__) | 6 | #if defined(__sparc__) && defined(__arch64__) |
4 | #include <asm/page_64.h> | 7 | #include <asm/page_64.h> |
5 | #else | 8 | #else |
diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h index aac53fcea807..bf109984a032 100644 --- a/arch/sparc/include/asm/page_64.h +++ b/arch/sparc/include/asm/page_64.h | |||
@@ -31,17 +31,17 @@ | |||
31 | 31 | ||
32 | #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) | 32 | #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) |
33 | struct pt_regs; | 33 | struct pt_regs; |
34 | extern void hugetlb_setup(struct pt_regs *regs); | 34 | void hugetlb_setup(struct pt_regs *regs); |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #define WANT_PAGE_VIRTUAL | 37 | #define WANT_PAGE_VIRTUAL |
38 | 38 | ||
39 | extern void _clear_page(void *page); | 39 | void _clear_page(void *page); |
40 | #define clear_page(X) _clear_page((void *)(X)) | 40 | #define clear_page(X) _clear_page((void *)(X)) |
41 | struct page; | 41 | struct page; |
42 | extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page); | 42 | void clear_user_page(void *addr, unsigned long vaddr, struct page *page); |
43 | #define copy_page(X,Y) memcpy((void *)(X), (void *)(Y), PAGE_SIZE) | 43 | #define copy_page(X,Y) memcpy((void *)(X), (void *)(Y), PAGE_SIZE) |
44 | extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage); | 44 | void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage); |
45 | 45 | ||
46 | /* Unlike sparc32, sparc64's parameter passing API is more | 46 | /* Unlike sparc32, sparc64's parameter passing API is more |
47 | * sane in that structures which as small enough are passed | 47 | * sane in that structures which as small enough are passed |
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h index c6c7396e7627..bd00a6226169 100644 --- a/arch/sparc/include/asm/pci_64.h +++ b/arch/sparc/include/asm/pci_64.h | |||
@@ -52,7 +52,7 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |||
52 | 52 | ||
53 | /* Return the index of the PCI controller for device PDEV. */ | 53 | /* Return the index of the PCI controller for device PDEV. */ |
54 | 54 | ||
55 | extern int pci_domain_nr(struct pci_bus *bus); | 55 | int pci_domain_nr(struct pci_bus *bus); |
56 | static inline int pci_proc_domain(struct pci_bus *bus) | 56 | static inline int pci_proc_domain(struct pci_bus *bus) |
57 | { | 57 | { |
58 | return 1; | 58 | return 1; |
@@ -64,9 +64,9 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
64 | #define HAVE_ARCH_PCI_GET_UNMAPPED_AREA | 64 | #define HAVE_ARCH_PCI_GET_UNMAPPED_AREA |
65 | #define get_pci_unmapped_area get_fb_unmapped_area | 65 | #define get_pci_unmapped_area get_fb_unmapped_area |
66 | 66 | ||
67 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | 67 | int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, |
68 | enum pci_mmap_state mmap_state, | 68 | enum pci_mmap_state mmap_state, |
69 | int write_combine); | 69 | int write_combine); |
70 | 70 | ||
71 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | 71 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) |
72 | { | 72 | { |
@@ -74,9 +74,9 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | |||
74 | } | 74 | } |
75 | 75 | ||
76 | #define HAVE_ARCH_PCI_RESOURCE_TO_USER | 76 | #define HAVE_ARCH_PCI_RESOURCE_TO_USER |
77 | extern void pci_resource_to_user(const struct pci_dev *dev, int bar, | 77 | void pci_resource_to_user(const struct pci_dev *dev, int bar, |
78 | const struct resource *rsrc, | 78 | const struct resource *rsrc, |
79 | resource_size_t *start, resource_size_t *end); | 79 | resource_size_t *start, resource_size_t *end); |
80 | #endif /* __KERNEL__ */ | 80 | #endif /* __KERNEL__ */ |
81 | 81 | ||
82 | #endif /* __SPARC64_PCI_H */ | 82 | #endif /* __SPARC64_PCI_H */ |
diff --git a/arch/sparc/include/asm/pcic.h b/arch/sparc/include/asm/pcic.h index 6676cbcc8b6a..f41706792592 100644 --- a/arch/sparc/include/asm/pcic.h +++ b/arch/sparc/include/asm/pcic.h | |||
@@ -30,10 +30,10 @@ struct linux_pcic { | |||
30 | }; | 30 | }; |
31 | 31 | ||
32 | #ifdef CONFIG_PCIC_PCI | 32 | #ifdef CONFIG_PCIC_PCI |
33 | extern int pcic_present(void); | 33 | int pcic_present(void); |
34 | extern int pcic_probe(void); | 34 | int pcic_probe(void); |
35 | extern void pci_time_init(void); | 35 | void pci_time_init(void); |
36 | extern void sun4m_pci_init_IRQ(void); | 36 | void sun4m_pci_init_IRQ(void); |
37 | #else | 37 | #else |
38 | static inline int pcic_present(void) { return 0; } | 38 | static inline int pcic_present(void) { return 0; } |
39 | static inline int pcic_probe(void) { return 0; } | 39 | static inline int pcic_probe(void) { return 0; } |
diff --git a/arch/sparc/include/asm/pcr.h b/arch/sparc/include/asm/pcr.h index 942bb17f60cd..cdf800c3326c 100644 --- a/arch/sparc/include/asm/pcr.h +++ b/arch/sparc/include/asm/pcr.h | |||
@@ -12,8 +12,8 @@ struct pcr_ops { | |||
12 | }; | 12 | }; |
13 | extern const struct pcr_ops *pcr_ops; | 13 | extern const struct pcr_ops *pcr_ops; |
14 | 14 | ||
15 | extern void deferred_pcr_work_irq(int irq, struct pt_regs *regs); | 15 | void deferred_pcr_work_irq(int irq, struct pt_regs *regs); |
16 | extern void schedule_deferred_pcr_work(void); | 16 | void schedule_deferred_pcr_work(void); |
17 | 17 | ||
18 | #define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */ | 18 | #define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */ |
19 | #define PCR_STRACE 0x00000002 /* Trace supervisor events */ | 19 | #define PCR_STRACE 0x00000002 /* Trace supervisor events */ |
@@ -45,6 +45,6 @@ extern void schedule_deferred_pcr_work(void); | |||
45 | #define PCR_N4_PICNHT 0x00020000 /* PIC non-hypervisor trap */ | 45 | #define PCR_N4_PICNHT 0x00020000 /* PIC non-hypervisor trap */ |
46 | #define PCR_N4_NTC 0x00040000 /* Next-To-Commit wrap */ | 46 | #define PCR_N4_NTC 0x00040000 /* Next-To-Commit wrap */ |
47 | 47 | ||
48 | extern int pcr_arch_init(void); | 48 | int pcr_arch_init(void); |
49 | 49 | ||
50 | #endif /* __PCR_H */ | 50 | #endif /* __PCR_H */ |
diff --git a/arch/sparc/include/asm/pgalloc_32.h b/arch/sparc/include/asm/pgalloc_32.h index 9b1c36de0f18..a3890da94428 100644 --- a/arch/sparc/include/asm/pgalloc_32.h +++ b/arch/sparc/include/asm/pgalloc_32.h | |||
@@ -14,6 +14,8 @@ struct page; | |||
14 | void *srmmu_get_nocache(int size, int align); | 14 | void *srmmu_get_nocache(int size, int align); |
15 | void srmmu_free_nocache(void *addr, int size); | 15 | void srmmu_free_nocache(void *addr, int size); |
16 | 16 | ||
17 | extern struct resource sparc_iomap; | ||
18 | |||
17 | #define check_pgt_cache() do { } while (0) | 19 | #define check_pgt_cache() do { } while (0) |
18 | 20 | ||
19 | pgd_t *get_pgd_fast(void); | 21 | pgd_t *get_pgd_fast(void); |
diff --git a/arch/sparc/include/asm/pgalloc_64.h b/arch/sparc/include/asm/pgalloc_64.h index bcfe063bce23..39a7ac49b00c 100644 --- a/arch/sparc/include/asm/pgalloc_64.h +++ b/arch/sparc/include/asm/pgalloc_64.h | |||
@@ -38,12 +38,12 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) | |||
38 | kmem_cache_free(pgtable_cache, pmd); | 38 | kmem_cache_free(pgtable_cache, pmd); |
39 | } | 39 | } |
40 | 40 | ||
41 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | 41 | pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
42 | unsigned long address); | 42 | unsigned long address); |
43 | extern pgtable_t pte_alloc_one(struct mm_struct *mm, | 43 | pgtable_t pte_alloc_one(struct mm_struct *mm, |
44 | unsigned long address); | 44 | unsigned long address); |
45 | extern void pte_free_kernel(struct mm_struct *mm, pte_t *pte); | 45 | void pte_free_kernel(struct mm_struct *mm, pte_t *pte); |
46 | extern void pte_free(struct mm_struct *mm, pgtable_t ptepage); | 46 | void pte_free(struct mm_struct *mm, pgtable_t ptepage); |
47 | 47 | ||
48 | #define pmd_populate_kernel(MM, PMD, PTE) pmd_set(MM, PMD, PTE) | 48 | #define pmd_populate_kernel(MM, PMD, PTE) pmd_set(MM, PMD, PTE) |
49 | #define pmd_populate(MM, PMD, PTE) pmd_set(MM, PMD, PTE) | 49 | #define pmd_populate(MM, PMD, PTE) pmd_set(MM, PMD, PTE) |
@@ -51,12 +51,12 @@ extern void pte_free(struct mm_struct *mm, pgtable_t ptepage); | |||
51 | 51 | ||
52 | #define check_pgt_cache() do { } while (0) | 52 | #define check_pgt_cache() do { } while (0) |
53 | 53 | ||
54 | extern void pgtable_free(void *table, bool is_page); | 54 | void pgtable_free(void *table, bool is_page); |
55 | 55 | ||
56 | #ifdef CONFIG_SMP | 56 | #ifdef CONFIG_SMP |
57 | 57 | ||
58 | struct mmu_gather; | 58 | struct mmu_gather; |
59 | extern void tlb_remove_table(struct mmu_gather *, void *); | 59 | void tlb_remove_table(struct mmu_gather *, void *); |
60 | 60 | ||
61 | static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page) | 61 | static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page) |
62 | { | 62 | { |
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index 502f632f6cc7..b9b91ae19fe1 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h | |||
@@ -25,8 +25,9 @@ | |||
25 | struct vm_area_struct; | 25 | struct vm_area_struct; |
26 | struct page; | 26 | struct page; |
27 | 27 | ||
28 | extern void load_mmu(void); | 28 | void load_mmu(void); |
29 | extern unsigned long calc_highpages(void); | 29 | unsigned long calc_highpages(void); |
30 | unsigned long __init bootmem_init(unsigned long *pages_avail); | ||
30 | 31 | ||
31 | #define pte_ERROR(e) __builtin_trap() | 32 | #define pte_ERROR(e) __builtin_trap() |
32 | #define pmd_ERROR(e) __builtin_trap() | 33 | #define pmd_ERROR(e) __builtin_trap() |
@@ -56,7 +57,7 @@ extern unsigned long calc_highpages(void); | |||
56 | * srmmu.c will assign the real one (which is dynamically sized) */ | 57 | * srmmu.c will assign the real one (which is dynamically sized) */ |
57 | #define swapper_pg_dir NULL | 58 | #define swapper_pg_dir NULL |
58 | 59 | ||
59 | extern void paging_init(void); | 60 | void paging_init(void); |
60 | 61 | ||
61 | extern unsigned long ptr_in_current_pgd; | 62 | extern unsigned long ptr_in_current_pgd; |
62 | 63 | ||
@@ -428,8 +429,8 @@ extern unsigned long *sparc_valid_addr_bitmap; | |||
428 | #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) | 429 | #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) |
429 | #define GET_PFN(pfn) (pfn & 0x0fffffffUL) | 430 | #define GET_PFN(pfn) (pfn & 0x0fffffffUL) |
430 | 431 | ||
431 | extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, | 432 | int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, |
432 | unsigned long, pgprot_t); | 433 | unsigned long, pgprot_t); |
433 | 434 | ||
434 | static inline int io_remap_pfn_range(struct vm_area_struct *vma, | 435 | static inline int io_remap_pfn_range(struct vm_area_struct *vma, |
435 | unsigned long from, unsigned long pfn, | 436 | unsigned long from, unsigned long pfn, |
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index 1a49ffdf9da9..3770bf5c6e1b 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h | |||
@@ -210,9 +210,9 @@ static inline bool kern_addr_valid(unsigned long addr) | |||
210 | 210 | ||
211 | #ifndef __ASSEMBLY__ | 211 | #ifndef __ASSEMBLY__ |
212 | 212 | ||
213 | extern pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long); | 213 | pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long); |
214 | 214 | ||
215 | extern unsigned long pte_sz_bits(unsigned long size); | 215 | unsigned long pte_sz_bits(unsigned long size); |
216 | 216 | ||
217 | extern pgprot_t PAGE_KERNEL; | 217 | extern pgprot_t PAGE_KERNEL; |
218 | extern pgprot_t PAGE_KERNEL_LOCKED; | 218 | extern pgprot_t PAGE_KERNEL_LOCKED; |
@@ -780,8 +780,8 @@ static inline int pmd_present(pmd_t pmd) | |||
780 | !__kern_addr_valid(pud_val(pud))) | 780 | !__kern_addr_valid(pud_val(pud))) |
781 | 781 | ||
782 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 782 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
783 | extern void set_pmd_at(struct mm_struct *mm, unsigned long addr, | 783 | void set_pmd_at(struct mm_struct *mm, unsigned long addr, |
784 | pmd_t *pmdp, pmd_t pmd); | 784 | pmd_t *pmdp, pmd_t pmd); |
785 | #else | 785 | #else |
786 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, | 786 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, |
787 | pmd_t *pmdp, pmd_t pmd) | 787 | pmd_t *pmdp, pmd_t pmd) |
@@ -840,8 +840,8 @@ static inline unsigned long __pmd_page(pmd_t pmd) | |||
840 | #define pte_unmap(pte) do { } while (0) | 840 | #define pte_unmap(pte) do { } while (0) |
841 | 841 | ||
842 | /* Actual page table PTE updates. */ | 842 | /* Actual page table PTE updates. */ |
843 | extern void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, | 843 | void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, |
844 | pte_t *ptep, pte_t orig, int fullmm); | 844 | pte_t *ptep, pte_t orig, int fullmm); |
845 | 845 | ||
846 | #define __HAVE_ARCH_PMDP_GET_AND_CLEAR | 846 | #define __HAVE_ARCH_PMDP_GET_AND_CLEAR |
847 | static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm, | 847 | static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm, |
@@ -900,28 +900,28 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
900 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | 900 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; |
901 | extern pmd_t swapper_low_pmd_dir[PTRS_PER_PMD]; | 901 | extern pmd_t swapper_low_pmd_dir[PTRS_PER_PMD]; |
902 | 902 | ||
903 | extern void paging_init(void); | 903 | void paging_init(void); |
904 | extern unsigned long find_ecache_flush_span(unsigned long size); | 904 | unsigned long find_ecache_flush_span(unsigned long size); |
905 | 905 | ||
906 | struct seq_file; | 906 | struct seq_file; |
907 | extern void mmu_info(struct seq_file *); | 907 | void mmu_info(struct seq_file *); |
908 | 908 | ||
909 | struct vm_area_struct; | 909 | struct vm_area_struct; |
910 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); | 910 | void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); |
911 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 911 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
912 | extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, | 912 | void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, |
913 | pmd_t *pmd); | 913 | pmd_t *pmd); |
914 | 914 | ||
915 | #define __HAVE_ARCH_PMDP_INVALIDATE | 915 | #define __HAVE_ARCH_PMDP_INVALIDATE |
916 | extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, | 916 | extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, |
917 | pmd_t *pmdp); | 917 | pmd_t *pmdp); |
918 | 918 | ||
919 | #define __HAVE_ARCH_PGTABLE_DEPOSIT | 919 | #define __HAVE_ARCH_PGTABLE_DEPOSIT |
920 | extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, | 920 | void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, |
921 | pgtable_t pgtable); | 921 | pgtable_t pgtable); |
922 | 922 | ||
923 | #define __HAVE_ARCH_PGTABLE_WITHDRAW | 923 | #define __HAVE_ARCH_PGTABLE_WITHDRAW |
924 | extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp); | 924 | pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp); |
925 | #endif | 925 | #endif |
926 | 926 | ||
927 | /* Encode and de-code a swap entry */ | 927 | /* Encode and de-code a swap entry */ |
@@ -937,12 +937,12 @@ extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp); | |||
937 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | 937 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) |
938 | 938 | ||
939 | /* File offset in PTE support. */ | 939 | /* File offset in PTE support. */ |
940 | extern unsigned long pte_file(pte_t); | 940 | unsigned long pte_file(pte_t); |
941 | #define pte_to_pgoff(pte) (pte_val(pte) >> PAGE_SHIFT) | 941 | #define pte_to_pgoff(pte) (pte_val(pte) >> PAGE_SHIFT) |
942 | extern pte_t pgoff_to_pte(unsigned long); | 942 | pte_t pgoff_to_pte(unsigned long); |
943 | #define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) | 943 | #define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) |
944 | 944 | ||
945 | extern int page_in_phys_avail(unsigned long paddr); | 945 | int page_in_phys_avail(unsigned long paddr); |
946 | 946 | ||
947 | /* | 947 | /* |
948 | * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in | 948 | * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in |
@@ -952,8 +952,8 @@ extern int page_in_phys_avail(unsigned long paddr); | |||
952 | #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) | 952 | #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) |
953 | #define GET_PFN(pfn) (pfn & 0x0fffffffffffffffUL) | 953 | #define GET_PFN(pfn) (pfn & 0x0fffffffffffffffUL) |
954 | 954 | ||
955 | extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, | 955 | int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, |
956 | unsigned long, pgprot_t); | 956 | unsigned long, pgprot_t); |
957 | 957 | ||
958 | static inline int io_remap_pfn_range(struct vm_area_struct *vma, | 958 | static inline int io_remap_pfn_range(struct vm_area_struct *vma, |
959 | unsigned long from, unsigned long pfn, | 959 | unsigned long from, unsigned long pfn, |
@@ -981,20 +981,20 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma, | |||
981 | /* We provide a special get_unmapped_area for framebuffer mmaps to try and use | 981 | /* We provide a special get_unmapped_area for framebuffer mmaps to try and use |
982 | * the largest alignment possible such that larget PTEs can be used. | 982 | * the largest alignment possible such that larget PTEs can be used. |
983 | */ | 983 | */ |
984 | extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, | 984 | unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, |
985 | unsigned long, unsigned long, | 985 | unsigned long, unsigned long, |
986 | unsigned long); | 986 | unsigned long); |
987 | #define HAVE_ARCH_FB_UNMAPPED_AREA | 987 | #define HAVE_ARCH_FB_UNMAPPED_AREA |
988 | 988 | ||
989 | extern void pgtable_cache_init(void); | 989 | void pgtable_cache_init(void); |
990 | extern void sun4v_register_fault_status(void); | 990 | void sun4v_register_fault_status(void); |
991 | extern void sun4v_ktsb_register(void); | 991 | void sun4v_ktsb_register(void); |
992 | extern void __init cheetah_ecache_flush_init(void); | 992 | void __init cheetah_ecache_flush_init(void); |
993 | extern void sun4v_patch_tlb_handlers(void); | 993 | void sun4v_patch_tlb_handlers(void); |
994 | 994 | ||
995 | extern unsigned long cmdline_memory_size; | 995 | extern unsigned long cmdline_memory_size; |
996 | 996 | ||
997 | extern asmlinkage void do_sparc64_fault(struct pt_regs *regs); | 997 | asmlinkage void do_sparc64_fault(struct pt_regs *regs); |
998 | 998 | ||
999 | #endif /* !(__ASSEMBLY__) */ | 999 | #endif /* !(__ASSEMBLY__) */ |
1000 | 1000 | ||
diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h index 2c7baa4c4505..a564817bbc2e 100644 --- a/arch/sparc/include/asm/processor_32.h +++ b/arch/sparc/include/asm/processor_32.h | |||
@@ -74,7 +74,7 @@ struct thread_struct { | |||
74 | } | 74 | } |
75 | 75 | ||
76 | /* Return saved PC of a blocked thread. */ | 76 | /* Return saved PC of a blocked thread. */ |
77 | extern unsigned long thread_saved_pc(struct task_struct *t); | 77 | unsigned long thread_saved_pc(struct task_struct *t); |
78 | 78 | ||
79 | /* Do necessary setup to start up a newly executed thread. */ | 79 | /* Do necessary setup to start up a newly executed thread. */ |
80 | static inline void start_thread(struct pt_regs * regs, unsigned long pc, | 80 | static inline void start_thread(struct pt_regs * regs, unsigned long pc, |
@@ -107,7 +107,7 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, | |||
107 | /* Free all resources held by a thread. */ | 107 | /* Free all resources held by a thread. */ |
108 | #define release_thread(tsk) do { } while(0) | 108 | #define release_thread(tsk) do { } while(0) |
109 | 109 | ||
110 | extern unsigned long get_wchan(struct task_struct *); | 110 | unsigned long get_wchan(struct task_struct *); |
111 | 111 | ||
112 | #define task_pt_regs(tsk) ((tsk)->thread.kregs) | 112 | #define task_pt_regs(tsk) ((tsk)->thread.kregs) |
113 | #define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc) | 113 | #define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc) |
@@ -116,6 +116,7 @@ extern unsigned long get_wchan(struct task_struct *); | |||
116 | #ifdef __KERNEL__ | 116 | #ifdef __KERNEL__ |
117 | 117 | ||
118 | extern struct task_struct *last_task_used_math; | 118 | extern struct task_struct *last_task_used_math; |
119 | int do_mathemu(struct pt_regs *regs, struct task_struct *fpt); | ||
119 | 120 | ||
120 | #define cpu_relax() barrier() | 121 | #define cpu_relax() barrier() |
121 | extern void (*sparc_idle)(void); | 122 | extern void (*sparc_idle)(void); |
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h index 4c3f7f01c709..7028fe1a7c04 100644 --- a/arch/sparc/include/asm/processor_64.h +++ b/arch/sparc/include/asm/processor_64.h | |||
@@ -95,7 +95,7 @@ struct thread_struct { | |||
95 | 95 | ||
96 | /* Return saved PC of a blocked thread. */ | 96 | /* Return saved PC of a blocked thread. */ |
97 | struct task_struct; | 97 | struct task_struct; |
98 | extern unsigned long thread_saved_pc(struct task_struct *); | 98 | unsigned long thread_saved_pc(struct task_struct *); |
99 | 99 | ||
100 | /* On Uniprocessor, even in RMO processes see TSO semantics */ | 100 | /* On Uniprocessor, even in RMO processes see TSO semantics */ |
101 | #ifdef CONFIG_SMP | 101 | #ifdef CONFIG_SMP |
@@ -194,7 +194,7 @@ do { \ | |||
194 | /* Free all resources held by a thread. */ | 194 | /* Free all resources held by a thread. */ |
195 | #define release_thread(tsk) do { } while (0) | 195 | #define release_thread(tsk) do { } while (0) |
196 | 196 | ||
197 | extern unsigned long get_wchan(struct task_struct *task); | 197 | unsigned long get_wchan(struct task_struct *task); |
198 | 198 | ||
199 | #define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) | 199 | #define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) |
200 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc) | 200 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc) |
@@ -253,6 +253,8 @@ static inline void prefetchw(const void *x) | |||
253 | 253 | ||
254 | #define HAVE_ARCH_PICK_MMAP_LAYOUT | 254 | #define HAVE_ARCH_PICK_MMAP_LAYOUT |
255 | 255 | ||
256 | int do_mathemu(struct pt_regs *regs, struct fpustate *f, bool illegal_insn_trap); | ||
257 | |||
256 | #endif /* !(__ASSEMBLY__) */ | 258 | #endif /* !(__ASSEMBLY__) */ |
257 | 259 | ||
258 | #endif /* !(__ASM_SPARC64_PROCESSOR_H) */ | 260 | #endif /* !(__ASM_SPARC64_PROCESSOR_H) */ |
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h index 11ebd659e7b6..d955c8df62d6 100644 --- a/arch/sparc/include/asm/prom.h +++ b/arch/sparc/include/asm/prom.h | |||
@@ -36,28 +36,28 @@ struct of_irq_controller { | |||
36 | void *data; | 36 | void *data; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern struct device_node *of_find_node_by_cpuid(int cpuid); | 39 | struct device_node *of_find_node_by_cpuid(int cpuid); |
40 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); | 40 | int of_set_property(struct device_node *node, const char *name, void *val, int len); |
41 | extern struct mutex of_set_property_mutex; | 41 | extern struct mutex of_set_property_mutex; |
42 | extern int of_getintprop_default(struct device_node *np, | 42 | int of_getintprop_default(struct device_node *np, |
43 | const char *name, | 43 | const char *name, |
44 | int def); | 44 | int def); |
45 | extern int of_find_in_proplist(const char *list, const char *match, int len); | 45 | int of_find_in_proplist(const char *list, const char *match, int len); |
46 | 46 | ||
47 | extern void prom_build_devicetree(void); | 47 | void prom_build_devicetree(void); |
48 | extern void of_populate_present_mask(void); | 48 | void of_populate_present_mask(void); |
49 | extern void of_fill_in_cpu_data(void); | 49 | void of_fill_in_cpu_data(void); |
50 | 50 | ||
51 | struct resource; | 51 | struct resource; |
52 | extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); | 52 | void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); |
53 | extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); | 53 | void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); |
54 | 54 | ||
55 | extern struct device_node *of_console_device; | 55 | extern struct device_node *of_console_device; |
56 | extern char *of_console_path; | 56 | extern char *of_console_path; |
57 | extern char *of_console_options; | 57 | extern char *of_console_options; |
58 | 58 | ||
59 | extern void irq_trans_init(struct device_node *dp); | 59 | void irq_trans_init(struct device_node *dp); |
60 | extern char *build_path_component(struct device_node *dp); | 60 | char *build_path_component(struct device_node *dp); |
61 | 61 | ||
62 | #endif /* __KERNEL__ */ | 62 | #endif /* __KERNEL__ */ |
63 | #endif /* _SPARC_PROM_H */ | 63 | #endif /* _SPARC_PROM_H */ |
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h index bdfafd7af46f..bac6a946ee00 100644 --- a/arch/sparc/include/asm/ptrace.h +++ b/arch/sparc/include/asm/ptrace.h | |||
@@ -73,7 +73,7 @@ static inline long regs_return_value(struct pt_regs *regs) | |||
73 | return regs->u_regs[UREG_I0]; | 73 | return regs->u_regs[UREG_I0]; |
74 | } | 74 | } |
75 | #ifdef CONFIG_SMP | 75 | #ifdef CONFIG_SMP |
76 | extern unsigned long profile_pc(struct pt_regs *); | 76 | unsigned long profile_pc(struct pt_regs *); |
77 | #else | 77 | #else |
78 | #define profile_pc(regs) instruction_pointer(regs) | 78 | #define profile_pc(regs) instruction_pointer(regs) |
79 | #endif | 79 | #endif |
diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h index 5e35e0517318..f5fffd84d0dd 100644 --- a/arch/sparc/include/asm/setup.h +++ b/arch/sparc/include/asm/setup.h | |||
@@ -4,8 +4,9 @@ | |||
4 | #ifndef _SPARC_SETUP_H | 4 | #ifndef _SPARC_SETUP_H |
5 | #define _SPARC_SETUP_H | 5 | #define _SPARC_SETUP_H |
6 | 6 | ||
7 | #include <uapi/asm/setup.h> | 7 | #include <linux/interrupt.h> |
8 | 8 | ||
9 | #include <uapi/asm/setup.h> | ||
9 | 10 | ||
10 | extern char reboot_command[]; | 11 | extern char reboot_command[]; |
11 | 12 | ||
@@ -22,9 +23,43 @@ static inline int con_is_present(void) | |||
22 | { | 23 | { |
23 | return serial_console ? 0 : 1; | 24 | return serial_console ? 0 : 1; |
24 | } | 25 | } |
26 | |||
27 | /* from irq_32.c */ | ||
28 | extern volatile unsigned char *fdc_status; | ||
29 | extern char *pdma_vaddr; | ||
30 | extern unsigned long pdma_size; | ||
31 | extern volatile int doing_pdma; | ||
32 | |||
33 | /* This is software state */ | ||
34 | extern char *pdma_base; | ||
35 | extern unsigned long pdma_areasize; | ||
36 | |||
37 | int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler); | ||
38 | |||
39 | /* setup_32.c */ | ||
40 | extern unsigned long cmdline_memory_size; | ||
41 | |||
42 | /* devices.c */ | ||
43 | void __init device_scan(void); | ||
44 | |||
45 | /* unaligned_32.c */ | ||
46 | unsigned long safe_compute_effective_address(struct pt_regs *, unsigned int); | ||
47 | |||
48 | #endif | ||
49 | |||
50 | #ifdef CONFIG_SPARC64 | ||
51 | /* unaligned_64.c */ | ||
52 | int handle_ldf_stq(u32 insn, struct pt_regs *regs); | ||
53 | void handle_ld_nf(u32 insn, struct pt_regs *regs); | ||
54 | |||
55 | /* init_64.c */ | ||
56 | extern atomic_t dcpage_flushes; | ||
57 | extern atomic_t dcpage_flushes_xcall; | ||
58 | |||
59 | extern int sysctl_tsb_ratio; | ||
25 | #endif | 60 | #endif |
26 | 61 | ||
27 | extern void sun_do_break(void); | 62 | void sun_do_break(void); |
28 | extern int stop_a_enabled; | 63 | extern int stop_a_enabled; |
29 | extern int scons_pwroff; | 64 | extern int scons_pwroff; |
30 | 65 | ||
diff --git a/arch/sparc/include/asm/sfp-machine_32.h b/arch/sparc/include/asm/sfp-machine_32.h index 01d9c3b5a73b..838c9d58f3b4 100644 --- a/arch/sparc/include/asm/sfp-machine_32.h +++ b/arch/sparc/include/asm/sfp-machine_32.h | |||
@@ -79,9 +79,9 @@ | |||
79 | __asm__ ("addcc %r7,%8,%2\n\t" \ | 79 | __asm__ ("addcc %r7,%8,%2\n\t" \ |
80 | "addxcc %r5,%6,%1\n\t" \ | 80 | "addxcc %r5,%6,%1\n\t" \ |
81 | "addx %r3,%4,%0\n" \ | 81 | "addx %r3,%4,%0\n" \ |
82 | : "=r" ((USItype)(r2)), \ | 82 | : "=r" (r2), \ |
83 | "=&r" ((USItype)(r1)), \ | 83 | "=&r" (r1), \ |
84 | "=&r" ((USItype)(r0)) \ | 84 | "=&r" (r0) \ |
85 | : "%rJ" ((USItype)(x2)), \ | 85 | : "%rJ" ((USItype)(x2)), \ |
86 | "rI" ((USItype)(y2)), \ | 86 | "rI" ((USItype)(y2)), \ |
87 | "%rJ" ((USItype)(x1)), \ | 87 | "%rJ" ((USItype)(x1)), \ |
@@ -94,9 +94,9 @@ | |||
94 | __asm__ ("subcc %r7,%8,%2\n\t" \ | 94 | __asm__ ("subcc %r7,%8,%2\n\t" \ |
95 | "subxcc %r5,%6,%1\n\t" \ | 95 | "subxcc %r5,%6,%1\n\t" \ |
96 | "subx %r3,%4,%0\n" \ | 96 | "subx %r3,%4,%0\n" \ |
97 | : "=r" ((USItype)(r2)), \ | 97 | : "=r" (r2), \ |
98 | "=&r" ((USItype)(r1)), \ | 98 | "=&r" (r1), \ |
99 | "=&r" ((USItype)(r0)) \ | 99 | "=&r" (r0) \ |
100 | : "%rJ" ((USItype)(x2)), \ | 100 | : "%rJ" ((USItype)(x2)), \ |
101 | "rI" ((USItype)(y2)), \ | 101 | "rI" ((USItype)(y2)), \ |
102 | "%rJ" ((USItype)(x1)), \ | 102 | "%rJ" ((USItype)(x1)), \ |
@@ -115,8 +115,8 @@ | |||
115 | "addxcc %r6,%7,%0\n\t" \ | 115 | "addxcc %r6,%7,%0\n\t" \ |
116 | "addxcc %r4,%5,%%g2\n\t" \ | 116 | "addxcc %r4,%5,%%g2\n\t" \ |
117 | "addx %r2,%3,%%g1\n\t" \ | 117 | "addx %r2,%3,%%g1\n\t" \ |
118 | : "=&r" ((USItype)(r1)), \ | 118 | : "=&r" (r1), \ |
119 | "=&r" ((USItype)(r0)) \ | 119 | "=&r" (r0) \ |
120 | : "%rJ" ((USItype)(x3)), \ | 120 | : "%rJ" ((USItype)(x3)), \ |
121 | "rI" ((USItype)(y3)), \ | 121 | "rI" ((USItype)(y3)), \ |
122 | "%rJ" ((USItype)(x2)), \ | 122 | "%rJ" ((USItype)(x2)), \ |
@@ -140,8 +140,8 @@ | |||
140 | "subxcc %r6,%7,%0\n\t" \ | 140 | "subxcc %r6,%7,%0\n\t" \ |
141 | "subxcc %r4,%5,%%g2\n\t" \ | 141 | "subxcc %r4,%5,%%g2\n\t" \ |
142 | "subx %r2,%3,%%g1\n\t" \ | 142 | "subx %r2,%3,%%g1\n\t" \ |
143 | : "=&r" ((USItype)(r1)), \ | 143 | : "=&r" (r1), \ |
144 | "=&r" ((USItype)(r0)) \ | 144 | "=&r" (r0) \ |
145 | : "%rJ" ((USItype)(x3)), \ | 145 | : "%rJ" ((USItype)(x3)), \ |
146 | "rI" ((USItype)(y3)), \ | 146 | "rI" ((USItype)(y3)), \ |
147 | "%rJ" ((USItype)(x2)), \ | 147 | "%rJ" ((USItype)(x2)), \ |
@@ -164,10 +164,10 @@ | |||
164 | "addxcc %2,%%g0,%2\n\t" \ | 164 | "addxcc %2,%%g0,%2\n\t" \ |
165 | "addxcc %1,%%g0,%1\n\t" \ | 165 | "addxcc %1,%%g0,%1\n\t" \ |
166 | "addx %0,%%g0,%0\n\t" \ | 166 | "addx %0,%%g0,%0\n\t" \ |
167 | : "=&r" ((USItype)(x3)), \ | 167 | : "=&r" (x3), \ |
168 | "=&r" ((USItype)(x2)), \ | 168 | "=&r" (x2), \ |
169 | "=&r" ((USItype)(x1)), \ | 169 | "=&r" (x1), \ |
170 | "=&r" ((USItype)(x0)) \ | 170 | "=&r" (x0) \ |
171 | : "rI" ((USItype)(i)), \ | 171 | : "rI" ((USItype)(i)), \ |
172 | "0" ((USItype)(x3)), \ | 172 | "0" ((USItype)(x3)), \ |
173 | "1" ((USItype)(x2)), \ | 173 | "1" ((USItype)(x2)), \ |
diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h index 3c8917f054de..7c24e08a88d2 100644 --- a/arch/sparc/include/asm/smp_32.h +++ b/arch/sparc/include/asm/smp_32.h | |||
@@ -93,15 +93,15 @@ static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2, | |||
93 | arg1, arg2, arg3, arg4); | 93 | arg1, arg2, arg3, arg4); |
94 | } | 94 | } |
95 | 95 | ||
96 | extern void arch_send_call_function_single_ipi(int cpu); | 96 | void arch_send_call_function_single_ipi(int cpu); |
97 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); | 97 | void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
98 | 98 | ||
99 | static inline int cpu_logical_map(int cpu) | 99 | static inline int cpu_logical_map(int cpu) |
100 | { | 100 | { |
101 | return cpu; | 101 | return cpu; |
102 | } | 102 | } |
103 | 103 | ||
104 | extern int hard_smp_processor_id(void); | 104 | int hard_smp_processor_id(void); |
105 | 105 | ||
106 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 106 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
107 | 107 | ||
diff --git a/arch/sparc/include/asm/smp_64.h b/arch/sparc/include/asm/smp_64.h index 05710393959f..26d9e7726867 100644 --- a/arch/sparc/include/asm/smp_64.h +++ b/arch/sparc/include/asm/smp_64.h | |||
@@ -33,29 +33,35 @@ | |||
33 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | 33 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); |
34 | extern cpumask_t cpu_core_map[NR_CPUS]; | 34 | extern cpumask_t cpu_core_map[NR_CPUS]; |
35 | 35 | ||
36 | extern void arch_send_call_function_single_ipi(int cpu); | 36 | void arch_send_call_function_single_ipi(int cpu); |
37 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); | 37 | void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * General functions that each host system must provide. | 40 | * General functions that each host system must provide. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | extern int hard_smp_processor_id(void); | 43 | int hard_smp_processor_id(void); |
44 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 44 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
45 | 45 | ||
46 | extern void smp_fill_in_sib_core_maps(void); | 46 | void smp_fill_in_sib_core_maps(void); |
47 | extern void cpu_play_dead(void); | 47 | void cpu_play_dead(void); |
48 | 48 | ||
49 | extern void smp_fetch_global_regs(void); | 49 | void smp_fetch_global_regs(void); |
50 | extern void smp_fetch_global_pmu(void); | 50 | void smp_fetch_global_pmu(void); |
51 | 51 | ||
52 | struct seq_file; | 52 | struct seq_file; |
53 | void smp_bogo(struct seq_file *); | 53 | void smp_bogo(struct seq_file *); |
54 | void smp_info(struct seq_file *); | 54 | void smp_info(struct seq_file *); |
55 | 55 | ||
56 | void smp_callin(void); | ||
57 | void cpu_panic(void); | ||
58 | void smp_synchronize_tick_client(void); | ||
59 | void smp_capture(void); | ||
60 | void smp_release(void); | ||
61 | |||
56 | #ifdef CONFIG_HOTPLUG_CPU | 62 | #ifdef CONFIG_HOTPLUG_CPU |
57 | extern int __cpu_disable(void); | 63 | int __cpu_disable(void); |
58 | extern void __cpu_die(unsigned int cpu); | 64 | void __cpu_die(unsigned int cpu); |
59 | #endif | 65 | #endif |
60 | 66 | ||
61 | #endif /* !(__ASSEMBLY__) */ | 67 | #endif /* !(__ASSEMBLY__) */ |
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h index 6b67e50fb9b4..3fc58691dbd0 100644 --- a/arch/sparc/include/asm/spitfire.h +++ b/arch/sparc/include/asm/spitfire.h | |||
@@ -62,7 +62,7 @@ extern enum ultra_tlb_layout tlb_type; | |||
62 | extern int sun4v_chip_type; | 62 | extern int sun4v_chip_type; |
63 | 63 | ||
64 | extern int cheetah_pcache_forced_on; | 64 | extern int cheetah_pcache_forced_on; |
65 | extern void cheetah_enable_pcache(void); | 65 | void cheetah_enable_pcache(void); |
66 | 66 | ||
67 | #define sparc64_highest_locked_tlbent() \ | 67 | #define sparc64_highest_locked_tlbent() \ |
68 | (tlb_type == spitfire ? \ | 68 | (tlb_type == spitfire ? \ |
diff --git a/arch/sparc/include/asm/stacktrace.h b/arch/sparc/include/asm/stacktrace.h index 6cee39adf6d6..c30d066f3048 100644 --- a/arch/sparc/include/asm/stacktrace.h +++ b/arch/sparc/include/asm/stacktrace.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef _SPARC64_STACKTRACE_H | 1 | #ifndef _SPARC64_STACKTRACE_H |
2 | #define _SPARC64_STACKTRACE_H | 2 | #define _SPARC64_STACKTRACE_H |
3 | 3 | ||
4 | extern void stack_trace_flush(void); | 4 | void stack_trace_flush(void); |
5 | 5 | ||
6 | #endif /* _SPARC64_STACKTRACE_H */ | 6 | #endif /* _SPARC64_STACKTRACE_H */ |
diff --git a/arch/sparc/include/asm/starfire.h b/arch/sparc/include/asm/starfire.h index d56ce60a5992..c100dc27a0a9 100644 --- a/arch/sparc/include/asm/starfire.h +++ b/arch/sparc/include/asm/starfire.h | |||
@@ -11,10 +11,10 @@ | |||
11 | 11 | ||
12 | extern int this_is_starfire; | 12 | extern int this_is_starfire; |
13 | 13 | ||
14 | extern void check_if_starfire(void); | 14 | void check_if_starfire(void); |
15 | extern int starfire_hard_smp_processor_id(void); | 15 | int starfire_hard_smp_processor_id(void); |
16 | extern void starfire_hookup(int); | 16 | void starfire_hookup(int); |
17 | extern unsigned int starfire_translate(unsigned long imap, unsigned int upaid); | 17 | unsigned int starfire_translate(unsigned long imap, unsigned int upaid); |
18 | 18 | ||
19 | #endif | 19 | #endif |
20 | #endif | 20 | #endif |
diff --git a/arch/sparc/include/asm/string_32.h b/arch/sparc/include/asm/string_32.h index 12f67857152e..69974e924611 100644 --- a/arch/sparc/include/asm/string_32.h +++ b/arch/sparc/include/asm/string_32.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
17 | 17 | ||
18 | extern void __memmove(void *,const void *,__kernel_size_t); | 18 | void __memmove(void *,const void *,__kernel_size_t); |
19 | 19 | ||
20 | #ifndef EXPORT_SYMTAB_STROPS | 20 | #ifndef EXPORT_SYMTAB_STROPS |
21 | 21 | ||
@@ -40,8 +40,8 @@ extern void __memmove(void *,const void *,__kernel_size_t); | |||
40 | #undef memscan | 40 | #undef memscan |
41 | #define memscan(__arg0, __char, __arg2) \ | 41 | #define memscan(__arg0, __char, __arg2) \ |
42 | ({ \ | 42 | ({ \ |
43 | extern void *__memscan_zero(void *, size_t); \ | 43 | void *__memscan_zero(void *, size_t); \ |
44 | extern void *__memscan_generic(void *, int, size_t); \ | 44 | void *__memscan_generic(void *, int, size_t); \ |
45 | void *__retval, *__addr = (__arg0); \ | 45 | void *__retval, *__addr = (__arg0); \ |
46 | size_t __size = (__arg2); \ | 46 | size_t __size = (__arg2); \ |
47 | \ | 47 | \ |
@@ -54,14 +54,14 @@ extern void __memmove(void *,const void *,__kernel_size_t); | |||
54 | }) | 54 | }) |
55 | 55 | ||
56 | #define __HAVE_ARCH_MEMCMP | 56 | #define __HAVE_ARCH_MEMCMP |
57 | extern int memcmp(const void *,const void *,__kernel_size_t); | 57 | int memcmp(const void *,const void *,__kernel_size_t); |
58 | 58 | ||
59 | /* Now the str*() stuff... */ | 59 | /* Now the str*() stuff... */ |
60 | #define __HAVE_ARCH_STRLEN | 60 | #define __HAVE_ARCH_STRLEN |
61 | extern __kernel_size_t strlen(const char *); | 61 | __kernel_size_t strlen(const char *); |
62 | 62 | ||
63 | #define __HAVE_ARCH_STRNCMP | 63 | #define __HAVE_ARCH_STRNCMP |
64 | extern int strncmp(const char *, const char *, __kernel_size_t); | 64 | int strncmp(const char *, const char *, __kernel_size_t); |
65 | 65 | ||
66 | #endif /* !EXPORT_SYMTAB_STROPS */ | 66 | #endif /* !EXPORT_SYMTAB_STROPS */ |
67 | 67 | ||
diff --git a/arch/sparc/include/asm/string_64.h b/arch/sparc/include/asm/string_64.h index 9623bc213158..5936b8ff3c05 100644 --- a/arch/sparc/include/asm/string_64.h +++ b/arch/sparc/include/asm/string_64.h | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | /* First the mem*() things. */ | 20 | /* First the mem*() things. */ |
21 | #define __HAVE_ARCH_MEMMOVE | 21 | #define __HAVE_ARCH_MEMMOVE |
22 | extern void *memmove(void *, const void *, __kernel_size_t); | 22 | void *memmove(void *, const void *, __kernel_size_t); |
23 | 23 | ||
24 | #define __HAVE_ARCH_MEMCPY | 24 | #define __HAVE_ARCH_MEMCPY |
25 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n) | 25 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n) |
@@ -32,8 +32,8 @@ extern void *memmove(void *, const void *, __kernel_size_t); | |||
32 | #undef memscan | 32 | #undef memscan |
33 | #define memscan(__arg0, __char, __arg2) \ | 33 | #define memscan(__arg0, __char, __arg2) \ |
34 | ({ \ | 34 | ({ \ |
35 | extern void *__memscan_zero(void *, size_t); \ | 35 | void *__memscan_zero(void *, size_t); \ |
36 | extern void *__memscan_generic(void *, int, size_t); \ | 36 | void *__memscan_generic(void *, int, size_t); \ |
37 | void *__retval, *__addr = (__arg0); \ | 37 | void *__retval, *__addr = (__arg0); \ |
38 | size_t __size = (__arg2); \ | 38 | size_t __size = (__arg2); \ |
39 | \ | 39 | \ |
@@ -46,14 +46,14 @@ extern void *memmove(void *, const void *, __kernel_size_t); | |||
46 | }) | 46 | }) |
47 | 47 | ||
48 | #define __HAVE_ARCH_MEMCMP | 48 | #define __HAVE_ARCH_MEMCMP |
49 | extern int memcmp(const void *,const void *,__kernel_size_t); | 49 | int memcmp(const void *,const void *,__kernel_size_t); |
50 | 50 | ||
51 | /* Now the str*() stuff... */ | 51 | /* Now the str*() stuff... */ |
52 | #define __HAVE_ARCH_STRLEN | 52 | #define __HAVE_ARCH_STRLEN |
53 | extern __kernel_size_t strlen(const char *); | 53 | __kernel_size_t strlen(const char *); |
54 | 54 | ||
55 | #define __HAVE_ARCH_STRNCMP | 55 | #define __HAVE_ARCH_STRNCMP |
56 | extern int strncmp(const char *, const char *, __kernel_size_t); | 56 | int strncmp(const char *, const char *, __kernel_size_t); |
57 | 57 | ||
58 | #endif /* !EXPORT_SYMTAB_STROPS */ | 58 | #endif /* !EXPORT_SYMTAB_STROPS */ |
59 | 59 | ||
diff --git a/arch/sparc/include/asm/switch_to_32.h b/arch/sparc/include/asm/switch_to_32.h index e32e82b76eed..16f10374feb3 100644 --- a/arch/sparc/include/asm/switch_to_32.h +++ b/arch/sparc/include/asm/switch_to_32.h | |||
@@ -99,8 +99,8 @@ extern struct thread_info *current_set[NR_CPUS]; | |||
99 | "o0", "o1", "o2", "o3", "o7"); \ | 99 | "o0", "o1", "o2", "o3", "o7"); \ |
100 | } while(0) | 100 | } while(0) |
101 | 101 | ||
102 | extern void fpsave(unsigned long *fpregs, unsigned long *fsr, | 102 | void fpsave(unsigned long *fpregs, unsigned long *fsr, |
103 | void *fpqueue, unsigned long *fpqdepth); | 103 | void *fpqueue, unsigned long *fpqdepth); |
104 | extern void synchronize_user_stack(void); | 104 | void synchronize_user_stack(void); |
105 | 105 | ||
106 | #endif /* __SPARC_SWITCH_TO_H */ | 106 | #endif /* __SPARC_SWITCH_TO_H */ |
diff --git a/arch/sparc/include/asm/switch_to_64.h b/arch/sparc/include/asm/switch_to_64.h index 8d284801f232..10e76332dc99 100644 --- a/arch/sparc/include/asm/switch_to_64.h +++ b/arch/sparc/include/asm/switch_to_64.h | |||
@@ -65,7 +65,7 @@ do { save_and_clear_fpu(); \ | |||
65 | "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \ | 65 | "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \ |
66 | } while(0) | 66 | } while(0) |
67 | 67 | ||
68 | extern void synchronize_user_stack(void); | 68 | void synchronize_user_stack(void); |
69 | extern void fault_in_user_windows(void); | 69 | void fault_in_user_windows(void); |
70 | 70 | ||
71 | #endif /* __SPARC64_SWITCH_TO_64_H */ | 71 | #endif /* __SPARC64_SWITCH_TO_64_H */ |
diff --git a/arch/sparc/include/asm/syscalls.h b/arch/sparc/include/asm/syscalls.h index bf8972adea17..b0a0db8ea61a 100644 --- a/arch/sparc/include/asm/syscalls.h +++ b/arch/sparc/include/asm/syscalls.h | |||
@@ -3,9 +3,9 @@ | |||
3 | 3 | ||
4 | struct pt_regs; | 4 | struct pt_regs; |
5 | 5 | ||
6 | extern asmlinkage long sparc_do_fork(unsigned long clone_flags, | 6 | asmlinkage long sparc_do_fork(unsigned long clone_flags, |
7 | unsigned long stack_start, | 7 | unsigned long stack_start, |
8 | struct pt_regs *regs, | 8 | struct pt_regs *regs, |
9 | unsigned long stack_size); | 9 | unsigned long stack_size); |
10 | 10 | ||
11 | #endif /* _SPARC64_SYSCALLS_H */ | 11 | #endif /* _SPARC64_SYSCALLS_H */ |
diff --git a/arch/sparc/include/asm/timer_32.h b/arch/sparc/include/asm/timer_32.h index 72f40a546de3..f8e708a0aa58 100644 --- a/arch/sparc/include/asm/timer_32.h +++ b/arch/sparc/include/asm/timer_32.h | |||
@@ -32,13 +32,13 @@ static inline unsigned int timer_value(unsigned int value) | |||
32 | return (value + 1) << TIMER_VALUE_SHIFT; | 32 | return (value + 1) << TIMER_VALUE_SHIFT; |
33 | } | 33 | } |
34 | 34 | ||
35 | extern __volatile__ unsigned int *master_l10_counter; | 35 | extern volatile u32 __iomem *master_l10_counter; |
36 | 36 | ||
37 | extern irqreturn_t notrace timer_interrupt(int dummy, void *dev_id); | 37 | irqreturn_t notrace timer_interrupt(int dummy, void *dev_id); |
38 | 38 | ||
39 | #ifdef CONFIG_SMP | 39 | #ifdef CONFIG_SMP |
40 | DECLARE_PER_CPU(struct clock_event_device, sparc32_clockevent); | 40 | DECLARE_PER_CPU(struct clock_event_device, sparc32_clockevent); |
41 | extern void register_percpu_ce(int cpu); | 41 | void register_percpu_ce(int cpu); |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #endif /* !(_SPARC_TIMER_H) */ | 44 | #endif /* !(_SPARC_TIMER_H) */ |
diff --git a/arch/sparc/include/asm/timer_64.h b/arch/sparc/include/asm/timer_64.h index 01197d8215c4..fce415034000 100644 --- a/arch/sparc/include/asm/timer_64.h +++ b/arch/sparc/include/asm/timer_64.h | |||
@@ -23,8 +23,8 @@ struct sparc64_tick_ops { | |||
23 | 23 | ||
24 | extern struct sparc64_tick_ops *tick_ops; | 24 | extern struct sparc64_tick_ops *tick_ops; |
25 | 25 | ||
26 | extern unsigned long sparc64_get_clock_tick(unsigned int cpu); | 26 | unsigned long sparc64_get_clock_tick(unsigned int cpu); |
27 | extern void setup_sparc64_timer(void); | 27 | void setup_sparc64_timer(void); |
28 | extern void __init time_init(void); | 28 | void __init time_init(void); |
29 | 29 | ||
30 | #endif /* _SPARC64_TIMER_H */ | 30 | #endif /* _SPARC64_TIMER_H */ |
diff --git a/arch/sparc/include/asm/tlb_64.h b/arch/sparc/include/asm/tlb_64.h index 190e18913cc6..4cb392f75d2b 100644 --- a/arch/sparc/include/asm/tlb_64.h +++ b/arch/sparc/include/asm/tlb_64.h | |||
@@ -8,19 +8,19 @@ | |||
8 | #include <asm/mmu_context.h> | 8 | #include <asm/mmu_context.h> |
9 | 9 | ||
10 | #ifdef CONFIG_SMP | 10 | #ifdef CONFIG_SMP |
11 | extern void smp_flush_tlb_pending(struct mm_struct *, | 11 | void smp_flush_tlb_pending(struct mm_struct *, |
12 | unsigned long, unsigned long *); | 12 | unsigned long, unsigned long *); |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #ifdef CONFIG_SMP | 15 | #ifdef CONFIG_SMP |
16 | extern void smp_flush_tlb_mm(struct mm_struct *mm); | 16 | void smp_flush_tlb_mm(struct mm_struct *mm); |
17 | #define do_flush_tlb_mm(mm) smp_flush_tlb_mm(mm) | 17 | #define do_flush_tlb_mm(mm) smp_flush_tlb_mm(mm) |
18 | #else | 18 | #else |
19 | #define do_flush_tlb_mm(mm) __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT) | 19 | #define do_flush_tlb_mm(mm) __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT) |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | extern void __flush_tlb_pending(unsigned long, unsigned long, unsigned long *); | 22 | void __flush_tlb_pending(unsigned long, unsigned long, unsigned long *); |
23 | extern void flush_tlb_pending(void); | 23 | void flush_tlb_pending(void); |
24 | 24 | ||
25 | #define tlb_start_vma(tlb, vma) do { } while (0) | 25 | #define tlb_start_vma(tlb, vma) do { } while (0) |
26 | #define tlb_end_vma(tlb, vma) do { } while (0) | 26 | #define tlb_end_vma(tlb, vma) do { } while (0) |
diff --git a/arch/sparc/include/asm/tlbflush_64.h b/arch/sparc/include/asm/tlbflush_64.h index 3c3c89f52643..816d8202fa0a 100644 --- a/arch/sparc/include/asm/tlbflush_64.h +++ b/arch/sparc/include/asm/tlbflush_64.h | |||
@@ -14,9 +14,9 @@ struct tlb_batch { | |||
14 | unsigned long vaddrs[TLB_BATCH_NR]; | 14 | unsigned long vaddrs[TLB_BATCH_NR]; |
15 | }; | 15 | }; |
16 | 16 | ||
17 | extern void flush_tsb_kernel_range(unsigned long start, unsigned long end); | 17 | void flush_tsb_kernel_range(unsigned long start, unsigned long end); |
18 | extern void flush_tsb_user(struct tlb_batch *tb); | 18 | void flush_tsb_user(struct tlb_batch *tb); |
19 | extern void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr); | 19 | void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr); |
20 | 20 | ||
21 | /* TLB flush operations. */ | 21 | /* TLB flush operations. */ |
22 | 22 | ||
@@ -36,15 +36,15 @@ static inline void flush_tlb_range(struct vm_area_struct *vma, | |||
36 | 36 | ||
37 | #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE | 37 | #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE |
38 | 38 | ||
39 | extern void flush_tlb_pending(void); | 39 | void flush_tlb_pending(void); |
40 | extern void arch_enter_lazy_mmu_mode(void); | 40 | void arch_enter_lazy_mmu_mode(void); |
41 | extern void arch_leave_lazy_mmu_mode(void); | 41 | void arch_leave_lazy_mmu_mode(void); |
42 | #define arch_flush_lazy_mmu_mode() do {} while (0) | 42 | #define arch_flush_lazy_mmu_mode() do {} while (0) |
43 | 43 | ||
44 | /* Local cpu only. */ | 44 | /* Local cpu only. */ |
45 | extern void __flush_tlb_all(void); | 45 | void __flush_tlb_all(void); |
46 | extern void __flush_tlb_page(unsigned long context, unsigned long vaddr); | 46 | void __flush_tlb_page(unsigned long context, unsigned long vaddr); |
47 | extern void __flush_tlb_kernel_range(unsigned long start, unsigned long end); | 47 | void __flush_tlb_kernel_range(unsigned long start, unsigned long end); |
48 | 48 | ||
49 | #ifndef CONFIG_SMP | 49 | #ifndef CONFIG_SMP |
50 | 50 | ||
@@ -60,8 +60,8 @@ static inline void global_flush_tlb_page(struct mm_struct *mm, unsigned long vad | |||
60 | 60 | ||
61 | #else /* CONFIG_SMP */ | 61 | #else /* CONFIG_SMP */ |
62 | 62 | ||
63 | extern void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end); | 63 | void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end); |
64 | extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr); | 64 | void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr); |
65 | 65 | ||
66 | #define flush_tlb_kernel_range(start, end) \ | 66 | #define flush_tlb_kernel_range(start, end) \ |
67 | do { flush_tsb_kernel_range(start,end); \ | 67 | do { flush_tsb_kernel_range(start,end); \ |
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h index a2d10fc64faf..ed8f071132e4 100644 --- a/arch/sparc/include/asm/topology_64.h +++ b/arch/sparc/include/asm/topology_64.h | |||
@@ -18,7 +18,7 @@ static inline int cpu_to_node(int cpu) | |||
18 | 18 | ||
19 | struct pci_bus; | 19 | struct pci_bus; |
20 | #ifdef CONFIG_PCI | 20 | #ifdef CONFIG_PCI |
21 | extern int pcibus_to_node(struct pci_bus *pbus); | 21 | int pcibus_to_node(struct pci_bus *pbus); |
22 | #else | 22 | #else |
23 | static inline int pcibus_to_node(struct pci_bus *pbus) | 23 | static inline int pcibus_to_node(struct pci_bus *pbus) |
24 | { | 24 | { |
diff --git a/arch/sparc/include/asm/trap_block.h b/arch/sparc/include/asm/trap_block.h index 7e26b2db6211..6fd4436d32f0 100644 --- a/arch/sparc/include/asm/trap_block.h +++ b/arch/sparc/include/asm/trap_block.h | |||
@@ -51,11 +51,11 @@ struct trap_per_cpu { | |||
51 | unsigned long __per_cpu_base; | 51 | unsigned long __per_cpu_base; |
52 | } __attribute__((aligned(64))); | 52 | } __attribute__((aligned(64))); |
53 | extern struct trap_per_cpu trap_block[NR_CPUS]; | 53 | extern struct trap_per_cpu trap_block[NR_CPUS]; |
54 | extern void init_cur_cpu_trap(struct thread_info *); | 54 | void init_cur_cpu_trap(struct thread_info *); |
55 | extern void setup_tba(void); | 55 | void setup_tba(void); |
56 | extern int ncpus_probed; | 56 | extern int ncpus_probed; |
57 | 57 | ||
58 | extern unsigned long real_hard_smp_processor_id(void); | 58 | unsigned long real_hard_smp_processor_id(void); |
59 | 59 | ||
60 | struct cpuid_patch_entry { | 60 | struct cpuid_patch_entry { |
61 | unsigned int addr; | 61 | unsigned int addr; |
diff --git a/arch/sparc/include/asm/uaccess.h b/arch/sparc/include/asm/uaccess.h index 0167d26d0d1d..bd56c28fff9f 100644 --- a/arch/sparc/include/asm/uaccess.h +++ b/arch/sparc/include/asm/uaccess.h | |||
@@ -9,6 +9,6 @@ | |||
9 | #define user_addr_max() \ | 9 | #define user_addr_max() \ |
10 | (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) | 10 | (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) |
11 | 11 | ||
12 | extern long strncpy_from_user(char *dest, const char __user *src, long count); | 12 | long strncpy_from_user(char *dest, const char __user *src, long count); |
13 | 13 | ||
14 | #endif | 14 | #endif |
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h index 53a28dd59f59..9634d086fc56 100644 --- a/arch/sparc/include/asm/uaccess_32.h +++ b/arch/sparc/include/asm/uaccess_32.h | |||
@@ -78,9 +78,9 @@ struct exception_table_entry | |||
78 | }; | 78 | }; |
79 | 79 | ||
80 | /* Returns 0 if exception not found and fixup otherwise. */ | 80 | /* Returns 0 if exception not found and fixup otherwise. */ |
81 | extern unsigned long search_extables_range(unsigned long addr, unsigned long *g2); | 81 | unsigned long search_extables_range(unsigned long addr, unsigned long *g2); |
82 | 82 | ||
83 | extern void __ret_efault(void); | 83 | void __ret_efault(void); |
84 | 84 | ||
85 | /* Uh, these should become the main single-value transfer routines.. | 85 | /* Uh, these should become the main single-value transfer routines.. |
86 | * They automatically use the right size if we just have the right | 86 | * They automatically use the right size if we just have the right |
@@ -152,7 +152,7 @@ __asm__ __volatile__( \ | |||
152 | : "=&r" (ret) : "r" (x), "m" (*__m(addr)), \ | 152 | : "=&r" (ret) : "r" (x), "m" (*__m(addr)), \ |
153 | "i" (-EFAULT)) | 153 | "i" (-EFAULT)) |
154 | 154 | ||
155 | extern int __put_user_bad(void); | 155 | int __put_user_bad(void); |
156 | 156 | ||
157 | #define __get_user_check(x,addr,size,type) ({ \ | 157 | #define __get_user_check(x,addr,size,type) ({ \ |
158 | register int __gu_ret; \ | 158 | register int __gu_ret; \ |
@@ -244,9 +244,9 @@ __asm__ __volatile__( \ | |||
244 | ".previous\n\t" \ | 244 | ".previous\n\t" \ |
245 | : "=&r" (x) : "m" (*__m(addr)), "i" (retval)) | 245 | : "=&r" (x) : "m" (*__m(addr)), "i" (retval)) |
246 | 246 | ||
247 | extern int __get_user_bad(void); | 247 | int __get_user_bad(void); |
248 | 248 | ||
249 | extern unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size); | 249 | unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size); |
250 | 250 | ||
251 | static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) | 251 | static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) |
252 | { | 252 | { |
@@ -306,8 +306,8 @@ static inline unsigned long clear_user(void __user *addr, unsigned long n) | |||
306 | return n; | 306 | return n; |
307 | } | 307 | } |
308 | 308 | ||
309 | extern __must_check long strlen_user(const char __user *str); | 309 | __must_check long strlen_user(const char __user *str); |
310 | extern __must_check long strnlen_user(const char __user *str, long n); | 310 | __must_check long strnlen_user(const char __user *str, long n); |
311 | 311 | ||
312 | #endif /* __ASSEMBLY__ */ | 312 | #endif /* __ASSEMBLY__ */ |
313 | 313 | ||
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h index ad7e178337f1..c990a5e577f0 100644 --- a/arch/sparc/include/asm/uaccess_64.h +++ b/arch/sparc/include/asm/uaccess_64.h | |||
@@ -76,8 +76,8 @@ struct exception_table_entry { | |||
76 | unsigned int insn, fixup; | 76 | unsigned int insn, fixup; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | extern void __ret_efault(void); | 79 | void __ret_efault(void); |
80 | extern void __retl_efault(void); | 80 | void __retl_efault(void); |
81 | 81 | ||
82 | /* Uh, these should become the main single-value transfer routines.. | 82 | /* Uh, these should become the main single-value transfer routines.. |
83 | * They automatically use the right size if we just have the right | 83 | * They automatically use the right size if we just have the right |
@@ -134,7 +134,7 @@ __asm__ __volatile__( \ | |||
134 | : "=r" (ret) : "r" (x), "r" (__m(addr)), \ | 134 | : "=r" (ret) : "r" (x), "r" (__m(addr)), \ |
135 | "i" (-EFAULT)) | 135 | "i" (-EFAULT)) |
136 | 136 | ||
137 | extern int __put_user_bad(void); | 137 | int __put_user_bad(void); |
138 | 138 | ||
139 | #define __get_user_nocheck(data,addr,size,type) ({ \ | 139 | #define __get_user_nocheck(data,addr,size,type) ({ \ |
140 | register int __gu_ret; \ | 140 | register int __gu_ret; \ |
@@ -204,13 +204,13 @@ __asm__ __volatile__( \ | |||
204 | ".previous\n\t" \ | 204 | ".previous\n\t" \ |
205 | : "=r" (x) : "r" (__m(addr)), "i" (retval)) | 205 | : "=r" (x) : "r" (__m(addr)), "i" (retval)) |
206 | 206 | ||
207 | extern int __get_user_bad(void); | 207 | int __get_user_bad(void); |
208 | 208 | ||
209 | extern unsigned long __must_check ___copy_from_user(void *to, | 209 | unsigned long __must_check ___copy_from_user(void *to, |
210 | const void __user *from, | 210 | const void __user *from, |
211 | unsigned long size); | 211 | unsigned long size); |
212 | extern unsigned long copy_from_user_fixup(void *to, const void __user *from, | 212 | unsigned long copy_from_user_fixup(void *to, const void __user *from, |
213 | unsigned long size); | 213 | unsigned long size); |
214 | static inline unsigned long __must_check | 214 | static inline unsigned long __must_check |
215 | copy_from_user(void *to, const void __user *from, unsigned long size) | 215 | copy_from_user(void *to, const void __user *from, unsigned long size) |
216 | { | 216 | { |
@@ -223,11 +223,11 @@ copy_from_user(void *to, const void __user *from, unsigned long size) | |||
223 | } | 223 | } |
224 | #define __copy_from_user copy_from_user | 224 | #define __copy_from_user copy_from_user |
225 | 225 | ||
226 | extern unsigned long __must_check ___copy_to_user(void __user *to, | 226 | unsigned long __must_check ___copy_to_user(void __user *to, |
227 | const void *from, | 227 | const void *from, |
228 | unsigned long size); | 228 | unsigned long size); |
229 | extern unsigned long copy_to_user_fixup(void __user *to, const void *from, | 229 | unsigned long copy_to_user_fixup(void __user *to, const void *from, |
230 | unsigned long size); | 230 | unsigned long size); |
231 | static inline unsigned long __must_check | 231 | static inline unsigned long __must_check |
232 | copy_to_user(void __user *to, const void *from, unsigned long size) | 232 | copy_to_user(void __user *to, const void *from, unsigned long size) |
233 | { | 233 | { |
@@ -239,11 +239,11 @@ copy_to_user(void __user *to, const void *from, unsigned long size) | |||
239 | } | 239 | } |
240 | #define __copy_to_user copy_to_user | 240 | #define __copy_to_user copy_to_user |
241 | 241 | ||
242 | extern unsigned long __must_check ___copy_in_user(void __user *to, | 242 | unsigned long __must_check ___copy_in_user(void __user *to, |
243 | const void __user *from, | 243 | const void __user *from, |
244 | unsigned long size); | 244 | unsigned long size); |
245 | extern unsigned long copy_in_user_fixup(void __user *to, void __user *from, | 245 | unsigned long copy_in_user_fixup(void __user *to, void __user *from, |
246 | unsigned long size); | 246 | unsigned long size); |
247 | static inline unsigned long __must_check | 247 | static inline unsigned long __must_check |
248 | copy_in_user(void __user *to, void __user *from, unsigned long size) | 248 | copy_in_user(void __user *to, void __user *from, unsigned long size) |
249 | { | 249 | { |
@@ -255,20 +255,20 @@ copy_in_user(void __user *to, void __user *from, unsigned long size) | |||
255 | } | 255 | } |
256 | #define __copy_in_user copy_in_user | 256 | #define __copy_in_user copy_in_user |
257 | 257 | ||
258 | extern unsigned long __must_check __clear_user(void __user *, unsigned long); | 258 | unsigned long __must_check __clear_user(void __user *, unsigned long); |
259 | 259 | ||
260 | #define clear_user __clear_user | 260 | #define clear_user __clear_user |
261 | 261 | ||
262 | extern __must_check long strlen_user(const char __user *str); | 262 | __must_check long strlen_user(const char __user *str); |
263 | extern __must_check long strnlen_user(const char __user *str, long n); | 263 | __must_check long strnlen_user(const char __user *str, long n); |
264 | 264 | ||
265 | #define __copy_to_user_inatomic __copy_to_user | 265 | #define __copy_to_user_inatomic __copy_to_user |
266 | #define __copy_from_user_inatomic __copy_from_user | 266 | #define __copy_from_user_inatomic __copy_from_user |
267 | 267 | ||
268 | struct pt_regs; | 268 | struct pt_regs; |
269 | extern unsigned long compute_effective_address(struct pt_regs *, | 269 | unsigned long compute_effective_address(struct pt_regs *, |
270 | unsigned int insn, | 270 | unsigned int insn, |
271 | unsigned int rd); | 271 | unsigned int rd); |
272 | 272 | ||
273 | #endif /* __ASSEMBLY__ */ | 273 | #endif /* __ASSEMBLY__ */ |
274 | 274 | ||
diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h index 432afa838861..e0f6c399f1d0 100644 --- a/arch/sparc/include/asm/vio.h +++ b/arch/sparc/include/asm/vio.h | |||
@@ -372,14 +372,14 @@ do { if (vio->debug & VIO_DEBUG_##TYPE) \ | |||
372 | vio->vdev->channel_id, ## a); \ | 372 | vio->vdev->channel_id, ## a); \ |
373 | } while (0) | 373 | } while (0) |
374 | 374 | ||
375 | extern int __vio_register_driver(struct vio_driver *drv, struct module *owner, | 375 | int __vio_register_driver(struct vio_driver *drv, struct module *owner, |
376 | const char *mod_name); | 376 | const char *mod_name); |
377 | /* | 377 | /* |
378 | * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded | 378 | * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded |
379 | */ | 379 | */ |
380 | #define vio_register_driver(driver) \ | 380 | #define vio_register_driver(driver) \ |
381 | __vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) | 381 | __vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) |
382 | extern void vio_unregister_driver(struct vio_driver *drv); | 382 | void vio_unregister_driver(struct vio_driver *drv); |
383 | 383 | ||
384 | static inline struct vio_driver *to_vio_driver(struct device_driver *drv) | 384 | static inline struct vio_driver *to_vio_driver(struct device_driver *drv) |
385 | { | 385 | { |
@@ -391,21 +391,21 @@ static inline struct vio_dev *to_vio_dev(struct device *dev) | |||
391 | return container_of(dev, struct vio_dev, dev); | 391 | return container_of(dev, struct vio_dev, dev); |
392 | } | 392 | } |
393 | 393 | ||
394 | extern int vio_ldc_send(struct vio_driver_state *vio, void *data, int len); | 394 | int vio_ldc_send(struct vio_driver_state *vio, void *data, int len); |
395 | extern void vio_link_state_change(struct vio_driver_state *vio, int event); | 395 | void vio_link_state_change(struct vio_driver_state *vio, int event); |
396 | extern void vio_conn_reset(struct vio_driver_state *vio); | 396 | void vio_conn_reset(struct vio_driver_state *vio); |
397 | extern int vio_control_pkt_engine(struct vio_driver_state *vio, void *pkt); | 397 | int vio_control_pkt_engine(struct vio_driver_state *vio, void *pkt); |
398 | extern int vio_validate_sid(struct vio_driver_state *vio, | 398 | int vio_validate_sid(struct vio_driver_state *vio, |
399 | struct vio_msg_tag *tp); | 399 | struct vio_msg_tag *tp); |
400 | extern u32 vio_send_sid(struct vio_driver_state *vio); | 400 | u32 vio_send_sid(struct vio_driver_state *vio); |
401 | extern int vio_ldc_alloc(struct vio_driver_state *vio, | 401 | int vio_ldc_alloc(struct vio_driver_state *vio, |
402 | struct ldc_channel_config *base_cfg, void *event_arg); | 402 | struct ldc_channel_config *base_cfg, void *event_arg); |
403 | extern void vio_ldc_free(struct vio_driver_state *vio); | 403 | void vio_ldc_free(struct vio_driver_state *vio); |
404 | extern int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev, | 404 | int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev, |
405 | u8 dev_class, struct vio_version *ver_table, | 405 | u8 dev_class, struct vio_version *ver_table, |
406 | int ver_table_size, struct vio_driver_ops *ops, | 406 | int ver_table_size, struct vio_driver_ops *ops, |
407 | char *name); | 407 | char *name); |
408 | 408 | ||
409 | extern void vio_port_up(struct vio_driver_state *vio); | 409 | void vio_port_up(struct vio_driver_state *vio); |
410 | 410 | ||
411 | #endif /* _SPARC64_VIO_H */ | 411 | #endif /* _SPARC64_VIO_H */ |
diff --git a/arch/sparc/include/asm/visasm.h b/arch/sparc/include/asm/visasm.h index 39ca301920db..b26673759283 100644 --- a/arch/sparc/include/asm/visasm.h +++ b/arch/sparc/include/asm/visasm.h | |||
@@ -57,7 +57,8 @@ static inline void save_and_clear_fpu(void) { | |||
57 | " " : : "i" (FPRS_FEF|FPRS_DU) : | 57 | " " : : "i" (FPRS_FEF|FPRS_DU) : |
58 | "o5", "g1", "g2", "g3", "g7", "cc"); | 58 | "o5", "g1", "g2", "g3", "g7", "cc"); |
59 | } | 59 | } |
60 | extern int vis_emul(struct pt_regs *, unsigned int); | 60 | |
61 | int vis_emul(struct pt_regs *, unsigned int); | ||
61 | #endif | 62 | #endif |
62 | 63 | ||
63 | #endif /* _SPARC64_ASI_H */ | 64 | #endif /* _SPARC64_ASI_H */ |
diff --git a/arch/sparc/include/asm/xor_64.h b/arch/sparc/include/asm/xor_64.h index ee8edc68423e..50c882856031 100644 --- a/arch/sparc/include/asm/xor_64.h +++ b/arch/sparc/include/asm/xor_64.h | |||
@@ -20,13 +20,13 @@ | |||
20 | 20 | ||
21 | #include <asm/spitfire.h> | 21 | #include <asm/spitfire.h> |
22 | 22 | ||
23 | extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); | 23 | void xor_vis_2(unsigned long, unsigned long *, unsigned long *); |
24 | extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, | 24 | void xor_vis_3(unsigned long, unsigned long *, unsigned long *, |
25 | unsigned long *); | 25 | unsigned long *); |
26 | extern void xor_vis_4(unsigned long, unsigned long *, unsigned long *, | 26 | void xor_vis_4(unsigned long, unsigned long *, unsigned long *, |
27 | unsigned long *, unsigned long *); | 27 | unsigned long *, unsigned long *); |
28 | extern void xor_vis_5(unsigned long, unsigned long *, unsigned long *, | 28 | void xor_vis_5(unsigned long, unsigned long *, unsigned long *, |
29 | unsigned long *, unsigned long *, unsigned long *); | 29 | unsigned long *, unsigned long *, unsigned long *); |
30 | 30 | ||
31 | /* XXX Ugh, write cheetah versions... -DaveM */ | 31 | /* XXX Ugh, write cheetah versions... -DaveM */ |
32 | 32 | ||
@@ -38,13 +38,13 @@ static struct xor_block_template xor_block_VIS = { | |||
38 | .do_5 = xor_vis_5, | 38 | .do_5 = xor_vis_5, |
39 | }; | 39 | }; |
40 | 40 | ||
41 | extern void xor_niagara_2(unsigned long, unsigned long *, unsigned long *); | 41 | void xor_niagara_2(unsigned long, unsigned long *, unsigned long *); |
42 | extern void xor_niagara_3(unsigned long, unsigned long *, unsigned long *, | 42 | void xor_niagara_3(unsigned long, unsigned long *, unsigned long *, |
43 | unsigned long *); | 43 | unsigned long *); |
44 | extern void xor_niagara_4(unsigned long, unsigned long *, unsigned long *, | 44 | void xor_niagara_4(unsigned long, unsigned long *, unsigned long *, |
45 | unsigned long *, unsigned long *); | 45 | unsigned long *, unsigned long *); |
46 | extern void xor_niagara_5(unsigned long, unsigned long *, unsigned long *, | 46 | void xor_niagara_5(unsigned long, unsigned long *, unsigned long *, |
47 | unsigned long *, unsigned long *, unsigned long *); | 47 | unsigned long *, unsigned long *, unsigned long *); |
48 | 48 | ||
49 | static struct xor_block_template xor_block_niagara = { | 49 | static struct xor_block_template xor_block_niagara = { |
50 | .name = "Niagara", | 50 | .name = "Niagara", |
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index d15cc1794b0e..7cf9c6ea3f1f 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile | |||
@@ -42,7 +42,6 @@ obj-y += time_$(BITS).o | |||
42 | obj-$(CONFIG_SPARC32) += windows.o | 42 | obj-$(CONFIG_SPARC32) += windows.o |
43 | obj-y += cpu.o | 43 | obj-y += cpu.o |
44 | obj-$(CONFIG_SPARC32) += devices.o | 44 | obj-$(CONFIG_SPARC32) += devices.o |
45 | obj-$(CONFIG_SPARC32) += tadpole.o | ||
46 | obj-y += ptrace_$(BITS).o | 45 | obj-y += ptrace_$(BITS).o |
47 | obj-y += unaligned_$(BITS).o | 46 | obj-y += unaligned_$(BITS).o |
48 | obj-y += una_asm_$(BITS).o | 47 | obj-y += una_asm_$(BITS).o |
diff --git a/arch/sparc/kernel/audit.c b/arch/sparc/kernel/audit.c index 8fff0ac63d56..24361b494a93 100644 --- a/arch/sparc/kernel/audit.c +++ b/arch/sparc/kernel/audit.c | |||
@@ -3,6 +3,8 @@ | |||
3 | #include <linux/audit.h> | 3 | #include <linux/audit.h> |
4 | #include <asm/unistd.h> | 4 | #include <asm/unistd.h> |
5 | 5 | ||
6 | #include "kernel.h" | ||
7 | |||
6 | static unsigned dir_class[] = { | 8 | static unsigned dir_class[] = { |
7 | #include <asm-generic/audit_dir_write.h> | 9 | #include <asm-generic/audit_dir_write.h> |
8 | ~0U | 10 | ~0U |
@@ -40,7 +42,6 @@ int audit_classify_arch(int arch) | |||
40 | int audit_classify_syscall(int abi, unsigned syscall) | 42 | int audit_classify_syscall(int abi, unsigned syscall) |
41 | { | 43 | { |
42 | #ifdef CONFIG_COMPAT | 44 | #ifdef CONFIG_COMPAT |
43 | extern int sparc32_classify_syscall(unsigned); | ||
44 | if (abi == AUDIT_ARCH_SPARC) | 45 | if (abi == AUDIT_ARCH_SPARC) |
45 | return sparc32_classify_syscall(syscall); | 46 | return sparc32_classify_syscall(syscall); |
46 | #endif | 47 | #endif |
@@ -61,11 +62,6 @@ int audit_classify_syscall(int abi, unsigned syscall) | |||
61 | static int __init audit_classes_init(void) | 62 | static int __init audit_classes_init(void) |
62 | { | 63 | { |
63 | #ifdef CONFIG_COMPAT | 64 | #ifdef CONFIG_COMPAT |
64 | extern __u32 sparc32_dir_class[]; | ||
65 | extern __u32 sparc32_write_class[]; | ||
66 | extern __u32 sparc32_read_class[]; | ||
67 | extern __u32 sparc32_chattr_class[]; | ||
68 | extern __u32 sparc32_signal_class[]; | ||
69 | audit_register_class(AUDIT_CLASS_WRITE_32, sparc32_write_class); | 65 | audit_register_class(AUDIT_CLASS_WRITE_32, sparc32_write_class); |
70 | audit_register_class(AUDIT_CLASS_READ_32, sparc32_read_class); | 66 | audit_register_class(AUDIT_CLASS_READ_32, sparc32_read_class); |
71 | audit_register_class(AUDIT_CLASS_DIR_WRITE_32, sparc32_dir_class); | 67 | audit_register_class(AUDIT_CLASS_DIR_WRITE_32, sparc32_dir_class); |
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c index e20cc55fb768..ae88c223e4d3 100644 --- a/arch/sparc/kernel/auxio_32.c +++ b/arch/sparc/kernel/auxio_32.c | |||
@@ -9,12 +9,15 @@ | |||
9 | #include <linux/of.h> | 9 | #include <linux/of.h> |
10 | #include <linux/of_device.h> | 10 | #include <linux/of_device.h> |
11 | #include <linux/export.h> | 11 | #include <linux/export.h> |
12 | |||
12 | #include <asm/oplib.h> | 13 | #include <asm/oplib.h> |
13 | #include <asm/io.h> | 14 | #include <asm/io.h> |
14 | #include <asm/auxio.h> | 15 | #include <asm/auxio.h> |
15 | #include <asm/string.h> /* memset(), Linux has no bzero() */ | 16 | #include <asm/string.h> /* memset(), Linux has no bzero() */ |
16 | #include <asm/cpu_type.h> | 17 | #include <asm/cpu_type.h> |
17 | 18 | ||
19 | #include "kernel.h" | ||
20 | |||
18 | /* Probe and map in the Auxiliary I/O register */ | 21 | /* Probe and map in the Auxiliary I/O register */ |
19 | 22 | ||
20 | /* auxio_register is not static because it is referenced | 23 | /* auxio_register is not static because it is referenced |
@@ -103,7 +106,7 @@ EXPORT_SYMBOL(set_auxio); | |||
103 | 106 | ||
104 | /* sun4m power control register (AUXIO2) */ | 107 | /* sun4m power control register (AUXIO2) */ |
105 | 108 | ||
106 | volatile unsigned char * auxio_power_register = NULL; | 109 | volatile u8 __iomem *auxio_power_register = NULL; |
107 | 110 | ||
108 | void __init auxio_power_probe(void) | 111 | void __init auxio_power_probe(void) |
109 | { | 112 | { |
@@ -127,8 +130,8 @@ void __init auxio_power_probe(void) | |||
127 | r.flags = regs.which_io & 0xF; | 130 | r.flags = regs.which_io & 0xF; |
128 | r.start = regs.phys_addr; | 131 | r.start = regs.phys_addr; |
129 | r.end = regs.phys_addr + regs.reg_size - 1; | 132 | r.end = regs.phys_addr + regs.reg_size - 1; |
130 | auxio_power_register = (unsigned char *) of_ioremap(&r, 0, | 133 | auxio_power_register = |
131 | regs.reg_size, "auxpower"); | 134 | (u8 __iomem *)of_ioremap(&r, 0, regs.reg_size, "auxpower"); |
132 | 135 | ||
133 | /* Display a quick message on the console. */ | 136 | /* Display a quick message on the console. */ |
134 | if (auxio_power_register) | 137 | if (auxio_power_register) |
diff --git a/arch/sparc/kernel/btext.c b/arch/sparc/kernel/btext.c index 57073e56ba9e..987f7ec497cc 100644 --- a/arch/sparc/kernel/btext.c +++ b/arch/sparc/kernel/btext.c | |||
@@ -137,7 +137,7 @@ static void scrollscreen(void) | |||
137 | } | 137 | } |
138 | #endif /* ndef NO_SCROLL */ | 138 | #endif /* ndef NO_SCROLL */ |
139 | 139 | ||
140 | void btext_drawchar(char c) | 140 | static void btext_drawchar(char c) |
141 | { | 141 | { |
142 | int cline = 0; | 142 | int cline = 0; |
143 | #ifdef NO_SCROLL | 143 | #ifdef NO_SCROLL |
diff --git a/arch/sparc/kernel/compat_audit.c b/arch/sparc/kernel/compat_audit.c index d865575b25bf..7062263d09c1 100644 --- a/arch/sparc/kernel/compat_audit.c +++ b/arch/sparc/kernel/compat_audit.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #define __32bit_syscall_numbers__ | 1 | #define __32bit_syscall_numbers__ |
2 | #include <asm/unistd.h> | 2 | #include <asm/unistd.h> |
3 | #include "kernel.h" | ||
3 | 4 | ||
4 | unsigned sparc32_dir_class[] = { | 5 | unsigned sparc32_dir_class[] = { |
5 | #include <asm-generic/audit_dir_write.h> | 6 | #include <asm-generic/audit_dir_write.h> |
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c index 5c5125895db8..82a3a71c451e 100644 --- a/arch/sparc/kernel/cpu.c +++ b/arch/sparc/kernel/cpu.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/cpudata.h> | 22 | #include <asm/cpudata.h> |
23 | 23 | ||
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | #include "entry.h" | ||
25 | 26 | ||
26 | DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; | 27 | DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; |
27 | EXPORT_PER_CPU_SYMBOL(__cpu_data); | 28 | EXPORT_PER_CPU_SYMBOL(__cpu_data); |
diff --git a/arch/sparc/kernel/cpumap.h b/arch/sparc/kernel/cpumap.h index e639880ab864..9dac398c434a 100644 --- a/arch/sparc/kernel/cpumap.h +++ b/arch/sparc/kernel/cpumap.h | |||
@@ -2,8 +2,8 @@ | |||
2 | #define _CPUMAP_H | 2 | #define _CPUMAP_H |
3 | 3 | ||
4 | #ifdef CONFIG_SMP | 4 | #ifdef CONFIG_SMP |
5 | extern void cpu_map_rebuild(void); | 5 | void cpu_map_rebuild(void); |
6 | extern int map_to_cpu(unsigned int index); | 6 | int map_to_cpu(unsigned int index); |
7 | #define cpu_map_init() cpu_map_rebuild() | 7 | #define cpu_map_init() cpu_map_rebuild() |
8 | #else | 8 | #else |
9 | #define cpu_map_init() do {} while (0) | 9 | #define cpu_map_init() do {} while (0) |
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c index 3d465e87f7e2..8d5d09f09caf 100644 --- a/arch/sparc/kernel/devices.c +++ b/arch/sparc/kernel/devices.c | |||
@@ -19,8 +19,9 @@ | |||
19 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
20 | #include <asm/cpudata.h> | 20 | #include <asm/cpudata.h> |
21 | #include <asm/cpu_type.h> | 21 | #include <asm/cpu_type.h> |
22 | #include <asm/setup.h> | ||
22 | 23 | ||
23 | extern void clock_stop_probe(void); /* tadpole.c */ | 24 | #include "kernel.h" |
24 | 25 | ||
25 | static char *cpu_mid_prop(void) | 26 | static char *cpu_mid_prop(void) |
26 | { | 27 | { |
@@ -131,11 +132,6 @@ void __init device_scan(void) | |||
131 | } | 132 | } |
132 | #endif /* !CONFIG_SMP */ | 133 | #endif /* !CONFIG_SMP */ |
133 | 134 | ||
134 | { | 135 | auxio_probe(); |
135 | extern void auxio_probe(void); | 136 | auxio_power_probe(); |
136 | extern void auxio_power_probe(void); | ||
137 | auxio_probe(); | ||
138 | auxio_power_probe(); | ||
139 | } | ||
140 | clock_stop_probe(); | ||
141 | } | 137 | } |
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h index 140966fbd303..ebaba6167dd4 100644 --- a/arch/sparc/kernel/entry.h +++ b/arch/sparc/kernel/entry.h | |||
@@ -6,40 +6,39 @@ | |||
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | 7 | ||
8 | /* irq */ | 8 | /* irq */ |
9 | extern void handler_irq(int irq, struct pt_regs *regs); | 9 | void handler_irq(int irq, struct pt_regs *regs); |
10 | 10 | ||
11 | #ifdef CONFIG_SPARC32 | 11 | #ifdef CONFIG_SPARC32 |
12 | /* traps */ | 12 | /* traps */ |
13 | extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type); | 13 | void do_hw_interrupt(struct pt_regs *regs, unsigned long type); |
14 | extern void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, | 14 | void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, |
15 | unsigned long npc, unsigned long psr); | 15 | unsigned long npc, unsigned long psr); |
16 | 16 | ||
17 | extern void do_priv_instruction(struct pt_regs *regs, unsigned long pc, | 17 | void do_priv_instruction(struct pt_regs *regs, unsigned long pc, |
18 | unsigned long npc, unsigned long psr); | 18 | unsigned long npc, unsigned long psr); |
19 | extern void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, | 19 | void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, |
20 | unsigned long npc, | 20 | unsigned long npc, unsigned long psr); |
21 | unsigned long psr); | 21 | void do_fpd_trap(struct pt_regs *regs, unsigned long pc, |
22 | extern void do_fpd_trap(struct pt_regs *regs, unsigned long pc, | 22 | unsigned long npc, unsigned long psr); |
23 | void do_fpe_trap(struct pt_regs *regs, unsigned long pc, | ||
24 | unsigned long npc, unsigned long psr); | ||
25 | void handle_tag_overflow(struct pt_regs *regs, unsigned long pc, | ||
26 | unsigned long npc, unsigned long psr); | ||
27 | void handle_watchpoint(struct pt_regs *regs, unsigned long pc, | ||
28 | unsigned long npc, unsigned long psr); | ||
29 | void handle_reg_access(struct pt_regs *regs, unsigned long pc, | ||
30 | unsigned long npc, unsigned long psr); | ||
31 | void handle_cp_disabled(struct pt_regs *regs, unsigned long pc, | ||
23 | unsigned long npc, unsigned long psr); | 32 | unsigned long npc, unsigned long psr); |
24 | extern void do_fpe_trap(struct pt_regs *regs, unsigned long pc, | 33 | void handle_cp_exception(struct pt_regs *regs, unsigned long pc, |
25 | unsigned long npc, unsigned long psr); | 34 | unsigned long npc, unsigned long psr); |
26 | extern void handle_tag_overflow(struct pt_regs *regs, unsigned long pc, | ||
27 | unsigned long npc, unsigned long psr); | ||
28 | extern void handle_watchpoint(struct pt_regs *regs, unsigned long pc, | ||
29 | unsigned long npc, unsigned long psr); | ||
30 | extern void handle_reg_access(struct pt_regs *regs, unsigned long pc, | ||
31 | unsigned long npc, unsigned long psr); | ||
32 | extern void handle_cp_disabled(struct pt_regs *regs, unsigned long pc, | ||
33 | unsigned long npc, unsigned long psr); | ||
34 | extern void handle_cp_exception(struct pt_regs *regs, unsigned long pc, | ||
35 | unsigned long npc, unsigned long psr); | ||
36 | 35 | ||
37 | 36 | ||
38 | 37 | ||
39 | /* entry.S */ | 38 | /* entry.S */ |
40 | extern void fpsave(unsigned long *fpregs, unsigned long *fsr, | 39 | void fpsave(unsigned long *fpregs, unsigned long *fsr, |
41 | void *fpqueue, unsigned long *fpqdepth); | 40 | void *fpqueue, unsigned long *fpqdepth); |
42 | extern void fpload(unsigned long *fpregs, unsigned long *fsr); | 41 | void fpload(unsigned long *fpregs, unsigned long *fsr); |
43 | 42 | ||
44 | #else /* CONFIG_SPARC32 */ | 43 | #else /* CONFIG_SPARC32 */ |
45 | 44 | ||
@@ -66,123 +65,123 @@ struct pause_patch_entry { | |||
66 | extern struct pause_patch_entry __pause_3insn_patch, | 65 | extern struct pause_patch_entry __pause_3insn_patch, |
67 | __pause_3insn_patch_end; | 66 | __pause_3insn_patch_end; |
68 | 67 | ||
69 | extern void __init per_cpu_patch(void); | 68 | void __init per_cpu_patch(void); |
70 | extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *, | 69 | void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *, |
71 | struct sun4v_1insn_patch_entry *); | 70 | struct sun4v_1insn_patch_entry *); |
72 | extern void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *, | 71 | void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *, |
73 | struct sun4v_2insn_patch_entry *); | 72 | struct sun4v_2insn_patch_entry *); |
74 | extern void __init sun4v_patch(void); | 73 | void __init sun4v_patch(void); |
75 | extern void __init boot_cpu_id_too_large(int cpu); | 74 | void __init boot_cpu_id_too_large(int cpu); |
76 | extern unsigned int dcache_parity_tl1_occurred; | 75 | extern unsigned int dcache_parity_tl1_occurred; |
77 | extern unsigned int icache_parity_tl1_occurred; | 76 | extern unsigned int icache_parity_tl1_occurred; |
78 | 77 | ||
79 | extern asmlinkage void sparc_breakpoint(struct pt_regs *regs); | 78 | asmlinkage void sparc_breakpoint(struct pt_regs *regs); |
80 | extern void timer_interrupt(int irq, struct pt_regs *regs); | 79 | void timer_interrupt(int irq, struct pt_regs *regs); |
81 | 80 | ||
82 | extern void do_notify_resume(struct pt_regs *regs, | 81 | void do_notify_resume(struct pt_regs *regs, |
83 | unsigned long orig_i0, | 82 | unsigned long orig_i0, |
84 | unsigned long thread_info_flags); | 83 | unsigned long thread_info_flags); |
85 | 84 | ||
86 | extern asmlinkage int syscall_trace_enter(struct pt_regs *regs); | 85 | asmlinkage int syscall_trace_enter(struct pt_regs *regs); |
87 | extern asmlinkage void syscall_trace_leave(struct pt_regs *regs); | 86 | asmlinkage void syscall_trace_leave(struct pt_regs *regs); |
88 | 87 | ||
89 | extern void bad_trap_tl1(struct pt_regs *regs, long lvl); | 88 | void bad_trap_tl1(struct pt_regs *regs, long lvl); |
90 | 89 | ||
91 | extern void do_fpieee(struct pt_regs *regs); | 90 | void do_fpieee(struct pt_regs *regs); |
92 | extern void do_fpother(struct pt_regs *regs); | 91 | void do_fpother(struct pt_regs *regs); |
93 | extern void do_tof(struct pt_regs *regs); | 92 | void do_tof(struct pt_regs *regs); |
94 | extern void do_div0(struct pt_regs *regs); | 93 | void do_div0(struct pt_regs *regs); |
95 | extern void do_illegal_instruction(struct pt_regs *regs); | 94 | void do_illegal_instruction(struct pt_regs *regs); |
96 | extern void mem_address_unaligned(struct pt_regs *regs, | 95 | void mem_address_unaligned(struct pt_regs *regs, |
97 | unsigned long sfar, | 96 | unsigned long sfar, |
98 | unsigned long sfsr); | 97 | unsigned long sfsr); |
99 | extern void sun4v_do_mna(struct pt_regs *regs, | 98 | void sun4v_do_mna(struct pt_regs *regs, |
100 | unsigned long addr, | 99 | unsigned long addr, |
101 | unsigned long type_ctx); | 100 | unsigned long type_ctx); |
102 | extern void do_privop(struct pt_regs *regs); | 101 | void do_privop(struct pt_regs *regs); |
103 | extern void do_privact(struct pt_regs *regs); | 102 | void do_privact(struct pt_regs *regs); |
104 | extern void do_cee(struct pt_regs *regs); | 103 | void do_cee(struct pt_regs *regs); |
105 | extern void do_cee_tl1(struct pt_regs *regs); | 104 | void do_cee_tl1(struct pt_regs *regs); |
106 | extern void do_dae_tl1(struct pt_regs *regs); | 105 | void do_dae_tl1(struct pt_regs *regs); |
107 | extern void do_iae_tl1(struct pt_regs *regs); | 106 | void do_iae_tl1(struct pt_regs *regs); |
108 | extern void do_div0_tl1(struct pt_regs *regs); | 107 | void do_div0_tl1(struct pt_regs *regs); |
109 | extern void do_fpdis_tl1(struct pt_regs *regs); | 108 | void do_fpdis_tl1(struct pt_regs *regs); |
110 | extern void do_fpieee_tl1(struct pt_regs *regs); | 109 | void do_fpieee_tl1(struct pt_regs *regs); |
111 | extern void do_fpother_tl1(struct pt_regs *regs); | 110 | void do_fpother_tl1(struct pt_regs *regs); |
112 | extern void do_ill_tl1(struct pt_regs *regs); | 111 | void do_ill_tl1(struct pt_regs *regs); |
113 | extern void do_irq_tl1(struct pt_regs *regs); | 112 | void do_irq_tl1(struct pt_regs *regs); |
114 | extern void do_lddfmna_tl1(struct pt_regs *regs); | 113 | void do_lddfmna_tl1(struct pt_regs *regs); |
115 | extern void do_stdfmna_tl1(struct pt_regs *regs); | 114 | void do_stdfmna_tl1(struct pt_regs *regs); |
116 | extern void do_paw(struct pt_regs *regs); | 115 | void do_paw(struct pt_regs *regs); |
117 | extern void do_paw_tl1(struct pt_regs *regs); | 116 | void do_paw_tl1(struct pt_regs *regs); |
118 | extern void do_vaw(struct pt_regs *regs); | 117 | void do_vaw(struct pt_regs *regs); |
119 | extern void do_vaw_tl1(struct pt_regs *regs); | 118 | void do_vaw_tl1(struct pt_regs *regs); |
120 | extern void do_tof_tl1(struct pt_regs *regs); | 119 | void do_tof_tl1(struct pt_regs *regs); |
121 | extern void do_getpsr(struct pt_regs *regs); | 120 | void do_getpsr(struct pt_regs *regs); |
122 | 121 | ||
123 | extern void spitfire_insn_access_exception(struct pt_regs *regs, | 122 | void spitfire_insn_access_exception(struct pt_regs *regs, |
124 | unsigned long sfsr, | 123 | unsigned long sfsr, |
125 | unsigned long sfar); | 124 | unsigned long sfar); |
126 | extern void spitfire_insn_access_exception_tl1(struct pt_regs *regs, | 125 | void spitfire_insn_access_exception_tl1(struct pt_regs *regs, |
127 | unsigned long sfsr, | 126 | unsigned long sfsr, |
128 | unsigned long sfar); | 127 | unsigned long sfar); |
129 | extern void spitfire_data_access_exception(struct pt_regs *regs, | 128 | void spitfire_data_access_exception(struct pt_regs *regs, |
130 | unsigned long sfsr, | 129 | unsigned long sfsr, |
131 | unsigned long sfar); | 130 | unsigned long sfar); |
132 | extern void spitfire_data_access_exception_tl1(struct pt_regs *regs, | 131 | void spitfire_data_access_exception_tl1(struct pt_regs *regs, |
133 | unsigned long sfsr, | 132 | unsigned long sfsr, |
134 | unsigned long sfar); | 133 | unsigned long sfar); |
135 | extern void spitfire_access_error(struct pt_regs *regs, | 134 | void spitfire_access_error(struct pt_regs *regs, |
136 | unsigned long status_encoded, | 135 | unsigned long status_encoded, |
137 | unsigned long afar); | 136 | unsigned long afar); |
138 | 137 | ||
139 | extern void cheetah_fecc_handler(struct pt_regs *regs, | 138 | void cheetah_fecc_handler(struct pt_regs *regs, |
140 | unsigned long afsr, | 139 | unsigned long afsr, |
141 | unsigned long afar); | 140 | unsigned long afar); |
142 | extern void cheetah_cee_handler(struct pt_regs *regs, | 141 | void cheetah_cee_handler(struct pt_regs *regs, |
143 | unsigned long afsr, | 142 | unsigned long afsr, |
144 | unsigned long afar); | 143 | unsigned long afar); |
145 | extern void cheetah_deferred_handler(struct pt_regs *regs, | 144 | void cheetah_deferred_handler(struct pt_regs *regs, |
146 | unsigned long afsr, | 145 | unsigned long afsr, |
147 | unsigned long afar); | 146 | unsigned long afar); |
148 | extern void cheetah_plus_parity_error(int type, struct pt_regs *regs); | 147 | void cheetah_plus_parity_error(int type, struct pt_regs *regs); |
149 | 148 | ||
150 | extern void sun4v_insn_access_exception(struct pt_regs *regs, | 149 | void sun4v_insn_access_exception(struct pt_regs *regs, |
151 | unsigned long addr, | 150 | unsigned long addr, |
152 | unsigned long type_ctx); | 151 | unsigned long type_ctx); |
153 | extern void sun4v_insn_access_exception_tl1(struct pt_regs *regs, | 152 | void sun4v_insn_access_exception_tl1(struct pt_regs *regs, |
154 | unsigned long addr, | 153 | unsigned long addr, |
155 | unsigned long type_ctx); | 154 | unsigned long type_ctx); |
156 | extern void sun4v_data_access_exception(struct pt_regs *regs, | 155 | void sun4v_data_access_exception(struct pt_regs *regs, |
157 | unsigned long addr, | 156 | unsigned long addr, |
158 | unsigned long type_ctx); | 157 | unsigned long type_ctx); |
159 | extern void sun4v_data_access_exception_tl1(struct pt_regs *regs, | 158 | void sun4v_data_access_exception_tl1(struct pt_regs *regs, |
160 | unsigned long addr, | 159 | unsigned long addr, |
161 | unsigned long type_ctx); | 160 | unsigned long type_ctx); |
162 | extern void sun4v_resum_error(struct pt_regs *regs, | 161 | void sun4v_resum_error(struct pt_regs *regs, |
163 | unsigned long offset); | 162 | unsigned long offset); |
164 | extern void sun4v_resum_overflow(struct pt_regs *regs); | 163 | void sun4v_resum_overflow(struct pt_regs *regs); |
165 | extern void sun4v_nonresum_error(struct pt_regs *regs, | 164 | void sun4v_nonresum_error(struct pt_regs *regs, |
166 | unsigned long offset); | 165 | unsigned long offset); |
167 | extern void sun4v_nonresum_overflow(struct pt_regs *regs); | 166 | void sun4v_nonresum_overflow(struct pt_regs *regs); |
168 | 167 | ||
169 | extern unsigned long sun4v_err_itlb_vaddr; | 168 | extern unsigned long sun4v_err_itlb_vaddr; |
170 | extern unsigned long sun4v_err_itlb_ctx; | 169 | extern unsigned long sun4v_err_itlb_ctx; |
171 | extern unsigned long sun4v_err_itlb_pte; | 170 | extern unsigned long sun4v_err_itlb_pte; |
172 | extern unsigned long sun4v_err_itlb_error; | 171 | extern unsigned long sun4v_err_itlb_error; |
173 | 172 | ||
174 | extern void sun4v_itlb_error_report(struct pt_regs *regs, int tl); | 173 | void sun4v_itlb_error_report(struct pt_regs *regs, int tl); |
175 | 174 | ||
176 | extern unsigned long sun4v_err_dtlb_vaddr; | 175 | extern unsigned long sun4v_err_dtlb_vaddr; |
177 | extern unsigned long sun4v_err_dtlb_ctx; | 176 | extern unsigned long sun4v_err_dtlb_ctx; |
178 | extern unsigned long sun4v_err_dtlb_pte; | 177 | extern unsigned long sun4v_err_dtlb_pte; |
179 | extern unsigned long sun4v_err_dtlb_error; | 178 | extern unsigned long sun4v_err_dtlb_error; |
180 | 179 | ||
181 | extern void sun4v_dtlb_error_report(struct pt_regs *regs, int tl); | 180 | void sun4v_dtlb_error_report(struct pt_regs *regs, int tl); |
182 | extern void hypervisor_tlbop_error(unsigned long err, | 181 | void hypervisor_tlbop_error(unsigned long err, |
183 | unsigned long op); | 182 | unsigned long op); |
184 | extern void hypervisor_tlbop_error_xcall(unsigned long err, | 183 | void hypervisor_tlbop_error_xcall(unsigned long err, |
185 | unsigned long op); | 184 | unsigned long op); |
186 | 185 | ||
187 | /* WARNING: The error trap handlers in assembly know the precise | 186 | /* WARNING: The error trap handlers in assembly know the precise |
188 | * layout of the following structure. | 187 | * layout of the following structure. |
@@ -248,8 +247,8 @@ struct ino_bucket { | |||
248 | extern struct ino_bucket *ivector_table; | 247 | extern struct ino_bucket *ivector_table; |
249 | extern unsigned long ivector_table_pa; | 248 | extern unsigned long ivector_table_pa; |
250 | 249 | ||
251 | extern void init_irqwork_curcpu(void); | 250 | void init_irqwork_curcpu(void); |
252 | extern void sun4v_register_mondo_queues(int this_cpu); | 251 | void sun4v_register_mondo_queues(int this_cpu); |
253 | 252 | ||
254 | #endif /* CONFIG_SPARC32 */ | 253 | #endif /* CONFIG_SPARC32 */ |
255 | #endif /* _ENTRY_H */ | 254 | #endif /* _ENTRY_H */ |
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c index 76663b019eb5..bfa4d0c2df42 100644 --- a/arch/sparc/kernel/iommu.c +++ b/arch/sparc/kernel/iommu.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/iommu.h> | 21 | #include <asm/iommu.h> |
22 | 22 | ||
23 | #include "iommu_common.h" | 23 | #include "iommu_common.h" |
24 | #include "kernel.h" | ||
24 | 25 | ||
25 | #define STC_CTXMATCH_ADDR(STC, CTX) \ | 26 | #define STC_CTXMATCH_ADDR(STC, CTX) \ |
26 | ((STC)->strbuf_ctxmatch_base + ((CTX) << 3)) | 27 | ((STC)->strbuf_ctxmatch_base + ((CTX) << 3)) |
@@ -840,8 +841,6 @@ static struct dma_map_ops sun4u_dma_ops = { | |||
840 | struct dma_map_ops *dma_ops = &sun4u_dma_ops; | 841 | struct dma_map_ops *dma_ops = &sun4u_dma_ops; |
841 | EXPORT_SYMBOL(dma_ops); | 842 | EXPORT_SYMBOL(dma_ops); |
842 | 843 | ||
843 | extern int pci64_dma_supported(struct pci_dev *pdev, u64 device_mask); | ||
844 | |||
845 | int dma_supported(struct device *dev, u64 device_mask) | 844 | int dma_supported(struct device *dev, u64 device_mask) |
846 | { | 845 | { |
847 | struct iommu *iommu = dev->archdata.iommu; | 846 | struct iommu *iommu = dev->archdata.iommu; |
diff --git a/arch/sparc/kernel/iommu_common.h b/arch/sparc/kernel/iommu_common.h index 591f5879039c..1ec0de4156e7 100644 --- a/arch/sparc/kernel/iommu_common.h +++ b/arch/sparc/kernel/iommu_common.h | |||
@@ -48,12 +48,12 @@ static inline int is_span_boundary(unsigned long entry, | |||
48 | return iommu_is_span_boundary(entry, nr, shift, boundary_size); | 48 | return iommu_is_span_boundary(entry, nr, shift, boundary_size); |
49 | } | 49 | } |
50 | 50 | ||
51 | extern unsigned long iommu_range_alloc(struct device *dev, | 51 | unsigned long iommu_range_alloc(struct device *dev, |
52 | struct iommu *iommu, | 52 | struct iommu *iommu, |
53 | unsigned long npages, | 53 | unsigned long npages, |
54 | unsigned long *handle); | 54 | unsigned long *handle); |
55 | extern void iommu_range_free(struct iommu *iommu, | 55 | void iommu_range_free(struct iommu *iommu, |
56 | dma_addr_t dma_addr, | 56 | dma_addr_t dma_addr, |
57 | unsigned long npages); | 57 | unsigned long npages); |
58 | 58 | ||
59 | #endif /* _IOMMU_COMMON_H */ | 59 | #endif /* _IOMMU_COMMON_H */ |
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index e7e215dfa866..7f08ec8a7c68 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -186,7 +186,7 @@ static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys, | |||
186 | 186 | ||
187 | if (name == NULL) name = "???"; | 187 | if (name == NULL) name = "???"; |
188 | 188 | ||
189 | if ((xres = xres_alloc()) != 0) { | 189 | if ((xres = xres_alloc()) != NULL) { |
190 | tack = xres->xname; | 190 | tack = xres->xname; |
191 | res = &xres->xres; | 191 | res = &xres->xres; |
192 | } else { | 192 | } else { |
@@ -400,7 +400,7 @@ static void sbus_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | |||
400 | BUG(); | 400 | BUG(); |
401 | } | 401 | } |
402 | 402 | ||
403 | struct dma_map_ops sbus_dma_ops = { | 403 | static struct dma_map_ops sbus_dma_ops = { |
404 | .alloc = sbus_alloc_coherent, | 404 | .alloc = sbus_alloc_coherent, |
405 | .free = sbus_free_coherent, | 405 | .free = sbus_free_coherent, |
406 | .map_page = sbus_map_page, | 406 | .map_page = sbus_map_page, |
@@ -681,7 +681,7 @@ static int sparc_io_proc_show(struct seq_file *m, void *v) | |||
681 | const char *nm; | 681 | const char *nm; |
682 | 682 | ||
683 | for (r = root->child; r != NULL; r = r->sibling) { | 683 | for (r = root->child; r != NULL; r = r->sibling) { |
684 | if ((nm = r->name) == 0) nm = "???"; | 684 | if ((nm = r->name) == NULL) nm = "???"; |
685 | seq_printf(m, "%016llx-%016llx: %s\n", | 685 | seq_printf(m, "%016llx-%016llx: %s\n", |
686 | (unsigned long long)r->start, | 686 | (unsigned long long)r->start, |
687 | (unsigned long long)r->end, nm); | 687 | (unsigned long long)r->end, nm); |
diff --git a/arch/sparc/kernel/irq.h b/arch/sparc/kernel/irq.h index b66b6aad1d6d..70a0b8ddd0ba 100644 --- a/arch/sparc/kernel/irq.h +++ b/arch/sparc/kernel/irq.h | |||
@@ -82,11 +82,20 @@ void handler_irq(unsigned int pil, struct pt_regs *regs); | |||
82 | 82 | ||
83 | unsigned long leon_get_irqmask(unsigned int irq); | 83 | unsigned long leon_get_irqmask(unsigned int irq); |
84 | 84 | ||
85 | /* irq_32.c */ | ||
86 | void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs); | ||
87 | |||
88 | /* sun4m_irq.c */ | ||
89 | void sun4m_nmi(struct pt_regs *regs); | ||
90 | |||
91 | /* sun4d_irq.c */ | ||
92 | void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs); | ||
93 | |||
85 | #ifdef CONFIG_SMP | 94 | #ifdef CONFIG_SMP |
86 | 95 | ||
87 | /* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */ | 96 | /* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */ |
88 | #define SUN4D_IPI_IRQ 13 | 97 | #define SUN4D_IPI_IRQ 13 |
89 | 98 | ||
90 | extern void sun4d_ipi_interrupt(void); | 99 | void sun4d_ipi_interrupt(void); |
91 | 100 | ||
92 | #endif | 101 | #endif |
diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c index c145f6fd123b..a979e99f8751 100644 --- a/arch/sparc/kernel/irq_32.c +++ b/arch/sparc/kernel/irq_32.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
19 | #include <asm/cpudata.h> | 19 | #include <asm/cpudata.h> |
20 | #include <asm/setup.h> | ||
20 | #include <asm/pcic.h> | 21 | #include <asm/pcic.h> |
21 | #include <asm/leon.h> | 22 | #include <asm/leon.h> |
22 | 23 | ||
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index a702d9ab019c..e7f652be9e61 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __SPARC_KERNEL_H | 2 | #define __SPARC_KERNEL_H |
3 | 3 | ||
4 | #include <linux/interrupt.h> | 4 | #include <linux/interrupt.h> |
5 | #include <linux/ftrace.h> | ||
5 | 6 | ||
6 | #include <asm/traps.h> | 7 | #include <asm/traps.h> |
7 | #include <asm/head.h> | 8 | #include <asm/head.h> |
@@ -15,62 +16,111 @@ extern int ncpus_probed; | |||
15 | #ifdef CONFIG_SPARC64 | 16 | #ifdef CONFIG_SPARC64 |
16 | /* setup_64.c */ | 17 | /* setup_64.c */ |
17 | struct seq_file; | 18 | struct seq_file; |
18 | extern void cpucap_info(struct seq_file *); | 19 | void cpucap_info(struct seq_file *); |
19 | 20 | ||
20 | static inline unsigned long kimage_addr_to_ra(const char *p) | 21 | static inline unsigned long kimage_addr_to_ra(const void *p) |
21 | { | 22 | { |
22 | unsigned long val = (unsigned long) p; | 23 | unsigned long val = (unsigned long) p; |
23 | 24 | ||
24 | return kern_base + (val - KERNBASE); | 25 | return kern_base + (val - KERNBASE); |
25 | } | 26 | } |
27 | |||
28 | /* sys_sparc_64.c */ | ||
29 | asmlinkage long sys_kern_features(void); | ||
30 | |||
31 | /* unaligned_64.c */ | ||
32 | asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn); | ||
33 | int handle_popc(u32 insn, struct pt_regs *regs); | ||
34 | void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr); | ||
35 | void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr); | ||
36 | |||
37 | /* smp_64.c */ | ||
38 | void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs); | ||
39 | void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs); | ||
40 | void __irq_entry smp_new_mmu_context_version_client(int irq, struct pt_regs *regs); | ||
41 | void __irq_entry smp_penguin_jailcell(int irq, struct pt_regs *regs); | ||
42 | void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs); | ||
43 | |||
44 | /* kgdb_64.c */ | ||
45 | void __irq_entry smp_kgdb_capture_client(int irq, struct pt_regs *regs); | ||
46 | |||
47 | /* pci.c */ | ||
48 | int pci64_dma_supported(struct pci_dev *pdev, u64 device_mask); | ||
49 | |||
50 | /* signal32.c */ | ||
51 | void do_sigreturn32(struct pt_regs *regs); | ||
52 | asmlinkage void do_rt_sigreturn32(struct pt_regs *regs); | ||
53 | void do_signal32(struct pt_regs * regs); | ||
54 | asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp); | ||
55 | |||
56 | /* compat_audit.c */ | ||
57 | extern unsigned sparc32_dir_class[]; | ||
58 | extern unsigned sparc32_chattr_class[]; | ||
59 | extern unsigned sparc32_write_class[]; | ||
60 | extern unsigned sparc32_read_class[]; | ||
61 | extern unsigned sparc32_signal_class[]; | ||
62 | int sparc32_classify_syscall(unsigned syscall); | ||
26 | #endif | 63 | #endif |
27 | 64 | ||
28 | #ifdef CONFIG_SPARC32 | 65 | #ifdef CONFIG_SPARC32 |
29 | /* setup_32.c */ | 66 | /* setup_32.c */ |
67 | struct linux_romvec; | ||
30 | void sparc32_start_kernel(struct linux_romvec *rp); | 68 | void sparc32_start_kernel(struct linux_romvec *rp); |
31 | 69 | ||
32 | /* cpu.c */ | 70 | /* cpu.c */ |
33 | extern void cpu_probe(void); | 71 | void cpu_probe(void); |
34 | 72 | ||
35 | /* traps_32.c */ | 73 | /* traps_32.c */ |
36 | extern void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, | 74 | void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, |
37 | unsigned long npc, unsigned long psr); | 75 | unsigned long npc, unsigned long psr); |
38 | /* irq_32.c */ | 76 | /* irq_32.c */ |
39 | extern struct irqaction static_irqaction[]; | 77 | extern struct irqaction static_irqaction[]; |
40 | extern int static_irq_count; | 78 | extern int static_irq_count; |
41 | extern spinlock_t irq_action_lock; | 79 | extern spinlock_t irq_action_lock; |
42 | 80 | ||
43 | extern void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs); | 81 | void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs); |
44 | extern void init_IRQ(void); | 82 | void init_IRQ(void); |
45 | 83 | ||
46 | /* sun4m_irq.c */ | 84 | /* sun4m_irq.c */ |
47 | extern void sun4m_init_IRQ(void); | 85 | void sun4m_init_IRQ(void); |
48 | extern void sun4m_unmask_profile_irq(void); | 86 | void sun4m_unmask_profile_irq(void); |
49 | extern void sun4m_clear_profile_irq(int cpu); | 87 | void sun4m_clear_profile_irq(int cpu); |
50 | 88 | ||
51 | /* sun4m_smp.c */ | 89 | /* sun4m_smp.c */ |
52 | void sun4m_cpu_pre_starting(void *arg); | 90 | void sun4m_cpu_pre_starting(void *arg); |
53 | void sun4m_cpu_pre_online(void *arg); | 91 | void sun4m_cpu_pre_online(void *arg); |
92 | void __init smp4m_boot_cpus(void); | ||
93 | int smp4m_boot_one_cpu(int i, struct task_struct *idle); | ||
94 | void __init smp4m_smp_done(void); | ||
95 | void smp4m_cross_call_irq(void); | ||
96 | void smp4m_percpu_timer_interrupt(struct pt_regs *regs); | ||
54 | 97 | ||
55 | /* sun4d_irq.c */ | 98 | /* sun4d_irq.c */ |
56 | extern spinlock_t sun4d_imsk_lock; | 99 | extern spinlock_t sun4d_imsk_lock; |
57 | 100 | ||
58 | extern void sun4d_init_IRQ(void); | 101 | void sun4d_init_IRQ(void); |
59 | extern int sun4d_request_irq(unsigned int irq, | 102 | int sun4d_request_irq(unsigned int irq, |
60 | irq_handler_t handler, | 103 | irq_handler_t handler, |
61 | unsigned long irqflags, | 104 | unsigned long irqflags, |
62 | const char *devname, void *dev_id); | 105 | const char *devname, void *dev_id); |
63 | extern int show_sun4d_interrupts(struct seq_file *, void *); | 106 | int show_sun4d_interrupts(struct seq_file *, void *); |
64 | extern void sun4d_distribute_irqs(void); | 107 | void sun4d_distribute_irqs(void); |
65 | extern void sun4d_free_irq(unsigned int irq, void *dev_id); | 108 | void sun4d_free_irq(unsigned int irq, void *dev_id); |
66 | 109 | ||
67 | /* sun4d_smp.c */ | 110 | /* sun4d_smp.c */ |
68 | void sun4d_cpu_pre_starting(void *arg); | 111 | void sun4d_cpu_pre_starting(void *arg); |
69 | void sun4d_cpu_pre_online(void *arg); | 112 | void sun4d_cpu_pre_online(void *arg); |
113 | void __init smp4d_boot_cpus(void); | ||
114 | int smp4d_boot_one_cpu(int i, struct task_struct *idle); | ||
115 | void __init smp4d_smp_done(void); | ||
116 | void smp4d_cross_call_irq(void); | ||
117 | void smp4d_percpu_timer_interrupt(struct pt_regs *regs); | ||
70 | 118 | ||
71 | /* leon_smp.c */ | 119 | /* leon_smp.c */ |
72 | void leon_cpu_pre_starting(void *arg); | 120 | void leon_cpu_pre_starting(void *arg); |
73 | void leon_cpu_pre_online(void *arg); | 121 | void leon_cpu_pre_online(void *arg); |
122 | void leonsmp_ipi_interrupt(void); | ||
123 | void leon_cross_call_irq(void); | ||
74 | 124 | ||
75 | /* head_32.S */ | 125 | /* head_32.S */ |
76 | extern unsigned int t_nmi[]; | 126 | extern unsigned int t_nmi[]; |
@@ -89,12 +139,48 @@ extern unsigned int real_irq_entry[]; | |||
89 | extern unsigned int smp4d_ticker[]; | 139 | extern unsigned int smp4d_ticker[]; |
90 | extern unsigned int patchme_maybe_smp_msg[]; | 140 | extern unsigned int patchme_maybe_smp_msg[]; |
91 | 141 | ||
92 | extern void floppy_hardint(void); | 142 | void floppy_hardint(void); |
93 | 143 | ||
94 | /* trampoline_32.S */ | 144 | /* trampoline_32.S */ |
95 | extern unsigned long sun4m_cpu_startup; | 145 | extern unsigned long sun4m_cpu_startup; |
96 | extern unsigned long sun4d_cpu_startup; | 146 | extern unsigned long sun4d_cpu_startup; |
97 | 147 | ||
148 | /* process_32.c */ | ||
149 | asmlinkage int sparc_do_fork(unsigned long clone_flags, | ||
150 | unsigned long stack_start, | ||
151 | struct pt_regs *regs, | ||
152 | unsigned long stack_size); | ||
153 | |||
154 | /* signal_32.c */ | ||
155 | asmlinkage void do_sigreturn(struct pt_regs *regs); | ||
156 | asmlinkage void do_rt_sigreturn(struct pt_regs *regs); | ||
157 | void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, | ||
158 | unsigned long thread_info_flags); | ||
159 | asmlinkage int do_sys_sigstack(struct sigstack __user *ssptr, | ||
160 | struct sigstack __user *ossptr, | ||
161 | unsigned long sp); | ||
162 | |||
163 | /* ptrace_32.c */ | ||
164 | asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p); | ||
165 | |||
166 | /* unaligned_32.c */ | ||
167 | asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn); | ||
168 | asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn); | ||
169 | |||
170 | /* windows.c */ | ||
171 | void try_to_clear_window_buffer(struct pt_regs *regs, int who); | ||
172 | |||
173 | /* auxio_32.c */ | ||
174 | void __init auxio_probe(void); | ||
175 | void __init auxio_power_probe(void); | ||
176 | |||
177 | /* pcic.c */ | ||
178 | extern void __iomem *pcic_regs; | ||
179 | void pcic_nmi(unsigned int pend, struct pt_regs *regs); | ||
180 | |||
181 | /* time_32.c */ | ||
182 | void __init time_init(void); | ||
183 | |||
98 | #else /* CONFIG_SPARC32 */ | 184 | #else /* CONFIG_SPARC32 */ |
99 | #endif /* CONFIG_SPARC32 */ | 185 | #endif /* CONFIG_SPARC32 */ |
100 | #endif /* !(__SPARC_KERNEL_H) */ | 186 | #endif /* !(__SPARC_KERNEL_H) */ |
diff --git a/arch/sparc/kernel/kgdb_64.c b/arch/sparc/kernel/kgdb_64.c index b45fe3fb4d2c..cbf21d0870e0 100644 --- a/arch/sparc/kernel/kgdb_64.c +++ b/arch/sparc/kernel/kgdb_64.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <asm/ptrace.h> | 13 | #include <asm/ptrace.h> |
14 | #include <asm/irq.h> | 14 | #include <asm/irq.h> |
15 | 15 | ||
16 | #include "kernel.h" | ||
17 | |||
16 | void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) | 18 | void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) |
17 | { | 19 | { |
18 | struct reg_window *win; | 20 | struct reg_window *win; |
diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c index 1b0973503197..98d712843413 100644 --- a/arch/sparc/kernel/kprobes.c +++ b/arch/sparc/kernel/kprobes.c | |||
@@ -512,7 +512,8 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, | |||
512 | /* | 512 | /* |
513 | * Called when the probe at kretprobe trampoline is hit | 513 | * Called when the probe at kretprobe trampoline is hit |
514 | */ | 514 | */ |
515 | int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | 515 | static int __kprobes trampoline_probe_handler(struct kprobe *p, |
516 | struct pt_regs *regs) | ||
516 | { | 517 | { |
517 | struct kretprobe_instance *ri = NULL; | 518 | struct kretprobe_instance *ri = NULL; |
518 | struct hlist_head *head, empty_rp; | 519 | struct hlist_head *head, empty_rp; |
@@ -576,7 +577,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
576 | return 1; | 577 | return 1; |
577 | } | 578 | } |
578 | 579 | ||
579 | void kretprobe_trampoline_holder(void) | 580 | static void __used kretprobe_trampoline_holder(void) |
580 | { | 581 | { |
581 | asm volatile(".global kretprobe_trampoline\n" | 582 | asm volatile(".global kretprobe_trampoline\n" |
582 | "kretprobe_trampoline:\n" | 583 | "kretprobe_trampoline:\n" |
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c index b7c68976cbc7..683c4af999de 100644 --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c | |||
@@ -32,12 +32,12 @@ struct leon3_gptimer_regs_map *leon3_gptimer_regs; /* timer controller base addr | |||
32 | 32 | ||
33 | int leondebug_irq_disable; | 33 | int leondebug_irq_disable; |
34 | int leon_debug_irqout; | 34 | int leon_debug_irqout; |
35 | static int dummy_master_l10_counter; | 35 | static volatile u32 dummy_master_l10_counter; |
36 | unsigned long amba_system_id; | 36 | unsigned long amba_system_id; |
37 | static DEFINE_SPINLOCK(leon_irq_lock); | 37 | static DEFINE_SPINLOCK(leon_irq_lock); |
38 | 38 | ||
39 | static unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */ | ||
39 | unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ | 40 | unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ |
40 | unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */ | ||
41 | unsigned int sparc_leon_eirq; | 41 | unsigned int sparc_leon_eirq; |
42 | #define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu]) | 42 | #define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu]) |
43 | #define LEON_IACK (&leon3_irqctrl_regs->iclear) | 43 | #define LEON_IACK (&leon3_irqctrl_regs->iclear) |
@@ -65,7 +65,7 @@ static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc) | |||
65 | } | 65 | } |
66 | 66 | ||
67 | /* The extended IRQ controller has been found, this function registers it */ | 67 | /* The extended IRQ controller has been found, this function registers it */ |
68 | void leon_eirq_setup(unsigned int eirq) | 68 | static void leon_eirq_setup(unsigned int eirq) |
69 | { | 69 | { |
70 | unsigned long mask, oldmask; | 70 | unsigned long mask, oldmask; |
71 | unsigned int veirq; | 71 | unsigned int veirq; |
@@ -270,7 +270,7 @@ static u32 leon_cycles_offset(void) | |||
270 | #ifdef CONFIG_SMP | 270 | #ifdef CONFIG_SMP |
271 | 271 | ||
272 | /* smp clockevent irq */ | 272 | /* smp clockevent irq */ |
273 | irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused) | 273 | static irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused) |
274 | { | 274 | { |
275 | struct clock_event_device *ce; | 275 | struct clock_event_device *ce; |
276 | int cpu = smp_processor_id(); | 276 | int cpu = smp_processor_id(); |
@@ -313,7 +313,7 @@ void __init leon_init_timers(void) | |||
313 | 313 | ||
314 | leondebug_irq_disable = 0; | 314 | leondebug_irq_disable = 0; |
315 | leon_debug_irqout = 0; | 315 | leon_debug_irqout = 0; |
316 | master_l10_counter = (unsigned int *)&dummy_master_l10_counter; | 316 | master_l10_counter = (u32 __iomem *)&dummy_master_l10_counter; |
317 | dummy_master_l10_counter = 0; | 317 | dummy_master_l10_counter = 0; |
318 | 318 | ||
319 | rootnp = of_find_node_by_path("/ambapp0"); | 319 | rootnp = of_find_node_by_path("/ambapp0"); |
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c index e16c4157e1ae..899b7203a4e4 100644 --- a/arch/sparc/kernel/leon_pci.c +++ b/arch/sparc/kernel/leon_pci.c | |||
@@ -98,82 +98,3 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, | |||
98 | { | 98 | { |
99 | return res->start; | 99 | return res->start; |
100 | } | 100 | } |
101 | |||
102 | /* in/out routines taken from pcic.c | ||
103 | * | ||
104 | * This probably belongs here rather than ioport.c because | ||
105 | * we do not want this crud linked into SBus kernels. | ||
106 | * Also, think for a moment about likes of floppy.c that | ||
107 | * include architecture specific parts. They may want to redefine ins/outs. | ||
108 | * | ||
109 | * We do not use horrible macros here because we want to | ||
110 | * advance pointer by sizeof(size). | ||
111 | */ | ||
112 | void outsb(unsigned long addr, const void *src, unsigned long count) | ||
113 | { | ||
114 | while (count) { | ||
115 | count -= 1; | ||
116 | outb(*(const char *)src, addr); | ||
117 | src += 1; | ||
118 | /* addr += 1; */ | ||
119 | } | ||
120 | } | ||
121 | EXPORT_SYMBOL(outsb); | ||
122 | |||
123 | void outsw(unsigned long addr, const void *src, unsigned long count) | ||
124 | { | ||
125 | while (count) { | ||
126 | count -= 2; | ||
127 | outw(*(const short *)src, addr); | ||
128 | src += 2; | ||
129 | /* addr += 2; */ | ||
130 | } | ||
131 | } | ||
132 | EXPORT_SYMBOL(outsw); | ||
133 | |||
134 | void outsl(unsigned long addr, const void *src, unsigned long count) | ||
135 | { | ||
136 | while (count) { | ||
137 | count -= 4; | ||
138 | outl(*(const long *)src, addr); | ||
139 | src += 4; | ||
140 | /* addr += 4; */ | ||
141 | } | ||
142 | } | ||
143 | EXPORT_SYMBOL(outsl); | ||
144 | |||
145 | void insb(unsigned long addr, void *dst, unsigned long count) | ||
146 | { | ||
147 | while (count) { | ||
148 | count -= 1; | ||
149 | *(unsigned char *)dst = inb(addr); | ||
150 | dst += 1; | ||
151 | /* addr += 1; */ | ||
152 | } | ||
153 | } | ||
154 | EXPORT_SYMBOL(insb); | ||
155 | |||
156 | void insw(unsigned long addr, void *dst, unsigned long count) | ||
157 | { | ||
158 | while (count) { | ||
159 | count -= 2; | ||
160 | *(unsigned short *)dst = inw(addr); | ||
161 | dst += 2; | ||
162 | /* addr += 2; */ | ||
163 | } | ||
164 | } | ||
165 | EXPORT_SYMBOL(insw); | ||
166 | |||
167 | void insl(unsigned long addr, void *dst, unsigned long count) | ||
168 | { | ||
169 | while (count) { | ||
170 | count -= 4; | ||
171 | /* | ||
172 | * XXX I am sure we are in for an unaligned trap here. | ||
173 | */ | ||
174 | *(unsigned long *)dst = inl(addr); | ||
175 | dst += 4; | ||
176 | /* addr += 4; */ | ||
177 | } | ||
178 | } | ||
179 | EXPORT_SYMBOL(insl); | ||
diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c index 6df26e37f879..c8bf26edfa7c 100644 --- a/arch/sparc/kernel/leon_pci_grpci1.c +++ b/arch/sparc/kernel/leon_pci_grpci1.c | |||
@@ -80,7 +80,7 @@ struct grpci1_regs { | |||
80 | 80 | ||
81 | struct grpci1_priv { | 81 | struct grpci1_priv { |
82 | struct leon_pci_info info; /* must be on top of this structure */ | 82 | struct leon_pci_info info; /* must be on top of this structure */ |
83 | struct grpci1_regs *regs; /* GRPCI register map */ | 83 | struct grpci1_regs __iomem *regs; /* GRPCI register map */ |
84 | struct device *dev; | 84 | struct device *dev; |
85 | int pci_err_mask; /* STATUS register error mask */ | 85 | int pci_err_mask; /* STATUS register error mask */ |
86 | int irq; /* LEON irqctrl GRPCI IRQ */ | 86 | int irq; /* LEON irqctrl GRPCI IRQ */ |
@@ -101,7 +101,7 @@ static struct grpci1_priv *grpci1priv; | |||
101 | static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus, | 101 | static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus, |
102 | unsigned int devfn, int where, u32 val); | 102 | unsigned int devfn, int where, u32 val); |
103 | 103 | ||
104 | int grpci1_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 104 | static int grpci1_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
105 | { | 105 | { |
106 | struct grpci1_priv *priv = dev->bus->sysdata; | 106 | struct grpci1_priv *priv = dev->bus->sysdata; |
107 | int irq_group; | 107 | int irq_group; |
@@ -144,7 +144,7 @@ static int grpci1_cfg_r32(struct grpci1_priv *priv, unsigned int bus, | |||
144 | grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, tmp); | 144 | grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, tmp); |
145 | } else { | 145 | } else { |
146 | /* Bus always little endian (unaffected by byte-swapping) */ | 146 | /* Bus always little endian (unaffected by byte-swapping) */ |
147 | *val = flip_dword(tmp); | 147 | *val = swab32(tmp); |
148 | } | 148 | } |
149 | 149 | ||
150 | return 0; | 150 | return 0; |
@@ -197,7 +197,7 @@ static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus, | |||
197 | 197 | ||
198 | pci_conf = (unsigned int *) (priv->pci_conf | | 198 | pci_conf = (unsigned int *) (priv->pci_conf | |
199 | (devfn << 8) | (where & 0xfc)); | 199 | (devfn << 8) | (where & 0xfc)); |
200 | LEON3_BYPASS_STORE_PA(pci_conf, flip_dword(val)); | 200 | LEON3_BYPASS_STORE_PA(pci_conf, swab32(val)); |
201 | 201 | ||
202 | return 0; | 202 | return 0; |
203 | } | 203 | } |
@@ -417,10 +417,10 @@ out: | |||
417 | * BAR1: peripheral DMA to host's memory (size at least 256MByte) | 417 | * BAR1: peripheral DMA to host's memory (size at least 256MByte) |
418 | * BAR2..BAR5: not implemented in hardware | 418 | * BAR2..BAR5: not implemented in hardware |
419 | */ | 419 | */ |
420 | void grpci1_hw_init(struct grpci1_priv *priv) | 420 | static void grpci1_hw_init(struct grpci1_priv *priv) |
421 | { | 421 | { |
422 | u32 ahbadr, bar_sz, data, pciadr; | 422 | u32 ahbadr, bar_sz, data, pciadr; |
423 | struct grpci1_regs *regs = priv->regs; | 423 | struct grpci1_regs __iomem *regs = priv->regs; |
424 | 424 | ||
425 | /* set 1:1 mapping between AHB -> PCI memory space */ | 425 | /* set 1:1 mapping between AHB -> PCI memory space */ |
426 | REGSTORE(regs->cfg_stat, priv->pci_area & 0xf0000000); | 426 | REGSTORE(regs->cfg_stat, priv->pci_area & 0xf0000000); |
@@ -509,7 +509,7 @@ static irqreturn_t grpci1_err_interrupt(int irq, void *arg) | |||
509 | 509 | ||
510 | static int grpci1_of_probe(struct platform_device *ofdev) | 510 | static int grpci1_of_probe(struct platform_device *ofdev) |
511 | { | 511 | { |
512 | struct grpci1_regs *regs; | 512 | struct grpci1_regs __iomem *regs; |
513 | struct grpci1_priv *priv; | 513 | struct grpci1_priv *priv; |
514 | int err, len; | 514 | int err, len; |
515 | const int *tmp; | 515 | const int *tmp; |
@@ -690,7 +690,7 @@ err3: | |||
690 | err2: | 690 | err2: |
691 | release_resource(&priv->info.mem_space); | 691 | release_resource(&priv->info.mem_space); |
692 | err1: | 692 | err1: |
693 | iounmap((void *)priv->pci_io_va); | 693 | iounmap((void __iomem *)priv->pci_io_va); |
694 | grpci1priv = NULL; | 694 | grpci1priv = NULL; |
695 | return err; | 695 | return err; |
696 | } | 696 | } |
diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_pci_grpci2.c index 24d6a4446349..e433a4d69fe0 100644 --- a/arch/sparc/kernel/leon_pci_grpci2.c +++ b/arch/sparc/kernel/leon_pci_grpci2.c | |||
@@ -191,7 +191,7 @@ struct grpci2_cap_first { | |||
191 | 191 | ||
192 | struct grpci2_priv { | 192 | struct grpci2_priv { |
193 | struct leon_pci_info info; /* must be on top of this structure */ | 193 | struct leon_pci_info info; /* must be on top of this structure */ |
194 | struct grpci2_regs *regs; | 194 | struct grpci2_regs __iomem *regs; |
195 | char irq; | 195 | char irq; |
196 | char irq_mode; /* IRQ Mode from CAPSTS REG */ | 196 | char irq_mode; /* IRQ Mode from CAPSTS REG */ |
197 | char bt_enabled; | 197 | char bt_enabled; |
@@ -215,10 +215,10 @@ struct grpci2_priv { | |||
215 | struct grpci2_barcfg tgtbars[6]; | 215 | struct grpci2_barcfg tgtbars[6]; |
216 | }; | 216 | }; |
217 | 217 | ||
218 | DEFINE_SPINLOCK(grpci2_dev_lock); | 218 | static DEFINE_SPINLOCK(grpci2_dev_lock); |
219 | struct grpci2_priv *grpci2priv; | 219 | static struct grpci2_priv *grpci2priv; |
220 | 220 | ||
221 | int grpci2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 221 | static int grpci2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
222 | { | 222 | { |
223 | struct grpci2_priv *priv = dev->bus->sysdata; | 223 | struct grpci2_priv *priv = dev->bus->sysdata; |
224 | int irq_group; | 224 | int irq_group; |
@@ -270,7 +270,7 @@ static int grpci2_cfg_r32(struct grpci2_priv *priv, unsigned int bus, | |||
270 | *val = 0xffffffff; | 270 | *val = 0xffffffff; |
271 | } else { | 271 | } else { |
272 | /* Bus always little endian (unaffected by byte-swapping) */ | 272 | /* Bus always little endian (unaffected by byte-swapping) */ |
273 | *val = flip_dword(tmp); | 273 | *val = swab32(tmp); |
274 | } | 274 | } |
275 | 275 | ||
276 | return 0; | 276 | return 0; |
@@ -328,7 +328,7 @@ static int grpci2_cfg_w32(struct grpci2_priv *priv, unsigned int bus, | |||
328 | 328 | ||
329 | pci_conf = (unsigned int *) (priv->pci_conf | | 329 | pci_conf = (unsigned int *) (priv->pci_conf | |
330 | (devfn << 8) | (where & 0xfc)); | 330 | (devfn << 8) | (where & 0xfc)); |
331 | LEON3_BYPASS_STORE_PA(pci_conf, flip_dword(val)); | 331 | LEON3_BYPASS_STORE_PA(pci_conf, swab32(val)); |
332 | 332 | ||
333 | /* Wait until GRPCI2 signals that CFG access is done, it should be | 333 | /* Wait until GRPCI2 signals that CFG access is done, it should be |
334 | * done instantaneously unless a DMA operation is ongoing... | 334 | * done instantaneously unless a DMA operation is ongoing... |
@@ -561,10 +561,10 @@ out: | |||
561 | return virq; | 561 | return virq; |
562 | } | 562 | } |
563 | 563 | ||
564 | void grpci2_hw_init(struct grpci2_priv *priv) | 564 | static void grpci2_hw_init(struct grpci2_priv *priv) |
565 | { | 565 | { |
566 | u32 ahbadr, pciadr, bar_sz, capptr, io_map, data; | 566 | u32 ahbadr, pciadr, bar_sz, capptr, io_map, data; |
567 | struct grpci2_regs *regs = priv->regs; | 567 | struct grpci2_regs __iomem *regs = priv->regs; |
568 | int i; | 568 | int i; |
569 | struct grpci2_barcfg *barcfg = priv->tgtbars; | 569 | struct grpci2_barcfg *barcfg = priv->tgtbars; |
570 | 570 | ||
@@ -655,7 +655,7 @@ static irqreturn_t grpci2_jump_interrupt(int irq, void *arg) | |||
655 | static irqreturn_t grpci2_err_interrupt(int irq, void *arg) | 655 | static irqreturn_t grpci2_err_interrupt(int irq, void *arg) |
656 | { | 656 | { |
657 | struct grpci2_priv *priv = arg; | 657 | struct grpci2_priv *priv = arg; |
658 | struct grpci2_regs *regs = priv->regs; | 658 | struct grpci2_regs __iomem *regs = priv->regs; |
659 | unsigned int status; | 659 | unsigned int status; |
660 | 660 | ||
661 | status = REGLOAD(regs->sts_cap); | 661 | status = REGLOAD(regs->sts_cap); |
@@ -682,7 +682,7 @@ static irqreturn_t grpci2_err_interrupt(int irq, void *arg) | |||
682 | 682 | ||
683 | static int grpci2_of_probe(struct platform_device *ofdev) | 683 | static int grpci2_of_probe(struct platform_device *ofdev) |
684 | { | 684 | { |
685 | struct grpci2_regs *regs; | 685 | struct grpci2_regs __iomem *regs; |
686 | struct grpci2_priv *priv; | 686 | struct grpci2_priv *priv; |
687 | int err, i, len; | 687 | int err, i, len; |
688 | const int *tmp; | 688 | const int *tmp; |
@@ -878,7 +878,7 @@ err4: | |||
878 | release_resource(&priv->info.mem_space); | 878 | release_resource(&priv->info.mem_space); |
879 | err3: | 879 | err3: |
880 | err = -ENOMEM; | 880 | err = -ENOMEM; |
881 | iounmap((void *)priv->pci_io_va); | 881 | iounmap((void __iomem *)priv->pci_io_va); |
882 | err2: | 882 | err2: |
883 | kfree(priv); | 883 | kfree(priv); |
884 | err1: | 884 | err1: |
diff --git a/arch/sparc/kernel/leon_pmc.c b/arch/sparc/kernel/leon_pmc.c index b0b3967a2dd2..ddcf950282ed 100644 --- a/arch/sparc/kernel/leon_pmc.c +++ b/arch/sparc/kernel/leon_pmc.c | |||
@@ -12,14 +12,14 @@ | |||
12 | #include <asm/processor.h> | 12 | #include <asm/processor.h> |
13 | 13 | ||
14 | /* List of Systems that need fixup instructions around power-down instruction */ | 14 | /* List of Systems that need fixup instructions around power-down instruction */ |
15 | unsigned int pmc_leon_fixup_ids[] = { | 15 | static unsigned int pmc_leon_fixup_ids[] = { |
16 | AEROFLEX_UT699, | 16 | AEROFLEX_UT699, |
17 | GAISLER_GR712RC, | 17 | GAISLER_GR712RC, |
18 | LEON4_NEXTREME1, | 18 | LEON4_NEXTREME1, |
19 | 0 | 19 | 0 |
20 | }; | 20 | }; |
21 | 21 | ||
22 | int pmc_leon_need_fixup(void) | 22 | static int pmc_leon_need_fixup(void) |
23 | { | 23 | { |
24 | unsigned int systemid = amba_system_id >> 16; | 24 | unsigned int systemid = amba_system_id >> 16; |
25 | unsigned int *id; | 25 | unsigned int *id; |
@@ -38,7 +38,7 @@ int pmc_leon_need_fixup(void) | |||
38 | * CPU idle callback function for systems that need some extra handling | 38 | * CPU idle callback function for systems that need some extra handling |
39 | * See .../arch/sparc/kernel/process.c | 39 | * See .../arch/sparc/kernel/process.c |
40 | */ | 40 | */ |
41 | void pmc_leon_idle_fixup(void) | 41 | static void pmc_leon_idle_fixup(void) |
42 | { | 42 | { |
43 | /* Prepare an address to a non-cachable region. APB is always | 43 | /* Prepare an address to a non-cachable region. APB is always |
44 | * none-cachable. One instruction is executed after the Sleep | 44 | * none-cachable. One instruction is executed after the Sleep |
@@ -62,7 +62,7 @@ void pmc_leon_idle_fixup(void) | |||
62 | * CPU idle callback function | 62 | * CPU idle callback function |
63 | * See .../arch/sparc/kernel/process.c | 63 | * See .../arch/sparc/kernel/process.c |
64 | */ | 64 | */ |
65 | void pmc_leon_idle(void) | 65 | static void pmc_leon_idle(void) |
66 | { | 66 | { |
67 | /* Interrupts need to be enabled to not hang the CPU */ | 67 | /* Interrupts need to be enabled to not hang the CPU */ |
68 | local_irq_enable(); | 68 | local_irq_enable(); |
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index 6edf955f987c..018ef11f57df 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c | |||
@@ -130,7 +130,7 @@ void leon_configure_cache_smp(void) | |||
130 | local_ops->tlb_all(); | 130 | local_ops->tlb_all(); |
131 | } | 131 | } |
132 | 132 | ||
133 | void leon_smp_setbroadcast(unsigned int mask) | 133 | static void leon_smp_setbroadcast(unsigned int mask) |
134 | { | 134 | { |
135 | int broadcast = | 135 | int broadcast = |
136 | ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >> | 136 | ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >> |
@@ -148,13 +148,6 @@ void leon_smp_setbroadcast(unsigned int mask) | |||
148 | LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpbroadcast), mask); | 148 | LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpbroadcast), mask); |
149 | } | 149 | } |
150 | 150 | ||
151 | unsigned int leon_smp_getbroadcast(void) | ||
152 | { | ||
153 | unsigned int mask; | ||
154 | mask = LEON_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpbroadcast)); | ||
155 | return mask; | ||
156 | } | ||
157 | |||
158 | int leon_smp_nrcpus(void) | 151 | int leon_smp_nrcpus(void) |
159 | { | 152 | { |
160 | int nrcpu = | 153 | int nrcpu = |
@@ -266,10 +259,6 @@ void __init leon_smp_done(void) | |||
266 | 259 | ||
267 | } | 260 | } |
268 | 261 | ||
269 | void leon_irq_rotate(int cpu) | ||
270 | { | ||
271 | } | ||
272 | |||
273 | struct leon_ipi_work { | 262 | struct leon_ipi_work { |
274 | int single; | 263 | int single; |
275 | int msk; | 264 | int msk; |
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c index 3241f56331c2..de0ee3971f00 100644 --- a/arch/sparc/kernel/of_device_common.c +++ b/arch/sparc/kernel/of_device_common.c | |||
@@ -5,8 +5,10 @@ | |||
5 | #include <linux/mod_devicetable.h> | 5 | #include <linux/mod_devicetable.h> |
6 | #include <linux/errno.h> | 6 | #include <linux/errno.h> |
7 | #include <linux/irq.h> | 7 | #include <linux/irq.h> |
8 | #include <linux/of_device.h> | ||
9 | #include <linux/of_platform.h> | 8 | #include <linux/of_platform.h> |
9 | #include <linux/of_address.h> | ||
10 | #include <linux/of_device.h> | ||
11 | #include <linux/of_irq.h> | ||
10 | 12 | ||
11 | #include "of_device_common.h" | 13 | #include "of_device_common.h" |
12 | 14 | ||
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index 857ad77df9c0..539babf00bb2 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/apb.h> | 28 | #include <asm/apb.h> |
29 | 29 | ||
30 | #include "pci_impl.h" | 30 | #include "pci_impl.h" |
31 | #include "kernel.h" | ||
31 | 32 | ||
32 | /* List of all PCI controllers found in the system. */ | 33 | /* List of all PCI controllers found in the system. */ |
33 | struct pci_pbm_info *pci_pbm_root = NULL; | 34 | struct pci_pbm_info *pci_pbm_root = NULL; |
diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h index 5f688531f48c..75803c780af3 100644 --- a/arch/sparc/kernel/pci_impl.h +++ b/arch/sparc/kernel/pci_impl.h | |||
@@ -48,8 +48,8 @@ struct sparc64_msiq_ops { | |||
48 | unsigned long devino); | 48 | unsigned long devino); |
49 | }; | 49 | }; |
50 | 50 | ||
51 | extern void sparc64_pbm_msi_init(struct pci_pbm_info *pbm, | 51 | void sparc64_pbm_msi_init(struct pci_pbm_info *pbm, |
52 | const struct sparc64_msiq_ops *ops); | 52 | const struct sparc64_msiq_ops *ops); |
53 | 53 | ||
54 | struct sparc64_msiq_cookie { | 54 | struct sparc64_msiq_cookie { |
55 | struct pci_pbm_info *pbm; | 55 | struct pci_pbm_info *pbm; |
@@ -158,23 +158,23 @@ extern struct pci_pbm_info *pci_pbm_root; | |||
158 | extern int pci_num_pbms; | 158 | extern int pci_num_pbms; |
159 | 159 | ||
160 | /* PCI bus scanning and fixup support. */ | 160 | /* PCI bus scanning and fixup support. */ |
161 | extern void pci_get_pbm_props(struct pci_pbm_info *pbm); | 161 | void pci_get_pbm_props(struct pci_pbm_info *pbm); |
162 | extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, | 162 | struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, |
163 | struct device *parent); | 163 | struct device *parent); |
164 | extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm); | 164 | void pci_determine_mem_io_space(struct pci_pbm_info *pbm); |
165 | 165 | ||
166 | /* Error reporting support. */ | 166 | /* Error reporting support. */ |
167 | extern void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *); | 167 | void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *); |
168 | extern void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *); | 168 | void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *); |
169 | extern void pci_scan_for_parity_error(struct pci_pbm_info *, struct pci_bus *); | 169 | void pci_scan_for_parity_error(struct pci_pbm_info *, struct pci_bus *); |
170 | 170 | ||
171 | /* Configuration space access. */ | 171 | /* Configuration space access. */ |
172 | extern void pci_config_read8(u8 *addr, u8 *ret); | 172 | void pci_config_read8(u8 *addr, u8 *ret); |
173 | extern void pci_config_read16(u16 *addr, u16 *ret); | 173 | void pci_config_read16(u16 *addr, u16 *ret); |
174 | extern void pci_config_read32(u32 *addr, u32 *ret); | 174 | void pci_config_read32(u32 *addr, u32 *ret); |
175 | extern void pci_config_write8(u8 *addr, u8 val); | 175 | void pci_config_write8(u8 *addr, u8 val); |
176 | extern void pci_config_write16(u16 *addr, u16 val); | 176 | void pci_config_write16(u16 *addr, u16 val); |
177 | extern void pci_config_write32(u32 *addr, u32 val); | 177 | void pci_config_write32(u32 *addr, u32 val); |
178 | 178 | ||
179 | extern struct pci_ops sun4u_pci_ops; | 179 | extern struct pci_ops sun4u_pci_ops; |
180 | extern struct pci_ops sun4v_pci_ops; | 180 | extern struct pci_ops sun4v_pci_ops; |
diff --git a/arch/sparc/kernel/pci_sun4v.h b/arch/sparc/kernel/pci_sun4v.h index 8e9fc3a5b4f5..5642212390b2 100644 --- a/arch/sparc/kernel/pci_sun4v.h +++ b/arch/sparc/kernel/pci_sun4v.h | |||
@@ -6,87 +6,87 @@ | |||
6 | #ifndef _PCI_SUN4V_H | 6 | #ifndef _PCI_SUN4V_H |
7 | #define _PCI_SUN4V_H | 7 | #define _PCI_SUN4V_H |
8 | 8 | ||
9 | extern long pci_sun4v_iommu_map(unsigned long devhandle, | 9 | long pci_sun4v_iommu_map(unsigned long devhandle, |
10 | unsigned long tsbid, | 10 | unsigned long tsbid, |
11 | unsigned long num_ttes, | 11 | unsigned long num_ttes, |
12 | unsigned long io_attributes, | 12 | unsigned long io_attributes, |
13 | unsigned long io_page_list_pa); | 13 | unsigned long io_page_list_pa); |
14 | extern unsigned long pci_sun4v_iommu_demap(unsigned long devhandle, | 14 | unsigned long pci_sun4v_iommu_demap(unsigned long devhandle, |
15 | unsigned long tsbid, | 15 | unsigned long tsbid, |
16 | unsigned long num_ttes); | 16 | unsigned long num_ttes); |
17 | extern unsigned long pci_sun4v_iommu_getmap(unsigned long devhandle, | 17 | unsigned long pci_sun4v_iommu_getmap(unsigned long devhandle, |
18 | unsigned long tsbid, | 18 | unsigned long tsbid, |
19 | unsigned long *io_attributes, | 19 | unsigned long *io_attributes, |
20 | unsigned long *real_address); | 20 | unsigned long *real_address); |
21 | extern unsigned long pci_sun4v_config_get(unsigned long devhandle, | 21 | unsigned long pci_sun4v_config_get(unsigned long devhandle, |
22 | unsigned long pci_device, | 22 | unsigned long pci_device, |
23 | unsigned long config_offset, | 23 | unsigned long config_offset, |
24 | unsigned long size); | 24 | unsigned long size); |
25 | extern int pci_sun4v_config_put(unsigned long devhandle, | 25 | int pci_sun4v_config_put(unsigned long devhandle, |
26 | unsigned long pci_device, | 26 | unsigned long pci_device, |
27 | unsigned long config_offset, | 27 | unsigned long config_offset, |
28 | unsigned long size, | 28 | unsigned long size, |
29 | unsigned long data); | 29 | unsigned long data); |
30 | 30 | ||
31 | extern unsigned long pci_sun4v_msiq_conf(unsigned long devhandle, | 31 | unsigned long pci_sun4v_msiq_conf(unsigned long devhandle, |
32 | unsigned long msiqid, | 32 | unsigned long msiqid, |
33 | unsigned long msiq_paddr, | 33 | unsigned long msiq_paddr, |
34 | unsigned long num_entries); | 34 | unsigned long num_entries); |
35 | extern unsigned long pci_sun4v_msiq_info(unsigned long devhandle, | 35 | unsigned long pci_sun4v_msiq_info(unsigned long devhandle, |
36 | unsigned long msiqid, | 36 | unsigned long msiqid, |
37 | unsigned long *msiq_paddr, | 37 | unsigned long *msiq_paddr, |
38 | unsigned long *num_entries); | 38 | unsigned long *num_entries); |
39 | extern unsigned long pci_sun4v_msiq_getvalid(unsigned long devhandle, | 39 | unsigned long pci_sun4v_msiq_getvalid(unsigned long devhandle, |
40 | unsigned long msiqid, | 40 | unsigned long msiqid, |
41 | unsigned long *valid); | 41 | unsigned long *valid); |
42 | extern unsigned long pci_sun4v_msiq_setvalid(unsigned long devhandle, | 42 | unsigned long pci_sun4v_msiq_setvalid(unsigned long devhandle, |
43 | unsigned long msiqid, | 43 | unsigned long msiqid, |
44 | unsigned long valid); | 44 | unsigned long valid); |
45 | extern unsigned long pci_sun4v_msiq_getstate(unsigned long devhandle, | 45 | unsigned long pci_sun4v_msiq_getstate(unsigned long devhandle, |
46 | unsigned long msiqid, | 46 | unsigned long msiqid, |
47 | unsigned long *state); | 47 | unsigned long *state); |
48 | extern unsigned long pci_sun4v_msiq_setstate(unsigned long devhandle, | 48 | unsigned long pci_sun4v_msiq_setstate(unsigned long devhandle, |
49 | unsigned long msiqid, | 49 | unsigned long msiqid, |
50 | unsigned long state); | 50 | unsigned long state); |
51 | extern unsigned long pci_sun4v_msiq_gethead(unsigned long devhandle, | 51 | unsigned long pci_sun4v_msiq_gethead(unsigned long devhandle, |
52 | unsigned long msiqid, | 52 | unsigned long msiqid, |
53 | unsigned long *head); | 53 | unsigned long *head); |
54 | extern unsigned long pci_sun4v_msiq_sethead(unsigned long devhandle, | 54 | unsigned long pci_sun4v_msiq_sethead(unsigned long devhandle, |
55 | unsigned long msiqid, | 55 | unsigned long msiqid, |
56 | unsigned long head); | 56 | unsigned long head); |
57 | extern unsigned long pci_sun4v_msiq_gettail(unsigned long devhandle, | 57 | unsigned long pci_sun4v_msiq_gettail(unsigned long devhandle, |
58 | unsigned long msiqid, | 58 | unsigned long msiqid, |
59 | unsigned long *head); | 59 | unsigned long *head); |
60 | extern unsigned long pci_sun4v_msi_getvalid(unsigned long devhandle, | 60 | unsigned long pci_sun4v_msi_getvalid(unsigned long devhandle, |
61 | unsigned long msinum, | 61 | unsigned long msinum, |
62 | unsigned long *valid); | 62 | unsigned long *valid); |
63 | extern unsigned long pci_sun4v_msi_setvalid(unsigned long devhandle, | 63 | unsigned long pci_sun4v_msi_setvalid(unsigned long devhandle, |
64 | unsigned long msinum, | 64 | unsigned long msinum, |
65 | unsigned long valid); | 65 | unsigned long valid); |
66 | extern unsigned long pci_sun4v_msi_getmsiq(unsigned long devhandle, | 66 | unsigned long pci_sun4v_msi_getmsiq(unsigned long devhandle, |
67 | unsigned long msinum, | 67 | unsigned long msinum, |
68 | unsigned long *msiq); | 68 | unsigned long *msiq); |
69 | extern unsigned long pci_sun4v_msi_setmsiq(unsigned long devhandle, | 69 | unsigned long pci_sun4v_msi_setmsiq(unsigned long devhandle, |
70 | unsigned long msinum, | 70 | unsigned long msinum, |
71 | unsigned long msiq, | 71 | unsigned long msiq, |
72 | unsigned long msitype); | 72 | unsigned long msitype); |
73 | extern unsigned long pci_sun4v_msi_getstate(unsigned long devhandle, | 73 | unsigned long pci_sun4v_msi_getstate(unsigned long devhandle, |
74 | unsigned long msinum, | 74 | unsigned long msinum, |
75 | unsigned long *state); | 75 | unsigned long *state); |
76 | extern unsigned long pci_sun4v_msi_setstate(unsigned long devhandle, | 76 | unsigned long pci_sun4v_msi_setstate(unsigned long devhandle, |
77 | unsigned long msinum, | 77 | unsigned long msinum, |
78 | unsigned long state); | 78 | unsigned long state); |
79 | extern unsigned long pci_sun4v_msg_getmsiq(unsigned long devhandle, | 79 | unsigned long pci_sun4v_msg_getmsiq(unsigned long devhandle, |
80 | unsigned long msinum, | 80 | unsigned long msinum, |
81 | unsigned long *msiq); | 81 | unsigned long *msiq); |
82 | extern unsigned long pci_sun4v_msg_setmsiq(unsigned long devhandle, | 82 | unsigned long pci_sun4v_msg_setmsiq(unsigned long devhandle, |
83 | unsigned long msinum, | 83 | unsigned long msinum, |
84 | unsigned long msiq); | 84 | unsigned long msiq); |
85 | extern unsigned long pci_sun4v_msg_getvalid(unsigned long devhandle, | 85 | unsigned long pci_sun4v_msg_getvalid(unsigned long devhandle, |
86 | unsigned long msinum, | 86 | unsigned long msinum, |
87 | unsigned long *valid); | 87 | unsigned long *valid); |
88 | extern unsigned long pci_sun4v_msg_setvalid(unsigned long devhandle, | 88 | unsigned long pci_sun4v_msg_setvalid(unsigned long devhandle, |
89 | unsigned long msinum, | 89 | unsigned long msinum, |
90 | unsigned long valid); | 90 | unsigned long valid); |
91 | 91 | ||
92 | #endif /* !(_PCI_SUN4V_H) */ | 92 | #endif /* !(_PCI_SUN4V_H) */ |
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index 09f4fdd8d808..6cc78c213c01 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
37 | #include <asm/irq_regs.h> | 37 | #include <asm/irq_regs.h> |
38 | 38 | ||
39 | #include "kernel.h" | ||
39 | #include "irq.h" | 40 | #include "irq.h" |
40 | 41 | ||
41 | /* | 42 | /* |
@@ -162,8 +163,8 @@ static int pcic0_up; | |||
162 | static struct linux_pcic pcic0; | 163 | static struct linux_pcic pcic0; |
163 | 164 | ||
164 | void __iomem *pcic_regs; | 165 | void __iomem *pcic_regs; |
165 | volatile int pcic_speculative; | 166 | static volatile int pcic_speculative; |
166 | volatile int pcic_trapped; | 167 | static volatile int pcic_trapped; |
167 | 168 | ||
168 | /* forward */ | 169 | /* forward */ |
169 | unsigned int pcic_build_device_irq(struct platform_device *op, | 170 | unsigned int pcic_build_device_irq(struct platform_device *op, |
@@ -329,7 +330,7 @@ int __init pcic_probe(void) | |||
329 | 330 | ||
330 | pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr"; | 331 | pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr"; |
331 | if ((pcic->pcic_config_space_addr = | 332 | if ((pcic->pcic_config_space_addr = |
332 | ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == 0) { | 333 | ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == NULL) { |
333 | prom_printf("PCIC: Error, cannot map " | 334 | prom_printf("PCIC: Error, cannot map " |
334 | "PCI Configuration Space Address.\n"); | 335 | "PCI Configuration Space Address.\n"); |
335 | prom_halt(); | 336 | prom_halt(); |
@@ -341,7 +342,7 @@ int __init pcic_probe(void) | |||
341 | */ | 342 | */ |
342 | pcic->pcic_res_cfg_data.name = "pcic_cfg_data"; | 343 | pcic->pcic_res_cfg_data.name = "pcic_cfg_data"; |
343 | if ((pcic->pcic_config_space_data = | 344 | if ((pcic->pcic_config_space_data = |
344 | ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == 0) { | 345 | ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == NULL) { |
345 | prom_printf("PCIC: Error, cannot map " | 346 | prom_printf("PCIC: Error, cannot map " |
346 | "PCI Configuration Space Data.\n"); | 347 | "PCI Configuration Space Data.\n"); |
347 | prom_halt(); | 348 | prom_halt(); |
@@ -353,7 +354,6 @@ int __init pcic_probe(void) | |||
353 | strcpy(pbm->prom_name, namebuf); | 354 | strcpy(pbm->prom_name, namebuf); |
354 | 355 | ||
355 | { | 356 | { |
356 | extern volatile int t_nmi[4]; | ||
357 | extern int pcic_nmi_trap_patch[4]; | 357 | extern int pcic_nmi_trap_patch[4]; |
358 | 358 | ||
359 | t_nmi[0] = pcic_nmi_trap_patch[0]; | 359 | t_nmi[0] = pcic_nmi_trap_patch[0]; |
@@ -536,7 +536,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node) | |||
536 | prom_getstring(node, "name", namebuf, sizeof(namebuf)); | 536 | prom_getstring(node, "name", namebuf, sizeof(namebuf)); |
537 | } | 537 | } |
538 | 538 | ||
539 | if ((p = pcic->pcic_imap) == 0) { | 539 | if ((p = pcic->pcic_imap) == NULL) { |
540 | dev->irq = 0; | 540 | dev->irq = 0; |
541 | return; | 541 | return; |
542 | } | 542 | } |
@@ -670,30 +670,6 @@ void pcibios_fixup_bus(struct pci_bus *bus) | |||
670 | } | 670 | } |
671 | } | 671 | } |
672 | 672 | ||
673 | /* | ||
674 | * pcic_pin_to_irq() is exported to bus probing code | ||
675 | */ | ||
676 | unsigned int | ||
677 | pcic_pin_to_irq(unsigned int pin, const char *name) | ||
678 | { | ||
679 | struct linux_pcic *pcic = &pcic0; | ||
680 | unsigned int irq; | ||
681 | unsigned int ivec; | ||
682 | |||
683 | if (pin < 4) { | ||
684 | ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_LO); | ||
685 | irq = ivec >> (pin << 2) & 0xF; | ||
686 | } else if (pin < 8) { | ||
687 | ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_HI); | ||
688 | irq = ivec >> ((pin-4) << 2) & 0xF; | ||
689 | } else { /* Corrupted map */ | ||
690 | printk("PCIC: BAD PIN %d FOR %s\n", pin, name); | ||
691 | for (;;) {} /* XXX Cannot panic properly in case of PROLL */ | ||
692 | } | ||
693 | /* P3 */ /* printk("PCIC: dev %s pin %d ivec 0x%x irq %x\n", name, pin, ivec, irq); */ | ||
694 | return irq; | ||
695 | } | ||
696 | |||
697 | /* Makes compiler happy */ | 673 | /* Makes compiler happy */ |
698 | static volatile int pcic_timer_dummy; | 674 | static volatile int pcic_timer_dummy; |
699 | 675 | ||
@@ -783,7 +759,7 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask) | |||
783 | void pcic_nmi(unsigned int pend, struct pt_regs *regs) | 759 | void pcic_nmi(unsigned int pend, struct pt_regs *regs) |
784 | { | 760 | { |
785 | 761 | ||
786 | pend = flip_dword(pend); | 762 | pend = swab32(pend); |
787 | 763 | ||
788 | if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) { | 764 | if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) { |
789 | /* | 765 | /* |
@@ -875,82 +851,4 @@ void __init sun4m_pci_init_IRQ(void) | |||
875 | sparc_config.load_profile_irq = pcic_load_profile_irq; | 851 | sparc_config.load_profile_irq = pcic_load_profile_irq; |
876 | } | 852 | } |
877 | 853 | ||
878 | /* | ||
879 | * This probably belongs here rather than ioport.c because | ||
880 | * we do not want this crud linked into SBus kernels. | ||
881 | * Also, think for a moment about likes of floppy.c that | ||
882 | * include architecture specific parts. They may want to redefine ins/outs. | ||
883 | * | ||
884 | * We do not use horrible macros here because we want to | ||
885 | * advance pointer by sizeof(size). | ||
886 | */ | ||
887 | void outsb(unsigned long addr, const void *src, unsigned long count) | ||
888 | { | ||
889 | while (count) { | ||
890 | count -= 1; | ||
891 | outb(*(const char *)src, addr); | ||
892 | src += 1; | ||
893 | /* addr += 1; */ | ||
894 | } | ||
895 | } | ||
896 | EXPORT_SYMBOL(outsb); | ||
897 | |||
898 | void outsw(unsigned long addr, const void *src, unsigned long count) | ||
899 | { | ||
900 | while (count) { | ||
901 | count -= 2; | ||
902 | outw(*(const short *)src, addr); | ||
903 | src += 2; | ||
904 | /* addr += 2; */ | ||
905 | } | ||
906 | } | ||
907 | EXPORT_SYMBOL(outsw); | ||
908 | |||
909 | void outsl(unsigned long addr, const void *src, unsigned long count) | ||
910 | { | ||
911 | while (count) { | ||
912 | count -= 4; | ||
913 | outl(*(const long *)src, addr); | ||
914 | src += 4; | ||
915 | /* addr += 4; */ | ||
916 | } | ||
917 | } | ||
918 | EXPORT_SYMBOL(outsl); | ||
919 | |||
920 | void insb(unsigned long addr, void *dst, unsigned long count) | ||
921 | { | ||
922 | while (count) { | ||
923 | count -= 1; | ||
924 | *(unsigned char *)dst = inb(addr); | ||
925 | dst += 1; | ||
926 | /* addr += 1; */ | ||
927 | } | ||
928 | } | ||
929 | EXPORT_SYMBOL(insb); | ||
930 | |||
931 | void insw(unsigned long addr, void *dst, unsigned long count) | ||
932 | { | ||
933 | while (count) { | ||
934 | count -= 2; | ||
935 | *(unsigned short *)dst = inw(addr); | ||
936 | dst += 2; | ||
937 | /* addr += 2; */ | ||
938 | } | ||
939 | } | ||
940 | EXPORT_SYMBOL(insw); | ||
941 | |||
942 | void insl(unsigned long addr, void *dst, unsigned long count) | ||
943 | { | ||
944 | while (count) { | ||
945 | count -= 4; | ||
946 | /* | ||
947 | * XXX I am sure we are in for an unaligned trap here. | ||
948 | */ | ||
949 | *(unsigned long *)dst = inl(addr); | ||
950 | dst += 4; | ||
951 | /* addr += 4; */ | ||
952 | } | ||
953 | } | ||
954 | EXPORT_SYMBOL(insl); | ||
955 | |||
956 | subsys_initcall(pcic_init); | 854 | subsys_initcall(pcic_init); |
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index b5c38faa4ead..8efd33753ad3 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
@@ -110,7 +110,7 @@ struct cpu_hw_events { | |||
110 | 110 | ||
111 | unsigned int group_flag; | 111 | unsigned int group_flag; |
112 | }; | 112 | }; |
113 | DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; | 113 | static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; |
114 | 114 | ||
115 | /* An event map describes the characteristics of a performance | 115 | /* An event map describes the characteristics of a performance |
116 | * counter event. In particular it gives the encoding as well as | 116 | * counter event. In particular it gives the encoding as well as |
@@ -1153,7 +1153,7 @@ static void perf_stop_nmi_watchdog(void *unused) | |||
1153 | cpuc->pcr[i] = pcr_ops->read_pcr(i); | 1153 | cpuc->pcr[i] = pcr_ops->read_pcr(i); |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | void perf_event_grab_pmc(void) | 1156 | static void perf_event_grab_pmc(void) |
1157 | { | 1157 | { |
1158 | if (atomic_inc_not_zero(&active_events)) | 1158 | if (atomic_inc_not_zero(&active_events)) |
1159 | return; | 1159 | return; |
@@ -1169,7 +1169,7 @@ void perf_event_grab_pmc(void) | |||
1169 | mutex_unlock(&pmc_grab_mutex); | 1169 | mutex_unlock(&pmc_grab_mutex); |
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | void perf_event_release_pmc(void) | 1172 | static void perf_event_release_pmc(void) |
1173 | { | 1173 | { |
1174 | if (atomic_dec_and_mutex_lock(&active_events, &pmc_grab_mutex)) { | 1174 | if (atomic_dec_and_mutex_lock(&active_events, &pmc_grab_mutex)) { |
1175 | if (atomic_read(&nmi_active) == 0) | 1175 | if (atomic_read(&nmi_active) == 0) |
@@ -1669,7 +1669,7 @@ static bool __init supported_pmu(void) | |||
1669 | return false; | 1669 | return false; |
1670 | } | 1670 | } |
1671 | 1671 | ||
1672 | int __init init_hw_perf_events(void) | 1672 | static int __init init_hw_perf_events(void) |
1673 | { | 1673 | { |
1674 | pr_info("Performance events: "); | 1674 | pr_info("Performance events: "); |
1675 | 1675 | ||
@@ -1742,10 +1742,11 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry, | |||
1742 | 1742 | ||
1743 | ufp = regs->u_regs[UREG_I6] + STACK_BIAS; | 1743 | ufp = regs->u_regs[UREG_I6] + STACK_BIAS; |
1744 | do { | 1744 | do { |
1745 | struct sparc_stackf *usf, sf; | 1745 | struct sparc_stackf __user *usf; |
1746 | struct sparc_stackf sf; | ||
1746 | unsigned long pc; | 1747 | unsigned long pc; |
1747 | 1748 | ||
1748 | usf = (struct sparc_stackf *) ufp; | 1749 | usf = (struct sparc_stackf __user *)ufp; |
1749 | if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) | 1750 | if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) |
1750 | break; | 1751 | break; |
1751 | 1752 | ||
@@ -1765,17 +1766,19 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry, | |||
1765 | unsigned long pc; | 1766 | unsigned long pc; |
1766 | 1767 | ||
1767 | if (thread32_stack_is_64bit(ufp)) { | 1768 | if (thread32_stack_is_64bit(ufp)) { |
1768 | struct sparc_stackf *usf, sf; | 1769 | struct sparc_stackf __user *usf; |
1770 | struct sparc_stackf sf; | ||
1769 | 1771 | ||
1770 | ufp += STACK_BIAS; | 1772 | ufp += STACK_BIAS; |
1771 | usf = (struct sparc_stackf *) ufp; | 1773 | usf = (struct sparc_stackf __user *)ufp; |
1772 | if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) | 1774 | if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) |
1773 | break; | 1775 | break; |
1774 | pc = sf.callers_pc & 0xffffffff; | 1776 | pc = sf.callers_pc & 0xffffffff; |
1775 | ufp = ((unsigned long) sf.fp) & 0xffffffff; | 1777 | ufp = ((unsigned long) sf.fp) & 0xffffffff; |
1776 | } else { | 1778 | } else { |
1777 | struct sparc_stackf32 *usf, sf; | 1779 | struct sparc_stackf32 __user *usf; |
1778 | usf = (struct sparc_stackf32 *) ufp; | 1780 | struct sparc_stackf32 sf; |
1781 | usf = (struct sparc_stackf32 __user *)ufp; | ||
1779 | if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) | 1782 | if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) |
1780 | break; | 1783 | break; |
1781 | pc = sf.callers_pc; | 1784 | pc = sf.callers_pc; |
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c index 510baec1b69b..50e7b626afe8 100644 --- a/arch/sparc/kernel/process_32.c +++ b/arch/sparc/kernel/process_32.c | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | #include <stdarg.h> | 11 | #include <stdarg.h> |
12 | 12 | ||
13 | #include <linux/elfcore.h> | ||
13 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
@@ -23,6 +24,7 @@ | |||
23 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
24 | #include <linux/pm.h> | 25 | #include <linux/pm.h> |
25 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/cpu.h> | ||
26 | 28 | ||
27 | #include <asm/auxio.h> | 29 | #include <asm/auxio.h> |
28 | #include <asm/oplib.h> | 30 | #include <asm/oplib.h> |
@@ -38,6 +40,8 @@ | |||
38 | #include <asm/unistd.h> | 40 | #include <asm/unistd.h> |
39 | #include <asm/setup.h> | 41 | #include <asm/setup.h> |
40 | 42 | ||
43 | #include "kernel.h" | ||
44 | |||
41 | /* | 45 | /* |
42 | * Power management idle function | 46 | * Power management idle function |
43 | * Set in pm platform drivers (apc.c and pmc.c) | 47 | * Set in pm platform drivers (apc.c and pmc.c) |
@@ -102,8 +106,12 @@ void machine_restart(char * cmd) | |||
102 | void machine_power_off(void) | 106 | void machine_power_off(void) |
103 | { | 107 | { |
104 | if (auxio_power_register && | 108 | if (auxio_power_register && |
105 | (strcmp(of_console_device->type, "serial") || scons_pwroff)) | 109 | (strcmp(of_console_device->type, "serial") || scons_pwroff)) { |
106 | *auxio_power_register |= AUXIO_POWER_OFF; | 110 | u8 power_register = sbus_readb(auxio_power_register); |
111 | power_register |= AUXIO_POWER_OFF; | ||
112 | sbus_writeb(power_register, auxio_power_register); | ||
113 | } | ||
114 | |||
107 | machine_halt(); | 115 | machine_halt(); |
108 | } | 116 | } |
109 | 117 | ||
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index d7b4967f8fa6..027e09986194 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c | |||
@@ -88,7 +88,7 @@ void arch_cpu_idle(void) | |||
88 | } | 88 | } |
89 | 89 | ||
90 | #ifdef CONFIG_HOTPLUG_CPU | 90 | #ifdef CONFIG_HOTPLUG_CPU |
91 | void arch_cpu_idle_dead() | 91 | void arch_cpu_idle_dead(void) |
92 | { | 92 | { |
93 | sched_preempt_enable_no_resched(); | 93 | sched_preempt_enable_no_resched(); |
94 | cpu_play_dead(); | 94 | cpu_play_dead(); |
@@ -239,7 +239,7 @@ static void __global_reg_poll(struct global_reg_snapshot *gp) | |||
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | void arch_trigger_all_cpu_backtrace(void) | 242 | void arch_trigger_all_cpu_backtrace(bool include_self) |
243 | { | 243 | { |
244 | struct thread_info *tp = current_thread_info(); | 244 | struct thread_info *tp = current_thread_info(); |
245 | struct pt_regs *regs = get_irq_regs(); | 245 | struct pt_regs *regs = get_irq_regs(); |
@@ -251,16 +251,22 @@ void arch_trigger_all_cpu_backtrace(void) | |||
251 | 251 | ||
252 | spin_lock_irqsave(&global_cpu_snapshot_lock, flags); | 252 | spin_lock_irqsave(&global_cpu_snapshot_lock, flags); |
253 | 253 | ||
254 | memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot)); | ||
255 | |||
256 | this_cpu = raw_smp_processor_id(); | 254 | this_cpu = raw_smp_processor_id(); |
257 | 255 | ||
258 | __global_reg_self(tp, regs, this_cpu); | 256 | memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot)); |
257 | |||
258 | if (include_self) | ||
259 | __global_reg_self(tp, regs, this_cpu); | ||
259 | 260 | ||
260 | smp_fetch_global_regs(); | 261 | smp_fetch_global_regs(); |
261 | 262 | ||
262 | for_each_online_cpu(cpu) { | 263 | for_each_online_cpu(cpu) { |
263 | struct global_reg_snapshot *gp = &global_cpu_snapshot[cpu].reg; | 264 | struct global_reg_snapshot *gp; |
265 | |||
266 | if (!include_self && cpu == this_cpu) | ||
267 | continue; | ||
268 | |||
269 | gp = &global_cpu_snapshot[cpu].reg; | ||
264 | 270 | ||
265 | __global_reg_poll(gp); | 271 | __global_reg_poll(gp); |
266 | 272 | ||
@@ -292,7 +298,7 @@ void arch_trigger_all_cpu_backtrace(void) | |||
292 | 298 | ||
293 | static void sysrq_handle_globreg(int key) | 299 | static void sysrq_handle_globreg(int key) |
294 | { | 300 | { |
295 | arch_trigger_all_cpu_backtrace(); | 301 | arch_trigger_all_cpu_backtrace(true); |
296 | } | 302 | } |
297 | 303 | ||
298 | static struct sysrq_key_op sparc_globalreg_op = { | 304 | static struct sysrq_key_op sparc_globalreg_op = { |
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index cf5fe1c0b024..890281b12b28 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
5 | #include <asm/prom.h> | 5 | #include <asm/prom.h> |
6 | 6 | ||
7 | extern void of_console_init(void); | 7 | void of_console_init(void); |
8 | 8 | ||
9 | extern unsigned int prom_early_allocated; | 9 | extern unsigned int prom_early_allocated; |
10 | 10 | ||
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index 9a690d39c01b..20cc5d80a471 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c | |||
@@ -15,11 +15,12 @@ | |||
15 | * 2 of the License, or (at your option) any later version. | 15 | * 2 of the License, or (at your option) any later version. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/memblock.h> | ||
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
19 | #include <linux/types.h> | ||
20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
21 | #include <linux/types.h> | ||
22 | #include <linux/cpu.h> | ||
21 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
22 | #include <linux/memblock.h> | ||
23 | #include <linux/of.h> | 24 | #include <linux/of.h> |
24 | 25 | ||
25 | #include <asm/prom.h> | 26 | #include <asm/prom.h> |
diff --git a/arch/sparc/kernel/psycho_common.h b/arch/sparc/kernel/psycho_common.h index 590b4ed8ab5e..05a6e30a928e 100644 --- a/arch/sparc/kernel/psycho_common.h +++ b/arch/sparc/kernel/psycho_common.h | |||
@@ -30,19 +30,19 @@ enum psycho_error_type { | |||
30 | UE_ERR, CE_ERR, PCI_ERR | 30 | UE_ERR, CE_ERR, PCI_ERR |
31 | }; | 31 | }; |
32 | 32 | ||
33 | extern void psycho_check_iommu_error(struct pci_pbm_info *pbm, | 33 | void psycho_check_iommu_error(struct pci_pbm_info *pbm, |
34 | unsigned long afsr, | 34 | unsigned long afsr, |
35 | unsigned long afar, | 35 | unsigned long afar, |
36 | enum psycho_error_type type); | 36 | enum psycho_error_type type); |
37 | 37 | ||
38 | extern irqreturn_t psycho_pcierr_intr(int irq, void *dev_id); | 38 | irqreturn_t psycho_pcierr_intr(int irq, void *dev_id); |
39 | 39 | ||
40 | extern int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize, | 40 | int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize, |
41 | u32 dvma_offset, u32 dma_mask, | 41 | u32 dvma_offset, u32 dma_mask, |
42 | unsigned long write_complete_offset); | 42 | unsigned long write_complete_offset); |
43 | 43 | ||
44 | extern void psycho_pbm_init_common(struct pci_pbm_info *pbm, | 44 | void psycho_pbm_init_common(struct pci_pbm_info *pbm, |
45 | struct platform_device *op, | 45 | struct platform_device *op, |
46 | const char *chip_name, int chip_type); | 46 | const char *chip_name, int chip_type); |
47 | 47 | ||
48 | #endif /* _PSYCHO_COMMON_H */ | 48 | #endif /* _PSYCHO_COMMON_H */ |
diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c index 896ba7c5cd8e..a331fdc11a2c 100644 --- a/arch/sparc/kernel/ptrace_32.c +++ b/arch/sparc/kernel/ptrace_32.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
27 | #include <asm/cacheflush.h> | 27 | #include <asm/cacheflush.h> |
28 | 28 | ||
29 | #include "kernel.h" | ||
30 | |||
29 | /* #define ALLOW_INIT_TRACING */ | 31 | /* #define ALLOW_INIT_TRACING */ |
30 | 32 | ||
31 | /* | 33 | /* |
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index 1434526970a6..baef495c06bd 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c | |||
@@ -267,7 +267,7 @@ static __init void leon_patch(void) | |||
267 | } | 267 | } |
268 | 268 | ||
269 | struct tt_entry *sparc_ttable; | 269 | struct tt_entry *sparc_ttable; |
270 | struct pt_regs fake_swapper_regs; | 270 | static struct pt_regs fake_swapper_regs; |
271 | 271 | ||
272 | /* Called from head_32.S - before we have setup anything | 272 | /* Called from head_32.S - before we have setup anything |
273 | * in the kernel. Be very careful with what you do here. | 273 | * in the kernel. Be very careful with what you do here. |
@@ -365,7 +365,7 @@ void __init setup_arch(char **cmdline_p) | |||
365 | 365 | ||
366 | prom_setsync(prom_sync_me); | 366 | prom_setsync(prom_sync_me); |
367 | 367 | ||
368 | if((boot_flags&BOOTME_DEBUG) && (linux_dbvec!=0) && | 368 | if((boot_flags & BOOTME_DEBUG) && (linux_dbvec != NULL) && |
369 | ((*(short *)linux_dbvec) != -1)) { | 369 | ((*(short *)linux_dbvec) != -1)) { |
370 | printk("Booted under KADB. Syncing trap table.\n"); | 370 | printk("Booted under KADB. Syncing trap table.\n"); |
371 | (*(linux_dbvec->teach_debugger))(); | 371 | (*(linux_dbvec->teach_debugger))(); |
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c index ee789d2ef05d..62deba7be1a9 100644 --- a/arch/sparc/kernel/signal32.c +++ b/arch/sparc/kernel/signal32.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <asm/switch_to.h> | 31 | #include <asm/switch_to.h> |
32 | 32 | ||
33 | #include "sigutil.h" | 33 | #include "sigutil.h" |
34 | #include "kernel.h" | ||
34 | 35 | ||
35 | /* This magic should be in g_upper[0] for all upper parts | 36 | /* This magic should be in g_upper[0] for all upper parts |
36 | * to be valid. | 37 | * to be valid. |
@@ -145,7 +146,7 @@ void do_sigreturn32(struct pt_regs *regs) | |||
145 | unsigned int psr; | 146 | unsigned int psr; |
146 | unsigned pc, npc; | 147 | unsigned pc, npc; |
147 | sigset_t set; | 148 | sigset_t set; |
148 | unsigned seta[_COMPAT_NSIG_WORDS]; | 149 | compat_sigset_t seta; |
149 | int err, i; | 150 | int err, i; |
150 | 151 | ||
151 | /* Always make any pending restarted system calls return -EINTR */ | 152 | /* Always make any pending restarted system calls return -EINTR */ |
@@ -209,17 +210,13 @@ void do_sigreturn32(struct pt_regs *regs) | |||
209 | if (restore_rwin_state(compat_ptr(rwin_save))) | 210 | if (restore_rwin_state(compat_ptr(rwin_save))) |
210 | goto segv; | 211 | goto segv; |
211 | } | 212 | } |
212 | err |= __get_user(seta[0], &sf->info.si_mask); | 213 | err |= __get_user(seta.sig[0], &sf->info.si_mask); |
213 | err |= copy_from_user(seta+1, &sf->extramask, | 214 | err |= copy_from_user(&seta.sig[1], &sf->extramask, |
214 | (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); | 215 | (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); |
215 | if (err) | 216 | if (err) |
216 | goto segv; | 217 | goto segv; |
217 | switch (_NSIG_WORDS) { | 218 | |
218 | case 4: set.sig[3] = seta[6] + (((long)seta[7]) << 32); | 219 | set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32); |
219 | case 3: set.sig[2] = seta[4] + (((long)seta[5]) << 32); | ||
220 | case 2: set.sig[1] = seta[2] + (((long)seta[3]) << 32); | ||
221 | case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32); | ||
222 | } | ||
223 | set_current_blocked(&set); | 220 | set_current_blocked(&set); |
224 | return; | 221 | return; |
225 | 222 | ||
@@ -303,12 +300,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) | |||
303 | goto segv; | 300 | goto segv; |
304 | } | 301 | } |
305 | 302 | ||
306 | switch (_NSIG_WORDS) { | 303 | set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32); |
307 | case 4: set.sig[3] = seta.sig[6] + (((long)seta.sig[7]) << 32); | ||
308 | case 3: set.sig[2] = seta.sig[4] + (((long)seta.sig[5]) << 32); | ||
309 | case 2: set.sig[1] = seta.sig[2] + (((long)seta.sig[3]) << 32); | ||
310 | case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32); | ||
311 | } | ||
312 | set_current_blocked(&set); | 304 | set_current_blocked(&set); |
313 | return; | 305 | return; |
314 | segv: | 306 | segv: |
@@ -417,7 +409,7 @@ static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs, | |||
417 | void __user *tail; | 409 | void __user *tail; |
418 | int sigframe_size; | 410 | int sigframe_size; |
419 | u32 psr; | 411 | u32 psr; |
420 | unsigned int seta[_COMPAT_NSIG_WORDS]; | 412 | compat_sigset_t seta; |
421 | 413 | ||
422 | /* 1. Make sure everything is clean */ | 414 | /* 1. Make sure everything is clean */ |
423 | synchronize_user_stack(); | 415 | synchronize_user_stack(); |
@@ -481,18 +473,14 @@ static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs, | |||
481 | err |= __put_user(0, &sf->rwin_save); | 473 | err |= __put_user(0, &sf->rwin_save); |
482 | } | 474 | } |
483 | 475 | ||
484 | switch (_NSIG_WORDS) { | 476 | /* If these change we need to know - assignments to seta relies on these sizes */ |
485 | case 4: seta[7] = (oldset->sig[3] >> 32); | 477 | BUILD_BUG_ON(_NSIG_WORDS != 1); |
486 | seta[6] = oldset->sig[3]; | 478 | BUILD_BUG_ON(_COMPAT_NSIG_WORDS != 2); |
487 | case 3: seta[5] = (oldset->sig[2] >> 32); | 479 | seta.sig[1] = (oldset->sig[0] >> 32); |
488 | seta[4] = oldset->sig[2]; | 480 | seta.sig[0] = oldset->sig[0]; |
489 | case 2: seta[3] = (oldset->sig[1] >> 32); | 481 | |
490 | seta[2] = oldset->sig[1]; | 482 | err |= __put_user(seta.sig[0], &sf->info.si_mask); |
491 | case 1: seta[1] = (oldset->sig[0] >> 32); | 483 | err |= __copy_to_user(sf->extramask, &seta.sig[1], |
492 | seta[0] = oldset->sig[0]; | ||
493 | } | ||
494 | err |= __put_user(seta[0], &sf->info.si_mask); | ||
495 | err |= __copy_to_user(sf->extramask, seta + 1, | ||
496 | (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); | 484 | (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); |
497 | 485 | ||
498 | if (!wsaved) { | 486 | if (!wsaved) { |
@@ -622,16 +610,8 @@ static int setup_rt_frame32(struct ksignal *ksig, struct pt_regs *regs, | |||
622 | /* Setup sigaltstack */ | 610 | /* Setup sigaltstack */ |
623 | err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]); | 611 | err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]); |
624 | 612 | ||
625 | switch (_NSIG_WORDS) { | 613 | seta.sig[1] = (oldset->sig[0] >> 32); |
626 | case 4: seta.sig[7] = (oldset->sig[3] >> 32); | 614 | seta.sig[0] = oldset->sig[0]; |
627 | seta.sig[6] = oldset->sig[3]; | ||
628 | case 3: seta.sig[5] = (oldset->sig[2] >> 32); | ||
629 | seta.sig[4] = oldset->sig[2]; | ||
630 | case 2: seta.sig[3] = (oldset->sig[1] >> 32); | ||
631 | seta.sig[2] = oldset->sig[1]; | ||
632 | case 1: seta.sig[1] = (oldset->sig[0] >> 32); | ||
633 | seta.sig[0] = oldset->sig[0]; | ||
634 | } | ||
635 | err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t)); | 615 | err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t)); |
636 | 616 | ||
637 | if (!wsaved) { | 617 | if (!wsaved) { |
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c index 7d5d8e1f8415..9ee72fc8e0e4 100644 --- a/arch/sparc/kernel/signal_32.c +++ b/arch/sparc/kernel/signal_32.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/switch_to.h> | 28 | #include <asm/switch_to.h> |
29 | 29 | ||
30 | #include "sigutil.h" | 30 | #include "sigutil.h" |
31 | #include "kernel.h" | ||
31 | 32 | ||
32 | extern void fpsave(unsigned long *fpregs, unsigned long *fsr, | 33 | extern void fpsave(unsigned long *fpregs, unsigned long *fsr, |
33 | void *fpqueue, unsigned long *fpqdepth); | 34 | void *fpqueue, unsigned long *fpqdepth); |
@@ -341,7 +342,7 @@ static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs, | |||
341 | err |= __put_user(0, &sf->extra_size); | 342 | err |= __put_user(0, &sf->extra_size); |
342 | 343 | ||
343 | if (psr & PSR_EF) { | 344 | if (psr & PSR_EF) { |
344 | __siginfo_fpu_t *fp = tail; | 345 | __siginfo_fpu_t __user *fp = tail; |
345 | tail += sizeof(*fp); | 346 | tail += sizeof(*fp); |
346 | err |= save_fpu_state(regs, fp); | 347 | err |= save_fpu_state(regs, fp); |
347 | err |= __put_user(fp, &sf->fpu_save); | 348 | err |= __put_user(fp, &sf->fpu_save); |
@@ -349,7 +350,7 @@ static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs, | |||
349 | err |= __put_user(0, &sf->fpu_save); | 350 | err |= __put_user(0, &sf->fpu_save); |
350 | } | 351 | } |
351 | if (wsaved) { | 352 | if (wsaved) { |
352 | __siginfo_rwin_t *rwp = tail; | 353 | __siginfo_rwin_t __user *rwp = tail; |
353 | tail += sizeof(*rwp); | 354 | tail += sizeof(*rwp); |
354 | err |= save_rwin_state(wsaved, rwp); | 355 | err |= save_rwin_state(wsaved, rwp); |
355 | err |= __put_user(rwp, &sf->rwin_save); | 356 | err |= __put_user(rwp, &sf->rwin_save); |
@@ -517,9 +518,9 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, | |||
517 | } | 518 | } |
518 | } | 519 | } |
519 | 520 | ||
520 | asmlinkage int | 521 | asmlinkage int do_sys_sigstack(struct sigstack __user *ssptr, |
521 | do_sys_sigstack(struct sigstack __user *ssptr, struct sigstack __user *ossptr, | 522 | struct sigstack __user *ossptr, |
522 | unsigned long sp) | 523 | unsigned long sp) |
523 | { | 524 | { |
524 | int ret = -EFAULT; | 525 | int ret = -EFAULT; |
525 | 526 | ||
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c index cd91d010e6d3..1a6999868031 100644 --- a/arch/sparc/kernel/signal_64.c +++ b/arch/sparc/kernel/signal_64.c | |||
@@ -35,9 +35,10 @@ | |||
35 | #include <asm/switch_to.h> | 35 | #include <asm/switch_to.h> |
36 | #include <asm/cacheflush.h> | 36 | #include <asm/cacheflush.h> |
37 | 37 | ||
38 | #include "entry.h" | ||
39 | #include "systbls.h" | ||
40 | #include "sigutil.h" | 38 | #include "sigutil.h" |
39 | #include "systbls.h" | ||
40 | #include "kernel.h" | ||
41 | #include "entry.h" | ||
41 | 42 | ||
42 | /* {set, get}context() needed for 64-bit SparcLinux userland. */ | 43 | /* {set, get}context() needed for 64-bit SparcLinux userland. */ |
43 | asmlinkage void sparc64_set_context(struct pt_regs *regs) | 44 | asmlinkage void sparc64_set_context(struct pt_regs *regs) |
@@ -492,7 +493,6 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
492 | 493 | ||
493 | #ifdef CONFIG_COMPAT | 494 | #ifdef CONFIG_COMPAT |
494 | if (test_thread_flag(TIF_32BIT)) { | 495 | if (test_thread_flag(TIF_32BIT)) { |
495 | extern void do_signal32(struct pt_regs *); | ||
496 | do_signal32(regs); | 496 | do_signal32(regs); |
497 | return; | 497 | return; |
498 | } | 498 | } |
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c index a102bfba6ea8..7958242d63c5 100644 --- a/arch/sparc/kernel/smp_32.c +++ b/arch/sparc/kernel/smp_32.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
21 | #include <linux/cache.h> | 21 | #include <linux/cache.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/profile.h> | ||
23 | #include <linux/cpu.h> | 24 | #include <linux/cpu.h> |
24 | 25 | ||
25 | #include <asm/ptrace.h> | 26 | #include <asm/ptrace.h> |
@@ -75,8 +76,6 @@ void smp_store_cpu_info(int id) | |||
75 | 76 | ||
76 | void __init smp_cpus_done(unsigned int max_cpus) | 77 | void __init smp_cpus_done(unsigned int max_cpus) |
77 | { | 78 | { |
78 | extern void smp4m_smp_done(void); | ||
79 | extern void smp4d_smp_done(void); | ||
80 | unsigned long bogosum = 0; | 79 | unsigned long bogosum = 0; |
81 | int cpu, num = 0; | 80 | int cpu, num = 0; |
82 | 81 | ||
@@ -183,8 +182,6 @@ int setup_profiling_timer(unsigned int multiplier) | |||
183 | 182 | ||
184 | void __init smp_prepare_cpus(unsigned int max_cpus) | 183 | void __init smp_prepare_cpus(unsigned int max_cpus) |
185 | { | 184 | { |
186 | extern void __init smp4m_boot_cpus(void); | ||
187 | extern void __init smp4d_boot_cpus(void); | ||
188 | int i, cpuid, extra; | 185 | int i, cpuid, extra; |
189 | 186 | ||
190 | printk("Entering SMP Mode...\n"); | 187 | printk("Entering SMP Mode...\n"); |
@@ -261,8 +258,6 @@ void __init smp_prepare_boot_cpu(void) | |||
261 | 258 | ||
262 | int __cpu_up(unsigned int cpu, struct task_struct *tidle) | 259 | int __cpu_up(unsigned int cpu, struct task_struct *tidle) |
263 | { | 260 | { |
264 | extern int smp4m_boot_one_cpu(int, struct task_struct *); | ||
265 | extern int smp4d_boot_one_cpu(int, struct task_struct *); | ||
266 | int ret=0; | 261 | int ret=0; |
267 | 262 | ||
268 | switch(sparc_cpu_model) { | 263 | switch(sparc_cpu_model) { |
@@ -297,7 +292,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) | |||
297 | return ret; | 292 | return ret; |
298 | } | 293 | } |
299 | 294 | ||
300 | void arch_cpu_pre_starting(void *arg) | 295 | static void arch_cpu_pre_starting(void *arg) |
301 | { | 296 | { |
302 | local_ops->cache_all(); | 297 | local_ops->cache_all(); |
303 | local_ops->tlb_all(); | 298 | local_ops->tlb_all(); |
@@ -317,7 +312,7 @@ void arch_cpu_pre_starting(void *arg) | |||
317 | } | 312 | } |
318 | } | 313 | } |
319 | 314 | ||
320 | void arch_cpu_pre_online(void *arg) | 315 | static void arch_cpu_pre_online(void *arg) |
321 | { | 316 | { |
322 | unsigned int cpuid = hard_smp_processor_id(); | 317 | unsigned int cpuid = hard_smp_processor_id(); |
323 | 318 | ||
@@ -344,7 +339,7 @@ void arch_cpu_pre_online(void *arg) | |||
344 | } | 339 | } |
345 | } | 340 | } |
346 | 341 | ||
347 | void sparc_start_secondary(void *arg) | 342 | static void sparc_start_secondary(void *arg) |
348 | { | 343 | { |
349 | unsigned int cpu; | 344 | unsigned int cpu; |
350 | 345 | ||
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index 745a3633ce14..41aa2478f3ca 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/ftrace.h> | 25 | #include <linux/ftrace.h> |
26 | #include <linux/cpu.h> | 26 | #include <linux/cpu.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/kgdb.h> | ||
28 | 29 | ||
29 | #include <asm/head.h> | 30 | #include <asm/head.h> |
30 | #include <asm/ptrace.h> | 31 | #include <asm/ptrace.h> |
@@ -35,6 +36,7 @@ | |||
35 | #include <asm/hvtramp.h> | 36 | #include <asm/hvtramp.h> |
36 | #include <asm/io.h> | 37 | #include <asm/io.h> |
37 | #include <asm/timer.h> | 38 | #include <asm/timer.h> |
39 | #include <asm/setup.h> | ||
38 | 40 | ||
39 | #include <asm/irq.h> | 41 | #include <asm/irq.h> |
40 | #include <asm/irq_regs.h> | 42 | #include <asm/irq_regs.h> |
@@ -52,6 +54,7 @@ | |||
52 | #include <asm/pcr.h> | 54 | #include <asm/pcr.h> |
53 | 55 | ||
54 | #include "cpumap.h" | 56 | #include "cpumap.h" |
57 | #include "kernel.h" | ||
55 | 58 | ||
56 | DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE; | 59 | DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE; |
57 | cpumask_t cpu_core_map[NR_CPUS] __read_mostly = | 60 | cpumask_t cpu_core_map[NR_CPUS] __read_mostly = |
@@ -272,14 +275,6 @@ static void smp_synchronize_one_tick(int cpu) | |||
272 | } | 275 | } |
273 | 276 | ||
274 | #if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) | 277 | #if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) |
275 | /* XXX Put this in some common place. XXX */ | ||
276 | static unsigned long kimage_addr_to_ra(void *p) | ||
277 | { | ||
278 | unsigned long val = (unsigned long) p; | ||
279 | |||
280 | return kern_base + (val - KERNBASE); | ||
281 | } | ||
282 | |||
283 | static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg, | 278 | static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg, |
284 | void **descrp) | 279 | void **descrp) |
285 | { | 280 | { |
@@ -867,11 +862,6 @@ extern unsigned long xcall_flush_dcache_page_cheetah; | |||
867 | #endif | 862 | #endif |
868 | extern unsigned long xcall_flush_dcache_page_spitfire; | 863 | extern unsigned long xcall_flush_dcache_page_spitfire; |
869 | 864 | ||
870 | #ifdef CONFIG_DEBUG_DCFLUSH | ||
871 | extern atomic_t dcpage_flushes; | ||
872 | extern atomic_t dcpage_flushes_xcall; | ||
873 | #endif | ||
874 | |||
875 | static inline void __local_flush_dcache_page(struct page *page) | 865 | static inline void __local_flush_dcache_page(struct page *page) |
876 | { | 866 | { |
877 | #ifdef DCACHE_ALIASING_POSSIBLE | 867 | #ifdef DCACHE_ALIASING_POSSIBLE |
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c index f8933be3ca8b..a1bb2675b280 100644 --- a/arch/sparc/kernel/sun4d_irq.c +++ b/arch/sparc/kernel/sun4d_irq.c | |||
@@ -143,7 +143,7 @@ static void sun4d_sbus_handler_irq(int sbusl) | |||
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | void sun4d_handler_irq(int pil, struct pt_regs *regs) | 146 | void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs) |
147 | { | 147 | { |
148 | struct pt_regs *old_regs; | 148 | struct pt_regs *old_regs; |
149 | /* SBUS IRQ level (1 - 7) */ | 149 | /* SBUS IRQ level (1 - 7) */ |
@@ -236,7 +236,7 @@ static void sun4d_shutdown_irq(struct irq_data *data) | |||
236 | irq_unlink(data->irq); | 236 | irq_unlink(data->irq); |
237 | } | 237 | } |
238 | 238 | ||
239 | struct irq_chip sun4d_irq = { | 239 | static struct irq_chip sun4d_irq = { |
240 | .name = "sun4d", | 240 | .name = "sun4d", |
241 | .irq_startup = sun4d_startup_irq, | 241 | .irq_startup = sun4d_startup_irq, |
242 | .irq_shutdown = sun4d_shutdown_irq, | 242 | .irq_shutdown = sun4d_shutdown_irq, |
@@ -285,9 +285,9 @@ static void __init sun4d_load_profile_irqs(void) | |||
285 | } | 285 | } |
286 | } | 286 | } |
287 | 287 | ||
288 | unsigned int _sun4d_build_device_irq(unsigned int real_irq, | 288 | static unsigned int _sun4d_build_device_irq(unsigned int real_irq, |
289 | unsigned int pil, | 289 | unsigned int pil, |
290 | unsigned int board) | 290 | unsigned int board) |
291 | { | 291 | { |
292 | struct sun4d_handler_data *handler_data; | 292 | struct sun4d_handler_data *handler_data; |
293 | unsigned int irq; | 293 | unsigned int irq; |
@@ -320,8 +320,8 @@ err_out: | |||
320 | 320 | ||
321 | 321 | ||
322 | 322 | ||
323 | unsigned int sun4d_build_device_irq(struct platform_device *op, | 323 | static unsigned int sun4d_build_device_irq(struct platform_device *op, |
324 | unsigned int real_irq) | 324 | unsigned int real_irq) |
325 | { | 325 | { |
326 | struct device_node *dp = op->dev.of_node; | 326 | struct device_node *dp = op->dev.of_node; |
327 | struct device_node *board_parent, *bus = dp->parent; | 327 | struct device_node *board_parent, *bus = dp->parent; |
@@ -383,7 +383,8 @@ err_out: | |||
383 | return irq; | 383 | return irq; |
384 | } | 384 | } |
385 | 385 | ||
386 | unsigned int sun4d_build_timer_irq(unsigned int board, unsigned int real_irq) | 386 | static unsigned int sun4d_build_timer_irq(unsigned int board, |
387 | unsigned int real_irq) | ||
387 | { | 388 | { |
388 | return _sun4d_build_device_irq(real_irq, real_irq, board); | 389 | return _sun4d_build_device_irq(real_irq, real_irq, board); |
389 | } | 390 | } |
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c index 71368850dfc0..022c30c72ebd 100644 --- a/arch/sparc/kernel/sys_sparc32.c +++ b/arch/sparc/kernel/sys_sparc32.c | |||
@@ -49,6 +49,8 @@ | |||
49 | #include <asm/mmu_context.h> | 49 | #include <asm/mmu_context.h> |
50 | #include <asm/compat_signal.h> | 50 | #include <asm/compat_signal.h> |
51 | 51 | ||
52 | #include "systbls.h" | ||
53 | |||
52 | asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) | 54 | asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) |
53 | { | 55 | { |
54 | if ((int)high < 0) | 56 | if ((int)high < 0) |
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c index 3a8d1844402e..646988d4c1a3 100644 --- a/arch/sparc/kernel/sys_sparc_32.c +++ b/arch/sparc/kernel/sys_sparc_32.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
25 | #include <asm/unistd.h> | 25 | #include <asm/unistd.h> |
26 | 26 | ||
27 | #include "systbls.h" | ||
28 | |||
27 | /* #define DEBUG_UNIMP_SYSCALL */ | 29 | /* #define DEBUG_UNIMP_SYSCALL */ |
28 | 30 | ||
29 | /* XXX Make this per-binary type, this way we can detect the type of | 31 | /* XXX Make this per-binary type, this way we can detect the type of |
@@ -68,7 +70,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi | |||
68 | * sys_pipe() is the normal C calling standard for creating | 70 | * sys_pipe() is the normal C calling standard for creating |
69 | * a pipe. It's not the way unix traditionally does this, though. | 71 | * a pipe. It's not the way unix traditionally does this, though. |
70 | */ | 72 | */ |
71 | asmlinkage int sparc_pipe(struct pt_regs *regs) | 73 | asmlinkage long sparc_pipe(struct pt_regs *regs) |
72 | { | 74 | { |
73 | int fd[2]; | 75 | int fd[2]; |
74 | int error; | 76 | int error; |
@@ -93,7 +95,7 @@ int sparc_mmap_check(unsigned long addr, unsigned long len) | |||
93 | 95 | ||
94 | /* Linux version of mmap */ | 96 | /* Linux version of mmap */ |
95 | 97 | ||
96 | asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, | 98 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, |
97 | unsigned long prot, unsigned long flags, unsigned long fd, | 99 | unsigned long prot, unsigned long flags, unsigned long fd, |
98 | unsigned long pgoff) | 100 | unsigned long pgoff) |
99 | { | 101 | { |
@@ -103,7 +105,7 @@ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, | |||
103 | pgoff >> (PAGE_SHIFT - 12)); | 105 | pgoff >> (PAGE_SHIFT - 12)); |
104 | } | 106 | } |
105 | 107 | ||
106 | asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, | 108 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, |
107 | unsigned long prot, unsigned long flags, unsigned long fd, | 109 | unsigned long prot, unsigned long flags, unsigned long fd, |
108 | unsigned long off) | 110 | unsigned long off) |
109 | { | 111 | { |
@@ -197,7 +199,7 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig, | |||
197 | return ret; | 199 | return ret; |
198 | } | 200 | } |
199 | 201 | ||
200 | asmlinkage int sys_getdomainname(char __user *name, int len) | 202 | asmlinkage long sys_getdomainname(char __user *name, int len) |
201 | { | 203 | { |
202 | int nlen, err; | 204 | int nlen, err; |
203 | 205 | ||
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index beb0b5a5f21f..c85403d0496c 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <asm/unistd.h> | 31 | #include <asm/unistd.h> |
32 | 32 | ||
33 | #include "entry.h" | 33 | #include "entry.h" |
34 | #include "kernel.h" | ||
34 | #include "systbls.h" | 35 | #include "systbls.h" |
35 | 36 | ||
36 | /* #define DEBUG_UNIMP_SYSCALL */ | 37 | /* #define DEBUG_UNIMP_SYSCALL */ |
diff --git a/arch/sparc/kernel/systbls.h b/arch/sparc/kernel/systbls.h index 26e6dd72e92a..2dab8236d490 100644 --- a/arch/sparc/kernel/systbls.h +++ b/arch/sparc/kernel/systbls.h | |||
@@ -1,41 +1,103 @@ | |||
1 | #ifndef _SYSTBLS_H | 1 | #ifndef _SYSTBLS_H |
2 | #define _SYSTBLS_H | 2 | #define _SYSTBLS_H |
3 | 3 | ||
4 | #include <linux/signal.h> | ||
4 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/compat.h> | ||
5 | #include <linux/types.h> | 7 | #include <linux/types.h> |
6 | #include <linux/signal.h> | 8 | |
7 | #include <asm/utrap.h> | 9 | #include <asm/utrap.h> |
8 | 10 | ||
9 | extern asmlinkage unsigned long sys_getpagesize(void); | 11 | asmlinkage unsigned long sys_getpagesize(void); |
10 | extern asmlinkage long sparc_pipe(struct pt_regs *regs); | 12 | asmlinkage long sparc_pipe(struct pt_regs *regs); |
11 | extern asmlinkage long sys_sparc_ipc(unsigned int call, int first, | 13 | asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs); |
12 | unsigned long second, | 14 | asmlinkage long sys_getdomainname(char __user *name, int len); |
13 | unsigned long third, | 15 | void do_rt_sigreturn(struct pt_regs *regs); |
14 | void __user *ptr, long fifth); | 16 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, |
15 | extern asmlinkage long sparc64_personality(unsigned long personality); | 17 | unsigned long prot, unsigned long flags, |
16 | extern asmlinkage long sys64_munmap(unsigned long addr, size_t len); | 18 | unsigned long fd, unsigned long off); |
17 | extern asmlinkage unsigned long sys64_mremap(unsigned long addr, | 19 | asmlinkage void sparc_breakpoint(struct pt_regs *regs); |
18 | unsigned long old_len, | 20 | |
19 | unsigned long new_len, | 21 | #ifdef CONFIG_SPARC32 |
20 | unsigned long flags, | 22 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, |
21 | unsigned long new_addr); | 23 | unsigned long prot, unsigned long flags, |
22 | extern asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs); | 24 | unsigned long fd, unsigned long pgoff); |
23 | extern asmlinkage long sys_getdomainname(char __user *name, int len); | 25 | long sparc_remap_file_pages(unsigned long start, unsigned long size, |
24 | extern asmlinkage long sys_utrap_install(utrap_entry_t type, | 26 | unsigned long prot, unsigned long pgoff, |
25 | utrap_handler_t new_p, | 27 | unsigned long flags); |
26 | utrap_handler_t new_d, | ||
27 | utrap_handler_t __user *old_p, | ||
28 | utrap_handler_t __user *old_d); | ||
29 | extern asmlinkage long sparc_memory_ordering(unsigned long model, | ||
30 | struct pt_regs *regs); | ||
31 | extern asmlinkage long sys_rt_sigaction(int sig, | ||
32 | const struct sigaction __user *act, | ||
33 | struct sigaction __user *oact, | ||
34 | void __user *restorer, | ||
35 | size_t sigsetsize); | ||
36 | 28 | ||
37 | extern asmlinkage void sparc64_set_context(struct pt_regs *regs); | 29 | #endif /* CONFIG_SPARC32 */ |
38 | extern asmlinkage void sparc64_get_context(struct pt_regs *regs); | ||
39 | extern void do_rt_sigreturn(struct pt_regs *regs); | ||
40 | 30 | ||
31 | #ifdef CONFIG_SPARC64 | ||
32 | asmlinkage long sys_sparc_ipc(unsigned int call, int first, | ||
33 | unsigned long second, | ||
34 | unsigned long third, | ||
35 | void __user *ptr, long fifth); | ||
36 | asmlinkage long sparc64_personality(unsigned long personality); | ||
37 | asmlinkage long sys64_munmap(unsigned long addr, size_t len); | ||
38 | asmlinkage unsigned long sys64_mremap(unsigned long addr, | ||
39 | unsigned long old_len, | ||
40 | unsigned long new_len, | ||
41 | unsigned long flags, | ||
42 | unsigned long new_addr); | ||
43 | asmlinkage long sys_utrap_install(utrap_entry_t type, | ||
44 | utrap_handler_t new_p, | ||
45 | utrap_handler_t new_d, | ||
46 | utrap_handler_t __user *old_p, | ||
47 | utrap_handler_t __user *old_d); | ||
48 | asmlinkage long sparc_memory_ordering(unsigned long model, | ||
49 | struct pt_regs *regs); | ||
50 | asmlinkage void sparc64_set_context(struct pt_regs *regs); | ||
51 | asmlinkage void sparc64_get_context(struct pt_regs *regs); | ||
52 | asmlinkage long sys32_truncate64(const char __user * path, | ||
53 | unsigned long high, | ||
54 | unsigned long low); | ||
55 | asmlinkage long sys32_ftruncate64(unsigned int fd, | ||
56 | unsigned long high, | ||
57 | unsigned long low); | ||
58 | struct compat_stat64; | ||
59 | asmlinkage long compat_sys_stat64(const char __user * filename, | ||
60 | struct compat_stat64 __user *statbuf); | ||
61 | asmlinkage long compat_sys_lstat64(const char __user * filename, | ||
62 | struct compat_stat64 __user *statbuf); | ||
63 | asmlinkage long compat_sys_fstat64(unsigned int fd, | ||
64 | struct compat_stat64 __user * statbuf); | ||
65 | asmlinkage long compat_sys_fstatat64(unsigned int dfd, | ||
66 | const char __user *filename, | ||
67 | struct compat_stat64 __user * statbuf, int flag); | ||
68 | asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, | ||
69 | char __user *ubuf, | ||
70 | compat_size_t count, | ||
71 | unsigned long poshi, | ||
72 | unsigned long poslo); | ||
73 | asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, | ||
74 | char __user *ubuf, | ||
75 | compat_size_t count, | ||
76 | unsigned long poshi, | ||
77 | unsigned long poslo); | ||
78 | asmlinkage long compat_sys_readahead(int fd, | ||
79 | unsigned long offhi, | ||
80 | unsigned long offlo, | ||
81 | compat_size_t count); | ||
82 | long compat_sys_fadvise64(int fd, | ||
83 | unsigned long offhi, | ||
84 | unsigned long offlo, | ||
85 | compat_size_t len, int advice); | ||
86 | long compat_sys_fadvise64_64(int fd, | ||
87 | unsigned long offhi, unsigned long offlo, | ||
88 | unsigned long lenhi, unsigned long lenlo, | ||
89 | int advice); | ||
90 | long sys32_sync_file_range(unsigned int fd, | ||
91 | unsigned long off_high, unsigned long off_low, | ||
92 | unsigned long nb_high, unsigned long nb_low, | ||
93 | unsigned int flags); | ||
94 | asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo, | ||
95 | u32 lenhi, u32 lenlo); | ||
96 | asmlinkage long compat_sys_fstat64(unsigned int fd, | ||
97 | struct compat_stat64 __user * statbuf); | ||
98 | asmlinkage long compat_sys_fstatat64(unsigned int dfd, | ||
99 | const char __user *filename, | ||
100 | struct compat_stat64 __user * statbuf, | ||
101 | int flag); | ||
102 | #endif /* CONFIG_SPARC64 */ | ||
41 | #endif /* _SYSTBLS_H */ | 103 | #endif /* _SYSTBLS_H */ |
diff --git a/arch/sparc/kernel/tadpole.c b/arch/sparc/kernel/tadpole.c deleted file mode 100644 index 9aba8bd5a78b..000000000000 --- a/arch/sparc/kernel/tadpole.c +++ /dev/null | |||
@@ -1,126 +0,0 @@ | |||
1 | /* tadpole.c: Probing for the tadpole clock stopping h/w at boot time. | ||
2 | * | ||
3 | * Copyright (C) 1996 David Redman (djhr@tadpole.co.uk) | ||
4 | */ | ||
5 | |||
6 | #include <linux/string.h> | ||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/sched.h> | ||
9 | #include <linux/init.h> | ||
10 | |||
11 | #include <asm/asi.h> | ||
12 | #include <asm/oplib.h> | ||
13 | #include <asm/io.h> | ||
14 | |||
15 | #define MACIO_SCSI_CSR_ADDR 0x78400000 | ||
16 | #define MACIO_EN_DMA 0x00000200 | ||
17 | #define CLOCK_INIT_DONE 1 | ||
18 | |||
19 | static int clk_state; | ||
20 | static volatile unsigned char *clk_ctrl; | ||
21 | void (*cpu_pwr_save)(void); | ||
22 | |||
23 | static inline unsigned int ldphys(unsigned int addr) | ||
24 | { | ||
25 | unsigned long data; | ||
26 | |||
27 | __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" : | ||
28 | "=r" (data) : | ||
29 | "r" (addr), "i" (ASI_M_BYPASS)); | ||
30 | return data; | ||
31 | } | ||
32 | |||
33 | static void clk_init(void) | ||
34 | { | ||
35 | __asm__ __volatile__("mov 0x6c, %%g1\n\t" | ||
36 | "mov 0x4c, %%g2\n\t" | ||
37 | "mov 0xdf, %%g3\n\t" | ||
38 | "stb %%g1, [%0+3]\n\t" | ||
39 | "stb %%g2, [%0+3]\n\t" | ||
40 | "stb %%g3, [%0+3]\n\t" : : | ||
41 | "r" (clk_ctrl) : | ||
42 | "g1", "g2", "g3"); | ||
43 | } | ||
44 | |||
45 | static void clk_slow(void) | ||
46 | { | ||
47 | __asm__ __volatile__("mov 0xcc, %%g2\n\t" | ||
48 | "mov 0x4c, %%g3\n\t" | ||
49 | "mov 0xcf, %%g4\n\t" | ||
50 | "mov 0xdf, %%g5\n\t" | ||
51 | "stb %%g2, [%0+3]\n\t" | ||
52 | "stb %%g3, [%0+3]\n\t" | ||
53 | "stb %%g4, [%0+3]\n\t" | ||
54 | "stb %%g5, [%0+3]\n\t" : : | ||
55 | "r" (clk_ctrl) : | ||
56 | "g2", "g3", "g4", "g5"); | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | * Tadpole is guaranteed to be UP, using local_irq_save. | ||
61 | */ | ||
62 | static void tsu_clockstop(void) | ||
63 | { | ||
64 | unsigned int mcsr; | ||
65 | unsigned long flags; | ||
66 | |||
67 | if (!clk_ctrl) | ||
68 | return; | ||
69 | if (!(clk_state & CLOCK_INIT_DONE)) { | ||
70 | local_irq_save(flags); | ||
71 | clk_init(); | ||
72 | clk_state |= CLOCK_INIT_DONE; /* all done */ | ||
73 | local_irq_restore(flags); | ||
74 | return; | ||
75 | } | ||
76 | if (!(clk_ctrl[2] & 1)) | ||
77 | return; /* no speed up yet */ | ||
78 | |||
79 | local_irq_save(flags); | ||
80 | |||
81 | /* if SCSI DMA in progress, don't slow clock */ | ||
82 | mcsr = ldphys(MACIO_SCSI_CSR_ADDR); | ||
83 | if ((mcsr&MACIO_EN_DMA) != 0) { | ||
84 | local_irq_restore(flags); | ||
85 | return; | ||
86 | } | ||
87 | /* TODO... the minimum clock setting ought to increase the | ||
88 | * memory refresh interval.. | ||
89 | */ | ||
90 | clk_slow(); | ||
91 | local_irq_restore(flags); | ||
92 | } | ||
93 | |||
94 | static void swift_clockstop(void) | ||
95 | { | ||
96 | if (!clk_ctrl) | ||
97 | return; | ||
98 | clk_ctrl[0] = 0; | ||
99 | } | ||
100 | |||
101 | void __init clock_stop_probe(void) | ||
102 | { | ||
103 | phandle node, clk_nd; | ||
104 | char name[20]; | ||
105 | |||
106 | prom_getstring(prom_root_node, "name", name, sizeof(name)); | ||
107 | if (strncmp(name, "Tadpole", 7)) | ||
108 | return; | ||
109 | node = prom_getchild(prom_root_node); | ||
110 | node = prom_searchsiblings(node, "obio"); | ||
111 | node = prom_getchild(node); | ||
112 | clk_nd = prom_searchsiblings(node, "clk-ctrl"); | ||
113 | if (!clk_nd) | ||
114 | return; | ||
115 | printk("Clock Stopping h/w detected... "); | ||
116 | clk_ctrl = (char *) prom_getint(clk_nd, "address"); | ||
117 | clk_state = 0; | ||
118 | if (name[10] == '\0') { | ||
119 | cpu_pwr_save = tsu_clockstop; | ||
120 | printk("enabled (S3)\n"); | ||
121 | } else if ((name[10] == 'X') || (name[10] == 'G')) { | ||
122 | cpu_pwr_save = swift_clockstop; | ||
123 | printk("enabled (%s)\n",name+7); | ||
124 | } else | ||
125 | printk("disabled %s\n",name+7); | ||
126 | } | ||
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c index c4c27b0f9063..5923d1e4e7c9 100644 --- a/arch/sparc/kernel/time_32.c +++ b/arch/sparc/kernel/time_32.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/of_device.h> | 36 | #include <linux/of_device.h> |
37 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
38 | 38 | ||
39 | #include <asm/mc146818rtc.h> | ||
39 | #include <asm/oplib.h> | 40 | #include <asm/oplib.h> |
40 | #include <asm/timex.h> | 41 | #include <asm/timex.h> |
41 | #include <asm/timer.h> | 42 | #include <asm/timer.h> |
@@ -47,6 +48,7 @@ | |||
47 | #include <asm/irq_regs.h> | 48 | #include <asm/irq_regs.h> |
48 | #include <asm/setup.h> | 49 | #include <asm/setup.h> |
49 | 50 | ||
51 | #include "kernel.h" | ||
50 | #include "irq.h" | 52 | #include "irq.h" |
51 | 53 | ||
52 | static __cacheline_aligned_in_smp DEFINE_SEQLOCK(timer_cs_lock); | 54 | static __cacheline_aligned_in_smp DEFINE_SEQLOCK(timer_cs_lock); |
@@ -83,7 +85,7 @@ unsigned long profile_pc(struct pt_regs *regs) | |||
83 | 85 | ||
84 | EXPORT_SYMBOL(profile_pc); | 86 | EXPORT_SYMBOL(profile_pc); |
85 | 87 | ||
86 | __volatile__ unsigned int *master_l10_counter; | 88 | volatile u32 __iomem *master_l10_counter; |
87 | 89 | ||
88 | int update_persistent_clock(struct timespec now) | 90 | int update_persistent_clock(struct timespec now) |
89 | { | 91 | { |
@@ -143,9 +145,9 @@ static __init void setup_timer_ce(void) | |||
143 | 145 | ||
144 | static unsigned int sbus_cycles_offset(void) | 146 | static unsigned int sbus_cycles_offset(void) |
145 | { | 147 | { |
146 | unsigned int val, offset; | 148 | u32 val, offset; |
147 | 149 | ||
148 | val = *master_l10_counter; | 150 | val = sbus_readl(master_l10_counter); |
149 | offset = (val >> TIMER_VALUE_SHIFT) & TIMER_VALUE_MASK; | 151 | offset = (val >> TIMER_VALUE_SHIFT) & TIMER_VALUE_MASK; |
150 | 152 | ||
151 | /* Limit hit? */ | 153 | /* Limit hit? */ |
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c index 662982946a89..6fd386c5232a 100644 --- a/arch/sparc/kernel/traps_32.c +++ b/arch/sparc/kernel/traps_32.c | |||
@@ -44,7 +44,7 @@ static void instruction_dump(unsigned long *pc) | |||
44 | #define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t") | 44 | #define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t") |
45 | #define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t") | 45 | #define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t") |
46 | 46 | ||
47 | void die_if_kernel(char *str, struct pt_regs *regs) | 47 | void __noreturn die_if_kernel(char *str, struct pt_regs *regs) |
48 | { | 48 | { |
49 | static int die_counter; | 49 | static int die_counter; |
50 | int count = 0; | 50 | int count = 0; |
@@ -219,8 +219,6 @@ static unsigned long fake_fsr; | |||
219 | static unsigned long fake_queue[32] __attribute__ ((aligned (8))); | 219 | static unsigned long fake_queue[32] __attribute__ ((aligned (8))); |
220 | static unsigned long fake_depth; | 220 | static unsigned long fake_depth; |
221 | 221 | ||
222 | extern int do_mathemu(struct pt_regs *, struct task_struct *); | ||
223 | |||
224 | void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc, | 222 | void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc, |
225 | unsigned long psr) | 223 | unsigned long psr) |
226 | { | 224 | { |
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c index 4ced92f05358..fb6640ec8557 100644 --- a/arch/sparc/kernel/traps_64.c +++ b/arch/sparc/kernel/traps_64.c | |||
@@ -43,8 +43,10 @@ | |||
43 | #include <asm/prom.h> | 43 | #include <asm/prom.h> |
44 | #include <asm/memctrl.h> | 44 | #include <asm/memctrl.h> |
45 | #include <asm/cacheflush.h> | 45 | #include <asm/cacheflush.h> |
46 | #include <asm/setup.h> | ||
46 | 47 | ||
47 | #include "entry.h" | 48 | #include "entry.h" |
49 | #include "kernel.h" | ||
48 | #include "kstack.h" | 50 | #include "kstack.h" |
49 | 51 | ||
50 | /* When an irrecoverable trap occurs at tl > 0, the trap entry | 52 | /* When an irrecoverable trap occurs at tl > 0, the trap entry |
@@ -2209,8 +2211,6 @@ out: | |||
2209 | exception_exit(prev_state); | 2211 | exception_exit(prev_state); |
2210 | } | 2212 | } |
2211 | 2213 | ||
2212 | extern int do_mathemu(struct pt_regs *, struct fpustate *, bool); | ||
2213 | |||
2214 | void do_fpother(struct pt_regs *regs) | 2214 | void do_fpother(struct pt_regs *regs) |
2215 | { | 2215 | { |
2216 | enum ctx_state prev_state = exception_enter(); | 2216 | enum ctx_state prev_state = exception_enter(); |
@@ -2383,7 +2383,7 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw) | |||
2383 | return (struct reg_window *) (fp + STACK_BIAS); | 2383 | return (struct reg_window *) (fp + STACK_BIAS); |
2384 | } | 2384 | } |
2385 | 2385 | ||
2386 | void die_if_kernel(char *str, struct pt_regs *regs) | 2386 | void __noreturn die_if_kernel(char *str, struct pt_regs *regs) |
2387 | { | 2387 | { |
2388 | static int die_counter; | 2388 | static int die_counter; |
2389 | int count = 0; | 2389 | int count = 0; |
@@ -2433,9 +2433,6 @@ EXPORT_SYMBOL(die_if_kernel); | |||
2433 | #define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19)) | 2433 | #define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19)) |
2434 | #define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19)) | 2434 | #define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19)) |
2435 | 2435 | ||
2436 | extern int handle_popc(u32 insn, struct pt_regs *regs); | ||
2437 | extern int handle_ldf_stq(u32 insn, struct pt_regs *regs); | ||
2438 | |||
2439 | void do_illegal_instruction(struct pt_regs *regs) | 2436 | void do_illegal_instruction(struct pt_regs *regs) |
2440 | { | 2437 | { |
2441 | enum ctx_state prev_state = exception_enter(); | 2438 | enum ctx_state prev_state = exception_enter(); |
@@ -2486,8 +2483,6 @@ out: | |||
2486 | exception_exit(prev_state); | 2483 | exception_exit(prev_state); |
2487 | } | 2484 | } |
2488 | 2485 | ||
2489 | extern void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn); | ||
2490 | |||
2491 | void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) | 2486 | void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) |
2492 | { | 2487 | { |
2493 | enum ctx_state prev_state = exception_enter(); | 2488 | enum ctx_state prev_state = exception_enter(); |
diff --git a/arch/sparc/kernel/unaligned_32.c b/arch/sparc/kernel/unaligned_32.c index c0ec89786193..c5c61b3c6b56 100644 --- a/arch/sparc/kernel/unaligned_32.c +++ b/arch/sparc/kernel/unaligned_32.c | |||
@@ -16,6 +16,10 @@ | |||
16 | #include <linux/smp.h> | 16 | #include <linux/smp.h> |
17 | #include <linux/perf_event.h> | 17 | #include <linux/perf_event.h> |
18 | 18 | ||
19 | #include <asm/setup.h> | ||
20 | |||
21 | #include "kernel.h" | ||
22 | |||
19 | enum direction { | 23 | enum direction { |
20 | load, /* ld, ldd, ldh, ldsh */ | 24 | load, /* ld, ldd, ldh, ldsh */ |
21 | store, /* st, std, sth, stsh */ | 25 | store, /* st, std, sth, stsh */ |
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c index 35ab8b60d256..62098a89bbbf 100644 --- a/arch/sparc/kernel/unaligned_64.c +++ b/arch/sparc/kernel/unaligned_64.c | |||
@@ -24,8 +24,10 @@ | |||
24 | #include <linux/context_tracking.h> | 24 | #include <linux/context_tracking.h> |
25 | #include <asm/fpumacro.h> | 25 | #include <asm/fpumacro.h> |
26 | #include <asm/cacheflush.h> | 26 | #include <asm/cacheflush.h> |
27 | #include <asm/setup.h> | ||
27 | 28 | ||
28 | #include "entry.h" | 29 | #include "entry.h" |
30 | #include "kernel.h" | ||
29 | 31 | ||
30 | enum direction { | 32 | enum direction { |
31 | load, /* ld, ldd, ldh, ldsh */ | 33 | load, /* ld, ldd, ldh, ldsh */ |
diff --git a/arch/sparc/kernel/windows.c b/arch/sparc/kernel/windows.c index 3107381e576d..87bab0a3857a 100644 --- a/arch/sparc/kernel/windows.c +++ b/arch/sparc/kernel/windows.c | |||
@@ -10,8 +10,11 @@ | |||
10 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
11 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
12 | 12 | ||
13 | #include <asm/cacheflush.h> | ||
13 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
14 | 15 | ||
16 | #include "kernel.h" | ||
17 | |||
15 | /* Do save's until all user register windows are out of the cpu. */ | 18 | /* Do save's until all user register windows are out of the cpu. */ |
16 | void flush_user_windows(void) | 19 | void flush_user_windows(void) |
17 | { | 20 | { |
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index dbe119b63b48..3269b0234093 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile | |||
@@ -41,7 +41,7 @@ lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o | |||
41 | lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o | 41 | lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o |
42 | lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o | 42 | lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o |
43 | 43 | ||
44 | obj-y += iomap.o | 44 | obj-$(CONFIG_SPARC64) += iomap.o |
45 | obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o | 45 | obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o |
46 | obj-y += ksyms.o | 46 | obj-y += ksyms.o |
47 | obj-$(CONFIG_SPARC64) += PeeCeeI.o | 47 | obj-$(CONFIG_SPARC64) += PeeCeeI.o |
diff --git a/arch/sparc/math-emu/sfp-util_32.h b/arch/sparc/math-emu/sfp-util_32.h index d1b2aff3c259..bb587d5f3d9d 100644 --- a/arch/sparc/math-emu/sfp-util_32.h +++ b/arch/sparc/math-emu/sfp-util_32.h | |||
@@ -4,20 +4,20 @@ | |||
4 | #include <asm/byteorder.h> | 4 | #include <asm/byteorder.h> |
5 | 5 | ||
6 | #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ | 6 | #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ |
7 | __asm__ ("addcc %r4,%5,%1\n\t" \ | 7 | __asm__ ("addcc %r4,%5,%1\n\t" \ |
8 | "addx %r2,%3,%0\n" \ | 8 | "addx %r2,%3,%0\n" \ |
9 | : "=r" ((USItype)(sh)), \ | 9 | : "=r" (sh), \ |
10 | "=&r" ((USItype)(sl)) \ | 10 | "=&r" (sl) \ |
11 | : "%rJ" ((USItype)(ah)), \ | 11 | : "%rJ" ((USItype)(ah)), \ |
12 | "rI" ((USItype)(bh)), \ | 12 | "rI" ((USItype)(bh)), \ |
13 | "%rJ" ((USItype)(al)), \ | 13 | "%rJ" ((USItype)(al)), \ |
14 | "rI" ((USItype)(bl)) \ | 14 | "rI" ((USItype)(bl)) \ |
15 | : "cc") | 15 | : "cc") |
16 | #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ | 16 | #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ |
17 | __asm__ ("subcc %r4,%5,%1\n\t" \ | 17 | __asm__ ("subcc %r4,%5,%1\n\t" \ |
18 | "subx %r2,%3,%0\n" \ | 18 | "subx %r2,%3,%0\n" \ |
19 | : "=r" ((USItype)(sh)), \ | 19 | : "=r" (sh), \ |
20 | "=&r" ((USItype)(sl)) \ | 20 | "=&r" (sl) \ |
21 | : "rJ" ((USItype)(ah)), \ | 21 | : "rJ" ((USItype)(ah)), \ |
22 | "rI" ((USItype)(bh)), \ | 22 | "rI" ((USItype)(bh)), \ |
23 | "rJ" ((USItype)(al)), \ | 23 | "rJ" ((USItype)(al)), \ |
@@ -65,8 +65,8 @@ | |||
65 | "mulscc %%g1,0,%%g1\n\t" \ | 65 | "mulscc %%g1,0,%%g1\n\t" \ |
66 | "add %%g1,%%g2,%0\n\t" \ | 66 | "add %%g1,%%g2,%0\n\t" \ |
67 | "rd %%y,%1\n" \ | 67 | "rd %%y,%1\n" \ |
68 | : "=r" ((USItype)(w1)), \ | 68 | : "=r" (w1), \ |
69 | "=r" ((USItype)(w0)) \ | 69 | "=r" (w0) \ |
70 | : "%rI" ((USItype)(u)), \ | 70 | : "%rI" ((USItype)(u)), \ |
71 | "r" ((USItype)(v)) \ | 71 | "r" ((USItype)(v)) \ |
72 | : "%g1", "%g2", "cc") | 72 | : "%g1", "%g2", "cc") |
@@ -98,8 +98,8 @@ | |||
98 | "sub %1,%2,%1\n\t" \ | 98 | "sub %1,%2,%1\n\t" \ |
99 | "3: xnor %0,0,%0\n\t" \ | 99 | "3: xnor %0,0,%0\n\t" \ |
100 | "! End of inline udiv_qrnnd\n" \ | 100 | "! End of inline udiv_qrnnd\n" \ |
101 | : "=&r" ((USItype)(q)), \ | 101 | : "=&r" (q), \ |
102 | "=&r" ((USItype)(r)) \ | 102 | "=&r" (r) \ |
103 | : "r" ((USItype)(d)), \ | 103 | : "r" ((USItype)(d)), \ |
104 | "1" ((USItype)(n1)), \ | 104 | "1" ((USItype)(n1)), \ |
105 | "0" ((USItype)(n0)) : "%g1", "cc") | 105 | "0" ((USItype)(n0)) : "%g1", "cc") |
diff --git a/arch/sparc/math-emu/sfp-util_64.h b/arch/sparc/math-emu/sfp-util_64.h index 425d3cf01af4..51320a861cc2 100644 --- a/arch/sparc/math-emu/sfp-util_64.h +++ b/arch/sparc/math-emu/sfp-util_64.h | |||
@@ -17,8 +17,8 @@ | |||
17 | "bcs,a,pn %%xcc, 1f\n\t" \ | 17 | "bcs,a,pn %%xcc, 1f\n\t" \ |
18 | "add %0, 1, %0\n" \ | 18 | "add %0, 1, %0\n" \ |
19 | "1:" \ | 19 | "1:" \ |
20 | : "=r" ((UDItype)(sh)), \ | 20 | : "=r" (sh), \ |
21 | "=&r" ((UDItype)(sl)) \ | 21 | "=&r" (sl) \ |
22 | : "r" ((UDItype)(ah)), \ | 22 | : "r" ((UDItype)(ah)), \ |
23 | "r" ((UDItype)(bh)), \ | 23 | "r" ((UDItype)(bh)), \ |
24 | "r" ((UDItype)(al)), \ | 24 | "r" ((UDItype)(al)), \ |
@@ -31,8 +31,8 @@ | |||
31 | "bcs,a,pn %%xcc, 1f\n\t" \ | 31 | "bcs,a,pn %%xcc, 1f\n\t" \ |
32 | "sub %0, 1, %0\n" \ | 32 | "sub %0, 1, %0\n" \ |
33 | "1:" \ | 33 | "1:" \ |
34 | : "=r" ((UDItype)(sh)), \ | 34 | : "=r" (sh), \ |
35 | "=&r" ((UDItype)(sl)) \ | 35 | "=&r" (sl) \ |
36 | : "r" ((UDItype)(ah)), \ | 36 | : "r" ((UDItype)(ah)), \ |
37 | "r" ((UDItype)(bh)), \ | 37 | "r" ((UDItype)(bh)), \ |
38 | "r" ((UDItype)(al)), \ | 38 | "r" ((UDItype)(al)), \ |
@@ -64,8 +64,8 @@ | |||
64 | "sllx %3,32,%3\n\t" \ | 64 | "sllx %3,32,%3\n\t" \ |
65 | "add %1,%3,%1\n\t" \ | 65 | "add %1,%3,%1\n\t" \ |
66 | "add %5,%2,%0" \ | 66 | "add %5,%2,%0" \ |
67 | : "=r" ((UDItype)(wh)), \ | 67 | : "=r" (wh), \ |
68 | "=&r" ((UDItype)(wl)), \ | 68 | "=&r" (wl), \ |
69 | "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \ | 69 | "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \ |
70 | : "r" ((UDItype)(u)), \ | 70 | : "r" ((UDItype)(u)), \ |
71 | "r" ((UDItype)(v)) \ | 71 | "r" ((UDItype)(v)) \ |
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c index 59dbd4645725..908e8c17c902 100644 --- a/arch/sparc/mm/fault_32.c +++ b/arch/sparc/mm/fault_32.c | |||
@@ -26,14 +26,14 @@ | |||
26 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
27 | #include <asm/openprom.h> | 27 | #include <asm/openprom.h> |
28 | #include <asm/oplib.h> | 28 | #include <asm/oplib.h> |
29 | #include <asm/setup.h> | ||
29 | #include <asm/smp.h> | 30 | #include <asm/smp.h> |
30 | #include <asm/traps.h> | 31 | #include <asm/traps.h> |
31 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
32 | 33 | ||
33 | int show_unhandled_signals = 1; | 34 | #include "mm_32.h" |
34 | 35 | ||
35 | static void unhandled_fault(unsigned long, struct task_struct *, | 36 | int show_unhandled_signals = 1; |
36 | struct pt_regs *) __attribute__ ((noreturn)); | ||
37 | 37 | ||
38 | static void __noreturn unhandled_fault(unsigned long address, | 38 | static void __noreturn unhandled_fault(unsigned long address, |
39 | struct task_struct *tsk, | 39 | struct task_struct *tsk, |
@@ -141,9 +141,6 @@ static void __do_fault_siginfo(int code, int sig, struct pt_regs *regs, | |||
141 | force_sig_info (sig, &info, current); | 141 | force_sig_info (sig, &info, current); |
142 | } | 142 | } |
143 | 143 | ||
144 | extern unsigned long safe_compute_effective_address(struct pt_regs *, | ||
145 | unsigned int); | ||
146 | |||
147 | static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault) | 144 | static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault) |
148 | { | 145 | { |
149 | unsigned int insn; | 146 | unsigned int insn; |
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c index 4ced3fc66130..587cd0565128 100644 --- a/arch/sparc/mm/fault_64.c +++ b/arch/sparc/mm/fault_64.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/lsu.h> | 32 | #include <asm/lsu.h> |
33 | #include <asm/sections.h> | 33 | #include <asm/sections.h> |
34 | #include <asm/mmu_context.h> | 34 | #include <asm/mmu_context.h> |
35 | #include <asm/setup.h> | ||
35 | 36 | ||
36 | int show_unhandled_signals = 1; | 37 | int show_unhandled_signals = 1; |
37 | 38 | ||
@@ -196,9 +197,6 @@ static void do_fault_siginfo(int code, int sig, struct pt_regs *regs, | |||
196 | force_sig_info(sig, &info, current); | 197 | force_sig_info(sig, &info, current); |
197 | } | 198 | } |
198 | 199 | ||
199 | extern int handle_ldf_stq(u32, struct pt_regs *); | ||
200 | extern int handle_ld_nf(u32, struct pt_regs *); | ||
201 | |||
202 | static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn) | 200 | static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn) |
203 | { | 201 | { |
204 | if (!insn) { | 202 | if (!insn) { |
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index db6987082805..eb8287155279 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c | |||
@@ -31,10 +31,13 @@ | |||
31 | #include <asm/pgtable.h> | 31 | #include <asm/pgtable.h> |
32 | #include <asm/vaddrs.h> | 32 | #include <asm/vaddrs.h> |
33 | #include <asm/pgalloc.h> /* bug in asm-generic/tlb.h: check_pgt_cache */ | 33 | #include <asm/pgalloc.h> /* bug in asm-generic/tlb.h: check_pgt_cache */ |
34 | #include <asm/setup.h> | ||
34 | #include <asm/tlb.h> | 35 | #include <asm/tlb.h> |
35 | #include <asm/prom.h> | 36 | #include <asm/prom.h> |
36 | #include <asm/leon.h> | 37 | #include <asm/leon.h> |
37 | 38 | ||
39 | #include "mm_32.h" | ||
40 | |||
38 | unsigned long *sparc_valid_addr_bitmap; | 41 | unsigned long *sparc_valid_addr_bitmap; |
39 | EXPORT_SYMBOL(sparc_valid_addr_bitmap); | 42 | EXPORT_SYMBOL(sparc_valid_addr_bitmap); |
40 | 43 | ||
@@ -63,7 +66,6 @@ void show_mem(unsigned int filter) | |||
63 | } | 66 | } |
64 | 67 | ||
65 | 68 | ||
66 | extern unsigned long cmdline_memory_size; | ||
67 | unsigned long last_valid_pfn; | 69 | unsigned long last_valid_pfn; |
68 | 70 | ||
69 | unsigned long calc_highpages(void) | 71 | unsigned long calc_highpages(void) |
@@ -246,9 +248,6 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) | |||
246 | * init routine based upon the Sun model type on the Sparc. | 248 | * init routine based upon the Sun model type on the Sparc. |
247 | * | 249 | * |
248 | */ | 250 | */ |
249 | extern void srmmu_paging_init(void); | ||
250 | extern void device_scan(void); | ||
251 | |||
252 | void __init paging_init(void) | 251 | void __init paging_init(void) |
253 | { | 252 | { |
254 | srmmu_paging_init(); | 253 | srmmu_paging_init(); |
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index ed3c969a5f4c..16b58ff11e65 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <asm/prom.h> | 47 | #include <asm/prom.h> |
48 | #include <asm/mdesc.h> | 48 | #include <asm/mdesc.h> |
49 | #include <asm/cpudata.h> | 49 | #include <asm/cpudata.h> |
50 | #include <asm/setup.h> | ||
50 | #include <asm/irq.h> | 51 | #include <asm/irq.h> |
51 | 52 | ||
52 | #include "init_64.h" | 53 | #include "init_64.h" |
@@ -794,11 +795,11 @@ struct node_mem_mask { | |||
794 | static struct node_mem_mask node_masks[MAX_NUMNODES]; | 795 | static struct node_mem_mask node_masks[MAX_NUMNODES]; |
795 | static int num_node_masks; | 796 | static int num_node_masks; |
796 | 797 | ||
798 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
799 | |||
797 | int numa_cpu_lookup_table[NR_CPUS]; | 800 | int numa_cpu_lookup_table[NR_CPUS]; |
798 | cpumask_t numa_cpumask_lookup_table[MAX_NUMNODES]; | 801 | cpumask_t numa_cpumask_lookup_table[MAX_NUMNODES]; |
799 | 802 | ||
800 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
801 | |||
802 | struct mdesc_mblock { | 803 | struct mdesc_mblock { |
803 | u64 base; | 804 | u64 base; |
804 | u64 size; | 805 | u64 size; |
@@ -887,17 +888,21 @@ static void __init allocate_node_data(int nid) | |||
887 | 888 | ||
888 | static void init_node_masks_nonnuma(void) | 889 | static void init_node_masks_nonnuma(void) |
889 | { | 890 | { |
891 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
890 | int i; | 892 | int i; |
893 | #endif | ||
891 | 894 | ||
892 | numadbg("Initializing tables for non-numa.\n"); | 895 | numadbg("Initializing tables for non-numa.\n"); |
893 | 896 | ||
894 | node_masks[0].mask = node_masks[0].val = 0; | 897 | node_masks[0].mask = node_masks[0].val = 0; |
895 | num_node_masks = 1; | 898 | num_node_masks = 1; |
896 | 899 | ||
900 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
897 | for (i = 0; i < NR_CPUS; i++) | 901 | for (i = 0; i < NR_CPUS; i++) |
898 | numa_cpu_lookup_table[i] = 0; | 902 | numa_cpu_lookup_table[i] = 0; |
899 | 903 | ||
900 | cpumask_setall(&numa_cpumask_lookup_table[0]); | 904 | cpumask_setall(&numa_cpumask_lookup_table[0]); |
905 | #endif | ||
901 | } | 906 | } |
902 | 907 | ||
903 | #ifdef CONFIG_NEED_MULTIPLE_NODES | 908 | #ifdef CONFIG_NEED_MULTIPLE_NODES |
diff --git a/arch/sparc/mm/init_64.h b/arch/sparc/mm/init_64.h index 5d3782deb403..0668b364f44d 100644 --- a/arch/sparc/mm/init_64.h +++ b/arch/sparc/mm/init_64.h | |||
@@ -21,7 +21,7 @@ extern unsigned int sparc64_highest_unlocked_tlb_ent; | |||
21 | extern unsigned long sparc64_kern_pri_context; | 21 | extern unsigned long sparc64_kern_pri_context; |
22 | extern unsigned long sparc64_kern_pri_nuc_bits; | 22 | extern unsigned long sparc64_kern_pri_nuc_bits; |
23 | extern unsigned long sparc64_kern_sec_context; | 23 | extern unsigned long sparc64_kern_sec_context; |
24 | extern void mmu_info(struct seq_file *m); | 24 | void mmu_info(struct seq_file *m); |
25 | 25 | ||
26 | struct linux_prom_translation { | 26 | struct linux_prom_translation { |
27 | unsigned long virt; | 27 | unsigned long virt; |
@@ -36,7 +36,7 @@ extern unsigned int prom_trans_ents; | |||
36 | /* Exported for SMP bootup purposes. */ | 36 | /* Exported for SMP bootup purposes. */ |
37 | extern unsigned long kern_locked_tte_data; | 37 | extern unsigned long kern_locked_tte_data; |
38 | 38 | ||
39 | extern void prom_world(int enter); | 39 | void prom_world(int enter); |
40 | 40 | ||
41 | #ifdef CONFIG_SPARSEMEM_VMEMMAP | 41 | #ifdef CONFIG_SPARSEMEM_VMEMMAP |
42 | #define VMEMMAP_CHUNK_SHIFT 22 | 42 | #define VMEMMAP_CHUNK_SHIFT 22 |
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index eb99862e9654..f311bf219016 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <asm/dma.h> | 25 | #include <asm/dma.h> |
26 | #include <asm/oplib.h> | 26 | #include <asm/oplib.h> |
27 | 27 | ||
28 | #include "mm_32.h" | ||
29 | |||
28 | /* #define IOUNIT_DEBUG */ | 30 | /* #define IOUNIT_DEBUG */ |
29 | #ifdef IOUNIT_DEBUG | 31 | #ifdef IOUNIT_DEBUG |
30 | #define IOD(x) printk(x) | 32 | #define IOD(x) printk(x) |
@@ -38,7 +40,8 @@ | |||
38 | static void __init iounit_iommu_init(struct platform_device *op) | 40 | static void __init iounit_iommu_init(struct platform_device *op) |
39 | { | 41 | { |
40 | struct iounit_struct *iounit; | 42 | struct iounit_struct *iounit; |
41 | iopte_t *xpt, *xptend; | 43 | iopte_t __iomem *xpt; |
44 | iopte_t __iomem *xptend; | ||
42 | 45 | ||
43 | iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); | 46 | iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); |
44 | if (!iounit) { | 47 | if (!iounit) { |
@@ -62,10 +65,10 @@ static void __init iounit_iommu_init(struct platform_device *op) | |||
62 | op->dev.archdata.iommu = iounit; | 65 | op->dev.archdata.iommu = iounit; |
63 | iounit->page_table = xpt; | 66 | iounit->page_table = xpt; |
64 | spin_lock_init(&iounit->lock); | 67 | spin_lock_init(&iounit->lock); |
65 | 68 | ||
66 | for (xptend = iounit->page_table + (16 * PAGE_SIZE) / sizeof(iopte_t); | 69 | xptend = iounit->page_table + (16 * PAGE_SIZE) / sizeof(iopte_t); |
67 | xpt < xptend;) | 70 | for (; xpt < xptend; xpt++) |
68 | iopte_val(*xpt++) = 0; | 71 | sbus_writel(0, xpt); |
69 | } | 72 | } |
70 | 73 | ||
71 | static int __init iounit_init(void) | 74 | static int __init iounit_init(void) |
@@ -130,7 +133,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan); | |||
130 | vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK); | 133 | vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK); |
131 | for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) { | 134 | for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) { |
132 | set_bit(scan, iounit->bmap); | 135 | set_bit(scan, iounit->bmap); |
133 | iounit->page_table[scan] = iopte; | 136 | sbus_writel(iopte, &iounit->page_table[scan]); |
134 | } | 137 | } |
135 | IOD(("%08lx\n", vaddr)); | 138 | IOD(("%08lx\n", vaddr)); |
136 | return vaddr; | 139 | return vaddr; |
@@ -202,7 +205,7 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon | |||
202 | struct iounit_struct *iounit = dev->archdata.iommu; | 205 | struct iounit_struct *iounit = dev->archdata.iommu; |
203 | unsigned long page, end; | 206 | unsigned long page, end; |
204 | pgprot_t dvma_prot; | 207 | pgprot_t dvma_prot; |
205 | iopte_t *iopte; | 208 | iopte_t __iomem *iopte; |
206 | 209 | ||
207 | *pba = addr; | 210 | *pba = addr; |
208 | 211 | ||
@@ -224,8 +227,8 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon | |||
224 | 227 | ||
225 | i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); | 228 | i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); |
226 | 229 | ||
227 | iopte = (iopte_t *)(iounit->page_table + i); | 230 | iopte = iounit->page_table + i; |
228 | *iopte = MKIOPTE(__pa(page)); | 231 | sbus_writel(MKIOPTE(__pa(page)), iopte); |
229 | } | 232 | } |
230 | addr += PAGE_SIZE; | 233 | addr += PAGE_SIZE; |
231 | va += PAGE_SIZE; | 234 | va += PAGE_SIZE; |
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index 28f96f27c768..491511d37e37 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <asm/iommu.h> | 27 | #include <asm/iommu.h> |
28 | #include <asm/dma.h> | 28 | #include <asm/dma.h> |
29 | 29 | ||
30 | #include "mm_32.h" | ||
31 | |||
30 | /* | 32 | /* |
31 | * This can be sized dynamically, but we will do this | 33 | * This can be sized dynamically, but we will do this |
32 | * only when we have a guidance about actual I/O pressures. | 34 | * only when we have a guidance about actual I/O pressures. |
@@ -37,9 +39,6 @@ | |||
37 | #define IOMMU_NPTES (IOMMU_WINSIZE/PAGE_SIZE) /* 64K PTEs, 256KB */ | 39 | #define IOMMU_NPTES (IOMMU_WINSIZE/PAGE_SIZE) /* 64K PTEs, 256KB */ |
38 | #define IOMMU_ORDER 6 /* 4096 * (1<<6) */ | 40 | #define IOMMU_ORDER 6 /* 4096 * (1<<6) */ |
39 | 41 | ||
40 | /* srmmu.c */ | ||
41 | extern int viking_mxcc_present; | ||
42 | extern int flush_page_for_dma_global; | ||
43 | static int viking_flush; | 42 | static int viking_flush; |
44 | /* viking.S */ | 43 | /* viking.S */ |
45 | extern void viking_flush_page(unsigned long page); | 44 | extern void viking_flush_page(unsigned long page); |
@@ -59,6 +58,8 @@ static void __init sbus_iommu_init(struct platform_device *op) | |||
59 | struct iommu_struct *iommu; | 58 | struct iommu_struct *iommu; |
60 | unsigned int impl, vers; | 59 | unsigned int impl, vers; |
61 | unsigned long *bitmap; | 60 | unsigned long *bitmap; |
61 | unsigned long control; | ||
62 | unsigned long base; | ||
62 | unsigned long tmp; | 63 | unsigned long tmp; |
63 | 64 | ||
64 | iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL); | 65 | iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL); |
@@ -73,12 +74,14 @@ static void __init sbus_iommu_init(struct platform_device *op) | |||
73 | prom_printf("Cannot map IOMMU registers\n"); | 74 | prom_printf("Cannot map IOMMU registers\n"); |
74 | prom_halt(); | 75 | prom_halt(); |
75 | } | 76 | } |
76 | impl = (iommu->regs->control & IOMMU_CTRL_IMPL) >> 28; | 77 | |
77 | vers = (iommu->regs->control & IOMMU_CTRL_VERS) >> 24; | 78 | control = sbus_readl(&iommu->regs->control); |
78 | tmp = iommu->regs->control; | 79 | impl = (control & IOMMU_CTRL_IMPL) >> 28; |
79 | tmp &= ~(IOMMU_CTRL_RNGE); | 80 | vers = (control & IOMMU_CTRL_VERS) >> 24; |
80 | tmp |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); | 81 | control &= ~(IOMMU_CTRL_RNGE); |
81 | iommu->regs->control = tmp; | 82 | control |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); |
83 | sbus_writel(control, &iommu->regs->control); | ||
84 | |||
82 | iommu_invalidate(iommu->regs); | 85 | iommu_invalidate(iommu->regs); |
83 | iommu->start = IOMMU_START; | 86 | iommu->start = IOMMU_START; |
84 | iommu->end = 0xffffffff; | 87 | iommu->end = 0xffffffff; |
@@ -100,7 +103,9 @@ static void __init sbus_iommu_init(struct platform_device *op) | |||
100 | memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t)); | 103 | memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t)); |
101 | flush_cache_all(); | 104 | flush_cache_all(); |
102 | flush_tlb_all(); | 105 | flush_tlb_all(); |
103 | iommu->regs->base = __pa((unsigned long) iommu->page_table) >> 4; | 106 | |
107 | base = __pa((unsigned long)iommu->page_table) >> 4; | ||
108 | sbus_writel(base, &iommu->regs->base); | ||
104 | iommu_invalidate(iommu->regs); | 109 | iommu_invalidate(iommu->regs); |
105 | 110 | ||
106 | bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL); | 111 | bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL); |
diff --git a/arch/sparc/mm/leon_mm.c b/arch/sparc/mm/leon_mm.c index 5bed085a2c17..3b17b6f7895a 100644 --- a/arch/sparc/mm/leon_mm.c +++ b/arch/sparc/mm/leon_mm.c | |||
@@ -15,10 +15,10 @@ | |||
15 | #include <asm/leon.h> | 15 | #include <asm/leon.h> |
16 | #include <asm/tlbflush.h> | 16 | #include <asm/tlbflush.h> |
17 | 17 | ||
18 | #include "srmmu.h" | 18 | #include "mm_32.h" |
19 | 19 | ||
20 | int leon_flush_during_switch = 1; | 20 | int leon_flush_during_switch = 1; |
21 | int srmmu_swprobe_trace; | 21 | static int srmmu_swprobe_trace; |
22 | 22 | ||
23 | static inline unsigned long leon_get_ctable_ptr(void) | 23 | static inline unsigned long leon_get_ctable_ptr(void) |
24 | { | 24 | { |
diff --git a/arch/sparc/mm/mm_32.h b/arch/sparc/mm/mm_32.h new file mode 100644 index 000000000000..a6c27ca9a721 --- /dev/null +++ b/arch/sparc/mm/mm_32.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* fault_32.c - visible as they are called from assembler */ | ||
2 | asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc, | ||
3 | unsigned long address); | ||
4 | asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, | ||
5 | unsigned long address); | ||
6 | |||
7 | void window_overflow_fault(void); | ||
8 | void window_underflow_fault(unsigned long sp); | ||
9 | void window_ret_fault(struct pt_regs *regs); | ||
10 | |||
11 | /* srmmu.c */ | ||
12 | extern char *srmmu_name; | ||
13 | extern int viking_mxcc_present; | ||
14 | extern int flush_page_for_dma_global; | ||
15 | |||
16 | extern void (*poke_srmmu)(void); | ||
17 | |||
18 | void __init srmmu_paging_init(void); | ||
19 | |||
20 | /* iommu.c */ | ||
21 | void ld_mmu_iommu(void); | ||
22 | |||
23 | /* io-unit.c */ | ||
24 | void ld_mmu_iounit(void); | ||
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index cfbe53c17b0d..be65f035d18a 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #include <asm/mxcc.h> | 49 | #include <asm/mxcc.h> |
50 | #include <asm/ross.h> | 50 | #include <asm/ross.h> |
51 | 51 | ||
52 | #include "srmmu.h" | 52 | #include "mm_32.h" |
53 | 53 | ||
54 | enum mbus_module srmmu_modtype; | 54 | enum mbus_module srmmu_modtype; |
55 | static unsigned int hwbug_bitmask; | 55 | static unsigned int hwbug_bitmask; |
@@ -100,7 +100,6 @@ static unsigned long srmmu_nocache_end; | |||
100 | #define SRMMU_NOCACHE_ALIGN_MAX (sizeof(ctxd_t)*SRMMU_MAX_CONTEXTS) | 100 | #define SRMMU_NOCACHE_ALIGN_MAX (sizeof(ctxd_t)*SRMMU_MAX_CONTEXTS) |
101 | 101 | ||
102 | void *srmmu_nocache_pool; | 102 | void *srmmu_nocache_pool; |
103 | void *srmmu_nocache_bitmap; | ||
104 | static struct bit_map srmmu_nocache_map; | 103 | static struct bit_map srmmu_nocache_map; |
105 | 104 | ||
106 | static inline int srmmu_pmd_none(pmd_t pmd) | 105 | static inline int srmmu_pmd_none(pmd_t pmd) |
@@ -173,7 +172,7 @@ static void *__srmmu_get_nocache(int size, int align) | |||
173 | printk(KERN_ERR "srmmu: out of nocache %d: %d/%d\n", | 172 | printk(KERN_ERR "srmmu: out of nocache %d: %d/%d\n", |
174 | size, (int) srmmu_nocache_size, | 173 | size, (int) srmmu_nocache_size, |
175 | srmmu_nocache_map.used << SRMMU_NOCACHE_BITMAP_SHIFT); | 174 | srmmu_nocache_map.used << SRMMU_NOCACHE_BITMAP_SHIFT); |
176 | return 0; | 175 | return NULL; |
177 | } | 176 | } |
178 | 177 | ||
179 | addr = SRMMU_NOCACHE_VADDR + (offset << SRMMU_NOCACHE_BITMAP_SHIFT); | 178 | addr = SRMMU_NOCACHE_VADDR + (offset << SRMMU_NOCACHE_BITMAP_SHIFT); |
@@ -269,6 +268,7 @@ static void __init srmmu_nocache_calcsize(void) | |||
269 | 268 | ||
270 | static void __init srmmu_nocache_init(void) | 269 | static void __init srmmu_nocache_init(void) |
271 | { | 270 | { |
271 | void *srmmu_nocache_bitmap; | ||
272 | unsigned int bitmap_bits; | 272 | unsigned int bitmap_bits; |
273 | pgd_t *pgd; | 273 | pgd_t *pgd; |
274 | pmd_t *pmd; | 274 | pmd_t *pmd; |
@@ -728,7 +728,7 @@ static inline unsigned long srmmu_probe(unsigned long vaddr) | |||
728 | "=r" (retval) : | 728 | "=r" (retval) : |
729 | "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE)); | 729 | "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE)); |
730 | } else { | 730 | } else { |
731 | retval = leon_swprobe(vaddr, 0); | 731 | retval = leon_swprobe(vaddr, NULL); |
732 | } | 732 | } |
733 | return retval; | 733 | return retval; |
734 | } | 734 | } |
@@ -865,8 +865,6 @@ static void __init map_kernel(void) | |||
865 | 865 | ||
866 | void (*poke_srmmu)(void) = NULL; | 866 | void (*poke_srmmu)(void) = NULL; |
867 | 867 | ||
868 | extern unsigned long bootmem_init(unsigned long *pages_avail); | ||
869 | |||
870 | void __init srmmu_paging_init(void) | 868 | void __init srmmu_paging_init(void) |
871 | { | 869 | { |
872 | int i; | 870 | int i; |
@@ -1771,9 +1769,6 @@ static struct sparc32_cachetlb_ops smp_cachetlb_ops = { | |||
1771 | /* Load up routines and constants for sun4m and sun4d mmu */ | 1769 | /* Load up routines and constants for sun4m and sun4d mmu */ |
1772 | void __init load_mmu(void) | 1770 | void __init load_mmu(void) |
1773 | { | 1771 | { |
1774 | extern void ld_mmu_iommu(void); | ||
1775 | extern void ld_mmu_iounit(void); | ||
1776 | |||
1777 | /* Functions */ | 1772 | /* Functions */ |
1778 | get_srmmu_type(); | 1773 | get_srmmu_type(); |
1779 | 1774 | ||
diff --git a/arch/sparc/mm/srmmu.h b/arch/sparc/mm/srmmu.h deleted file mode 100644 index 5703274ccf89..000000000000 --- a/arch/sparc/mm/srmmu.h +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | /* srmmu.c */ | ||
2 | extern char *srmmu_name; | ||
3 | |||
4 | extern void (*poke_srmmu)(void); | ||
diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c index fe19b81acc09..a06576683c38 100644 --- a/arch/sparc/mm/tsb.c +++ b/arch/sparc/mm/tsb.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <asm/page.h> | 9 | #include <asm/page.h> |
10 | #include <asm/pgtable.h> | 10 | #include <asm/pgtable.h> |
11 | #include <asm/mmu_context.h> | 11 | #include <asm/mmu_context.h> |
12 | #include <asm/setup.h> | ||
12 | #include <asm/tsb.h> | 13 | #include <asm/tsb.h> |
13 | #include <asm/tlb.h> | 14 | #include <asm/tlb.h> |
14 | #include <asm/oplib.h> | 15 | #include <asm/oplib.h> |
diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c index f178b9dcc7b7..53a696d3eb3b 100644 --- a/arch/sparc/prom/misc_64.c +++ b/arch/sparc/prom/misc_64.c | |||
@@ -81,11 +81,6 @@ void prom_feval(const char *fstring) | |||
81 | } | 81 | } |
82 | EXPORT_SYMBOL(prom_feval); | 82 | EXPORT_SYMBOL(prom_feval); |
83 | 83 | ||
84 | #ifdef CONFIG_SMP | ||
85 | extern void smp_capture(void); | ||
86 | extern void smp_release(void); | ||
87 | #endif | ||
88 | |||
89 | /* Drop into the prom, with the chance to continue with the 'go' | 84 | /* Drop into the prom, with the chance to continue with the 'go' |
90 | * prom command. | 85 | * prom command. |
91 | */ | 86 | */ |
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig index aafad6fa1667..928237a7b9ca 100644 --- a/arch/unicore32/Kconfig +++ b/arch/unicore32/Kconfig | |||
@@ -51,9 +51,6 @@ config ARCH_HAS_ILOG2_U32 | |||
51 | config ARCH_HAS_ILOG2_U64 | 51 | config ARCH_HAS_ILOG2_U64 |
52 | bool | 52 | bool |
53 | 53 | ||
54 | config ARCH_HAS_CPUFREQ | ||
55 | bool | ||
56 | |||
57 | config GENERIC_HWEIGHT | 54 | config GENERIC_HWEIGHT |
58 | def_bool y | 55 | def_bool y |
59 | 56 | ||
@@ -87,7 +84,6 @@ config ARCH_PUV3 | |||
87 | select GENERIC_CLOCKEVENTS | 84 | select GENERIC_CLOCKEVENTS |
88 | select HAVE_CLK | 85 | select HAVE_CLK |
89 | select ARCH_REQUIRE_GPIOLIB | 86 | select ARCH_REQUIRE_GPIOLIB |
90 | select ARCH_HAS_CPUFREQ | ||
91 | 87 | ||
92 | # CONFIGs for ARCH_PUV3 | 88 | # CONFIGs for ARCH_PUV3 |
93 | 89 | ||
@@ -198,9 +194,7 @@ menu "Power management options" | |||
198 | 194 | ||
199 | source "kernel/power/Kconfig" | 195 | source "kernel/power/Kconfig" |
200 | 196 | ||
201 | if ARCH_HAS_CPUFREQ | ||
202 | source "drivers/cpufreq/Kconfig" | 197 | source "drivers/cpufreq/Kconfig" |
203 | endif | ||
204 | 198 | ||
205 | config ARCH_SUSPEND_POSSIBLE | 199 | config ARCH_SUSPEND_POSSIBLE |
206 | def_bool y if !ARCH_FPGA | 200 | def_bool y if !ARCH_FPGA |
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h index 39decb6e6f57..cb1d8fd2b16b 100644 --- a/arch/unicore32/include/asm/io.h +++ b/arch/unicore32/include/asm/io.h | |||
@@ -39,10 +39,37 @@ extern void __uc32_iounmap(volatile void __iomem *addr); | |||
39 | #define ioremap_nocache(cookie, size) __uc32_ioremap(cookie, size) | 39 | #define ioremap_nocache(cookie, size) __uc32_ioremap(cookie, size) |
40 | #define iounmap(cookie) __uc32_iounmap(cookie) | 40 | #define iounmap(cookie) __uc32_iounmap(cookie) |
41 | 41 | ||
42 | #define readb_relaxed readb | ||
43 | #define readw_relaxed readw | ||
44 | #define readl_relaxed readl | ||
45 | |||
42 | #define HAVE_ARCH_PIO_SIZE | 46 | #define HAVE_ARCH_PIO_SIZE |
43 | #define PIO_OFFSET (unsigned int)(PCI_IOBASE) | 47 | #define PIO_OFFSET (unsigned int)(PCI_IOBASE) |
44 | #define PIO_MASK (unsigned int)(IO_SPACE_LIMIT) | 48 | #define PIO_MASK (unsigned int)(IO_SPACE_LIMIT) |
45 | #define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1) | 49 | #define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1) |
46 | 50 | ||
51 | #ifdef CONFIG_STRICT_DEVMEM | ||
52 | |||
53 | #include <linux/ioport.h> | ||
54 | #include <linux/mm.h> | ||
55 | |||
56 | /* | ||
57 | * devmem_is_allowed() checks to see if /dev/mem access to a certain | ||
58 | * address is valid. The argument is a physical page number. | ||
59 | * We mimic x86 here by disallowing access to system RAM as well as | ||
60 | * device-exclusive MMIO regions. This effectively disable read()/write() | ||
61 | * on /dev/mem. | ||
62 | */ | ||
63 | static inline int devmem_is_allowed(unsigned long pfn) | ||
64 | { | ||
65 | if (iomem_is_exclusive(pfn << PAGE_SHIFT)) | ||
66 | return 0; | ||
67 | if (!page_is_ram(pfn)) | ||
68 | return 1; | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | #endif /* CONFIG_STRICT_DEVMEM */ | ||
73 | |||
47 | #endif /* __KERNEL__ */ | 74 | #endif /* __KERNEL__ */ |
48 | #endif /* __UNICORE_IO_H__ */ | 75 | #endif /* __UNICORE_IO_H__ */ |
diff --git a/arch/unicore32/include/asm/pgtable.h b/arch/unicore32/include/asm/pgtable.h index 233c25880df4..ed6f7d000fba 100644 --- a/arch/unicore32/include/asm/pgtable.h +++ b/arch/unicore32/include/asm/pgtable.h | |||
@@ -87,16 +87,16 @@ extern pgprot_t pgprot_kernel; | |||
87 | 87 | ||
88 | #define PAGE_NONE pgprot_user | 88 | #define PAGE_NONE pgprot_user |
89 | #define PAGE_SHARED __pgprot(pgprot_val(pgprot_user | PTE_READ \ | 89 | #define PAGE_SHARED __pgprot(pgprot_val(pgprot_user | PTE_READ \ |
90 | | PTE_WRITE) | 90 | | PTE_WRITE)) |
91 | #define PAGE_SHARED_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ | 91 | #define PAGE_SHARED_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ |
92 | | PTE_WRITE \ | 92 | | PTE_WRITE \ |
93 | | PTE_EXEC) | 93 | | PTE_EXEC)) |
94 | #define PAGE_COPY __pgprot(pgprot_val(pgprot_user | PTE_READ) | 94 | #define PAGE_COPY __pgprot(pgprot_val(pgprot_user | PTE_READ) |
95 | #define PAGE_COPY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ | 95 | #define PAGE_COPY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ |
96 | | PTE_EXEC) | 96 | | PTE_EXEC)) |
97 | #define PAGE_READONLY __pgprot(pgprot_val(pgprot_user | PTE_READ) | 97 | #define PAGE_READONLY __pgprot(pgprot_val(pgprot_user | PTE_READ)) |
98 | #define PAGE_READONLY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ | 98 | #define PAGE_READONLY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ |
99 | | PTE_EXEC) | 99 | | PTE_EXEC)) |
100 | #define PAGE_KERNEL pgprot_kernel | 100 | #define PAGE_KERNEL pgprot_kernel |
101 | #define PAGE_KERNEL_EXEC __pgprot(pgprot_val(pgprot_kernel | PTE_EXEC)) | 101 | #define PAGE_KERNEL_EXEC __pgprot(pgprot_val(pgprot_kernel | PTE_EXEC)) |
102 | 102 | ||
diff --git a/arch/unicore32/include/asm/ptrace.h b/arch/unicore32/include/asm/ptrace.h index 9df53d991c78..02bf5a415bf5 100644 --- a/arch/unicore32/include/asm/ptrace.h +++ b/arch/unicore32/include/asm/ptrace.h | |||
@@ -55,6 +55,7 @@ static inline int valid_user_regs(struct pt_regs *regs) | |||
55 | 55 | ||
56 | #define instruction_pointer(regs) ((regs)->UCreg_pc) | 56 | #define instruction_pointer(regs) ((regs)->UCreg_pc) |
57 | #define user_stack_pointer(regs) ((regs)->UCreg_sp) | 57 | #define user_stack_pointer(regs) ((regs)->UCreg_sp) |
58 | #define profile_pc(regs) instruction_pointer(regs) | ||
58 | 59 | ||
59 | #endif /* __ASSEMBLY__ */ | 60 | #endif /* __ASSEMBLY__ */ |
60 | #endif | 61 | #endif |
diff --git a/arch/unicore32/kernel/clock.c b/arch/unicore32/kernel/clock.c index 18d4563e6fa5..b1ca775f6f6e 100644 --- a/arch/unicore32/kernel/clock.c +++ b/arch/unicore32/kernel/clock.c | |||
@@ -179,7 +179,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate) | |||
179 | } | 179 | } |
180 | #ifdef CONFIG_CPU_FREQ | 180 | #ifdef CONFIG_CPU_FREQ |
181 | if (clk == &clk_mclk_clk) { | 181 | if (clk == &clk_mclk_clk) { |
182 | u32 pll_rate, divstatus = PM_DIVSTATUS; | 182 | u32 pll_rate, divstatus = readl(PM_DIVSTATUS); |
183 | int ret, i; | 183 | int ret, i; |
184 | 184 | ||
185 | /* lookup mclk_clk_table */ | 185 | /* lookup mclk_clk_table */ |
@@ -201,10 +201,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate) | |||
201 | / (((divstatus & 0x0000f000) >> 12) + 1); | 201 | / (((divstatus & 0x0000f000) >> 12) + 1); |
202 | 202 | ||
203 | /* set pll sys cfg reg. */ | 203 | /* set pll sys cfg reg. */ |
204 | PM_PLLSYSCFG = pll_rate; | 204 | writel(pll_rate, PM_PLLSYSCFG); |
205 | 205 | ||
206 | PM_PMCR = PM_PMCR_CFBSYS; | 206 | writel(PM_PMCR_CFBSYS, PM_PMCR); |
207 | while ((PM_PLLDFCDONE & PM_PLLDFCDONE_SYSDFC) | 207 | while ((readl(PM_PLLDFCDONE) & PM_PLLDFCDONE_SYSDFC) |
208 | != PM_PLLDFCDONE_SYSDFC) | 208 | != PM_PLLDFCDONE_SYSDFC) |
209 | udelay(100); | 209 | udelay(100); |
210 | /* about 1ms */ | 210 | /* about 1ms */ |
diff --git a/arch/unicore32/kernel/ksyms.c b/arch/unicore32/kernel/ksyms.c index d285d71cbe35..0323528a80fd 100644 --- a/arch/unicore32/kernel/ksyms.c +++ b/arch/unicore32/kernel/ksyms.c | |||
@@ -23,41 +23,15 @@ | |||
23 | 23 | ||
24 | #include "ksyms.h" | 24 | #include "ksyms.h" |
25 | 25 | ||
26 | EXPORT_SYMBOL(find_first_bit); | ||
27 | EXPORT_SYMBOL(find_first_zero_bit); | ||
26 | EXPORT_SYMBOL(find_next_zero_bit); | 28 | EXPORT_SYMBOL(find_next_zero_bit); |
27 | EXPORT_SYMBOL(find_next_bit); | 29 | EXPORT_SYMBOL(find_next_bit); |
28 | 30 | ||
29 | EXPORT_SYMBOL(__backtrace); | ||
30 | |||
31 | /* platform dependent support */ | 31 | /* platform dependent support */ |
32 | EXPORT_SYMBOL(__udelay); | 32 | EXPORT_SYMBOL(__udelay); |
33 | EXPORT_SYMBOL(__const_udelay); | 33 | EXPORT_SYMBOL(__const_udelay); |
34 | 34 | ||
35 | /* networking */ | ||
36 | EXPORT_SYMBOL(csum_partial); | ||
37 | EXPORT_SYMBOL(csum_partial_copy_from_user); | ||
38 | EXPORT_SYMBOL(csum_partial_copy_nocheck); | ||
39 | EXPORT_SYMBOL(__csum_ipv6_magic); | ||
40 | |||
41 | /* io */ | ||
42 | #ifndef __raw_readsb | ||
43 | EXPORT_SYMBOL(__raw_readsb); | ||
44 | #endif | ||
45 | #ifndef __raw_readsw | ||
46 | EXPORT_SYMBOL(__raw_readsw); | ||
47 | #endif | ||
48 | #ifndef __raw_readsl | ||
49 | EXPORT_SYMBOL(__raw_readsl); | ||
50 | #endif | ||
51 | #ifndef __raw_writesb | ||
52 | EXPORT_SYMBOL(__raw_writesb); | ||
53 | #endif | ||
54 | #ifndef __raw_writesw | ||
55 | EXPORT_SYMBOL(__raw_writesw); | ||
56 | #endif | ||
57 | #ifndef __raw_writesl | ||
58 | EXPORT_SYMBOL(__raw_writesl); | ||
59 | #endif | ||
60 | |||
61 | /* string / mem functions */ | 35 | /* string / mem functions */ |
62 | EXPORT_SYMBOL(strchr); | 36 | EXPORT_SYMBOL(strchr); |
63 | EXPORT_SYMBOL(strrchr); | 37 | EXPORT_SYMBOL(strrchr); |
@@ -76,23 +50,12 @@ EXPORT_SYMBOL(__copy_from_user); | |||
76 | EXPORT_SYMBOL(__copy_to_user); | 50 | EXPORT_SYMBOL(__copy_to_user); |
77 | EXPORT_SYMBOL(__clear_user); | 51 | EXPORT_SYMBOL(__clear_user); |
78 | 52 | ||
79 | EXPORT_SYMBOL(__get_user_1); | ||
80 | EXPORT_SYMBOL(__get_user_2); | ||
81 | EXPORT_SYMBOL(__get_user_4); | ||
82 | |||
83 | EXPORT_SYMBOL(__put_user_1); | ||
84 | EXPORT_SYMBOL(__put_user_2); | ||
85 | EXPORT_SYMBOL(__put_user_4); | ||
86 | EXPORT_SYMBOL(__put_user_8); | ||
87 | |||
88 | EXPORT_SYMBOL(__ashldi3); | 53 | EXPORT_SYMBOL(__ashldi3); |
89 | EXPORT_SYMBOL(__ashrdi3); | 54 | EXPORT_SYMBOL(__ashrdi3); |
90 | EXPORT_SYMBOL(__divsi3); | 55 | EXPORT_SYMBOL(__divsi3); |
91 | EXPORT_SYMBOL(__lshrdi3); | 56 | EXPORT_SYMBOL(__lshrdi3); |
92 | EXPORT_SYMBOL(__modsi3); | 57 | EXPORT_SYMBOL(__modsi3); |
93 | EXPORT_SYMBOL(__muldi3); | ||
94 | EXPORT_SYMBOL(__ucmpdi2); | 58 | EXPORT_SYMBOL(__ucmpdi2); |
95 | EXPORT_SYMBOL(__udivsi3); | 59 | EXPORT_SYMBOL(__udivsi3); |
96 | EXPORT_SYMBOL(__umodsi3); | 60 | EXPORT_SYMBOL(__umodsi3); |
97 | EXPORT_SYMBOL(__bswapsi2); | ||
98 | 61 | ||
diff --git a/arch/unicore32/kernel/ksyms.h b/arch/unicore32/kernel/ksyms.h index 185cdc712d03..31472ad9467a 100644 --- a/arch/unicore32/kernel/ksyms.h +++ b/arch/unicore32/kernel/ksyms.h | |||
@@ -8,8 +8,6 @@ extern void __ashrdi3(void); | |||
8 | extern void __divsi3(void); | 8 | extern void __divsi3(void); |
9 | extern void __lshrdi3(void); | 9 | extern void __lshrdi3(void); |
10 | extern void __modsi3(void); | 10 | extern void __modsi3(void); |
11 | extern void __muldi3(void); | ||
12 | extern void __ucmpdi2(void); | 11 | extern void __ucmpdi2(void); |
13 | extern void __udivsi3(void); | 12 | extern void __udivsi3(void); |
14 | extern void __umodsi3(void); | 13 | extern void __umodsi3(void); |
15 | extern void __bswapsi2(void); | ||
diff --git a/arch/unicore32/kernel/module.c b/arch/unicore32/kernel/module.c index 16bd1495b934..dc41f6dfedb6 100644 --- a/arch/unicore32/kernel/module.c +++ b/arch/unicore32/kernel/module.c | |||
@@ -24,14 +24,9 @@ | |||
24 | 24 | ||
25 | void *module_alloc(unsigned long size) | 25 | void *module_alloc(unsigned long size) |
26 | { | 26 | { |
27 | struct vm_struct *area; | 27 | return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, |
28 | 28 | GFP_KERNEL, PAGE_KERNEL_EXEC, NUMA_NO_NODE, | |
29 | size = PAGE_ALIGN(size); | 29 | __builtin_return_address(0)); |
30 | area = __get_vm_area(size, VM_ALLOC, MODULES_VADDR, MODULES_END); | ||
31 | if (!area) | ||
32 | return NULL; | ||
33 | |||
34 | return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL_EXEC); | ||
35 | } | 30 | } |
36 | 31 | ||
37 | int | 32 | int |
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c index 778ebba80827..b008e9961465 100644 --- a/arch/unicore32/kernel/process.c +++ b/arch/unicore32/kernel/process.c | |||
@@ -60,6 +60,7 @@ void machine_halt(void) | |||
60 | * Function pointers to optional machine specific functions | 60 | * Function pointers to optional machine specific functions |
61 | */ | 61 | */ |
62 | void (*pm_power_off)(void) = NULL; | 62 | void (*pm_power_off)(void) = NULL; |
63 | EXPORT_SYMBOL(pm_power_off); | ||
63 | 64 | ||
64 | void machine_power_off(void) | 65 | void machine_power_off(void) |
65 | { | 66 | { |
diff --git a/arch/unicore32/kernel/setup.c b/arch/unicore32/kernel/setup.c index 87adbf5ebfe0..3fa317f96122 100644 --- a/arch/unicore32/kernel/setup.c +++ b/arch/unicore32/kernel/setup.c | |||
@@ -53,6 +53,10 @@ struct stack { | |||
53 | 53 | ||
54 | static struct stack stacks[NR_CPUS]; | 54 | static struct stack stacks[NR_CPUS]; |
55 | 55 | ||
56 | #ifdef CONFIG_VGA_CONSOLE | ||
57 | struct screen_info screen_info; | ||
58 | #endif | ||
59 | |||
56 | char elf_platform[ELF_PLATFORM_SIZE]; | 60 | char elf_platform[ELF_PLATFORM_SIZE]; |
57 | EXPORT_SYMBOL(elf_platform); | 61 | EXPORT_SYMBOL(elf_platform); |
58 | 62 | ||
diff --git a/arch/unicore32/mm/alignment.c b/arch/unicore32/mm/alignment.c index de7dc5fdd58b..24e836023e6c 100644 --- a/arch/unicore32/mm/alignment.c +++ b/arch/unicore32/mm/alignment.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | #include <linux/uaccess.h> | 22 | #include <linux/uaccess.h> |
23 | 23 | ||
24 | #include <asm/pgtable.h> | ||
24 | #include <asm/tlbflush.h> | 25 | #include <asm/tlbflush.h> |
25 | #include <asm/unaligned.h> | 26 | #include <asm/unaligned.h> |
26 | 27 | ||
diff --git a/arch/unicore32/mm/proc-syms.c b/arch/unicore32/mm/proc-syms.c index f30071e3665d..21c00fc85c99 100644 --- a/arch/unicore32/mm/proc-syms.c +++ b/arch/unicore32/mm/proc-syms.c | |||
@@ -19,5 +19,7 @@ | |||
19 | EXPORT_SYMBOL(cpu_dcache_clean_area); | 19 | EXPORT_SYMBOL(cpu_dcache_clean_area); |
20 | EXPORT_SYMBOL(cpu_set_pte); | 20 | EXPORT_SYMBOL(cpu_set_pte); |
21 | 21 | ||
22 | EXPORT_SYMBOL(__cpuc_coherent_kern_range); | ||
23 | |||
22 | EXPORT_SYMBOL(__cpuc_dma_flush_range); | 24 | EXPORT_SYMBOL(__cpuc_dma_flush_range); |
23 | EXPORT_SYMBOL(__cpuc_dma_clean_range); | 25 | EXPORT_SYMBOL(__cpuc_dma_clean_range); |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index fcefdda5136d..a8f749ef0fdc 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -1672,7 +1672,6 @@ config RELOCATABLE | |||
1672 | config RANDOMIZE_BASE | 1672 | config RANDOMIZE_BASE |
1673 | bool "Randomize the address of the kernel image" | 1673 | bool "Randomize the address of the kernel image" |
1674 | depends on RELOCATABLE | 1674 | depends on RELOCATABLE |
1675 | depends on !HIBERNATION | ||
1676 | default n | 1675 | default n |
1677 | ---help--- | 1676 | ---help--- |
1678 | Randomizes the physical and virtual address at which the | 1677 | Randomizes the physical and virtual address at which the |
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c index 4dbf967da50d..fc6091abedb7 100644 --- a/arch/x86/boot/compressed/aslr.c +++ b/arch/x86/boot/compressed/aslr.c | |||
@@ -289,10 +289,17 @@ unsigned char *choose_kernel_location(unsigned char *input, | |||
289 | unsigned long choice = (unsigned long)output; | 289 | unsigned long choice = (unsigned long)output; |
290 | unsigned long random; | 290 | unsigned long random; |
291 | 291 | ||
292 | #ifdef CONFIG_HIBERNATION | ||
293 | if (!cmdline_find_option_bool("kaslr")) { | ||
294 | debug_putstr("KASLR disabled by default...\n"); | ||
295 | goto out; | ||
296 | } | ||
297 | #else | ||
292 | if (cmdline_find_option_bool("nokaslr")) { | 298 | if (cmdline_find_option_bool("nokaslr")) { |
293 | debug_putstr("KASLR disabled...\n"); | 299 | debug_putstr("KASLR disabled by cmdline...\n"); |
294 | goto out; | 300 | goto out; |
295 | } | 301 | } |
302 | #endif | ||
296 | 303 | ||
297 | /* Record the various known unsafe memory ranges. */ | 304 | /* Record the various known unsafe memory ranges. */ |
298 | mem_avoid_init((unsigned long)input, input_size, | 305 | mem_avoid_init((unsigned long)input, input_size, |
diff --git a/arch/x86/crypto/sha512_ssse3_glue.c b/arch/x86/crypto/sha512_ssse3_glue.c index f30cd10293f0..8626b03e83b7 100644 --- a/arch/x86/crypto/sha512_ssse3_glue.c +++ b/arch/x86/crypto/sha512_ssse3_glue.c | |||
@@ -141,7 +141,7 @@ static int sha512_ssse3_final(struct shash_desc *desc, u8 *out) | |||
141 | 141 | ||
142 | /* save number of bits */ | 142 | /* save number of bits */ |
143 | bits[1] = cpu_to_be64(sctx->count[0] << 3); | 143 | bits[1] = cpu_to_be64(sctx->count[0] << 3); |
144 | bits[0] = cpu_to_be64(sctx->count[1] << 3) | sctx->count[0] >> 61; | 144 | bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61); |
145 | 145 | ||
146 | /* Pad out to 112 mod 128 and append length */ | 146 | /* Pad out to 112 mod 128 and append length */ |
147 | index = sctx->count[0] & 0x7f; | 147 | index = sctx->count[0] & 0x7f; |
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h index cb6cfcd034cf..a80cbb88ea91 100644 --- a/arch/x86/include/asm/irq.h +++ b/arch/x86/include/asm/irq.h | |||
@@ -43,7 +43,7 @@ extern int vector_used_by_percpu_irq(unsigned int vector); | |||
43 | extern void init_ISA_irqs(void); | 43 | extern void init_ISA_irqs(void); |
44 | 44 | ||
45 | #ifdef CONFIG_X86_LOCAL_APIC | 45 | #ifdef CONFIG_X86_LOCAL_APIC |
46 | void arch_trigger_all_cpu_backtrace(void); | 46 | void arch_trigger_all_cpu_backtrace(bool); |
47 | #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace | 47 | #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace |
48 | #endif | 48 | #endif |
49 | 49 | ||
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 49314155b66c..49205d01b9ad 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -95,7 +95,7 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level) | |||
95 | #define KVM_REFILL_PAGES 25 | 95 | #define KVM_REFILL_PAGES 25 |
96 | #define KVM_MAX_CPUID_ENTRIES 80 | 96 | #define KVM_MAX_CPUID_ENTRIES 80 |
97 | #define KVM_NR_FIXED_MTRR_REGION 88 | 97 | #define KVM_NR_FIXED_MTRR_REGION 88 |
98 | #define KVM_NR_VAR_MTRR 8 | 98 | #define KVM_NR_VAR_MTRR 10 |
99 | 99 | ||
100 | #define ASYNC_PF_PER_VCPU 64 | 100 | #define ASYNC_PF_PER_VCPU 64 |
101 | 101 | ||
@@ -461,7 +461,7 @@ struct kvm_vcpu_arch { | |||
461 | bool nmi_injected; /* Trying to inject an NMI this entry */ | 461 | bool nmi_injected; /* Trying to inject an NMI this entry */ |
462 | 462 | ||
463 | struct mtrr_state_type mtrr_state; | 463 | struct mtrr_state_type mtrr_state; |
464 | u32 pat; | 464 | u64 pat; |
465 | 465 | ||
466 | unsigned switch_db_regs; | 466 | unsigned switch_db_regs; |
467 | unsigned long db[KVM_NR_DB_REGS]; | 467 | unsigned long db[KVM_NR_DB_REGS]; |
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h index 14fd6fd75a19..6205f0c434db 100644 --- a/arch/x86/include/asm/ptrace.h +++ b/arch/x86/include/asm/ptrace.h | |||
@@ -231,6 +231,22 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, | |||
231 | 231 | ||
232 | #define ARCH_HAS_USER_SINGLE_STEP_INFO | 232 | #define ARCH_HAS_USER_SINGLE_STEP_INFO |
233 | 233 | ||
234 | /* | ||
235 | * When hitting ptrace_stop(), we cannot return using SYSRET because | ||
236 | * that does not restore the full CPU state, only a minimal set. The | ||
237 | * ptracer can change arbitrary register values, which is usually okay | ||
238 | * because the usual ptrace stops run off the signal delivery path which | ||
239 | * forces IRET; however, ptrace_event() stops happen in arbitrary places | ||
240 | * in the kernel and don't force IRET path. | ||
241 | * | ||
242 | * So force IRET path after a ptrace stop. | ||
243 | */ | ||
244 | #define arch_ptrace_stop_needed(code, info) \ | ||
245 | ({ \ | ||
246 | set_thread_flag(TIF_NOTIFY_RESUME); \ | ||
247 | false; \ | ||
248 | }) | ||
249 | |||
234 | struct user_desc; | 250 | struct user_desc; |
235 | extern int do_get_thread_area(struct task_struct *p, int idx, | 251 | extern int do_get_thread_area(struct task_struct *p, int idx, |
236 | struct user_desc __user *info); | 252 | struct user_desc __user *info); |
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c index c3fcb5de5083..6a1e71bde323 100644 --- a/arch/x86/kernel/apic/hw_nmi.c +++ b/arch/x86/kernel/apic/hw_nmi.c | |||
@@ -33,31 +33,41 @@ static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly; | |||
33 | /* "in progress" flag of arch_trigger_all_cpu_backtrace */ | 33 | /* "in progress" flag of arch_trigger_all_cpu_backtrace */ |
34 | static unsigned long backtrace_flag; | 34 | static unsigned long backtrace_flag; |
35 | 35 | ||
36 | void arch_trigger_all_cpu_backtrace(void) | 36 | void arch_trigger_all_cpu_backtrace(bool include_self) |
37 | { | 37 | { |
38 | int i; | 38 | int i; |
39 | int cpu = get_cpu(); | ||
39 | 40 | ||
40 | if (test_and_set_bit(0, &backtrace_flag)) | 41 | if (test_and_set_bit(0, &backtrace_flag)) { |
41 | /* | 42 | /* |
42 | * If there is already a trigger_all_cpu_backtrace() in progress | 43 | * If there is already a trigger_all_cpu_backtrace() in progress |
43 | * (backtrace_flag == 1), don't output double cpu dump infos. | 44 | * (backtrace_flag == 1), don't output double cpu dump infos. |
44 | */ | 45 | */ |
46 | put_cpu(); | ||
45 | return; | 47 | return; |
48 | } | ||
46 | 49 | ||
47 | cpumask_copy(to_cpumask(backtrace_mask), cpu_online_mask); | 50 | cpumask_copy(to_cpumask(backtrace_mask), cpu_online_mask); |
51 | if (!include_self) | ||
52 | cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask)); | ||
48 | 53 | ||
49 | printk(KERN_INFO "sending NMI to all CPUs:\n"); | 54 | if (!cpumask_empty(to_cpumask(backtrace_mask))) { |
50 | apic->send_IPI_all(NMI_VECTOR); | 55 | pr_info("sending NMI to %s CPUs:\n", |
56 | (include_self ? "all" : "other")); | ||
57 | apic->send_IPI_mask(to_cpumask(backtrace_mask), NMI_VECTOR); | ||
58 | } | ||
51 | 59 | ||
52 | /* Wait for up to 10 seconds for all CPUs to do the backtrace */ | 60 | /* Wait for up to 10 seconds for all CPUs to do the backtrace */ |
53 | for (i = 0; i < 10 * 1000; i++) { | 61 | for (i = 0; i < 10 * 1000; i++) { |
54 | if (cpumask_empty(to_cpumask(backtrace_mask))) | 62 | if (cpumask_empty(to_cpumask(backtrace_mask))) |
55 | break; | 63 | break; |
56 | mdelay(1); | 64 | mdelay(1); |
65 | touch_softlockup_watchdog(); | ||
57 | } | 66 | } |
58 | 67 | ||
59 | clear_bit(0, &backtrace_flag); | 68 | clear_bit(0, &backtrace_flag); |
60 | smp_mb__after_atomic(); | 69 | smp_mb__after_atomic(); |
70 | put_cpu(); | ||
61 | } | 71 | } |
62 | 72 | ||
63 | static int | 73 | static int |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index f0da82b8e634..dbaa23e78b36 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -423,9 +423,10 @@ sysenter_past_esp: | |||
423 | jnz sysenter_audit | 423 | jnz sysenter_audit |
424 | sysenter_do_call: | 424 | sysenter_do_call: |
425 | cmpl $(NR_syscalls), %eax | 425 | cmpl $(NR_syscalls), %eax |
426 | jae syscall_badsys | 426 | jae sysenter_badsys |
427 | call *sys_call_table(,%eax,4) | 427 | call *sys_call_table(,%eax,4) |
428 | movl %eax,PT_EAX(%esp) | 428 | movl %eax,PT_EAX(%esp) |
429 | sysenter_after_call: | ||
429 | LOCKDEP_SYS_EXIT | 430 | LOCKDEP_SYS_EXIT |
430 | DISABLE_INTERRUPTS(CLBR_ANY) | 431 | DISABLE_INTERRUPTS(CLBR_ANY) |
431 | TRACE_IRQS_OFF | 432 | TRACE_IRQS_OFF |
@@ -675,7 +676,12 @@ END(syscall_fault) | |||
675 | 676 | ||
676 | syscall_badsys: | 677 | syscall_badsys: |
677 | movl $-ENOSYS,PT_EAX(%esp) | 678 | movl $-ENOSYS,PT_EAX(%esp) |
678 | jmp resume_userspace | 679 | jmp syscall_exit |
680 | END(syscall_badsys) | ||
681 | |||
682 | sysenter_badsys: | ||
683 | movl $-ENOSYS,PT_EAX(%esp) | ||
684 | jmp sysenter_after_call | ||
679 | END(syscall_badsys) | 685 | END(syscall_badsys) |
680 | CFI_ENDPROC | 686 | CFI_ENDPROC |
681 | 687 | ||
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index a0da58db43a8..2851d63c1202 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -363,7 +363,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, | |||
363 | 363 | ||
364 | /* Set up to return from userspace. */ | 364 | /* Set up to return from userspace. */ |
365 | restorer = current->mm->context.vdso + | 365 | restorer = current->mm->context.vdso + |
366 | selected_vdso32->sym___kernel_sigreturn; | 366 | selected_vdso32->sym___kernel_rt_sigreturn; |
367 | if (ksig->ka.sa.sa_flags & SA_RESTORER) | 367 | if (ksig->ka.sa.sa_flags & SA_RESTORER) |
368 | restorer = ksig->ka.sa.sa_restorer; | 368 | restorer = ksig->ka.sa.sa_restorer; |
369 | put_user_ex(restorer, &frame->pretcode); | 369 | put_user_ex(restorer, &frame->pretcode); |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index c6eb418c5627..0d0e922fafc1 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -343,6 +343,7 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) | |||
343 | if (poke_int3_handler(regs)) | 343 | if (poke_int3_handler(regs)) |
344 | return; | 344 | return; |
345 | 345 | ||
346 | prev_state = exception_enter(); | ||
346 | #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP | 347 | #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP |
347 | if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, | 348 | if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, |
348 | SIGTRAP) == NOTIFY_STOP) | 349 | SIGTRAP) == NOTIFY_STOP) |
@@ -351,9 +352,8 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) | |||
351 | 352 | ||
352 | #ifdef CONFIG_KPROBES | 353 | #ifdef CONFIG_KPROBES |
353 | if (kprobe_int3_handler(regs)) | 354 | if (kprobe_int3_handler(regs)) |
354 | return; | 355 | goto exit; |
355 | #endif | 356 | #endif |
356 | prev_state = exception_enter(); | ||
357 | 357 | ||
358 | if (notify_die(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, | 358 | if (notify_die(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, |
359 | SIGTRAP) == NOTIFY_STOP) | 359 | SIGTRAP) == NOTIFY_STOP) |
@@ -433,6 +433,8 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code) | |||
433 | unsigned long dr6; | 433 | unsigned long dr6; |
434 | int si_code; | 434 | int si_code; |
435 | 435 | ||
436 | prev_state = exception_enter(); | ||
437 | |||
436 | get_debugreg(dr6, 6); | 438 | get_debugreg(dr6, 6); |
437 | 439 | ||
438 | /* Filter out all the reserved bits which are preset to 1 */ | 440 | /* Filter out all the reserved bits which are preset to 1 */ |
@@ -465,7 +467,6 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code) | |||
465 | if (kprobe_debug_handler(regs)) | 467 | if (kprobe_debug_handler(regs)) |
466 | goto exit; | 468 | goto exit; |
467 | #endif | 469 | #endif |
468 | prev_state = exception_enter(); | ||
469 | 470 | ||
470 | if (notify_die(DIE_DEBUG, "debug", regs, (long)&dr6, error_code, | 471 | if (notify_die(DIE_DEBUG, "debug", regs, (long)&dr6, error_code, |
471 | SIGTRAP) == NOTIFY_STOP) | 472 | SIGTRAP) == NOTIFY_STOP) |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index ec8366c5cfea..b5e994ad0135 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -1462,6 +1462,7 @@ static void svm_get_segment(struct kvm_vcpu *vcpu, | |||
1462 | */ | 1462 | */ |
1463 | if (var->unusable) | 1463 | if (var->unusable) |
1464 | var->db = 0; | 1464 | var->db = 0; |
1465 | var->dpl = to_svm(vcpu)->vmcb->save.cpl; | ||
1465 | break; | 1466 | break; |
1466 | } | 1467 | } |
1467 | } | 1468 | } |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f32a02578c0d..f6449334ec45 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1898,7 +1898,7 @@ static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
1898 | if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE)) | 1898 | if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE)) |
1899 | break; | 1899 | break; |
1900 | gfn = data >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; | 1900 | gfn = data >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; |
1901 | if (kvm_write_guest(kvm, data, | 1901 | if (kvm_write_guest(kvm, gfn << HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT, |
1902 | &tsc_ref, sizeof(tsc_ref))) | 1902 | &tsc_ref, sizeof(tsc_ref))) |
1903 | return 1; | 1903 | return 1; |
1904 | mark_page_dirty(kvm, gfn); | 1904 | mark_page_dirty(kvm, gfn); |
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile index 3c0809a0631f..61b04fe36e66 100644 --- a/arch/x86/vdso/Makefile +++ b/arch/x86/vdso/Makefile | |||
@@ -11,7 +11,6 @@ VDSO32-$(CONFIG_COMPAT) := y | |||
11 | 11 | ||
12 | # files to link into the vdso | 12 | # files to link into the vdso |
13 | vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vdso-fakesections.o | 13 | vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vdso-fakesections.o |
14 | vobjs-nox32 := vdso-fakesections.o | ||
15 | 14 | ||
16 | # files to link into kernel | 15 | # files to link into kernel |
17 | obj-y += vma.o | 16 | obj-y += vma.o |
@@ -67,7 +66,8 @@ $(obj)/vdso-image-%.c: $(obj)/vdso%.so.dbg $(obj)/vdso2c FORCE | |||
67 | # | 66 | # |
68 | CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \ | 67 | CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \ |
69 | $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \ | 68 | $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \ |
70 | -fno-omit-frame-pointer -foptimize-sibling-calls | 69 | -fno-omit-frame-pointer -foptimize-sibling-calls \ |
70 | -DDISABLE_BRANCH_PROFILING | ||
71 | 71 | ||
72 | $(vobjs): KBUILD_CFLAGS += $(CFL) | 72 | $(vobjs): KBUILD_CFLAGS += $(CFL) |
73 | 73 | ||
@@ -134,7 +134,7 @@ override obj-dirs = $(dir $(obj)) $(obj)/vdso32/ | |||
134 | 134 | ||
135 | targets += vdso32/vdso32.lds | 135 | targets += vdso32/vdso32.lds |
136 | targets += vdso32/note.o vdso32/vclock_gettime.o $(vdso32.so-y:%=vdso32/%.o) | 136 | targets += vdso32/note.o vdso32/vclock_gettime.o $(vdso32.so-y:%=vdso32/%.o) |
137 | targets += vdso32/vclock_gettime.o | 137 | targets += vdso32/vclock_gettime.o vdso32/vdso-fakesections.o |
138 | 138 | ||
139 | $(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%) | 139 | $(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%) |
140 | 140 | ||
@@ -150,11 +150,13 @@ KBUILD_CFLAGS_32 += -m32 -msoft-float -mregparm=0 -fpic | |||
150 | KBUILD_CFLAGS_32 += $(call cc-option, -fno-stack-protector) | 150 | KBUILD_CFLAGS_32 += $(call cc-option, -fno-stack-protector) |
151 | KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls) | 151 | KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls) |
152 | KBUILD_CFLAGS_32 += -fno-omit-frame-pointer | 152 | KBUILD_CFLAGS_32 += -fno-omit-frame-pointer |
153 | KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING | ||
153 | $(vdso32-images:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32) | 154 | $(vdso32-images:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32) |
154 | 155 | ||
155 | $(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \ | 156 | $(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \ |
156 | $(obj)/vdso32/vdso32.lds \ | 157 | $(obj)/vdso32/vdso32.lds \ |
157 | $(obj)/vdso32/vclock_gettime.o \ | 158 | $(obj)/vdso32/vclock_gettime.o \ |
159 | $(obj)/vdso32/vdso-fakesections.o \ | ||
158 | $(obj)/vdso32/note.o \ | 160 | $(obj)/vdso32/note.o \ |
159 | $(obj)/vdso32/%.o | 161 | $(obj)/vdso32/%.o |
160 | $(call if_changed,vdso) | 162 | $(call if_changed,vdso) |
@@ -169,14 +171,24 @@ quiet_cmd_vdso = VDSO $@ | |||
169 | sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' | 171 | sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' |
170 | 172 | ||
171 | VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \ | 173 | VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \ |
172 | -Wl,-Bsymbolic $(LTO_CFLAGS) | 174 | $(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS) |
173 | GCOV_PROFILE := n | 175 | GCOV_PROFILE := n |
174 | 176 | ||
175 | # | 177 | # |
176 | # Install the unstripped copies of vdso*.so. | 178 | # Install the unstripped copies of vdso*.so. If our toolchain supports |
179 | # build-id, install .build-id links as well. | ||
177 | # | 180 | # |
178 | quiet_cmd_vdso_install = INSTALL $(@:install_%=%) | 181 | quiet_cmd_vdso_install = INSTALL $(@:install_%=%) |
179 | cmd_vdso_install = cp $< $(MODLIB)/vdso/$(@:install_%=%) | 182 | define cmd_vdso_install |
183 | cp $< "$(MODLIB)/vdso/$(@:install_%=%)"; \ | ||
184 | if readelf -n $< |grep -q 'Build ID'; then \ | ||
185 | buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \ | ||
186 | first=`echo $$buildid | cut -b-2`; \ | ||
187 | last=`echo $$buildid | cut -b3-`; \ | ||
188 | mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \ | ||
189 | ln -sf "../../$(@:install_%=%)" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \ | ||
190 | fi | ||
191 | endef | ||
180 | 192 | ||
181 | vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%) | 193 | vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%) |
182 | 194 | ||
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c index b2e4f493e5b0..9793322751e0 100644 --- a/arch/x86/vdso/vclock_gettime.c +++ b/arch/x86/vdso/vclock_gettime.c | |||
@@ -11,9 +11,6 @@ | |||
11 | * Check with readelf after changing. | 11 | * Check with readelf after changing. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* Disable profiling for userspace code: */ | ||
15 | #define DISABLE_BRANCH_PROFILING | ||
16 | |||
17 | #include <uapi/linux/time.h> | 14 | #include <uapi/linux/time.h> |
18 | #include <asm/vgtod.h> | 15 | #include <asm/vgtod.h> |
19 | #include <asm/hpet.h> | 16 | #include <asm/hpet.h> |
diff --git a/arch/x86/vdso/vdso-fakesections.c b/arch/x86/vdso/vdso-fakesections.c index cb8a8d72c24b..aa5fbfab20a5 100644 --- a/arch/x86/vdso/vdso-fakesections.c +++ b/arch/x86/vdso/vdso-fakesections.c | |||
@@ -2,31 +2,20 @@ | |||
2 | * Copyright 2014 Andy Lutomirski | 2 | * Copyright 2014 Andy Lutomirski |
3 | * Subject to the GNU Public License, v.2 | 3 | * Subject to the GNU Public License, v.2 |
4 | * | 4 | * |
5 | * Hack to keep broken Go programs working. | 5 | * String table for loadable section headers. See vdso2c.h for why |
6 | * | 6 | * this exists. |
7 | * The Go runtime had a couple of bugs: it would read the section table to try | ||
8 | * to figure out how many dynamic symbols there were (it shouldn't have looked | ||
9 | * at the section table at all) and, if there were no SHT_SYNDYM section table | ||
10 | * entry, it would use an uninitialized value for the number of symbols. As a | ||
11 | * workaround, we supply a minimal section table. vdso2c will adjust the | ||
12 | * in-memory image so that "vdso_fake_sections" becomes the section table. | ||
13 | * | ||
14 | * The bug was introduced by: | ||
15 | * https://code.google.com/p/go/source/detail?r=56ea40aac72b (2012-08-31) | ||
16 | * and is being addressed in the Go runtime in this issue: | ||
17 | * https://code.google.com/p/go/issues/detail?id=8197 | ||
18 | */ | 7 | */ |
19 | 8 | ||
20 | #ifndef __x86_64__ | 9 | const char fake_shstrtab[] __attribute__((section(".fake_shstrtab"))) = |
21 | #error This hack is specific to the 64-bit vDSO | 10 | ".hash\0" |
22 | #endif | 11 | ".dynsym\0" |
23 | 12 | ".dynstr\0" | |
24 | #include <linux/elf.h> | 13 | ".gnu.version\0" |
25 | 14 | ".gnu.version_d\0" | |
26 | extern const __visible struct elf64_shdr vdso_fake_sections[]; | 15 | ".dynamic\0" |
27 | const __visible struct elf64_shdr vdso_fake_sections[] = { | 16 | ".rodata\0" |
28 | { | 17 | ".fake_shstrtab\0" /* Yay, self-referential code. */ |
29 | .sh_type = SHT_DYNSYM, | 18 | ".note\0" |
30 | .sh_entsize = sizeof(Elf64_Sym), | 19 | ".eh_frame_hdr\0" |
31 | } | 20 | ".eh_frame\0" |
32 | }; | 21 | ".text"; |
diff --git a/arch/x86/vdso/vdso-layout.lds.S b/arch/x86/vdso/vdso-layout.lds.S index 2ec72f651ebf..9197544eea9a 100644 --- a/arch/x86/vdso/vdso-layout.lds.S +++ b/arch/x86/vdso/vdso-layout.lds.S | |||
@@ -6,6 +6,16 @@ | |||
6 | * This script controls its layout. | 6 | * This script controls its layout. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #if defined(BUILD_VDSO64) | ||
10 | # define SHDR_SIZE 64 | ||
11 | #elif defined(BUILD_VDSO32) || defined(BUILD_VDSOX32) | ||
12 | # define SHDR_SIZE 40 | ||
13 | #else | ||
14 | # error unknown VDSO target | ||
15 | #endif | ||
16 | |||
17 | #define NUM_FAKE_SHDRS 13 | ||
18 | |||
9 | SECTIONS | 19 | SECTIONS |
10 | { | 20 | { |
11 | . = SIZEOF_HEADERS; | 21 | . = SIZEOF_HEADERS; |
@@ -18,36 +28,53 @@ SECTIONS | |||
18 | .gnu.version_d : { *(.gnu.version_d) } | 28 | .gnu.version_d : { *(.gnu.version_d) } |
19 | .gnu.version_r : { *(.gnu.version_r) } | 29 | .gnu.version_r : { *(.gnu.version_r) } |
20 | 30 | ||
31 | .dynamic : { *(.dynamic) } :text :dynamic | ||
32 | |||
33 | .rodata : { | ||
34 | *(.rodata*) | ||
35 | *(.data*) | ||
36 | *(.sdata*) | ||
37 | *(.got.plt) *(.got) | ||
38 | *(.gnu.linkonce.d.*) | ||
39 | *(.bss*) | ||
40 | *(.dynbss*) | ||
41 | *(.gnu.linkonce.b.*) | ||
42 | |||
43 | /* | ||
44 | * Ideally this would live in a C file, but that won't | ||
45 | * work cleanly for x32 until we start building the x32 | ||
46 | * C code using an x32 toolchain. | ||
47 | */ | ||
48 | VDSO_FAKE_SECTION_TABLE_START = .; | ||
49 | . = . + NUM_FAKE_SHDRS * SHDR_SIZE; | ||
50 | VDSO_FAKE_SECTION_TABLE_END = .; | ||
51 | } :text | ||
52 | |||
53 | .fake_shstrtab : { *(.fake_shstrtab) } :text | ||
54 | |||
55 | |||
21 | .note : { *(.note.*) } :text :note | 56 | .note : { *(.note.*) } :text :note |
22 | 57 | ||
23 | .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr | 58 | .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr |
24 | .eh_frame : { KEEP (*(.eh_frame)) } :text | 59 | .eh_frame : { KEEP (*(.eh_frame)) } :text |
25 | 60 | ||
26 | .dynamic : { *(.dynamic) } :text :dynamic | ||
27 | |||
28 | .rodata : { *(.rodata*) } :text | ||
29 | .data : { | ||
30 | *(.data*) | ||
31 | *(.sdata*) | ||
32 | *(.got.plt) *(.got) | ||
33 | *(.gnu.linkonce.d.*) | ||
34 | *(.bss*) | ||
35 | *(.dynbss*) | ||
36 | *(.gnu.linkonce.b.*) | ||
37 | } | ||
38 | |||
39 | .altinstructions : { *(.altinstructions) } | ||
40 | .altinstr_replacement : { *(.altinstr_replacement) } | ||
41 | 61 | ||
42 | /* | 62 | /* |
43 | * Align the actual code well away from the non-instruction data. | 63 | * Text is well-separated from actual data: there's plenty of |
44 | * This is the best thing for the I-cache. | 64 | * stuff that isn't used at runtime in between. |
45 | */ | 65 | */ |
46 | . = ALIGN(0x100); | ||
47 | 66 | ||
48 | .text : { *(.text*) } :text =0x90909090, | 67 | .text : { *(.text*) } :text =0x90909090, |
49 | 68 | ||
50 | /* | 69 | /* |
70 | * At the end so that eu-elflint stays happy when vdso2c strips | ||
71 | * these. A better implementation would avoid allocating space | ||
72 | * for these. | ||
73 | */ | ||
74 | .altinstructions : { *(.altinstructions) } :text | ||
75 | .altinstr_replacement : { *(.altinstr_replacement) } :text | ||
76 | |||
77 | /* | ||
51 | * The remainder of the vDSO consists of special pages that are | 78 | * The remainder of the vDSO consists of special pages that are |
52 | * shared between the kernel and userspace. It needs to be at the | 79 | * shared between the kernel and userspace. It needs to be at the |
53 | * end so that it doesn't overlap the mapping of the actual | 80 | * end so that it doesn't overlap the mapping of the actual |
@@ -75,6 +102,7 @@ SECTIONS | |||
75 | /DISCARD/ : { | 102 | /DISCARD/ : { |
76 | *(.discard) | 103 | *(.discard) |
77 | *(.discard.*) | 104 | *(.discard.*) |
105 | *(__bug_table) | ||
78 | } | 106 | } |
79 | } | 107 | } |
80 | 108 | ||
diff --git a/arch/x86/vdso/vdso.lds.S b/arch/x86/vdso/vdso.lds.S index 75e3404c83b1..6807932643c2 100644 --- a/arch/x86/vdso/vdso.lds.S +++ b/arch/x86/vdso/vdso.lds.S | |||
@@ -6,6 +6,8 @@ | |||
6 | * the DSO. | 6 | * the DSO. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #define BUILD_VDSO64 | ||
10 | |||
9 | #include "vdso-layout.lds.S" | 11 | #include "vdso-layout.lds.S" |
10 | 12 | ||
11 | /* | 13 | /* |
diff --git a/arch/x86/vdso/vdso2c.c b/arch/x86/vdso/vdso2c.c index 7a6bf50f9165..238dbe82776e 100644 --- a/arch/x86/vdso/vdso2c.c +++ b/arch/x86/vdso/vdso2c.c | |||
@@ -23,6 +23,8 @@ enum { | |||
23 | sym_vvar_page, | 23 | sym_vvar_page, |
24 | sym_hpet_page, | 24 | sym_hpet_page, |
25 | sym_end_mapping, | 25 | sym_end_mapping, |
26 | sym_VDSO_FAKE_SECTION_TABLE_START, | ||
27 | sym_VDSO_FAKE_SECTION_TABLE_END, | ||
26 | }; | 28 | }; |
27 | 29 | ||
28 | const int special_pages[] = { | 30 | const int special_pages[] = { |
@@ -30,15 +32,26 @@ const int special_pages[] = { | |||
30 | sym_hpet_page, | 32 | sym_hpet_page, |
31 | }; | 33 | }; |
32 | 34 | ||
33 | char const * const required_syms[] = { | 35 | struct vdso_sym { |
34 | [sym_vvar_page] = "vvar_page", | 36 | const char *name; |
35 | [sym_hpet_page] = "hpet_page", | 37 | bool export; |
36 | [sym_end_mapping] = "end_mapping", | 38 | }; |
37 | "VDSO32_NOTE_MASK", | 39 | |
38 | "VDSO32_SYSENTER_RETURN", | 40 | struct vdso_sym required_syms[] = { |
39 | "__kernel_vsyscall", | 41 | [sym_vvar_page] = {"vvar_page", true}, |
40 | "__kernel_sigreturn", | 42 | [sym_hpet_page] = {"hpet_page", true}, |
41 | "__kernel_rt_sigreturn", | 43 | [sym_end_mapping] = {"end_mapping", true}, |
44 | [sym_VDSO_FAKE_SECTION_TABLE_START] = { | ||
45 | "VDSO_FAKE_SECTION_TABLE_START", false | ||
46 | }, | ||
47 | [sym_VDSO_FAKE_SECTION_TABLE_END] = { | ||
48 | "VDSO_FAKE_SECTION_TABLE_END", false | ||
49 | }, | ||
50 | {"VDSO32_NOTE_MASK", true}, | ||
51 | {"VDSO32_SYSENTER_RETURN", true}, | ||
52 | {"__kernel_vsyscall", true}, | ||
53 | {"__kernel_sigreturn", true}, | ||
54 | {"__kernel_rt_sigreturn", true}, | ||
42 | }; | 55 | }; |
43 | 56 | ||
44 | __attribute__((format(printf, 1, 2))) __attribute__((noreturn)) | 57 | __attribute__((format(printf, 1, 2))) __attribute__((noreturn)) |
@@ -83,37 +96,21 @@ extern void bad_put_le(void); | |||
83 | 96 | ||
84 | #define NSYMS (sizeof(required_syms) / sizeof(required_syms[0])) | 97 | #define NSYMS (sizeof(required_syms) / sizeof(required_syms[0])) |
85 | 98 | ||
86 | #define BITS 64 | 99 | #define BITSFUNC3(name, bits) name##bits |
87 | #define GOFUNC go64 | 100 | #define BITSFUNC2(name, bits) BITSFUNC3(name, bits) |
88 | #define Elf_Ehdr Elf64_Ehdr | 101 | #define BITSFUNC(name) BITSFUNC2(name, ELF_BITS) |
89 | #define Elf_Shdr Elf64_Shdr | 102 | |
90 | #define Elf_Phdr Elf64_Phdr | 103 | #define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x |
91 | #define Elf_Sym Elf64_Sym | 104 | #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x) |
92 | #define Elf_Dyn Elf64_Dyn | 105 | #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x) |
106 | |||
107 | #define ELF_BITS 64 | ||
93 | #include "vdso2c.h" | 108 | #include "vdso2c.h" |
94 | #undef BITS | 109 | #undef ELF_BITS |
95 | #undef GOFUNC | 110 | |
96 | #undef Elf_Ehdr | 111 | #define ELF_BITS 32 |
97 | #undef Elf_Shdr | ||
98 | #undef Elf_Phdr | ||
99 | #undef Elf_Sym | ||
100 | #undef Elf_Dyn | ||
101 | |||
102 | #define BITS 32 | ||
103 | #define GOFUNC go32 | ||
104 | #define Elf_Ehdr Elf32_Ehdr | ||
105 | #define Elf_Shdr Elf32_Shdr | ||
106 | #define Elf_Phdr Elf32_Phdr | ||
107 | #define Elf_Sym Elf32_Sym | ||
108 | #define Elf_Dyn Elf32_Dyn | ||
109 | #include "vdso2c.h" | 112 | #include "vdso2c.h" |
110 | #undef BITS | 113 | #undef ELF_BITS |
111 | #undef GOFUNC | ||
112 | #undef Elf_Ehdr | ||
113 | #undef Elf_Shdr | ||
114 | #undef Elf_Phdr | ||
115 | #undef Elf_Sym | ||
116 | #undef Elf_Dyn | ||
117 | 114 | ||
118 | static void go(void *addr, size_t len, FILE *outfile, const char *name) | 115 | static void go(void *addr, size_t len, FILE *outfile, const char *name) |
119 | { | 116 | { |
diff --git a/arch/x86/vdso/vdso2c.h b/arch/x86/vdso/vdso2c.h index c6eefaf389b9..11b65d4f9414 100644 --- a/arch/x86/vdso/vdso2c.h +++ b/arch/x86/vdso/vdso2c.h | |||
@@ -4,23 +4,139 @@ | |||
4 | * are built for 32-bit userspace. | 4 | * are built for 32-bit userspace. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | 7 | /* |
8 | * We're writing a section table for a few reasons: | ||
9 | * | ||
10 | * The Go runtime had a couple of bugs: it would read the section | ||
11 | * table to try to figure out how many dynamic symbols there were (it | ||
12 | * shouldn't have looked at the section table at all) and, if there | ||
13 | * were no SHT_SYNDYM section table entry, it would use an | ||
14 | * uninitialized value for the number of symbols. An empty DYNSYM | ||
15 | * table would work, but I see no reason not to write a valid one (and | ||
16 | * keep full performance for old Go programs). This hack is only | ||
17 | * needed on x86_64. | ||
18 | * | ||
19 | * The bug was introduced on 2012-08-31 by: | ||
20 | * https://code.google.com/p/go/source/detail?r=56ea40aac72b | ||
21 | * and was fixed on 2014-06-13 by: | ||
22 | * https://code.google.com/p/go/source/detail?r=fc1cd5e12595 | ||
23 | * | ||
24 | * Binutils has issues debugging the vDSO: it reads the section table to | ||
25 | * find SHT_NOTE; it won't look at PT_NOTE for the in-memory vDSO, which | ||
26 | * would break build-id if we removed the section table. Binutils | ||
27 | * also requires that shstrndx != 0. See: | ||
28 | * https://sourceware.org/bugzilla/show_bug.cgi?id=17064 | ||
29 | * | ||
30 | * elfutils might not look for PT_NOTE if there is a section table at | ||
31 | * all. I don't know whether this matters for any practical purpose. | ||
32 | * | ||
33 | * For simplicity, rather than hacking up a partial section table, we | ||
34 | * just write a mostly complete one. We omit non-dynamic symbols, | ||
35 | * though, since they're rather large. | ||
36 | * | ||
37 | * Once binutils gets fixed, we might be able to drop this for all but | ||
38 | * the 64-bit vdso, since build-id only works in kernel RPMs, and | ||
39 | * systems that update to new enough kernel RPMs will likely update | ||
40 | * binutils in sync. build-id has never worked for home-built kernel | ||
41 | * RPMs without manual symlinking, and I suspect that no one ever does | ||
42 | * that. | ||
43 | */ | ||
44 | struct BITSFUNC(fake_sections) | ||
45 | { | ||
46 | ELF(Shdr) *table; | ||
47 | unsigned long table_offset; | ||
48 | int count, max_count; | ||
49 | |||
50 | int in_shstrndx; | ||
51 | unsigned long shstr_offset; | ||
52 | const char *shstrtab; | ||
53 | size_t shstrtab_len; | ||
54 | |||
55 | int out_shstrndx; | ||
56 | }; | ||
57 | |||
58 | static unsigned int BITSFUNC(find_shname)(struct BITSFUNC(fake_sections) *out, | ||
59 | const char *name) | ||
60 | { | ||
61 | const char *outname = out->shstrtab; | ||
62 | while (outname - out->shstrtab < out->shstrtab_len) { | ||
63 | if (!strcmp(name, outname)) | ||
64 | return (outname - out->shstrtab) + out->shstr_offset; | ||
65 | outname += strlen(outname) + 1; | ||
66 | } | ||
67 | |||
68 | if (*name) | ||
69 | printf("Warning: could not find output name \"%s\"\n", name); | ||
70 | return out->shstr_offset + out->shstrtab_len - 1; /* Use a null. */ | ||
71 | } | ||
72 | |||
73 | static void BITSFUNC(init_sections)(struct BITSFUNC(fake_sections) *out) | ||
74 | { | ||
75 | if (!out->in_shstrndx) | ||
76 | fail("didn't find the fake shstrndx\n"); | ||
77 | |||
78 | memset(out->table, 0, out->max_count * sizeof(ELF(Shdr))); | ||
79 | |||
80 | if (out->max_count < 1) | ||
81 | fail("we need at least two fake output sections\n"); | ||
82 | |||
83 | PUT_LE(&out->table[0].sh_type, SHT_NULL); | ||
84 | PUT_LE(&out->table[0].sh_name, BITSFUNC(find_shname)(out, "")); | ||
85 | |||
86 | out->count = 1; | ||
87 | } | ||
88 | |||
89 | static void BITSFUNC(copy_section)(struct BITSFUNC(fake_sections) *out, | ||
90 | int in_idx, const ELF(Shdr) *in, | ||
91 | const char *name) | ||
92 | { | ||
93 | uint64_t flags = GET_LE(&in->sh_flags); | ||
94 | |||
95 | bool copy = flags & SHF_ALLOC && | ||
96 | (GET_LE(&in->sh_size) || | ||
97 | (GET_LE(&in->sh_type) != SHT_RELA && | ||
98 | GET_LE(&in->sh_type) != SHT_REL)) && | ||
99 | strcmp(name, ".altinstructions") && | ||
100 | strcmp(name, ".altinstr_replacement"); | ||
101 | |||
102 | if (!copy) | ||
103 | return; | ||
104 | |||
105 | if (out->count >= out->max_count) | ||
106 | fail("too many copied sections (max = %d)\n", out->max_count); | ||
107 | |||
108 | if (in_idx == out->in_shstrndx) | ||
109 | out->out_shstrndx = out->count; | ||
110 | |||
111 | out->table[out->count] = *in; | ||
112 | PUT_LE(&out->table[out->count].sh_name, | ||
113 | BITSFUNC(find_shname)(out, name)); | ||
114 | |||
115 | /* elfutils requires that a strtab have the correct type. */ | ||
116 | if (!strcmp(name, ".fake_shstrtab")) | ||
117 | PUT_LE(&out->table[out->count].sh_type, SHT_STRTAB); | ||
118 | |||
119 | out->count++; | ||
120 | } | ||
121 | |||
122 | static void BITSFUNC(go)(void *addr, size_t len, | ||
123 | FILE *outfile, const char *name) | ||
8 | { | 124 | { |
9 | int found_load = 0; | 125 | int found_load = 0; |
10 | unsigned long load_size = -1; /* Work around bogus warning */ | 126 | unsigned long load_size = -1; /* Work around bogus warning */ |
11 | unsigned long data_size; | 127 | unsigned long data_size; |
12 | Elf_Ehdr *hdr = (Elf_Ehdr *)addr; | 128 | ELF(Ehdr) *hdr = (ELF(Ehdr) *)addr; |
13 | int i; | 129 | int i; |
14 | unsigned long j; | 130 | unsigned long j; |
15 | Elf_Shdr *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr, | 131 | ELF(Shdr) *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr, |
16 | *alt_sec = NULL; | 132 | *alt_sec = NULL; |
17 | Elf_Dyn *dyn = 0, *dyn_end = 0; | 133 | ELF(Dyn) *dyn = 0, *dyn_end = 0; |
18 | const char *secstrings; | 134 | const char *secstrings; |
19 | uint64_t syms[NSYMS] = {}; | 135 | uint64_t syms[NSYMS] = {}; |
20 | 136 | ||
21 | uint64_t fake_sections_value = 0, fake_sections_size = 0; | 137 | struct BITSFUNC(fake_sections) fake_sections = {}; |
22 | 138 | ||
23 | Elf_Phdr *pt = (Elf_Phdr *)(addr + GET_LE(&hdr->e_phoff)); | 139 | ELF(Phdr) *pt = (ELF(Phdr) *)(addr + GET_LE(&hdr->e_phoff)); |
24 | 140 | ||
25 | /* Walk the segment table. */ | 141 | /* Walk the segment table. */ |
26 | for (i = 0; i < GET_LE(&hdr->e_phnum); i++) { | 142 | for (i = 0; i < GET_LE(&hdr->e_phnum); i++) { |
@@ -51,7 +167,7 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | |||
51 | for (i = 0; dyn + i < dyn_end && | 167 | for (i = 0; dyn + i < dyn_end && |
52 | GET_LE(&dyn[i].d_tag) != DT_NULL; i++) { | 168 | GET_LE(&dyn[i].d_tag) != DT_NULL; i++) { |
53 | typeof(dyn[i].d_tag) tag = GET_LE(&dyn[i].d_tag); | 169 | typeof(dyn[i].d_tag) tag = GET_LE(&dyn[i].d_tag); |
54 | if (tag == DT_REL || tag == DT_RELSZ || | 170 | if (tag == DT_REL || tag == DT_RELSZ || tag == DT_RELA || |
55 | tag == DT_RELENT || tag == DT_TEXTREL) | 171 | tag == DT_RELENT || tag == DT_TEXTREL) |
56 | fail("vdso image contains dynamic relocations\n"); | 172 | fail("vdso image contains dynamic relocations\n"); |
57 | } | 173 | } |
@@ -61,7 +177,7 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | |||
61 | GET_LE(&hdr->e_shentsize)*GET_LE(&hdr->e_shstrndx); | 177 | GET_LE(&hdr->e_shentsize)*GET_LE(&hdr->e_shstrndx); |
62 | secstrings = addr + GET_LE(&secstrings_hdr->sh_offset); | 178 | secstrings = addr + GET_LE(&secstrings_hdr->sh_offset); |
63 | for (i = 0; i < GET_LE(&hdr->e_shnum); i++) { | 179 | for (i = 0; i < GET_LE(&hdr->e_shnum); i++) { |
64 | Elf_Shdr *sh = addr + GET_LE(&hdr->e_shoff) + | 180 | ELF(Shdr) *sh = addr + GET_LE(&hdr->e_shoff) + |
65 | GET_LE(&hdr->e_shentsize) * i; | 181 | GET_LE(&hdr->e_shentsize) * i; |
66 | if (GET_LE(&sh->sh_type) == SHT_SYMTAB) | 182 | if (GET_LE(&sh->sh_type) == SHT_SYMTAB) |
67 | symtab_hdr = sh; | 183 | symtab_hdr = sh; |
@@ -82,29 +198,63 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | |||
82 | i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize); | 198 | i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize); |
83 | i++) { | 199 | i++) { |
84 | int k; | 200 | int k; |
85 | Elf_Sym *sym = addr + GET_LE(&symtab_hdr->sh_offset) + | 201 | ELF(Sym) *sym = addr + GET_LE(&symtab_hdr->sh_offset) + |
86 | GET_LE(&symtab_hdr->sh_entsize) * i; | 202 | GET_LE(&symtab_hdr->sh_entsize) * i; |
87 | const char *name = addr + GET_LE(&strtab_hdr->sh_offset) + | 203 | const char *name = addr + GET_LE(&strtab_hdr->sh_offset) + |
88 | GET_LE(&sym->st_name); | 204 | GET_LE(&sym->st_name); |
89 | 205 | ||
90 | for (k = 0; k < NSYMS; k++) { | 206 | for (k = 0; k < NSYMS; k++) { |
91 | if (!strcmp(name, required_syms[k])) { | 207 | if (!strcmp(name, required_syms[k].name)) { |
92 | if (syms[k]) { | 208 | if (syms[k]) { |
93 | fail("duplicate symbol %s\n", | 209 | fail("duplicate symbol %s\n", |
94 | required_syms[k]); | 210 | required_syms[k].name); |
95 | } | 211 | } |
96 | syms[k] = GET_LE(&sym->st_value); | 212 | syms[k] = GET_LE(&sym->st_value); |
97 | } | 213 | } |
98 | } | 214 | } |
99 | 215 | ||
100 | if (!strcmp(name, "vdso_fake_sections")) { | 216 | if (!strcmp(name, "fake_shstrtab")) { |
101 | if (fake_sections_value) | 217 | ELF(Shdr) *sh; |
102 | fail("duplicate vdso_fake_sections\n"); | 218 | |
103 | fake_sections_value = GET_LE(&sym->st_value); | 219 | fake_sections.in_shstrndx = GET_LE(&sym->st_shndx); |
104 | fake_sections_size = GET_LE(&sym->st_size); | 220 | fake_sections.shstrtab = addr + GET_LE(&sym->st_value); |
221 | fake_sections.shstrtab_len = GET_LE(&sym->st_size); | ||
222 | sh = addr + GET_LE(&hdr->e_shoff) + | ||
223 | GET_LE(&hdr->e_shentsize) * | ||
224 | fake_sections.in_shstrndx; | ||
225 | fake_sections.shstr_offset = GET_LE(&sym->st_value) - | ||
226 | GET_LE(&sh->sh_addr); | ||
105 | } | 227 | } |
106 | } | 228 | } |
107 | 229 | ||
230 | /* Build the output section table. */ | ||
231 | if (!syms[sym_VDSO_FAKE_SECTION_TABLE_START] || | ||
232 | !syms[sym_VDSO_FAKE_SECTION_TABLE_END]) | ||
233 | fail("couldn't find fake section table\n"); | ||
234 | if ((syms[sym_VDSO_FAKE_SECTION_TABLE_END] - | ||
235 | syms[sym_VDSO_FAKE_SECTION_TABLE_START]) % sizeof(ELF(Shdr))) | ||
236 | fail("fake section table size isn't a multiple of sizeof(Shdr)\n"); | ||
237 | fake_sections.table = addr + syms[sym_VDSO_FAKE_SECTION_TABLE_START]; | ||
238 | fake_sections.table_offset = syms[sym_VDSO_FAKE_SECTION_TABLE_START]; | ||
239 | fake_sections.max_count = (syms[sym_VDSO_FAKE_SECTION_TABLE_END] - | ||
240 | syms[sym_VDSO_FAKE_SECTION_TABLE_START]) / | ||
241 | sizeof(ELF(Shdr)); | ||
242 | |||
243 | BITSFUNC(init_sections)(&fake_sections); | ||
244 | for (i = 0; i < GET_LE(&hdr->e_shnum); i++) { | ||
245 | ELF(Shdr) *sh = addr + GET_LE(&hdr->e_shoff) + | ||
246 | GET_LE(&hdr->e_shentsize) * i; | ||
247 | BITSFUNC(copy_section)(&fake_sections, i, sh, | ||
248 | secstrings + GET_LE(&sh->sh_name)); | ||
249 | } | ||
250 | if (!fake_sections.out_shstrndx) | ||
251 | fail("didn't generate shstrndx?!?\n"); | ||
252 | |||
253 | PUT_LE(&hdr->e_shoff, fake_sections.table_offset); | ||
254 | PUT_LE(&hdr->e_shentsize, sizeof(ELF(Shdr))); | ||
255 | PUT_LE(&hdr->e_shnum, fake_sections.count); | ||
256 | PUT_LE(&hdr->e_shstrndx, fake_sections.out_shstrndx); | ||
257 | |||
108 | /* Validate mapping addresses. */ | 258 | /* Validate mapping addresses. */ |
109 | for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) { | 259 | for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) { |
110 | if (!syms[i]) | 260 | if (!syms[i]) |
@@ -112,25 +262,17 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | |||
112 | 262 | ||
113 | if (syms[i] % 4096) | 263 | if (syms[i] % 4096) |
114 | fail("%s must be a multiple of 4096\n", | 264 | fail("%s must be a multiple of 4096\n", |
115 | required_syms[i]); | 265 | required_syms[i].name); |
116 | if (syms[i] < data_size) | 266 | if (syms[i] < data_size) |
117 | fail("%s must be after the text mapping\n", | 267 | fail("%s must be after the text mapping\n", |
118 | required_syms[i]); | 268 | required_syms[i].name); |
119 | if (syms[sym_end_mapping] < syms[i] + 4096) | 269 | if (syms[sym_end_mapping] < syms[i] + 4096) |
120 | fail("%s overruns end_mapping\n", required_syms[i]); | 270 | fail("%s overruns end_mapping\n", |
271 | required_syms[i].name); | ||
121 | } | 272 | } |
122 | if (syms[sym_end_mapping] % 4096) | 273 | if (syms[sym_end_mapping] % 4096) |
123 | fail("end_mapping must be a multiple of 4096\n"); | 274 | fail("end_mapping must be a multiple of 4096\n"); |
124 | 275 | ||
125 | /* Remove sections or use fakes */ | ||
126 | if (fake_sections_size % sizeof(Elf_Shdr)) | ||
127 | fail("vdso_fake_sections size is not a multiple of %ld\n", | ||
128 | (long)sizeof(Elf_Shdr)); | ||
129 | PUT_LE(&hdr->e_shoff, fake_sections_value); | ||
130 | PUT_LE(&hdr->e_shentsize, fake_sections_value ? sizeof(Elf_Shdr) : 0); | ||
131 | PUT_LE(&hdr->e_shnum, fake_sections_size / sizeof(Elf_Shdr)); | ||
132 | PUT_LE(&hdr->e_shstrndx, SHN_UNDEF); | ||
133 | |||
134 | if (!name) { | 276 | if (!name) { |
135 | fwrite(addr, load_size, 1, outfile); | 277 | fwrite(addr, load_size, 1, outfile); |
136 | return; | 278 | return; |
@@ -168,9 +310,9 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | |||
168 | (unsigned long)GET_LE(&alt_sec->sh_size)); | 310 | (unsigned long)GET_LE(&alt_sec->sh_size)); |
169 | } | 311 | } |
170 | for (i = 0; i < NSYMS; i++) { | 312 | for (i = 0; i < NSYMS; i++) { |
171 | if (syms[i]) | 313 | if (required_syms[i].export && syms[i]) |
172 | fprintf(outfile, "\t.sym_%s = 0x%" PRIx64 ",\n", | 314 | fprintf(outfile, "\t.sym_%s = 0x%" PRIx64 ",\n", |
173 | required_syms[i], syms[i]); | 315 | required_syms[i].name, syms[i]); |
174 | } | 316 | } |
175 | fprintf(outfile, "};\n"); | 317 | fprintf(outfile, "};\n"); |
176 | } | 318 | } |
diff --git a/arch/x86/vdso/vdso32/vdso-fakesections.c b/arch/x86/vdso/vdso32/vdso-fakesections.c new file mode 100644 index 000000000000..541468e25265 --- /dev/null +++ b/arch/x86/vdso/vdso32/vdso-fakesections.c | |||
@@ -0,0 +1 @@ | |||
#include "../vdso-fakesections.c" | |||
diff --git a/arch/x86/vdso/vdsox32.lds.S b/arch/x86/vdso/vdsox32.lds.S index 46b991b578a8..697c11ece90c 100644 --- a/arch/x86/vdso/vdsox32.lds.S +++ b/arch/x86/vdso/vdsox32.lds.S | |||
@@ -6,6 +6,8 @@ | |||
6 | * the DSO. | 6 | * the DSO. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #define BUILD_VDSOX32 | ||
10 | |||
9 | #include "vdso-layout.lds.S" | 11 | #include "vdso-layout.lds.S" |
10 | 12 | ||
11 | /* | 13 | /* |
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c index e1513c47872a..5a5176de8d0a 100644 --- a/arch/x86/vdso/vma.c +++ b/arch/x86/vdso/vma.c | |||
@@ -62,6 +62,9 @@ struct linux_binprm; | |||
62 | Only used for the 64-bit and x32 vdsos. */ | 62 | Only used for the 64-bit and x32 vdsos. */ |
63 | static unsigned long vdso_addr(unsigned long start, unsigned len) | 63 | static unsigned long vdso_addr(unsigned long start, unsigned len) |
64 | { | 64 | { |
65 | #ifdef CONFIG_X86_32 | ||
66 | return 0; | ||
67 | #else | ||
65 | unsigned long addr, end; | 68 | unsigned long addr, end; |
66 | unsigned offset; | 69 | unsigned offset; |
67 | end = (start + PMD_SIZE - 1) & PMD_MASK; | 70 | end = (start + PMD_SIZE - 1) & PMD_MASK; |
@@ -83,6 +86,7 @@ static unsigned long vdso_addr(unsigned long start, unsigned len) | |||
83 | addr = align_vdso_addr(addr); | 86 | addr = align_vdso_addr(addr); |
84 | 87 | ||
85 | return addr; | 88 | return addr; |
89 | #endif | ||
86 | } | 90 | } |
87 | 91 | ||
88 | static int map_vdso(const struct vdso_image *image, bool calculate_addr) | 92 | static int map_vdso(const struct vdso_image *image, bool calculate_addr) |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index f17b29210ac4..ffb101e45731 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -1537,7 +1537,10 @@ asmlinkage __visible void __init xen_start_kernel(void) | |||
1537 | if (!xen_pvh_domain()) | 1537 | if (!xen_pvh_domain()) |
1538 | pv_cpu_ops = xen_cpu_ops; | 1538 | pv_cpu_ops = xen_cpu_ops; |
1539 | 1539 | ||
1540 | x86_init.resources.memory_setup = xen_memory_setup; | 1540 | if (xen_feature(XENFEAT_auto_translated_physmap)) |
1541 | x86_init.resources.memory_setup = xen_auto_xlated_memory_setup; | ||
1542 | else | ||
1543 | x86_init.resources.memory_setup = xen_memory_setup; | ||
1541 | x86_init.oem.arch_setup = xen_arch_setup; | 1544 | x86_init.oem.arch_setup = xen_arch_setup; |
1542 | x86_init.oem.banner = xen_banner; | 1545 | x86_init.oem.banner = xen_banner; |
1543 | 1546 | ||
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 821a11ada590..2e555163c2fe 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <xen/interface/memory.h> | 27 | #include <xen/interface/memory.h> |
28 | #include <xen/interface/physdev.h> | 28 | #include <xen/interface/physdev.h> |
29 | #include <xen/features.h> | 29 | #include <xen/features.h> |
30 | #include "mmu.h" | ||
31 | #include "xen-ops.h" | 30 | #include "xen-ops.h" |
32 | #include "vdso.h" | 31 | #include "vdso.h" |
33 | 32 | ||
@@ -82,9 +81,6 @@ static void __init xen_add_extra_mem(u64 start, u64 size) | |||
82 | 81 | ||
83 | memblock_reserve(start, size); | 82 | memblock_reserve(start, size); |
84 | 83 | ||
85 | if (xen_feature(XENFEAT_auto_translated_physmap)) | ||
86 | return; | ||
87 | |||
88 | xen_max_p2m_pfn = PFN_DOWN(start + size); | 84 | xen_max_p2m_pfn = PFN_DOWN(start + size); |
89 | for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) { | 85 | for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) { |
90 | unsigned long mfn = pfn_to_mfn(pfn); | 86 | unsigned long mfn = pfn_to_mfn(pfn); |
@@ -107,7 +103,6 @@ static unsigned long __init xen_do_chunk(unsigned long start, | |||
107 | .domid = DOMID_SELF | 103 | .domid = DOMID_SELF |
108 | }; | 104 | }; |
109 | unsigned long len = 0; | 105 | unsigned long len = 0; |
110 | int xlated_phys = xen_feature(XENFEAT_auto_translated_physmap); | ||
111 | unsigned long pfn; | 106 | unsigned long pfn; |
112 | int ret; | 107 | int ret; |
113 | 108 | ||
@@ -121,7 +116,7 @@ static unsigned long __init xen_do_chunk(unsigned long start, | |||
121 | continue; | 116 | continue; |
122 | frame = mfn; | 117 | frame = mfn; |
123 | } else { | 118 | } else { |
124 | if (!xlated_phys && mfn != INVALID_P2M_ENTRY) | 119 | if (mfn != INVALID_P2M_ENTRY) |
125 | continue; | 120 | continue; |
126 | frame = pfn; | 121 | frame = pfn; |
127 | } | 122 | } |
@@ -159,13 +154,6 @@ static unsigned long __init xen_do_chunk(unsigned long start, | |||
159 | static unsigned long __init xen_release_chunk(unsigned long start, | 154 | static unsigned long __init xen_release_chunk(unsigned long start, |
160 | unsigned long end) | 155 | unsigned long end) |
161 | { | 156 | { |
162 | /* | ||
163 | * Xen already ballooned out the E820 non RAM regions for us | ||
164 | * and set them up properly in EPT. | ||
165 | */ | ||
166 | if (xen_feature(XENFEAT_auto_translated_physmap)) | ||
167 | return end - start; | ||
168 | |||
169 | return xen_do_chunk(start, end, true); | 157 | return xen_do_chunk(start, end, true); |
170 | } | 158 | } |
171 | 159 | ||
@@ -234,13 +222,7 @@ static void __init xen_set_identity_and_release_chunk( | |||
234 | * (except for the ISA region which must be 1:1 mapped) to | 222 | * (except for the ISA region which must be 1:1 mapped) to |
235 | * release the refcounts (in Xen) on the original frames. | 223 | * release the refcounts (in Xen) on the original frames. |
236 | */ | 224 | */ |
237 | 225 | for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) { | |
238 | /* | ||
239 | * PVH E820 matches the hypervisor's P2M which means we need to | ||
240 | * account for the proper values of *release and *identity. | ||
241 | */ | ||
242 | for (pfn = start_pfn; !xen_feature(XENFEAT_auto_translated_physmap) && | ||
243 | pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) { | ||
244 | pte_t pte = __pte_ma(0); | 226 | pte_t pte = __pte_ma(0); |
245 | 227 | ||
246 | if (pfn < PFN_UP(ISA_END_ADDRESS)) | 228 | if (pfn < PFN_UP(ISA_END_ADDRESS)) |
@@ -518,6 +500,35 @@ char * __init xen_memory_setup(void) | |||
518 | } | 500 | } |
519 | 501 | ||
520 | /* | 502 | /* |
503 | * Machine specific memory setup for auto-translated guests. | ||
504 | */ | ||
505 | char * __init xen_auto_xlated_memory_setup(void) | ||
506 | { | ||
507 | static struct e820entry map[E820MAX] __initdata; | ||
508 | |||
509 | struct xen_memory_map memmap; | ||
510 | int i; | ||
511 | int rc; | ||
512 | |||
513 | memmap.nr_entries = E820MAX; | ||
514 | set_xen_guest_handle(memmap.buffer, map); | ||
515 | |||
516 | rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap); | ||
517 | if (rc < 0) | ||
518 | panic("No memory map (%d)\n", rc); | ||
519 | |||
520 | sanitize_e820_map(map, ARRAY_SIZE(map), &memmap.nr_entries); | ||
521 | |||
522 | for (i = 0; i < memmap.nr_entries; i++) | ||
523 | e820_add_region(map[i].addr, map[i].size, map[i].type); | ||
524 | |||
525 | memblock_reserve(__pa(xen_start_info->mfn_list), | ||
526 | xen_start_info->pt_base - xen_start_info->mfn_list); | ||
527 | |||
528 | return "Xen"; | ||
529 | } | ||
530 | |||
531 | /* | ||
521 | * Set the bit indicating "nosegneg" library variants should be used. | 532 | * Set the bit indicating "nosegneg" library variants should be used. |
522 | * We only need to bother in pure 32-bit mode; compat 32-bit processes | 533 | * We only need to bother in pure 32-bit mode; compat 32-bit processes |
523 | * can have un-truncated segments, so wrapping around is allowed. | 534 | * can have un-truncated segments, so wrapping around is allowed. |
@@ -590,13 +601,7 @@ void xen_enable_syscall(void) | |||
590 | } | 601 | } |
591 | #endif /* CONFIG_X86_64 */ | 602 | #endif /* CONFIG_X86_64 */ |
592 | } | 603 | } |
593 | void xen_enable_nmi(void) | 604 | |
594 | { | ||
595 | #ifdef CONFIG_X86_64 | ||
596 | if (register_callback(CALLBACKTYPE_nmi, (char *)nmi)) | ||
597 | BUG(); | ||
598 | #endif | ||
599 | } | ||
600 | void __init xen_pvmmu_arch_setup(void) | 605 | void __init xen_pvmmu_arch_setup(void) |
601 | { | 606 | { |
602 | HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); | 607 | HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); |
@@ -611,7 +616,6 @@ void __init xen_pvmmu_arch_setup(void) | |||
611 | 616 | ||
612 | xen_enable_sysenter(); | 617 | xen_enable_sysenter(); |
613 | xen_enable_syscall(); | 618 | xen_enable_syscall(); |
614 | xen_enable_nmi(); | ||
615 | } | 619 | } |
616 | 620 | ||
617 | /* This function is not called for HVM domains */ | 621 | /* This function is not called for HVM domains */ |
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index c834d4b231f0..97d87659f779 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h | |||
@@ -36,6 +36,7 @@ void xen_mm_unpin_all(void); | |||
36 | void xen_set_pat(u64); | 36 | void xen_set_pat(u64); |
37 | 37 | ||
38 | char * __init xen_memory_setup(void); | 38 | char * __init xen_memory_setup(void); |
39 | char * xen_auto_xlated_memory_setup(void); | ||
39 | void __init xen_arch_setup(void); | 40 | void __init xen_arch_setup(void); |
40 | void xen_enable_sysenter(void); | 41 | void xen_enable_sysenter(void); |
41 | void xen_enable_syscall(void); | 42 | void xen_enable_syscall(void); |
diff --git a/block/bio.c b/block/bio.c index 8c2e55e39a1b..0ec61c9e536c 100644 --- a/block/bio.c +++ b/block/bio.c | |||
@@ -746,6 +746,14 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page | |||
746 | 746 | ||
747 | goto done; | 747 | goto done; |
748 | } | 748 | } |
749 | |||
750 | /* | ||
751 | * If the queue doesn't support SG gaps and adding this | ||
752 | * offset would create a gap, disallow it. | ||
753 | */ | ||
754 | if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS) && | ||
755 | bvec_gap_to_prev(prev, offset)) | ||
756 | return 0; | ||
749 | } | 757 | } |
750 | 758 | ||
751 | if (bio->bi_vcnt >= bio->bi_max_vecs) | 759 | if (bio->bi_vcnt >= bio->bi_max_vecs) |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 069bc202ffe3..b9f4cc494ece 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -80,7 +80,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q, | |||
80 | blkg->q = q; | 80 | blkg->q = q; |
81 | INIT_LIST_HEAD(&blkg->q_node); | 81 | INIT_LIST_HEAD(&blkg->q_node); |
82 | blkg->blkcg = blkcg; | 82 | blkg->blkcg = blkcg; |
83 | blkg->refcnt = 1; | 83 | atomic_set(&blkg->refcnt, 1); |
84 | 84 | ||
85 | /* root blkg uses @q->root_rl, init rl only for !root blkgs */ | 85 | /* root blkg uses @q->root_rl, init rl only for !root blkgs */ |
86 | if (blkcg != &blkcg_root) { | 86 | if (blkcg != &blkcg_root) { |
@@ -399,11 +399,8 @@ void __blkg_release_rcu(struct rcu_head *rcu_head) | |||
399 | 399 | ||
400 | /* release the blkcg and parent blkg refs this blkg has been holding */ | 400 | /* release the blkcg and parent blkg refs this blkg has been holding */ |
401 | css_put(&blkg->blkcg->css); | 401 | css_put(&blkg->blkcg->css); |
402 | if (blkg->parent) { | 402 | if (blkg->parent) |
403 | spin_lock_irq(blkg->q->queue_lock); | ||
404 | blkg_put(blkg->parent); | 403 | blkg_put(blkg->parent); |
405 | spin_unlock_irq(blkg->q->queue_lock); | ||
406 | } | ||
407 | 404 | ||
408 | blkg_free(blkg); | 405 | blkg_free(blkg); |
409 | } | 406 | } |
@@ -1093,7 +1090,7 @@ EXPORT_SYMBOL_GPL(blkcg_deactivate_policy); | |||
1093 | * Register @pol with blkcg core. Might sleep and @pol may be modified on | 1090 | * Register @pol with blkcg core. Might sleep and @pol may be modified on |
1094 | * successful registration. Returns 0 on success and -errno on failure. | 1091 | * successful registration. Returns 0 on success and -errno on failure. |
1095 | */ | 1092 | */ |
1096 | int __init blkcg_policy_register(struct blkcg_policy *pol) | 1093 | int blkcg_policy_register(struct blkcg_policy *pol) |
1097 | { | 1094 | { |
1098 | int i, ret; | 1095 | int i, ret; |
1099 | 1096 | ||
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index cbb7f943f78a..d3fd7aa3d2a3 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/seq_file.h> | 18 | #include <linux/seq_file.h> |
19 | #include <linux/radix-tree.h> | 19 | #include <linux/radix-tree.h> |
20 | #include <linux/blkdev.h> | 20 | #include <linux/blkdev.h> |
21 | #include <linux/atomic.h> | ||
21 | 22 | ||
22 | /* Max limits for throttle policy */ | 23 | /* Max limits for throttle policy */ |
23 | #define THROTL_IOPS_MAX UINT_MAX | 24 | #define THROTL_IOPS_MAX UINT_MAX |
@@ -104,7 +105,7 @@ struct blkcg_gq { | |||
104 | struct request_list rl; | 105 | struct request_list rl; |
105 | 106 | ||
106 | /* reference count */ | 107 | /* reference count */ |
107 | int refcnt; | 108 | atomic_t refcnt; |
108 | 109 | ||
109 | /* is this blkg online? protected by both blkcg and q locks */ | 110 | /* is this blkg online? protected by both blkcg and q locks */ |
110 | bool online; | 111 | bool online; |
@@ -145,7 +146,7 @@ void blkcg_drain_queue(struct request_queue *q); | |||
145 | void blkcg_exit_queue(struct request_queue *q); | 146 | void blkcg_exit_queue(struct request_queue *q); |
146 | 147 | ||
147 | /* Blkio controller policy registration */ | 148 | /* Blkio controller policy registration */ |
148 | int __init blkcg_policy_register(struct blkcg_policy *pol); | 149 | int blkcg_policy_register(struct blkcg_policy *pol); |
149 | void blkcg_policy_unregister(struct blkcg_policy *pol); | 150 | void blkcg_policy_unregister(struct blkcg_policy *pol); |
150 | int blkcg_activate_policy(struct request_queue *q, | 151 | int blkcg_activate_policy(struct request_queue *q, |
151 | const struct blkcg_policy *pol); | 152 | const struct blkcg_policy *pol); |
@@ -257,13 +258,12 @@ static inline int blkg_path(struct blkcg_gq *blkg, char *buf, int buflen) | |||
257 | * blkg_get - get a blkg reference | 258 | * blkg_get - get a blkg reference |
258 | * @blkg: blkg to get | 259 | * @blkg: blkg to get |
259 | * | 260 | * |
260 | * The caller should be holding queue_lock and an existing reference. | 261 | * The caller should be holding an existing reference. |
261 | */ | 262 | */ |
262 | static inline void blkg_get(struct blkcg_gq *blkg) | 263 | static inline void blkg_get(struct blkcg_gq *blkg) |
263 | { | 264 | { |
264 | lockdep_assert_held(blkg->q->queue_lock); | 265 | WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0); |
265 | WARN_ON_ONCE(!blkg->refcnt); | 266 | atomic_inc(&blkg->refcnt); |
266 | blkg->refcnt++; | ||
267 | } | 267 | } |
268 | 268 | ||
269 | void __blkg_release_rcu(struct rcu_head *rcu); | 269 | void __blkg_release_rcu(struct rcu_head *rcu); |
@@ -271,14 +271,11 @@ void __blkg_release_rcu(struct rcu_head *rcu); | |||
271 | /** | 271 | /** |
272 | * blkg_put - put a blkg reference | 272 | * blkg_put - put a blkg reference |
273 | * @blkg: blkg to put | 273 | * @blkg: blkg to put |
274 | * | ||
275 | * The caller should be holding queue_lock. | ||
276 | */ | 274 | */ |
277 | static inline void blkg_put(struct blkcg_gq *blkg) | 275 | static inline void blkg_put(struct blkcg_gq *blkg) |
278 | { | 276 | { |
279 | lockdep_assert_held(blkg->q->queue_lock); | 277 | WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0); |
280 | WARN_ON_ONCE(blkg->refcnt <= 0); | 278 | if (atomic_dec_and_test(&blkg->refcnt)) |
281 | if (!--blkg->refcnt) | ||
282 | call_rcu(&blkg->rcu_head, __blkg_release_rcu); | 279 | call_rcu(&blkg->rcu_head, __blkg_release_rcu); |
283 | } | 280 | } |
284 | 281 | ||
@@ -580,7 +577,7 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { ret | |||
580 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } | 577 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } |
581 | static inline void blkcg_drain_queue(struct request_queue *q) { } | 578 | static inline void blkcg_drain_queue(struct request_queue *q) { } |
582 | static inline void blkcg_exit_queue(struct request_queue *q) { } | 579 | static inline void blkcg_exit_queue(struct request_queue *q) { } |
583 | static inline int __init blkcg_policy_register(struct blkcg_policy *pol) { return 0; } | 580 | static inline int blkcg_policy_register(struct blkcg_policy *pol) { return 0; } |
584 | static inline void blkcg_policy_unregister(struct blkcg_policy *pol) { } | 581 | static inline void blkcg_policy_unregister(struct blkcg_policy *pol) { } |
585 | static inline int blkcg_activate_policy(struct request_queue *q, | 582 | static inline int blkcg_activate_policy(struct request_queue *q, |
586 | const struct blkcg_policy *pol) { return 0; } | 583 | const struct blkcg_policy *pol) { return 0; } |
diff --git a/block/blk-core.c b/block/blk-core.c index f6f6b9af3e3f..6f8dba161bfe 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -3312,8 +3312,7 @@ int __init blk_dev_init(void) | |||
3312 | 3312 | ||
3313 | /* used for unplugging and affects IO latency/throughput - HIGHPRI */ | 3313 | /* used for unplugging and affects IO latency/throughput - HIGHPRI */ |
3314 | kblockd_workqueue = alloc_workqueue("kblockd", | 3314 | kblockd_workqueue = alloc_workqueue("kblockd", |
3315 | WQ_MEM_RECLAIM | WQ_HIGHPRI | | 3315 | WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); |
3316 | WQ_POWER_EFFICIENT, 0); | ||
3317 | if (!kblockd_workqueue) | 3316 | if (!kblockd_workqueue) |
3318 | panic("Failed to create kblockd\n"); | 3317 | panic("Failed to create kblockd\n"); |
3319 | 3318 | ||
diff --git a/block/blk-flush.c b/block/blk-flush.c index 8ffee4b5f93d..3cb5e9e7108a 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
@@ -422,44 +422,6 @@ void blk_insert_flush(struct request *rq) | |||
422 | } | 422 | } |
423 | 423 | ||
424 | /** | 424 | /** |
425 | * blk_abort_flushes - @q is being aborted, abort flush requests | ||
426 | * @q: request_queue being aborted | ||
427 | * | ||
428 | * To be called from elv_abort_queue(). @q is being aborted. Prepare all | ||
429 | * FLUSH/FUA requests for abortion. | ||
430 | * | ||
431 | * CONTEXT: | ||
432 | * spin_lock_irq(q->queue_lock) | ||
433 | */ | ||
434 | void blk_abort_flushes(struct request_queue *q) | ||
435 | { | ||
436 | struct request *rq, *n; | ||
437 | int i; | ||
438 | |||
439 | /* | ||
440 | * Requests in flight for data are already owned by the dispatch | ||
441 | * queue or the device driver. Just restore for normal completion. | ||
442 | */ | ||
443 | list_for_each_entry_safe(rq, n, &q->flush_data_in_flight, flush.list) { | ||
444 | list_del_init(&rq->flush.list); | ||
445 | blk_flush_restore_request(rq); | ||
446 | } | ||
447 | |||
448 | /* | ||
449 | * We need to give away requests on flush queues. Restore for | ||
450 | * normal completion and put them on the dispatch queue. | ||
451 | */ | ||
452 | for (i = 0; i < ARRAY_SIZE(q->flush_queue); i++) { | ||
453 | list_for_each_entry_safe(rq, n, &q->flush_queue[i], | ||
454 | flush.list) { | ||
455 | list_del_init(&rq->flush.list); | ||
456 | blk_flush_restore_request(rq); | ||
457 | list_add_tail(&rq->queuelist, &q->queue_head); | ||
458 | } | ||
459 | } | ||
460 | } | ||
461 | |||
462 | /** | ||
463 | * blkdev_issue_flush - queue a flush | 425 | * blkdev_issue_flush - queue a flush |
464 | * @bdev: blockdev to issue flush for | 426 | * @bdev: blockdev to issue flush for |
465 | * @gfp_mask: memory allocation flags (for bio_alloc) | 427 | * @gfp_mask: memory allocation flags (for bio_alloc) |
diff --git a/block/blk-merge.c b/block/blk-merge.c index b3bf0df0f4c2..54535831f1e1 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -568,6 +568,8 @@ int blk_attempt_req_merge(struct request_queue *q, struct request *rq, | |||
568 | 568 | ||
569 | bool blk_rq_merge_ok(struct request *rq, struct bio *bio) | 569 | bool blk_rq_merge_ok(struct request *rq, struct bio *bio) |
570 | { | 570 | { |
571 | struct request_queue *q = rq->q; | ||
572 | |||
571 | if (!rq_mergeable(rq) || !bio_mergeable(bio)) | 573 | if (!rq_mergeable(rq) || !bio_mergeable(bio)) |
572 | return false; | 574 | return false; |
573 | 575 | ||
@@ -591,6 +593,14 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) | |||
591 | !blk_write_same_mergeable(rq->bio, bio)) | 593 | !blk_write_same_mergeable(rq->bio, bio)) |
592 | return false; | 594 | return false; |
593 | 595 | ||
596 | if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS)) { | ||
597 | struct bio_vec *bprev; | ||
598 | |||
599 | bprev = &rq->biotail->bi_io_vec[bio->bi_vcnt - 1]; | ||
600 | if (bvec_gap_to_prev(bprev, bio->bi_io_vec[0].bv_offset)) | ||
601 | return false; | ||
602 | } | ||
603 | |||
594 | return true; | 604 | return true; |
595 | } | 605 | } |
596 | 606 | ||
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 1aab39f71d95..c1b92426c95e 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c | |||
@@ -43,9 +43,16 @@ bool blk_mq_has_free_tags(struct blk_mq_tags *tags) | |||
43 | return bt_has_free_tags(&tags->bitmap_tags); | 43 | return bt_has_free_tags(&tags->bitmap_tags); |
44 | } | 44 | } |
45 | 45 | ||
46 | static inline void bt_index_inc(unsigned int *index) | 46 | static inline int bt_index_inc(int index) |
47 | { | 47 | { |
48 | *index = (*index + 1) & (BT_WAIT_QUEUES - 1); | 48 | return (index + 1) & (BT_WAIT_QUEUES - 1); |
49 | } | ||
50 | |||
51 | static inline void bt_index_atomic_inc(atomic_t *index) | ||
52 | { | ||
53 | int old = atomic_read(index); | ||
54 | int new = bt_index_inc(old); | ||
55 | atomic_cmpxchg(index, old, new); | ||
49 | } | 56 | } |
50 | 57 | ||
51 | /* | 58 | /* |
@@ -69,14 +76,14 @@ static void blk_mq_tag_wakeup_all(struct blk_mq_tags *tags) | |||
69 | int i, wake_index; | 76 | int i, wake_index; |
70 | 77 | ||
71 | bt = &tags->bitmap_tags; | 78 | bt = &tags->bitmap_tags; |
72 | wake_index = bt->wake_index; | 79 | wake_index = atomic_read(&bt->wake_index); |
73 | for (i = 0; i < BT_WAIT_QUEUES; i++) { | 80 | for (i = 0; i < BT_WAIT_QUEUES; i++) { |
74 | struct bt_wait_state *bs = &bt->bs[wake_index]; | 81 | struct bt_wait_state *bs = &bt->bs[wake_index]; |
75 | 82 | ||
76 | if (waitqueue_active(&bs->wait)) | 83 | if (waitqueue_active(&bs->wait)) |
77 | wake_up(&bs->wait); | 84 | wake_up(&bs->wait); |
78 | 85 | ||
79 | bt_index_inc(&wake_index); | 86 | wake_index = bt_index_inc(wake_index); |
80 | } | 87 | } |
81 | } | 88 | } |
82 | 89 | ||
@@ -212,12 +219,14 @@ static struct bt_wait_state *bt_wait_ptr(struct blk_mq_bitmap_tags *bt, | |||
212 | struct blk_mq_hw_ctx *hctx) | 219 | struct blk_mq_hw_ctx *hctx) |
213 | { | 220 | { |
214 | struct bt_wait_state *bs; | 221 | struct bt_wait_state *bs; |
222 | int wait_index; | ||
215 | 223 | ||
216 | if (!hctx) | 224 | if (!hctx) |
217 | return &bt->bs[0]; | 225 | return &bt->bs[0]; |
218 | 226 | ||
219 | bs = &bt->bs[hctx->wait_index]; | 227 | wait_index = atomic_read(&hctx->wait_index); |
220 | bt_index_inc(&hctx->wait_index); | 228 | bs = &bt->bs[wait_index]; |
229 | bt_index_atomic_inc(&hctx->wait_index); | ||
221 | return bs; | 230 | return bs; |
222 | } | 231 | } |
223 | 232 | ||
@@ -239,18 +248,12 @@ static int bt_get(struct blk_mq_alloc_data *data, | |||
239 | 248 | ||
240 | bs = bt_wait_ptr(bt, hctx); | 249 | bs = bt_wait_ptr(bt, hctx); |
241 | do { | 250 | do { |
242 | bool was_empty; | ||
243 | |||
244 | was_empty = list_empty(&wait.task_list); | ||
245 | prepare_to_wait(&bs->wait, &wait, TASK_UNINTERRUPTIBLE); | 251 | prepare_to_wait(&bs->wait, &wait, TASK_UNINTERRUPTIBLE); |
246 | 252 | ||
247 | tag = __bt_get(hctx, bt, last_tag); | 253 | tag = __bt_get(hctx, bt, last_tag); |
248 | if (tag != -1) | 254 | if (tag != -1) |
249 | break; | 255 | break; |
250 | 256 | ||
251 | if (was_empty) | ||
252 | atomic_set(&bs->wait_cnt, bt->wake_cnt); | ||
253 | |||
254 | blk_mq_put_ctx(data->ctx); | 257 | blk_mq_put_ctx(data->ctx); |
255 | 258 | ||
256 | io_schedule(); | 259 | io_schedule(); |
@@ -313,18 +316,19 @@ static struct bt_wait_state *bt_wake_ptr(struct blk_mq_bitmap_tags *bt) | |||
313 | { | 316 | { |
314 | int i, wake_index; | 317 | int i, wake_index; |
315 | 318 | ||
316 | wake_index = bt->wake_index; | 319 | wake_index = atomic_read(&bt->wake_index); |
317 | for (i = 0; i < BT_WAIT_QUEUES; i++) { | 320 | for (i = 0; i < BT_WAIT_QUEUES; i++) { |
318 | struct bt_wait_state *bs = &bt->bs[wake_index]; | 321 | struct bt_wait_state *bs = &bt->bs[wake_index]; |
319 | 322 | ||
320 | if (waitqueue_active(&bs->wait)) { | 323 | if (waitqueue_active(&bs->wait)) { |
321 | if (wake_index != bt->wake_index) | 324 | int o = atomic_read(&bt->wake_index); |
322 | bt->wake_index = wake_index; | 325 | if (wake_index != o) |
326 | atomic_cmpxchg(&bt->wake_index, o, wake_index); | ||
323 | 327 | ||
324 | return bs; | 328 | return bs; |
325 | } | 329 | } |
326 | 330 | ||
327 | bt_index_inc(&wake_index); | 331 | wake_index = bt_index_inc(wake_index); |
328 | } | 332 | } |
329 | 333 | ||
330 | return NULL; | 334 | return NULL; |
@@ -334,6 +338,7 @@ static void bt_clear_tag(struct blk_mq_bitmap_tags *bt, unsigned int tag) | |||
334 | { | 338 | { |
335 | const int index = TAG_TO_INDEX(bt, tag); | 339 | const int index = TAG_TO_INDEX(bt, tag); |
336 | struct bt_wait_state *bs; | 340 | struct bt_wait_state *bs; |
341 | int wait_cnt; | ||
337 | 342 | ||
338 | /* | 343 | /* |
339 | * The unlock memory barrier need to order access to req in free | 344 | * The unlock memory barrier need to order access to req in free |
@@ -342,10 +347,19 @@ static void bt_clear_tag(struct blk_mq_bitmap_tags *bt, unsigned int tag) | |||
342 | clear_bit_unlock(TAG_TO_BIT(bt, tag), &bt->map[index].word); | 347 | clear_bit_unlock(TAG_TO_BIT(bt, tag), &bt->map[index].word); |
343 | 348 | ||
344 | bs = bt_wake_ptr(bt); | 349 | bs = bt_wake_ptr(bt); |
345 | if (bs && atomic_dec_and_test(&bs->wait_cnt)) { | 350 | if (!bs) |
346 | atomic_set(&bs->wait_cnt, bt->wake_cnt); | 351 | return; |
347 | bt_index_inc(&bt->wake_index); | 352 | |
353 | wait_cnt = atomic_dec_return(&bs->wait_cnt); | ||
354 | if (wait_cnt == 0) { | ||
355 | wake: | ||
356 | atomic_add(bt->wake_cnt, &bs->wait_cnt); | ||
357 | bt_index_atomic_inc(&bt->wake_index); | ||
348 | wake_up(&bs->wait); | 358 | wake_up(&bs->wait); |
359 | } else if (wait_cnt < 0) { | ||
360 | wait_cnt = atomic_inc_return(&bs->wait_cnt); | ||
361 | if (!wait_cnt) | ||
362 | goto wake; | ||
349 | } | 363 | } |
350 | } | 364 | } |
351 | 365 | ||
@@ -499,10 +513,13 @@ static int bt_alloc(struct blk_mq_bitmap_tags *bt, unsigned int depth, | |||
499 | return -ENOMEM; | 513 | return -ENOMEM; |
500 | } | 514 | } |
501 | 515 | ||
502 | for (i = 0; i < BT_WAIT_QUEUES; i++) | 516 | bt_update_count(bt, depth); |
517 | |||
518 | for (i = 0; i < BT_WAIT_QUEUES; i++) { | ||
503 | init_waitqueue_head(&bt->bs[i].wait); | 519 | init_waitqueue_head(&bt->bs[i].wait); |
520 | atomic_set(&bt->bs[i].wait_cnt, bt->wake_cnt); | ||
521 | } | ||
504 | 522 | ||
505 | bt_update_count(bt, depth); | ||
506 | return 0; | 523 | return 0; |
507 | } | 524 | } |
508 | 525 | ||
diff --git a/block/blk-mq-tag.h b/block/blk-mq-tag.h index 98696a65d4d4..6206ed17ef76 100644 --- a/block/blk-mq-tag.h +++ b/block/blk-mq-tag.h | |||
@@ -24,7 +24,7 @@ struct blk_mq_bitmap_tags { | |||
24 | unsigned int map_nr; | 24 | unsigned int map_nr; |
25 | struct blk_align_bitmap *map; | 25 | struct blk_align_bitmap *map; |
26 | 26 | ||
27 | unsigned int wake_index; | 27 | atomic_t wake_index; |
28 | struct bt_wait_state *bs; | 28 | struct bt_wait_state *bs; |
29 | }; | 29 | }; |
30 | 30 | ||
diff --git a/block/blk-mq.c b/block/blk-mq.c index e11f5f8e0313..ad69ef657e85 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -109,7 +109,7 @@ static void blk_mq_queue_exit(struct request_queue *q) | |||
109 | __percpu_counter_add(&q->mq_usage_counter, -1, 1000000); | 109 | __percpu_counter_add(&q->mq_usage_counter, -1, 1000000); |
110 | } | 110 | } |
111 | 111 | ||
112 | static void __blk_mq_drain_queue(struct request_queue *q) | 112 | void blk_mq_drain_queue(struct request_queue *q) |
113 | { | 113 | { |
114 | while (true) { | 114 | while (true) { |
115 | s64 count; | 115 | s64 count; |
@@ -120,7 +120,7 @@ static void __blk_mq_drain_queue(struct request_queue *q) | |||
120 | 120 | ||
121 | if (count == 0) | 121 | if (count == 0) |
122 | break; | 122 | break; |
123 | blk_mq_run_queues(q, false); | 123 | blk_mq_start_hw_queues(q); |
124 | msleep(10); | 124 | msleep(10); |
125 | } | 125 | } |
126 | } | 126 | } |
@@ -139,12 +139,7 @@ static void blk_mq_freeze_queue(struct request_queue *q) | |||
139 | spin_unlock_irq(q->queue_lock); | 139 | spin_unlock_irq(q->queue_lock); |
140 | 140 | ||
141 | if (drain) | 141 | if (drain) |
142 | __blk_mq_drain_queue(q); | 142 | blk_mq_drain_queue(q); |
143 | } | ||
144 | |||
145 | void blk_mq_drain_queue(struct request_queue *q) | ||
146 | { | ||
147 | __blk_mq_drain_queue(q); | ||
148 | } | 143 | } |
149 | 144 | ||
150 | static void blk_mq_unfreeze_queue(struct request_queue *q) | 145 | static void blk_mq_unfreeze_queue(struct request_queue *q) |
@@ -883,7 +878,7 @@ void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx) | |||
883 | clear_bit(BLK_MQ_S_STOPPED, &hctx->state); | 878 | clear_bit(BLK_MQ_S_STOPPED, &hctx->state); |
884 | 879 | ||
885 | preempt_disable(); | 880 | preempt_disable(); |
886 | __blk_mq_run_hw_queue(hctx); | 881 | blk_mq_run_hw_queue(hctx, false); |
887 | preempt_enable(); | 882 | preempt_enable(); |
888 | } | 883 | } |
889 | EXPORT_SYMBOL(blk_mq_start_hw_queue); | 884 | EXPORT_SYMBOL(blk_mq_start_hw_queue); |
diff --git a/block/blk.h b/block/blk.h index 45385e9abf6f..6748c4f8d7a1 100644 --- a/block/blk.h +++ b/block/blk.h | |||
@@ -84,7 +84,6 @@ static inline void blk_clear_rq_complete(struct request *rq) | |||
84 | #define ELV_ON_HASH(rq) ((rq)->cmd_flags & REQ_HASHED) | 84 | #define ELV_ON_HASH(rq) ((rq)->cmd_flags & REQ_HASHED) |
85 | 85 | ||
86 | void blk_insert_flush(struct request *rq); | 86 | void blk_insert_flush(struct request *rq); |
87 | void blk_abort_flushes(struct request_queue *q); | ||
88 | 87 | ||
89 | static inline struct request *__elv_next_request(struct request_queue *q) | 88 | static inline struct request *__elv_next_request(struct request_queue *q) |
90 | { | 89 | { |
diff --git a/block/elevator.c b/block/elevator.c index f35edddfe9b5..24c28b659bb3 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -729,26 +729,6 @@ int elv_may_queue(struct request_queue *q, int rw) | |||
729 | return ELV_MQUEUE_MAY; | 729 | return ELV_MQUEUE_MAY; |
730 | } | 730 | } |
731 | 731 | ||
732 | void elv_abort_queue(struct request_queue *q) | ||
733 | { | ||
734 | struct request *rq; | ||
735 | |||
736 | blk_abort_flushes(q); | ||
737 | |||
738 | while (!list_empty(&q->queue_head)) { | ||
739 | rq = list_entry_rq(q->queue_head.next); | ||
740 | rq->cmd_flags |= REQ_QUIET; | ||
741 | trace_block_rq_abort(q, rq); | ||
742 | /* | ||
743 | * Mark this request as started so we don't trigger | ||
744 | * any debug logic in the end I/O path. | ||
745 | */ | ||
746 | blk_start_request(rq); | ||
747 | __blk_end_request_all(rq, -EIO); | ||
748 | } | ||
749 | } | ||
750 | EXPORT_SYMBOL(elv_abort_queue); | ||
751 | |||
752 | void elv_completed_request(struct request_queue *q, struct request *rq) | 732 | void elv_completed_request(struct request_queue *q, struct request *rq) |
753 | { | 733 | { |
754 | struct elevator_queue *e = q->elevator; | 734 | struct elevator_queue *e = q->elevator; |
@@ -845,7 +825,7 @@ void elv_unregister_queue(struct request_queue *q) | |||
845 | } | 825 | } |
846 | EXPORT_SYMBOL(elv_unregister_queue); | 826 | EXPORT_SYMBOL(elv_unregister_queue); |
847 | 827 | ||
848 | int __init elv_register(struct elevator_type *e) | 828 | int elv_register(struct elevator_type *e) |
849 | { | 829 | { |
850 | char *def = ""; | 830 | char *def = ""; |
851 | 831 | ||
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index c67f6f5ad611..36b0e61f9c09 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -30,6 +30,10 @@ | |||
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/dmi.h> | 31 | #include <linux/dmi.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
34 | #include <linux/proc_fs.h> | ||
35 | #include <linux/seq_file.h> | ||
36 | #endif | ||
33 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
34 | #include <linux/power_supply.h> | 38 | #include <linux/power_supply.h> |
35 | #include <linux/acpi.h> | 39 | #include <linux/acpi.h> |
@@ -52,6 +56,7 @@ MODULE_AUTHOR("Paul Diefenbaugh"); | |||
52 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); | 56 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); |
53 | MODULE_LICENSE("GPL"); | 57 | MODULE_LICENSE("GPL"); |
54 | 58 | ||
59 | |||
55 | static int acpi_ac_add(struct acpi_device *device); | 60 | static int acpi_ac_add(struct acpi_device *device); |
56 | static int acpi_ac_remove(struct acpi_device *device); | 61 | static int acpi_ac_remove(struct acpi_device *device); |
57 | static void acpi_ac_notify(struct acpi_device *device, u32 event); | 62 | static void acpi_ac_notify(struct acpi_device *device, u32 event); |
@@ -67,6 +72,13 @@ static int acpi_ac_resume(struct device *dev); | |||
67 | #endif | 72 | #endif |
68 | static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); | 73 | static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); |
69 | 74 | ||
75 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
76 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); | ||
77 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); | ||
78 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); | ||
79 | #endif | ||
80 | |||
81 | |||
70 | static int ac_sleep_before_get_state_ms; | 82 | static int ac_sleep_before_get_state_ms; |
71 | 83 | ||
72 | static struct acpi_driver acpi_ac_driver = { | 84 | static struct acpi_driver acpi_ac_driver = { |
@@ -91,6 +103,16 @@ struct acpi_ac { | |||
91 | 103 | ||
92 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger) | 104 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger) |
93 | 105 | ||
106 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
107 | static const struct file_operations acpi_ac_fops = { | ||
108 | .owner = THIS_MODULE, | ||
109 | .open = acpi_ac_open_fs, | ||
110 | .read = seq_read, | ||
111 | .llseek = seq_lseek, | ||
112 | .release = single_release, | ||
113 | }; | ||
114 | #endif | ||
115 | |||
94 | /* -------------------------------------------------------------------------- | 116 | /* -------------------------------------------------------------------------- |
95 | AC Adapter Management | 117 | AC Adapter Management |
96 | -------------------------------------------------------------------------- */ | 118 | -------------------------------------------------------------------------- */ |
@@ -143,6 +165,83 @@ static enum power_supply_property ac_props[] = { | |||
143 | POWER_SUPPLY_PROP_ONLINE, | 165 | POWER_SUPPLY_PROP_ONLINE, |
144 | }; | 166 | }; |
145 | 167 | ||
168 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
169 | /* -------------------------------------------------------------------------- | ||
170 | FS Interface (/proc) | ||
171 | -------------------------------------------------------------------------- */ | ||
172 | |||
173 | static struct proc_dir_entry *acpi_ac_dir; | ||
174 | |||
175 | static int acpi_ac_seq_show(struct seq_file *seq, void *offset) | ||
176 | { | ||
177 | struct acpi_ac *ac = seq->private; | ||
178 | |||
179 | |||
180 | if (!ac) | ||
181 | return 0; | ||
182 | |||
183 | if (acpi_ac_get_state(ac)) { | ||
184 | seq_puts(seq, "ERROR: Unable to read AC Adapter state\n"); | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | seq_puts(seq, "state: "); | ||
189 | switch (ac->state) { | ||
190 | case ACPI_AC_STATUS_OFFLINE: | ||
191 | seq_puts(seq, "off-line\n"); | ||
192 | break; | ||
193 | case ACPI_AC_STATUS_ONLINE: | ||
194 | seq_puts(seq, "on-line\n"); | ||
195 | break; | ||
196 | default: | ||
197 | seq_puts(seq, "unknown\n"); | ||
198 | break; | ||
199 | } | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static int acpi_ac_open_fs(struct inode *inode, struct file *file) | ||
205 | { | ||
206 | return single_open(file, acpi_ac_seq_show, PDE_DATA(inode)); | ||
207 | } | ||
208 | |||
209 | static int acpi_ac_add_fs(struct acpi_ac *ac) | ||
210 | { | ||
211 | struct proc_dir_entry *entry = NULL; | ||
212 | |||
213 | printk(KERN_WARNING PREFIX "Deprecated procfs I/F for AC is loaded," | ||
214 | " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); | ||
215 | if (!acpi_device_dir(ac->device)) { | ||
216 | acpi_device_dir(ac->device) = | ||
217 | proc_mkdir(acpi_device_bid(ac->device), acpi_ac_dir); | ||
218 | if (!acpi_device_dir(ac->device)) | ||
219 | return -ENODEV; | ||
220 | } | ||
221 | |||
222 | /* 'state' [R] */ | ||
223 | entry = proc_create_data(ACPI_AC_FILE_STATE, | ||
224 | S_IRUGO, acpi_device_dir(ac->device), | ||
225 | &acpi_ac_fops, ac); | ||
226 | if (!entry) | ||
227 | return -ENODEV; | ||
228 | return 0; | ||
229 | } | ||
230 | |||
231 | static int acpi_ac_remove_fs(struct acpi_ac *ac) | ||
232 | { | ||
233 | |||
234 | if (acpi_device_dir(ac->device)) { | ||
235 | remove_proc_entry(ACPI_AC_FILE_STATE, | ||
236 | acpi_device_dir(ac->device)); | ||
237 | remove_proc_entry(acpi_device_bid(ac->device), acpi_ac_dir); | ||
238 | acpi_device_dir(ac->device) = NULL; | ||
239 | } | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | #endif | ||
244 | |||
146 | /* -------------------------------------------------------------------------- | 245 | /* -------------------------------------------------------------------------- |
147 | Driver Model | 246 | Driver Model |
148 | -------------------------------------------------------------------------- */ | 247 | -------------------------------------------------------------------------- */ |
@@ -243,6 +342,11 @@ static int acpi_ac_add(struct acpi_device *device) | |||
243 | goto end; | 342 | goto end; |
244 | 343 | ||
245 | ac->charger.name = acpi_device_bid(device); | 344 | ac->charger.name = acpi_device_bid(device); |
345 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
346 | result = acpi_ac_add_fs(ac); | ||
347 | if (result) | ||
348 | goto end; | ||
349 | #endif | ||
246 | ac->charger.type = POWER_SUPPLY_TYPE_MAINS; | 350 | ac->charger.type = POWER_SUPPLY_TYPE_MAINS; |
247 | ac->charger.properties = ac_props; | 351 | ac->charger.properties = ac_props; |
248 | ac->charger.num_properties = ARRAY_SIZE(ac_props); | 352 | ac->charger.num_properties = ARRAY_SIZE(ac_props); |
@@ -258,8 +362,12 @@ static int acpi_ac_add(struct acpi_device *device) | |||
258 | ac->battery_nb.notifier_call = acpi_ac_battery_notify; | 362 | ac->battery_nb.notifier_call = acpi_ac_battery_notify; |
259 | register_acpi_notifier(&ac->battery_nb); | 363 | register_acpi_notifier(&ac->battery_nb); |
260 | end: | 364 | end: |
261 | if (result) | 365 | if (result) { |
366 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
367 | acpi_ac_remove_fs(ac); | ||
368 | #endif | ||
262 | kfree(ac); | 369 | kfree(ac); |
370 | } | ||
263 | 371 | ||
264 | dmi_check_system(ac_dmi_table); | 372 | dmi_check_system(ac_dmi_table); |
265 | return result; | 373 | return result; |
@@ -303,6 +411,10 @@ static int acpi_ac_remove(struct acpi_device *device) | |||
303 | power_supply_unregister(&ac->charger); | 411 | power_supply_unregister(&ac->charger); |
304 | unregister_acpi_notifier(&ac->battery_nb); | 412 | unregister_acpi_notifier(&ac->battery_nb); |
305 | 413 | ||
414 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
415 | acpi_ac_remove_fs(ac); | ||
416 | #endif | ||
417 | |||
306 | kfree(ac); | 418 | kfree(ac); |
307 | 419 | ||
308 | return 0; | 420 | return 0; |
@@ -315,9 +427,20 @@ static int __init acpi_ac_init(void) | |||
315 | if (acpi_disabled) | 427 | if (acpi_disabled) |
316 | return -ENODEV; | 428 | return -ENODEV; |
317 | 429 | ||
430 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
431 | acpi_ac_dir = acpi_lock_ac_dir(); | ||
432 | if (!acpi_ac_dir) | ||
433 | return -ENODEV; | ||
434 | #endif | ||
435 | |||
436 | |||
318 | result = acpi_bus_register_driver(&acpi_ac_driver); | 437 | result = acpi_bus_register_driver(&acpi_ac_driver); |
319 | if (result < 0) | 438 | if (result < 0) { |
439 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
440 | acpi_unlock_ac_dir(acpi_ac_dir); | ||
441 | #endif | ||
320 | return -ENODEV; | 442 | return -ENODEV; |
443 | } | ||
321 | 444 | ||
322 | return 0; | 445 | return 0; |
323 | } | 446 | } |
@@ -325,6 +448,9 @@ static int __init acpi_ac_init(void) | |||
325 | static void __exit acpi_ac_exit(void) | 448 | static void __exit acpi_ac_exit(void) |
326 | { | 449 | { |
327 | acpi_bus_unregister_driver(&acpi_ac_driver); | 450 | acpi_bus_unregister_driver(&acpi_ac_driver); |
451 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
452 | acpi_unlock_ac_dir(acpi_ac_dir); | ||
453 | #endif | ||
328 | } | 454 | } |
329 | module_init(acpi_ac_init); | 455 | module_init(acpi_ac_init); |
330 | module_exit(acpi_ac_exit); | 456 | module_exit(acpi_ac_exit); |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 63407d264885..9cb65b0e7597 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -34,6 +34,9 @@ ACPI_MODULE_NAME("acpi_lpss"); | |||
34 | 34 | ||
35 | /* Offsets relative to LPSS_PRIVATE_OFFSET */ | 35 | /* Offsets relative to LPSS_PRIVATE_OFFSET */ |
36 | #define LPSS_CLK_DIVIDER_DEF_MASK (BIT(1) | BIT(16)) | 36 | #define LPSS_CLK_DIVIDER_DEF_MASK (BIT(1) | BIT(16)) |
37 | #define LPSS_RESETS 0x04 | ||
38 | #define LPSS_RESETS_RESET_FUNC BIT(0) | ||
39 | #define LPSS_RESETS_RESET_APB BIT(1) | ||
37 | #define LPSS_GENERAL 0x08 | 40 | #define LPSS_GENERAL 0x08 |
38 | #define LPSS_GENERAL_LTR_MODE_SW BIT(2) | 41 | #define LPSS_GENERAL_LTR_MODE_SW BIT(2) |
39 | #define LPSS_GENERAL_UART_RTS_OVRD BIT(3) | 42 | #define LPSS_GENERAL_UART_RTS_OVRD BIT(3) |
@@ -99,6 +102,17 @@ static void lpss_uart_setup(struct lpss_private_data *pdata) | |||
99 | writel(reg | LPSS_GENERAL_UART_RTS_OVRD, pdata->mmio_base + offset); | 102 | writel(reg | LPSS_GENERAL_UART_RTS_OVRD, pdata->mmio_base + offset); |
100 | } | 103 | } |
101 | 104 | ||
105 | static void lpss_i2c_setup(struct lpss_private_data *pdata) | ||
106 | { | ||
107 | unsigned int offset; | ||
108 | u32 val; | ||
109 | |||
110 | offset = pdata->dev_desc->prv_offset + LPSS_RESETS; | ||
111 | val = readl(pdata->mmio_base + offset); | ||
112 | val |= LPSS_RESETS_RESET_APB | LPSS_RESETS_RESET_FUNC; | ||
113 | writel(val, pdata->mmio_base + offset); | ||
114 | } | ||
115 | |||
102 | static struct lpss_device_desc lpt_dev_desc = { | 116 | static struct lpss_device_desc lpt_dev_desc = { |
103 | .clk_required = true, | 117 | .clk_required = true, |
104 | .prv_offset = 0x800, | 118 | .prv_offset = 0x800, |
@@ -171,6 +185,7 @@ static struct lpss_device_desc byt_i2c_dev_desc = { | |||
171 | .prv_offset = 0x800, | 185 | .prv_offset = 0x800, |
172 | .save_ctx = true, | 186 | .save_ctx = true, |
173 | .shared_clock = &i2c_clock, | 187 | .shared_clock = &i2c_clock, |
188 | .setup = lpss_i2c_setup, | ||
174 | }; | 189 | }; |
175 | 190 | ||
176 | #else | 191 | #else |
diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c index 6703c1fd993a..4ddb0dca56f6 100644 --- a/drivers/acpi/acpi_pnp.c +++ b/drivers/acpi/acpi_pnp.c | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | 15 | ||
16 | static const struct acpi_device_id acpi_pnp_device_ids[] = { | 16 | static const struct acpi_device_id acpi_pnp_device_ids[] = { |
17 | /* soc_button_array */ | ||
18 | {"PNP0C40"}, | ||
17 | /* pata_isapnp */ | 19 | /* pata_isapnp */ |
18 | {"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */ | 20 | {"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */ |
19 | /* floppy */ | 21 | /* floppy */ |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index e48fc98e71c4..130f513e08c9 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -32,8 +32,10 @@ | |||
32 | #include <linux/jiffies.h> | 32 | #include <linux/jiffies.h> |
33 | #include <linux/async.h> | 33 | #include <linux/async.h> |
34 | #include <linux/dmi.h> | 34 | #include <linux/dmi.h> |
35 | #include <linux/delay.h> | ||
35 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
36 | #include <linux/suspend.h> | 37 | #include <linux/suspend.h> |
38 | #include <linux/delay.h> | ||
37 | #include <asm/unaligned.h> | 39 | #include <asm/unaligned.h> |
38 | 40 | ||
39 | #ifdef CONFIG_ACPI_PROCFS_POWER | 41 | #ifdef CONFIG_ACPI_PROCFS_POWER |
@@ -70,6 +72,7 @@ MODULE_DESCRIPTION("ACPI Battery Driver"); | |||
70 | MODULE_LICENSE("GPL"); | 72 | MODULE_LICENSE("GPL"); |
71 | 73 | ||
72 | static int battery_bix_broken_package; | 74 | static int battery_bix_broken_package; |
75 | static int battery_notification_delay_ms; | ||
73 | static unsigned int cache_time = 1000; | 76 | static unsigned int cache_time = 1000; |
74 | module_param(cache_time, uint, 0644); | 77 | module_param(cache_time, uint, 0644); |
75 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); | 78 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); |
@@ -532,6 +535,20 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
532 | " invalid.\n"); | 535 | " invalid.\n"); |
533 | } | 536 | } |
534 | 537 | ||
538 | /* | ||
539 | * When fully charged, some batteries wrongly report | ||
540 | * capacity_now = design_capacity instead of = full_charge_capacity | ||
541 | */ | ||
542 | if (battery->capacity_now > battery->full_charge_capacity | ||
543 | && battery->full_charge_capacity != ACPI_BATTERY_VALUE_UNKNOWN) { | ||
544 | battery->capacity_now = battery->full_charge_capacity; | ||
545 | if (battery->capacity_now != battery->design_capacity) | ||
546 | printk_once(KERN_WARNING FW_BUG | ||
547 | "battery: reported current charge level (%d) " | ||
548 | "is higher than reported maximum charge level (%d).\n", | ||
549 | battery->capacity_now, battery->full_charge_capacity); | ||
550 | } | ||
551 | |||
535 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) | 552 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) |
536 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) | 553 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) |
537 | battery->capacity_now = (battery->capacity_now * | 554 | battery->capacity_now = (battery->capacity_now * |
@@ -930,7 +947,10 @@ static ssize_t acpi_battery_write_alarm(struct file *file, | |||
930 | goto end; | 947 | goto end; |
931 | } | 948 | } |
932 | alarm_string[count] = '\0'; | 949 | alarm_string[count] = '\0'; |
933 | battery->alarm = simple_strtol(alarm_string, NULL, 0); | 950 | if (kstrtoint(alarm_string, 0, &battery->alarm)) { |
951 | result = -EINVAL; | ||
952 | goto end; | ||
953 | } | ||
934 | result = acpi_battery_set_alarm(battery); | 954 | result = acpi_battery_set_alarm(battery); |
935 | end: | 955 | end: |
936 | if (!result) | 956 | if (!result) |
@@ -1062,6 +1082,14 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event) | |||
1062 | if (!battery) | 1082 | if (!battery) |
1063 | return; | 1083 | return; |
1064 | old = battery->bat.dev; | 1084 | old = battery->bat.dev; |
1085 | /* | ||
1086 | * On Acer Aspire V5-573G notifications are sometimes triggered too | ||
1087 | * early. For example, when AC is unplugged and notification is | ||
1088 | * triggered, battery state is still reported as "Full", and changes to | ||
1089 | * "Discharging" only after short delay, without any notification. | ||
1090 | */ | ||
1091 | if (battery_notification_delay_ms > 0) | ||
1092 | msleep(battery_notification_delay_ms); | ||
1065 | if (event == ACPI_BATTERY_NOTIFY_INFO) | 1093 | if (event == ACPI_BATTERY_NOTIFY_INFO) |
1066 | acpi_battery_refresh(battery); | 1094 | acpi_battery_refresh(battery); |
1067 | acpi_battery_update(battery, false); | 1095 | acpi_battery_update(battery, false); |
@@ -1106,17 +1134,60 @@ static int battery_notify(struct notifier_block *nb, | |||
1106 | return 0; | 1134 | return 0; |
1107 | } | 1135 | } |
1108 | 1136 | ||
1137 | static int battery_bix_broken_package_quirk(const struct dmi_system_id *d) | ||
1138 | { | ||
1139 | battery_bix_broken_package = 1; | ||
1140 | return 0; | ||
1141 | } | ||
1142 | |||
1143 | static int battery_notification_delay_quirk(const struct dmi_system_id *d) | ||
1144 | { | ||
1145 | battery_notification_delay_ms = 1000; | ||
1146 | return 0; | ||
1147 | } | ||
1148 | |||
1109 | static struct dmi_system_id bat_dmi_table[] = { | 1149 | static struct dmi_system_id bat_dmi_table[] = { |
1110 | { | 1150 | { |
1151 | .callback = battery_bix_broken_package_quirk, | ||
1111 | .ident = "NEC LZ750/LS", | 1152 | .ident = "NEC LZ750/LS", |
1112 | .matches = { | 1153 | .matches = { |
1113 | DMI_MATCH(DMI_SYS_VENDOR, "NEC"), | 1154 | DMI_MATCH(DMI_SYS_VENDOR, "NEC"), |
1114 | DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"), | 1155 | DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"), |
1115 | }, | 1156 | }, |
1116 | }, | 1157 | }, |
1158 | { | ||
1159 | .callback = battery_notification_delay_quirk, | ||
1160 | .ident = "Acer Aspire V5-573G", | ||
1161 | .matches = { | ||
1162 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
1163 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"), | ||
1164 | }, | ||
1165 | }, | ||
1117 | {}, | 1166 | {}, |
1118 | }; | 1167 | }; |
1119 | 1168 | ||
1169 | /* | ||
1170 | * Some machines'(E,G Lenovo Z480) ECs are not stable | ||
1171 | * during boot up and this causes battery driver fails to be | ||
1172 | * probed due to failure of getting battery information | ||
1173 | * from EC sometimes. After several retries, the operation | ||
1174 | * may work. So add retry code here and 20ms sleep between | ||
1175 | * every retries. | ||
1176 | */ | ||
1177 | static int acpi_battery_update_retry(struct acpi_battery *battery) | ||
1178 | { | ||
1179 | int retry, ret; | ||
1180 | |||
1181 | for (retry = 5; retry; retry--) { | ||
1182 | ret = acpi_battery_update(battery, false); | ||
1183 | if (!ret) | ||
1184 | break; | ||
1185 | |||
1186 | msleep(20); | ||
1187 | } | ||
1188 | return ret; | ||
1189 | } | ||
1190 | |||
1120 | static int acpi_battery_add(struct acpi_device *device) | 1191 | static int acpi_battery_add(struct acpi_device *device) |
1121 | { | 1192 | { |
1122 | int result = 0; | 1193 | int result = 0; |
@@ -1135,9 +1206,11 @@ static int acpi_battery_add(struct acpi_device *device) | |||
1135 | mutex_init(&battery->sysfs_lock); | 1206 | mutex_init(&battery->sysfs_lock); |
1136 | if (acpi_has_method(battery->device->handle, "_BIX")) | 1207 | if (acpi_has_method(battery->device->handle, "_BIX")) |
1137 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); | 1208 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); |
1138 | result = acpi_battery_update(battery, false); | 1209 | |
1210 | result = acpi_battery_update_retry(battery); | ||
1139 | if (result) | 1211 | if (result) |
1140 | goto fail; | 1212 | goto fail; |
1213 | |||
1141 | #ifdef CONFIG_ACPI_PROCFS_POWER | 1214 | #ifdef CONFIG_ACPI_PROCFS_POWER |
1142 | result = acpi_battery_add_fs(device); | 1215 | result = acpi_battery_add_fs(device); |
1143 | #endif | 1216 | #endif |
@@ -1227,8 +1300,7 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) | |||
1227 | if (acpi_disabled) | 1300 | if (acpi_disabled) |
1228 | return; | 1301 | return; |
1229 | 1302 | ||
1230 | if (dmi_check_system(bat_dmi_table)) | 1303 | dmi_check_system(bat_dmi_table); |
1231 | battery_bix_broken_package = 1; | ||
1232 | 1304 | ||
1233 | #ifdef CONFIG_ACPI_PROCFS_POWER | 1305 | #ifdef CONFIG_ACPI_PROCFS_POWER |
1234 | acpi_battery_dir = acpi_lock_battery_dir(); | 1306 | acpi_battery_dir = acpi_lock_battery_dir(); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index ad11ba4a412d..a66ab658abbc 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -1,11 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * ec.c - ACPI Embedded Controller Driver (v2.1) | 2 | * ec.c - ACPI Embedded Controller Driver (v2.2) |
3 | * | 3 | * |
4 | * Copyright (C) 2006-2008 Alexey Starikovskiy <astarikovskiy@suse.de> | 4 | * Copyright (C) 2001-2014 Intel Corporation |
5 | * Copyright (C) 2006 Denis Sadykov <denis.m.sadykov@intel.com> | 5 | * Author: 2014 Lv Zheng <lv.zheng@intel.com> |
6 | * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> | 6 | * 2006, 2007 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> |
7 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | 7 | * 2006 Denis Sadykov <denis.m.sadykov@intel.com> |
8 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | 8 | * 2004 Luming Yu <luming.yu@intel.com> |
9 | * 2001, 2002 Andy Grover <andrew.grover@intel.com> | ||
10 | * 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | ||
11 | * Copyright (C) 2008 Alexey Starikovskiy <astarikovskiy@suse.de> | ||
9 | * | 12 | * |
10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 13 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
11 | * | 14 | * |
@@ -52,6 +55,7 @@ | |||
52 | /* EC status register */ | 55 | /* EC status register */ |
53 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ | 56 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ |
54 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ | 57 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ |
58 | #define ACPI_EC_FLAG_CMD 0x08 /* Input buffer contains a command */ | ||
55 | #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ | 59 | #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ |
56 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ | 60 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ |
57 | 61 | ||
@@ -78,6 +82,9 @@ enum { | |||
78 | EC_FLAGS_BLOCKED, /* Transactions are blocked */ | 82 | EC_FLAGS_BLOCKED, /* Transactions are blocked */ |
79 | }; | 83 | }; |
80 | 84 | ||
85 | #define ACPI_EC_COMMAND_POLL 0x01 /* Available for command byte */ | ||
86 | #define ACPI_EC_COMMAND_COMPLETE 0x02 /* Completed last byte */ | ||
87 | |||
81 | /* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */ | 88 | /* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */ |
82 | static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY; | 89 | static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY; |
83 | module_param(ec_delay, uint, 0644); | 90 | module_param(ec_delay, uint, 0644); |
@@ -109,7 +116,7 @@ struct transaction { | |||
109 | u8 ri; | 116 | u8 ri; |
110 | u8 wlen; | 117 | u8 wlen; |
111 | u8 rlen; | 118 | u8 rlen; |
112 | bool done; | 119 | u8 flags; |
113 | }; | 120 | }; |
114 | 121 | ||
115 | struct acpi_ec *boot_ec, *first_ec; | 122 | struct acpi_ec *boot_ec, *first_ec; |
@@ -127,83 +134,104 @@ static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */ | |||
127 | static inline u8 acpi_ec_read_status(struct acpi_ec *ec) | 134 | static inline u8 acpi_ec_read_status(struct acpi_ec *ec) |
128 | { | 135 | { |
129 | u8 x = inb(ec->command_addr); | 136 | u8 x = inb(ec->command_addr); |
130 | pr_debug("---> status = 0x%2.2x\n", x); | 137 | pr_debug("EC_SC(R) = 0x%2.2x " |
138 | "SCI_EVT=%d BURST=%d CMD=%d IBF=%d OBF=%d\n", | ||
139 | x, | ||
140 | !!(x & ACPI_EC_FLAG_SCI), | ||
141 | !!(x & ACPI_EC_FLAG_BURST), | ||
142 | !!(x & ACPI_EC_FLAG_CMD), | ||
143 | !!(x & ACPI_EC_FLAG_IBF), | ||
144 | !!(x & ACPI_EC_FLAG_OBF)); | ||
131 | return x; | 145 | return x; |
132 | } | 146 | } |
133 | 147 | ||
134 | static inline u8 acpi_ec_read_data(struct acpi_ec *ec) | 148 | static inline u8 acpi_ec_read_data(struct acpi_ec *ec) |
135 | { | 149 | { |
136 | u8 x = inb(ec->data_addr); | 150 | u8 x = inb(ec->data_addr); |
137 | pr_debug("---> data = 0x%2.2x\n", x); | 151 | pr_debug("EC_DATA(R) = 0x%2.2x\n", x); |
138 | return x; | 152 | return x; |
139 | } | 153 | } |
140 | 154 | ||
141 | static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) | 155 | static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) |
142 | { | 156 | { |
143 | pr_debug("<--- command = 0x%2.2x\n", command); | 157 | pr_debug("EC_SC(W) = 0x%2.2x\n", command); |
144 | outb(command, ec->command_addr); | 158 | outb(command, ec->command_addr); |
145 | } | 159 | } |
146 | 160 | ||
147 | static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) | 161 | static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) |
148 | { | 162 | { |
149 | pr_debug("<--- data = 0x%2.2x\n", data); | 163 | pr_debug("EC_DATA(W) = 0x%2.2x\n", data); |
150 | outb(data, ec->data_addr); | 164 | outb(data, ec->data_addr); |
151 | } | 165 | } |
152 | 166 | ||
153 | static int ec_transaction_done(struct acpi_ec *ec) | 167 | static int ec_transaction_completed(struct acpi_ec *ec) |
154 | { | 168 | { |
155 | unsigned long flags; | 169 | unsigned long flags; |
156 | int ret = 0; | 170 | int ret = 0; |
157 | spin_lock_irqsave(&ec->lock, flags); | 171 | spin_lock_irqsave(&ec->lock, flags); |
158 | if (!ec->curr || ec->curr->done) | 172 | if (ec->curr && (ec->curr->flags & ACPI_EC_COMMAND_COMPLETE)) |
159 | ret = 1; | 173 | ret = 1; |
160 | spin_unlock_irqrestore(&ec->lock, flags); | 174 | spin_unlock_irqrestore(&ec->lock, flags); |
161 | return ret; | 175 | return ret; |
162 | } | 176 | } |
163 | 177 | ||
164 | static void start_transaction(struct acpi_ec *ec) | 178 | static bool advance_transaction(struct acpi_ec *ec) |
165 | { | 179 | { |
166 | ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0; | ||
167 | ec->curr->done = false; | ||
168 | acpi_ec_write_cmd(ec, ec->curr->command); | ||
169 | } | ||
170 | |||
171 | static void advance_transaction(struct acpi_ec *ec, u8 status) | ||
172 | { | ||
173 | unsigned long flags; | ||
174 | struct transaction *t; | 180 | struct transaction *t; |
181 | u8 status; | ||
182 | bool wakeup = false; | ||
175 | 183 | ||
176 | spin_lock_irqsave(&ec->lock, flags); | 184 | pr_debug("===== %s =====\n", in_interrupt() ? "IRQ" : "TASK"); |
185 | status = acpi_ec_read_status(ec); | ||
177 | t = ec->curr; | 186 | t = ec->curr; |
178 | if (!t) | 187 | if (!t) |
179 | goto unlock; | 188 | goto err; |
180 | if (t->wlen > t->wi) { | 189 | if (t->flags & ACPI_EC_COMMAND_POLL) { |
181 | if ((status & ACPI_EC_FLAG_IBF) == 0) | 190 | if (t->wlen > t->wi) { |
182 | acpi_ec_write_data(ec, | 191 | if ((status & ACPI_EC_FLAG_IBF) == 0) |
183 | t->wdata[t->wi++]); | 192 | acpi_ec_write_data(ec, t->wdata[t->wi++]); |
184 | else | 193 | else |
185 | goto err; | 194 | goto err; |
186 | } else if (t->rlen > t->ri) { | 195 | } else if (t->rlen > t->ri) { |
187 | if ((status & ACPI_EC_FLAG_OBF) == 1) { | 196 | if ((status & ACPI_EC_FLAG_OBF) == 1) { |
188 | t->rdata[t->ri++] = acpi_ec_read_data(ec); | 197 | t->rdata[t->ri++] = acpi_ec_read_data(ec); |
189 | if (t->rlen == t->ri) | 198 | if (t->rlen == t->ri) { |
190 | t->done = true; | 199 | t->flags |= ACPI_EC_COMMAND_COMPLETE; |
200 | wakeup = true; | ||
201 | } | ||
202 | } else | ||
203 | goto err; | ||
204 | } else if (t->wlen == t->wi && | ||
205 | (status & ACPI_EC_FLAG_IBF) == 0) { | ||
206 | t->flags |= ACPI_EC_COMMAND_COMPLETE; | ||
207 | wakeup = true; | ||
208 | } | ||
209 | return wakeup; | ||
210 | } else { | ||
211 | if ((status & ACPI_EC_FLAG_IBF) == 0) { | ||
212 | acpi_ec_write_cmd(ec, t->command); | ||
213 | t->flags |= ACPI_EC_COMMAND_POLL; | ||
191 | } else | 214 | } else |
192 | goto err; | 215 | goto err; |
193 | } else if (t->wlen == t->wi && | 216 | return wakeup; |
194 | (status & ACPI_EC_FLAG_IBF) == 0) | 217 | } |
195 | t->done = true; | ||
196 | goto unlock; | ||
197 | err: | 218 | err: |
198 | /* | 219 | /* |
199 | * If SCI bit is set, then don't think it's a false IRQ | 220 | * If SCI bit is set, then don't think it's a false IRQ |
200 | * otherwise will take a not handled IRQ as a false one. | 221 | * otherwise will take a not handled IRQ as a false one. |
201 | */ | 222 | */ |
202 | if (in_interrupt() && !(status & ACPI_EC_FLAG_SCI)) | 223 | if (!(status & ACPI_EC_FLAG_SCI)) { |
203 | ++t->irq_count; | 224 | if (in_interrupt() && t) |
225 | ++t->irq_count; | ||
226 | } | ||
227 | return wakeup; | ||
228 | } | ||
204 | 229 | ||
205 | unlock: | 230 | static void start_transaction(struct acpi_ec *ec) |
206 | spin_unlock_irqrestore(&ec->lock, flags); | 231 | { |
232 | ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0; | ||
233 | ec->curr->flags = 0; | ||
234 | (void)advance_transaction(ec); | ||
207 | } | 235 | } |
208 | 236 | ||
209 | static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data); | 237 | static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data); |
@@ -228,15 +256,17 @@ static int ec_poll(struct acpi_ec *ec) | |||
228 | /* don't sleep with disabled interrupts */ | 256 | /* don't sleep with disabled interrupts */ |
229 | if (EC_FLAGS_MSI || irqs_disabled()) { | 257 | if (EC_FLAGS_MSI || irqs_disabled()) { |
230 | udelay(ACPI_EC_MSI_UDELAY); | 258 | udelay(ACPI_EC_MSI_UDELAY); |
231 | if (ec_transaction_done(ec)) | 259 | if (ec_transaction_completed(ec)) |
232 | return 0; | 260 | return 0; |
233 | } else { | 261 | } else { |
234 | if (wait_event_timeout(ec->wait, | 262 | if (wait_event_timeout(ec->wait, |
235 | ec_transaction_done(ec), | 263 | ec_transaction_completed(ec), |
236 | msecs_to_jiffies(1))) | 264 | msecs_to_jiffies(1))) |
237 | return 0; | 265 | return 0; |
238 | } | 266 | } |
239 | advance_transaction(ec, acpi_ec_read_status(ec)); | 267 | spin_lock_irqsave(&ec->lock, flags); |
268 | (void)advance_transaction(ec); | ||
269 | spin_unlock_irqrestore(&ec->lock, flags); | ||
240 | } while (time_before(jiffies, delay)); | 270 | } while (time_before(jiffies, delay)); |
241 | pr_debug("controller reset, restart transaction\n"); | 271 | pr_debug("controller reset, restart transaction\n"); |
242 | spin_lock_irqsave(&ec->lock, flags); | 272 | spin_lock_irqsave(&ec->lock, flags); |
@@ -268,23 +298,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
268 | return ret; | 298 | return ret; |
269 | } | 299 | } |
270 | 300 | ||
271 | static int ec_check_ibf0(struct acpi_ec *ec) | ||
272 | { | ||
273 | u8 status = acpi_ec_read_status(ec); | ||
274 | return (status & ACPI_EC_FLAG_IBF) == 0; | ||
275 | } | ||
276 | |||
277 | static int ec_wait_ibf0(struct acpi_ec *ec) | ||
278 | { | ||
279 | unsigned long delay = jiffies + msecs_to_jiffies(ec_delay); | ||
280 | /* interrupt wait manually if GPE mode is not active */ | ||
281 | while (time_before(jiffies, delay)) | ||
282 | if (wait_event_timeout(ec->wait, ec_check_ibf0(ec), | ||
283 | msecs_to_jiffies(1))) | ||
284 | return 0; | ||
285 | return -ETIME; | ||
286 | } | ||
287 | |||
288 | static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | 301 | static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) |
289 | { | 302 | { |
290 | int status; | 303 | int status; |
@@ -305,12 +318,6 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
305 | goto unlock; | 318 | goto unlock; |
306 | } | 319 | } |
307 | } | 320 | } |
308 | if (ec_wait_ibf0(ec)) { | ||
309 | pr_err("input buffer is not empty, " | ||
310 | "aborting transaction\n"); | ||
311 | status = -ETIME; | ||
312 | goto end; | ||
313 | } | ||
314 | pr_debug("transaction start (cmd=0x%02x, addr=0x%02x)\n", | 321 | pr_debug("transaction start (cmd=0x%02x, addr=0x%02x)\n", |
315 | t->command, t->wdata ? t->wdata[0] : 0); | 322 | t->command, t->wdata ? t->wdata[0] : 0); |
316 | /* disable GPE during transaction if storm is detected */ | 323 | /* disable GPE during transaction if storm is detected */ |
@@ -334,7 +341,6 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
334 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); | 341 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); |
335 | } | 342 | } |
336 | pr_debug("transaction end\n"); | 343 | pr_debug("transaction end\n"); |
337 | end: | ||
338 | if (ec->global_lock) | 344 | if (ec->global_lock) |
339 | acpi_release_global_lock(glk); | 345 | acpi_release_global_lock(glk); |
340 | unlock: | 346 | unlock: |
@@ -634,17 +640,14 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state) | |||
634 | static u32 acpi_ec_gpe_handler(acpi_handle gpe_device, | 640 | static u32 acpi_ec_gpe_handler(acpi_handle gpe_device, |
635 | u32 gpe_number, void *data) | 641 | u32 gpe_number, void *data) |
636 | { | 642 | { |
643 | unsigned long flags; | ||
637 | struct acpi_ec *ec = data; | 644 | struct acpi_ec *ec = data; |
638 | u8 status = acpi_ec_read_status(ec); | ||
639 | 645 | ||
640 | pr_debug("~~~> interrupt, status:0x%02x\n", status); | 646 | spin_lock_irqsave(&ec->lock, flags); |
641 | 647 | if (advance_transaction(ec)) | |
642 | advance_transaction(ec, status); | ||
643 | if (ec_transaction_done(ec) && | ||
644 | (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { | ||
645 | wake_up(&ec->wait); | 648 | wake_up(&ec->wait); |
646 | ec_check_sci(ec, acpi_ec_read_status(ec)); | 649 | spin_unlock_irqrestore(&ec->lock, flags); |
647 | } | 650 | ec_check_sci(ec, acpi_ec_read_status(ec)); |
648 | return ACPI_INTERRUPT_HANDLED | ACPI_REENABLE_GPE; | 651 | return ACPI_INTERRUPT_HANDLED | ACPI_REENABLE_GPE; |
649 | } | 652 | } |
650 | 653 | ||
@@ -1066,8 +1069,10 @@ int __init acpi_ec_ecdt_probe(void) | |||
1066 | /* fall through */ | 1069 | /* fall through */ |
1067 | } | 1070 | } |
1068 | 1071 | ||
1069 | if (EC_FLAGS_SKIP_DSDT_SCAN) | 1072 | if (EC_FLAGS_SKIP_DSDT_SCAN) { |
1073 | kfree(saved_ec); | ||
1070 | return -ENODEV; | 1074 | return -ENODEV; |
1075 | } | ||
1071 | 1076 | ||
1072 | /* This workaround is needed only on some broken machines, | 1077 | /* This workaround is needed only on some broken machines, |
1073 | * which require early EC, but fail to provide ECDT */ | 1078 | * which require early EC, but fail to provide ECDT */ |
@@ -1105,6 +1110,7 @@ install: | |||
1105 | } | 1110 | } |
1106 | error: | 1111 | error: |
1107 | kfree(boot_ec); | 1112 | kfree(boot_ec); |
1113 | kfree(saved_ec); | ||
1108 | boot_ec = NULL; | 1114 | boot_ec = NULL; |
1109 | return -ENODEV; | 1115 | return -ENODEV; |
1110 | } | 1116 | } |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 3f2bdc812d23..bad25b070fe0 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -235,7 +235,8 @@ void acpi_os_vprintf(const char *fmt, va_list args) | |||
235 | static unsigned long acpi_rsdp; | 235 | static unsigned long acpi_rsdp; |
236 | static int __init setup_acpi_rsdp(char *arg) | 236 | static int __init setup_acpi_rsdp(char *arg) |
237 | { | 237 | { |
238 | acpi_rsdp = simple_strtoul(arg, NULL, 16); | 238 | if (kstrtoul(arg, 16, &acpi_rsdp)) |
239 | return -EINVAL; | ||
239 | return 0; | 240 | return 0; |
240 | } | 241 | } |
241 | early_param("acpi_rsdp", setup_acpi_rsdp); | 242 | early_param("acpi_rsdp", setup_acpi_rsdp); |
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 0bdacc5e26a3..2ba8f02ced36 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c | |||
@@ -77,7 +77,7 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res) | |||
77 | switch (ares->type) { | 77 | switch (ares->type) { |
78 | case ACPI_RESOURCE_TYPE_MEMORY24: | 78 | case ACPI_RESOURCE_TYPE_MEMORY24: |
79 | memory24 = &ares->data.memory24; | 79 | memory24 = &ares->data.memory24; |
80 | if (!memory24->address_length) | 80 | if (!memory24->minimum && !memory24->address_length) |
81 | return false; | 81 | return false; |
82 | acpi_dev_get_memresource(res, memory24->minimum, | 82 | acpi_dev_get_memresource(res, memory24->minimum, |
83 | memory24->address_length, | 83 | memory24->address_length, |
@@ -85,7 +85,7 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res) | |||
85 | break; | 85 | break; |
86 | case ACPI_RESOURCE_TYPE_MEMORY32: | 86 | case ACPI_RESOURCE_TYPE_MEMORY32: |
87 | memory32 = &ares->data.memory32; | 87 | memory32 = &ares->data.memory32; |
88 | if (!memory32->address_length) | 88 | if (!memory32->minimum && !memory32->address_length) |
89 | return false; | 89 | return false; |
90 | acpi_dev_get_memresource(res, memory32->minimum, | 90 | acpi_dev_get_memresource(res, memory32->minimum, |
91 | memory32->address_length, | 91 | memory32->address_length, |
@@ -93,7 +93,7 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res) | |||
93 | break; | 93 | break; |
94 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 94 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
95 | fixed_memory32 = &ares->data.fixed_memory32; | 95 | fixed_memory32 = &ares->data.fixed_memory32; |
96 | if (!fixed_memory32->address_length) | 96 | if (!fixed_memory32->address && !fixed_memory32->address_length) |
97 | return false; | 97 | return false; |
98 | acpi_dev_get_memresource(res, fixed_memory32->address, | 98 | acpi_dev_get_memresource(res, fixed_memory32->address, |
99 | fixed_memory32->address_length, | 99 | fixed_memory32->address_length, |
@@ -150,7 +150,7 @@ bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res) | |||
150 | switch (ares->type) { | 150 | switch (ares->type) { |
151 | case ACPI_RESOURCE_TYPE_IO: | 151 | case ACPI_RESOURCE_TYPE_IO: |
152 | io = &ares->data.io; | 152 | io = &ares->data.io; |
153 | if (!io->address_length) | 153 | if (!io->minimum && !io->address_length) |
154 | return false; | 154 | return false; |
155 | acpi_dev_get_ioresource(res, io->minimum, | 155 | acpi_dev_get_ioresource(res, io->minimum, |
156 | io->address_length, | 156 | io->address_length, |
@@ -158,7 +158,7 @@ bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res) | |||
158 | break; | 158 | break; |
159 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 159 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
160 | fixed_io = &ares->data.fixed_io; | 160 | fixed_io = &ares->data.fixed_io; |
161 | if (!fixed_io->address_length) | 161 | if (!fixed_io->address && !fixed_io->address_length) |
162 | return false; | 162 | return false; |
163 | acpi_dev_get_ioresource(res, fixed_io->address, | 163 | acpi_dev_get_ioresource(res, fixed_io->address, |
164 | fixed_io->address_length, | 164 | fixed_io->address_length, |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 05550ba44d32..6d5a6cda0734 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -360,7 +360,8 @@ static int __init acpi_parse_apic_instance(char *str) | |||
360 | if (!str) | 360 | if (!str) |
361 | return -EINVAL; | 361 | return -EINVAL; |
362 | 362 | ||
363 | acpi_apic_instance = simple_strtoul(str, NULL, 0); | 363 | if (kstrtoint(str, 0, &acpi_apic_instance)) |
364 | return -EINVAL; | ||
364 | 365 | ||
365 | pr_notice("Shall use APIC/MADT table %d\n", acpi_apic_instance); | 366 | pr_notice("Shall use APIC/MADT table %d\n", acpi_apic_instance); |
366 | 367 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index fb9ffe9adc64..071c1dfb93f3 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -241,13 +241,14 @@ static bool acpi_video_use_native_backlight(void) | |||
241 | return use_native_backlight_dmi; | 241 | return use_native_backlight_dmi; |
242 | } | 242 | } |
243 | 243 | ||
244 | static bool acpi_video_verify_backlight_support(void) | 244 | bool acpi_video_verify_backlight_support(void) |
245 | { | 245 | { |
246 | if (acpi_osi_is_win8() && acpi_video_use_native_backlight() && | 246 | if (acpi_osi_is_win8() && acpi_video_use_native_backlight() && |
247 | backlight_device_registered(BACKLIGHT_RAW)) | 247 | backlight_device_registered(BACKLIGHT_RAW)) |
248 | return false; | 248 | return false; |
249 | return acpi_video_backlight_support(); | 249 | return acpi_video_backlight_support(); |
250 | } | 250 | } |
251 | EXPORT_SYMBOL_GPL(acpi_video_verify_backlight_support); | ||
251 | 252 | ||
252 | /* backlight device sysfs support */ | 253 | /* backlight device sysfs support */ |
253 | static int acpi_video_get_brightness(struct backlight_device *bd) | 254 | static int acpi_video_get_brightness(struct backlight_device *bd) |
@@ -563,6 +564,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
563 | }, | 564 | }, |
564 | }, | 565 | }, |
565 | { | 566 | { |
567 | .callback = video_set_use_native_backlight, | ||
568 | .ident = "Acer TravelMate B113", | ||
569 | .matches = { | ||
570 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
571 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate B113"), | ||
572 | }, | ||
573 | }, | ||
574 | { | ||
566 | .callback = video_set_use_native_backlight, | 575 | .callback = video_set_use_native_backlight, |
567 | .ident = "HP ProBook 4340s", | 576 | .ident = "HP ProBook 4340s", |
568 | .matches = { | 577 | .matches = { |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 33e3db548a29..c42feb2bacd0 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -166,6 +166,14 @@ static struct dmi_system_id video_detect_dmi_table[] = { | |||
166 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), | 166 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), |
167 | }, | 167 | }, |
168 | }, | 168 | }, |
169 | { | ||
170 | .callback = video_detect_force_vendor, | ||
171 | .ident = "Dell Inspiron 5737", | ||
172 | .matches = { | ||
173 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
174 | DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5737"), | ||
175 | }, | ||
176 | }, | ||
169 | { }, | 177 | { }, |
170 | }; | 178 | }; |
171 | 179 | ||
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 05882e4445a6..5513296e5e2e 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
@@ -371,7 +371,9 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
371 | int pmp, unsigned long deadline, | 371 | int pmp, unsigned long deadline, |
372 | int (*check_ready)(struct ata_link *link)); | 372 | int (*check_ready)(struct ata_link *link)); |
373 | 373 | ||
374 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); | ||
374 | int ahci_stop_engine(struct ata_port *ap); | 375 | int ahci_stop_engine(struct ata_port *ap); |
376 | void ahci_start_fis_rx(struct ata_port *ap); | ||
375 | void ahci_start_engine(struct ata_port *ap); | 377 | void ahci_start_engine(struct ata_port *ap); |
376 | int ahci_check_ready(struct ata_link *link); | 378 | int ahci_check_ready(struct ata_link *link); |
377 | int ahci_kick_engine(struct ata_port *ap); | 379 | int ahci_kick_engine(struct ata_port *ap); |
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 3a901520c62b..cac4360f272a 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c | |||
@@ -58,6 +58,8 @@ enum ahci_imx_type { | |||
58 | struct imx_ahci_priv { | 58 | struct imx_ahci_priv { |
59 | struct platform_device *ahci_pdev; | 59 | struct platform_device *ahci_pdev; |
60 | enum ahci_imx_type type; | 60 | enum ahci_imx_type type; |
61 | struct clk *sata_clk; | ||
62 | struct clk *sata_ref_clk; | ||
61 | struct clk *ahb_clk; | 63 | struct clk *ahb_clk; |
62 | struct regmap *gpr; | 64 | struct regmap *gpr; |
63 | bool no_device; | 65 | bool no_device; |
@@ -224,7 +226,7 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv) | |||
224 | return ret; | 226 | return ret; |
225 | } | 227 | } |
226 | 228 | ||
227 | ret = ahci_platform_enable_clks(hpriv); | 229 | ret = clk_prepare_enable(imxpriv->sata_ref_clk); |
228 | if (ret < 0) | 230 | if (ret < 0) |
229 | goto disable_regulator; | 231 | goto disable_regulator; |
230 | 232 | ||
@@ -291,7 +293,7 @@ static void imx_sata_disable(struct ahci_host_priv *hpriv) | |||
291 | !IMX6Q_GPR13_SATA_MPLL_CLK_EN); | 293 | !IMX6Q_GPR13_SATA_MPLL_CLK_EN); |
292 | } | 294 | } |
293 | 295 | ||
294 | ahci_platform_disable_clks(hpriv); | 296 | clk_disable_unprepare(imxpriv->sata_ref_clk); |
295 | 297 | ||
296 | if (hpriv->target_pwr) | 298 | if (hpriv->target_pwr) |
297 | regulator_disable(hpriv->target_pwr); | 299 | regulator_disable(hpriv->target_pwr); |
@@ -324,6 +326,9 @@ static void ahci_imx_error_handler(struct ata_port *ap) | |||
324 | writel(reg_val | IMX_P0PHYCR_TEST_PDDQ, mmio + IMX_P0PHYCR); | 326 | writel(reg_val | IMX_P0PHYCR_TEST_PDDQ, mmio + IMX_P0PHYCR); |
325 | imx_sata_disable(hpriv); | 327 | imx_sata_disable(hpriv); |
326 | imxpriv->no_device = true; | 328 | imxpriv->no_device = true; |
329 | |||
330 | dev_info(ap->dev, "no device found, disabling link.\n"); | ||
331 | dev_info(ap->dev, "pass " MODULE_PARAM_PREFIX ".hotplug=1 to enable hotplug\n"); | ||
327 | } | 332 | } |
328 | 333 | ||
329 | static int ahci_imx_softreset(struct ata_link *link, unsigned int *class, | 334 | static int ahci_imx_softreset(struct ata_link *link, unsigned int *class, |
@@ -385,6 +390,19 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
385 | imxpriv->no_device = false; | 390 | imxpriv->no_device = false; |
386 | imxpriv->first_time = true; | 391 | imxpriv->first_time = true; |
387 | imxpriv->type = (enum ahci_imx_type)of_id->data; | 392 | imxpriv->type = (enum ahci_imx_type)of_id->data; |
393 | |||
394 | imxpriv->sata_clk = devm_clk_get(dev, "sata"); | ||
395 | if (IS_ERR(imxpriv->sata_clk)) { | ||
396 | dev_err(dev, "can't get sata clock.\n"); | ||
397 | return PTR_ERR(imxpriv->sata_clk); | ||
398 | } | ||
399 | |||
400 | imxpriv->sata_ref_clk = devm_clk_get(dev, "sata_ref"); | ||
401 | if (IS_ERR(imxpriv->sata_ref_clk)) { | ||
402 | dev_err(dev, "can't get sata_ref clock.\n"); | ||
403 | return PTR_ERR(imxpriv->sata_ref_clk); | ||
404 | } | ||
405 | |||
388 | imxpriv->ahb_clk = devm_clk_get(dev, "ahb"); | 406 | imxpriv->ahb_clk = devm_clk_get(dev, "ahb"); |
389 | if (IS_ERR(imxpriv->ahb_clk)) { | 407 | if (IS_ERR(imxpriv->ahb_clk)) { |
390 | dev_err(dev, "can't get ahb clock.\n"); | 408 | dev_err(dev, "can't get ahb clock.\n"); |
@@ -407,10 +425,14 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
407 | 425 | ||
408 | hpriv->plat_data = imxpriv; | 426 | hpriv->plat_data = imxpriv; |
409 | 427 | ||
410 | ret = imx_sata_enable(hpriv); | 428 | ret = clk_prepare_enable(imxpriv->sata_clk); |
411 | if (ret) | 429 | if (ret) |
412 | return ret; | 430 | return ret; |
413 | 431 | ||
432 | ret = imx_sata_enable(hpriv); | ||
433 | if (ret) | ||
434 | goto disable_clk; | ||
435 | |||
414 | /* | 436 | /* |
415 | * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL, | 437 | * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL, |
416 | * and IP vendor specific register IMX_TIMER1MS. | 438 | * and IP vendor specific register IMX_TIMER1MS. |
@@ -435,16 +457,24 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
435 | ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, | 457 | ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, |
436 | 0, 0, 0); | 458 | 0, 0, 0); |
437 | if (ret) | 459 | if (ret) |
438 | imx_sata_disable(hpriv); | 460 | goto disable_sata; |
439 | 461 | ||
462 | return 0; | ||
463 | |||
464 | disable_sata: | ||
465 | imx_sata_disable(hpriv); | ||
466 | disable_clk: | ||
467 | clk_disable_unprepare(imxpriv->sata_clk); | ||
440 | return ret; | 468 | return ret; |
441 | } | 469 | } |
442 | 470 | ||
443 | static void ahci_imx_host_stop(struct ata_host *host) | 471 | static void ahci_imx_host_stop(struct ata_host *host) |
444 | { | 472 | { |
445 | struct ahci_host_priv *hpriv = host->private_data; | 473 | struct ahci_host_priv *hpriv = host->private_data; |
474 | struct imx_ahci_priv *imxpriv = hpriv->plat_data; | ||
446 | 475 | ||
447 | imx_sata_disable(hpriv); | 476 | imx_sata_disable(hpriv); |
477 | clk_disable_unprepare(imxpriv->sata_clk); | ||
448 | } | 478 | } |
449 | 479 | ||
450 | #ifdef CONFIG_PM_SLEEP | 480 | #ifdef CONFIG_PM_SLEEP |
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index ebe505c17763..b10d81ddb528 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c | |||
@@ -58,7 +58,7 @@ static int ahci_probe(struct platform_device *pdev) | |||
58 | } | 58 | } |
59 | 59 | ||
60 | if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) | 60 | if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) |
61 | hflags |= AHCI_HFLAG_NO_FBS; | 61 | hflags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; |
62 | 62 | ||
63 | rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, | 63 | rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, |
64 | hflags, 0, 0); | 64 | hflags, 0, 0); |
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index 042a9bb45c86..ee3a3659bd9e 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c | |||
@@ -78,6 +78,7 @@ | |||
78 | struct xgene_ahci_context { | 78 | struct xgene_ahci_context { |
79 | struct ahci_host_priv *hpriv; | 79 | struct ahci_host_priv *hpriv; |
80 | struct device *dev; | 80 | struct device *dev; |
81 | u8 last_cmd[MAX_AHCI_CHN_PERCTR]; /* tracking the last command issued*/ | ||
81 | void __iomem *csr_core; /* Core CSR address of IP */ | 82 | void __iomem *csr_core; /* Core CSR address of IP */ |
82 | void __iomem *csr_diag; /* Diag CSR address of IP */ | 83 | void __iomem *csr_diag; /* Diag CSR address of IP */ |
83 | void __iomem *csr_axi; /* AXI CSR address of IP */ | 84 | void __iomem *csr_axi; /* AXI CSR address of IP */ |
@@ -98,20 +99,62 @@ static int xgene_ahci_init_memram(struct xgene_ahci_context *ctx) | |||
98 | } | 99 | } |
99 | 100 | ||
100 | /** | 101 | /** |
102 | * xgene_ahci_restart_engine - Restart the dma engine. | ||
103 | * @ap : ATA port of interest | ||
104 | * | ||
105 | * Restarts the dma engine inside the controller. | ||
106 | */ | ||
107 | static int xgene_ahci_restart_engine(struct ata_port *ap) | ||
108 | { | ||
109 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
110 | |||
111 | ahci_stop_engine(ap); | ||
112 | ahci_start_fis_rx(ap); | ||
113 | hpriv->start_engine(ap); | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * xgene_ahci_qc_issue - Issue commands to the device | ||
120 | * @qc: Command to issue | ||
121 | * | ||
122 | * Due to Hardware errata for IDENTIFY DEVICE command, the controller cannot | ||
123 | * clear the BSY bit after receiving the PIO setup FIS. This results in the dma | ||
124 | * state machine goes into the CMFatalErrorUpdate state and locks up. By | ||
125 | * restarting the dma engine, it removes the controller out of lock up state. | ||
126 | */ | ||
127 | static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) | ||
128 | { | ||
129 | struct ata_port *ap = qc->ap; | ||
130 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
131 | struct xgene_ahci_context *ctx = hpriv->plat_data; | ||
132 | int rc = 0; | ||
133 | |||
134 | if (unlikely(ctx->last_cmd[ap->port_no] == ATA_CMD_ID_ATA)) | ||
135 | xgene_ahci_restart_engine(ap); | ||
136 | |||
137 | rc = ahci_qc_issue(qc); | ||
138 | |||
139 | /* Save the last command issued */ | ||
140 | ctx->last_cmd[ap->port_no] = qc->tf.command; | ||
141 | |||
142 | return rc; | ||
143 | } | ||
144 | |||
145 | /** | ||
101 | * xgene_ahci_read_id - Read ID data from the specified device | 146 | * xgene_ahci_read_id - Read ID data from the specified device |
102 | * @dev: device | 147 | * @dev: device |
103 | * @tf: proposed taskfile | 148 | * @tf: proposed taskfile |
104 | * @id: data buffer | 149 | * @id: data buffer |
105 | * | 150 | * |
106 | * This custom read ID function is required due to the fact that the HW | 151 | * This custom read ID function is required due to the fact that the HW |
107 | * does not support DEVSLP and the controller state machine may get stuck | 152 | * does not support DEVSLP. |
108 | * after processing the ID query command. | ||
109 | */ | 153 | */ |
110 | static unsigned int xgene_ahci_read_id(struct ata_device *dev, | 154 | static unsigned int xgene_ahci_read_id(struct ata_device *dev, |
111 | struct ata_taskfile *tf, u16 *id) | 155 | struct ata_taskfile *tf, u16 *id) |
112 | { | 156 | { |
113 | u32 err_mask; | 157 | u32 err_mask; |
114 | void __iomem *port_mmio = ahci_port_base(dev->link->ap); | ||
115 | 158 | ||
116 | err_mask = ata_do_dev_read_id(dev, tf, id); | 159 | err_mask = ata_do_dev_read_id(dev, tf, id); |
117 | if (err_mask) | 160 | if (err_mask) |
@@ -133,16 +176,6 @@ static unsigned int xgene_ahci_read_id(struct ata_device *dev, | |||
133 | */ | 176 | */ |
134 | id[ATA_ID_FEATURE_SUPP] &= ~(1 << 8); | 177 | id[ATA_ID_FEATURE_SUPP] &= ~(1 << 8); |
135 | 178 | ||
136 | /* | ||
137 | * Due to HW errata, restart the port if no other command active. | ||
138 | * Otherwise the controller may get stuck. | ||
139 | */ | ||
140 | if (!readl(port_mmio + PORT_CMD_ISSUE)) { | ||
141 | writel(PORT_CMD_FIS_RX, port_mmio + PORT_CMD); | ||
142 | readl(port_mmio + PORT_CMD); /* Force a barrier */ | ||
143 | writel(PORT_CMD_FIS_RX | PORT_CMD_START, port_mmio + PORT_CMD); | ||
144 | readl(port_mmio + PORT_CMD); /* Force a barrier */ | ||
145 | } | ||
146 | return 0; | 179 | return 0; |
147 | } | 180 | } |
148 | 181 | ||
@@ -300,6 +333,7 @@ static struct ata_port_operations xgene_ahci_ops = { | |||
300 | .host_stop = xgene_ahci_host_stop, | 333 | .host_stop = xgene_ahci_host_stop, |
301 | .hardreset = xgene_ahci_hardreset, | 334 | .hardreset = xgene_ahci_hardreset, |
302 | .read_id = xgene_ahci_read_id, | 335 | .read_id = xgene_ahci_read_id, |
336 | .qc_issue = xgene_ahci_qc_issue, | ||
303 | }; | 337 | }; |
304 | 338 | ||
305 | static const struct ata_port_info xgene_ahci_port_info = { | 339 | static const struct ata_port_info xgene_ahci_port_info = { |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 40ea583d3610..d72ce0470309 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -68,7 +68,6 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, | |||
68 | 68 | ||
69 | static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); | 69 | static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); |
70 | static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); | 70 | static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); |
71 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); | ||
72 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); | 71 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); |
73 | static int ahci_port_start(struct ata_port *ap); | 72 | static int ahci_port_start(struct ata_port *ap); |
74 | static void ahci_port_stop(struct ata_port *ap); | 73 | static void ahci_port_stop(struct ata_port *ap); |
@@ -620,7 +619,7 @@ int ahci_stop_engine(struct ata_port *ap) | |||
620 | } | 619 | } |
621 | EXPORT_SYMBOL_GPL(ahci_stop_engine); | 620 | EXPORT_SYMBOL_GPL(ahci_stop_engine); |
622 | 621 | ||
623 | static void ahci_start_fis_rx(struct ata_port *ap) | 622 | void ahci_start_fis_rx(struct ata_port *ap) |
624 | { | 623 | { |
625 | void __iomem *port_mmio = ahci_port_base(ap); | 624 | void __iomem *port_mmio = ahci_port_base(ap); |
626 | struct ahci_host_priv *hpriv = ap->host->private_data; | 625 | struct ahci_host_priv *hpriv = ap->host->private_data; |
@@ -646,6 +645,7 @@ static void ahci_start_fis_rx(struct ata_port *ap) | |||
646 | /* flush */ | 645 | /* flush */ |
647 | readl(port_mmio + PORT_CMD); | 646 | readl(port_mmio + PORT_CMD); |
648 | } | 647 | } |
648 | EXPORT_SYMBOL_GPL(ahci_start_fis_rx); | ||
649 | 649 | ||
650 | static int ahci_stop_fis_rx(struct ata_port *ap) | 650 | static int ahci_stop_fis_rx(struct ata_port *ap) |
651 | { | 651 | { |
@@ -1945,7 +1945,7 @@ irqreturn_t ahci_interrupt(int irq, void *dev_instance) | |||
1945 | } | 1945 | } |
1946 | EXPORT_SYMBOL_GPL(ahci_interrupt); | 1946 | EXPORT_SYMBOL_GPL(ahci_interrupt); |
1947 | 1947 | ||
1948 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | 1948 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) |
1949 | { | 1949 | { |
1950 | struct ata_port *ap = qc->ap; | 1950 | struct ata_port *ap = qc->ap; |
1951 | void __iomem *port_mmio = ahci_port_base(ap); | 1951 | void __iomem *port_mmio = ahci_port_base(ap); |
@@ -1974,6 +1974,7 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | |||
1974 | 1974 | ||
1975 | return 0; | 1975 | return 0; |
1976 | } | 1976 | } |
1977 | EXPORT_SYMBOL_GPL(ahci_qc_issue); | ||
1977 | 1978 | ||
1978 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc) | 1979 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc) |
1979 | { | 1980 | { |
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 3a5b4ed25a4f..b0077589f065 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c | |||
@@ -250,8 +250,13 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev) | |||
250 | if (IS_ERR(hpriv->phy)) { | 250 | if (IS_ERR(hpriv->phy)) { |
251 | rc = PTR_ERR(hpriv->phy); | 251 | rc = PTR_ERR(hpriv->phy); |
252 | switch (rc) { | 252 | switch (rc) { |
253 | case -ENODEV: | ||
254 | case -ENOSYS: | 253 | case -ENOSYS: |
254 | /* No PHY support. Check if PHY is required. */ | ||
255 | if (of_find_property(dev->of_node, "phys", NULL)) { | ||
256 | dev_err(dev, "couldn't get sata-phy: ENOSYS\n"); | ||
257 | goto err_out; | ||
258 | } | ||
259 | case -ENODEV: | ||
255 | /* continue normally */ | 260 | /* continue normally */ |
256 | hpriv->phy = NULL; | 261 | hpriv->phy = NULL; |
257 | break; | 262 | break; |
diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index 83969f8c5727..6467c919c509 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c | |||
@@ -176,14 +176,24 @@ static int __init cma_activate_area(struct cma *cma) | |||
176 | base_pfn = pfn; | 176 | base_pfn = pfn; |
177 | for (j = pageblock_nr_pages; j; --j, pfn++) { | 177 | for (j = pageblock_nr_pages; j; --j, pfn++) { |
178 | WARN_ON_ONCE(!pfn_valid(pfn)); | 178 | WARN_ON_ONCE(!pfn_valid(pfn)); |
179 | /* | ||
180 | * alloc_contig_range requires the pfn range | ||
181 | * specified to be in the same zone. Make this | ||
182 | * simple by forcing the entire CMA resv range | ||
183 | * to be in the same zone. | ||
184 | */ | ||
179 | if (page_zone(pfn_to_page(pfn)) != zone) | 185 | if (page_zone(pfn_to_page(pfn)) != zone) |
180 | return -EINVAL; | 186 | goto err; |
181 | } | 187 | } |
182 | init_cma_reserved_pageblock(pfn_to_page(base_pfn)); | 188 | init_cma_reserved_pageblock(pfn_to_page(base_pfn)); |
183 | } while (--i); | 189 | } while (--i); |
184 | 190 | ||
185 | mutex_init(&cma->lock); | 191 | mutex_init(&cma->lock); |
186 | return 0; | 192 | return 0; |
193 | |||
194 | err: | ||
195 | kfree(cma->bitmap); | ||
196 | return -EINVAL; | ||
187 | } | 197 | } |
188 | 198 | ||
189 | static struct cma cma_areas[MAX_CMA_AREAS]; | 199 | static struct cma cma_areas[MAX_CMA_AREAS]; |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index b6c8aaf4931b..5b17ec88ea05 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -1337,8 +1337,11 @@ int drbd_submit_peer_request(struct drbd_device *device, | |||
1337 | return 0; | 1337 | return 0; |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | /* Discards don't have any payload. | ||
1341 | * But the scsi layer still expects a bio_vec it can use internally, | ||
1342 | * see sd_setup_discard_cmnd() and blk_add_request_payload(). */ | ||
1340 | if (peer_req->flags & EE_IS_TRIM) | 1343 | if (peer_req->flags & EE_IS_TRIM) |
1341 | nr_pages = 0; /* discards don't have any payload. */ | 1344 | nr_pages = 1; |
1342 | 1345 | ||
1343 | /* In most cases, we will only need one bio. But in case the lower | 1346 | /* In most cases, we will only need one bio. But in case the lower |
1344 | * level restrictions happen to be different at this offset on this | 1347 | * level restrictions happen to be different at this offset on this |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 677db049f55a..56d46ffb08e1 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3777,7 +3777,7 @@ static void floppy_rb0_cb(struct bio *bio, int err) | |||
3777 | int drive = cbdata->drive; | 3777 | int drive = cbdata->drive; |
3778 | 3778 | ||
3779 | if (err) { | 3779 | if (err) { |
3780 | pr_info("floppy: error %d while reading block 0", err); | 3780 | pr_info("floppy: error %d while reading block 0\n", err); |
3781 | set_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); | 3781 | set_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); |
3782 | } | 3782 | } |
3783 | complete(&cbdata->complete); | 3783 | complete(&cbdata->complete); |
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index 77087a29b127..a3b042c4d448 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -79,7 +79,7 @@ MODULE_PARM_DESC(home_node, "Home node for the device"); | |||
79 | 79 | ||
80 | static int queue_mode = NULL_Q_MQ; | 80 | static int queue_mode = NULL_Q_MQ; |
81 | module_param(queue_mode, int, S_IRUGO); | 81 | module_param(queue_mode, int, S_IRUGO); |
82 | MODULE_PARM_DESC(use_mq, "Use blk-mq interface (0=bio,1=rq,2=multiqueue)"); | 82 | MODULE_PARM_DESC(queue_mode, "Block interface to use (0=bio,1=rq,2=multiqueue)"); |
83 | 83 | ||
84 | static int gb = 250; | 84 | static int gb = 250; |
85 | module_param(gb, int, S_IRUGO); | 85 | module_param(gb, int, S_IRUGO); |
@@ -227,7 +227,10 @@ static void null_cmd_end_timer(struct nullb_cmd *cmd) | |||
227 | 227 | ||
228 | static void null_softirq_done_fn(struct request *rq) | 228 | static void null_softirq_done_fn(struct request *rq) |
229 | { | 229 | { |
230 | end_cmd(blk_mq_rq_to_pdu(rq)); | 230 | if (queue_mode == NULL_Q_MQ) |
231 | end_cmd(blk_mq_rq_to_pdu(rq)); | ||
232 | else | ||
233 | end_cmd(rq->special); | ||
231 | } | 234 | } |
232 | 235 | ||
233 | static inline void null_handle_cmd(struct nullb_cmd *cmd) | 236 | static inline void null_handle_cmd(struct nullb_cmd *cmd) |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index bbeb404b3a07..b2c98c1bc037 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1431,6 +1431,14 @@ static bool obj_request_exists_test(struct rbd_obj_request *obj_request) | |||
1431 | return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0; | 1431 | return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0; |
1432 | } | 1432 | } |
1433 | 1433 | ||
1434 | static bool obj_request_overlaps_parent(struct rbd_obj_request *obj_request) | ||
1435 | { | ||
1436 | struct rbd_device *rbd_dev = obj_request->img_request->rbd_dev; | ||
1437 | |||
1438 | return obj_request->img_offset < | ||
1439 | round_up(rbd_dev->parent_overlap, rbd_obj_bytes(&rbd_dev->header)); | ||
1440 | } | ||
1441 | |||
1434 | static void rbd_obj_request_get(struct rbd_obj_request *obj_request) | 1442 | static void rbd_obj_request_get(struct rbd_obj_request *obj_request) |
1435 | { | 1443 | { |
1436 | dout("%s: obj %p (was %d)\n", __func__, obj_request, | 1444 | dout("%s: obj %p (was %d)\n", __func__, obj_request, |
@@ -2748,7 +2756,7 @@ static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request) | |||
2748 | */ | 2756 | */ |
2749 | if (!img_request_write_test(img_request) || | 2757 | if (!img_request_write_test(img_request) || |
2750 | !img_request_layered_test(img_request) || | 2758 | !img_request_layered_test(img_request) || |
2751 | rbd_dev->parent_overlap <= obj_request->img_offset || | 2759 | !obj_request_overlaps_parent(obj_request) || |
2752 | ((known = obj_request_known_test(obj_request)) && | 2760 | ((known = obj_request_known_test(obj_request)) && |
2753 | obj_request_exists_test(obj_request))) { | 2761 | obj_request_exists_test(obj_request))) { |
2754 | 2762 | ||
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 48eccb350180..089e72cd37be 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -622,8 +622,10 @@ static void zram_reset_device(struct zram *zram, bool reset_capacity) | |||
622 | memset(&zram->stats, 0, sizeof(zram->stats)); | 622 | memset(&zram->stats, 0, sizeof(zram->stats)); |
623 | 623 | ||
624 | zram->disksize = 0; | 624 | zram->disksize = 0; |
625 | if (reset_capacity) | 625 | if (reset_capacity) { |
626 | set_capacity(zram->disk, 0); | 626 | set_capacity(zram->disk, 0); |
627 | revalidate_disk(zram->disk); | ||
628 | } | ||
627 | up_write(&zram->init_lock); | 629 | up_write(&zram->init_lock); |
628 | } | 630 | } |
629 | 631 | ||
@@ -664,6 +666,7 @@ static ssize_t disksize_store(struct device *dev, | |||
664 | zram->comp = comp; | 666 | zram->comp = comp; |
665 | zram->disksize = disksize; | 667 | zram->disksize = disksize; |
666 | set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); | 668 | set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); |
669 | revalidate_disk(zram->disk); | ||
667 | up_write(&zram->init_lock); | 670 | up_write(&zram->init_lock); |
668 | return len; | 671 | return len; |
669 | 672 | ||
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index a118ec1650fa..1f37d9870e7a 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig | |||
@@ -45,7 +45,7 @@ config OMAP_INTERCONNECT | |||
45 | 45 | ||
46 | config ARM_CCI | 46 | config ARM_CCI |
47 | bool "ARM CCI driver support" | 47 | bool "ARM CCI driver support" |
48 | depends on ARM | 48 | depends on ARM && OF && CPU_V7 |
49 | help | 49 | help |
50 | Driver supporting the CCI cache coherent interconnect for ARM | 50 | Driver supporting the CCI cache coherent interconnect for ARM |
51 | platforms. | 51 | platforms. |
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index d915707d2ba1..93dcad0c1cbe 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
@@ -138,7 +138,9 @@ static int i8k_smm(struct smm_regs *regs) | |||
138 | if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) | 138 | if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) |
139 | return -ENOMEM; | 139 | return -ENOMEM; |
140 | cpumask_copy(old_mask, ¤t->cpus_allowed); | 140 | cpumask_copy(old_mask, ¤t->cpus_allowed); |
141 | set_cpus_allowed_ptr(current, cpumask_of(0)); | 141 | rc = set_cpus_allowed_ptr(current, cpumask_of(0)); |
142 | if (rc) | ||
143 | goto out; | ||
142 | if (smp_processor_id() != 0) { | 144 | if (smp_processor_id() != 0) { |
143 | rc = -EBUSY; | 145 | rc = -EBUSY; |
144 | goto out; | 146 | goto out; |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 4ad71ef2cd59..0a7ac0a7b252 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -980,7 +980,6 @@ static void push_to_pool(struct work_struct *work) | |||
980 | static size_t account(struct entropy_store *r, size_t nbytes, int min, | 980 | static size_t account(struct entropy_store *r, size_t nbytes, int min, |
981 | int reserved) | 981 | int reserved) |
982 | { | 982 | { |
983 | int have_bytes; | ||
984 | int entropy_count, orig; | 983 | int entropy_count, orig; |
985 | size_t ibytes; | 984 | size_t ibytes; |
986 | 985 | ||
@@ -989,17 +988,19 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | |||
989 | /* Can we pull enough? */ | 988 | /* Can we pull enough? */ |
990 | retry: | 989 | retry: |
991 | entropy_count = orig = ACCESS_ONCE(r->entropy_count); | 990 | entropy_count = orig = ACCESS_ONCE(r->entropy_count); |
992 | have_bytes = entropy_count >> (ENTROPY_SHIFT + 3); | ||
993 | ibytes = nbytes; | 991 | ibytes = nbytes; |
994 | /* If limited, never pull more than available */ | 992 | /* If limited, never pull more than available */ |
995 | if (r->limit) | 993 | if (r->limit) { |
996 | ibytes = min_t(size_t, ibytes, have_bytes - reserved); | 994 | int have_bytes = entropy_count >> (ENTROPY_SHIFT + 3); |
995 | |||
996 | if ((have_bytes -= reserved) < 0) | ||
997 | have_bytes = 0; | ||
998 | ibytes = min_t(size_t, ibytes, have_bytes); | ||
999 | } | ||
997 | if (ibytes < min) | 1000 | if (ibytes < min) |
998 | ibytes = 0; | 1001 | ibytes = 0; |
999 | if (have_bytes >= ibytes + reserved) | 1002 | if ((entropy_count -= ibytes << (ENTROPY_SHIFT + 3)) < 0) |
1000 | entropy_count -= ibytes << (ENTROPY_SHIFT + 3); | 1003 | entropy_count = 0; |
1001 | else | ||
1002 | entropy_count = reserved << (ENTROPY_SHIFT + 3); | ||
1003 | 1004 | ||
1004 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) | 1005 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) |
1005 | goto retry; | 1006 | goto retry; |
diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index 9b7b5859a420..3757e9e72d37 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c | |||
@@ -230,16 +230,13 @@ static int s2mps11_clk_probe(struct platform_device *pdev) | |||
230 | goto err_reg; | 230 | goto err_reg; |
231 | } | 231 | } |
232 | 232 | ||
233 | s2mps11_clk->lookup = devm_kzalloc(&pdev->dev, | 233 | s2mps11_clk->lookup = clkdev_alloc(s2mps11_clk->clk, |
234 | sizeof(struct clk_lookup), GFP_KERNEL); | 234 | s2mps11_name(s2mps11_clk), NULL); |
235 | if (!s2mps11_clk->lookup) { | 235 | if (!s2mps11_clk->lookup) { |
236 | ret = -ENOMEM; | 236 | ret = -ENOMEM; |
237 | goto err_lup; | 237 | goto err_lup; |
238 | } | 238 | } |
239 | 239 | ||
240 | s2mps11_clk->lookup->con_id = s2mps11_name(s2mps11_clk); | ||
241 | s2mps11_clk->lookup->clk = s2mps11_clk->clk; | ||
242 | |||
243 | clkdev_add(s2mps11_clk->lookup); | 240 | clkdev_add(s2mps11_clk->lookup); |
244 | } | 241 | } |
245 | 242 | ||
diff --git a/drivers/clk/qcom/mmcc-msm8960.c b/drivers/clk/qcom/mmcc-msm8960.c index 12f3c0b64fcd..4c449b3170f6 100644 --- a/drivers/clk/qcom/mmcc-msm8960.c +++ b/drivers/clk/qcom/mmcc-msm8960.c | |||
@@ -1209,7 +1209,7 @@ static struct clk_branch rot_clk = { | |||
1209 | 1209 | ||
1210 | static u8 mmcc_pxo_hdmi_map[] = { | 1210 | static u8 mmcc_pxo_hdmi_map[] = { |
1211 | [P_PXO] = 0, | 1211 | [P_PXO] = 0, |
1212 | [P_HDMI_PLL] = 2, | 1212 | [P_HDMI_PLL] = 3, |
1213 | }; | 1213 | }; |
1214 | 1214 | ||
1215 | static const char *mmcc_pxo_hdmi[] = { | 1215 | static const char *mmcc_pxo_hdmi[] = { |
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c index 4f150c9dd38c..7f4a473a7ad7 100644 --- a/drivers/clk/samsung/clk-exynos4.c +++ b/drivers/clk/samsung/clk-exynos4.c | |||
@@ -925,21 +925,13 @@ static struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = { | |||
925 | GATE(CLK_RTC, "rtc", "aclk100", E4X12_GATE_IP_PERIR, 15, | 925 | GATE(CLK_RTC, "rtc", "aclk100", E4X12_GATE_IP_PERIR, 15, |
926 | 0, 0), | 926 | 0, 0), |
927 | GATE(CLK_KEYIF, "keyif", "aclk100", E4X12_GATE_IP_PERIR, 16, 0, 0), | 927 | GATE(CLK_KEYIF, "keyif", "aclk100", E4X12_GATE_IP_PERIR, 16, 0, 0), |
928 | GATE(CLK_SCLK_PWM_ISP, "sclk_pwm_isp", "div_pwm_isp", | 928 | GATE(CLK_PWM_ISP_SCLK, "pwm_isp_sclk", "div_pwm_isp", |
929 | E4X12_SRC_MASK_ISP, 0, CLK_SET_RATE_PARENT, 0), | ||
930 | GATE(CLK_SCLK_SPI0_ISP, "sclk_spi0_isp", "div_spi0_isp_pre", | ||
931 | E4X12_SRC_MASK_ISP, 4, CLK_SET_RATE_PARENT, 0), | ||
932 | GATE(CLK_SCLK_SPI1_ISP, "sclk_spi1_isp", "div_spi1_isp_pre", | ||
933 | E4X12_SRC_MASK_ISP, 8, CLK_SET_RATE_PARENT, 0), | ||
934 | GATE(CLK_SCLK_UART_ISP, "sclk_uart_isp", "div_uart_isp", | ||
935 | E4X12_SRC_MASK_ISP, 12, CLK_SET_RATE_PARENT, 0), | ||
936 | GATE(CLK_PWM_ISP_SCLK, "pwm_isp_sclk", "sclk_pwm_isp", | ||
937 | E4X12_GATE_IP_ISP, 0, 0, 0), | 929 | E4X12_GATE_IP_ISP, 0, 0, 0), |
938 | GATE(CLK_SPI0_ISP_SCLK, "spi0_isp_sclk", "sclk_spi0_isp", | 930 | GATE(CLK_SPI0_ISP_SCLK, "spi0_isp_sclk", "div_spi0_isp_pre", |
939 | E4X12_GATE_IP_ISP, 1, 0, 0), | 931 | E4X12_GATE_IP_ISP, 1, 0, 0), |
940 | GATE(CLK_SPI1_ISP_SCLK, "spi1_isp_sclk", "sclk_spi1_isp", | 932 | GATE(CLK_SPI1_ISP_SCLK, "spi1_isp_sclk", "div_spi1_isp_pre", |
941 | E4X12_GATE_IP_ISP, 2, 0, 0), | 933 | E4X12_GATE_IP_ISP, 2, 0, 0), |
942 | GATE(CLK_UART_ISP_SCLK, "uart_isp_sclk", "sclk_uart_isp", | 934 | GATE(CLK_UART_ISP_SCLK, "uart_isp_sclk", "div_uart_isp", |
943 | E4X12_GATE_IP_ISP, 3, 0, 0), | 935 | E4X12_GATE_IP_ISP, 3, 0, 0), |
944 | GATE(CLK_WDT, "watchdog", "aclk100", E4X12_GATE_IP_PERIR, 14, 0, 0), | 936 | GATE(CLK_WDT, "watchdog", "aclk100", E4X12_GATE_IP_PERIR, 14, 0, 0), |
945 | GATE(CLK_PCM0, "pcm0", "aclk100", E4X12_GATE_IP_MAUDIO, 2, | 937 | GATE(CLK_PCM0, "pcm0", "aclk100", E4X12_GATE_IP_MAUDIO, 2, |
diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c index 1fad4c5e3f5d..184f64293b26 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c | |||
@@ -661,7 +661,7 @@ static struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { | |||
661 | GATE(CLK_RTC, "rtc", "div_aclk66", GATE_IP_PERIS, 20, 0, 0), | 661 | GATE(CLK_RTC, "rtc", "div_aclk66", GATE_IP_PERIS, 20, 0, 0), |
662 | GATE(CLK_TMU, "tmu", "div_aclk66", GATE_IP_PERIS, 21, 0, 0), | 662 | GATE(CLK_TMU, "tmu", "div_aclk66", GATE_IP_PERIS, 21, 0, 0), |
663 | GATE(CLK_SMMU_TV, "smmu_tv", "mout_aclk200_disp1_sub", | 663 | GATE(CLK_SMMU_TV, "smmu_tv", "mout_aclk200_disp1_sub", |
664 | GATE_IP_DISP1, 2, 0, 0), | 664 | GATE_IP_DISP1, 9, 0, 0), |
665 | GATE(CLK_SMMU_FIMD1, "smmu_fimd1", "mout_aclk200_disp1_sub", | 665 | GATE(CLK_SMMU_FIMD1, "smmu_fimd1", "mout_aclk200_disp1_sub", |
666 | GATE_IP_DISP1, 8, 0, 0), | 666 | GATE_IP_DISP1, 8, 0, 0), |
667 | GATE(CLK_SMMU_2D, "smmu_2d", "div_aclk200", GATE_IP_ACP, 7, 0, 0), | 667 | GATE(CLK_SMMU_2D, "smmu_2d", "div_aclk200", GATE_IP_ACP, 7, 0, 0), |
diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 9d7d7eed03fd..a4e6cc782e5c 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c | |||
@@ -631,7 +631,8 @@ static struct samsung_mux_clock exynos5x_mux_clks[] __initdata = { | |||
631 | SRC_TOP4, 16, 1), | 631 | SRC_TOP4, 16, 1), |
632 | MUX(0, "mout_user_aclk266", mout_user_aclk266_p, SRC_TOP4, 20, 1), | 632 | MUX(0, "mout_user_aclk266", mout_user_aclk266_p, SRC_TOP4, 20, 1), |
633 | MUX(0, "mout_user_aclk166", mout_user_aclk166_p, SRC_TOP4, 24, 1), | 633 | MUX(0, "mout_user_aclk166", mout_user_aclk166_p, SRC_TOP4, 24, 1), |
634 | MUX(0, "mout_user_aclk333", mout_user_aclk333_p, SRC_TOP4, 28, 1), | 634 | MUX(CLK_MOUT_USER_ACLK333, "mout_user_aclk333", mout_user_aclk333_p, |
635 | SRC_TOP4, 28, 1), | ||
635 | 636 | ||
636 | MUX(0, "mout_user_aclk400_disp1", mout_user_aclk400_disp1_p, | 637 | MUX(0, "mout_user_aclk400_disp1", mout_user_aclk400_disp1_p, |
637 | SRC_TOP5, 0, 1), | 638 | SRC_TOP5, 0, 1), |
@@ -684,7 +685,8 @@ static struct samsung_mux_clock exynos5x_mux_clks[] __initdata = { | |||
684 | SRC_TOP11, 12, 1), | 685 | SRC_TOP11, 12, 1), |
685 | MUX(0, "mout_sw_aclk266", mout_sw_aclk266_p, SRC_TOP11, 20, 1), | 686 | MUX(0, "mout_sw_aclk266", mout_sw_aclk266_p, SRC_TOP11, 20, 1), |
686 | MUX(0, "mout_sw_aclk166", mout_sw_aclk166_p, SRC_TOP11, 24, 1), | 687 | MUX(0, "mout_sw_aclk166", mout_sw_aclk166_p, SRC_TOP11, 24, 1), |
687 | MUX(0, "mout_sw_aclk333", mout_sw_aclk333_p, SRC_TOP11, 28, 1), | 688 | MUX(CLK_MOUT_SW_ACLK333, "mout_sw_aclk333", mout_sw_aclk333_p, |
689 | SRC_TOP11, 28, 1), | ||
688 | 690 | ||
689 | MUX(0, "mout_sw_aclk400_disp1", mout_sw_aclk400_disp1_p, | 691 | MUX(0, "mout_sw_aclk400_disp1", mout_sw_aclk400_disp1_p, |
690 | SRC_TOP12, 4, 1), | 692 | SRC_TOP12, 4, 1), |
@@ -890,8 +892,6 @@ static struct samsung_gate_clock exynos5x_gate_clks[] __initdata = { | |||
890 | GATE_BUS_TOP, 9, CLK_IGNORE_UNUSED, 0), | 892 | GATE_BUS_TOP, 9, CLK_IGNORE_UNUSED, 0), |
891 | GATE(0, "aclk66_psgen", "mout_user_aclk66_psgen", | 893 | GATE(0, "aclk66_psgen", "mout_user_aclk66_psgen", |
892 | GATE_BUS_TOP, 10, CLK_IGNORE_UNUSED, 0), | 894 | GATE_BUS_TOP, 10, CLK_IGNORE_UNUSED, 0), |
893 | GATE(CLK_ACLK66_PERIC, "aclk66_peric", "mout_user_aclk66_peric", | ||
894 | GATE_BUS_TOP, 11, CLK_IGNORE_UNUSED, 0), | ||
895 | GATE(0, "aclk266_isp", "mout_user_aclk266_isp", | 895 | GATE(0, "aclk266_isp", "mout_user_aclk266_isp", |
896 | GATE_BUS_TOP, 13, 0, 0), | 896 | GATE_BUS_TOP, 13, 0, 0), |
897 | GATE(0, "aclk166", "mout_user_aclk166", | 897 | GATE(0, "aclk166", "mout_user_aclk166", |
@@ -994,34 +994,61 @@ static struct samsung_gate_clock exynos5x_gate_clks[] __initdata = { | |||
994 | SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0), | 994 | SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0), |
995 | 995 | ||
996 | /* PERIC Block */ | 996 | /* PERIC Block */ |
997 | GATE(CLK_UART0, "uart0", "aclk66_peric", GATE_IP_PERIC, 0, 0, 0), | 997 | GATE(CLK_UART0, "uart0", "mout_user_aclk66_peric", |
998 | GATE(CLK_UART1, "uart1", "aclk66_peric", GATE_IP_PERIC, 1, 0, 0), | 998 | GATE_IP_PERIC, 0, 0, 0), |
999 | GATE(CLK_UART2, "uart2", "aclk66_peric", GATE_IP_PERIC, 2, 0, 0), | 999 | GATE(CLK_UART1, "uart1", "mout_user_aclk66_peric", |
1000 | GATE(CLK_UART3, "uart3", "aclk66_peric", GATE_IP_PERIC, 3, 0, 0), | 1000 | GATE_IP_PERIC, 1, 0, 0), |
1001 | GATE(CLK_I2C0, "i2c0", "aclk66_peric", GATE_IP_PERIC, 6, 0, 0), | 1001 | GATE(CLK_UART2, "uart2", "mout_user_aclk66_peric", |
1002 | GATE(CLK_I2C1, "i2c1", "aclk66_peric", GATE_IP_PERIC, 7, 0, 0), | 1002 | GATE_IP_PERIC, 2, 0, 0), |
1003 | GATE(CLK_I2C2, "i2c2", "aclk66_peric", GATE_IP_PERIC, 8, 0, 0), | 1003 | GATE(CLK_UART3, "uart3", "mout_user_aclk66_peric", |
1004 | GATE(CLK_I2C3, "i2c3", "aclk66_peric", GATE_IP_PERIC, 9, 0, 0), | 1004 | GATE_IP_PERIC, 3, 0, 0), |
1005 | GATE(CLK_USI0, "usi0", "aclk66_peric", GATE_IP_PERIC, 10, 0, 0), | 1005 | GATE(CLK_I2C0, "i2c0", "mout_user_aclk66_peric", |
1006 | GATE(CLK_USI1, "usi1", "aclk66_peric", GATE_IP_PERIC, 11, 0, 0), | 1006 | GATE_IP_PERIC, 6, 0, 0), |
1007 | GATE(CLK_USI2, "usi2", "aclk66_peric", GATE_IP_PERIC, 12, 0, 0), | 1007 | GATE(CLK_I2C1, "i2c1", "mout_user_aclk66_peric", |
1008 | GATE(CLK_USI3, "usi3", "aclk66_peric", GATE_IP_PERIC, 13, 0, 0), | 1008 | GATE_IP_PERIC, 7, 0, 0), |
1009 | GATE(CLK_I2C_HDMI, "i2c_hdmi", "aclk66_peric", GATE_IP_PERIC, 14, 0, 0), | 1009 | GATE(CLK_I2C2, "i2c2", "mout_user_aclk66_peric", |
1010 | GATE(CLK_TSADC, "tsadc", "aclk66_peric", GATE_IP_PERIC, 15, 0, 0), | 1010 | GATE_IP_PERIC, 8, 0, 0), |
1011 | GATE(CLK_SPI0, "spi0", "aclk66_peric", GATE_IP_PERIC, 16, 0, 0), | 1011 | GATE(CLK_I2C3, "i2c3", "mout_user_aclk66_peric", |
1012 | GATE(CLK_SPI1, "spi1", "aclk66_peric", GATE_IP_PERIC, 17, 0, 0), | 1012 | GATE_IP_PERIC, 9, 0, 0), |
1013 | GATE(CLK_SPI2, "spi2", "aclk66_peric", GATE_IP_PERIC, 18, 0, 0), | 1013 | GATE(CLK_USI0, "usi0", "mout_user_aclk66_peric", |
1014 | GATE(CLK_I2S1, "i2s1", "aclk66_peric", GATE_IP_PERIC, 20, 0, 0), | 1014 | GATE_IP_PERIC, 10, 0, 0), |
1015 | GATE(CLK_I2S2, "i2s2", "aclk66_peric", GATE_IP_PERIC, 21, 0, 0), | 1015 | GATE(CLK_USI1, "usi1", "mout_user_aclk66_peric", |
1016 | GATE(CLK_PCM1, "pcm1", "aclk66_peric", GATE_IP_PERIC, 22, 0, 0), | 1016 | GATE_IP_PERIC, 11, 0, 0), |
1017 | GATE(CLK_PCM2, "pcm2", "aclk66_peric", GATE_IP_PERIC, 23, 0, 0), | 1017 | GATE(CLK_USI2, "usi2", "mout_user_aclk66_peric", |
1018 | GATE(CLK_PWM, "pwm", "aclk66_peric", GATE_IP_PERIC, 24, 0, 0), | 1018 | GATE_IP_PERIC, 12, 0, 0), |
1019 | GATE(CLK_SPDIF, "spdif", "aclk66_peric", GATE_IP_PERIC, 26, 0, 0), | 1019 | GATE(CLK_USI3, "usi3", "mout_user_aclk66_peric", |
1020 | GATE(CLK_USI4, "usi4", "aclk66_peric", GATE_IP_PERIC, 28, 0, 0), | 1020 | GATE_IP_PERIC, 13, 0, 0), |
1021 | GATE(CLK_USI5, "usi5", "aclk66_peric", GATE_IP_PERIC, 30, 0, 0), | 1021 | GATE(CLK_I2C_HDMI, "i2c_hdmi", "mout_user_aclk66_peric", |
1022 | GATE(CLK_USI6, "usi6", "aclk66_peric", GATE_IP_PERIC, 31, 0, 0), | 1022 | GATE_IP_PERIC, 14, 0, 0), |
1023 | 1023 | GATE(CLK_TSADC, "tsadc", "mout_user_aclk66_peric", | |
1024 | GATE(CLK_KEYIF, "keyif", "aclk66_peric", GATE_BUS_PERIC, 22, 0, 0), | 1024 | GATE_IP_PERIC, 15, 0, 0), |
1025 | GATE(CLK_SPI0, "spi0", "mout_user_aclk66_peric", | ||
1026 | GATE_IP_PERIC, 16, 0, 0), | ||
1027 | GATE(CLK_SPI1, "spi1", "mout_user_aclk66_peric", | ||
1028 | GATE_IP_PERIC, 17, 0, 0), | ||
1029 | GATE(CLK_SPI2, "spi2", "mout_user_aclk66_peric", | ||
1030 | GATE_IP_PERIC, 18, 0, 0), | ||
1031 | GATE(CLK_I2S1, "i2s1", "mout_user_aclk66_peric", | ||
1032 | GATE_IP_PERIC, 20, 0, 0), | ||
1033 | GATE(CLK_I2S2, "i2s2", "mout_user_aclk66_peric", | ||
1034 | GATE_IP_PERIC, 21, 0, 0), | ||
1035 | GATE(CLK_PCM1, "pcm1", "mout_user_aclk66_peric", | ||
1036 | GATE_IP_PERIC, 22, 0, 0), | ||
1037 | GATE(CLK_PCM2, "pcm2", "mout_user_aclk66_peric", | ||
1038 | GATE_IP_PERIC, 23, 0, 0), | ||
1039 | GATE(CLK_PWM, "pwm", "mout_user_aclk66_peric", | ||
1040 | GATE_IP_PERIC, 24, 0, 0), | ||
1041 | GATE(CLK_SPDIF, "spdif", "mout_user_aclk66_peric", | ||
1042 | GATE_IP_PERIC, 26, 0, 0), | ||
1043 | GATE(CLK_USI4, "usi4", "mout_user_aclk66_peric", | ||
1044 | GATE_IP_PERIC, 28, 0, 0), | ||
1045 | GATE(CLK_USI5, "usi5", "mout_user_aclk66_peric", | ||
1046 | GATE_IP_PERIC, 30, 0, 0), | ||
1047 | GATE(CLK_USI6, "usi6", "mout_user_aclk66_peric", | ||
1048 | GATE_IP_PERIC, 31, 0, 0), | ||
1049 | |||
1050 | GATE(CLK_KEYIF, "keyif", "mout_user_aclk66_peric", | ||
1051 | GATE_BUS_PERIC, 22, 0, 0), | ||
1025 | 1052 | ||
1026 | /* PERIS Block */ | 1053 | /* PERIS Block */ |
1027 | GATE(CLK_CHIPID, "chipid", "aclk66_psgen", | 1054 | GATE(CLK_CHIPID, "chipid", "aclk66_psgen", |
diff --git a/drivers/clk/samsung/clk-s3c2410.c b/drivers/clk/samsung/clk-s3c2410.c index ba0716801db2..140f4733c02e 100644 --- a/drivers/clk/samsung/clk-s3c2410.c +++ b/drivers/clk/samsung/clk-s3c2410.c | |||
@@ -152,6 +152,11 @@ struct samsung_clock_alias s3c2410_common_aliases[] __initdata = { | |||
152 | ALIAS(HCLK, NULL, "hclk"), | 152 | ALIAS(HCLK, NULL, "hclk"), |
153 | ALIAS(MPLL, NULL, "mpll"), | 153 | ALIAS(MPLL, NULL, "mpll"), |
154 | ALIAS(FCLK, NULL, "fclk"), | 154 | ALIAS(FCLK, NULL, "fclk"), |
155 | ALIAS(PCLK, NULL, "watchdog"), | ||
156 | ALIAS(PCLK_SDI, NULL, "sdi"), | ||
157 | ALIAS(HCLK_NAND, NULL, "nand"), | ||
158 | ALIAS(PCLK_I2S, NULL, "iis"), | ||
159 | ALIAS(PCLK_I2C, NULL, "i2c"), | ||
155 | }; | 160 | }; |
156 | 161 | ||
157 | /* S3C2410 specific clocks */ | 162 | /* S3C2410 specific clocks */ |
@@ -378,7 +383,7 @@ void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f, | |||
378 | if (!np) | 383 | if (!np) |
379 | s3c2410_common_clk_register_fixed_ext(ctx, xti_f); | 384 | s3c2410_common_clk_register_fixed_ext(ctx, xti_f); |
380 | 385 | ||
381 | if (current_soc == 2410) { | 386 | if (current_soc == S3C2410) { |
382 | if (_get_rate("xti") == 12 * MHZ) { | 387 | if (_get_rate("xti") == 12 * MHZ) { |
383 | s3c2410_plls[mpll].rate_table = pll_s3c2410_12mhz_tbl; | 388 | s3c2410_plls[mpll].rate_table = pll_s3c2410_12mhz_tbl; |
384 | s3c2410_plls[upll].rate_table = pll_s3c2410_12mhz_tbl; | 389 | s3c2410_plls[upll].rate_table = pll_s3c2410_12mhz_tbl; |
@@ -432,7 +437,7 @@ void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f, | |||
432 | samsung_clk_register_fixed_factor(ctx, s3c2410_ffactor, | 437 | samsung_clk_register_fixed_factor(ctx, s3c2410_ffactor, |
433 | ARRAY_SIZE(s3c2410_ffactor)); | 438 | ARRAY_SIZE(s3c2410_ffactor)); |
434 | samsung_clk_register_alias(ctx, s3c2410_aliases, | 439 | samsung_clk_register_alias(ctx, s3c2410_aliases, |
435 | ARRAY_SIZE(s3c2410_common_aliases)); | 440 | ARRAY_SIZE(s3c2410_aliases)); |
436 | break; | 441 | break; |
437 | case S3C2440: | 442 | case S3C2440: |
438 | samsung_clk_register_mux(ctx, s3c2440_muxes, | 443 | samsung_clk_register_mux(ctx, s3c2440_muxes, |
diff --git a/drivers/clk/samsung/clk-s3c64xx.c b/drivers/clk/samsung/clk-s3c64xx.c index efa16ee592c8..8889ff1c10fc 100644 --- a/drivers/clk/samsung/clk-s3c64xx.c +++ b/drivers/clk/samsung/clk-s3c64xx.c | |||
@@ -418,8 +418,10 @@ static struct samsung_clock_alias s3c64xx_clock_aliases[] = { | |||
418 | ALIAS(SCLK_MMC2, "s3c-sdhci.2", "mmc_busclk.2"), | 418 | ALIAS(SCLK_MMC2, "s3c-sdhci.2", "mmc_busclk.2"), |
419 | ALIAS(SCLK_MMC1, "s3c-sdhci.1", "mmc_busclk.2"), | 419 | ALIAS(SCLK_MMC1, "s3c-sdhci.1", "mmc_busclk.2"), |
420 | ALIAS(SCLK_MMC0, "s3c-sdhci.0", "mmc_busclk.2"), | 420 | ALIAS(SCLK_MMC0, "s3c-sdhci.0", "mmc_busclk.2"), |
421 | ALIAS(SCLK_SPI1, "s3c6410-spi.1", "spi-bus"), | 421 | ALIAS(PCLK_SPI1, "s3c6410-spi.1", "spi_busclk0"), |
422 | ALIAS(SCLK_SPI0, "s3c6410-spi.0", "spi-bus"), | 422 | ALIAS(SCLK_SPI1, "s3c6410-spi.1", "spi_busclk2"), |
423 | ALIAS(PCLK_SPI0, "s3c6410-spi.0", "spi_busclk0"), | ||
424 | ALIAS(SCLK_SPI0, "s3c6410-spi.0", "spi_busclk2"), | ||
423 | ALIAS(SCLK_AUDIO1, "samsung-pcm.1", "audio-bus"), | 425 | ALIAS(SCLK_AUDIO1, "samsung-pcm.1", "audio-bus"), |
424 | ALIAS(SCLK_AUDIO1, "samsung-i2s.1", "audio-bus"), | 426 | ALIAS(SCLK_AUDIO1, "samsung-i2s.1", "audio-bus"), |
425 | ALIAS(SCLK_AUDIO0, "samsung-pcm.0", "audio-bus"), | 427 | ALIAS(SCLK_AUDIO0, "samsung-pcm.0", "audio-bus"), |
diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c index c2d204315546..bb5f387774e2 100644 --- a/drivers/clk/spear/spear3xx_clock.c +++ b/drivers/clk/spear/spear3xx_clock.c | |||
@@ -211,7 +211,7 @@ static inline void spear310_clk_init(void) { } | |||
211 | /* array of all spear 320 clock lookups */ | 211 | /* array of all spear 320 clock lookups */ |
212 | #ifdef CONFIG_MACH_SPEAR320 | 212 | #ifdef CONFIG_MACH_SPEAR320 |
213 | 213 | ||
214 | #define SPEAR320_CONTROL_REG (soc_config_base + 0x0000) | 214 | #define SPEAR320_CONTROL_REG (soc_config_base + 0x0010) |
215 | #define SPEAR320_EXT_CTRL_REG (soc_config_base + 0x0018) | 215 | #define SPEAR320_EXT_CTRL_REG (soc_config_base + 0x0018) |
216 | 216 | ||
217 | #define SPEAR320_UARTX_PCLK_MASK 0x1 | 217 | #define SPEAR320_UARTX_PCLK_MASK 0x1 |
@@ -245,7 +245,8 @@ static const char *smii0_parents[] = { "smii_125m_pad", "ras_pll2_clk", | |||
245 | "ras_syn0_gclk", }; | 245 | "ras_syn0_gclk", }; |
246 | static const char *uartx_parents[] = { "ras_syn1_gclk", "ras_apb_clk", }; | 246 | static const char *uartx_parents[] = { "ras_syn1_gclk", "ras_apb_clk", }; |
247 | 247 | ||
248 | static void __init spear320_clk_init(void __iomem *soc_config_base) | 248 | static void __init spear320_clk_init(void __iomem *soc_config_base, |
249 | struct clk *ras_apb_clk) | ||
249 | { | 250 | { |
250 | struct clk *clk; | 251 | struct clk *clk; |
251 | 252 | ||
@@ -342,6 +343,8 @@ static void __init spear320_clk_init(void __iomem *soc_config_base) | |||
342 | SPEAR320_CONTROL_REG, UART1_PCLK_SHIFT, UART1_PCLK_MASK, | 343 | SPEAR320_CONTROL_REG, UART1_PCLK_SHIFT, UART1_PCLK_MASK, |
343 | 0, &_lock); | 344 | 0, &_lock); |
344 | clk_register_clkdev(clk, NULL, "a3000000.serial"); | 345 | clk_register_clkdev(clk, NULL, "a3000000.serial"); |
346 | /* Enforce ras_apb_clk */ | ||
347 | clk_set_parent(clk, ras_apb_clk); | ||
345 | 348 | ||
346 | clk = clk_register_mux(NULL, "uart2_clk", uartx_parents, | 349 | clk = clk_register_mux(NULL, "uart2_clk", uartx_parents, |
347 | ARRAY_SIZE(uartx_parents), | 350 | ARRAY_SIZE(uartx_parents), |
@@ -349,6 +352,8 @@ static void __init spear320_clk_init(void __iomem *soc_config_base) | |||
349 | SPEAR320_EXT_CTRL_REG, SPEAR320_UART2_PCLK_SHIFT, | 352 | SPEAR320_EXT_CTRL_REG, SPEAR320_UART2_PCLK_SHIFT, |
350 | SPEAR320_UARTX_PCLK_MASK, 0, &_lock); | 353 | SPEAR320_UARTX_PCLK_MASK, 0, &_lock); |
351 | clk_register_clkdev(clk, NULL, "a4000000.serial"); | 354 | clk_register_clkdev(clk, NULL, "a4000000.serial"); |
355 | /* Enforce ras_apb_clk */ | ||
356 | clk_set_parent(clk, ras_apb_clk); | ||
352 | 357 | ||
353 | clk = clk_register_mux(NULL, "uart3_clk", uartx_parents, | 358 | clk = clk_register_mux(NULL, "uart3_clk", uartx_parents, |
354 | ARRAY_SIZE(uartx_parents), | 359 | ARRAY_SIZE(uartx_parents), |
@@ -379,12 +384,12 @@ static void __init spear320_clk_init(void __iomem *soc_config_base) | |||
379 | clk_register_clkdev(clk, NULL, "60100000.serial"); | 384 | clk_register_clkdev(clk, NULL, "60100000.serial"); |
380 | } | 385 | } |
381 | #else | 386 | #else |
382 | static inline void spear320_clk_init(void __iomem *soc_config_base) { } | 387 | static inline void spear320_clk_init(void __iomem *sb, struct clk *rc) { } |
383 | #endif | 388 | #endif |
384 | 389 | ||
385 | void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_base) | 390 | void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_base) |
386 | { | 391 | { |
387 | struct clk *clk, *clk1; | 392 | struct clk *clk, *clk1, *ras_apb_clk; |
388 | 393 | ||
389 | clk = clk_register_fixed_rate(NULL, "osc_32k_clk", NULL, CLK_IS_ROOT, | 394 | clk = clk_register_fixed_rate(NULL, "osc_32k_clk", NULL, CLK_IS_ROOT, |
390 | 32000); | 395 | 32000); |
@@ -613,6 +618,7 @@ void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_ | |||
613 | clk = clk_register_gate(NULL, "ras_apb_clk", "apb_clk", 0, RAS_CLK_ENB, | 618 | clk = clk_register_gate(NULL, "ras_apb_clk", "apb_clk", 0, RAS_CLK_ENB, |
614 | RAS_APB_CLK_ENB, 0, &_lock); | 619 | RAS_APB_CLK_ENB, 0, &_lock); |
615 | clk_register_clkdev(clk, "ras_apb_clk", NULL); | 620 | clk_register_clkdev(clk, "ras_apb_clk", NULL); |
621 | ras_apb_clk = clk; | ||
616 | 622 | ||
617 | clk = clk_register_gate(NULL, "ras_32k_clk", "osc_32k_clk", 0, | 623 | clk = clk_register_gate(NULL, "ras_32k_clk", "osc_32k_clk", 0, |
618 | RAS_CLK_ENB, RAS_32K_CLK_ENB, 0, &_lock); | 624 | RAS_CLK_ENB, RAS_32K_CLK_ENB, 0, &_lock); |
@@ -659,5 +665,5 @@ void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_ | |||
659 | else if (of_machine_is_compatible("st,spear310")) | 665 | else if (of_machine_is_compatible("st,spear310")) |
660 | spear310_clk_init(); | 666 | spear310_clk_init(); |
661 | else if (of_machine_is_compatible("st,spear320")) | 667 | else if (of_machine_is_compatible("st,spear320")) |
662 | spear320_clk_init(soc_config_base); | 668 | spear320_clk_init(soc_config_base, ras_apb_clk); |
663 | } | 669 | } |
diff --git a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c index 44cd27c5c401..670f90d629d7 100644 --- a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c +++ b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c | |||
@@ -29,7 +29,7 @@ static int sun6i_a31_apb0_gates_clk_probe(struct platform_device *pdev) | |||
29 | 29 | ||
30 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 30 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
31 | reg = devm_ioremap_resource(&pdev->dev, r); | 31 | reg = devm_ioremap_resource(&pdev->dev, r); |
32 | if (!reg) | 32 | if (IS_ERR(reg)) |
33 | return PTR_ERR(reg); | 33 | return PTR_ERR(reg); |
34 | 34 | ||
35 | clk_parent = of_clk_get_parent_name(np, 0); | 35 | clk_parent = of_clk_get_parent_name(np, 0); |
diff --git a/drivers/clk/ti/apll.c b/drivers/clk/ti/apll.c index 5428c9c547cd..72d97279eae1 100644 --- a/drivers/clk/ti/apll.c +++ b/drivers/clk/ti/apll.c | |||
@@ -77,13 +77,11 @@ static int dra7_apll_enable(struct clk_hw *hw) | |||
77 | if (i == MAX_APLL_WAIT_TRIES) { | 77 | if (i == MAX_APLL_WAIT_TRIES) { |
78 | pr_warn("clock: %s failed transition to '%s'\n", | 78 | pr_warn("clock: %s failed transition to '%s'\n", |
79 | clk_name, (state) ? "locked" : "bypassed"); | 79 | clk_name, (state) ? "locked" : "bypassed"); |
80 | } else { | 80 | r = -EBUSY; |
81 | } else | ||
81 | pr_debug("clock: %s transition to '%s' in %d loops\n", | 82 | pr_debug("clock: %s transition to '%s' in %d loops\n", |
82 | clk_name, (state) ? "locked" : "bypassed", i); | 83 | clk_name, (state) ? "locked" : "bypassed", i); |
83 | 84 | ||
84 | r = 0; | ||
85 | } | ||
86 | |||
87 | return r; | 85 | return r; |
88 | } | 86 | } |
89 | 87 | ||
@@ -338,7 +336,7 @@ static void __init of_omap2_apll_setup(struct device_node *node) | |||
338 | const char *parent_name; | 336 | const char *parent_name; |
339 | u32 val; | 337 | u32 val; |
340 | 338 | ||
341 | ad = kzalloc(sizeof(*clk_hw), GFP_KERNEL); | 339 | ad = kzalloc(sizeof(*ad), GFP_KERNEL); |
342 | clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); | 340 | clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); |
343 | init = kzalloc(sizeof(*init), GFP_KERNEL); | 341 | init = kzalloc(sizeof(*init), GFP_KERNEL); |
344 | 342 | ||
diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c index abd956d5f838..79791e1bf282 100644 --- a/drivers/clk/ti/dpll.c +++ b/drivers/clk/ti/dpll.c | |||
@@ -161,7 +161,8 @@ cleanup: | |||
161 | } | 161 | } |
162 | 162 | ||
163 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ | 163 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ |
164 | defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX) | 164 | defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX) || \ |
165 | defined(CONFIG_SOC_AM43XX) | ||
165 | /** | 166 | /** |
166 | * ti_clk_register_dpll_x2 - Registers a DPLLx2 clock | 167 | * ti_clk_register_dpll_x2 - Registers a DPLLx2 clock |
167 | * @node: device node for this clock | 168 | * @node: device node for this clock |
@@ -322,7 +323,7 @@ CLK_OF_DECLARE(ti_omap4_dpll_x2_clock, "ti,omap4-dpll-x2-clock", | |||
322 | of_ti_omap4_dpll_x2_setup); | 323 | of_ti_omap4_dpll_x2_setup); |
323 | #endif | 324 | #endif |
324 | 325 | ||
325 | #ifdef CONFIG_SOC_AM33XX | 326 | #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) |
326 | static void __init of_ti_am3_dpll_x2_setup(struct device_node *node) | 327 | static void __init of_ti_am3_dpll_x2_setup(struct device_node *node) |
327 | { | 328 | { |
328 | ti_clk_register_dpll_x2(node, &dpll_x2_ck_ops, NULL); | 329 | ti_clk_register_dpll_x2(node, &dpll_x2_ck_ops, NULL); |
diff --git a/drivers/clk/ti/mux.c b/drivers/clk/ti/mux.c index 0197a478720c..e9d650e51287 100644 --- a/drivers/clk/ti/mux.c +++ b/drivers/clk/ti/mux.c | |||
@@ -160,7 +160,7 @@ static void of_mux_clk_setup(struct device_node *node) | |||
160 | u8 clk_mux_flags = 0; | 160 | u8 clk_mux_flags = 0; |
161 | u32 mask = 0; | 161 | u32 mask = 0; |
162 | u32 shift = 0; | 162 | u32 shift = 0; |
163 | u32 flags = 0; | 163 | u32 flags = CLK_SET_RATE_NO_REPARENT; |
164 | 164 | ||
165 | num_parents = of_clk_get_parent_count(node); | 165 | num_parents = of_clk_get_parent_count(node); |
166 | if (num_parents < 2) { | 166 | if (num_parents < 2) { |
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 8d6420013a04..ab51bf20a3ed 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c | |||
@@ -153,19 +153,16 @@ static void exynos4_mct_write(unsigned int value, unsigned long offset) | |||
153 | } | 153 | } |
154 | 154 | ||
155 | /* Clocksource handling */ | 155 | /* Clocksource handling */ |
156 | static void exynos4_mct_frc_start(u32 hi, u32 lo) | 156 | static void exynos4_mct_frc_start(void) |
157 | { | 157 | { |
158 | u32 reg; | 158 | u32 reg; |
159 | 159 | ||
160 | exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L); | ||
161 | exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U); | ||
162 | |||
163 | reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); | 160 | reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); |
164 | reg |= MCT_G_TCON_START; | 161 | reg |= MCT_G_TCON_START; |
165 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); | 162 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); |
166 | } | 163 | } |
167 | 164 | ||
168 | static cycle_t exynos4_frc_read(struct clocksource *cs) | 165 | static cycle_t notrace _exynos4_frc_read(void) |
169 | { | 166 | { |
170 | unsigned int lo, hi; | 167 | unsigned int lo, hi; |
171 | u32 hi2 = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_U); | 168 | u32 hi2 = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_U); |
@@ -179,9 +176,14 @@ static cycle_t exynos4_frc_read(struct clocksource *cs) | |||
179 | return ((cycle_t)hi << 32) | lo; | 176 | return ((cycle_t)hi << 32) | lo; |
180 | } | 177 | } |
181 | 178 | ||
179 | static cycle_t exynos4_frc_read(struct clocksource *cs) | ||
180 | { | ||
181 | return _exynos4_frc_read(); | ||
182 | } | ||
183 | |||
182 | static void exynos4_frc_resume(struct clocksource *cs) | 184 | static void exynos4_frc_resume(struct clocksource *cs) |
183 | { | 185 | { |
184 | exynos4_mct_frc_start(0, 0); | 186 | exynos4_mct_frc_start(); |
185 | } | 187 | } |
186 | 188 | ||
187 | struct clocksource mct_frc = { | 189 | struct clocksource mct_frc = { |
@@ -195,12 +197,23 @@ struct clocksource mct_frc = { | |||
195 | 197 | ||
196 | static u64 notrace exynos4_read_sched_clock(void) | 198 | static u64 notrace exynos4_read_sched_clock(void) |
197 | { | 199 | { |
198 | return exynos4_frc_read(&mct_frc); | 200 | return _exynos4_frc_read(); |
201 | } | ||
202 | |||
203 | static struct delay_timer exynos4_delay_timer; | ||
204 | |||
205 | static cycles_t exynos4_read_current_timer(void) | ||
206 | { | ||
207 | return _exynos4_frc_read(); | ||
199 | } | 208 | } |
200 | 209 | ||
201 | static void __init exynos4_clocksource_init(void) | 210 | static void __init exynos4_clocksource_init(void) |
202 | { | 211 | { |
203 | exynos4_mct_frc_start(0, 0); | 212 | exynos4_mct_frc_start(); |
213 | |||
214 | exynos4_delay_timer.read_current_timer = &exynos4_read_current_timer; | ||
215 | exynos4_delay_timer.freq = clk_rate; | ||
216 | register_current_timer_delay(&exynos4_delay_timer); | ||
204 | 217 | ||
205 | if (clocksource_register_hz(&mct_frc, clk_rate)) | 218 | if (clocksource_register_hz(&mct_frc, clk_rate)) |
206 | panic("%s: can't register clocksource\n", mct_frc.name); | 219 | panic("%s: can't register clocksource\n", mct_frc.name); |
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index e473d6555f96..ffe350f86bca 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig | |||
@@ -186,6 +186,8 @@ config CPU_FREQ_GOV_CONSERVATIVE | |||
186 | config GENERIC_CPUFREQ_CPU0 | 186 | config GENERIC_CPUFREQ_CPU0 |
187 | tristate "Generic CPU0 cpufreq driver" | 187 | tristate "Generic CPU0 cpufreq driver" |
188 | depends on HAVE_CLK && OF | 188 | depends on HAVE_CLK && OF |
189 | # if CPU_THERMAL is on and THERMAL=m, CPU0 cannot be =y: | ||
190 | depends on !CPU_THERMAL || THERMAL | ||
189 | select PM_OPP | 191 | select PM_OPP |
190 | help | 192 | help |
191 | This adds a generic cpufreq driver for CPU0 frequency management. | 193 | This adds a generic cpufreq driver for CPU0 frequency management. |
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index 738c8b7b17dc..db6d9a2fea4d 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile | |||
@@ -49,7 +49,7 @@ obj-$(CONFIG_ARM_BIG_LITTLE_CPUFREQ) += arm_big_little.o | |||
49 | # LITTLE drivers, so that it is probed last. | 49 | # LITTLE drivers, so that it is probed last. |
50 | obj-$(CONFIG_ARM_DT_BL_CPUFREQ) += arm_big_little_dt.o | 50 | obj-$(CONFIG_ARM_DT_BL_CPUFREQ) += arm_big_little_dt.o |
51 | 51 | ||
52 | obj-$(CONFIG_ARCH_DAVINCI_DA850) += davinci-cpufreq.o | 52 | obj-$(CONFIG_ARCH_DAVINCI) += davinci-cpufreq.o |
53 | obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o | 53 | obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o |
54 | obj-$(CONFIG_ARM_EXYNOS_CPUFREQ) += exynos-cpufreq.o | 54 | obj-$(CONFIG_ARM_EXYNOS_CPUFREQ) += exynos-cpufreq.o |
55 | obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ) += exynos4210-cpufreq.o | 55 | obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ) += exynos4210-cpufreq.o |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index aed2b0cb83dc..62259d27f03e 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -2242,10 +2242,8 @@ int cpufreq_update_policy(unsigned int cpu) | |||
2242 | struct cpufreq_policy new_policy; | 2242 | struct cpufreq_policy new_policy; |
2243 | int ret; | 2243 | int ret; |
2244 | 2244 | ||
2245 | if (!policy) { | 2245 | if (!policy) |
2246 | ret = -ENODEV; | 2246 | return -ENODEV; |
2247 | goto no_policy; | ||
2248 | } | ||
2249 | 2247 | ||
2250 | down_write(&policy->rwsem); | 2248 | down_write(&policy->rwsem); |
2251 | 2249 | ||
@@ -2264,7 +2262,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
2264 | new_policy.cur = cpufreq_driver->get(cpu); | 2262 | new_policy.cur = cpufreq_driver->get(cpu); |
2265 | if (WARN_ON(!new_policy.cur)) { | 2263 | if (WARN_ON(!new_policy.cur)) { |
2266 | ret = -EIO; | 2264 | ret = -EIO; |
2267 | goto no_policy; | 2265 | goto unlock; |
2268 | } | 2266 | } |
2269 | 2267 | ||
2270 | if (!policy->cur) { | 2268 | if (!policy->cur) { |
@@ -2279,10 +2277,10 @@ int cpufreq_update_policy(unsigned int cpu) | |||
2279 | 2277 | ||
2280 | ret = cpufreq_set_policy(policy, &new_policy); | 2278 | ret = cpufreq_set_policy(policy, &new_policy); |
2281 | 2279 | ||
2280 | unlock: | ||
2282 | up_write(&policy->rwsem); | 2281 | up_write(&policy->rwsem); |
2283 | 2282 | ||
2284 | cpufreq_cpu_put(policy); | 2283 | cpufreq_cpu_put(policy); |
2285 | no_policy: | ||
2286 | return ret; | 2284 | return ret; |
2287 | } | 2285 | } |
2288 | EXPORT_SYMBOL(cpufreq_update_policy); | 2286 | EXPORT_SYMBOL(cpufreq_update_policy); |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 4e7f492ad583..86631cb6f7de 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -128,6 +128,7 @@ static struct pstate_funcs pstate_funcs; | |||
128 | 128 | ||
129 | struct perf_limits { | 129 | struct perf_limits { |
130 | int no_turbo; | 130 | int no_turbo; |
131 | int turbo_disabled; | ||
131 | int max_perf_pct; | 132 | int max_perf_pct; |
132 | int min_perf_pct; | 133 | int min_perf_pct; |
133 | int32_t max_perf; | 134 | int32_t max_perf; |
@@ -196,10 +197,7 @@ static signed int pid_calc(struct _pid *pid, int32_t busy) | |||
196 | pid->last_err = fp_error; | 197 | pid->last_err = fp_error; |
197 | 198 | ||
198 | result = pterm + mul_fp(pid->integral, pid->i_gain) + dterm; | 199 | result = pterm + mul_fp(pid->integral, pid->i_gain) + dterm; |
199 | if (result >= 0) | 200 | result = result + (1 << (FRAC_BITS-1)); |
200 | result = result + (1 << (FRAC_BITS-1)); | ||
201 | else | ||
202 | result = result - (1 << (FRAC_BITS-1)); | ||
203 | return (signed int)fp_toint(result); | 201 | return (signed int)fp_toint(result); |
204 | } | 202 | } |
205 | 203 | ||
@@ -290,7 +288,10 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, | |||
290 | if (ret != 1) | 288 | if (ret != 1) |
291 | return -EINVAL; | 289 | return -EINVAL; |
292 | limits.no_turbo = clamp_t(int, input, 0 , 1); | 290 | limits.no_turbo = clamp_t(int, input, 0 , 1); |
293 | 291 | if (limits.turbo_disabled) { | |
292 | pr_warn("Turbo disabled by BIOS or unavailable on processor\n"); | ||
293 | limits.no_turbo = limits.turbo_disabled; | ||
294 | } | ||
294 | return count; | 295 | return count; |
295 | } | 296 | } |
296 | 297 | ||
@@ -360,21 +361,21 @@ static int byt_get_min_pstate(void) | |||
360 | { | 361 | { |
361 | u64 value; | 362 | u64 value; |
362 | rdmsrl(BYT_RATIOS, value); | 363 | rdmsrl(BYT_RATIOS, value); |
363 | return (value >> 8) & 0x3F; | 364 | return (value >> 8) & 0x7F; |
364 | } | 365 | } |
365 | 366 | ||
366 | static int byt_get_max_pstate(void) | 367 | static int byt_get_max_pstate(void) |
367 | { | 368 | { |
368 | u64 value; | 369 | u64 value; |
369 | rdmsrl(BYT_RATIOS, value); | 370 | rdmsrl(BYT_RATIOS, value); |
370 | return (value >> 16) & 0x3F; | 371 | return (value >> 16) & 0x7F; |
371 | } | 372 | } |
372 | 373 | ||
373 | static int byt_get_turbo_pstate(void) | 374 | static int byt_get_turbo_pstate(void) |
374 | { | 375 | { |
375 | u64 value; | 376 | u64 value; |
376 | rdmsrl(BYT_TURBO_RATIOS, value); | 377 | rdmsrl(BYT_TURBO_RATIOS, value); |
377 | return value & 0x3F; | 378 | return value & 0x7F; |
378 | } | 379 | } |
379 | 380 | ||
380 | static void byt_set_pstate(struct cpudata *cpudata, int pstate) | 381 | static void byt_set_pstate(struct cpudata *cpudata, int pstate) |
@@ -384,7 +385,7 @@ static void byt_set_pstate(struct cpudata *cpudata, int pstate) | |||
384 | u32 vid; | 385 | u32 vid; |
385 | 386 | ||
386 | val = pstate << 8; | 387 | val = pstate << 8; |
387 | if (limits.no_turbo) | 388 | if (limits.no_turbo && !limits.turbo_disabled) |
388 | val |= (u64)1 << 32; | 389 | val |= (u64)1 << 32; |
389 | 390 | ||
390 | vid_fp = cpudata->vid.min + mul_fp( | 391 | vid_fp = cpudata->vid.min + mul_fp( |
@@ -408,8 +409,8 @@ static void byt_get_vid(struct cpudata *cpudata) | |||
408 | 409 | ||
409 | 410 | ||
410 | rdmsrl(BYT_VIDS, value); | 411 | rdmsrl(BYT_VIDS, value); |
411 | cpudata->vid.min = int_tofp((value >> 8) & 0x3f); | 412 | cpudata->vid.min = int_tofp((value >> 8) & 0x7f); |
412 | cpudata->vid.max = int_tofp((value >> 16) & 0x3f); | 413 | cpudata->vid.max = int_tofp((value >> 16) & 0x7f); |
413 | cpudata->vid.ratio = div_fp( | 414 | cpudata->vid.ratio = div_fp( |
414 | cpudata->vid.max - cpudata->vid.min, | 415 | cpudata->vid.max - cpudata->vid.min, |
415 | int_tofp(cpudata->pstate.max_pstate - | 416 | int_tofp(cpudata->pstate.max_pstate - |
@@ -451,7 +452,7 @@ static void core_set_pstate(struct cpudata *cpudata, int pstate) | |||
451 | u64 val; | 452 | u64 val; |
452 | 453 | ||
453 | val = pstate << 8; | 454 | val = pstate << 8; |
454 | if (limits.no_turbo) | 455 | if (limits.no_turbo && !limits.turbo_disabled) |
455 | val |= (u64)1 << 32; | 456 | val |= (u64)1 << 32; |
456 | 457 | ||
457 | wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); | 458 | wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); |
@@ -699,9 +700,8 @@ static int intel_pstate_init_cpu(unsigned int cpunum) | |||
699 | 700 | ||
700 | cpu = all_cpu_data[cpunum]; | 701 | cpu = all_cpu_data[cpunum]; |
701 | 702 | ||
702 | intel_pstate_get_cpu_pstates(cpu); | ||
703 | |||
704 | cpu->cpu = cpunum; | 703 | cpu->cpu = cpunum; |
704 | intel_pstate_get_cpu_pstates(cpu); | ||
705 | 705 | ||
706 | init_timer_deferrable(&cpu->timer); | 706 | init_timer_deferrable(&cpu->timer); |
707 | cpu->timer.function = intel_pstate_timer_func; | 707 | cpu->timer.function = intel_pstate_timer_func; |
@@ -744,7 +744,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) | |||
744 | limits.min_perf = int_tofp(1); | 744 | limits.min_perf = int_tofp(1); |
745 | limits.max_perf_pct = 100; | 745 | limits.max_perf_pct = 100; |
746 | limits.max_perf = int_tofp(1); | 746 | limits.max_perf = int_tofp(1); |
747 | limits.no_turbo = 0; | 747 | limits.no_turbo = limits.turbo_disabled; |
748 | return 0; | 748 | return 0; |
749 | } | 749 | } |
750 | limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq; | 750 | limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq; |
@@ -787,6 +787,7 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) | |||
787 | { | 787 | { |
788 | struct cpudata *cpu; | 788 | struct cpudata *cpu; |
789 | int rc; | 789 | int rc; |
790 | u64 misc_en; | ||
790 | 791 | ||
791 | rc = intel_pstate_init_cpu(policy->cpu); | 792 | rc = intel_pstate_init_cpu(policy->cpu); |
792 | if (rc) | 793 | if (rc) |
@@ -794,8 +795,13 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) | |||
794 | 795 | ||
795 | cpu = all_cpu_data[policy->cpu]; | 796 | cpu = all_cpu_data[policy->cpu]; |
796 | 797 | ||
797 | if (!limits.no_turbo && | 798 | rdmsrl(MSR_IA32_MISC_ENABLE, misc_en); |
798 | limits.min_perf_pct == 100 && limits.max_perf_pct == 100) | 799 | if (misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE || |
800 | cpu->pstate.max_pstate == cpu->pstate.turbo_pstate) { | ||
801 | limits.turbo_disabled = 1; | ||
802 | limits.no_turbo = 1; | ||
803 | } | ||
804 | if (limits.min_perf_pct == 100 && limits.max_perf_pct == 100) | ||
799 | policy->policy = CPUFREQ_POLICY_PERFORMANCE; | 805 | policy->policy = CPUFREQ_POLICY_PERFORMANCE; |
800 | else | 806 | else |
801 | policy->policy = CPUFREQ_POLICY_POWERSAVE; | 807 | policy->policy = CPUFREQ_POLICY_POWERSAVE; |
diff --git a/drivers/cpuidle/cpuidle-armada-370-xp.c b/drivers/cpuidle/cpuidle-armada-370-xp.c index 28587d0f3947..a5fba0287bfb 100644 --- a/drivers/cpuidle/cpuidle-armada-370-xp.c +++ b/drivers/cpuidle/cpuidle-armada-370-xp.c | |||
@@ -55,7 +55,7 @@ static struct cpuidle_driver armada_370_xp_idle_driver = { | |||
55 | .power_usage = 50, | 55 | .power_usage = 50, |
56 | .target_residency = 100, | 56 | .target_residency = 100, |
57 | .flags = CPUIDLE_FLAG_TIME_VALID, | 57 | .flags = CPUIDLE_FLAG_TIME_VALID, |
58 | .name = "MV CPU IDLE", | 58 | .name = "Idle", |
59 | .desc = "CPU power down", | 59 | .desc = "CPU power down", |
60 | }, | 60 | }, |
61 | .states[2] = { | 61 | .states[2] = { |
@@ -65,7 +65,7 @@ static struct cpuidle_driver armada_370_xp_idle_driver = { | |||
65 | .target_residency = 1000, | 65 | .target_residency = 1000, |
66 | .flags = CPUIDLE_FLAG_TIME_VALID | | 66 | .flags = CPUIDLE_FLAG_TIME_VALID | |
67 | ARMADA_370_XP_FLAG_DEEP_IDLE, | 67 | ARMADA_370_XP_FLAG_DEEP_IDLE, |
68 | .name = "MV CPU DEEP IDLE", | 68 | .name = "Deep idle", |
69 | .desc = "CPU and L2 Fabric power down", | 69 | .desc = "CPU and L2 Fabric power down", |
70 | }, | 70 | }, |
71 | .state_count = ARMADA_370_XP_MAX_STATES, | 71 | .state_count = ARMADA_370_XP_MAX_STATES, |
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 1d80bd3636c5..b512a4ba7569 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c | |||
@@ -453,8 +453,8 @@ static int caam_jr_probe(struct platform_device *pdev) | |||
453 | int error; | 453 | int error; |
454 | 454 | ||
455 | jrdev = &pdev->dev; | 455 | jrdev = &pdev->dev; |
456 | jrpriv = kmalloc(sizeof(struct caam_drv_private_jr), | 456 | jrpriv = devm_kmalloc(jrdev, sizeof(struct caam_drv_private_jr), |
457 | GFP_KERNEL); | 457 | GFP_KERNEL); |
458 | if (!jrpriv) | 458 | if (!jrpriv) |
459 | return -ENOMEM; | 459 | return -ENOMEM; |
460 | 460 | ||
@@ -487,10 +487,8 @@ static int caam_jr_probe(struct platform_device *pdev) | |||
487 | 487 | ||
488 | /* Now do the platform independent part */ | 488 | /* Now do the platform independent part */ |
489 | error = caam_jr_init(jrdev); /* now turn on hardware */ | 489 | error = caam_jr_init(jrdev); /* now turn on hardware */ |
490 | if (error) { | 490 | if (error) |
491 | kfree(jrpriv); | ||
492 | return error; | 491 | return error; |
493 | } | ||
494 | 492 | ||
495 | jrpriv->dev = jrdev; | 493 | jrpriv->dev = jrdev; |
496 | spin_lock(&driver_data.jr_alloc_lock); | 494 | spin_lock(&driver_data.jr_alloc_lock); |
diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c index d028f36ae655..8f8b0b608875 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c | |||
@@ -86,6 +86,9 @@ | |||
86 | 86 | ||
87 | #define USBSS_IRQ_PD_COMP (1 << 2) | 87 | #define USBSS_IRQ_PD_COMP (1 << 2) |
88 | 88 | ||
89 | /* Packet Descriptor */ | ||
90 | #define PD2_ZERO_LENGTH (1 << 19) | ||
91 | |||
89 | struct cppi41_channel { | 92 | struct cppi41_channel { |
90 | struct dma_chan chan; | 93 | struct dma_chan chan; |
91 | struct dma_async_tx_descriptor txd; | 94 | struct dma_async_tx_descriptor txd; |
@@ -307,7 +310,7 @@ static irqreturn_t cppi41_irq(int irq, void *data) | |||
307 | __iormb(); | 310 | __iormb(); |
308 | 311 | ||
309 | while (val) { | 312 | while (val) { |
310 | u32 desc; | 313 | u32 desc, len; |
311 | 314 | ||
312 | q_num = __fls(val); | 315 | q_num = __fls(val); |
313 | val &= ~(1 << q_num); | 316 | val &= ~(1 << q_num); |
@@ -319,9 +322,13 @@ static irqreturn_t cppi41_irq(int irq, void *data) | |||
319 | q_num, desc); | 322 | q_num, desc); |
320 | continue; | 323 | continue; |
321 | } | 324 | } |
322 | c->residue = pd_trans_len(c->desc->pd6) - | ||
323 | pd_trans_len(c->desc->pd0); | ||
324 | 325 | ||
326 | if (c->desc->pd2 & PD2_ZERO_LENGTH) | ||
327 | len = 0; | ||
328 | else | ||
329 | len = pd_trans_len(c->desc->pd0); | ||
330 | |||
331 | c->residue = pd_trans_len(c->desc->pd6) - len; | ||
325 | dma_cookie_complete(&c->txd); | 332 | dma_cookie_complete(&c->txd); |
326 | c->txd.callback(c->txd.callback_param); | 333 | c->txd.callback(c->txd.callback_param); |
327 | } | 334 | } |
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 128714622bf5..14867e3ac8ff 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
@@ -255,6 +255,7 @@ struct sdma_channel { | |||
255 | enum dma_slave_buswidth word_size; | 255 | enum dma_slave_buswidth word_size; |
256 | unsigned int buf_tail; | 256 | unsigned int buf_tail; |
257 | unsigned int num_bd; | 257 | unsigned int num_bd; |
258 | unsigned int period_len; | ||
258 | struct sdma_buffer_descriptor *bd; | 259 | struct sdma_buffer_descriptor *bd; |
259 | dma_addr_t bd_phys; | 260 | dma_addr_t bd_phys; |
260 | unsigned int pc_from_device, pc_to_device; | 261 | unsigned int pc_from_device, pc_to_device; |
@@ -593,6 +594,12 @@ static void sdma_event_disable(struct sdma_channel *sdmac, unsigned int event) | |||
593 | 594 | ||
594 | static void sdma_handle_channel_loop(struct sdma_channel *sdmac) | 595 | static void sdma_handle_channel_loop(struct sdma_channel *sdmac) |
595 | { | 596 | { |
597 | if (sdmac->desc.callback) | ||
598 | sdmac->desc.callback(sdmac->desc.callback_param); | ||
599 | } | ||
600 | |||
601 | static void sdma_update_channel_loop(struct sdma_channel *sdmac) | ||
602 | { | ||
596 | struct sdma_buffer_descriptor *bd; | 603 | struct sdma_buffer_descriptor *bd; |
597 | 604 | ||
598 | /* | 605 | /* |
@@ -611,9 +618,6 @@ static void sdma_handle_channel_loop(struct sdma_channel *sdmac) | |||
611 | bd->mode.status |= BD_DONE; | 618 | bd->mode.status |= BD_DONE; |
612 | sdmac->buf_tail++; | 619 | sdmac->buf_tail++; |
613 | sdmac->buf_tail %= sdmac->num_bd; | 620 | sdmac->buf_tail %= sdmac->num_bd; |
614 | |||
615 | if (sdmac->desc.callback) | ||
616 | sdmac->desc.callback(sdmac->desc.callback_param); | ||
617 | } | 621 | } |
618 | } | 622 | } |
619 | 623 | ||
@@ -669,6 +673,9 @@ static irqreturn_t sdma_int_handler(int irq, void *dev_id) | |||
669 | int channel = fls(stat) - 1; | 673 | int channel = fls(stat) - 1; |
670 | struct sdma_channel *sdmac = &sdma->channel[channel]; | 674 | struct sdma_channel *sdmac = &sdma->channel[channel]; |
671 | 675 | ||
676 | if (sdmac->flags & IMX_DMA_SG_LOOP) | ||
677 | sdma_update_channel_loop(sdmac); | ||
678 | |||
672 | tasklet_schedule(&sdmac->tasklet); | 679 | tasklet_schedule(&sdmac->tasklet); |
673 | 680 | ||
674 | __clear_bit(channel, &stat); | 681 | __clear_bit(channel, &stat); |
@@ -1129,6 +1136,7 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( | |||
1129 | sdmac->status = DMA_IN_PROGRESS; | 1136 | sdmac->status = DMA_IN_PROGRESS; |
1130 | 1137 | ||
1131 | sdmac->buf_tail = 0; | 1138 | sdmac->buf_tail = 0; |
1139 | sdmac->period_len = period_len; | ||
1132 | 1140 | ||
1133 | sdmac->flags |= IMX_DMA_SG_LOOP; | 1141 | sdmac->flags |= IMX_DMA_SG_LOOP; |
1134 | sdmac->direction = direction; | 1142 | sdmac->direction = direction; |
@@ -1225,9 +1233,15 @@ static enum dma_status sdma_tx_status(struct dma_chan *chan, | |||
1225 | struct dma_tx_state *txstate) | 1233 | struct dma_tx_state *txstate) |
1226 | { | 1234 | { |
1227 | struct sdma_channel *sdmac = to_sdma_chan(chan); | 1235 | struct sdma_channel *sdmac = to_sdma_chan(chan); |
1236 | u32 residue; | ||
1237 | |||
1238 | if (sdmac->flags & IMX_DMA_SG_LOOP) | ||
1239 | residue = (sdmac->num_bd - sdmac->buf_tail) * sdmac->period_len; | ||
1240 | else | ||
1241 | residue = sdmac->chn_count - sdmac->chn_real_count; | ||
1228 | 1242 | ||
1229 | dma_set_tx_state(txstate, chan->completed_cookie, chan->cookie, | 1243 | dma_set_tx_state(txstate, chan->completed_cookie, chan->cookie, |
1230 | sdmac->chn_count - sdmac->chn_real_count); | 1244 | residue); |
1231 | 1245 | ||
1232 | return sdmac->status; | 1246 | return sdmac->status; |
1233 | } | 1247 | } |
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 4b9dc836dcf9..e992abc5ef26 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c | |||
@@ -40,7 +40,7 @@ struct pstore_read_data { | |||
40 | static inline u64 generic_id(unsigned long timestamp, | 40 | static inline u64 generic_id(unsigned long timestamp, |
41 | unsigned int part, int count) | 41 | unsigned int part, int count) |
42 | { | 42 | { |
43 | return (timestamp * 100 + part) * 1000 + count; | 43 | return ((u64) timestamp * 100 + part) * 1000 + count; |
44 | } | 44 | } |
45 | 45 | ||
46 | static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | 46 | static int efi_pstore_read_func(struct efivar_entry *entry, void *data) |
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index cd36deb619fa..eff1a2f22f09 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c | |||
@@ -353,10 +353,10 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, | |||
353 | int depth, void *data) | 353 | int depth, void *data) |
354 | { | 354 | { |
355 | struct param_info *info = data; | 355 | struct param_info *info = data; |
356 | void *prop, *dest; | 356 | const void *prop; |
357 | unsigned long len; | 357 | void *dest; |
358 | u64 val; | 358 | u64 val; |
359 | int i; | 359 | int i, len; |
360 | 360 | ||
361 | if (depth != 1 || | 361 | if (depth != 1 || |
362 | (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) | 362 | (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) |
diff --git a/drivers/firmware/efi/fdt.c b/drivers/firmware/efi/fdt.c index 5c6a8e8a9580..82d774161cc9 100644 --- a/drivers/firmware/efi/fdt.c +++ b/drivers/firmware/efi/fdt.c | |||
@@ -63,7 +63,7 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
63 | */ | 63 | */ |
64 | prev = 0; | 64 | prev = 0; |
65 | for (;;) { | 65 | for (;;) { |
66 | const char *type, *name; | 66 | const char *type; |
67 | int len; | 67 | int len; |
68 | 68 | ||
69 | node = fdt_next_node(fdt, prev, NULL); | 69 | node = fdt_next_node(fdt, prev, NULL); |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 03711d00aaae..8218078b6133 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -419,8 +419,9 @@ long drm_ioctl(struct file *filp, | |||
419 | retcode = -EFAULT; | 419 | retcode = -EFAULT; |
420 | goto err_i1; | 420 | goto err_i1; |
421 | } | 421 | } |
422 | } else | 422 | } else if (cmd & IOC_OUT) { |
423 | memset(kdata, 0, usize); | 423 | memset(kdata, 0, usize); |
424 | } | ||
424 | 425 | ||
425 | if (ioctl->flags & DRM_UNLOCKED) | 426 | if (ioctl->flags & DRM_UNLOCKED) |
426 | retcode = func(dev, kdata, file_priv); | 427 | retcode = func(dev, kdata, file_priv); |
diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c index 7c2497dea1e9..0dc57d5ecd10 100644 --- a/drivers/gpu/drm/drm_modeset_lock.c +++ b/drivers/gpu/drm/drm_modeset_lock.c | |||
@@ -64,6 +64,7 @@ | |||
64 | void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx, | 64 | void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx, |
65 | uint32_t flags) | 65 | uint32_t flags) |
66 | { | 66 | { |
67 | memset(ctx, 0, sizeof(*ctx)); | ||
67 | ww_acquire_init(&ctx->ww_ctx, &crtc_ww_class); | 68 | ww_acquire_init(&ctx->ww_ctx, &crtc_ww_class); |
68 | INIT_LIST_HEAD(&ctx->locked); | 69 | INIT_LIST_HEAD(&ctx->locked); |
69 | } | 70 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index 482127f633c5..9e530f205ad2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c | |||
@@ -40,7 +40,7 @@ exynos_dpi_detect(struct drm_connector *connector, bool force) | |||
40 | { | 40 | { |
41 | struct exynos_dpi *ctx = connector_to_dpi(connector); | 41 | struct exynos_dpi *ctx = connector_to_dpi(connector); |
42 | 42 | ||
43 | if (!ctx->panel->connector) | 43 | if (ctx->panel && !ctx->panel->connector) |
44 | drm_panel_attach(ctx->panel, &ctx->connector); | 44 | drm_panel_attach(ctx->panel, &ctx->connector); |
45 | 45 | ||
46 | return connector_status_connected; | 46 | return connector_status_connected; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index d91f27777537..ab7d182063c3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -765,24 +765,24 @@ static int exynos_drm_init(void) | |||
765 | 765 | ||
766 | return 0; | 766 | return 0; |
767 | 767 | ||
768 | err_unregister_pd: | ||
769 | platform_device_unregister(exynos_drm_pdev); | ||
770 | |||
771 | err_remove_vidi: | 768 | err_remove_vidi: |
772 | #ifdef CONFIG_DRM_EXYNOS_VIDI | 769 | #ifdef CONFIG_DRM_EXYNOS_VIDI |
773 | exynos_drm_remove_vidi(); | 770 | exynos_drm_remove_vidi(); |
771 | |||
772 | err_unregister_pd: | ||
774 | #endif | 773 | #endif |
774 | platform_device_unregister(exynos_drm_pdev); | ||
775 | 775 | ||
776 | return ret; | 776 | return ret; |
777 | } | 777 | } |
778 | 778 | ||
779 | static void exynos_drm_exit(void) | 779 | static void exynos_drm_exit(void) |
780 | { | 780 | { |
781 | platform_driver_unregister(&exynos_drm_platform_driver); | ||
781 | #ifdef CONFIG_DRM_EXYNOS_VIDI | 782 | #ifdef CONFIG_DRM_EXYNOS_VIDI |
782 | exynos_drm_remove_vidi(); | 783 | exynos_drm_remove_vidi(); |
783 | #endif | 784 | #endif |
784 | platform_device_unregister(exynos_drm_pdev); | 785 | platform_device_unregister(exynos_drm_pdev); |
785 | platform_driver_unregister(&exynos_drm_platform_driver); | ||
786 | } | 786 | } |
787 | 787 | ||
788 | module_init(exynos_drm_init); | 788 | module_init(exynos_drm_init); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 36535f398848..06cde4506278 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -343,7 +343,7 @@ struct exynos_drm_display * exynos_dpi_probe(struct device *dev); | |||
343 | int exynos_dpi_remove(struct device *dev); | 343 | int exynos_dpi_remove(struct device *dev); |
344 | #else | 344 | #else |
345 | static inline struct exynos_drm_display * | 345 | static inline struct exynos_drm_display * |
346 | exynos_dpi_probe(struct device *dev) { return 0; } | 346 | exynos_dpi_probe(struct device *dev) { return NULL; } |
347 | static inline int exynos_dpi_remove(struct device *dev) { return 0; } | 347 | static inline int exynos_dpi_remove(struct device *dev) { return 0; } |
348 | #endif | 348 | #endif |
349 | 349 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index bb45ab2e7384..33161ad38201 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -741,6 +741,8 @@ static void fimd_apply(struct exynos_drm_manager *mgr) | |||
741 | win_data = &ctx->win_data[i]; | 741 | win_data = &ctx->win_data[i]; |
742 | if (win_data->enabled) | 742 | if (win_data->enabled) |
743 | fimd_win_commit(mgr, i); | 743 | fimd_win_commit(mgr, i); |
744 | else | ||
745 | fimd_win_disable(mgr, i); | ||
744 | } | 746 | } |
745 | 747 | ||
746 | fimd_commit(mgr); | 748 | fimd_commit(mgr); |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index c104d0c9b385..aa259b0a873a 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -2090,6 +2090,11 @@ out: | |||
2090 | 2090 | ||
2091 | static void hdmi_dpms(struct exynos_drm_display *display, int mode) | 2091 | static void hdmi_dpms(struct exynos_drm_display *display, int mode) |
2092 | { | 2092 | { |
2093 | struct hdmi_context *hdata = display->ctx; | ||
2094 | struct drm_encoder *encoder = hdata->encoder; | ||
2095 | struct drm_crtc *crtc = encoder->crtc; | ||
2096 | struct drm_crtc_helper_funcs *funcs = NULL; | ||
2097 | |||
2093 | DRM_DEBUG_KMS("mode %d\n", mode); | 2098 | DRM_DEBUG_KMS("mode %d\n", mode); |
2094 | 2099 | ||
2095 | switch (mode) { | 2100 | switch (mode) { |
@@ -2099,6 +2104,20 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode) | |||
2099 | case DRM_MODE_DPMS_STANDBY: | 2104 | case DRM_MODE_DPMS_STANDBY: |
2100 | case DRM_MODE_DPMS_SUSPEND: | 2105 | case DRM_MODE_DPMS_SUSPEND: |
2101 | case DRM_MODE_DPMS_OFF: | 2106 | case DRM_MODE_DPMS_OFF: |
2107 | /* | ||
2108 | * The SFRs of VP and Mixer are updated by Vertical Sync of | ||
2109 | * Timing generator which is a part of HDMI so the sequence | ||
2110 | * to disable TV Subsystem should be as following, | ||
2111 | * VP -> Mixer -> HDMI | ||
2112 | * | ||
2113 | * Below codes will try to disable Mixer and VP(if used) | ||
2114 | * prior to disabling HDMI. | ||
2115 | */ | ||
2116 | if (crtc) | ||
2117 | funcs = crtc->helper_private; | ||
2118 | if (funcs && funcs->dpms) | ||
2119 | (*funcs->dpms)(crtc, mode); | ||
2120 | |||
2102 | hdmi_poweroff(display); | 2121 | hdmi_poweroff(display); |
2103 | break; | 2122 | break; |
2104 | default: | 2123 | default: |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 4c5aed7e54c8..7529946d0a74 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -377,6 +377,20 @@ static void mixer_run(struct mixer_context *ctx) | |||
377 | mixer_regs_dump(ctx); | 377 | mixer_regs_dump(ctx); |
378 | } | 378 | } |
379 | 379 | ||
380 | static void mixer_stop(struct mixer_context *ctx) | ||
381 | { | ||
382 | struct mixer_resources *res = &ctx->mixer_res; | ||
383 | int timeout = 20; | ||
384 | |||
385 | mixer_reg_writemask(res, MXR_STATUS, 0, MXR_STATUS_REG_RUN); | ||
386 | |||
387 | while (!(mixer_reg_read(res, MXR_STATUS) & MXR_STATUS_REG_IDLE) && | ||
388 | --timeout) | ||
389 | usleep_range(10000, 12000); | ||
390 | |||
391 | mixer_regs_dump(ctx); | ||
392 | } | ||
393 | |||
380 | static void vp_video_buffer(struct mixer_context *ctx, int win) | 394 | static void vp_video_buffer(struct mixer_context *ctx, int win) |
381 | { | 395 | { |
382 | struct mixer_resources *res = &ctx->mixer_res; | 396 | struct mixer_resources *res = &ctx->mixer_res; |
@@ -497,13 +511,8 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) | |||
497 | static void mixer_layer_update(struct mixer_context *ctx) | 511 | static void mixer_layer_update(struct mixer_context *ctx) |
498 | { | 512 | { |
499 | struct mixer_resources *res = &ctx->mixer_res; | 513 | struct mixer_resources *res = &ctx->mixer_res; |
500 | u32 val; | ||
501 | |||
502 | val = mixer_reg_read(res, MXR_CFG); | ||
503 | 514 | ||
504 | /* allow one update per vsync only */ | 515 | mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE); |
505 | if (!(val & MXR_CFG_LAYER_UPDATE_COUNT_MASK)) | ||
506 | mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE); | ||
507 | } | 516 | } |
508 | 517 | ||
509 | static void mixer_graph_buffer(struct mixer_context *ctx, int win) | 518 | static void mixer_graph_buffer(struct mixer_context *ctx, int win) |
@@ -1010,6 +1019,8 @@ static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) | |||
1010 | } | 1019 | } |
1011 | mutex_unlock(&mixer_ctx->mixer_mutex); | 1020 | mutex_unlock(&mixer_ctx->mixer_mutex); |
1012 | 1021 | ||
1022 | drm_vblank_get(mgr->crtc->dev, mixer_ctx->pipe); | ||
1023 | |||
1013 | atomic_set(&mixer_ctx->wait_vsync_event, 1); | 1024 | atomic_set(&mixer_ctx->wait_vsync_event, 1); |
1014 | 1025 | ||
1015 | /* | 1026 | /* |
@@ -1020,6 +1031,8 @@ static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) | |||
1020 | !atomic_read(&mixer_ctx->wait_vsync_event), | 1031 | !atomic_read(&mixer_ctx->wait_vsync_event), |
1021 | HZ/20)) | 1032 | HZ/20)) |
1022 | DRM_DEBUG_KMS("vblank wait timed out.\n"); | 1033 | DRM_DEBUG_KMS("vblank wait timed out.\n"); |
1034 | |||
1035 | drm_vblank_put(mgr->crtc->dev, mixer_ctx->pipe); | ||
1023 | } | 1036 | } |
1024 | 1037 | ||
1025 | static void mixer_window_suspend(struct exynos_drm_manager *mgr) | 1038 | static void mixer_window_suspend(struct exynos_drm_manager *mgr) |
@@ -1061,7 +1074,7 @@ static void mixer_poweron(struct exynos_drm_manager *mgr) | |||
1061 | mutex_unlock(&ctx->mixer_mutex); | 1074 | mutex_unlock(&ctx->mixer_mutex); |
1062 | return; | 1075 | return; |
1063 | } | 1076 | } |
1064 | ctx->powered = true; | 1077 | |
1065 | mutex_unlock(&ctx->mixer_mutex); | 1078 | mutex_unlock(&ctx->mixer_mutex); |
1066 | 1079 | ||
1067 | pm_runtime_get_sync(ctx->dev); | 1080 | pm_runtime_get_sync(ctx->dev); |
@@ -1072,6 +1085,12 @@ static void mixer_poweron(struct exynos_drm_manager *mgr) | |||
1072 | clk_prepare_enable(res->sclk_mixer); | 1085 | clk_prepare_enable(res->sclk_mixer); |
1073 | } | 1086 | } |
1074 | 1087 | ||
1088 | mutex_lock(&ctx->mixer_mutex); | ||
1089 | ctx->powered = true; | ||
1090 | mutex_unlock(&ctx->mixer_mutex); | ||
1091 | |||
1092 | mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET); | ||
1093 | |||
1075 | mixer_reg_write(res, MXR_INT_EN, ctx->int_en); | 1094 | mixer_reg_write(res, MXR_INT_EN, ctx->int_en); |
1076 | mixer_win_reset(ctx); | 1095 | mixer_win_reset(ctx); |
1077 | 1096 | ||
@@ -1084,14 +1103,21 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr) | |||
1084 | struct mixer_resources *res = &ctx->mixer_res; | 1103 | struct mixer_resources *res = &ctx->mixer_res; |
1085 | 1104 | ||
1086 | mutex_lock(&ctx->mixer_mutex); | 1105 | mutex_lock(&ctx->mixer_mutex); |
1087 | if (!ctx->powered) | 1106 | if (!ctx->powered) { |
1088 | goto out; | 1107 | mutex_unlock(&ctx->mixer_mutex); |
1108 | return; | ||
1109 | } | ||
1089 | mutex_unlock(&ctx->mixer_mutex); | 1110 | mutex_unlock(&ctx->mixer_mutex); |
1090 | 1111 | ||
1112 | mixer_stop(ctx); | ||
1091 | mixer_window_suspend(mgr); | 1113 | mixer_window_suspend(mgr); |
1092 | 1114 | ||
1093 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); | 1115 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); |
1094 | 1116 | ||
1117 | mutex_lock(&ctx->mixer_mutex); | ||
1118 | ctx->powered = false; | ||
1119 | mutex_unlock(&ctx->mixer_mutex); | ||
1120 | |||
1095 | clk_disable_unprepare(res->mixer); | 1121 | clk_disable_unprepare(res->mixer); |
1096 | if (ctx->vp_enabled) { | 1122 | if (ctx->vp_enabled) { |
1097 | clk_disable_unprepare(res->vp); | 1123 | clk_disable_unprepare(res->vp); |
@@ -1099,12 +1125,6 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr) | |||
1099 | } | 1125 | } |
1100 | 1126 | ||
1101 | pm_runtime_put_sync(ctx->dev); | 1127 | pm_runtime_put_sync(ctx->dev); |
1102 | |||
1103 | mutex_lock(&ctx->mixer_mutex); | ||
1104 | ctx->powered = false; | ||
1105 | |||
1106 | out: | ||
1107 | mutex_unlock(&ctx->mixer_mutex); | ||
1108 | } | 1128 | } |
1109 | 1129 | ||
1110 | static void mixer_dpms(struct exynos_drm_manager *mgr, int mode) | 1130 | static void mixer_dpms(struct exynos_drm_manager *mgr, int mode) |
diff --git a/drivers/gpu/drm/exynos/regs-mixer.h b/drivers/gpu/drm/exynos/regs-mixer.h index 4537026bc385..5f32e1a29411 100644 --- a/drivers/gpu/drm/exynos/regs-mixer.h +++ b/drivers/gpu/drm/exynos/regs-mixer.h | |||
@@ -78,6 +78,7 @@ | |||
78 | #define MXR_STATUS_BIG_ENDIAN (1 << 3) | 78 | #define MXR_STATUS_BIG_ENDIAN (1 << 3) |
79 | #define MXR_STATUS_ENDIAN_MASK (1 << 3) | 79 | #define MXR_STATUS_ENDIAN_MASK (1 << 3) |
80 | #define MXR_STATUS_SYNC_ENABLE (1 << 2) | 80 | #define MXR_STATUS_SYNC_ENABLE (1 << 2) |
81 | #define MXR_STATUS_REG_IDLE (1 << 1) | ||
81 | #define MXR_STATUS_REG_RUN (1 << 0) | 82 | #define MXR_STATUS_REG_RUN (1 << 0) |
82 | 83 | ||
83 | /* bits for MXR_CFG */ | 84 | /* bits for MXR_CFG */ |
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 240c331405b9..ac357b02bd35 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c | |||
@@ -810,6 +810,12 @@ static int | |||
810 | tda998x_encoder_mode_valid(struct drm_encoder *encoder, | 810 | tda998x_encoder_mode_valid(struct drm_encoder *encoder, |
811 | struct drm_display_mode *mode) | 811 | struct drm_display_mode *mode) |
812 | { | 812 | { |
813 | if (mode->clock > 150000) | ||
814 | return MODE_CLOCK_HIGH; | ||
815 | if (mode->htotal >= BIT(13)) | ||
816 | return MODE_BAD_HVALUE; | ||
817 | if (mode->vtotal >= BIT(11)) | ||
818 | return MODE_BAD_VVALUE; | ||
813 | return MODE_OK; | 819 | return MODE_OK; |
814 | } | 820 | } |
815 | 821 | ||
@@ -1048,8 +1054,8 @@ read_edid_block(struct drm_encoder *encoder, uint8_t *buf, int blk) | |||
1048 | return i; | 1054 | return i; |
1049 | } | 1055 | } |
1050 | } else { | 1056 | } else { |
1051 | for (i = 10; i > 0; i--) { | 1057 | for (i = 100; i > 0; i--) { |
1052 | msleep(10); | 1058 | msleep(1); |
1053 | ret = reg_read(priv, REG_INT_FLAGS_2); | 1059 | ret = reg_read(priv, REG_INT_FLAGS_2); |
1054 | if (ret < 0) | 1060 | if (ret < 0) |
1055 | return ret; | 1061 | return ret; |
@@ -1183,7 +1189,6 @@ static void | |||
1183 | tda998x_encoder_destroy(struct drm_encoder *encoder) | 1189 | tda998x_encoder_destroy(struct drm_encoder *encoder) |
1184 | { | 1190 | { |
1185 | struct tda998x_priv *priv = to_tda998x_priv(encoder); | 1191 | struct tda998x_priv *priv = to_tda998x_priv(encoder); |
1186 | drm_i2c_encoder_destroy(encoder); | ||
1187 | 1192 | ||
1188 | /* disable all IRQs and free the IRQ handler */ | 1193 | /* disable all IRQs and free the IRQ handler */ |
1189 | cec_write(priv, REG_CEC_RXSHPDINTENA, 0); | 1194 | cec_write(priv, REG_CEC_RXSHPDINTENA, 0); |
@@ -1193,6 +1198,7 @@ tda998x_encoder_destroy(struct drm_encoder *encoder) | |||
1193 | 1198 | ||
1194 | if (priv->cec) | 1199 | if (priv->cec) |
1195 | i2c_unregister_device(priv->cec); | 1200 | i2c_unregister_device(priv->cec); |
1201 | drm_i2c_encoder_destroy(encoder); | ||
1196 | kfree(priv); | 1202 | kfree(priv); |
1197 | } | 1203 | } |
1198 | 1204 | ||
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 601caa88c092..b8c689202c40 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -446,7 +446,9 @@ static int i915_gem_object_info(struct seq_file *m, void* data) | |||
446 | 446 | ||
447 | memset(&stats, 0, sizeof(stats)); | 447 | memset(&stats, 0, sizeof(stats)); |
448 | stats.file_priv = file->driver_priv; | 448 | stats.file_priv = file->driver_priv; |
449 | spin_lock(&file->table_lock); | ||
449 | idr_for_each(&file->object_idr, per_file_stats, &stats); | 450 | idr_for_each(&file->object_idr, per_file_stats, &stats); |
451 | spin_unlock(&file->table_lock); | ||
450 | /* | 452 | /* |
451 | * Although we have a valid reference on file->pid, that does | 453 | * Although we have a valid reference on file->pid, that does |
452 | * not guarantee that the task_struct who called get_pid() is | 454 | * not guarantee that the task_struct who called get_pid() is |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 4c22a5b7f4c5..d44344140627 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -36,6 +36,8 @@ | |||
36 | #include "i915_drv.h" | 36 | #include "i915_drv.h" |
37 | #include "i915_trace.h" | 37 | #include "i915_trace.h" |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/console.h> | ||
40 | #include <linux/vt.h> | ||
39 | #include <linux/vgaarb.h> | 41 | #include <linux/vgaarb.h> |
40 | #include <linux/acpi.h> | 42 | #include <linux/acpi.h> |
41 | #include <linux/pnp.h> | 43 | #include <linux/pnp.h> |
@@ -1386,7 +1388,6 @@ cleanup_gem: | |||
1386 | i915_gem_context_fini(dev); | 1388 | i915_gem_context_fini(dev); |
1387 | mutex_unlock(&dev->struct_mutex); | 1389 | mutex_unlock(&dev->struct_mutex); |
1388 | WARN_ON(dev_priv->mm.aliasing_ppgtt); | 1390 | WARN_ON(dev_priv->mm.aliasing_ppgtt); |
1389 | drm_mm_takedown(&dev_priv->gtt.base.mm); | ||
1390 | cleanup_irq: | 1391 | cleanup_irq: |
1391 | drm_irq_uninstall(dev); | 1392 | drm_irq_uninstall(dev); |
1392 | cleanup_gem_stolen: | 1393 | cleanup_gem_stolen: |
@@ -1450,6 +1451,39 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) | |||
1450 | } | 1451 | } |
1451 | #endif | 1452 | #endif |
1452 | 1453 | ||
1454 | #if !defined(CONFIG_VGA_CONSOLE) | ||
1455 | static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) | ||
1456 | { | ||
1457 | return 0; | ||
1458 | } | ||
1459 | #elif !defined(CONFIG_DUMMY_CONSOLE) | ||
1460 | static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) | ||
1461 | { | ||
1462 | return -ENODEV; | ||
1463 | } | ||
1464 | #else | ||
1465 | static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) | ||
1466 | { | ||
1467 | int ret = 0; | ||
1468 | |||
1469 | DRM_INFO("Replacing VGA console driver\n"); | ||
1470 | |||
1471 | console_lock(); | ||
1472 | if (con_is_bound(&vga_con)) | ||
1473 | ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1); | ||
1474 | if (ret == 0) { | ||
1475 | ret = do_unregister_con_driver(&vga_con); | ||
1476 | |||
1477 | /* Ignore "already unregistered". */ | ||
1478 | if (ret == -ENODEV) | ||
1479 | ret = 0; | ||
1480 | } | ||
1481 | console_unlock(); | ||
1482 | |||
1483 | return ret; | ||
1484 | } | ||
1485 | #endif | ||
1486 | |||
1453 | static void i915_dump_device_info(struct drm_i915_private *dev_priv) | 1487 | static void i915_dump_device_info(struct drm_i915_private *dev_priv) |
1454 | { | 1488 | { |
1455 | const struct intel_device_info *info = &dev_priv->info; | 1489 | const struct intel_device_info *info = &dev_priv->info; |
@@ -1623,8 +1657,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1623 | if (ret) | 1657 | if (ret) |
1624 | goto out_regs; | 1658 | goto out_regs; |
1625 | 1659 | ||
1626 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 1660 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
1661 | ret = i915_kick_out_vgacon(dev_priv); | ||
1662 | if (ret) { | ||
1663 | DRM_ERROR("failed to remove conflicting VGA console\n"); | ||
1664 | goto out_gtt; | ||
1665 | } | ||
1666 | |||
1627 | i915_kick_out_firmware_fb(dev_priv); | 1667 | i915_kick_out_firmware_fb(dev_priv); |
1668 | } | ||
1628 | 1669 | ||
1629 | pci_set_master(dev->pdev); | 1670 | pci_set_master(dev->pdev); |
1630 | 1671 | ||
@@ -1756,8 +1797,6 @@ out_mtrrfree: | |||
1756 | arch_phys_wc_del(dev_priv->gtt.mtrr); | 1797 | arch_phys_wc_del(dev_priv->gtt.mtrr); |
1757 | io_mapping_free(dev_priv->gtt.mappable); | 1798 | io_mapping_free(dev_priv->gtt.mappable); |
1758 | out_gtt: | 1799 | out_gtt: |
1759 | list_del(&dev_priv->gtt.base.global_link); | ||
1760 | drm_mm_takedown(&dev_priv->gtt.base.mm); | ||
1761 | dev_priv->gtt.base.cleanup(&dev_priv->gtt.base); | 1800 | dev_priv->gtt.base.cleanup(&dev_priv->gtt.base); |
1762 | out_regs: | 1801 | out_regs: |
1763 | intel_uncore_fini(dev); | 1802 | intel_uncore_fini(dev); |
@@ -1846,7 +1885,6 @@ int i915_driver_unload(struct drm_device *dev) | |||
1846 | i915_free_hws(dev); | 1885 | i915_free_hws(dev); |
1847 | } | 1886 | } |
1848 | 1887 | ||
1849 | list_del(&dev_priv->gtt.base.global_link); | ||
1850 | WARN_ON(!list_empty(&dev_priv->vm_list)); | 1888 | WARN_ON(!list_empty(&dev_priv->vm_list)); |
1851 | 1889 | ||
1852 | drm_vblank_cleanup(dev); | 1890 | drm_vblank_cleanup(dev); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 49414d30e8d4..374f964323ad 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -656,6 +656,7 @@ enum intel_sbi_destination { | |||
656 | #define QUIRK_PIPEA_FORCE (1<<0) | 656 | #define QUIRK_PIPEA_FORCE (1<<0) |
657 | #define QUIRK_LVDS_SSC_DISABLE (1<<1) | 657 | #define QUIRK_LVDS_SSC_DISABLE (1<<1) |
658 | #define QUIRK_INVERT_BRIGHTNESS (1<<2) | 658 | #define QUIRK_INVERT_BRIGHTNESS (1<<2) |
659 | #define QUIRK_BACKLIGHT_PRESENT (1<<3) | ||
659 | 660 | ||
660 | struct intel_fbdev; | 661 | struct intel_fbdev; |
661 | struct intel_fbc_work; | 662 | struct intel_fbc_work; |
@@ -977,6 +978,8 @@ struct i915_power_well { | |||
977 | bool always_on; | 978 | bool always_on; |
978 | /* power well enable/disable usage count */ | 979 | /* power well enable/disable usage count */ |
979 | int count; | 980 | int count; |
981 | /* cached hw enabled state */ | ||
982 | bool hw_enabled; | ||
980 | unsigned long domains; | 983 | unsigned long domains; |
981 | unsigned long data; | 984 | unsigned long data; |
982 | const struct i915_power_well_ops *ops; | 985 | const struct i915_power_well_ops *ops; |
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 3ffe308d5893..a5ddf3bce9c3 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c | |||
@@ -598,6 +598,7 @@ static int do_switch(struct intel_engine_cs *ring, | |||
598 | struct intel_context *from = ring->last_context; | 598 | struct intel_context *from = ring->last_context; |
599 | struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to); | 599 | struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to); |
600 | u32 hw_flags = 0; | 600 | u32 hw_flags = 0; |
601 | bool uninitialized = false; | ||
601 | int ret, i; | 602 | int ret, i; |
602 | 603 | ||
603 | if (from != NULL && ring == &dev_priv->ring[RCS]) { | 604 | if (from != NULL && ring == &dev_priv->ring[RCS]) { |
@@ -696,19 +697,20 @@ static int do_switch(struct intel_engine_cs *ring, | |||
696 | i915_gem_context_unreference(from); | 697 | i915_gem_context_unreference(from); |
697 | } | 698 | } |
698 | 699 | ||
700 | uninitialized = !to->is_initialized && from == NULL; | ||
701 | to->is_initialized = true; | ||
702 | |||
699 | done: | 703 | done: |
700 | i915_gem_context_reference(to); | 704 | i915_gem_context_reference(to); |
701 | ring->last_context = to; | 705 | ring->last_context = to; |
702 | to->last_ring = ring; | 706 | to->last_ring = ring; |
703 | 707 | ||
704 | if (ring->id == RCS && !to->is_initialized && from == NULL) { | 708 | if (uninitialized) { |
705 | ret = i915_gem_render_state_init(ring); | 709 | ret = i915_gem_render_state_init(ring); |
706 | if (ret) | 710 | if (ret) |
707 | DRM_ERROR("init render state: %d\n", ret); | 711 | DRM_ERROR("init render state: %d\n", ret); |
708 | } | 712 | } |
709 | 713 | ||
710 | to->is_initialized = true; | ||
711 | |||
712 | return 0; | 714 | return 0; |
713 | 715 | ||
714 | unpin_out: | 716 | unpin_out: |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index eec820aec022..8b3cde703364 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -1992,7 +1992,10 @@ static void gen6_gmch_remove(struct i915_address_space *vm) | |||
1992 | 1992 | ||
1993 | struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base); | 1993 | struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base); |
1994 | 1994 | ||
1995 | drm_mm_takedown(&vm->mm); | 1995 | if (drm_mm_initialized(&vm->mm)) { |
1996 | drm_mm_takedown(&vm->mm); | ||
1997 | list_del(&vm->global_link); | ||
1998 | } | ||
1996 | iounmap(gtt->gsm); | 1999 | iounmap(gtt->gsm); |
1997 | teardown_scratch_page(vm->dev); | 2000 | teardown_scratch_page(vm->dev); |
1998 | } | 2001 | } |
@@ -2025,6 +2028,10 @@ static int i915_gmch_probe(struct drm_device *dev, | |||
2025 | 2028 | ||
2026 | static void i915_gmch_remove(struct i915_address_space *vm) | 2029 | static void i915_gmch_remove(struct i915_address_space *vm) |
2027 | { | 2030 | { |
2031 | if (drm_mm_initialized(&vm->mm)) { | ||
2032 | drm_mm_takedown(&vm->mm); | ||
2033 | list_del(&vm->global_link); | ||
2034 | } | ||
2028 | intel_gmch_remove(); | 2035 | intel_gmch_remove(); |
2029 | } | 2036 | } |
2030 | 2037 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 62ef55ba061c..7465ab0fd396 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c | |||
@@ -74,6 +74,50 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev) | |||
74 | if (base == 0) | 74 | if (base == 0) |
75 | return 0; | 75 | return 0; |
76 | 76 | ||
77 | /* make sure we don't clobber the GTT if it's within stolen memory */ | ||
78 | if (INTEL_INFO(dev)->gen <= 4 && !IS_G33(dev) && !IS_G4X(dev)) { | ||
79 | struct { | ||
80 | u32 start, end; | ||
81 | } stolen[2] = { | ||
82 | { .start = base, .end = base + dev_priv->gtt.stolen_size, }, | ||
83 | { .start = base, .end = base + dev_priv->gtt.stolen_size, }, | ||
84 | }; | ||
85 | u64 gtt_start, gtt_end; | ||
86 | |||
87 | gtt_start = I915_READ(PGTBL_CTL); | ||
88 | if (IS_GEN4(dev)) | ||
89 | gtt_start = (gtt_start & PGTBL_ADDRESS_LO_MASK) | | ||
90 | (gtt_start & PGTBL_ADDRESS_HI_MASK) << 28; | ||
91 | else | ||
92 | gtt_start &= PGTBL_ADDRESS_LO_MASK; | ||
93 | gtt_end = gtt_start + gtt_total_entries(dev_priv->gtt) * 4; | ||
94 | |||
95 | if (gtt_start >= stolen[0].start && gtt_start < stolen[0].end) | ||
96 | stolen[0].end = gtt_start; | ||
97 | if (gtt_end > stolen[1].start && gtt_end <= stolen[1].end) | ||
98 | stolen[1].start = gtt_end; | ||
99 | |||
100 | /* pick the larger of the two chunks */ | ||
101 | if (stolen[0].end - stolen[0].start > | ||
102 | stolen[1].end - stolen[1].start) { | ||
103 | base = stolen[0].start; | ||
104 | dev_priv->gtt.stolen_size = stolen[0].end - stolen[0].start; | ||
105 | } else { | ||
106 | base = stolen[1].start; | ||
107 | dev_priv->gtt.stolen_size = stolen[1].end - stolen[1].start; | ||
108 | } | ||
109 | |||
110 | if (stolen[0].start != stolen[1].start || | ||
111 | stolen[0].end != stolen[1].end) { | ||
112 | DRM_DEBUG_KMS("GTT within stolen memory at 0x%llx-0x%llx\n", | ||
113 | (unsigned long long) gtt_start, | ||
114 | (unsigned long long) gtt_end - 1); | ||
115 | DRM_DEBUG_KMS("Stolen memory adjusted to 0x%x-0x%x\n", | ||
116 | base, base + (u32) dev_priv->gtt.stolen_size - 1); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | |||
77 | /* Verify that nothing else uses this physical address. Stolen | 121 | /* Verify that nothing else uses this physical address. Stolen |
78 | * memory should be reserved by the BIOS and hidden from the | 122 | * memory should be reserved by the BIOS and hidden from the |
79 | * kernel. So if the region is already marked as busy, something | 123 | * kernel. So if the region is already marked as busy, something |
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index 87ec60e181a7..66cf41765bf9 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c | |||
@@ -888,6 +888,8 @@ static void i915_gem_record_rings(struct drm_device *dev, | |||
888 | for (i = 0; i < I915_NUM_RINGS; i++) { | 888 | for (i = 0; i < I915_NUM_RINGS; i++) { |
889 | struct intel_engine_cs *ring = &dev_priv->ring[i]; | 889 | struct intel_engine_cs *ring = &dev_priv->ring[i]; |
890 | 890 | ||
891 | error->ring[i].pid = -1; | ||
892 | |||
891 | if (ring->dev == NULL) | 893 | if (ring->dev == NULL) |
892 | continue; | 894 | continue; |
893 | 895 | ||
@@ -895,7 +897,6 @@ static void i915_gem_record_rings(struct drm_device *dev, | |||
895 | 897 | ||
896 | i915_record_ring_state(dev, ring, &error->ring[i]); | 898 | i915_record_ring_state(dev, ring, &error->ring[i]); |
897 | 899 | ||
898 | error->ring[i].pid = -1; | ||
899 | request = i915_gem_find_active_request(ring); | 900 | request = i915_gem_find_active_request(ring); |
900 | if (request) { | 901 | if (request) { |
901 | /* We need to copy these to an anonymous buffer | 902 | /* We need to copy these to an anonymous buffer |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 6f8017a7e937..267f069765ad 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -2847,10 +2847,14 @@ static int semaphore_passed(struct intel_engine_cs *ring) | |||
2847 | struct intel_engine_cs *signaller; | 2847 | struct intel_engine_cs *signaller; |
2848 | u32 seqno, ctl; | 2848 | u32 seqno, ctl; |
2849 | 2849 | ||
2850 | ring->hangcheck.deadlock = true; | 2850 | ring->hangcheck.deadlock++; |
2851 | 2851 | ||
2852 | signaller = semaphore_waits_for(ring, &seqno); | 2852 | signaller = semaphore_waits_for(ring, &seqno); |
2853 | if (signaller == NULL || signaller->hangcheck.deadlock) | 2853 | if (signaller == NULL) |
2854 | return -1; | ||
2855 | |||
2856 | /* Prevent pathological recursion due to driver bugs */ | ||
2857 | if (signaller->hangcheck.deadlock >= I915_NUM_RINGS) | ||
2854 | return -1; | 2858 | return -1; |
2855 | 2859 | ||
2856 | /* cursory check for an unkickable deadlock */ | 2860 | /* cursory check for an unkickable deadlock */ |
@@ -2858,7 +2862,13 @@ static int semaphore_passed(struct intel_engine_cs *ring) | |||
2858 | if (ctl & RING_WAIT_SEMAPHORE && semaphore_passed(signaller) < 0) | 2862 | if (ctl & RING_WAIT_SEMAPHORE && semaphore_passed(signaller) < 0) |
2859 | return -1; | 2863 | return -1; |
2860 | 2864 | ||
2861 | return i915_seqno_passed(signaller->get_seqno(signaller, false), seqno); | 2865 | if (i915_seqno_passed(signaller->get_seqno(signaller, false), seqno)) |
2866 | return 1; | ||
2867 | |||
2868 | if (signaller->hangcheck.deadlock) | ||
2869 | return -1; | ||
2870 | |||
2871 | return 0; | ||
2862 | } | 2872 | } |
2863 | 2873 | ||
2864 | static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv) | 2874 | static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv) |
@@ -2867,7 +2877,7 @@ static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv) | |||
2867 | int i; | 2877 | int i; |
2868 | 2878 | ||
2869 | for_each_ring(ring, dev_priv, i) | 2879 | for_each_ring(ring, dev_priv, i) |
2870 | ring->hangcheck.deadlock = false; | 2880 | ring->hangcheck.deadlock = 0; |
2871 | } | 2881 | } |
2872 | 2882 | ||
2873 | static enum intel_ring_hangcheck_action | 2883 | static enum intel_ring_hangcheck_action |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index e691b30b2817..a5bab61bfc00 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -942,6 +942,9 @@ enum punit_power_well { | |||
942 | /* | 942 | /* |
943 | * Instruction and interrupt control regs | 943 | * Instruction and interrupt control regs |
944 | */ | 944 | */ |
945 | #define PGTBL_CTL 0x02020 | ||
946 | #define PGTBL_ADDRESS_LO_MASK 0xfffff000 /* bits [31:12] */ | ||
947 | #define PGTBL_ADDRESS_HI_MASK 0x000000f0 /* bits [35:32] (gen4) */ | ||
945 | #define PGTBL_ER 0x02024 | 948 | #define PGTBL_ER 0x02024 |
946 | #define RENDER_RING_BASE 0x02000 | 949 | #define RENDER_RING_BASE 0x02000 |
947 | #define BSD_RING_BASE 0x04000 | 950 | #define BSD_RING_BASE 0x04000 |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 1ee98f121a00..827498e081df 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -315,9 +315,6 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb) | |||
315 | const struct bdb_lfp_backlight_data *backlight_data; | 315 | const struct bdb_lfp_backlight_data *backlight_data; |
316 | const struct bdb_lfp_backlight_data_entry *entry; | 316 | const struct bdb_lfp_backlight_data_entry *entry; |
317 | 317 | ||
318 | /* Err to enabling backlight if no backlight block. */ | ||
319 | dev_priv->vbt.backlight.present = true; | ||
320 | |||
321 | backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT); | 318 | backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT); |
322 | if (!backlight_data) | 319 | if (!backlight_data) |
323 | return; | 320 | return; |
@@ -1088,6 +1085,9 @@ init_vbt_defaults(struct drm_i915_private *dev_priv) | |||
1088 | 1085 | ||
1089 | dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC; | 1086 | dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC; |
1090 | 1087 | ||
1088 | /* Default to having backlight */ | ||
1089 | dev_priv->vbt.backlight.present = true; | ||
1090 | |||
1091 | /* LFP panel data */ | 1091 | /* LFP panel data */ |
1092 | dev_priv->vbt.lvds_dither = 1; | 1092 | dev_priv->vbt.lvds_dither = 1; |
1093 | dev_priv->vbt.lvds_vbt = 0; | 1093 | dev_priv->vbt.lvds_vbt = 0; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index efd3cf50cb0f..e27e7804c0b9 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2087,6 +2087,7 @@ void intel_flush_primary_plane(struct drm_i915_private *dev_priv, | |||
2087 | static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, | 2087 | static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, |
2088 | enum plane plane, enum pipe pipe) | 2088 | enum plane plane, enum pipe pipe) |
2089 | { | 2089 | { |
2090 | struct drm_device *dev = dev_priv->dev; | ||
2090 | struct intel_crtc *intel_crtc = | 2091 | struct intel_crtc *intel_crtc = |
2091 | to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); | 2092 | to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); |
2092 | int reg; | 2093 | int reg; |
@@ -2106,6 +2107,14 @@ static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, | |||
2106 | 2107 | ||
2107 | I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE); | 2108 | I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE); |
2108 | intel_flush_primary_plane(dev_priv, plane); | 2109 | intel_flush_primary_plane(dev_priv, plane); |
2110 | |||
2111 | /* | ||
2112 | * BDW signals flip done immediately if the plane | ||
2113 | * is disabled, even if the plane enable is already | ||
2114 | * armed to occur at the next vblank :( | ||
2115 | */ | ||
2116 | if (IS_BROADWELL(dev)) | ||
2117 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
2109 | } | 2118 | } |
2110 | 2119 | ||
2111 | /** | 2120 | /** |
@@ -4564,7 +4573,10 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc) | |||
4564 | if (intel_crtc->active) | 4573 | if (intel_crtc->active) |
4565 | return; | 4574 | return; |
4566 | 4575 | ||
4567 | vlv_prepare_pll(intel_crtc); | 4576 | is_dsi = intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI); |
4577 | |||
4578 | if (!is_dsi && !IS_CHERRYVIEW(dev)) | ||
4579 | vlv_prepare_pll(intel_crtc); | ||
4568 | 4580 | ||
4569 | /* Set up the display plane register */ | 4581 | /* Set up the display plane register */ |
4570 | dspcntr = DISPPLANE_GAMMA_ENABLE; | 4582 | dspcntr = DISPPLANE_GAMMA_ENABLE; |
@@ -4598,8 +4610,6 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc) | |||
4598 | if (encoder->pre_pll_enable) | 4610 | if (encoder->pre_pll_enable) |
4599 | encoder->pre_pll_enable(encoder); | 4611 | encoder->pre_pll_enable(encoder); |
4600 | 4612 | ||
4601 | is_dsi = intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI); | ||
4602 | |||
4603 | if (!is_dsi) { | 4613 | if (!is_dsi) { |
4604 | if (IS_CHERRYVIEW(dev)) | 4614 | if (IS_CHERRYVIEW(dev)) |
4605 | chv_enable_pll(intel_crtc); | 4615 | chv_enable_pll(intel_crtc); |
@@ -11087,6 +11097,22 @@ const char *intel_output_name(int output) | |||
11087 | return names[output]; | 11097 | return names[output]; |
11088 | } | 11098 | } |
11089 | 11099 | ||
11100 | static bool intel_crt_present(struct drm_device *dev) | ||
11101 | { | ||
11102 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
11103 | |||
11104 | if (IS_ULT(dev)) | ||
11105 | return false; | ||
11106 | |||
11107 | if (IS_CHERRYVIEW(dev)) | ||
11108 | return false; | ||
11109 | |||
11110 | if (IS_VALLEYVIEW(dev) && !dev_priv->vbt.int_crt_support) | ||
11111 | return false; | ||
11112 | |||
11113 | return true; | ||
11114 | } | ||
11115 | |||
11090 | static void intel_setup_outputs(struct drm_device *dev) | 11116 | static void intel_setup_outputs(struct drm_device *dev) |
11091 | { | 11117 | { |
11092 | struct drm_i915_private *dev_priv = dev->dev_private; | 11118 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -11095,7 +11121,7 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
11095 | 11121 | ||
11096 | intel_lvds_init(dev); | 11122 | intel_lvds_init(dev); |
11097 | 11123 | ||
11098 | if (!IS_ULT(dev) && !IS_CHERRYVIEW(dev) && dev_priv->vbt.int_crt_support) | 11124 | if (intel_crt_present(dev)) |
11099 | intel_crt_init(dev); | 11125 | intel_crt_init(dev); |
11100 | 11126 | ||
11101 | if (HAS_DDI(dev)) { | 11127 | if (HAS_DDI(dev)) { |
@@ -11565,6 +11591,14 @@ static void quirk_invert_brightness(struct drm_device *dev) | |||
11565 | DRM_INFO("applying inverted panel brightness quirk\n"); | 11591 | DRM_INFO("applying inverted panel brightness quirk\n"); |
11566 | } | 11592 | } |
11567 | 11593 | ||
11594 | /* Some VBT's incorrectly indicate no backlight is present */ | ||
11595 | static void quirk_backlight_present(struct drm_device *dev) | ||
11596 | { | ||
11597 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
11598 | dev_priv->quirks |= QUIRK_BACKLIGHT_PRESENT; | ||
11599 | DRM_INFO("applying backlight present quirk\n"); | ||
11600 | } | ||
11601 | |||
11568 | struct intel_quirk { | 11602 | struct intel_quirk { |
11569 | int device; | 11603 | int device; |
11570 | int subsystem_vendor; | 11604 | int subsystem_vendor; |
@@ -11633,6 +11667,12 @@ static struct intel_quirk intel_quirks[] = { | |||
11633 | 11667 | ||
11634 | /* Acer Aspire 5336 */ | 11668 | /* Acer Aspire 5336 */ |
11635 | { 0x2a42, 0x1025, 0x048a, quirk_invert_brightness }, | 11669 | { 0x2a42, 0x1025, 0x048a, quirk_invert_brightness }, |
11670 | |||
11671 | /* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */ | ||
11672 | { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present }, | ||
11673 | |||
11674 | /* Toshiba CB35 Chromebook (Celeron 2955U) */ | ||
11675 | { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, | ||
11636 | }; | 11676 | }; |
11637 | 11677 | ||
11638 | static void intel_init_quirks(struct drm_device *dev) | 11678 | static void intel_init_quirks(struct drm_device *dev) |
@@ -12411,8 +12451,8 @@ intel_display_capture_error_state(struct drm_device *dev) | |||
12411 | 12451 | ||
12412 | for_each_pipe(i) { | 12452 | for_each_pipe(i) { |
12413 | error->pipe[i].power_domain_on = | 12453 | error->pipe[i].power_domain_on = |
12414 | intel_display_power_enabled_sw(dev_priv, | 12454 | intel_display_power_enabled_unlocked(dev_priv, |
12415 | POWER_DOMAIN_PIPE(i)); | 12455 | POWER_DOMAIN_PIPE(i)); |
12416 | if (!error->pipe[i].power_domain_on) | 12456 | if (!error->pipe[i].power_domain_on) |
12417 | continue; | 12457 | continue; |
12418 | 12458 | ||
@@ -12447,7 +12487,7 @@ intel_display_capture_error_state(struct drm_device *dev) | |||
12447 | enum transcoder cpu_transcoder = transcoders[i]; | 12487 | enum transcoder cpu_transcoder = transcoders[i]; |
12448 | 12488 | ||
12449 | error->transcoder[i].power_domain_on = | 12489 | error->transcoder[i].power_domain_on = |
12450 | intel_display_power_enabled_sw(dev_priv, | 12490 | intel_display_power_enabled_unlocked(dev_priv, |
12451 | POWER_DOMAIN_TRANSCODER(cpu_transcoder)); | 12491 | POWER_DOMAIN_TRANSCODER(cpu_transcoder)); |
12452 | if (!error->transcoder[i].power_domain_on) | 12492 | if (!error->transcoder[i].power_domain_on) |
12453 | continue; | 12493 | continue; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 52fda950fd2a..075170d1844f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/export.h> | 30 | #include <linux/export.h> |
31 | #include <linux/notifier.h> | ||
32 | #include <linux/reboot.h> | ||
31 | #include <drm/drmP.h> | 33 | #include <drm/drmP.h> |
32 | #include <drm/drm_crtc.h> | 34 | #include <drm/drm_crtc.h> |
33 | #include <drm/drm_crtc_helper.h> | 35 | #include <drm/drm_crtc_helper.h> |
@@ -336,6 +338,37 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp) | |||
336 | return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp)); | 338 | return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp)); |
337 | } | 339 | } |
338 | 340 | ||
341 | /* Reboot notifier handler to shutdown panel power to guarantee T12 timing | ||
342 | This function only applicable when panel PM state is not to be tracked */ | ||
343 | static int edp_notify_handler(struct notifier_block *this, unsigned long code, | ||
344 | void *unused) | ||
345 | { | ||
346 | struct intel_dp *intel_dp = container_of(this, typeof(* intel_dp), | ||
347 | edp_notifier); | ||
348 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
349 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
350 | u32 pp_div; | ||
351 | u32 pp_ctrl_reg, pp_div_reg; | ||
352 | enum pipe pipe = vlv_power_sequencer_pipe(intel_dp); | ||
353 | |||
354 | if (!is_edp(intel_dp) || code != SYS_RESTART) | ||
355 | return 0; | ||
356 | |||
357 | if (IS_VALLEYVIEW(dev)) { | ||
358 | pp_ctrl_reg = VLV_PIPE_PP_CONTROL(pipe); | ||
359 | pp_div_reg = VLV_PIPE_PP_DIVISOR(pipe); | ||
360 | pp_div = I915_READ(pp_div_reg); | ||
361 | pp_div &= PP_REFERENCE_DIVIDER_MASK; | ||
362 | |||
363 | /* 0x1F write to PP_DIV_REG sets max cycle delay */ | ||
364 | I915_WRITE(pp_div_reg, pp_div | 0x1F); | ||
365 | I915_WRITE(pp_ctrl_reg, PANEL_UNLOCK_REGS | PANEL_POWER_OFF); | ||
366 | msleep(intel_dp->panel_power_cycle_delay); | ||
367 | } | ||
368 | |||
369 | return 0; | ||
370 | } | ||
371 | |||
339 | static bool edp_have_panel_power(struct intel_dp *intel_dp) | 372 | static bool edp_have_panel_power(struct intel_dp *intel_dp) |
340 | { | 373 | { |
341 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 374 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
@@ -3707,6 +3740,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) | |||
3707 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | 3740 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); |
3708 | edp_panel_vdd_off_sync(intel_dp); | 3741 | edp_panel_vdd_off_sync(intel_dp); |
3709 | drm_modeset_unlock(&dev->mode_config.connection_mutex); | 3742 | drm_modeset_unlock(&dev->mode_config.connection_mutex); |
3743 | if (intel_dp->edp_notifier.notifier_call) { | ||
3744 | unregister_reboot_notifier(&intel_dp->edp_notifier); | ||
3745 | intel_dp->edp_notifier.notifier_call = NULL; | ||
3746 | } | ||
3710 | } | 3747 | } |
3711 | kfree(intel_dig_port); | 3748 | kfree(intel_dig_port); |
3712 | } | 3749 | } |
@@ -4184,6 +4221,11 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, | |||
4184 | } | 4221 | } |
4185 | mutex_unlock(&dev->mode_config.mutex); | 4222 | mutex_unlock(&dev->mode_config.mutex); |
4186 | 4223 | ||
4224 | if (IS_VALLEYVIEW(dev)) { | ||
4225 | intel_dp->edp_notifier.notifier_call = edp_notify_handler; | ||
4226 | register_reboot_notifier(&intel_dp->edp_notifier); | ||
4227 | } | ||
4228 | |||
4187 | intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode); | 4229 | intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode); |
4188 | intel_panel_setup_backlight(connector); | 4230 | intel_panel_setup_backlight(connector); |
4189 | 4231 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index bda0ae3d80cc..f67340ed2c12 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -538,6 +538,8 @@ struct intel_dp { | |||
538 | unsigned long last_power_on; | 538 | unsigned long last_power_on; |
539 | unsigned long last_backlight_off; | 539 | unsigned long last_backlight_off; |
540 | bool psr_setup_done; | 540 | bool psr_setup_done; |
541 | struct notifier_block edp_notifier; | ||
542 | |||
541 | bool use_tps3; | 543 | bool use_tps3; |
542 | struct intel_connector *attached_connector; | 544 | struct intel_connector *attached_connector; |
543 | 545 | ||
@@ -950,8 +952,8 @@ int intel_power_domains_init(struct drm_i915_private *); | |||
950 | void intel_power_domains_remove(struct drm_i915_private *); | 952 | void intel_power_domains_remove(struct drm_i915_private *); |
951 | bool intel_display_power_enabled(struct drm_i915_private *dev_priv, | 953 | bool intel_display_power_enabled(struct drm_i915_private *dev_priv, |
952 | enum intel_display_power_domain domain); | 954 | enum intel_display_power_domain domain); |
953 | bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, | 955 | bool intel_display_power_enabled_unlocked(struct drm_i915_private *dev_priv, |
954 | enum intel_display_power_domain domain); | 956 | enum intel_display_power_domain domain); |
955 | void intel_display_power_get(struct drm_i915_private *dev_priv, | 957 | void intel_display_power_get(struct drm_i915_private *dev_priv, |
956 | enum intel_display_power_domain domain); | 958 | enum intel_display_power_domain domain); |
957 | void intel_display_power_put(struct drm_i915_private *dev_priv, | 959 | void intel_display_power_put(struct drm_i915_private *dev_priv, |
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c index 02f99d768d49..3fd082933c87 100644 --- a/drivers/gpu/drm/i915/intel_dsi.c +++ b/drivers/gpu/drm/i915/intel_dsi.c | |||
@@ -117,17 +117,18 @@ static void intel_dsi_device_ready(struct intel_encoder *encoder) | |||
117 | /* bandgap reset is needed after everytime we do power gate */ | 117 | /* bandgap reset is needed after everytime we do power gate */ |
118 | band_gap_reset(dev_priv); | 118 | band_gap_reset(dev_priv); |
119 | 119 | ||
120 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); | ||
121 | usleep_range(2500, 3000); | ||
122 | |||
120 | val = I915_READ(MIPI_PORT_CTRL(pipe)); | 123 | val = I915_READ(MIPI_PORT_CTRL(pipe)); |
121 | I915_WRITE(MIPI_PORT_CTRL(pipe), val | LP_OUTPUT_HOLD); | 124 | I915_WRITE(MIPI_PORT_CTRL(pipe), val | LP_OUTPUT_HOLD); |
122 | usleep_range(1000, 1500); | 125 | usleep_range(1000, 1500); |
123 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_EXIT); | 126 | |
124 | usleep_range(2000, 2500); | 127 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_EXIT); |
125 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); | 128 | usleep_range(2500, 3000); |
126 | usleep_range(2000, 2500); | 129 | |
127 | I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); | ||
128 | usleep_range(2000, 2500); | ||
129 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); | 130 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); |
130 | usleep_range(2000, 2500); | 131 | usleep_range(2500, 3000); |
131 | } | 132 | } |
132 | 133 | ||
133 | static void intel_dsi_enable(struct intel_encoder *encoder) | 134 | static void intel_dsi_enable(struct intel_encoder *encoder) |
@@ -271,23 +272,23 @@ static void intel_dsi_clear_device_ready(struct intel_encoder *encoder) | |||
271 | 272 | ||
272 | DRM_DEBUG_KMS("\n"); | 273 | DRM_DEBUG_KMS("\n"); |
273 | 274 | ||
274 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); | 275 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_ENTER); |
275 | usleep_range(2000, 2500); | 276 | usleep_range(2000, 2500); |
276 | 277 | ||
277 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_EXIT); | 278 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_EXIT); |
278 | usleep_range(2000, 2500); | 279 | usleep_range(2000, 2500); |
279 | 280 | ||
280 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); | 281 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_ENTER); |
281 | usleep_range(2000, 2500); | 282 | usleep_range(2000, 2500); |
282 | 283 | ||
283 | val = I915_READ(MIPI_PORT_CTRL(pipe)); | ||
284 | I915_WRITE(MIPI_PORT_CTRL(pipe), val & ~LP_OUTPUT_HOLD); | ||
285 | usleep_range(1000, 1500); | ||
286 | |||
287 | if (wait_for(((I915_READ(MIPI_PORT_CTRL(pipe)) & AFE_LATCHOUT) | 284 | if (wait_for(((I915_READ(MIPI_PORT_CTRL(pipe)) & AFE_LATCHOUT) |
288 | == 0x00000), 30)) | 285 | == 0x00000), 30)) |
289 | DRM_ERROR("DSI LP not going Low\n"); | 286 | DRM_ERROR("DSI LP not going Low\n"); |
290 | 287 | ||
288 | val = I915_READ(MIPI_PORT_CTRL(pipe)); | ||
289 | I915_WRITE(MIPI_PORT_CTRL(pipe), val & ~LP_OUTPUT_HOLD); | ||
290 | usleep_range(1000, 1500); | ||
291 | |||
291 | I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); | 292 | I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); |
292 | usleep_range(2000, 2500); | 293 | usleep_range(2000, 2500); |
293 | 294 | ||
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c index 3eeb21b9fddf..933c86305237 100644 --- a/drivers/gpu/drm/i915/intel_dsi_cmd.c +++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c | |||
@@ -404,12 +404,6 @@ int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs) | |||
404 | else | 404 | else |
405 | cmd |= DPI_LP_MODE; | 405 | cmd |= DPI_LP_MODE; |
406 | 406 | ||
407 | /* DPI virtual channel?! */ | ||
408 | |||
409 | mask = DPI_FIFO_EMPTY; | ||
410 | if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(pipe)) & mask) == mask, 50)) | ||
411 | DRM_ERROR("Timeout waiting for DPI FIFO empty.\n"); | ||
412 | |||
413 | /* clear bit */ | 407 | /* clear bit */ |
414 | I915_WRITE(MIPI_INTR_STAT(pipe), SPL_PKT_SENT_INTERRUPT); | 408 | I915_WRITE(MIPI_INTR_STAT(pipe), SPL_PKT_SENT_INTERRUPT); |
415 | 409 | ||
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index 2e2c71fcc9ed..4f6b53998d79 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c | |||
@@ -403,6 +403,15 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) | |||
403 | 403 | ||
404 | DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); | 404 | DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); |
405 | 405 | ||
406 | /* | ||
407 | * If the acpi_video interface is not supposed to be used, don't | ||
408 | * bother processing backlight level change requests from firmware. | ||
409 | */ | ||
410 | if (!acpi_video_verify_backlight_support()) { | ||
411 | DRM_DEBUG_KMS("opregion backlight request ignored\n"); | ||
412 | return 0; | ||
413 | } | ||
414 | |||
406 | if (!(bclp & ASLE_BCLP_VALID)) | 415 | if (!(bclp & ASLE_BCLP_VALID)) |
407 | return ASLC_BACKLIGHT_FAILED; | 416 | return ASLC_BACKLIGHT_FAILED; |
408 | 417 | ||
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 5e6c888b4928..628cd8938274 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -798,9 +798,6 @@ static void i965_enable_backlight(struct intel_connector *connector) | |||
798 | ctl = freq << 16; | 798 | ctl = freq << 16; |
799 | I915_WRITE(BLC_PWM_CTL, ctl); | 799 | I915_WRITE(BLC_PWM_CTL, ctl); |
800 | 800 | ||
801 | /* XXX: combine this into above write? */ | ||
802 | intel_panel_actually_set_backlight(connector, panel->backlight.level); | ||
803 | |||
804 | ctl2 = BLM_PIPE(pipe); | 801 | ctl2 = BLM_PIPE(pipe); |
805 | if (panel->backlight.combination_mode) | 802 | if (panel->backlight.combination_mode) |
806 | ctl2 |= BLM_COMBINATION_MODE; | 803 | ctl2 |= BLM_COMBINATION_MODE; |
@@ -809,6 +806,8 @@ static void i965_enable_backlight(struct intel_connector *connector) | |||
809 | I915_WRITE(BLC_PWM_CTL2, ctl2); | 806 | I915_WRITE(BLC_PWM_CTL2, ctl2); |
810 | POSTING_READ(BLC_PWM_CTL2); | 807 | POSTING_READ(BLC_PWM_CTL2); |
811 | I915_WRITE(BLC_PWM_CTL2, ctl2 | BLM_PWM_ENABLE); | 808 | I915_WRITE(BLC_PWM_CTL2, ctl2 | BLM_PWM_ENABLE); |
809 | |||
810 | intel_panel_actually_set_backlight(connector, panel->backlight.level); | ||
812 | } | 811 | } |
813 | 812 | ||
814 | static void vlv_enable_backlight(struct intel_connector *connector) | 813 | static void vlv_enable_backlight(struct intel_connector *connector) |
@@ -1119,8 +1118,12 @@ int intel_panel_setup_backlight(struct drm_connector *connector) | |||
1119 | int ret; | 1118 | int ret; |
1120 | 1119 | ||
1121 | if (!dev_priv->vbt.backlight.present) { | 1120 | if (!dev_priv->vbt.backlight.present) { |
1122 | DRM_DEBUG_KMS("native backlight control not available per VBT\n"); | 1121 | if (dev_priv->quirks & QUIRK_BACKLIGHT_PRESENT) { |
1123 | return 0; | 1122 | DRM_DEBUG_KMS("no backlight present per VBT, but present per quirk\n"); |
1123 | } else { | ||
1124 | DRM_DEBUG_KMS("no backlight present per VBT\n"); | ||
1125 | return 0; | ||
1126 | } | ||
1124 | } | 1127 | } |
1125 | 1128 | ||
1126 | /* set level and max in panel struct */ | 1129 | /* set level and max in panel struct */ |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index d1e53abec1b5..ee72807069e4 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -511,8 +511,7 @@ void intel_update_fbc(struct drm_device *dev) | |||
511 | obj = intel_fb->obj; | 511 | obj = intel_fb->obj; |
512 | adjusted_mode = &intel_crtc->config.adjusted_mode; | 512 | adjusted_mode = &intel_crtc->config.adjusted_mode; |
513 | 513 | ||
514 | if (i915.enable_fbc < 0 && | 514 | if (i915.enable_fbc < 0) { |
515 | INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev)) { | ||
516 | if (set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT)) | 515 | if (set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT)) |
517 | DRM_DEBUG_KMS("disabled per chip default\n"); | 516 | DRM_DEBUG_KMS("disabled per chip default\n"); |
518 | goto out_disable; | 517 | goto out_disable; |
@@ -3210,6 +3209,14 @@ void gen6_set_rps(struct drm_device *dev, u8 val) | |||
3210 | */ | 3209 | */ |
3211 | static void vlv_set_rps_idle(struct drm_i915_private *dev_priv) | 3210 | static void vlv_set_rps_idle(struct drm_i915_private *dev_priv) |
3212 | { | 3211 | { |
3212 | struct drm_device *dev = dev_priv->dev; | ||
3213 | |||
3214 | /* Latest VLV doesn't need to force the gfx clock */ | ||
3215 | if (dev->pdev->revision >= 0xd) { | ||
3216 | valleyview_set_rps(dev_priv->dev, dev_priv->rps.min_freq_softlimit); | ||
3217 | return; | ||
3218 | } | ||
3219 | |||
3213 | /* | 3220 | /* |
3214 | * When we are idle. Drop to min voltage state. | 3221 | * When we are idle. Drop to min voltage state. |
3215 | */ | 3222 | */ |
@@ -3506,15 +3513,11 @@ static void gen8_enable_rps(struct drm_device *dev) | |||
3506 | 3513 | ||
3507 | I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10); | 3514 | I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10); |
3508 | 3515 | ||
3509 | /* WaDisablePwrmtrEvent:chv (pre-production hw) */ | ||
3510 | I915_WRITE(0xA80C, I915_READ(0xA80C) & 0x00ffffff); | ||
3511 | I915_WRITE(0xA810, I915_READ(0xA810) & 0xffffff00); | ||
3512 | |||
3513 | /* 5: Enable RPS */ | 3516 | /* 5: Enable RPS */ |
3514 | I915_WRITE(GEN6_RP_CONTROL, | 3517 | I915_WRITE(GEN6_RP_CONTROL, |
3515 | GEN6_RP_MEDIA_TURBO | | 3518 | GEN6_RP_MEDIA_TURBO | |
3516 | GEN6_RP_MEDIA_HW_NORMAL_MODE | | 3519 | GEN6_RP_MEDIA_HW_NORMAL_MODE | |
3517 | GEN6_RP_MEDIA_IS_GFX | /* WaSetMaskForGfxBusyness:chv (pre-production hw ?) */ | 3520 | GEN6_RP_MEDIA_IS_GFX | |
3518 | GEN6_RP_ENABLE | | 3521 | GEN6_RP_ENABLE | |
3519 | GEN6_RP_UP_BUSY_AVG | | 3522 | GEN6_RP_UP_BUSY_AVG | |
3520 | GEN6_RP_DOWN_IDLE_AVG); | 3523 | GEN6_RP_DOWN_IDLE_AVG); |
@@ -5608,8 +5611,8 @@ static bool hsw_power_well_enabled(struct drm_i915_private *dev_priv, | |||
5608 | (HSW_PWR_WELL_ENABLE_REQUEST | HSW_PWR_WELL_STATE_ENABLED); | 5611 | (HSW_PWR_WELL_ENABLE_REQUEST | HSW_PWR_WELL_STATE_ENABLED); |
5609 | } | 5612 | } |
5610 | 5613 | ||
5611 | bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, | 5614 | bool intel_display_power_enabled_unlocked(struct drm_i915_private *dev_priv, |
5612 | enum intel_display_power_domain domain) | 5615 | enum intel_display_power_domain domain) |
5613 | { | 5616 | { |
5614 | struct i915_power_domains *power_domains; | 5617 | struct i915_power_domains *power_domains; |
5615 | struct i915_power_well *power_well; | 5618 | struct i915_power_well *power_well; |
@@ -5620,16 +5623,19 @@ bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, | |||
5620 | return false; | 5623 | return false; |
5621 | 5624 | ||
5622 | power_domains = &dev_priv->power_domains; | 5625 | power_domains = &dev_priv->power_domains; |
5626 | |||
5623 | is_enabled = true; | 5627 | is_enabled = true; |
5628 | |||
5624 | for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { | 5629 | for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { |
5625 | if (power_well->always_on) | 5630 | if (power_well->always_on) |
5626 | continue; | 5631 | continue; |
5627 | 5632 | ||
5628 | if (!power_well->count) { | 5633 | if (!power_well->hw_enabled) { |
5629 | is_enabled = false; | 5634 | is_enabled = false; |
5630 | break; | 5635 | break; |
5631 | } | 5636 | } |
5632 | } | 5637 | } |
5638 | |||
5633 | return is_enabled; | 5639 | return is_enabled; |
5634 | } | 5640 | } |
5635 | 5641 | ||
@@ -5637,30 +5643,15 @@ bool intel_display_power_enabled(struct drm_i915_private *dev_priv, | |||
5637 | enum intel_display_power_domain domain) | 5643 | enum intel_display_power_domain domain) |
5638 | { | 5644 | { |
5639 | struct i915_power_domains *power_domains; | 5645 | struct i915_power_domains *power_domains; |
5640 | struct i915_power_well *power_well; | 5646 | bool ret; |
5641 | bool is_enabled; | ||
5642 | int i; | ||
5643 | |||
5644 | if (dev_priv->pm.suspended) | ||
5645 | return false; | ||
5646 | 5647 | ||
5647 | power_domains = &dev_priv->power_domains; | 5648 | power_domains = &dev_priv->power_domains; |
5648 | 5649 | ||
5649 | is_enabled = true; | ||
5650 | |||
5651 | mutex_lock(&power_domains->lock); | 5650 | mutex_lock(&power_domains->lock); |
5652 | for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { | 5651 | ret = intel_display_power_enabled_unlocked(dev_priv, domain); |
5653 | if (power_well->always_on) | ||
5654 | continue; | ||
5655 | |||
5656 | if (!power_well->ops->is_enabled(dev_priv, power_well)) { | ||
5657 | is_enabled = false; | ||
5658 | break; | ||
5659 | } | ||
5660 | } | ||
5661 | mutex_unlock(&power_domains->lock); | 5652 | mutex_unlock(&power_domains->lock); |
5662 | 5653 | ||
5663 | return is_enabled; | 5654 | return ret; |
5664 | } | 5655 | } |
5665 | 5656 | ||
5666 | /* | 5657 | /* |
@@ -5981,6 +5972,7 @@ void intel_display_power_get(struct drm_i915_private *dev_priv, | |||
5981 | if (!power_well->count++) { | 5972 | if (!power_well->count++) { |
5982 | DRM_DEBUG_KMS("enabling %s\n", power_well->name); | 5973 | DRM_DEBUG_KMS("enabling %s\n", power_well->name); |
5983 | power_well->ops->enable(dev_priv, power_well); | 5974 | power_well->ops->enable(dev_priv, power_well); |
5975 | power_well->hw_enabled = true; | ||
5984 | } | 5976 | } |
5985 | 5977 | ||
5986 | check_power_well_state(dev_priv, power_well); | 5978 | check_power_well_state(dev_priv, power_well); |
@@ -6010,6 +6002,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, | |||
6010 | 6002 | ||
6011 | if (!--power_well->count && i915.disable_power_well) { | 6003 | if (!--power_well->count && i915.disable_power_well) { |
6012 | DRM_DEBUG_KMS("disabling %s\n", power_well->name); | 6004 | DRM_DEBUG_KMS("disabling %s\n", power_well->name); |
6005 | power_well->hw_enabled = false; | ||
6013 | power_well->ops->disable(dev_priv, power_well); | 6006 | power_well->ops->disable(dev_priv, power_well); |
6014 | } | 6007 | } |
6015 | 6008 | ||
@@ -6024,33 +6017,56 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, | |||
6024 | static struct i915_power_domains *hsw_pwr; | 6017 | static struct i915_power_domains *hsw_pwr; |
6025 | 6018 | ||
6026 | /* Display audio driver power well request */ | 6019 | /* Display audio driver power well request */ |
6027 | void i915_request_power_well(void) | 6020 | int i915_request_power_well(void) |
6028 | { | 6021 | { |
6029 | struct drm_i915_private *dev_priv; | 6022 | struct drm_i915_private *dev_priv; |
6030 | 6023 | ||
6031 | if (WARN_ON(!hsw_pwr)) | 6024 | if (!hsw_pwr) |
6032 | return; | 6025 | return -ENODEV; |
6033 | 6026 | ||
6034 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, | 6027 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, |
6035 | power_domains); | 6028 | power_domains); |
6036 | intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); | 6029 | intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); |
6030 | return 0; | ||
6037 | } | 6031 | } |
6038 | EXPORT_SYMBOL_GPL(i915_request_power_well); | 6032 | EXPORT_SYMBOL_GPL(i915_request_power_well); |
6039 | 6033 | ||
6040 | /* Display audio driver power well release */ | 6034 | /* Display audio driver power well release */ |
6041 | void i915_release_power_well(void) | 6035 | int i915_release_power_well(void) |
6042 | { | 6036 | { |
6043 | struct drm_i915_private *dev_priv; | 6037 | struct drm_i915_private *dev_priv; |
6044 | 6038 | ||
6045 | if (WARN_ON(!hsw_pwr)) | 6039 | if (!hsw_pwr) |
6046 | return; | 6040 | return -ENODEV; |
6047 | 6041 | ||
6048 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, | 6042 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, |
6049 | power_domains); | 6043 | power_domains); |
6050 | intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); | 6044 | intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); |
6045 | return 0; | ||
6051 | } | 6046 | } |
6052 | EXPORT_SYMBOL_GPL(i915_release_power_well); | 6047 | EXPORT_SYMBOL_GPL(i915_release_power_well); |
6053 | 6048 | ||
6049 | /* | ||
6050 | * Private interface for the audio driver to get CDCLK in kHz. | ||
6051 | * | ||
6052 | * Caller must request power well using i915_request_power_well() prior to | ||
6053 | * making the call. | ||
6054 | */ | ||
6055 | int i915_get_cdclk_freq(void) | ||
6056 | { | ||
6057 | struct drm_i915_private *dev_priv; | ||
6058 | |||
6059 | if (!hsw_pwr) | ||
6060 | return -ENODEV; | ||
6061 | |||
6062 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, | ||
6063 | power_domains); | ||
6064 | |||
6065 | return intel_ddi_get_cdclk_freq(dev_priv); | ||
6066 | } | ||
6067 | EXPORT_SYMBOL_GPL(i915_get_cdclk_freq); | ||
6068 | |||
6069 | |||
6054 | #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1) | 6070 | #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1) |
6055 | 6071 | ||
6056 | #define HSW_ALWAYS_ON_POWER_DOMAINS ( \ | 6072 | #define HSW_ALWAYS_ON_POWER_DOMAINS ( \ |
@@ -6270,8 +6286,11 @@ static void intel_power_domains_resume(struct drm_i915_private *dev_priv) | |||
6270 | int i; | 6286 | int i; |
6271 | 6287 | ||
6272 | mutex_lock(&power_domains->lock); | 6288 | mutex_lock(&power_domains->lock); |
6273 | for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) | 6289 | for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) { |
6274 | power_well->ops->sync_hw(dev_priv, power_well); | 6290 | power_well->ops->sync_hw(dev_priv, power_well); |
6291 | power_well->hw_enabled = power_well->ops->is_enabled(dev_priv, | ||
6292 | power_well); | ||
6293 | } | ||
6275 | mutex_unlock(&power_domains->lock); | 6294 | mutex_unlock(&power_domains->lock); |
6276 | } | 6295 | } |
6277 | 6296 | ||
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 910c83cf7d44..e72017bdcd7f 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -55,7 +55,7 @@ struct intel_ring_hangcheck { | |||
55 | u32 seqno; | 55 | u32 seqno; |
56 | int score; | 56 | int score; |
57 | enum intel_ring_hangcheck_action action; | 57 | enum intel_ring_hangcheck_action action; |
58 | bool deadlock; | 58 | int deadlock; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | struct intel_ringbuffer { | 61 | struct intel_ringbuffer { |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 6a4d5bc17697..20375cc7f82d 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -1385,7 +1385,9 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder, | |||
1385 | >> SDVO_PORT_MULTIPLY_SHIFT) + 1; | 1385 | >> SDVO_PORT_MULTIPLY_SHIFT) + 1; |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | dotclock = pipe_config->port_clock / pipe_config->pixel_multiplier; | 1388 | dotclock = pipe_config->port_clock; |
1389 | if (pipe_config->pixel_multiplier) | ||
1390 | dotclock /= pipe_config->pixel_multiplier; | ||
1389 | 1391 | ||
1390 | if (HAS_PCH_SPLIT(dev)) | 1392 | if (HAS_PCH_SPLIT(dev)) |
1391 | ironlake_check_encoder_dotclock(pipe_config, dotclock); | 1393 | ironlake_check_encoder_dotclock(pipe_config, dotclock); |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 1b66ddcdfb33..9a17b4e92ef4 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -691,6 +691,14 @@ intel_post_enable_primary(struct drm_crtc *crtc) | |||
691 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 691 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
692 | 692 | ||
693 | /* | 693 | /* |
694 | * BDW signals flip done immediately if the plane | ||
695 | * is disabled, even if the plane enable is already | ||
696 | * armed to occur at the next vblank :( | ||
697 | */ | ||
698 | if (IS_BROADWELL(dev)) | ||
699 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
700 | |||
701 | /* | ||
694 | * FIXME IPS should be fine as long as one plane is | 702 | * FIXME IPS should be fine as long as one plane is |
695 | * enabled, but in practice it seems to have problems | 703 | * enabled, but in practice it seems to have problems |
696 | * when going from primary only to sprite only and vice | 704 | * when going from primary only to sprite only and vice |
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index 79cba593df0d..4f6fef7ac069 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c | |||
@@ -320,7 +320,8 @@ static void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) | |||
320 | struct drm_i915_private *dev_priv = dev->dev_private; | 320 | struct drm_i915_private *dev_priv = dev->dev_private; |
321 | unsigned long irqflags; | 321 | unsigned long irqflags; |
322 | 322 | ||
323 | del_timer_sync(&dev_priv->uncore.force_wake_timer); | 323 | if (del_timer_sync(&dev_priv->uncore.force_wake_timer)) |
324 | gen6_force_wake_timer((unsigned long)dev_priv); | ||
324 | 325 | ||
325 | /* Hold uncore.lock across reset to prevent any register access | 326 | /* Hold uncore.lock across reset to prevent any register access |
326 | * with forcewake not set correctly | 327 | * with forcewake not set correctly |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index ae750f6928c1..7f7aadef8a82 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c | |||
@@ -277,6 +277,7 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) | |||
277 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; | 277 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; |
278 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; | 278 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; |
279 | static const char *hpd_clk_names[] = {"iface_clk", "core_clk", "mdp_core_clk"}; | 279 | static const char *hpd_clk_names[] = {"iface_clk", "core_clk", "mdp_core_clk"}; |
280 | static unsigned long hpd_clk_freq[] = {0, 19200000, 0}; | ||
280 | static const char *pwr_clk_names[] = {"extp_clk", "alt_iface_clk"}; | 281 | static const char *pwr_clk_names[] = {"extp_clk", "alt_iface_clk"}; |
281 | 282 | ||
282 | config.phy_init = hdmi_phy_8x74_init; | 283 | config.phy_init = hdmi_phy_8x74_init; |
@@ -286,6 +287,7 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) | |||
286 | config.pwr_reg_names = pwr_reg_names; | 287 | config.pwr_reg_names = pwr_reg_names; |
287 | config.pwr_reg_cnt = ARRAY_SIZE(pwr_reg_names); | 288 | config.pwr_reg_cnt = ARRAY_SIZE(pwr_reg_names); |
288 | config.hpd_clk_names = hpd_clk_names; | 289 | config.hpd_clk_names = hpd_clk_names; |
290 | config.hpd_freq = hpd_clk_freq; | ||
289 | config.hpd_clk_cnt = ARRAY_SIZE(hpd_clk_names); | 291 | config.hpd_clk_cnt = ARRAY_SIZE(hpd_clk_names); |
290 | config.pwr_clk_names = pwr_clk_names; | 292 | config.pwr_clk_names = pwr_clk_names; |
291 | config.pwr_clk_cnt = ARRAY_SIZE(pwr_clk_names); | 293 | config.pwr_clk_cnt = ARRAY_SIZE(pwr_clk_names); |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index 9fafee6a3e43..9d7723c6528a 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h | |||
@@ -87,6 +87,7 @@ struct hdmi_platform_config { | |||
87 | 87 | ||
88 | /* clks that need to be on for hpd: */ | 88 | /* clks that need to be on for hpd: */ |
89 | const char **hpd_clk_names; | 89 | const char **hpd_clk_names; |
90 | const long unsigned *hpd_freq; | ||
90 | int hpd_clk_cnt; | 91 | int hpd_clk_cnt; |
91 | 92 | ||
92 | /* clks that need to be on for screen pwr (ie pixel clk): */ | 93 | /* clks that need to be on for screen pwr (ie pixel clk): */ |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c index e56a6196867c..28f7e3ec6c28 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c | |||
@@ -127,6 +127,14 @@ static int hpd_enable(struct hdmi_connector *hdmi_connector) | |||
127 | } | 127 | } |
128 | 128 | ||
129 | for (i = 0; i < config->hpd_clk_cnt; i++) { | 129 | for (i = 0; i < config->hpd_clk_cnt; i++) { |
130 | if (config->hpd_freq && config->hpd_freq[i]) { | ||
131 | ret = clk_set_rate(hdmi->hpd_clks[i], | ||
132 | config->hpd_freq[i]); | ||
133 | if (ret) | ||
134 | dev_warn(dev->dev, "failed to set clk %s (%d)\n", | ||
135 | config->hpd_clk_names[i], ret); | ||
136 | } | ||
137 | |||
130 | ret = clk_prepare_enable(hdmi->hpd_clks[i]); | 138 | ret = clk_prepare_enable(hdmi->hpd_clks[i]); |
131 | if (ret) { | 139 | if (ret) { |
132 | dev_err(dev->dev, "failed to enable hpd clk: %s (%d)\n", | 140 | dev_err(dev->dev, "failed to enable hpd clk: %s (%d)\n", |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c index 42caf7fcb0b9..71510ee26e96 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | |||
@@ -20,6 +20,10 @@ | |||
20 | #include "msm_mmu.h" | 20 | #include "msm_mmu.h" |
21 | #include "mdp5_kms.h" | 21 | #include "mdp5_kms.h" |
22 | 22 | ||
23 | static const char *iommu_ports[] = { | ||
24 | "mdp_0", | ||
25 | }; | ||
26 | |||
23 | static struct mdp5_platform_config *mdp5_get_config(struct platform_device *dev); | 27 | static struct mdp5_platform_config *mdp5_get_config(struct platform_device *dev); |
24 | 28 | ||
25 | static int mdp5_hw_init(struct msm_kms *kms) | 29 | static int mdp5_hw_init(struct msm_kms *kms) |
@@ -104,6 +108,12 @@ static void mdp5_preclose(struct msm_kms *kms, struct drm_file *file) | |||
104 | static void mdp5_destroy(struct msm_kms *kms) | 108 | static void mdp5_destroy(struct msm_kms *kms) |
105 | { | 109 | { |
106 | struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); | 110 | struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); |
111 | struct msm_mmu *mmu = mdp5_kms->mmu; | ||
112 | |||
113 | if (mmu) { | ||
114 | mmu->funcs->detach(mmu, iommu_ports, ARRAY_SIZE(iommu_ports)); | ||
115 | mmu->funcs->destroy(mmu); | ||
116 | } | ||
107 | kfree(mdp5_kms); | 117 | kfree(mdp5_kms); |
108 | } | 118 | } |
109 | 119 | ||
@@ -216,10 +226,6 @@ fail: | |||
216 | return ret; | 226 | return ret; |
217 | } | 227 | } |
218 | 228 | ||
219 | static const char *iommu_ports[] = { | ||
220 | "mdp_0", | ||
221 | }; | ||
222 | |||
223 | static int get_clk(struct platform_device *pdev, struct clk **clkp, | 229 | static int get_clk(struct platform_device *pdev, struct clk **clkp, |
224 | const char *name) | 230 | const char *name) |
225 | { | 231 | { |
@@ -317,17 +323,23 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) | |||
317 | mmu = msm_iommu_new(dev, config->iommu); | 323 | mmu = msm_iommu_new(dev, config->iommu); |
318 | if (IS_ERR(mmu)) { | 324 | if (IS_ERR(mmu)) { |
319 | ret = PTR_ERR(mmu); | 325 | ret = PTR_ERR(mmu); |
326 | dev_err(dev->dev, "failed to init iommu: %d\n", ret); | ||
320 | goto fail; | 327 | goto fail; |
321 | } | 328 | } |
329 | |||
322 | ret = mmu->funcs->attach(mmu, iommu_ports, | 330 | ret = mmu->funcs->attach(mmu, iommu_ports, |
323 | ARRAY_SIZE(iommu_ports)); | 331 | ARRAY_SIZE(iommu_ports)); |
324 | if (ret) | 332 | if (ret) { |
333 | dev_err(dev->dev, "failed to attach iommu: %d\n", ret); | ||
334 | mmu->funcs->destroy(mmu); | ||
325 | goto fail; | 335 | goto fail; |
336 | } | ||
326 | } else { | 337 | } else { |
327 | dev_info(dev->dev, "no iommu, fallback to phys " | 338 | dev_info(dev->dev, "no iommu, fallback to phys " |
328 | "contig buffers for scanout\n"); | 339 | "contig buffers for scanout\n"); |
329 | mmu = NULL; | 340 | mmu = NULL; |
330 | } | 341 | } |
342 | mdp5_kms->mmu = mmu; | ||
331 | 343 | ||
332 | mdp5_kms->id = msm_register_mmu(dev, mmu); | 344 | mdp5_kms->id = msm_register_mmu(dev, mmu); |
333 | if (mdp5_kms->id < 0) { | 345 | if (mdp5_kms->id < 0) { |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h index c8b1a2522c25..6e981b692d1d 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | |||
@@ -33,6 +33,7 @@ struct mdp5_kms { | |||
33 | 33 | ||
34 | /* mapper-id used to request GEM buffer mapped for scanout: */ | 34 | /* mapper-id used to request GEM buffer mapped for scanout: */ |
35 | int id; | 35 | int id; |
36 | struct msm_mmu *mmu; | ||
36 | 37 | ||
37 | /* for tracking smp allocation amongst pipes: */ | 38 | /* for tracking smp allocation amongst pipes: */ |
38 | mdp5_smp_state_t smp_state; | 39 | mdp5_smp_state_t smp_state; |
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 0d2562fb681e..9a5d87db5c23 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
@@ -159,7 +159,7 @@ static int msm_unload(struct drm_device *dev) | |||
159 | static int get_mdp_ver(struct platform_device *pdev) | 159 | static int get_mdp_ver(struct platform_device *pdev) |
160 | { | 160 | { |
161 | #ifdef CONFIG_OF | 161 | #ifdef CONFIG_OF |
162 | const static struct of_device_id match_types[] = { { | 162 | static const struct of_device_id match_types[] = { { |
163 | .compatible = "qcom,mdss_mdp", | 163 | .compatible = "qcom,mdss_mdp", |
164 | .data = (void *)5, | 164 | .data = (void *)5, |
165 | }, { | 165 | }, { |
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index a752ab83b810..5107fc4826bc 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c | |||
@@ -59,7 +59,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, | |||
59 | struct drm_framebuffer *fb = NULL; | 59 | struct drm_framebuffer *fb = NULL; |
60 | struct fb_info *fbi = NULL; | 60 | struct fb_info *fbi = NULL; |
61 | struct drm_mode_fb_cmd2 mode_cmd = {0}; | 61 | struct drm_mode_fb_cmd2 mode_cmd = {0}; |
62 | dma_addr_t paddr; | 62 | uint32_t paddr; |
63 | int ret, size; | 63 | int ret, size; |
64 | 64 | ||
65 | sizes->surface_bpp = 32; | 65 | sizes->surface_bpp = 32; |
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index bb8026daebc9..690d7e7b6d1e 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c | |||
@@ -278,6 +278,7 @@ int msm_gem_get_iova_locked(struct drm_gem_object *obj, int id, | |||
278 | uint32_t *iova) | 278 | uint32_t *iova) |
279 | { | 279 | { |
280 | struct msm_gem_object *msm_obj = to_msm_bo(obj); | 280 | struct msm_gem_object *msm_obj = to_msm_bo(obj); |
281 | struct drm_device *dev = obj->dev; | ||
281 | int ret = 0; | 282 | int ret = 0; |
282 | 283 | ||
283 | if (!msm_obj->domain[id].iova) { | 284 | if (!msm_obj->domain[id].iova) { |
@@ -285,6 +286,11 @@ int msm_gem_get_iova_locked(struct drm_gem_object *obj, int id, | |||
285 | struct msm_mmu *mmu = priv->mmus[id]; | 286 | struct msm_mmu *mmu = priv->mmus[id]; |
286 | struct page **pages = get_pages(obj); | 287 | struct page **pages = get_pages(obj); |
287 | 288 | ||
289 | if (!mmu) { | ||
290 | dev_err(dev->dev, "null MMU pointer\n"); | ||
291 | return -EINVAL; | ||
292 | } | ||
293 | |||
288 | if (IS_ERR(pages)) | 294 | if (IS_ERR(pages)) |
289 | return PTR_ERR(pages); | 295 | return PTR_ERR(pages); |
290 | 296 | ||
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c index 92b745986231..4b2ad9181edf 100644 --- a/drivers/gpu/drm/msm/msm_iommu.c +++ b/drivers/gpu/drm/msm/msm_iommu.c | |||
@@ -28,7 +28,7 @@ static int msm_fault_handler(struct iommu_domain *iommu, struct device *dev, | |||
28 | unsigned long iova, int flags, void *arg) | 28 | unsigned long iova, int flags, void *arg) |
29 | { | 29 | { |
30 | DBG("*** fault: iova=%08lx, flags=%d", iova, flags); | 30 | DBG("*** fault: iova=%08lx, flags=%d", iova, flags); |
31 | return 0; | 31 | return -ENOSYS; |
32 | } | 32 | } |
33 | 33 | ||
34 | static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) | 34 | static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) |
@@ -40,8 +40,10 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) | |||
40 | for (i = 0; i < cnt; i++) { | 40 | for (i = 0; i < cnt; i++) { |
41 | struct device *msm_iommu_get_ctx(const char *ctx_name); | 41 | struct device *msm_iommu_get_ctx(const char *ctx_name); |
42 | struct device *ctx = msm_iommu_get_ctx(names[i]); | 42 | struct device *ctx = msm_iommu_get_ctx(names[i]); |
43 | if (IS_ERR_OR_NULL(ctx)) | 43 | if (IS_ERR_OR_NULL(ctx)) { |
44 | dev_warn(dev->dev, "couldn't get %s context", names[i]); | ||
44 | continue; | 45 | continue; |
46 | } | ||
45 | ret = iommu_attach_device(iommu->domain, ctx); | 47 | ret = iommu_attach_device(iommu->domain, ctx); |
46 | if (ret) { | 48 | if (ret) { |
47 | dev_warn(dev->dev, "could not attach iommu to %s", names[i]); | 49 | dev_warn(dev->dev, "could not attach iommu to %s", names[i]); |
@@ -52,6 +54,20 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) | |||
52 | return 0; | 54 | return 0; |
53 | } | 55 | } |
54 | 56 | ||
57 | static void msm_iommu_detach(struct msm_mmu *mmu, const char **names, int cnt) | ||
58 | { | ||
59 | struct msm_iommu *iommu = to_msm_iommu(mmu); | ||
60 | int i; | ||
61 | |||
62 | for (i = 0; i < cnt; i++) { | ||
63 | struct device *msm_iommu_get_ctx(const char *ctx_name); | ||
64 | struct device *ctx = msm_iommu_get_ctx(names[i]); | ||
65 | if (IS_ERR_OR_NULL(ctx)) | ||
66 | continue; | ||
67 | iommu_detach_device(iommu->domain, ctx); | ||
68 | } | ||
69 | } | ||
70 | |||
55 | static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova, | 71 | static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova, |
56 | struct sg_table *sgt, unsigned len, int prot) | 72 | struct sg_table *sgt, unsigned len, int prot) |
57 | { | 73 | { |
@@ -110,7 +126,7 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova, | |||
110 | 126 | ||
111 | VERB("unmap[%d]: %08x(%x)", i, iova, bytes); | 127 | VERB("unmap[%d]: %08x(%x)", i, iova, bytes); |
112 | 128 | ||
113 | BUG_ON(!IS_ALIGNED(bytes, PAGE_SIZE)); | 129 | BUG_ON(!PAGE_ALIGNED(bytes)); |
114 | 130 | ||
115 | da += bytes; | 131 | da += bytes; |
116 | } | 132 | } |
@@ -127,6 +143,7 @@ static void msm_iommu_destroy(struct msm_mmu *mmu) | |||
127 | 143 | ||
128 | static const struct msm_mmu_funcs funcs = { | 144 | static const struct msm_mmu_funcs funcs = { |
129 | .attach = msm_iommu_attach, | 145 | .attach = msm_iommu_attach, |
146 | .detach = msm_iommu_detach, | ||
130 | .map = msm_iommu_map, | 147 | .map = msm_iommu_map, |
131 | .unmap = msm_iommu_unmap, | 148 | .unmap = msm_iommu_unmap, |
132 | .destroy = msm_iommu_destroy, | 149 | .destroy = msm_iommu_destroy, |
diff --git a/drivers/gpu/drm/msm/msm_mmu.h b/drivers/gpu/drm/msm/msm_mmu.h index 030324482b4a..21da6d154f71 100644 --- a/drivers/gpu/drm/msm/msm_mmu.h +++ b/drivers/gpu/drm/msm/msm_mmu.h | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | struct msm_mmu_funcs { | 23 | struct msm_mmu_funcs { |
24 | int (*attach)(struct msm_mmu *mmu, const char **names, int cnt); | 24 | int (*attach)(struct msm_mmu *mmu, const char **names, int cnt); |
25 | void (*detach)(struct msm_mmu *mmu, const char **names, int cnt); | ||
25 | int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, | 26 | int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, |
26 | unsigned len, int prot); | 27 | unsigned len, int prot); |
27 | int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, | 28 | int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, |
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index 2b6156d0e4b5..8b307e143632 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile | |||
@@ -140,6 +140,7 @@ nouveau-y += core/subdev/i2c/nv4e.o | |||
140 | nouveau-y += core/subdev/i2c/nv50.o | 140 | nouveau-y += core/subdev/i2c/nv50.o |
141 | nouveau-y += core/subdev/i2c/nv94.o | 141 | nouveau-y += core/subdev/i2c/nv94.o |
142 | nouveau-y += core/subdev/i2c/nvd0.o | 142 | nouveau-y += core/subdev/i2c/nvd0.o |
143 | nouveau-y += core/subdev/i2c/gf117.o | ||
143 | nouveau-y += core/subdev/i2c/nve0.o | 144 | nouveau-y += core/subdev/i2c/nve0.o |
144 | nouveau-y += core/subdev/ibus/nvc0.o | 145 | nouveau-y += core/subdev/ibus/nvc0.o |
145 | nouveau-y += core/subdev/ibus/nve0.o | 146 | nouveau-y += core/subdev/ibus/nve0.o |
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c index f199957995fa..8d55ed633b19 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c | |||
@@ -314,7 +314,7 @@ nvc0_identify(struct nouveau_device *device) | |||
314 | device->cname = "GF117"; | 314 | device->cname = "GF117"; |
315 | device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; | 315 | device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; |
316 | device->oclass[NVDEV_SUBDEV_GPIO ] = nvd0_gpio_oclass; | 316 | device->oclass[NVDEV_SUBDEV_GPIO ] = nvd0_gpio_oclass; |
317 | device->oclass[NVDEV_SUBDEV_I2C ] = nvd0_i2c_oclass; | 317 | device->oclass[NVDEV_SUBDEV_I2C ] = gf117_i2c_oclass; |
318 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; | 318 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; |
319 | device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; | 319 | device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; |
320 | device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; | 320 | device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/base.c b/drivers/gpu/drm/nouveau/core/engine/disp/base.c index c41f656abe64..9c38c5e40500 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/base.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/base.c | |||
@@ -99,8 +99,10 @@ _nouveau_disp_dtor(struct nouveau_object *object) | |||
99 | 99 | ||
100 | nouveau_event_destroy(&disp->vblank); | 100 | nouveau_event_destroy(&disp->vblank); |
101 | 101 | ||
102 | list_for_each_entry_safe(outp, outt, &disp->outp, head) { | 102 | if (disp->outp.next) { |
103 | nouveau_object_ref(NULL, (struct nouveau_object **)&outp); | 103 | list_for_each_entry_safe(outp, outt, &disp->outp, head) { |
104 | nouveau_object_ref(NULL, (struct nouveau_object **)&outp); | ||
105 | } | ||
104 | } | 106 | } |
105 | 107 | ||
106 | nouveau_engine_destroy(&disp->base); | 108 | nouveau_engine_destroy(&disp->base); |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c index 39562d48101d..5a5b59b21130 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c | |||
@@ -241,7 +241,9 @@ dp_link_train_eq(struct dp_state *dp) | |||
241 | dp_set_training_pattern(dp, 2); | 241 | dp_set_training_pattern(dp, 2); |
242 | 242 | ||
243 | do { | 243 | do { |
244 | if (dp_link_train_update(dp, dp->pc2, 400)) | 244 | if ((tries && |
245 | dp_link_train_commit(dp, dp->pc2)) || | ||
246 | dp_link_train_update(dp, dp->pc2, 400)) | ||
245 | break; | 247 | break; |
246 | 248 | ||
247 | eq_done = !!(dp->stat[2] & DPCD_LS04_INTERLANE_ALIGN_DONE); | 249 | eq_done = !!(dp->stat[2] & DPCD_LS04_INTERLANE_ALIGN_DONE); |
@@ -253,9 +255,6 @@ dp_link_train_eq(struct dp_state *dp) | |||
253 | !(lane & DPCD_LS02_LANE0_SYMBOL_LOCKED)) | 255 | !(lane & DPCD_LS02_LANE0_SYMBOL_LOCKED)) |
254 | eq_done = false; | 256 | eq_done = false; |
255 | } | 257 | } |
256 | |||
257 | if (dp_link_train_commit(dp, dp->pc2)) | ||
258 | break; | ||
259 | } while (!eq_done && cr_done && ++tries <= 5); | 258 | } while (!eq_done && cr_done && ++tries <= 5); |
260 | 259 | ||
261 | return eq_done ? 0 : -1; | 260 | return eq_done ? 0 : -1; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c index 1e85f36c705f..2283c442a10d 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | |||
@@ -1270,7 +1270,7 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, u32 pclk, u32 *conf) | |||
1270 | i--; | 1270 | i--; |
1271 | 1271 | ||
1272 | outp = exec_lookup(priv, head, i, ctrl, &data, &ver, &hdr, &cnt, &len, &info1); | 1272 | outp = exec_lookup(priv, head, i, ctrl, &data, &ver, &hdr, &cnt, &len, &info1); |
1273 | if (!data) | 1273 | if (!outp) |
1274 | return NULL; | 1274 | return NULL; |
1275 | 1275 | ||
1276 | if (outp->info.location == 0) { | 1276 | if (outp->info.location == 0) { |
@@ -1516,11 +1516,11 @@ nv50_disp_intr_unk20_2(struct nv50_disp_priv *priv, int head) | |||
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | switch ((ctrl & 0x000f0000) >> 16) { | 1518 | switch ((ctrl & 0x000f0000) >> 16) { |
1519 | case 6: datarate = pclk * 30 / 8; break; | 1519 | case 6: datarate = pclk * 30; break; |
1520 | case 5: datarate = pclk * 24 / 8; break; | 1520 | case 5: datarate = pclk * 24; break; |
1521 | case 2: | 1521 | case 2: |
1522 | default: | 1522 | default: |
1523 | datarate = pclk * 18 / 8; | 1523 | datarate = pclk * 18; |
1524 | break; | 1524 | break; |
1525 | } | 1525 | } |
1526 | 1526 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c index 48aa38a87e3f..fa30d8196f35 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c | |||
@@ -1159,11 +1159,11 @@ nvd0_disp_intr_unk2_2(struct nv50_disp_priv *priv, int head) | |||
1159 | if (outp->info.type == DCB_OUTPUT_DP) { | 1159 | if (outp->info.type == DCB_OUTPUT_DP) { |
1160 | u32 sync = nv_rd32(priv, 0x660404 + (head * 0x300)); | 1160 | u32 sync = nv_rd32(priv, 0x660404 + (head * 0x300)); |
1161 | switch ((sync & 0x000003c0) >> 6) { | 1161 | switch ((sync & 0x000003c0) >> 6) { |
1162 | case 6: pclk = pclk * 30 / 8; break; | 1162 | case 6: pclk = pclk * 30; break; |
1163 | case 5: pclk = pclk * 24 / 8; break; | 1163 | case 5: pclk = pclk * 24; break; |
1164 | case 2: | 1164 | case 2: |
1165 | default: | 1165 | default: |
1166 | pclk = pclk * 18 / 8; | 1166 | pclk = pclk * 18; |
1167 | break; | 1167 | break; |
1168 | } | 1168 | } |
1169 | 1169 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c b/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c index 52c299c3d300..eb2d7789555d 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c | |||
@@ -34,7 +34,7 @@ nvkm_output_dp_train(struct nvkm_output *base, u32 datarate, bool wait) | |||
34 | struct nvkm_output_dp *outp = (void *)base; | 34 | struct nvkm_output_dp *outp = (void *)base; |
35 | bool retrain = true; | 35 | bool retrain = true; |
36 | u8 link[2], stat[3]; | 36 | u8 link[2], stat[3]; |
37 | u32 rate; | 37 | u32 linkrate; |
38 | int ret, i; | 38 | int ret, i; |
39 | 39 | ||
40 | /* check that the link is trained at a high enough rate */ | 40 | /* check that the link is trained at a high enough rate */ |
@@ -44,8 +44,10 @@ nvkm_output_dp_train(struct nvkm_output *base, u32 datarate, bool wait) | |||
44 | goto done; | 44 | goto done; |
45 | } | 45 | } |
46 | 46 | ||
47 | rate = link[0] * 27000 * (link[1] & DPCD_LC01_LANE_COUNT_SET); | 47 | linkrate = link[0] * 27000 * (link[1] & DPCD_LC01_LANE_COUNT_SET); |
48 | if (rate < ((datarate / 8) * 10)) { | 48 | linkrate = (linkrate * 8) / 10; /* 8B/10B coding overhead */ |
49 | datarate = (datarate + 9) / 10; /* -> decakilobits */ | ||
50 | if (linkrate < datarate) { | ||
49 | DBG("link not trained at sufficient rate\n"); | 51 | DBG("link not trained at sufficient rate\n"); |
50 | goto done; | 52 | goto done; |
51 | } | 53 | } |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c index e1832778e8b6..7a1ebdfa9e1b 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c | |||
@@ -87,6 +87,7 @@ nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size) | |||
87 | struct nvkm_output_dp *outpdp = (void *)outp; | 87 | struct nvkm_output_dp *outpdp = (void *)outp; |
88 | switch (data) { | 88 | switch (data) { |
89 | case NV94_DISP_SOR_DP_PWR_STATE_OFF: | 89 | case NV94_DISP_SOR_DP_PWR_STATE_OFF: |
90 | nouveau_event_put(outpdp->irq); | ||
90 | ((struct nvkm_output_dp_impl *)nv_oclass(outp)) | 91 | ((struct nvkm_output_dp_impl *)nv_oclass(outp)) |
91 | ->lnk_pwr(outpdp, 0); | 92 | ->lnk_pwr(outpdp, 0); |
92 | atomic_set(&outpdp->lt.done, 0); | 93 | atomic_set(&outpdp->lt.done, 0); |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc index 2f7345f7fe07..7445f12b1d9e 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc | |||
@@ -54,7 +54,7 @@ mmio_list_base: | |||
54 | #ifdef INCLUDE_CODE | 54 | #ifdef INCLUDE_CODE |
55 | // reports an exception to the host | 55 | // reports an exception to the host |
56 | // | 56 | // |
57 | // In: $r15 error code (see nvc0.fuc) | 57 | // In: $r15 error code (see os.h) |
58 | // | 58 | // |
59 | error: | 59 | error: |
60 | push $r14 | 60 | push $r14 |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc index c8ddb8d71b91..b4ad18bf5a26 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc | |||
@@ -49,7 +49,7 @@ hub_mmio_list_next: | |||
49 | #ifdef INCLUDE_CODE | 49 | #ifdef INCLUDE_CODE |
50 | // reports an exception to the host | 50 | // reports an exception to the host |
51 | // | 51 | // |
52 | // In: $r15 error code (see nvc0.fuc) | 52 | // In: $r15 error code (see os.h) |
53 | // | 53 | // |
54 | error: | 54 | error: |
55 | nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(5), 0, $r15) | 55 | nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(5), 0, $r15) |
@@ -343,13 +343,25 @@ ih: | |||
343 | ih_no_ctxsw: | 343 | ih_no_ctxsw: |
344 | and $r11 $r10 NV_PGRAPH_FECS_INTR_FWMTHD | 344 | and $r11 $r10 NV_PGRAPH_FECS_INTR_FWMTHD |
345 | bra e #ih_no_fwmthd | 345 | bra e #ih_no_fwmthd |
346 | // none we handle, ack, and fall-through to unhandled | 346 | // none we handle; report to host and ack |
347 | nv_rd32($r15, NV_PGRAPH_TRAPPED_DATA_LO) | ||
348 | nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(4), 0, $r15) | ||
349 | nv_rd32($r15, NV_PGRAPH_TRAPPED_ADDR) | ||
350 | nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(3), 0, $r15) | ||
351 | extr $r14 $r15 16:18 | ||
352 | shl b32 $r14 $r14 2 | ||
353 | imm32($r15, NV_PGRAPH_FE_OBJECT_TABLE(0)) | ||
354 | add b32 $r14 $r15 | ||
355 | call(nv_rd32) | ||
356 | nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(2), 0, $r15) | ||
357 | mov $r15 E_BAD_FWMTHD | ||
358 | call(error) | ||
347 | mov $r11 0x100 | 359 | mov $r11 0x100 |
348 | nv_wr32(0x400144, $r11) | 360 | nv_wr32(0x400144, $r11) |
349 | 361 | ||
350 | // anything we didn't handle, bring it to the host's attention | 362 | // anything we didn't handle, bring it to the host's attention |
351 | ih_no_fwmthd: | 363 | ih_no_fwmthd: |
352 | mov $r11 0x104 // FIFO | CHSW | 364 | mov $r11 0x504 // FIFO | CHSW | FWMTHD |
353 | not b32 $r11 | 365 | not b32 $r11 |
354 | and $r11 $r10 $r11 | 366 | and $r11 $r10 $r11 |
355 | bra e #ih_no_other | 367 | bra e #ih_no_other |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubgm107.fuc5.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubgm107.fuc5.h index 214dd16ec566..5f953c5c20b7 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubgm107.fuc5.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubgm107.fuc5.h | |||
@@ -478,10 +478,10 @@ uint32_t gm107_grhub_code[] = { | |||
478 | 0x01040080, | 478 | 0x01040080, |
479 | 0xbd0001f6, | 479 | 0xbd0001f6, |
480 | 0x01004104, | 480 | 0x01004104, |
481 | 0x627e020f, | 481 | 0xa87e020f, |
482 | 0x717e0006, | 482 | 0xb77e0006, |
483 | 0x100f0006, | 483 | 0x100f0006, |
484 | 0x0006b37e, | 484 | 0x0006f97e, |
485 | 0x98000e98, | 485 | 0x98000e98, |
486 | 0x207e010f, | 486 | 0x207e010f, |
487 | 0x14950001, | 487 | 0x14950001, |
@@ -523,8 +523,8 @@ uint32_t gm107_grhub_code[] = { | |||
523 | 0x800040b7, | 523 | 0x800040b7, |
524 | 0xf40132b6, | 524 | 0xf40132b6, |
525 | 0x000fb41b, | 525 | 0x000fb41b, |
526 | 0x0006b37e, | 526 | 0x0006f97e, |
527 | 0x627e000f, | 527 | 0xa87e000f, |
528 | 0x00800006, | 528 | 0x00800006, |
529 | 0x01f60201, | 529 | 0x01f60201, |
530 | 0xbd04bd00, | 530 | 0xbd04bd00, |
@@ -554,7 +554,7 @@ uint32_t gm107_grhub_code[] = { | |||
554 | 0x0009f602, | 554 | 0x0009f602, |
555 | 0x32f404bd, | 555 | 0x32f404bd, |
556 | 0x0231f401, | 556 | 0x0231f401, |
557 | 0x0008367e, | 557 | 0x00087c7e, |
558 | 0x99f094bd, | 558 | 0x99f094bd, |
559 | 0x17008007, | 559 | 0x17008007, |
560 | 0x0009f602, | 560 | 0x0009f602, |
@@ -563,7 +563,7 @@ uint32_t gm107_grhub_code[] = { | |||
563 | 0x37008006, | 563 | 0x37008006, |
564 | 0x0009f602, | 564 | 0x0009f602, |
565 | 0x31f404bd, | 565 | 0x31f404bd, |
566 | 0x08367e01, | 566 | 0x087c7e01, |
567 | 0xf094bd00, | 567 | 0xf094bd00, |
568 | 0x00800699, | 568 | 0x00800699, |
569 | 0x09f60217, | 569 | 0x09f60217, |
@@ -572,7 +572,7 @@ uint32_t gm107_grhub_code[] = { | |||
572 | 0x20f92f0e, | 572 | 0x20f92f0e, |
573 | 0x32f412b2, | 573 | 0x32f412b2, |
574 | 0x0232f401, | 574 | 0x0232f401, |
575 | 0x0008367e, | 575 | 0x00087c7e, |
576 | 0x008020fc, | 576 | 0x008020fc, |
577 | 0x02f602c0, | 577 | 0x02f602c0, |
578 | 0xf404bd00, | 578 | 0xf404bd00, |
@@ -580,7 +580,7 @@ uint32_t gm107_grhub_code[] = { | |||
580 | 0x23c8130e, | 580 | 0x23c8130e, |
581 | 0x0d0bf41f, | 581 | 0x0d0bf41f, |
582 | 0xf40131f4, | 582 | 0xf40131f4, |
583 | 0x367e0232, | 583 | 0x7c7e0232, |
584 | /* 0x054e: chsw_done */ | 584 | /* 0x054e: chsw_done */ |
585 | 0x01020008, | 585 | 0x01020008, |
586 | 0x02c30080, | 586 | 0x02c30080, |
@@ -593,7 +593,7 @@ uint32_t gm107_grhub_code[] = { | |||
593 | 0xb0ff2a0e, | 593 | 0xb0ff2a0e, |
594 | 0x1bf401e4, | 594 | 0x1bf401e4, |
595 | 0x7ef2b20c, | 595 | 0x7ef2b20c, |
596 | 0xf40007d6, | 596 | 0xf400081c, |
597 | /* 0x057a: main_not_ctx_chan */ | 597 | /* 0x057a: main_not_ctx_chan */ |
598 | 0xe4b0400e, | 598 | 0xe4b0400e, |
599 | 0x2c1bf402, | 599 | 0x2c1bf402, |
@@ -602,7 +602,7 @@ uint32_t gm107_grhub_code[] = { | |||
602 | 0x0009f602, | 602 | 0x0009f602, |
603 | 0x32f404bd, | 603 | 0x32f404bd, |
604 | 0x0232f401, | 604 | 0x0232f401, |
605 | 0x0008367e, | 605 | 0x00087c7e, |
606 | 0x99f094bd, | 606 | 0x99f094bd, |
607 | 0x17008007, | 607 | 0x17008007, |
608 | 0x0009f602, | 608 | 0x0009f602, |
@@ -642,238 +642,238 @@ uint32_t gm107_grhub_code[] = { | |||
642 | /* 0x061a: ih_no_ctxsw */ | 642 | /* 0x061a: ih_no_ctxsw */ |
643 | 0xabe40000, | 643 | 0xabe40000, |
644 | 0x0bf40400, | 644 | 0x0bf40400, |
645 | 0x01004b10, | 645 | 0x07088e56, |
646 | 0x448ebfb2, | ||
647 | 0x8f7e4001, | ||
648 | /* 0x062e: ih_no_fwmthd */ | ||
649 | 0x044b0000, | ||
650 | 0xffb0bd01, | ||
651 | 0x0bf4b4ab, | ||
652 | 0x0700800c, | ||
653 | 0x000bf603, | ||
654 | /* 0x0642: ih_no_other */ | ||
655 | 0x004004bd, | ||
656 | 0x000af601, | ||
657 | 0xf0fc04bd, | ||
658 | 0xd0fce0fc, | ||
659 | 0xa0fcb0fc, | ||
660 | 0x80fc90fc, | ||
661 | 0xfc0088fe, | ||
662 | 0x0032f480, | ||
663 | /* 0x0662: ctx_4170s */ | ||
664 | 0xf5f001f8, | ||
665 | 0x8effb210, | ||
666 | 0x7e404170, | ||
667 | 0xf800008f, | ||
668 | /* 0x0671: ctx_4170w */ | ||
669 | 0x41708e00, | ||
670 | 0x00657e40, | 646 | 0x00657e40, |
671 | 0xf0ffb200, | 647 | 0x80ffb200, |
672 | 0x1bf410f4, | 648 | 0xf6020400, |
673 | /* 0x0683: ctx_redswitch */ | ||
674 | 0x4e00f8f3, | ||
675 | 0xe5f00200, | ||
676 | 0x20e5f040, | ||
677 | 0x8010e5f0, | ||
678 | 0xf6018500, | ||
679 | 0x04bd000e, | ||
680 | /* 0x069a: ctx_redswitch_delay */ | ||
681 | 0xf2b6080f, | ||
682 | 0xfd1bf401, | ||
683 | 0x0400e5f1, | ||
684 | 0x0100e5f1, | ||
685 | 0x01850080, | ||
686 | 0xbd000ef6, | ||
687 | /* 0x06b3: ctx_86c */ | ||
688 | 0x8000f804, | ||
689 | 0xf6022300, | ||
690 | 0x04bd000f, | 649 | 0x04bd000f, |
691 | 0x148effb2, | 650 | 0x4007048e, |
692 | 0x8f7e408a, | 651 | 0x0000657e, |
693 | 0xffb20000, | 652 | 0x0080ffb2, |
694 | 0x41a88c8e, | 653 | 0x0ff60203, |
654 | 0xc704bd00, | ||
655 | 0xee9450fe, | ||
656 | 0x07008f02, | ||
657 | 0x00efbb40, | ||
658 | 0x0000657e, | ||
659 | 0x02020080, | ||
660 | 0xbd000ff6, | ||
661 | 0x7e030f04, | ||
662 | 0x4b0002f8, | ||
663 | 0xbfb20100, | ||
664 | 0x4001448e, | ||
695 | 0x00008f7e, | 665 | 0x00008f7e, |
696 | /* 0x06d2: ctx_mem */ | 666 | /* 0x0674: ih_no_fwmthd */ |
697 | 0x008000f8, | 667 | 0xbd05044b, |
698 | 0x0ff60284, | 668 | 0xb4abffb0, |
699 | /* 0x06db: ctx_mem_wait */ | 669 | 0x800c0bf4, |
700 | 0x8f04bd00, | 670 | 0xf6030700, |
701 | 0xcf028400, | 671 | 0x04bd000b, |
702 | 0xfffd00ff, | 672 | /* 0x0688: ih_no_other */ |
703 | 0xf61bf405, | 673 | 0xf6010040, |
704 | /* 0x06ea: ctx_load */ | 674 | 0x04bd000a, |
705 | 0x94bd00f8, | 675 | 0xe0fcf0fc, |
706 | 0x800599f0, | 676 | 0xb0fcd0fc, |
707 | 0xf6023700, | 677 | 0x90fca0fc, |
708 | 0x04bd0009, | 678 | 0x88fe80fc, |
709 | 0xb87e0c0a, | 679 | 0xf480fc00, |
710 | 0xf4bd0000, | 680 | 0x01f80032, |
711 | 0x02890080, | 681 | /* 0x06a8: ctx_4170s */ |
682 | 0xb210f5f0, | ||
683 | 0x41708eff, | ||
684 | 0x008f7e40, | ||
685 | /* 0x06b7: ctx_4170w */ | ||
686 | 0x8e00f800, | ||
687 | 0x7e404170, | ||
688 | 0xb2000065, | ||
689 | 0x10f4f0ff, | ||
690 | 0xf8f31bf4, | ||
691 | /* 0x06c9: ctx_redswitch */ | ||
692 | 0x02004e00, | ||
693 | 0xf040e5f0, | ||
694 | 0xe5f020e5, | ||
695 | 0x85008010, | ||
696 | 0x000ef601, | ||
697 | 0x080f04bd, | ||
698 | /* 0x06e0: ctx_redswitch_delay */ | ||
699 | 0xf401f2b6, | ||
700 | 0xe5f1fd1b, | ||
701 | 0xe5f10400, | ||
702 | 0x00800100, | ||
703 | 0x0ef60185, | ||
704 | 0xf804bd00, | ||
705 | /* 0x06f9: ctx_86c */ | ||
706 | 0x23008000, | ||
707 | 0x000ff602, | ||
708 | 0xffb204bd, | ||
709 | 0x408a148e, | ||
710 | 0x00008f7e, | ||
711 | 0x8c8effb2, | ||
712 | 0x8f7e41a8, | ||
713 | 0x00f80000, | ||
714 | /* 0x0718: ctx_mem */ | ||
715 | 0x02840080, | ||
712 | 0xbd000ff6, | 716 | 0xbd000ff6, |
713 | 0xc1008004, | 717 | /* 0x0721: ctx_mem_wait */ |
714 | 0x0002f602, | 718 | 0x84008f04, |
715 | 0x008004bd, | 719 | 0x00ffcf02, |
716 | 0x02f60283, | 720 | 0xf405fffd, |
717 | 0x0f04bd00, | 721 | 0x00f8f61b, |
718 | 0x06d27e07, | 722 | /* 0x0730: ctx_load */ |
719 | 0xc0008000, | 723 | 0x99f094bd, |
720 | 0x0002f602, | 724 | 0x37008005, |
721 | 0x0bfe04bd, | 725 | 0x0009f602, |
722 | 0x1f2af000, | 726 | 0x0c0a04bd, |
723 | 0xb60424b6, | 727 | 0x0000b87e, |
724 | 0x94bd0220, | 728 | 0x0080f4bd, |
725 | 0x800899f0, | 729 | 0x0ff60289, |
726 | 0xf6023700, | 730 | 0x8004bd00, |
727 | 0x04bd0009, | 731 | 0xf602c100, |
728 | 0x02810080, | 732 | 0x04bd0002, |
729 | 0xbd0002f6, | 733 | 0x02830080, |
730 | 0x0000d204, | ||
731 | 0x25f08000, | ||
732 | 0x88008002, | ||
733 | 0x0002f602, | ||
734 | 0x100104bd, | ||
735 | 0xf0020042, | ||
736 | 0x12fa0223, | ||
737 | 0xbd03f805, | ||
738 | 0x0899f094, | ||
739 | 0x02170080, | ||
740 | 0xbd0009f6, | ||
741 | 0x81019804, | ||
742 | 0x981814b6, | ||
743 | 0x25b68002, | ||
744 | 0x0512fd08, | ||
745 | 0xbd1601b5, | ||
746 | 0x0999f094, | ||
747 | 0x02370080, | ||
748 | 0xbd0009f6, | ||
749 | 0x81008004, | ||
750 | 0x0001f602, | ||
751 | 0x010204bd, | ||
752 | 0x02880080, | ||
753 | 0xbd0002f6, | 734 | 0xbd0002f6, |
754 | 0x01004104, | 735 | 0x7e070f04, |
755 | 0xfa0613f0, | 736 | 0x80000718, |
756 | 0x03f80501, | 737 | 0xf602c000, |
738 | 0x04bd0002, | ||
739 | 0xf0000bfe, | ||
740 | 0x24b61f2a, | ||
741 | 0x0220b604, | ||
757 | 0x99f094bd, | 742 | 0x99f094bd, |
758 | 0x17008009, | 743 | 0x37008008, |
759 | 0x0009f602, | 744 | 0x0009f602, |
760 | 0x94bd04bd, | 745 | 0x008004bd, |
761 | 0x800599f0, | 746 | 0x02f60281, |
747 | 0xd204bd00, | ||
748 | 0x80000000, | ||
749 | 0x800225f0, | ||
750 | 0xf6028800, | ||
751 | 0x04bd0002, | ||
752 | 0x00421001, | ||
753 | 0x0223f002, | ||
754 | 0xf80512fa, | ||
755 | 0xf094bd03, | ||
756 | 0x00800899, | ||
757 | 0x09f60217, | ||
758 | 0x9804bd00, | ||
759 | 0x14b68101, | ||
760 | 0x80029818, | ||
761 | 0xfd0825b6, | ||
762 | 0x01b50512, | ||
763 | 0xf094bd16, | ||
764 | 0x00800999, | ||
765 | 0x09f60237, | ||
766 | 0x8004bd00, | ||
767 | 0xf6028100, | ||
768 | 0x04bd0001, | ||
769 | 0x00800102, | ||
770 | 0x02f60288, | ||
771 | 0x4104bd00, | ||
772 | 0x13f00100, | ||
773 | 0x0501fa06, | ||
774 | 0x94bd03f8, | ||
775 | 0x800999f0, | ||
762 | 0xf6021700, | 776 | 0xf6021700, |
763 | 0x04bd0009, | 777 | 0x04bd0009, |
764 | /* 0x07d6: ctx_chan */ | 778 | 0x99f094bd, |
765 | 0xea7e00f8, | 779 | 0x17008005, |
766 | 0x0c0a0006, | 780 | 0x0009f602, |
767 | 0x0000b87e, | 781 | 0x00f804bd, |
768 | 0xd27e050f, | 782 | /* 0x081c: ctx_chan */ |
769 | 0x00f80006, | 783 | 0x0007307e, |
770 | /* 0x07e8: ctx_mmio_exec */ | 784 | 0xb87e0c0a, |
771 | 0x80410398, | 785 | 0x050f0000, |
786 | 0x0007187e, | ||
787 | /* 0x082e: ctx_mmio_exec */ | ||
788 | 0x039800f8, | ||
789 | 0x81008041, | ||
790 | 0x0003f602, | ||
791 | 0x34bd04bd, | ||
792 | /* 0x083c: ctx_mmio_loop */ | ||
793 | 0xf4ff34c4, | ||
794 | 0x00450e1b, | ||
795 | 0x0653f002, | ||
796 | 0xf80535fa, | ||
797 | /* 0x084d: ctx_mmio_pull */ | ||
798 | 0x804e9803, | ||
799 | 0x7e814f98, | ||
800 | 0xb600008f, | ||
801 | 0x12b60830, | ||
802 | 0xdf1bf401, | ||
803 | /* 0x0860: ctx_mmio_done */ | ||
804 | 0x80160398, | ||
772 | 0xf6028100, | 805 | 0xf6028100, |
773 | 0x04bd0003, | 806 | 0x04bd0003, |
774 | /* 0x07f6: ctx_mmio_loop */ | 807 | 0x414000b5, |
775 | 0x34c434bd, | 808 | 0x13f00100, |
776 | 0x0e1bf4ff, | 809 | 0x0601fa06, |
777 | 0xf0020045, | 810 | 0x00f803f8, |
778 | 0x35fa0653, | 811 | /* 0x087c: ctx_xfer */ |
779 | /* 0x0807: ctx_mmio_pull */ | 812 | 0x0080040e, |
780 | 0x9803f805, | 813 | 0x0ef60302, |
781 | 0x4f98804e, | 814 | /* 0x0887: ctx_xfer_idle */ |
782 | 0x008f7e81, | 815 | 0x8e04bd00, |
783 | 0x0830b600, | 816 | 0xcf030000, |
784 | 0xf40112b6, | 817 | 0xe4f100ee, |
785 | /* 0x081a: ctx_mmio_done */ | 818 | 0x1bf42000, |
786 | 0x0398df1b, | 819 | 0x0611f4f5, |
787 | 0x81008016, | 820 | /* 0x089b: ctx_xfer_pre */ |
788 | 0x0003f602, | 821 | 0x0f0c02f4, |
789 | 0x00b504bd, | 822 | 0x06f97e10, |
790 | 0x01004140, | 823 | 0x1b11f400, |
791 | 0xfa0613f0, | 824 | /* 0x08a4: ctx_xfer_pre_load */ |
792 | 0x03f80601, | 825 | 0xa87e020f, |
793 | /* 0x0836: ctx_xfer */ | 826 | 0xb77e0006, |
794 | 0x040e00f8, | 827 | 0xc97e0006, |
795 | 0x03020080, | 828 | 0xf4bd0006, |
796 | 0xbd000ef6, | 829 | 0x0006a87e, |
797 | /* 0x0841: ctx_xfer_idle */ | 830 | 0x0007307e, |
798 | 0x00008e04, | 831 | /* 0x08bc: ctx_xfer_exec */ |
799 | 0x00eecf03, | 832 | 0xbd160198, |
800 | 0x2000e4f1, | 833 | 0x05008024, |
801 | 0xf4f51bf4, | 834 | 0x0002f601, |
802 | 0x02f40611, | 835 | 0x1fb204bd, |
803 | /* 0x0855: ctx_xfer_pre */ | 836 | 0x41a5008e, |
804 | 0x7e100f0c, | ||
805 | 0xf40006b3, | ||
806 | /* 0x085e: ctx_xfer_pre_load */ | ||
807 | 0x020f1b11, | ||
808 | 0x0006627e, | ||
809 | 0x0006717e, | ||
810 | 0x0006837e, | ||
811 | 0x627ef4bd, | ||
812 | 0xea7e0006, | ||
813 | /* 0x0876: ctx_xfer_exec */ | ||
814 | 0x01980006, | ||
815 | 0x8024bd16, | ||
816 | 0xf6010500, | ||
817 | 0x04bd0002, | ||
818 | 0x008e1fb2, | ||
819 | 0x8f7e41a5, | ||
820 | 0xfcf00000, | ||
821 | 0x022cf001, | ||
822 | 0xfd0124b6, | ||
823 | 0xffb205f2, | ||
824 | 0x41a5048e, | ||
825 | 0x00008f7e, | 837 | 0x00008f7e, |
826 | 0x0002167e, | 838 | 0xf001fcf0, |
827 | 0xfc8024bd, | 839 | 0x24b6022c, |
828 | 0x02f60247, | 840 | 0x05f2fd01, |
829 | 0xf004bd00, | 841 | 0x048effb2, |
830 | 0x20b6012c, | 842 | 0x8f7e41a5, |
831 | 0x4afc8003, | 843 | 0x167e0000, |
832 | 0x0002f602, | 844 | 0x24bd0002, |
833 | 0xacf004bd, | 845 | 0x0247fc80, |
834 | 0x06a5f001, | 846 | 0xbd0002f6, |
835 | 0x0c98000b, | 847 | 0x012cf004, |
836 | 0x010d9800, | 848 | 0x800320b6, |
837 | 0x3d7e000e, | 849 | 0xf6024afc, |
838 | 0x080a0001, | 850 | 0x04bd0002, |
839 | 0x0000ec7e, | 851 | 0xf001acf0, |
840 | 0x00020a7e, | 852 | 0x000b06a5, |
841 | 0x0a1201f4, | 853 | 0x98000c98, |
842 | 0x00b87e0c, | 854 | 0x000e010d, |
843 | 0x7e050f00, | 855 | 0x00013d7e, |
844 | 0xf40006d2, | 856 | 0xec7e080a, |
845 | /* 0x08f2: ctx_xfer_post */ | 857 | 0x0a7e0000, |
846 | 0x020f2d02, | 858 | 0x01f40002, |
847 | 0x0006627e, | 859 | 0x7e0c0a12, |
848 | 0xb37ef4bd, | 860 | 0x0f0000b8, |
849 | 0x277e0006, | 861 | 0x07187e05, |
850 | 0x717e0002, | 862 | 0x2d02f400, |
863 | /* 0x0938: ctx_xfer_post */ | ||
864 | 0xa87e020f, | ||
851 | 0xf4bd0006, | 865 | 0xf4bd0006, |
852 | 0x0006627e, | 866 | 0x0006f97e, |
853 | 0x981011f4, | 867 | 0x0002277e, |
854 | 0x11fd4001, | 868 | 0x0006b77e, |
855 | 0x070bf405, | 869 | 0xa87ef4bd, |
856 | 0x0007e87e, | 870 | 0x11f40006, |
857 | /* 0x091c: ctx_xfer_no_post_mmio */ | 871 | 0x40019810, |
858 | /* 0x091c: ctx_xfer_done */ | 872 | 0xf40511fd, |
859 | 0x000000f8, | 873 | 0x2e7e070b, |
860 | 0x00000000, | 874 | /* 0x0962: ctx_xfer_no_post_mmio */ |
861 | 0x00000000, | 875 | /* 0x0962: ctx_xfer_done */ |
862 | 0x00000000, | 876 | 0x00f80008, |
863 | 0x00000000, | ||
864 | 0x00000000, | ||
865 | 0x00000000, | ||
866 | 0x00000000, | ||
867 | 0x00000000, | ||
868 | 0x00000000, | ||
869 | 0x00000000, | ||
870 | 0x00000000, | ||
871 | 0x00000000, | ||
872 | 0x00000000, | ||
873 | 0x00000000, | ||
874 | 0x00000000, | ||
875 | 0x00000000, | ||
876 | 0x00000000, | ||
877 | 0x00000000, | 877 | 0x00000000, |
878 | 0x00000000, | 878 | 0x00000000, |
879 | 0x00000000, | 879 | 0x00000000, |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnv108.fuc5.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnv108.fuc5.h index 64dfd75192bf..e49b5a877ae4 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnv108.fuc5.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnv108.fuc5.h | |||
@@ -478,10 +478,10 @@ uint32_t nv108_grhub_code[] = { | |||
478 | 0x01040080, | 478 | 0x01040080, |
479 | 0xbd0001f6, | 479 | 0xbd0001f6, |
480 | 0x01004104, | 480 | 0x01004104, |
481 | 0x627e020f, | 481 | 0xa87e020f, |
482 | 0x717e0006, | 482 | 0xb77e0006, |
483 | 0x100f0006, | 483 | 0x100f0006, |
484 | 0x0006b37e, | 484 | 0x0006f97e, |
485 | 0x98000e98, | 485 | 0x98000e98, |
486 | 0x207e010f, | 486 | 0x207e010f, |
487 | 0x14950001, | 487 | 0x14950001, |
@@ -523,8 +523,8 @@ uint32_t nv108_grhub_code[] = { | |||
523 | 0x800040b7, | 523 | 0x800040b7, |
524 | 0xf40132b6, | 524 | 0xf40132b6, |
525 | 0x000fb41b, | 525 | 0x000fb41b, |
526 | 0x0006b37e, | 526 | 0x0006f97e, |
527 | 0x627e000f, | 527 | 0xa87e000f, |
528 | 0x00800006, | 528 | 0x00800006, |
529 | 0x01f60201, | 529 | 0x01f60201, |
530 | 0xbd04bd00, | 530 | 0xbd04bd00, |
@@ -554,7 +554,7 @@ uint32_t nv108_grhub_code[] = { | |||
554 | 0x0009f602, | 554 | 0x0009f602, |
555 | 0x32f404bd, | 555 | 0x32f404bd, |
556 | 0x0231f401, | 556 | 0x0231f401, |
557 | 0x0008367e, | 557 | 0x00087c7e, |
558 | 0x99f094bd, | 558 | 0x99f094bd, |
559 | 0x17008007, | 559 | 0x17008007, |
560 | 0x0009f602, | 560 | 0x0009f602, |
@@ -563,7 +563,7 @@ uint32_t nv108_grhub_code[] = { | |||
563 | 0x37008006, | 563 | 0x37008006, |
564 | 0x0009f602, | 564 | 0x0009f602, |
565 | 0x31f404bd, | 565 | 0x31f404bd, |
566 | 0x08367e01, | 566 | 0x087c7e01, |
567 | 0xf094bd00, | 567 | 0xf094bd00, |
568 | 0x00800699, | 568 | 0x00800699, |
569 | 0x09f60217, | 569 | 0x09f60217, |
@@ -572,7 +572,7 @@ uint32_t nv108_grhub_code[] = { | |||
572 | 0x20f92f0e, | 572 | 0x20f92f0e, |
573 | 0x32f412b2, | 573 | 0x32f412b2, |
574 | 0x0232f401, | 574 | 0x0232f401, |
575 | 0x0008367e, | 575 | 0x00087c7e, |
576 | 0x008020fc, | 576 | 0x008020fc, |
577 | 0x02f602c0, | 577 | 0x02f602c0, |
578 | 0xf404bd00, | 578 | 0xf404bd00, |
@@ -580,7 +580,7 @@ uint32_t nv108_grhub_code[] = { | |||
580 | 0x23c8130e, | 580 | 0x23c8130e, |
581 | 0x0d0bf41f, | 581 | 0x0d0bf41f, |
582 | 0xf40131f4, | 582 | 0xf40131f4, |
583 | 0x367e0232, | 583 | 0x7c7e0232, |
584 | /* 0x054e: chsw_done */ | 584 | /* 0x054e: chsw_done */ |
585 | 0x01020008, | 585 | 0x01020008, |
586 | 0x02c30080, | 586 | 0x02c30080, |
@@ -593,7 +593,7 @@ uint32_t nv108_grhub_code[] = { | |||
593 | 0xb0ff2a0e, | 593 | 0xb0ff2a0e, |
594 | 0x1bf401e4, | 594 | 0x1bf401e4, |
595 | 0x7ef2b20c, | 595 | 0x7ef2b20c, |
596 | 0xf40007d6, | 596 | 0xf400081c, |
597 | /* 0x057a: main_not_ctx_chan */ | 597 | /* 0x057a: main_not_ctx_chan */ |
598 | 0xe4b0400e, | 598 | 0xe4b0400e, |
599 | 0x2c1bf402, | 599 | 0x2c1bf402, |
@@ -602,7 +602,7 @@ uint32_t nv108_grhub_code[] = { | |||
602 | 0x0009f602, | 602 | 0x0009f602, |
603 | 0x32f404bd, | 603 | 0x32f404bd, |
604 | 0x0232f401, | 604 | 0x0232f401, |
605 | 0x0008367e, | 605 | 0x00087c7e, |
606 | 0x99f094bd, | 606 | 0x99f094bd, |
607 | 0x17008007, | 607 | 0x17008007, |
608 | 0x0009f602, | 608 | 0x0009f602, |
@@ -642,238 +642,238 @@ uint32_t nv108_grhub_code[] = { | |||
642 | /* 0x061a: ih_no_ctxsw */ | 642 | /* 0x061a: ih_no_ctxsw */ |
643 | 0xabe40000, | 643 | 0xabe40000, |
644 | 0x0bf40400, | 644 | 0x0bf40400, |
645 | 0x01004b10, | 645 | 0x07088e56, |
646 | 0x448ebfb2, | ||
647 | 0x8f7e4001, | ||
648 | /* 0x062e: ih_no_fwmthd */ | ||
649 | 0x044b0000, | ||
650 | 0xffb0bd01, | ||
651 | 0x0bf4b4ab, | ||
652 | 0x0700800c, | ||
653 | 0x000bf603, | ||
654 | /* 0x0642: ih_no_other */ | ||
655 | 0x004004bd, | ||
656 | 0x000af601, | ||
657 | 0xf0fc04bd, | ||
658 | 0xd0fce0fc, | ||
659 | 0xa0fcb0fc, | ||
660 | 0x80fc90fc, | ||
661 | 0xfc0088fe, | ||
662 | 0x0032f480, | ||
663 | /* 0x0662: ctx_4170s */ | ||
664 | 0xf5f001f8, | ||
665 | 0x8effb210, | ||
666 | 0x7e404170, | ||
667 | 0xf800008f, | ||
668 | /* 0x0671: ctx_4170w */ | ||
669 | 0x41708e00, | ||
670 | 0x00657e40, | 646 | 0x00657e40, |
671 | 0xf0ffb200, | 647 | 0x80ffb200, |
672 | 0x1bf410f4, | 648 | 0xf6020400, |
673 | /* 0x0683: ctx_redswitch */ | ||
674 | 0x4e00f8f3, | ||
675 | 0xe5f00200, | ||
676 | 0x20e5f040, | ||
677 | 0x8010e5f0, | ||
678 | 0xf6018500, | ||
679 | 0x04bd000e, | ||
680 | /* 0x069a: ctx_redswitch_delay */ | ||
681 | 0xf2b6080f, | ||
682 | 0xfd1bf401, | ||
683 | 0x0400e5f1, | ||
684 | 0x0100e5f1, | ||
685 | 0x01850080, | ||
686 | 0xbd000ef6, | ||
687 | /* 0x06b3: ctx_86c */ | ||
688 | 0x8000f804, | ||
689 | 0xf6022300, | ||
690 | 0x04bd000f, | 649 | 0x04bd000f, |
691 | 0x148effb2, | 650 | 0x4007048e, |
692 | 0x8f7e408a, | 651 | 0x0000657e, |
693 | 0xffb20000, | 652 | 0x0080ffb2, |
694 | 0x41a88c8e, | 653 | 0x0ff60203, |
654 | 0xc704bd00, | ||
655 | 0xee9450fe, | ||
656 | 0x07008f02, | ||
657 | 0x00efbb40, | ||
658 | 0x0000657e, | ||
659 | 0x02020080, | ||
660 | 0xbd000ff6, | ||
661 | 0x7e030f04, | ||
662 | 0x4b0002f8, | ||
663 | 0xbfb20100, | ||
664 | 0x4001448e, | ||
695 | 0x00008f7e, | 665 | 0x00008f7e, |
696 | /* 0x06d2: ctx_mem */ | 666 | /* 0x0674: ih_no_fwmthd */ |
697 | 0x008000f8, | 667 | 0xbd05044b, |
698 | 0x0ff60284, | 668 | 0xb4abffb0, |
699 | /* 0x06db: ctx_mem_wait */ | 669 | 0x800c0bf4, |
700 | 0x8f04bd00, | 670 | 0xf6030700, |
701 | 0xcf028400, | 671 | 0x04bd000b, |
702 | 0xfffd00ff, | 672 | /* 0x0688: ih_no_other */ |
703 | 0xf61bf405, | 673 | 0xf6010040, |
704 | /* 0x06ea: ctx_load */ | 674 | 0x04bd000a, |
705 | 0x94bd00f8, | 675 | 0xe0fcf0fc, |
706 | 0x800599f0, | 676 | 0xb0fcd0fc, |
707 | 0xf6023700, | 677 | 0x90fca0fc, |
708 | 0x04bd0009, | 678 | 0x88fe80fc, |
709 | 0xb87e0c0a, | 679 | 0xf480fc00, |
710 | 0xf4bd0000, | 680 | 0x01f80032, |
711 | 0x02890080, | 681 | /* 0x06a8: ctx_4170s */ |
682 | 0xb210f5f0, | ||
683 | 0x41708eff, | ||
684 | 0x008f7e40, | ||
685 | /* 0x06b7: ctx_4170w */ | ||
686 | 0x8e00f800, | ||
687 | 0x7e404170, | ||
688 | 0xb2000065, | ||
689 | 0x10f4f0ff, | ||
690 | 0xf8f31bf4, | ||
691 | /* 0x06c9: ctx_redswitch */ | ||
692 | 0x02004e00, | ||
693 | 0xf040e5f0, | ||
694 | 0xe5f020e5, | ||
695 | 0x85008010, | ||
696 | 0x000ef601, | ||
697 | 0x080f04bd, | ||
698 | /* 0x06e0: ctx_redswitch_delay */ | ||
699 | 0xf401f2b6, | ||
700 | 0xe5f1fd1b, | ||
701 | 0xe5f10400, | ||
702 | 0x00800100, | ||
703 | 0x0ef60185, | ||
704 | 0xf804bd00, | ||
705 | /* 0x06f9: ctx_86c */ | ||
706 | 0x23008000, | ||
707 | 0x000ff602, | ||
708 | 0xffb204bd, | ||
709 | 0x408a148e, | ||
710 | 0x00008f7e, | ||
711 | 0x8c8effb2, | ||
712 | 0x8f7e41a8, | ||
713 | 0x00f80000, | ||
714 | /* 0x0718: ctx_mem */ | ||
715 | 0x02840080, | ||
712 | 0xbd000ff6, | 716 | 0xbd000ff6, |
713 | 0xc1008004, | 717 | /* 0x0721: ctx_mem_wait */ |
714 | 0x0002f602, | 718 | 0x84008f04, |
715 | 0x008004bd, | 719 | 0x00ffcf02, |
716 | 0x02f60283, | 720 | 0xf405fffd, |
717 | 0x0f04bd00, | 721 | 0x00f8f61b, |
718 | 0x06d27e07, | 722 | /* 0x0730: ctx_load */ |
719 | 0xc0008000, | 723 | 0x99f094bd, |
720 | 0x0002f602, | 724 | 0x37008005, |
721 | 0x0bfe04bd, | 725 | 0x0009f602, |
722 | 0x1f2af000, | 726 | 0x0c0a04bd, |
723 | 0xb60424b6, | 727 | 0x0000b87e, |
724 | 0x94bd0220, | 728 | 0x0080f4bd, |
725 | 0x800899f0, | 729 | 0x0ff60289, |
726 | 0xf6023700, | 730 | 0x8004bd00, |
727 | 0x04bd0009, | 731 | 0xf602c100, |
728 | 0x02810080, | 732 | 0x04bd0002, |
729 | 0xbd0002f6, | 733 | 0x02830080, |
730 | 0x0000d204, | ||
731 | 0x25f08000, | ||
732 | 0x88008002, | ||
733 | 0x0002f602, | ||
734 | 0x100104bd, | ||
735 | 0xf0020042, | ||
736 | 0x12fa0223, | ||
737 | 0xbd03f805, | ||
738 | 0x0899f094, | ||
739 | 0x02170080, | ||
740 | 0xbd0009f6, | ||
741 | 0x81019804, | ||
742 | 0x981814b6, | ||
743 | 0x25b68002, | ||
744 | 0x0512fd08, | ||
745 | 0xbd1601b5, | ||
746 | 0x0999f094, | ||
747 | 0x02370080, | ||
748 | 0xbd0009f6, | ||
749 | 0x81008004, | ||
750 | 0x0001f602, | ||
751 | 0x010204bd, | ||
752 | 0x02880080, | ||
753 | 0xbd0002f6, | 734 | 0xbd0002f6, |
754 | 0x01004104, | 735 | 0x7e070f04, |
755 | 0xfa0613f0, | 736 | 0x80000718, |
756 | 0x03f80501, | 737 | 0xf602c000, |
738 | 0x04bd0002, | ||
739 | 0xf0000bfe, | ||
740 | 0x24b61f2a, | ||
741 | 0x0220b604, | ||
757 | 0x99f094bd, | 742 | 0x99f094bd, |
758 | 0x17008009, | 743 | 0x37008008, |
759 | 0x0009f602, | 744 | 0x0009f602, |
760 | 0x94bd04bd, | 745 | 0x008004bd, |
761 | 0x800599f0, | 746 | 0x02f60281, |
747 | 0xd204bd00, | ||
748 | 0x80000000, | ||
749 | 0x800225f0, | ||
750 | 0xf6028800, | ||
751 | 0x04bd0002, | ||
752 | 0x00421001, | ||
753 | 0x0223f002, | ||
754 | 0xf80512fa, | ||
755 | 0xf094bd03, | ||
756 | 0x00800899, | ||
757 | 0x09f60217, | ||
758 | 0x9804bd00, | ||
759 | 0x14b68101, | ||
760 | 0x80029818, | ||
761 | 0xfd0825b6, | ||
762 | 0x01b50512, | ||
763 | 0xf094bd16, | ||
764 | 0x00800999, | ||
765 | 0x09f60237, | ||
766 | 0x8004bd00, | ||
767 | 0xf6028100, | ||
768 | 0x04bd0001, | ||
769 | 0x00800102, | ||
770 | 0x02f60288, | ||
771 | 0x4104bd00, | ||
772 | 0x13f00100, | ||
773 | 0x0501fa06, | ||
774 | 0x94bd03f8, | ||
775 | 0x800999f0, | ||
762 | 0xf6021700, | 776 | 0xf6021700, |
763 | 0x04bd0009, | 777 | 0x04bd0009, |
764 | /* 0x07d6: ctx_chan */ | 778 | 0x99f094bd, |
765 | 0xea7e00f8, | 779 | 0x17008005, |
766 | 0x0c0a0006, | 780 | 0x0009f602, |
767 | 0x0000b87e, | 781 | 0x00f804bd, |
768 | 0xd27e050f, | 782 | /* 0x081c: ctx_chan */ |
769 | 0x00f80006, | 783 | 0x0007307e, |
770 | /* 0x07e8: ctx_mmio_exec */ | 784 | 0xb87e0c0a, |
771 | 0x80410398, | 785 | 0x050f0000, |
786 | 0x0007187e, | ||
787 | /* 0x082e: ctx_mmio_exec */ | ||
788 | 0x039800f8, | ||
789 | 0x81008041, | ||
790 | 0x0003f602, | ||
791 | 0x34bd04bd, | ||
792 | /* 0x083c: ctx_mmio_loop */ | ||
793 | 0xf4ff34c4, | ||
794 | 0x00450e1b, | ||
795 | 0x0653f002, | ||
796 | 0xf80535fa, | ||
797 | /* 0x084d: ctx_mmio_pull */ | ||
798 | 0x804e9803, | ||
799 | 0x7e814f98, | ||
800 | 0xb600008f, | ||
801 | 0x12b60830, | ||
802 | 0xdf1bf401, | ||
803 | /* 0x0860: ctx_mmio_done */ | ||
804 | 0x80160398, | ||
772 | 0xf6028100, | 805 | 0xf6028100, |
773 | 0x04bd0003, | 806 | 0x04bd0003, |
774 | /* 0x07f6: ctx_mmio_loop */ | 807 | 0x414000b5, |
775 | 0x34c434bd, | 808 | 0x13f00100, |
776 | 0x0e1bf4ff, | 809 | 0x0601fa06, |
777 | 0xf0020045, | 810 | 0x00f803f8, |
778 | 0x35fa0653, | 811 | /* 0x087c: ctx_xfer */ |
779 | /* 0x0807: ctx_mmio_pull */ | 812 | 0x0080040e, |
780 | 0x9803f805, | 813 | 0x0ef60302, |
781 | 0x4f98804e, | 814 | /* 0x0887: ctx_xfer_idle */ |
782 | 0x008f7e81, | 815 | 0x8e04bd00, |
783 | 0x0830b600, | 816 | 0xcf030000, |
784 | 0xf40112b6, | 817 | 0xe4f100ee, |
785 | /* 0x081a: ctx_mmio_done */ | 818 | 0x1bf42000, |
786 | 0x0398df1b, | 819 | 0x0611f4f5, |
787 | 0x81008016, | 820 | /* 0x089b: ctx_xfer_pre */ |
788 | 0x0003f602, | 821 | 0x0f0c02f4, |
789 | 0x00b504bd, | 822 | 0x06f97e10, |
790 | 0x01004140, | 823 | 0x1b11f400, |
791 | 0xfa0613f0, | 824 | /* 0x08a4: ctx_xfer_pre_load */ |
792 | 0x03f80601, | 825 | 0xa87e020f, |
793 | /* 0x0836: ctx_xfer */ | 826 | 0xb77e0006, |
794 | 0x040e00f8, | 827 | 0xc97e0006, |
795 | 0x03020080, | 828 | 0xf4bd0006, |
796 | 0xbd000ef6, | 829 | 0x0006a87e, |
797 | /* 0x0841: ctx_xfer_idle */ | 830 | 0x0007307e, |
798 | 0x00008e04, | 831 | /* 0x08bc: ctx_xfer_exec */ |
799 | 0x00eecf03, | 832 | 0xbd160198, |
800 | 0x2000e4f1, | 833 | 0x05008024, |
801 | 0xf4f51bf4, | 834 | 0x0002f601, |
802 | 0x02f40611, | 835 | 0x1fb204bd, |
803 | /* 0x0855: ctx_xfer_pre */ | 836 | 0x41a5008e, |
804 | 0x7e100f0c, | ||
805 | 0xf40006b3, | ||
806 | /* 0x085e: ctx_xfer_pre_load */ | ||
807 | 0x020f1b11, | ||
808 | 0x0006627e, | ||
809 | 0x0006717e, | ||
810 | 0x0006837e, | ||
811 | 0x627ef4bd, | ||
812 | 0xea7e0006, | ||
813 | /* 0x0876: ctx_xfer_exec */ | ||
814 | 0x01980006, | ||
815 | 0x8024bd16, | ||
816 | 0xf6010500, | ||
817 | 0x04bd0002, | ||
818 | 0x008e1fb2, | ||
819 | 0x8f7e41a5, | ||
820 | 0xfcf00000, | ||
821 | 0x022cf001, | ||
822 | 0xfd0124b6, | ||
823 | 0xffb205f2, | ||
824 | 0x41a5048e, | ||
825 | 0x00008f7e, | 837 | 0x00008f7e, |
826 | 0x0002167e, | 838 | 0xf001fcf0, |
827 | 0xfc8024bd, | 839 | 0x24b6022c, |
828 | 0x02f60247, | 840 | 0x05f2fd01, |
829 | 0xf004bd00, | 841 | 0x048effb2, |
830 | 0x20b6012c, | 842 | 0x8f7e41a5, |
831 | 0x4afc8003, | 843 | 0x167e0000, |
832 | 0x0002f602, | 844 | 0x24bd0002, |
833 | 0xacf004bd, | 845 | 0x0247fc80, |
834 | 0x06a5f001, | 846 | 0xbd0002f6, |
835 | 0x0c98000b, | 847 | 0x012cf004, |
836 | 0x010d9800, | 848 | 0x800320b6, |
837 | 0x3d7e000e, | 849 | 0xf6024afc, |
838 | 0x080a0001, | 850 | 0x04bd0002, |
839 | 0x0000ec7e, | 851 | 0xf001acf0, |
840 | 0x00020a7e, | 852 | 0x000b06a5, |
841 | 0x0a1201f4, | 853 | 0x98000c98, |
842 | 0x00b87e0c, | 854 | 0x000e010d, |
843 | 0x7e050f00, | 855 | 0x00013d7e, |
844 | 0xf40006d2, | 856 | 0xec7e080a, |
845 | /* 0x08f2: ctx_xfer_post */ | 857 | 0x0a7e0000, |
846 | 0x020f2d02, | 858 | 0x01f40002, |
847 | 0x0006627e, | 859 | 0x7e0c0a12, |
848 | 0xb37ef4bd, | 860 | 0x0f0000b8, |
849 | 0x277e0006, | 861 | 0x07187e05, |
850 | 0x717e0002, | 862 | 0x2d02f400, |
863 | /* 0x0938: ctx_xfer_post */ | ||
864 | 0xa87e020f, | ||
851 | 0xf4bd0006, | 865 | 0xf4bd0006, |
852 | 0x0006627e, | 866 | 0x0006f97e, |
853 | 0x981011f4, | 867 | 0x0002277e, |
854 | 0x11fd4001, | 868 | 0x0006b77e, |
855 | 0x070bf405, | 869 | 0xa87ef4bd, |
856 | 0x0007e87e, | 870 | 0x11f40006, |
857 | /* 0x091c: ctx_xfer_no_post_mmio */ | 871 | 0x40019810, |
858 | /* 0x091c: ctx_xfer_done */ | 872 | 0xf40511fd, |
859 | 0x000000f8, | 873 | 0x2e7e070b, |
860 | 0x00000000, | 874 | /* 0x0962: ctx_xfer_no_post_mmio */ |
861 | 0x00000000, | 875 | /* 0x0962: ctx_xfer_done */ |
862 | 0x00000000, | 876 | 0x00f80008, |
863 | 0x00000000, | ||
864 | 0x00000000, | ||
865 | 0x00000000, | ||
866 | 0x00000000, | ||
867 | 0x00000000, | ||
868 | 0x00000000, | ||
869 | 0x00000000, | ||
870 | 0x00000000, | ||
871 | 0x00000000, | ||
872 | 0x00000000, | ||
873 | 0x00000000, | ||
874 | 0x00000000, | ||
875 | 0x00000000, | ||
876 | 0x00000000, | ||
877 | 0x00000000, | 877 | 0x00000000, |
878 | 0x00000000, | 878 | 0x00000000, |
879 | 0x00000000, | 879 | 0x00000000, |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h index f8f7b278a13f..92dfe6a4ac87 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h | |||
@@ -528,10 +528,10 @@ uint32_t nvc0_grhub_code[] = { | |||
528 | 0x0001d001, | 528 | 0x0001d001, |
529 | 0x17f104bd, | 529 | 0x17f104bd, |
530 | 0xf7f00100, | 530 | 0xf7f00100, |
531 | 0xb521f502, | 531 | 0x0d21f502, |
532 | 0xc721f507, | 532 | 0x1f21f508, |
533 | 0x10f7f007, | 533 | 0x10f7f008, |
534 | 0x081421f5, | 534 | 0x086c21f5, |
535 | 0x98000e98, | 535 | 0x98000e98, |
536 | 0x21f5010f, | 536 | 0x21f5010f, |
537 | 0x14950150, | 537 | 0x14950150, |
@@ -574,9 +574,9 @@ uint32_t nvc0_grhub_code[] = { | |||
574 | 0xb6800040, | 574 | 0xb6800040, |
575 | 0x1bf40132, | 575 | 0x1bf40132, |
576 | 0x00f7f0be, | 576 | 0x00f7f0be, |
577 | 0x081421f5, | 577 | 0x086c21f5, |
578 | 0xf500f7f0, | 578 | 0xf500f7f0, |
579 | 0xf107b521, | 579 | 0xf1080d21, |
580 | 0xf0010007, | 580 | 0xf0010007, |
581 | 0x01d00203, | 581 | 0x01d00203, |
582 | 0xbd04bd00, | 582 | 0xbd04bd00, |
@@ -610,8 +610,8 @@ uint32_t nvc0_grhub_code[] = { | |||
610 | 0x09d00203, | 610 | 0x09d00203, |
611 | 0xf404bd00, | 611 | 0xf404bd00, |
612 | 0x31f40132, | 612 | 0x31f40132, |
613 | 0xe821f502, | 613 | 0x4021f502, |
614 | 0xf094bd09, | 614 | 0xf094bd0a, |
615 | 0x07f10799, | 615 | 0x07f10799, |
616 | 0x03f01700, | 616 | 0x03f01700, |
617 | 0x0009d002, | 617 | 0x0009d002, |
@@ -621,7 +621,7 @@ uint32_t nvc0_grhub_code[] = { | |||
621 | 0x0203f00f, | 621 | 0x0203f00f, |
622 | 0xbd0009d0, | 622 | 0xbd0009d0, |
623 | 0x0131f404, | 623 | 0x0131f404, |
624 | 0x09e821f5, | 624 | 0x0a4021f5, |
625 | 0x99f094bd, | 625 | 0x99f094bd, |
626 | 0x0007f106, | 626 | 0x0007f106, |
627 | 0x0203f017, | 627 | 0x0203f017, |
@@ -631,7 +631,7 @@ uint32_t nvc0_grhub_code[] = { | |||
631 | 0x12b920f9, | 631 | 0x12b920f9, |
632 | 0x0132f402, | 632 | 0x0132f402, |
633 | 0xf50232f4, | 633 | 0xf50232f4, |
634 | 0xfc09e821, | 634 | 0xfc0a4021, |
635 | 0x0007f120, | 635 | 0x0007f120, |
636 | 0x0203f0c0, | 636 | 0x0203f0c0, |
637 | 0xbd0002d0, | 637 | 0xbd0002d0, |
@@ -640,7 +640,7 @@ uint32_t nvc0_grhub_code[] = { | |||
640 | 0xf41f23c8, | 640 | 0xf41f23c8, |
641 | 0x31f40d0b, | 641 | 0x31f40d0b, |
642 | 0x0232f401, | 642 | 0x0232f401, |
643 | 0x09e821f5, | 643 | 0x0a4021f5, |
644 | /* 0x063c: chsw_done */ | 644 | /* 0x063c: chsw_done */ |
645 | 0xf10127f0, | 645 | 0xf10127f0, |
646 | 0xf0c30007, | 646 | 0xf0c30007, |
@@ -654,7 +654,7 @@ uint32_t nvc0_grhub_code[] = { | |||
654 | /* 0x0660: main_not_ctx_switch */ | 654 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 655 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 656 | 0xf2b90d1b, |
657 | 0x7821f502, | 657 | 0xd021f502, |
658 | 0x460ef409, | 658 | 0x460ef409, |
659 | /* 0x0670: main_not_ctx_chan */ | 659 | /* 0x0670: main_not_ctx_chan */ |
660 | 0xf402e4b0, | 660 | 0xf402e4b0, |
@@ -664,8 +664,8 @@ uint32_t nvc0_grhub_code[] = { | |||
664 | 0x09d00203, | 664 | 0x09d00203, |
665 | 0xf404bd00, | 665 | 0xf404bd00, |
666 | 0x32f40132, | 666 | 0x32f40132, |
667 | 0xe821f502, | 667 | 0x4021f502, |
668 | 0xf094bd09, | 668 | 0xf094bd0a, |
669 | 0x07f10799, | 669 | 0x07f10799, |
670 | 0x03f01700, | 670 | 0x03f01700, |
671 | 0x0009d002, | 671 | 0x0009d002, |
@@ -710,18 +710,40 @@ uint32_t nvc0_grhub_code[] = { | |||
710 | /* 0x072b: ih_no_ctxsw */ | 710 | /* 0x072b: ih_no_ctxsw */ |
711 | 0xe40421f4, | 711 | 0xe40421f4, |
712 | 0xf40400ab, | 712 | 0xf40400ab, |
713 | 0xb7f1140b, | 713 | 0xe7f16c0b, |
714 | 0xe3f00708, | ||
715 | 0x6821f440, | ||
716 | 0xf102ffb9, | ||
717 | 0xf0040007, | ||
718 | 0x0fd00203, | ||
719 | 0xf104bd00, | ||
720 | 0xf00704e7, | ||
721 | 0x21f440e3, | ||
722 | 0x02ffb968, | ||
723 | 0x030007f1, | ||
724 | 0xd00203f0, | ||
725 | 0x04bd000f, | ||
726 | 0x9450fec7, | ||
727 | 0xf7f102ee, | ||
728 | 0xf3f00700, | ||
729 | 0x00efbb40, | ||
730 | 0xf16821f4, | ||
731 | 0xf0020007, | ||
732 | 0x0fd00203, | ||
733 | 0xf004bd00, | ||
734 | 0x21f503f7, | ||
735 | 0xb7f1037e, | ||
714 | 0xbfb90100, | 736 | 0xbfb90100, |
715 | 0x44e7f102, | 737 | 0x44e7f102, |
716 | 0x40e3f001, | 738 | 0x40e3f001, |
717 | /* 0x0743: ih_no_fwmthd */ | 739 | /* 0x079b: ih_no_fwmthd */ |
718 | 0xf19d21f4, | 740 | 0xf19d21f4, |
719 | 0xbd0104b7, | 741 | 0xbd0504b7, |
720 | 0xb4abffb0, | 742 | 0xb4abffb0, |
721 | 0xf10f0bf4, | 743 | 0xf10f0bf4, |
722 | 0xf0070007, | 744 | 0xf0070007, |
723 | 0x0bd00303, | 745 | 0x0bd00303, |
724 | /* 0x075b: ih_no_other */ | 746 | /* 0x07b3: ih_no_other */ |
725 | 0xf104bd00, | 747 | 0xf104bd00, |
726 | 0xf0010007, | 748 | 0xf0010007, |
727 | 0x0ad00003, | 749 | 0x0ad00003, |
@@ -731,36 +753,36 @@ uint32_t nvc0_grhub_code[] = { | |||
731 | 0xfc90fca0, | 753 | 0xfc90fca0, |
732 | 0x0088fe80, | 754 | 0x0088fe80, |
733 | 0x32f480fc, | 755 | 0x32f480fc, |
734 | /* 0x077f: ctx_4160s */ | 756 | /* 0x07d7: ctx_4160s */ |
735 | 0xf001f800, | 757 | 0xf001f800, |
736 | 0xffb901f7, | 758 | 0xffb901f7, |
737 | 0x60e7f102, | 759 | 0x60e7f102, |
738 | 0x40e3f041, | 760 | 0x40e3f041, |
739 | /* 0x078f: ctx_4160s_wait */ | 761 | /* 0x07e7: ctx_4160s_wait */ |
740 | 0xf19d21f4, | 762 | 0xf19d21f4, |
741 | 0xf04160e7, | 763 | 0xf04160e7, |
742 | 0x21f440e3, | 764 | 0x21f440e3, |
743 | 0x02ffb968, | 765 | 0x02ffb968, |
744 | 0xf404ffc8, | 766 | 0xf404ffc8, |
745 | 0x00f8f00b, | 767 | 0x00f8f00b, |
746 | /* 0x07a4: ctx_4160c */ | 768 | /* 0x07fc: ctx_4160c */ |
747 | 0xffb9f4bd, | 769 | 0xffb9f4bd, |
748 | 0x60e7f102, | 770 | 0x60e7f102, |
749 | 0x40e3f041, | 771 | 0x40e3f041, |
750 | 0xf89d21f4, | 772 | 0xf89d21f4, |
751 | /* 0x07b5: ctx_4170s */ | 773 | /* 0x080d: ctx_4170s */ |
752 | 0x10f5f000, | 774 | 0x10f5f000, |
753 | 0xf102ffb9, | 775 | 0xf102ffb9, |
754 | 0xf04170e7, | 776 | 0xf04170e7, |
755 | 0x21f440e3, | 777 | 0x21f440e3, |
756 | /* 0x07c7: ctx_4170w */ | 778 | /* 0x081f: ctx_4170w */ |
757 | 0xf100f89d, | 779 | 0xf100f89d, |
758 | 0xf04170e7, | 780 | 0xf04170e7, |
759 | 0x21f440e3, | 781 | 0x21f440e3, |
760 | 0x02ffb968, | 782 | 0x02ffb968, |
761 | 0xf410f4f0, | 783 | 0xf410f4f0, |
762 | 0x00f8f01b, | 784 | 0x00f8f01b, |
763 | /* 0x07dc: ctx_redswitch */ | 785 | /* 0x0834: ctx_redswitch */ |
764 | 0x0200e7f1, | 786 | 0x0200e7f1, |
765 | 0xf040e5f0, | 787 | 0xf040e5f0, |
766 | 0xe5f020e5, | 788 | 0xe5f020e5, |
@@ -768,7 +790,7 @@ uint32_t nvc0_grhub_code[] = { | |||
768 | 0x0103f085, | 790 | 0x0103f085, |
769 | 0xbd000ed0, | 791 | 0xbd000ed0, |
770 | 0x08f7f004, | 792 | 0x08f7f004, |
771 | /* 0x07f8: ctx_redswitch_delay */ | 793 | /* 0x0850: ctx_redswitch_delay */ |
772 | 0xf401f2b6, | 794 | 0xf401f2b6, |
773 | 0xe5f1fd1b, | 795 | 0xe5f1fd1b, |
774 | 0xe5f10400, | 796 | 0xe5f10400, |
@@ -776,7 +798,7 @@ uint32_t nvc0_grhub_code[] = { | |||
776 | 0x03f08500, | 798 | 0x03f08500, |
777 | 0x000ed001, | 799 | 0x000ed001, |
778 | 0x00f804bd, | 800 | 0x00f804bd, |
779 | /* 0x0814: ctx_86c */ | 801 | /* 0x086c: ctx_86c */ |
780 | 0x1b0007f1, | 802 | 0x1b0007f1, |
781 | 0xd00203f0, | 803 | 0xd00203f0, |
782 | 0x04bd000f, | 804 | 0x04bd000f, |
@@ -787,16 +809,16 @@ uint32_t nvc0_grhub_code[] = { | |||
787 | 0xa86ce7f1, | 809 | 0xa86ce7f1, |
788 | 0xf441e3f0, | 810 | 0xf441e3f0, |
789 | 0x00f89d21, | 811 | 0x00f89d21, |
790 | /* 0x083c: ctx_mem */ | 812 | /* 0x0894: ctx_mem */ |
791 | 0x840007f1, | 813 | 0x840007f1, |
792 | 0xd00203f0, | 814 | 0xd00203f0, |
793 | 0x04bd000f, | 815 | 0x04bd000f, |
794 | /* 0x0848: ctx_mem_wait */ | 816 | /* 0x08a0: ctx_mem_wait */ |
795 | 0x8400f7f1, | 817 | 0x8400f7f1, |
796 | 0xcf02f3f0, | 818 | 0xcf02f3f0, |
797 | 0xfffd00ff, | 819 | 0xfffd00ff, |
798 | 0xf31bf405, | 820 | 0xf31bf405, |
799 | /* 0x085a: ctx_load */ | 821 | /* 0x08b2: ctx_load */ |
800 | 0x94bd00f8, | 822 | 0x94bd00f8, |
801 | 0xf10599f0, | 823 | 0xf10599f0, |
802 | 0xf00f0007, | 824 | 0xf00f0007, |
@@ -814,7 +836,7 @@ uint32_t nvc0_grhub_code[] = { | |||
814 | 0x02d00203, | 836 | 0x02d00203, |
815 | 0xf004bd00, | 837 | 0xf004bd00, |
816 | 0x21f507f7, | 838 | 0x21f507f7, |
817 | 0x07f1083c, | 839 | 0x07f10894, |
818 | 0x03f0c000, | 840 | 0x03f0c000, |
819 | 0x0002d002, | 841 | 0x0002d002, |
820 | 0x0bfe04bd, | 842 | 0x0bfe04bd, |
@@ -869,31 +891,31 @@ uint32_t nvc0_grhub_code[] = { | |||
869 | 0x03f01700, | 891 | 0x03f01700, |
870 | 0x0009d002, | 892 | 0x0009d002, |
871 | 0x00f804bd, | 893 | 0x00f804bd, |
872 | /* 0x0978: ctx_chan */ | 894 | /* 0x09d0: ctx_chan */ |
873 | 0x077f21f5, | 895 | 0x07d721f5, |
874 | 0x085a21f5, | 896 | 0x08b221f5, |
875 | 0xf40ca7f0, | 897 | 0xf40ca7f0, |
876 | 0xf7f0d021, | 898 | 0xf7f0d021, |
877 | 0x3c21f505, | 899 | 0x9421f505, |
878 | 0xa421f508, | 900 | 0xfc21f508, |
879 | /* 0x0993: ctx_mmio_exec */ | 901 | /* 0x09eb: ctx_mmio_exec */ |
880 | 0x9800f807, | 902 | 0x9800f807, |
881 | 0x07f14103, | 903 | 0x07f14103, |
882 | 0x03f08100, | 904 | 0x03f08100, |
883 | 0x0003d002, | 905 | 0x0003d002, |
884 | 0x34bd04bd, | 906 | 0x34bd04bd, |
885 | /* 0x09a4: ctx_mmio_loop */ | 907 | /* 0x09fc: ctx_mmio_loop */ |
886 | 0xf4ff34c4, | 908 | 0xf4ff34c4, |
887 | 0x57f10f1b, | 909 | 0x57f10f1b, |
888 | 0x53f00200, | 910 | 0x53f00200, |
889 | 0x0535fa06, | 911 | 0x0535fa06, |
890 | /* 0x09b6: ctx_mmio_pull */ | 912 | /* 0x0a0e: ctx_mmio_pull */ |
891 | 0x4e9803f8, | 913 | 0x4e9803f8, |
892 | 0x814f9880, | 914 | 0x814f9880, |
893 | 0xb69d21f4, | 915 | 0xb69d21f4, |
894 | 0x12b60830, | 916 | 0x12b60830, |
895 | 0xdf1bf401, | 917 | 0xdf1bf401, |
896 | /* 0x09c8: ctx_mmio_done */ | 918 | /* 0x0a20: ctx_mmio_done */ |
897 | 0xf1160398, | 919 | 0xf1160398, |
898 | 0xf0810007, | 920 | 0xf0810007, |
899 | 0x03d00203, | 921 | 0x03d00203, |
@@ -902,30 +924,30 @@ uint32_t nvc0_grhub_code[] = { | |||
902 | 0x13f00100, | 924 | 0x13f00100, |
903 | 0x0601fa06, | 925 | 0x0601fa06, |
904 | 0x00f803f8, | 926 | 0x00f803f8, |
905 | /* 0x09e8: ctx_xfer */ | 927 | /* 0x0a40: ctx_xfer */ |
906 | 0xf104e7f0, | 928 | 0xf104e7f0, |
907 | 0xf0020007, | 929 | 0xf0020007, |
908 | 0x0ed00303, | 930 | 0x0ed00303, |
909 | /* 0x09f7: ctx_xfer_idle */ | 931 | /* 0x0a4f: ctx_xfer_idle */ |
910 | 0xf104bd00, | 932 | 0xf104bd00, |
911 | 0xf00000e7, | 933 | 0xf00000e7, |
912 | 0xeecf03e3, | 934 | 0xeecf03e3, |
913 | 0x00e4f100, | 935 | 0x00e4f100, |
914 | 0xf21bf420, | 936 | 0xf21bf420, |
915 | 0xf40611f4, | 937 | 0xf40611f4, |
916 | /* 0x0a0e: ctx_xfer_pre */ | 938 | /* 0x0a66: ctx_xfer_pre */ |
917 | 0xf7f01102, | 939 | 0xf7f01102, |
918 | 0x1421f510, | 940 | 0x6c21f510, |
919 | 0x7f21f508, | 941 | 0xd721f508, |
920 | 0x1c11f407, | 942 | 0x1c11f407, |
921 | /* 0x0a1c: ctx_xfer_pre_load */ | 943 | /* 0x0a74: ctx_xfer_pre_load */ |
922 | 0xf502f7f0, | 944 | 0xf502f7f0, |
923 | 0xf507b521, | 945 | 0xf5080d21, |
924 | 0xf507c721, | 946 | 0xf5081f21, |
925 | 0xbd07dc21, | 947 | 0xbd083421, |
926 | 0xb521f5f4, | 948 | 0x0d21f5f4, |
927 | 0x5a21f507, | 949 | 0xb221f508, |
928 | /* 0x0a35: ctx_xfer_exec */ | 950 | /* 0x0a8d: ctx_xfer_exec */ |
929 | 0x16019808, | 951 | 0x16019808, |
930 | 0x07f124bd, | 952 | 0x07f124bd, |
931 | 0x03f00500, | 953 | 0x03f00500, |
@@ -960,23 +982,65 @@ uint32_t nvc0_grhub_code[] = { | |||
960 | 0x1301f402, | 982 | 0x1301f402, |
961 | 0xf40ca7f0, | 983 | 0xf40ca7f0, |
962 | 0xf7f0d021, | 984 | 0xf7f0d021, |
963 | 0x3c21f505, | 985 | 0x9421f505, |
964 | 0x3202f408, | 986 | 0x3202f408, |
965 | /* 0x0ac4: ctx_xfer_post */ | 987 | /* 0x0b1c: ctx_xfer_post */ |
966 | 0xf502f7f0, | 988 | 0xf502f7f0, |
967 | 0xbd07b521, | 989 | 0xbd080d21, |
968 | 0x1421f5f4, | 990 | 0x6c21f5f4, |
969 | 0x7f21f508, | 991 | 0x7f21f508, |
970 | 0xc721f502, | 992 | 0x1f21f502, |
971 | 0xf5f4bd07, | 993 | 0xf5f4bd08, |
972 | 0xf407b521, | 994 | 0xf4080d21, |
973 | 0x01981011, | 995 | 0x01981011, |
974 | 0x0511fd40, | 996 | 0x0511fd40, |
975 | 0xf5070bf4, | 997 | 0xf5070bf4, |
976 | /* 0x0aef: ctx_xfer_no_post_mmio */ | 998 | /* 0x0b47: ctx_xfer_no_post_mmio */ |
977 | 0xf5099321, | 999 | 0xf509eb21, |
978 | /* 0x0af3: ctx_xfer_done */ | 1000 | /* 0x0b4b: ctx_xfer_done */ |
979 | 0xf807a421, | 1001 | 0xf807fc21, |
1002 | 0x00000000, | ||
1003 | 0x00000000, | ||
1004 | 0x00000000, | ||
1005 | 0x00000000, | ||
1006 | 0x00000000, | ||
1007 | 0x00000000, | ||
1008 | 0x00000000, | ||
1009 | 0x00000000, | ||
1010 | 0x00000000, | ||
1011 | 0x00000000, | ||
1012 | 0x00000000, | ||
1013 | 0x00000000, | ||
1014 | 0x00000000, | ||
1015 | 0x00000000, | ||
1016 | 0x00000000, | ||
1017 | 0x00000000, | ||
1018 | 0x00000000, | ||
1019 | 0x00000000, | ||
1020 | 0x00000000, | ||
1021 | 0x00000000, | ||
1022 | 0x00000000, | ||
1023 | 0x00000000, | ||
1024 | 0x00000000, | ||
1025 | 0x00000000, | ||
1026 | 0x00000000, | ||
1027 | 0x00000000, | ||
1028 | 0x00000000, | ||
1029 | 0x00000000, | ||
1030 | 0x00000000, | ||
1031 | 0x00000000, | ||
1032 | 0x00000000, | ||
1033 | 0x00000000, | ||
1034 | 0x00000000, | ||
1035 | 0x00000000, | ||
1036 | 0x00000000, | ||
1037 | 0x00000000, | ||
1038 | 0x00000000, | ||
1039 | 0x00000000, | ||
1040 | 0x00000000, | ||
1041 | 0x00000000, | ||
1042 | 0x00000000, | ||
1043 | 0x00000000, | ||
980 | 0x00000000, | 1044 | 0x00000000, |
981 | 0x00000000, | 1045 | 0x00000000, |
982 | 0x00000000, | 1046 | 0x00000000, |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h index 624215a005b0..62b0c7601d8b 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h | |||
@@ -528,10 +528,10 @@ uint32_t nvd7_grhub_code[] = { | |||
528 | 0x0001d001, | 528 | 0x0001d001, |
529 | 0x17f104bd, | 529 | 0x17f104bd, |
530 | 0xf7f00100, | 530 | 0xf7f00100, |
531 | 0xb521f502, | 531 | 0x0d21f502, |
532 | 0xc721f507, | 532 | 0x1f21f508, |
533 | 0x10f7f007, | 533 | 0x10f7f008, |
534 | 0x081421f5, | 534 | 0x086c21f5, |
535 | 0x98000e98, | 535 | 0x98000e98, |
536 | 0x21f5010f, | 536 | 0x21f5010f, |
537 | 0x14950150, | 537 | 0x14950150, |
@@ -574,9 +574,9 @@ uint32_t nvd7_grhub_code[] = { | |||
574 | 0xb6800040, | 574 | 0xb6800040, |
575 | 0x1bf40132, | 575 | 0x1bf40132, |
576 | 0x00f7f0be, | 576 | 0x00f7f0be, |
577 | 0x081421f5, | 577 | 0x086c21f5, |
578 | 0xf500f7f0, | 578 | 0xf500f7f0, |
579 | 0xf107b521, | 579 | 0xf1080d21, |
580 | 0xf0010007, | 580 | 0xf0010007, |
581 | 0x01d00203, | 581 | 0x01d00203, |
582 | 0xbd04bd00, | 582 | 0xbd04bd00, |
@@ -610,8 +610,8 @@ uint32_t nvd7_grhub_code[] = { | |||
610 | 0x09d00203, | 610 | 0x09d00203, |
611 | 0xf404bd00, | 611 | 0xf404bd00, |
612 | 0x31f40132, | 612 | 0x31f40132, |
613 | 0xe821f502, | 613 | 0x4021f502, |
614 | 0xf094bd09, | 614 | 0xf094bd0a, |
615 | 0x07f10799, | 615 | 0x07f10799, |
616 | 0x03f01700, | 616 | 0x03f01700, |
617 | 0x0009d002, | 617 | 0x0009d002, |
@@ -621,7 +621,7 @@ uint32_t nvd7_grhub_code[] = { | |||
621 | 0x0203f00f, | 621 | 0x0203f00f, |
622 | 0xbd0009d0, | 622 | 0xbd0009d0, |
623 | 0x0131f404, | 623 | 0x0131f404, |
624 | 0x09e821f5, | 624 | 0x0a4021f5, |
625 | 0x99f094bd, | 625 | 0x99f094bd, |
626 | 0x0007f106, | 626 | 0x0007f106, |
627 | 0x0203f017, | 627 | 0x0203f017, |
@@ -631,7 +631,7 @@ uint32_t nvd7_grhub_code[] = { | |||
631 | 0x12b920f9, | 631 | 0x12b920f9, |
632 | 0x0132f402, | 632 | 0x0132f402, |
633 | 0xf50232f4, | 633 | 0xf50232f4, |
634 | 0xfc09e821, | 634 | 0xfc0a4021, |
635 | 0x0007f120, | 635 | 0x0007f120, |
636 | 0x0203f0c0, | 636 | 0x0203f0c0, |
637 | 0xbd0002d0, | 637 | 0xbd0002d0, |
@@ -640,7 +640,7 @@ uint32_t nvd7_grhub_code[] = { | |||
640 | 0xf41f23c8, | 640 | 0xf41f23c8, |
641 | 0x31f40d0b, | 641 | 0x31f40d0b, |
642 | 0x0232f401, | 642 | 0x0232f401, |
643 | 0x09e821f5, | 643 | 0x0a4021f5, |
644 | /* 0x063c: chsw_done */ | 644 | /* 0x063c: chsw_done */ |
645 | 0xf10127f0, | 645 | 0xf10127f0, |
646 | 0xf0c30007, | 646 | 0xf0c30007, |
@@ -654,7 +654,7 @@ uint32_t nvd7_grhub_code[] = { | |||
654 | /* 0x0660: main_not_ctx_switch */ | 654 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 655 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 656 | 0xf2b90d1b, |
657 | 0x7821f502, | 657 | 0xd021f502, |
658 | 0x460ef409, | 658 | 0x460ef409, |
659 | /* 0x0670: main_not_ctx_chan */ | 659 | /* 0x0670: main_not_ctx_chan */ |
660 | 0xf402e4b0, | 660 | 0xf402e4b0, |
@@ -664,8 +664,8 @@ uint32_t nvd7_grhub_code[] = { | |||
664 | 0x09d00203, | 664 | 0x09d00203, |
665 | 0xf404bd00, | 665 | 0xf404bd00, |
666 | 0x32f40132, | 666 | 0x32f40132, |
667 | 0xe821f502, | 667 | 0x4021f502, |
668 | 0xf094bd09, | 668 | 0xf094bd0a, |
669 | 0x07f10799, | 669 | 0x07f10799, |
670 | 0x03f01700, | 670 | 0x03f01700, |
671 | 0x0009d002, | 671 | 0x0009d002, |
@@ -710,18 +710,40 @@ uint32_t nvd7_grhub_code[] = { | |||
710 | /* 0x072b: ih_no_ctxsw */ | 710 | /* 0x072b: ih_no_ctxsw */ |
711 | 0xe40421f4, | 711 | 0xe40421f4, |
712 | 0xf40400ab, | 712 | 0xf40400ab, |
713 | 0xb7f1140b, | 713 | 0xe7f16c0b, |
714 | 0xe3f00708, | ||
715 | 0x6821f440, | ||
716 | 0xf102ffb9, | ||
717 | 0xf0040007, | ||
718 | 0x0fd00203, | ||
719 | 0xf104bd00, | ||
720 | 0xf00704e7, | ||
721 | 0x21f440e3, | ||
722 | 0x02ffb968, | ||
723 | 0x030007f1, | ||
724 | 0xd00203f0, | ||
725 | 0x04bd000f, | ||
726 | 0x9450fec7, | ||
727 | 0xf7f102ee, | ||
728 | 0xf3f00700, | ||
729 | 0x00efbb40, | ||
730 | 0xf16821f4, | ||
731 | 0xf0020007, | ||
732 | 0x0fd00203, | ||
733 | 0xf004bd00, | ||
734 | 0x21f503f7, | ||
735 | 0xb7f1037e, | ||
714 | 0xbfb90100, | 736 | 0xbfb90100, |
715 | 0x44e7f102, | 737 | 0x44e7f102, |
716 | 0x40e3f001, | 738 | 0x40e3f001, |
717 | /* 0x0743: ih_no_fwmthd */ | 739 | /* 0x079b: ih_no_fwmthd */ |
718 | 0xf19d21f4, | 740 | 0xf19d21f4, |
719 | 0xbd0104b7, | 741 | 0xbd0504b7, |
720 | 0xb4abffb0, | 742 | 0xb4abffb0, |
721 | 0xf10f0bf4, | 743 | 0xf10f0bf4, |
722 | 0xf0070007, | 744 | 0xf0070007, |
723 | 0x0bd00303, | 745 | 0x0bd00303, |
724 | /* 0x075b: ih_no_other */ | 746 | /* 0x07b3: ih_no_other */ |
725 | 0xf104bd00, | 747 | 0xf104bd00, |
726 | 0xf0010007, | 748 | 0xf0010007, |
727 | 0x0ad00003, | 749 | 0x0ad00003, |
@@ -731,36 +753,36 @@ uint32_t nvd7_grhub_code[] = { | |||
731 | 0xfc90fca0, | 753 | 0xfc90fca0, |
732 | 0x0088fe80, | 754 | 0x0088fe80, |
733 | 0x32f480fc, | 755 | 0x32f480fc, |
734 | /* 0x077f: ctx_4160s */ | 756 | /* 0x07d7: ctx_4160s */ |
735 | 0xf001f800, | 757 | 0xf001f800, |
736 | 0xffb901f7, | 758 | 0xffb901f7, |
737 | 0x60e7f102, | 759 | 0x60e7f102, |
738 | 0x40e3f041, | 760 | 0x40e3f041, |
739 | /* 0x078f: ctx_4160s_wait */ | 761 | /* 0x07e7: ctx_4160s_wait */ |
740 | 0xf19d21f4, | 762 | 0xf19d21f4, |
741 | 0xf04160e7, | 763 | 0xf04160e7, |
742 | 0x21f440e3, | 764 | 0x21f440e3, |
743 | 0x02ffb968, | 765 | 0x02ffb968, |
744 | 0xf404ffc8, | 766 | 0xf404ffc8, |
745 | 0x00f8f00b, | 767 | 0x00f8f00b, |
746 | /* 0x07a4: ctx_4160c */ | 768 | /* 0x07fc: ctx_4160c */ |
747 | 0xffb9f4bd, | 769 | 0xffb9f4bd, |
748 | 0x60e7f102, | 770 | 0x60e7f102, |
749 | 0x40e3f041, | 771 | 0x40e3f041, |
750 | 0xf89d21f4, | 772 | 0xf89d21f4, |
751 | /* 0x07b5: ctx_4170s */ | 773 | /* 0x080d: ctx_4170s */ |
752 | 0x10f5f000, | 774 | 0x10f5f000, |
753 | 0xf102ffb9, | 775 | 0xf102ffb9, |
754 | 0xf04170e7, | 776 | 0xf04170e7, |
755 | 0x21f440e3, | 777 | 0x21f440e3, |
756 | /* 0x07c7: ctx_4170w */ | 778 | /* 0x081f: ctx_4170w */ |
757 | 0xf100f89d, | 779 | 0xf100f89d, |
758 | 0xf04170e7, | 780 | 0xf04170e7, |
759 | 0x21f440e3, | 781 | 0x21f440e3, |
760 | 0x02ffb968, | 782 | 0x02ffb968, |
761 | 0xf410f4f0, | 783 | 0xf410f4f0, |
762 | 0x00f8f01b, | 784 | 0x00f8f01b, |
763 | /* 0x07dc: ctx_redswitch */ | 785 | /* 0x0834: ctx_redswitch */ |
764 | 0x0200e7f1, | 786 | 0x0200e7f1, |
765 | 0xf040e5f0, | 787 | 0xf040e5f0, |
766 | 0xe5f020e5, | 788 | 0xe5f020e5, |
@@ -768,7 +790,7 @@ uint32_t nvd7_grhub_code[] = { | |||
768 | 0x0103f085, | 790 | 0x0103f085, |
769 | 0xbd000ed0, | 791 | 0xbd000ed0, |
770 | 0x08f7f004, | 792 | 0x08f7f004, |
771 | /* 0x07f8: ctx_redswitch_delay */ | 793 | /* 0x0850: ctx_redswitch_delay */ |
772 | 0xf401f2b6, | 794 | 0xf401f2b6, |
773 | 0xe5f1fd1b, | 795 | 0xe5f1fd1b, |
774 | 0xe5f10400, | 796 | 0xe5f10400, |
@@ -776,7 +798,7 @@ uint32_t nvd7_grhub_code[] = { | |||
776 | 0x03f08500, | 798 | 0x03f08500, |
777 | 0x000ed001, | 799 | 0x000ed001, |
778 | 0x00f804bd, | 800 | 0x00f804bd, |
779 | /* 0x0814: ctx_86c */ | 801 | /* 0x086c: ctx_86c */ |
780 | 0x1b0007f1, | 802 | 0x1b0007f1, |
781 | 0xd00203f0, | 803 | 0xd00203f0, |
782 | 0x04bd000f, | 804 | 0x04bd000f, |
@@ -787,16 +809,16 @@ uint32_t nvd7_grhub_code[] = { | |||
787 | 0xa86ce7f1, | 809 | 0xa86ce7f1, |
788 | 0xf441e3f0, | 810 | 0xf441e3f0, |
789 | 0x00f89d21, | 811 | 0x00f89d21, |
790 | /* 0x083c: ctx_mem */ | 812 | /* 0x0894: ctx_mem */ |
791 | 0x840007f1, | 813 | 0x840007f1, |
792 | 0xd00203f0, | 814 | 0xd00203f0, |
793 | 0x04bd000f, | 815 | 0x04bd000f, |
794 | /* 0x0848: ctx_mem_wait */ | 816 | /* 0x08a0: ctx_mem_wait */ |
795 | 0x8400f7f1, | 817 | 0x8400f7f1, |
796 | 0xcf02f3f0, | 818 | 0xcf02f3f0, |
797 | 0xfffd00ff, | 819 | 0xfffd00ff, |
798 | 0xf31bf405, | 820 | 0xf31bf405, |
799 | /* 0x085a: ctx_load */ | 821 | /* 0x08b2: ctx_load */ |
800 | 0x94bd00f8, | 822 | 0x94bd00f8, |
801 | 0xf10599f0, | 823 | 0xf10599f0, |
802 | 0xf00f0007, | 824 | 0xf00f0007, |
@@ -814,7 +836,7 @@ uint32_t nvd7_grhub_code[] = { | |||
814 | 0x02d00203, | 836 | 0x02d00203, |
815 | 0xf004bd00, | 837 | 0xf004bd00, |
816 | 0x21f507f7, | 838 | 0x21f507f7, |
817 | 0x07f1083c, | 839 | 0x07f10894, |
818 | 0x03f0c000, | 840 | 0x03f0c000, |
819 | 0x0002d002, | 841 | 0x0002d002, |
820 | 0x0bfe04bd, | 842 | 0x0bfe04bd, |
@@ -869,31 +891,31 @@ uint32_t nvd7_grhub_code[] = { | |||
869 | 0x03f01700, | 891 | 0x03f01700, |
870 | 0x0009d002, | 892 | 0x0009d002, |
871 | 0x00f804bd, | 893 | 0x00f804bd, |
872 | /* 0x0978: ctx_chan */ | 894 | /* 0x09d0: ctx_chan */ |
873 | 0x077f21f5, | 895 | 0x07d721f5, |
874 | 0x085a21f5, | 896 | 0x08b221f5, |
875 | 0xf40ca7f0, | 897 | 0xf40ca7f0, |
876 | 0xf7f0d021, | 898 | 0xf7f0d021, |
877 | 0x3c21f505, | 899 | 0x9421f505, |
878 | 0xa421f508, | 900 | 0xfc21f508, |
879 | /* 0x0993: ctx_mmio_exec */ | 901 | /* 0x09eb: ctx_mmio_exec */ |
880 | 0x9800f807, | 902 | 0x9800f807, |
881 | 0x07f14103, | 903 | 0x07f14103, |
882 | 0x03f08100, | 904 | 0x03f08100, |
883 | 0x0003d002, | 905 | 0x0003d002, |
884 | 0x34bd04bd, | 906 | 0x34bd04bd, |
885 | /* 0x09a4: ctx_mmio_loop */ | 907 | /* 0x09fc: ctx_mmio_loop */ |
886 | 0xf4ff34c4, | 908 | 0xf4ff34c4, |
887 | 0x57f10f1b, | 909 | 0x57f10f1b, |
888 | 0x53f00200, | 910 | 0x53f00200, |
889 | 0x0535fa06, | 911 | 0x0535fa06, |
890 | /* 0x09b6: ctx_mmio_pull */ | 912 | /* 0x0a0e: ctx_mmio_pull */ |
891 | 0x4e9803f8, | 913 | 0x4e9803f8, |
892 | 0x814f9880, | 914 | 0x814f9880, |
893 | 0xb69d21f4, | 915 | 0xb69d21f4, |
894 | 0x12b60830, | 916 | 0x12b60830, |
895 | 0xdf1bf401, | 917 | 0xdf1bf401, |
896 | /* 0x09c8: ctx_mmio_done */ | 918 | /* 0x0a20: ctx_mmio_done */ |
897 | 0xf1160398, | 919 | 0xf1160398, |
898 | 0xf0810007, | 920 | 0xf0810007, |
899 | 0x03d00203, | 921 | 0x03d00203, |
@@ -902,30 +924,30 @@ uint32_t nvd7_grhub_code[] = { | |||
902 | 0x13f00100, | 924 | 0x13f00100, |
903 | 0x0601fa06, | 925 | 0x0601fa06, |
904 | 0x00f803f8, | 926 | 0x00f803f8, |
905 | /* 0x09e8: ctx_xfer */ | 927 | /* 0x0a40: ctx_xfer */ |
906 | 0xf104e7f0, | 928 | 0xf104e7f0, |
907 | 0xf0020007, | 929 | 0xf0020007, |
908 | 0x0ed00303, | 930 | 0x0ed00303, |
909 | /* 0x09f7: ctx_xfer_idle */ | 931 | /* 0x0a4f: ctx_xfer_idle */ |
910 | 0xf104bd00, | 932 | 0xf104bd00, |
911 | 0xf00000e7, | 933 | 0xf00000e7, |
912 | 0xeecf03e3, | 934 | 0xeecf03e3, |
913 | 0x00e4f100, | 935 | 0x00e4f100, |
914 | 0xf21bf420, | 936 | 0xf21bf420, |
915 | 0xf40611f4, | 937 | 0xf40611f4, |
916 | /* 0x0a0e: ctx_xfer_pre */ | 938 | /* 0x0a66: ctx_xfer_pre */ |
917 | 0xf7f01102, | 939 | 0xf7f01102, |
918 | 0x1421f510, | 940 | 0x6c21f510, |
919 | 0x7f21f508, | 941 | 0xd721f508, |
920 | 0x1c11f407, | 942 | 0x1c11f407, |
921 | /* 0x0a1c: ctx_xfer_pre_load */ | 943 | /* 0x0a74: ctx_xfer_pre_load */ |
922 | 0xf502f7f0, | 944 | 0xf502f7f0, |
923 | 0xf507b521, | 945 | 0xf5080d21, |
924 | 0xf507c721, | 946 | 0xf5081f21, |
925 | 0xbd07dc21, | 947 | 0xbd083421, |
926 | 0xb521f5f4, | 948 | 0x0d21f5f4, |
927 | 0x5a21f507, | 949 | 0xb221f508, |
928 | /* 0x0a35: ctx_xfer_exec */ | 950 | /* 0x0a8d: ctx_xfer_exec */ |
929 | 0x16019808, | 951 | 0x16019808, |
930 | 0x07f124bd, | 952 | 0x07f124bd, |
931 | 0x03f00500, | 953 | 0x03f00500, |
@@ -960,23 +982,65 @@ uint32_t nvd7_grhub_code[] = { | |||
960 | 0x1301f402, | 982 | 0x1301f402, |
961 | 0xf40ca7f0, | 983 | 0xf40ca7f0, |
962 | 0xf7f0d021, | 984 | 0xf7f0d021, |
963 | 0x3c21f505, | 985 | 0x9421f505, |
964 | 0x3202f408, | 986 | 0x3202f408, |
965 | /* 0x0ac4: ctx_xfer_post */ | 987 | /* 0x0b1c: ctx_xfer_post */ |
966 | 0xf502f7f0, | 988 | 0xf502f7f0, |
967 | 0xbd07b521, | 989 | 0xbd080d21, |
968 | 0x1421f5f4, | 990 | 0x6c21f5f4, |
969 | 0x7f21f508, | 991 | 0x7f21f508, |
970 | 0xc721f502, | 992 | 0x1f21f502, |
971 | 0xf5f4bd07, | 993 | 0xf5f4bd08, |
972 | 0xf407b521, | 994 | 0xf4080d21, |
973 | 0x01981011, | 995 | 0x01981011, |
974 | 0x0511fd40, | 996 | 0x0511fd40, |
975 | 0xf5070bf4, | 997 | 0xf5070bf4, |
976 | /* 0x0aef: ctx_xfer_no_post_mmio */ | 998 | /* 0x0b47: ctx_xfer_no_post_mmio */ |
977 | 0xf5099321, | 999 | 0xf509eb21, |
978 | /* 0x0af3: ctx_xfer_done */ | 1000 | /* 0x0b4b: ctx_xfer_done */ |
979 | 0xf807a421, | 1001 | 0xf807fc21, |
1002 | 0x00000000, | ||
1003 | 0x00000000, | ||
1004 | 0x00000000, | ||
1005 | 0x00000000, | ||
1006 | 0x00000000, | ||
1007 | 0x00000000, | ||
1008 | 0x00000000, | ||
1009 | 0x00000000, | ||
1010 | 0x00000000, | ||
1011 | 0x00000000, | ||
1012 | 0x00000000, | ||
1013 | 0x00000000, | ||
1014 | 0x00000000, | ||
1015 | 0x00000000, | ||
1016 | 0x00000000, | ||
1017 | 0x00000000, | ||
1018 | 0x00000000, | ||
1019 | 0x00000000, | ||
1020 | 0x00000000, | ||
1021 | 0x00000000, | ||
1022 | 0x00000000, | ||
1023 | 0x00000000, | ||
1024 | 0x00000000, | ||
1025 | 0x00000000, | ||
1026 | 0x00000000, | ||
1027 | 0x00000000, | ||
1028 | 0x00000000, | ||
1029 | 0x00000000, | ||
1030 | 0x00000000, | ||
1031 | 0x00000000, | ||
1032 | 0x00000000, | ||
1033 | 0x00000000, | ||
1034 | 0x00000000, | ||
1035 | 0x00000000, | ||
1036 | 0x00000000, | ||
1037 | 0x00000000, | ||
1038 | 0x00000000, | ||
1039 | 0x00000000, | ||
1040 | 0x00000000, | ||
1041 | 0x00000000, | ||
1042 | 0x00000000, | ||
1043 | 0x00000000, | ||
980 | 0x00000000, | 1044 | 0x00000000, |
981 | 0x00000000, | 1045 | 0x00000000, |
982 | 0x00000000, | 1046 | 0x00000000, |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h index 6547b3dfc7ed..51c3797d8537 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h | |||
@@ -528,10 +528,10 @@ uint32_t nve0_grhub_code[] = { | |||
528 | 0x0001d001, | 528 | 0x0001d001, |
529 | 0x17f104bd, | 529 | 0x17f104bd, |
530 | 0xf7f00100, | 530 | 0xf7f00100, |
531 | 0x7f21f502, | 531 | 0xd721f502, |
532 | 0x9121f507, | 532 | 0xe921f507, |
533 | 0x10f7f007, | 533 | 0x10f7f007, |
534 | 0x07de21f5, | 534 | 0x083621f5, |
535 | 0x98000e98, | 535 | 0x98000e98, |
536 | 0x21f5010f, | 536 | 0x21f5010f, |
537 | 0x14950150, | 537 | 0x14950150, |
@@ -574,9 +574,9 @@ uint32_t nve0_grhub_code[] = { | |||
574 | 0xb6800040, | 574 | 0xb6800040, |
575 | 0x1bf40132, | 575 | 0x1bf40132, |
576 | 0x00f7f0be, | 576 | 0x00f7f0be, |
577 | 0x07de21f5, | 577 | 0x083621f5, |
578 | 0xf500f7f0, | 578 | 0xf500f7f0, |
579 | 0xf1077f21, | 579 | 0xf107d721, |
580 | 0xf0010007, | 580 | 0xf0010007, |
581 | 0x01d00203, | 581 | 0x01d00203, |
582 | 0xbd04bd00, | 582 | 0xbd04bd00, |
@@ -610,8 +610,8 @@ uint32_t nve0_grhub_code[] = { | |||
610 | 0x09d00203, | 610 | 0x09d00203, |
611 | 0xf404bd00, | 611 | 0xf404bd00, |
612 | 0x31f40132, | 612 | 0x31f40132, |
613 | 0xaa21f502, | 613 | 0x0221f502, |
614 | 0xf094bd09, | 614 | 0xf094bd0a, |
615 | 0x07f10799, | 615 | 0x07f10799, |
616 | 0x03f01700, | 616 | 0x03f01700, |
617 | 0x0009d002, | 617 | 0x0009d002, |
@@ -621,7 +621,7 @@ uint32_t nve0_grhub_code[] = { | |||
621 | 0x0203f00f, | 621 | 0x0203f00f, |
622 | 0xbd0009d0, | 622 | 0xbd0009d0, |
623 | 0x0131f404, | 623 | 0x0131f404, |
624 | 0x09aa21f5, | 624 | 0x0a0221f5, |
625 | 0x99f094bd, | 625 | 0x99f094bd, |
626 | 0x0007f106, | 626 | 0x0007f106, |
627 | 0x0203f017, | 627 | 0x0203f017, |
@@ -631,7 +631,7 @@ uint32_t nve0_grhub_code[] = { | |||
631 | 0x12b920f9, | 631 | 0x12b920f9, |
632 | 0x0132f402, | 632 | 0x0132f402, |
633 | 0xf50232f4, | 633 | 0xf50232f4, |
634 | 0xfc09aa21, | 634 | 0xfc0a0221, |
635 | 0x0007f120, | 635 | 0x0007f120, |
636 | 0x0203f0c0, | 636 | 0x0203f0c0, |
637 | 0xbd0002d0, | 637 | 0xbd0002d0, |
@@ -640,7 +640,7 @@ uint32_t nve0_grhub_code[] = { | |||
640 | 0xf41f23c8, | 640 | 0xf41f23c8, |
641 | 0x31f40d0b, | 641 | 0x31f40d0b, |
642 | 0x0232f401, | 642 | 0x0232f401, |
643 | 0x09aa21f5, | 643 | 0x0a0221f5, |
644 | /* 0x063c: chsw_done */ | 644 | /* 0x063c: chsw_done */ |
645 | 0xf10127f0, | 645 | 0xf10127f0, |
646 | 0xf0c30007, | 646 | 0xf0c30007, |
@@ -654,7 +654,7 @@ uint32_t nve0_grhub_code[] = { | |||
654 | /* 0x0660: main_not_ctx_switch */ | 654 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 655 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 656 | 0xf2b90d1b, |
657 | 0x4221f502, | 657 | 0x9a21f502, |
658 | 0x460ef409, | 658 | 0x460ef409, |
659 | /* 0x0670: main_not_ctx_chan */ | 659 | /* 0x0670: main_not_ctx_chan */ |
660 | 0xf402e4b0, | 660 | 0xf402e4b0, |
@@ -664,8 +664,8 @@ uint32_t nve0_grhub_code[] = { | |||
664 | 0x09d00203, | 664 | 0x09d00203, |
665 | 0xf404bd00, | 665 | 0xf404bd00, |
666 | 0x32f40132, | 666 | 0x32f40132, |
667 | 0xaa21f502, | 667 | 0x0221f502, |
668 | 0xf094bd09, | 668 | 0xf094bd0a, |
669 | 0x07f10799, | 669 | 0x07f10799, |
670 | 0x03f01700, | 670 | 0x03f01700, |
671 | 0x0009d002, | 671 | 0x0009d002, |
@@ -710,18 +710,40 @@ uint32_t nve0_grhub_code[] = { | |||
710 | /* 0x072b: ih_no_ctxsw */ | 710 | /* 0x072b: ih_no_ctxsw */ |
711 | 0xe40421f4, | 711 | 0xe40421f4, |
712 | 0xf40400ab, | 712 | 0xf40400ab, |
713 | 0xb7f1140b, | 713 | 0xe7f16c0b, |
714 | 0xe3f00708, | ||
715 | 0x6821f440, | ||
716 | 0xf102ffb9, | ||
717 | 0xf0040007, | ||
718 | 0x0fd00203, | ||
719 | 0xf104bd00, | ||
720 | 0xf00704e7, | ||
721 | 0x21f440e3, | ||
722 | 0x02ffb968, | ||
723 | 0x030007f1, | ||
724 | 0xd00203f0, | ||
725 | 0x04bd000f, | ||
726 | 0x9450fec7, | ||
727 | 0xf7f102ee, | ||
728 | 0xf3f00700, | ||
729 | 0x00efbb40, | ||
730 | 0xf16821f4, | ||
731 | 0xf0020007, | ||
732 | 0x0fd00203, | ||
733 | 0xf004bd00, | ||
734 | 0x21f503f7, | ||
735 | 0xb7f1037e, | ||
714 | 0xbfb90100, | 736 | 0xbfb90100, |
715 | 0x44e7f102, | 737 | 0x44e7f102, |
716 | 0x40e3f001, | 738 | 0x40e3f001, |
717 | /* 0x0743: ih_no_fwmthd */ | 739 | /* 0x079b: ih_no_fwmthd */ |
718 | 0xf19d21f4, | 740 | 0xf19d21f4, |
719 | 0xbd0104b7, | 741 | 0xbd0504b7, |
720 | 0xb4abffb0, | 742 | 0xb4abffb0, |
721 | 0xf10f0bf4, | 743 | 0xf10f0bf4, |
722 | 0xf0070007, | 744 | 0xf0070007, |
723 | 0x0bd00303, | 745 | 0x0bd00303, |
724 | /* 0x075b: ih_no_other */ | 746 | /* 0x07b3: ih_no_other */ |
725 | 0xf104bd00, | 747 | 0xf104bd00, |
726 | 0xf0010007, | 748 | 0xf0010007, |
727 | 0x0ad00003, | 749 | 0x0ad00003, |
@@ -731,19 +753,19 @@ uint32_t nve0_grhub_code[] = { | |||
731 | 0xfc90fca0, | 753 | 0xfc90fca0, |
732 | 0x0088fe80, | 754 | 0x0088fe80, |
733 | 0x32f480fc, | 755 | 0x32f480fc, |
734 | /* 0x077f: ctx_4170s */ | 756 | /* 0x07d7: ctx_4170s */ |
735 | 0xf001f800, | 757 | 0xf001f800, |
736 | 0xffb910f5, | 758 | 0xffb910f5, |
737 | 0x70e7f102, | 759 | 0x70e7f102, |
738 | 0x40e3f041, | 760 | 0x40e3f041, |
739 | 0xf89d21f4, | 761 | 0xf89d21f4, |
740 | /* 0x0791: ctx_4170w */ | 762 | /* 0x07e9: ctx_4170w */ |
741 | 0x70e7f100, | 763 | 0x70e7f100, |
742 | 0x40e3f041, | 764 | 0x40e3f041, |
743 | 0xb96821f4, | 765 | 0xb96821f4, |
744 | 0xf4f002ff, | 766 | 0xf4f002ff, |
745 | 0xf01bf410, | 767 | 0xf01bf410, |
746 | /* 0x07a6: ctx_redswitch */ | 768 | /* 0x07fe: ctx_redswitch */ |
747 | 0xe7f100f8, | 769 | 0xe7f100f8, |
748 | 0xe5f00200, | 770 | 0xe5f00200, |
749 | 0x20e5f040, | 771 | 0x20e5f040, |
@@ -751,7 +773,7 @@ uint32_t nve0_grhub_code[] = { | |||
751 | 0xf0850007, | 773 | 0xf0850007, |
752 | 0x0ed00103, | 774 | 0x0ed00103, |
753 | 0xf004bd00, | 775 | 0xf004bd00, |
754 | /* 0x07c2: ctx_redswitch_delay */ | 776 | /* 0x081a: ctx_redswitch_delay */ |
755 | 0xf2b608f7, | 777 | 0xf2b608f7, |
756 | 0xfd1bf401, | 778 | 0xfd1bf401, |
757 | 0x0400e5f1, | 779 | 0x0400e5f1, |
@@ -759,7 +781,7 @@ uint32_t nve0_grhub_code[] = { | |||
759 | 0x850007f1, | 781 | 0x850007f1, |
760 | 0xd00103f0, | 782 | 0xd00103f0, |
761 | 0x04bd000e, | 783 | 0x04bd000e, |
762 | /* 0x07de: ctx_86c */ | 784 | /* 0x0836: ctx_86c */ |
763 | 0x07f100f8, | 785 | 0x07f100f8, |
764 | 0x03f01b00, | 786 | 0x03f01b00, |
765 | 0x000fd002, | 787 | 0x000fd002, |
@@ -770,17 +792,17 @@ uint32_t nve0_grhub_code[] = { | |||
770 | 0xe7f102ff, | 792 | 0xe7f102ff, |
771 | 0xe3f0a86c, | 793 | 0xe3f0a86c, |
772 | 0x9d21f441, | 794 | 0x9d21f441, |
773 | /* 0x0806: ctx_mem */ | 795 | /* 0x085e: ctx_mem */ |
774 | 0x07f100f8, | 796 | 0x07f100f8, |
775 | 0x03f08400, | 797 | 0x03f08400, |
776 | 0x000fd002, | 798 | 0x000fd002, |
777 | /* 0x0812: ctx_mem_wait */ | 799 | /* 0x086a: ctx_mem_wait */ |
778 | 0xf7f104bd, | 800 | 0xf7f104bd, |
779 | 0xf3f08400, | 801 | 0xf3f08400, |
780 | 0x00ffcf02, | 802 | 0x00ffcf02, |
781 | 0xf405fffd, | 803 | 0xf405fffd, |
782 | 0x00f8f31b, | 804 | 0x00f8f31b, |
783 | /* 0x0824: ctx_load */ | 805 | /* 0x087c: ctx_load */ |
784 | 0x99f094bd, | 806 | 0x99f094bd, |
785 | 0x0007f105, | 807 | 0x0007f105, |
786 | 0x0203f00f, | 808 | 0x0203f00f, |
@@ -797,7 +819,7 @@ uint32_t nve0_grhub_code[] = { | |||
797 | 0x0203f083, | 819 | 0x0203f083, |
798 | 0xbd0002d0, | 820 | 0xbd0002d0, |
799 | 0x07f7f004, | 821 | 0x07f7f004, |
800 | 0x080621f5, | 822 | 0x085e21f5, |
801 | 0xc00007f1, | 823 | 0xc00007f1, |
802 | 0xd00203f0, | 824 | 0xd00203f0, |
803 | 0x04bd0002, | 825 | 0x04bd0002, |
@@ -852,29 +874,29 @@ uint32_t nve0_grhub_code[] = { | |||
852 | 0x170007f1, | 874 | 0x170007f1, |
853 | 0xd00203f0, | 875 | 0xd00203f0, |
854 | 0x04bd0009, | 876 | 0x04bd0009, |
855 | /* 0x0942: ctx_chan */ | 877 | /* 0x099a: ctx_chan */ |
856 | 0x21f500f8, | 878 | 0x21f500f8, |
857 | 0xa7f00824, | 879 | 0xa7f0087c, |
858 | 0xd021f40c, | 880 | 0xd021f40c, |
859 | 0xf505f7f0, | 881 | 0xf505f7f0, |
860 | 0xf8080621, | 882 | 0xf8085e21, |
861 | /* 0x0955: ctx_mmio_exec */ | 883 | /* 0x09ad: ctx_mmio_exec */ |
862 | 0x41039800, | 884 | 0x41039800, |
863 | 0x810007f1, | 885 | 0x810007f1, |
864 | 0xd00203f0, | 886 | 0xd00203f0, |
865 | 0x04bd0003, | 887 | 0x04bd0003, |
866 | /* 0x0966: ctx_mmio_loop */ | 888 | /* 0x09be: ctx_mmio_loop */ |
867 | 0x34c434bd, | 889 | 0x34c434bd, |
868 | 0x0f1bf4ff, | 890 | 0x0f1bf4ff, |
869 | 0x020057f1, | 891 | 0x020057f1, |
870 | 0xfa0653f0, | 892 | 0xfa0653f0, |
871 | 0x03f80535, | 893 | 0x03f80535, |
872 | /* 0x0978: ctx_mmio_pull */ | 894 | /* 0x09d0: ctx_mmio_pull */ |
873 | 0x98804e98, | 895 | 0x98804e98, |
874 | 0x21f4814f, | 896 | 0x21f4814f, |
875 | 0x0830b69d, | 897 | 0x0830b69d, |
876 | 0xf40112b6, | 898 | 0xf40112b6, |
877 | /* 0x098a: ctx_mmio_done */ | 899 | /* 0x09e2: ctx_mmio_done */ |
878 | 0x0398df1b, | 900 | 0x0398df1b, |
879 | 0x0007f116, | 901 | 0x0007f116, |
880 | 0x0203f081, | 902 | 0x0203f081, |
@@ -883,30 +905,30 @@ uint32_t nve0_grhub_code[] = { | |||
883 | 0x010017f1, | 905 | 0x010017f1, |
884 | 0xfa0613f0, | 906 | 0xfa0613f0, |
885 | 0x03f80601, | 907 | 0x03f80601, |
886 | /* 0x09aa: ctx_xfer */ | 908 | /* 0x0a02: ctx_xfer */ |
887 | 0xe7f000f8, | 909 | 0xe7f000f8, |
888 | 0x0007f104, | 910 | 0x0007f104, |
889 | 0x0303f002, | 911 | 0x0303f002, |
890 | 0xbd000ed0, | 912 | 0xbd000ed0, |
891 | /* 0x09b9: ctx_xfer_idle */ | 913 | /* 0x0a11: ctx_xfer_idle */ |
892 | 0x00e7f104, | 914 | 0x00e7f104, |
893 | 0x03e3f000, | 915 | 0x03e3f000, |
894 | 0xf100eecf, | 916 | 0xf100eecf, |
895 | 0xf42000e4, | 917 | 0xf42000e4, |
896 | 0x11f4f21b, | 918 | 0x11f4f21b, |
897 | 0x0d02f406, | 919 | 0x0d02f406, |
898 | /* 0x09d0: ctx_xfer_pre */ | 920 | /* 0x0a28: ctx_xfer_pre */ |
899 | 0xf510f7f0, | 921 | 0xf510f7f0, |
900 | 0xf407de21, | 922 | 0xf4083621, |
901 | /* 0x09da: ctx_xfer_pre_load */ | 923 | /* 0x0a32: ctx_xfer_pre_load */ |
902 | 0xf7f01c11, | 924 | 0xf7f01c11, |
903 | 0x7f21f502, | 925 | 0xd721f502, |
904 | 0x9121f507, | 926 | 0xe921f507, |
905 | 0xa621f507, | 927 | 0xfe21f507, |
906 | 0xf5f4bd07, | 928 | 0xf5f4bd07, |
907 | 0xf5077f21, | 929 | 0xf507d721, |
908 | /* 0x09f3: ctx_xfer_exec */ | 930 | /* 0x0a4b: ctx_xfer_exec */ |
909 | 0x98082421, | 931 | 0x98087c21, |
910 | 0x24bd1601, | 932 | 0x24bd1601, |
911 | 0x050007f1, | 933 | 0x050007f1, |
912 | 0xd00103f0, | 934 | 0xd00103f0, |
@@ -941,21 +963,21 @@ uint32_t nve0_grhub_code[] = { | |||
941 | 0xa7f01301, | 963 | 0xa7f01301, |
942 | 0xd021f40c, | 964 | 0xd021f40c, |
943 | 0xf505f7f0, | 965 | 0xf505f7f0, |
944 | 0xf4080621, | 966 | 0xf4085e21, |
945 | /* 0x0a82: ctx_xfer_post */ | 967 | /* 0x0ada: ctx_xfer_post */ |
946 | 0xf7f02e02, | 968 | 0xf7f02e02, |
947 | 0x7f21f502, | 969 | 0xd721f502, |
948 | 0xf5f4bd07, | 970 | 0xf5f4bd07, |
949 | 0xf507de21, | 971 | 0xf5083621, |
950 | 0xf5027f21, | 972 | 0xf5027f21, |
951 | 0xbd079121, | 973 | 0xbd07e921, |
952 | 0x7f21f5f4, | 974 | 0xd721f5f4, |
953 | 0x1011f407, | 975 | 0x1011f407, |
954 | 0xfd400198, | 976 | 0xfd400198, |
955 | 0x0bf40511, | 977 | 0x0bf40511, |
956 | 0x5521f507, | 978 | 0xad21f507, |
957 | /* 0x0aad: ctx_xfer_no_post_mmio */ | 979 | /* 0x0b05: ctx_xfer_no_post_mmio */ |
958 | /* 0x0aad: ctx_xfer_done */ | 980 | /* 0x0b05: ctx_xfer_done */ |
959 | 0x0000f809, | 981 | 0x0000f809, |
960 | 0x00000000, | 982 | 0x00000000, |
961 | 0x00000000, | 983 | 0x00000000, |
@@ -977,4 +999,46 @@ uint32_t nve0_grhub_code[] = { | |||
977 | 0x00000000, | 999 | 0x00000000, |
978 | 0x00000000, | 1000 | 0x00000000, |
979 | 0x00000000, | 1001 | 0x00000000, |
1002 | 0x00000000, | ||
1003 | 0x00000000, | ||
1004 | 0x00000000, | ||
1005 | 0x00000000, | ||
1006 | 0x00000000, | ||
1007 | 0x00000000, | ||
1008 | 0x00000000, | ||
1009 | 0x00000000, | ||
1010 | 0x00000000, | ||
1011 | 0x00000000, | ||
1012 | 0x00000000, | ||
1013 | 0x00000000, | ||
1014 | 0x00000000, | ||
1015 | 0x00000000, | ||
1016 | 0x00000000, | ||
1017 | 0x00000000, | ||
1018 | 0x00000000, | ||
1019 | 0x00000000, | ||
1020 | 0x00000000, | ||
1021 | 0x00000000, | ||
1022 | 0x00000000, | ||
1023 | 0x00000000, | ||
1024 | 0x00000000, | ||
1025 | 0x00000000, | ||
1026 | 0x00000000, | ||
1027 | 0x00000000, | ||
1028 | 0x00000000, | ||
1029 | 0x00000000, | ||
1030 | 0x00000000, | ||
1031 | 0x00000000, | ||
1032 | 0x00000000, | ||
1033 | 0x00000000, | ||
1034 | 0x00000000, | ||
1035 | 0x00000000, | ||
1036 | 0x00000000, | ||
1037 | 0x00000000, | ||
1038 | 0x00000000, | ||
1039 | 0x00000000, | ||
1040 | 0x00000000, | ||
1041 | 0x00000000, | ||
1042 | 0x00000000, | ||
1043 | 0x00000000, | ||
980 | }; | 1044 | }; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h index a5aee5a4302f..a0af4b703a8e 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h | |||
@@ -528,10 +528,10 @@ uint32_t nvf0_grhub_code[] = { | |||
528 | 0x0001d001, | 528 | 0x0001d001, |
529 | 0x17f104bd, | 529 | 0x17f104bd, |
530 | 0xf7f00100, | 530 | 0xf7f00100, |
531 | 0x7f21f502, | 531 | 0xd721f502, |
532 | 0x9121f507, | 532 | 0xe921f507, |
533 | 0x10f7f007, | 533 | 0x10f7f007, |
534 | 0x07de21f5, | 534 | 0x083621f5, |
535 | 0x98000e98, | 535 | 0x98000e98, |
536 | 0x21f5010f, | 536 | 0x21f5010f, |
537 | 0x14950150, | 537 | 0x14950150, |
@@ -574,9 +574,9 @@ uint32_t nvf0_grhub_code[] = { | |||
574 | 0xb6800040, | 574 | 0xb6800040, |
575 | 0x1bf40132, | 575 | 0x1bf40132, |
576 | 0x00f7f0be, | 576 | 0x00f7f0be, |
577 | 0x07de21f5, | 577 | 0x083621f5, |
578 | 0xf500f7f0, | 578 | 0xf500f7f0, |
579 | 0xf1077f21, | 579 | 0xf107d721, |
580 | 0xf0010007, | 580 | 0xf0010007, |
581 | 0x01d00203, | 581 | 0x01d00203, |
582 | 0xbd04bd00, | 582 | 0xbd04bd00, |
@@ -610,8 +610,8 @@ uint32_t nvf0_grhub_code[] = { | |||
610 | 0x09d00203, | 610 | 0x09d00203, |
611 | 0xf404bd00, | 611 | 0xf404bd00, |
612 | 0x31f40132, | 612 | 0x31f40132, |
613 | 0xaa21f502, | 613 | 0x0221f502, |
614 | 0xf094bd09, | 614 | 0xf094bd0a, |
615 | 0x07f10799, | 615 | 0x07f10799, |
616 | 0x03f01700, | 616 | 0x03f01700, |
617 | 0x0009d002, | 617 | 0x0009d002, |
@@ -621,7 +621,7 @@ uint32_t nvf0_grhub_code[] = { | |||
621 | 0x0203f037, | 621 | 0x0203f037, |
622 | 0xbd0009d0, | 622 | 0xbd0009d0, |
623 | 0x0131f404, | 623 | 0x0131f404, |
624 | 0x09aa21f5, | 624 | 0x0a0221f5, |
625 | 0x99f094bd, | 625 | 0x99f094bd, |
626 | 0x0007f106, | 626 | 0x0007f106, |
627 | 0x0203f017, | 627 | 0x0203f017, |
@@ -631,7 +631,7 @@ uint32_t nvf0_grhub_code[] = { | |||
631 | 0x12b920f9, | 631 | 0x12b920f9, |
632 | 0x0132f402, | 632 | 0x0132f402, |
633 | 0xf50232f4, | 633 | 0xf50232f4, |
634 | 0xfc09aa21, | 634 | 0xfc0a0221, |
635 | 0x0007f120, | 635 | 0x0007f120, |
636 | 0x0203f0c0, | 636 | 0x0203f0c0, |
637 | 0xbd0002d0, | 637 | 0xbd0002d0, |
@@ -640,7 +640,7 @@ uint32_t nvf0_grhub_code[] = { | |||
640 | 0xf41f23c8, | 640 | 0xf41f23c8, |
641 | 0x31f40d0b, | 641 | 0x31f40d0b, |
642 | 0x0232f401, | 642 | 0x0232f401, |
643 | 0x09aa21f5, | 643 | 0x0a0221f5, |
644 | /* 0x063c: chsw_done */ | 644 | /* 0x063c: chsw_done */ |
645 | 0xf10127f0, | 645 | 0xf10127f0, |
646 | 0xf0c30007, | 646 | 0xf0c30007, |
@@ -654,7 +654,7 @@ uint32_t nvf0_grhub_code[] = { | |||
654 | /* 0x0660: main_not_ctx_switch */ | 654 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 655 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 656 | 0xf2b90d1b, |
657 | 0x4221f502, | 657 | 0x9a21f502, |
658 | 0x460ef409, | 658 | 0x460ef409, |
659 | /* 0x0670: main_not_ctx_chan */ | 659 | /* 0x0670: main_not_ctx_chan */ |
660 | 0xf402e4b0, | 660 | 0xf402e4b0, |
@@ -664,8 +664,8 @@ uint32_t nvf0_grhub_code[] = { | |||
664 | 0x09d00203, | 664 | 0x09d00203, |
665 | 0xf404bd00, | 665 | 0xf404bd00, |
666 | 0x32f40132, | 666 | 0x32f40132, |
667 | 0xaa21f502, | 667 | 0x0221f502, |
668 | 0xf094bd09, | 668 | 0xf094bd0a, |
669 | 0x07f10799, | 669 | 0x07f10799, |
670 | 0x03f01700, | 670 | 0x03f01700, |
671 | 0x0009d002, | 671 | 0x0009d002, |
@@ -710,18 +710,40 @@ uint32_t nvf0_grhub_code[] = { | |||
710 | /* 0x072b: ih_no_ctxsw */ | 710 | /* 0x072b: ih_no_ctxsw */ |
711 | 0xe40421f4, | 711 | 0xe40421f4, |
712 | 0xf40400ab, | 712 | 0xf40400ab, |
713 | 0xb7f1140b, | 713 | 0xe7f16c0b, |
714 | 0xe3f00708, | ||
715 | 0x6821f440, | ||
716 | 0xf102ffb9, | ||
717 | 0xf0040007, | ||
718 | 0x0fd00203, | ||
719 | 0xf104bd00, | ||
720 | 0xf00704e7, | ||
721 | 0x21f440e3, | ||
722 | 0x02ffb968, | ||
723 | 0x030007f1, | ||
724 | 0xd00203f0, | ||
725 | 0x04bd000f, | ||
726 | 0x9450fec7, | ||
727 | 0xf7f102ee, | ||
728 | 0xf3f00700, | ||
729 | 0x00efbb40, | ||
730 | 0xf16821f4, | ||
731 | 0xf0020007, | ||
732 | 0x0fd00203, | ||
733 | 0xf004bd00, | ||
734 | 0x21f503f7, | ||
735 | 0xb7f1037e, | ||
714 | 0xbfb90100, | 736 | 0xbfb90100, |
715 | 0x44e7f102, | 737 | 0x44e7f102, |
716 | 0x40e3f001, | 738 | 0x40e3f001, |
717 | /* 0x0743: ih_no_fwmthd */ | 739 | /* 0x079b: ih_no_fwmthd */ |
718 | 0xf19d21f4, | 740 | 0xf19d21f4, |
719 | 0xbd0104b7, | 741 | 0xbd0504b7, |
720 | 0xb4abffb0, | 742 | 0xb4abffb0, |
721 | 0xf10f0bf4, | 743 | 0xf10f0bf4, |
722 | 0xf0070007, | 744 | 0xf0070007, |
723 | 0x0bd00303, | 745 | 0x0bd00303, |
724 | /* 0x075b: ih_no_other */ | 746 | /* 0x07b3: ih_no_other */ |
725 | 0xf104bd00, | 747 | 0xf104bd00, |
726 | 0xf0010007, | 748 | 0xf0010007, |
727 | 0x0ad00003, | 749 | 0x0ad00003, |
@@ -731,19 +753,19 @@ uint32_t nvf0_grhub_code[] = { | |||
731 | 0xfc90fca0, | 753 | 0xfc90fca0, |
732 | 0x0088fe80, | 754 | 0x0088fe80, |
733 | 0x32f480fc, | 755 | 0x32f480fc, |
734 | /* 0x077f: ctx_4170s */ | 756 | /* 0x07d7: ctx_4170s */ |
735 | 0xf001f800, | 757 | 0xf001f800, |
736 | 0xffb910f5, | 758 | 0xffb910f5, |
737 | 0x70e7f102, | 759 | 0x70e7f102, |
738 | 0x40e3f041, | 760 | 0x40e3f041, |
739 | 0xf89d21f4, | 761 | 0xf89d21f4, |
740 | /* 0x0791: ctx_4170w */ | 762 | /* 0x07e9: ctx_4170w */ |
741 | 0x70e7f100, | 763 | 0x70e7f100, |
742 | 0x40e3f041, | 764 | 0x40e3f041, |
743 | 0xb96821f4, | 765 | 0xb96821f4, |
744 | 0xf4f002ff, | 766 | 0xf4f002ff, |
745 | 0xf01bf410, | 767 | 0xf01bf410, |
746 | /* 0x07a6: ctx_redswitch */ | 768 | /* 0x07fe: ctx_redswitch */ |
747 | 0xe7f100f8, | 769 | 0xe7f100f8, |
748 | 0xe5f00200, | 770 | 0xe5f00200, |
749 | 0x20e5f040, | 771 | 0x20e5f040, |
@@ -751,7 +773,7 @@ uint32_t nvf0_grhub_code[] = { | |||
751 | 0xf0850007, | 773 | 0xf0850007, |
752 | 0x0ed00103, | 774 | 0x0ed00103, |
753 | 0xf004bd00, | 775 | 0xf004bd00, |
754 | /* 0x07c2: ctx_redswitch_delay */ | 776 | /* 0x081a: ctx_redswitch_delay */ |
755 | 0xf2b608f7, | 777 | 0xf2b608f7, |
756 | 0xfd1bf401, | 778 | 0xfd1bf401, |
757 | 0x0400e5f1, | 779 | 0x0400e5f1, |
@@ -759,7 +781,7 @@ uint32_t nvf0_grhub_code[] = { | |||
759 | 0x850007f1, | 781 | 0x850007f1, |
760 | 0xd00103f0, | 782 | 0xd00103f0, |
761 | 0x04bd000e, | 783 | 0x04bd000e, |
762 | /* 0x07de: ctx_86c */ | 784 | /* 0x0836: ctx_86c */ |
763 | 0x07f100f8, | 785 | 0x07f100f8, |
764 | 0x03f02300, | 786 | 0x03f02300, |
765 | 0x000fd002, | 787 | 0x000fd002, |
@@ -770,17 +792,17 @@ uint32_t nvf0_grhub_code[] = { | |||
770 | 0xe7f102ff, | 792 | 0xe7f102ff, |
771 | 0xe3f0a88c, | 793 | 0xe3f0a88c, |
772 | 0x9d21f441, | 794 | 0x9d21f441, |
773 | /* 0x0806: ctx_mem */ | 795 | /* 0x085e: ctx_mem */ |
774 | 0x07f100f8, | 796 | 0x07f100f8, |
775 | 0x03f08400, | 797 | 0x03f08400, |
776 | 0x000fd002, | 798 | 0x000fd002, |
777 | /* 0x0812: ctx_mem_wait */ | 799 | /* 0x086a: ctx_mem_wait */ |
778 | 0xf7f104bd, | 800 | 0xf7f104bd, |
779 | 0xf3f08400, | 801 | 0xf3f08400, |
780 | 0x00ffcf02, | 802 | 0x00ffcf02, |
781 | 0xf405fffd, | 803 | 0xf405fffd, |
782 | 0x00f8f31b, | 804 | 0x00f8f31b, |
783 | /* 0x0824: ctx_load */ | 805 | /* 0x087c: ctx_load */ |
784 | 0x99f094bd, | 806 | 0x99f094bd, |
785 | 0x0007f105, | 807 | 0x0007f105, |
786 | 0x0203f037, | 808 | 0x0203f037, |
@@ -797,7 +819,7 @@ uint32_t nvf0_grhub_code[] = { | |||
797 | 0x0203f083, | 819 | 0x0203f083, |
798 | 0xbd0002d0, | 820 | 0xbd0002d0, |
799 | 0x07f7f004, | 821 | 0x07f7f004, |
800 | 0x080621f5, | 822 | 0x085e21f5, |
801 | 0xc00007f1, | 823 | 0xc00007f1, |
802 | 0xd00203f0, | 824 | 0xd00203f0, |
803 | 0x04bd0002, | 825 | 0x04bd0002, |
@@ -852,29 +874,29 @@ uint32_t nvf0_grhub_code[] = { | |||
852 | 0x170007f1, | 874 | 0x170007f1, |
853 | 0xd00203f0, | 875 | 0xd00203f0, |
854 | 0x04bd0009, | 876 | 0x04bd0009, |
855 | /* 0x0942: ctx_chan */ | 877 | /* 0x099a: ctx_chan */ |
856 | 0x21f500f8, | 878 | 0x21f500f8, |
857 | 0xa7f00824, | 879 | 0xa7f0087c, |
858 | 0xd021f40c, | 880 | 0xd021f40c, |
859 | 0xf505f7f0, | 881 | 0xf505f7f0, |
860 | 0xf8080621, | 882 | 0xf8085e21, |
861 | /* 0x0955: ctx_mmio_exec */ | 883 | /* 0x09ad: ctx_mmio_exec */ |
862 | 0x41039800, | 884 | 0x41039800, |
863 | 0x810007f1, | 885 | 0x810007f1, |
864 | 0xd00203f0, | 886 | 0xd00203f0, |
865 | 0x04bd0003, | 887 | 0x04bd0003, |
866 | /* 0x0966: ctx_mmio_loop */ | 888 | /* 0x09be: ctx_mmio_loop */ |
867 | 0x34c434bd, | 889 | 0x34c434bd, |
868 | 0x0f1bf4ff, | 890 | 0x0f1bf4ff, |
869 | 0x020057f1, | 891 | 0x020057f1, |
870 | 0xfa0653f0, | 892 | 0xfa0653f0, |
871 | 0x03f80535, | 893 | 0x03f80535, |
872 | /* 0x0978: ctx_mmio_pull */ | 894 | /* 0x09d0: ctx_mmio_pull */ |
873 | 0x98804e98, | 895 | 0x98804e98, |
874 | 0x21f4814f, | 896 | 0x21f4814f, |
875 | 0x0830b69d, | 897 | 0x0830b69d, |
876 | 0xf40112b6, | 898 | 0xf40112b6, |
877 | /* 0x098a: ctx_mmio_done */ | 899 | /* 0x09e2: ctx_mmio_done */ |
878 | 0x0398df1b, | 900 | 0x0398df1b, |
879 | 0x0007f116, | 901 | 0x0007f116, |
880 | 0x0203f081, | 902 | 0x0203f081, |
@@ -883,30 +905,30 @@ uint32_t nvf0_grhub_code[] = { | |||
883 | 0x010017f1, | 905 | 0x010017f1, |
884 | 0xfa0613f0, | 906 | 0xfa0613f0, |
885 | 0x03f80601, | 907 | 0x03f80601, |
886 | /* 0x09aa: ctx_xfer */ | 908 | /* 0x0a02: ctx_xfer */ |
887 | 0xe7f000f8, | 909 | 0xe7f000f8, |
888 | 0x0007f104, | 910 | 0x0007f104, |
889 | 0x0303f002, | 911 | 0x0303f002, |
890 | 0xbd000ed0, | 912 | 0xbd000ed0, |
891 | /* 0x09b9: ctx_xfer_idle */ | 913 | /* 0x0a11: ctx_xfer_idle */ |
892 | 0x00e7f104, | 914 | 0x00e7f104, |
893 | 0x03e3f000, | 915 | 0x03e3f000, |
894 | 0xf100eecf, | 916 | 0xf100eecf, |
895 | 0xf42000e4, | 917 | 0xf42000e4, |
896 | 0x11f4f21b, | 918 | 0x11f4f21b, |
897 | 0x0d02f406, | 919 | 0x0d02f406, |
898 | /* 0x09d0: ctx_xfer_pre */ | 920 | /* 0x0a28: ctx_xfer_pre */ |
899 | 0xf510f7f0, | 921 | 0xf510f7f0, |
900 | 0xf407de21, | 922 | 0xf4083621, |
901 | /* 0x09da: ctx_xfer_pre_load */ | 923 | /* 0x0a32: ctx_xfer_pre_load */ |
902 | 0xf7f01c11, | 924 | 0xf7f01c11, |
903 | 0x7f21f502, | 925 | 0xd721f502, |
904 | 0x9121f507, | 926 | 0xe921f507, |
905 | 0xa621f507, | 927 | 0xfe21f507, |
906 | 0xf5f4bd07, | 928 | 0xf5f4bd07, |
907 | 0xf5077f21, | 929 | 0xf507d721, |
908 | /* 0x09f3: ctx_xfer_exec */ | 930 | /* 0x0a4b: ctx_xfer_exec */ |
909 | 0x98082421, | 931 | 0x98087c21, |
910 | 0x24bd1601, | 932 | 0x24bd1601, |
911 | 0x050007f1, | 933 | 0x050007f1, |
912 | 0xd00103f0, | 934 | 0xd00103f0, |
@@ -941,21 +963,21 @@ uint32_t nvf0_grhub_code[] = { | |||
941 | 0xa7f01301, | 963 | 0xa7f01301, |
942 | 0xd021f40c, | 964 | 0xd021f40c, |
943 | 0xf505f7f0, | 965 | 0xf505f7f0, |
944 | 0xf4080621, | 966 | 0xf4085e21, |
945 | /* 0x0a82: ctx_xfer_post */ | 967 | /* 0x0ada: ctx_xfer_post */ |
946 | 0xf7f02e02, | 968 | 0xf7f02e02, |
947 | 0x7f21f502, | 969 | 0xd721f502, |
948 | 0xf5f4bd07, | 970 | 0xf5f4bd07, |
949 | 0xf507de21, | 971 | 0xf5083621, |
950 | 0xf5027f21, | 972 | 0xf5027f21, |
951 | 0xbd079121, | 973 | 0xbd07e921, |
952 | 0x7f21f5f4, | 974 | 0xd721f5f4, |
953 | 0x1011f407, | 975 | 0x1011f407, |
954 | 0xfd400198, | 976 | 0xfd400198, |
955 | 0x0bf40511, | 977 | 0x0bf40511, |
956 | 0x5521f507, | 978 | 0xad21f507, |
957 | /* 0x0aad: ctx_xfer_no_post_mmio */ | 979 | /* 0x0b05: ctx_xfer_no_post_mmio */ |
958 | /* 0x0aad: ctx_xfer_done */ | 980 | /* 0x0b05: ctx_xfer_done */ |
959 | 0x0000f809, | 981 | 0x0000f809, |
960 | 0x00000000, | 982 | 0x00000000, |
961 | 0x00000000, | 983 | 0x00000000, |
@@ -977,4 +999,46 @@ uint32_t nvf0_grhub_code[] = { | |||
977 | 0x00000000, | 999 | 0x00000000, |
978 | 0x00000000, | 1000 | 0x00000000, |
979 | 0x00000000, | 1001 | 0x00000000, |
1002 | 0x00000000, | ||
1003 | 0x00000000, | ||
1004 | 0x00000000, | ||
1005 | 0x00000000, | ||
1006 | 0x00000000, | ||
1007 | 0x00000000, | ||
1008 | 0x00000000, | ||
1009 | 0x00000000, | ||
1010 | 0x00000000, | ||
1011 | 0x00000000, | ||
1012 | 0x00000000, | ||
1013 | 0x00000000, | ||
1014 | 0x00000000, | ||
1015 | 0x00000000, | ||
1016 | 0x00000000, | ||
1017 | 0x00000000, | ||
1018 | 0x00000000, | ||
1019 | 0x00000000, | ||
1020 | 0x00000000, | ||
1021 | 0x00000000, | ||
1022 | 0x00000000, | ||
1023 | 0x00000000, | ||
1024 | 0x00000000, | ||
1025 | 0x00000000, | ||
1026 | 0x00000000, | ||
1027 | 0x00000000, | ||
1028 | 0x00000000, | ||
1029 | 0x00000000, | ||
1030 | 0x00000000, | ||
1031 | 0x00000000, | ||
1032 | 0x00000000, | ||
1033 | 0x00000000, | ||
1034 | 0x00000000, | ||
1035 | 0x00000000, | ||
1036 | 0x00000000, | ||
1037 | 0x00000000, | ||
1038 | 0x00000000, | ||
1039 | 0x00000000, | ||
1040 | 0x00000000, | ||
1041 | 0x00000000, | ||
1042 | 0x00000000, | ||
1043 | 0x00000000, | ||
980 | }; | 1044 | }; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc index a47d49db5232..2a0b0f844299 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc | |||
@@ -30,6 +30,12 @@ | |||
30 | #define GK110 0xf0 | 30 | #define GK110 0xf0 |
31 | #define GK208 0x108 | 31 | #define GK208 0x108 |
32 | 32 | ||
33 | #define NV_PGRAPH_TRAPPED_ADDR 0x400704 | ||
34 | #define NV_PGRAPH_TRAPPED_DATA_LO 0x400708 | ||
35 | #define NV_PGRAPH_TRAPPED_DATA_HI 0x40070c | ||
36 | |||
37 | #define NV_PGRAPH_FE_OBJECT_TABLE(n) ((n) * 4 + 0x400700) | ||
38 | |||
33 | #define NV_PGRAPH_FECS_INTR_ACK 0x409004 | 39 | #define NV_PGRAPH_FECS_INTR_ACK 0x409004 |
34 | #define NV_PGRAPH_FECS_INTR 0x409008 | 40 | #define NV_PGRAPH_FECS_INTR 0x409008 |
35 | #define NV_PGRAPH_FECS_INTR_FWMTHD 0x00000400 | 41 | #define NV_PGRAPH_FECS_INTR_FWMTHD 0x00000400 |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h index fd1d380de094..1718ae4e8224 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h | |||
@@ -3,5 +3,6 @@ | |||
3 | 3 | ||
4 | #define E_BAD_COMMAND 0x00000001 | 4 | #define E_BAD_COMMAND 0x00000001 |
5 | #define E_CMD_OVERFLOW 0x00000002 | 5 | #define E_CMD_OVERFLOW 0x00000002 |
6 | #define E_BAD_FWMTHD 0x00000003 | ||
6 | 7 | ||
7 | #endif | 8 | #endif |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c index 1a2d56493cf6..20665c21d80e 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c | |||
@@ -976,7 +976,6 @@ nv50_graph_init(struct nouveau_object *object) | |||
976 | break; | 976 | break; |
977 | case 0xa0: | 977 | case 0xa0: |
978 | default: | 978 | default: |
979 | nv_wr32(priv, 0x402cc0, 0x00000000); | ||
980 | if (nv_device(priv)->chipset == 0xa0 || | 979 | if (nv_device(priv)->chipset == 0xa0 || |
981 | nv_device(priv)->chipset == 0xaa || | 980 | nv_device(priv)->chipset == 0xaa || |
982 | nv_device(priv)->chipset == 0xac) { | 981 | nv_device(priv)->chipset == 0xac) { |
@@ -991,10 +990,10 @@ nv50_graph_init(struct nouveau_object *object) | |||
991 | 990 | ||
992 | /* zero out zcull regions */ | 991 | /* zero out zcull regions */ |
993 | for (i = 0; i < 8; i++) { | 992 | for (i = 0; i < 8; i++) { |
994 | nv_wr32(priv, 0x402c20 + (i * 8), 0x00000000); | 993 | nv_wr32(priv, 0x402c20 + (i * 0x10), 0x00000000); |
995 | nv_wr32(priv, 0x402c24 + (i * 8), 0x00000000); | 994 | nv_wr32(priv, 0x402c24 + (i * 0x10), 0x00000000); |
996 | nv_wr32(priv, 0x402c28 + (i * 8), 0x00000000); | 995 | nv_wr32(priv, 0x402c28 + (i * 0x10), 0x00000000); |
997 | nv_wr32(priv, 0x402c2c + (i * 8), 0x00000000); | 996 | nv_wr32(priv, 0x402c2c + (i * 0x10), 0x00000000); |
998 | } | 997 | } |
999 | return 0; | 998 | return 0; |
1000 | } | 999 | } |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c index bf7bdb1f291e..aa0838916354 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | |||
@@ -789,17 +789,40 @@ nvc0_graph_ctxctl_debug(struct nvc0_graph_priv *priv) | |||
789 | static void | 789 | static void |
790 | nvc0_graph_ctxctl_isr(struct nvc0_graph_priv *priv) | 790 | nvc0_graph_ctxctl_isr(struct nvc0_graph_priv *priv) |
791 | { | 791 | { |
792 | u32 ustat = nv_rd32(priv, 0x409c18); | 792 | u32 stat = nv_rd32(priv, 0x409c18); |
793 | 793 | ||
794 | if (ustat & 0x00000001) | 794 | if (stat & 0x00000001) { |
795 | nv_error(priv, "CTXCTL ucode error\n"); | 795 | u32 code = nv_rd32(priv, 0x409814); |
796 | if (ustat & 0x00080000) | 796 | if (code == E_BAD_FWMTHD) { |
797 | nv_error(priv, "CTXCTL watchdog timeout\n"); | 797 | u32 class = nv_rd32(priv, 0x409808); |
798 | if (ustat & ~0x00080001) | 798 | u32 addr = nv_rd32(priv, 0x40980c); |
799 | nv_error(priv, "CTXCTL 0x%08x\n", ustat); | 799 | u32 subc = (addr & 0x00070000) >> 16; |
800 | u32 mthd = (addr & 0x00003ffc); | ||
801 | u32 data = nv_rd32(priv, 0x409810); | ||
802 | |||
803 | nv_error(priv, "FECS MTHD subc %d class 0x%04x " | ||
804 | "mthd 0x%04x data 0x%08x\n", | ||
805 | subc, class, mthd, data); | ||
800 | 806 | ||
801 | nvc0_graph_ctxctl_debug(priv); | 807 | nv_wr32(priv, 0x409c20, 0x00000001); |
802 | nv_wr32(priv, 0x409c20, ustat); | 808 | stat &= ~0x00000001; |
809 | } else { | ||
810 | nv_error(priv, "FECS ucode error %d\n", code); | ||
811 | } | ||
812 | } | ||
813 | |||
814 | if (stat & 0x00080000) { | ||
815 | nv_error(priv, "FECS watchdog timeout\n"); | ||
816 | nvc0_graph_ctxctl_debug(priv); | ||
817 | nv_wr32(priv, 0x409c20, 0x00080000); | ||
818 | stat &= ~0x00080000; | ||
819 | } | ||
820 | |||
821 | if (stat) { | ||
822 | nv_error(priv, "FECS 0x%08x\n", stat); | ||
823 | nvc0_graph_ctxctl_debug(priv); | ||
824 | nv_wr32(priv, 0x409c20, stat); | ||
825 | } | ||
803 | } | 826 | } |
804 | 827 | ||
805 | static void | 828 | static void |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h index 75203a99d902..ffc289198dd8 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h | |||
@@ -38,6 +38,8 @@ | |||
38 | #include <engine/fifo.h> | 38 | #include <engine/fifo.h> |
39 | #include <engine/graph.h> | 39 | #include <engine/graph.h> |
40 | 40 | ||
41 | #include "fuc/os.h" | ||
42 | |||
41 | #define GPC_MAX 32 | 43 | #define GPC_MAX 32 |
42 | #define TPC_MAX (GPC_MAX * 8) | 44 | #define TPC_MAX (GPC_MAX * 8) |
43 | 45 | ||
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h b/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h index db1b39d08013..825f7bb46b67 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h | |||
@@ -84,6 +84,7 @@ extern struct nouveau_oclass *nv4e_i2c_oclass; | |||
84 | extern struct nouveau_oclass *nv50_i2c_oclass; | 84 | extern struct nouveau_oclass *nv50_i2c_oclass; |
85 | extern struct nouveau_oclass *nv94_i2c_oclass; | 85 | extern struct nouveau_oclass *nv94_i2c_oclass; |
86 | extern struct nouveau_oclass *nvd0_i2c_oclass; | 86 | extern struct nouveau_oclass *nvd0_i2c_oclass; |
87 | extern struct nouveau_oclass *gf117_i2c_oclass; | ||
87 | extern struct nouveau_oclass *nve0_i2c_oclass; | 88 | extern struct nouveau_oclass *nve0_i2c_oclass; |
88 | 89 | ||
89 | static inline int | 90 | static inline int |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nve0.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nve0.c index 4ac1aa30ea11..0e62a3240144 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/nve0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nve0.c | |||
@@ -307,7 +307,6 @@ calc_clk(struct nve0_clock_priv *priv, | |||
307 | info->dsrc = src0; | 307 | info->dsrc = src0; |
308 | if (div0) { | 308 | if (div0) { |
309 | info->ddiv |= 0x80000000; | 309 | info->ddiv |= 0x80000000; |
310 | info->ddiv |= div0 << 8; | ||
311 | info->ddiv |= div0; | 310 | info->ddiv |= div0; |
312 | } | 311 | } |
313 | if (div1D) { | 312 | if (div1D) { |
@@ -352,7 +351,7 @@ nve0_clock_prog_0(struct nve0_clock_priv *priv, int clk) | |||
352 | { | 351 | { |
353 | struct nve0_clock_info *info = &priv->eng[clk]; | 352 | struct nve0_clock_info *info = &priv->eng[clk]; |
354 | if (!info->ssel) { | 353 | if (!info->ssel) { |
355 | nv_mask(priv, 0x1371d0 + (clk * 0x04), 0x80003f3f, info->ddiv); | 354 | nv_mask(priv, 0x1371d0 + (clk * 0x04), 0x8000003f, info->ddiv); |
356 | nv_wr32(priv, 0x137160 + (clk * 0x04), info->dsrc); | 355 | nv_wr32(priv, 0x137160 + (clk * 0x04), info->dsrc); |
357 | } | 356 | } |
358 | } | 357 | } |
@@ -389,7 +388,10 @@ static void | |||
389 | nve0_clock_prog_3(struct nve0_clock_priv *priv, int clk) | 388 | nve0_clock_prog_3(struct nve0_clock_priv *priv, int clk) |
390 | { | 389 | { |
391 | struct nve0_clock_info *info = &priv->eng[clk]; | 390 | struct nve0_clock_info *info = &priv->eng[clk]; |
392 | nv_mask(priv, 0x137250 + (clk * 0x04), 0x00003f3f, info->mdiv); | 391 | if (info->ssel) |
392 | nv_mask(priv, 0x137250 + (clk * 0x04), 0x00003f00, info->mdiv); | ||
393 | else | ||
394 | nv_mask(priv, 0x137250 + (clk * 0x04), 0x0000003f, info->mdiv); | ||
393 | } | 395 | } |
394 | 396 | ||
395 | static void | 397 | static void |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h b/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h index 0f57fcfe0bbf..2af9cfd2c60f 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h | |||
@@ -26,7 +26,7 @@ ramfuc_reg2(u32 addr1, u32 addr2) | |||
26 | }; | 26 | }; |
27 | } | 27 | } |
28 | 28 | ||
29 | static inline struct ramfuc_reg | 29 | static noinline struct ramfuc_reg |
30 | ramfuc_reg(u32 addr) | 30 | ramfuc_reg(u32 addr) |
31 | { | 31 | { |
32 | return ramfuc_reg2(addr, addr); | 32 | return ramfuc_reg2(addr, addr); |
@@ -107,7 +107,7 @@ ramfuc_nsec(struct ramfuc *ram, u32 nsec) | |||
107 | 107 | ||
108 | #define ram_init(s,p) ramfuc_init(&(s)->base, (p)) | 108 | #define ram_init(s,p) ramfuc_init(&(s)->base, (p)) |
109 | #define ram_exec(s,e) ramfuc_exec(&(s)->base, (e)) | 109 | #define ram_exec(s,e) ramfuc_exec(&(s)->base, (e)) |
110 | #define ram_have(s,r) ((s)->r_##r.addr != 0x000000) | 110 | #define ram_have(s,r) ((s)->r_##r.addr[0] != 0x000000) |
111 | #define ram_rd32(s,r) ramfuc_rd32(&(s)->base, &(s)->r_##r) | 111 | #define ram_rd32(s,r) ramfuc_rd32(&(s)->base, &(s)->r_##r) |
112 | #define ram_wr32(s,r,d) ramfuc_wr32(&(s)->base, &(s)->r_##r, (d)) | 112 | #define ram_wr32(s,r,d) ramfuc_wr32(&(s)->base, &(s)->r_##r, (d)) |
113 | #define ram_nuke(s,r) ramfuc_nuke(&(s)->base, &(s)->r_##r) | 113 | #define ram_nuke(s,r) ramfuc_nuke(&(s)->base, &(s)->r_##r) |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c index 84c7efbc4f38..c5b46e302319 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c | |||
@@ -200,6 +200,7 @@ r1373f4_init(struct nve0_ramfuc *fuc) | |||
200 | /* (re)program mempll, if required */ | 200 | /* (re)program mempll, if required */ |
201 | if (ram->mode == 2) { | 201 | if (ram->mode == 2) { |
202 | ram_mask(fuc, 0x1373f4, 0x00010000, 0x00000000); | 202 | ram_mask(fuc, 0x1373f4, 0x00010000, 0x00000000); |
203 | ram_mask(fuc, 0x132000, 0x80000000, 0x80000000); | ||
203 | ram_mask(fuc, 0x132000, 0x00000001, 0x00000000); | 204 | ram_mask(fuc, 0x132000, 0x00000001, 0x00000000); |
204 | ram_mask(fuc, 0x132004, 0x103fffff, mcoef); | 205 | ram_mask(fuc, 0x132004, 0x103fffff, mcoef); |
205 | ram_mask(fuc, 0x132000, 0x00000001, 0x00000001); | 206 | ram_mask(fuc, 0x132000, 0x00000001, 0x00000001); |
@@ -262,8 +263,8 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
262 | struct nve0_ram *ram = (void *)pfb->ram; | 263 | struct nve0_ram *ram = (void *)pfb->ram; |
263 | struct nve0_ramfuc *fuc = &ram->fuc; | 264 | struct nve0_ramfuc *fuc = &ram->fuc; |
264 | struct nouveau_ram_data *next = ram->base.next; | 265 | struct nouveau_ram_data *next = ram->base.next; |
265 | int vc = !(next->bios.ramcfg_11_02_08); | 266 | int vc = !next->bios.ramcfg_11_02_08; |
266 | int mv = !(next->bios.ramcfg_11_02_04); | 267 | int mv = !next->bios.ramcfg_11_02_04; |
267 | u32 mask, data; | 268 | u32 mask, data; |
268 | 269 | ||
269 | ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000); | 270 | ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000); |
@@ -370,8 +371,8 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
370 | } | 371 | } |
371 | } | 372 | } |
372 | 373 | ||
373 | if ( (next->bios.ramcfg_11_02_40) || | 374 | if (next->bios.ramcfg_11_02_40 || |
374 | (next->bios.ramcfg_11_07_10)) { | 375 | next->bios.ramcfg_11_07_10) { |
375 | ram_mask(fuc, 0x132040, 0x00010000, 0x00010000); | 376 | ram_mask(fuc, 0x132040, 0x00010000, 0x00010000); |
376 | ram_nsec(fuc, 20000); | 377 | ram_nsec(fuc, 20000); |
377 | } | 378 | } |
@@ -417,7 +418,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
417 | ram_mask(fuc, 0x10f694, 0xff00ff00, data); | 418 | ram_mask(fuc, 0x10f694, 0xff00ff00, data); |
418 | } | 419 | } |
419 | 420 | ||
420 | if (ram->mode == 2 && (next->bios.ramcfg_11_08_10)) | 421 | if (ram->mode == 2 && next->bios.ramcfg_11_08_10) |
421 | data = 0x00000080; | 422 | data = 0x00000080; |
422 | else | 423 | else |
423 | data = 0x00000000; | 424 | data = 0x00000000; |
@@ -425,13 +426,13 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
425 | 426 | ||
426 | mask = 0x00070000; | 427 | mask = 0x00070000; |
427 | data = 0x00000000; | 428 | data = 0x00000000; |
428 | if (!(next->bios.ramcfg_11_02_80)) | 429 | if (!next->bios.ramcfg_11_02_80) |
429 | data |= 0x03000000; | 430 | data |= 0x03000000; |
430 | if (!(next->bios.ramcfg_11_02_40)) | 431 | if (!next->bios.ramcfg_11_02_40) |
431 | data |= 0x00002000; | 432 | data |= 0x00002000; |
432 | if (!(next->bios.ramcfg_11_07_10)) | 433 | if (!next->bios.ramcfg_11_07_10) |
433 | data |= 0x00004000; | 434 | data |= 0x00004000; |
434 | if (!(next->bios.ramcfg_11_07_08)) | 435 | if (!next->bios.ramcfg_11_07_08) |
435 | data |= 0x00000003; | 436 | data |= 0x00000003; |
436 | else | 437 | else |
437 | data |= 0x74000000; | 438 | data |= 0x74000000; |
@@ -486,7 +487,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
486 | 487 | ||
487 | data = mask = 0x00000000; | 488 | data = mask = 0x00000000; |
488 | if (NOTE00(ramcfg_02_03 != 0)) { | 489 | if (NOTE00(ramcfg_02_03 != 0)) { |
489 | data |= (next->bios.ramcfg_11_02_03) << 8; | 490 | data |= next->bios.ramcfg_11_02_03 << 8; |
490 | mask |= 0x00000300; | 491 | mask |= 0x00000300; |
491 | } | 492 | } |
492 | if (NOTE00(ramcfg_01_10)) { | 493 | if (NOTE00(ramcfg_01_10)) { |
@@ -498,7 +499,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
498 | 499 | ||
499 | data = mask = 0x00000000; | 500 | data = mask = 0x00000000; |
500 | if (NOTE00(timing_30_07 != 0)) { | 501 | if (NOTE00(timing_30_07 != 0)) { |
501 | data |= (next->bios.timing_20_30_07) << 28; | 502 | data |= next->bios.timing_20_30_07 << 28; |
502 | mask |= 0x70000000; | 503 | mask |= 0x70000000; |
503 | } | 504 | } |
504 | if (NOTE00(ramcfg_01_01)) { | 505 | if (NOTE00(ramcfg_01_01)) { |
@@ -510,7 +511,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
510 | 511 | ||
511 | data = mask = 0x00000000; | 512 | data = mask = 0x00000000; |
512 | if (NOTE00(timing_30_07 != 0)) { | 513 | if (NOTE00(timing_30_07 != 0)) { |
513 | data |= (next->bios.timing_20_30_07) << 28; | 514 | data |= next->bios.timing_20_30_07 << 28; |
514 | mask |= 0x70000000; | 515 | mask |= 0x70000000; |
515 | } | 516 | } |
516 | if (NOTE00(ramcfg_01_02)) { | 517 | if (NOTE00(ramcfg_01_02)) { |
@@ -522,16 +523,16 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
522 | 523 | ||
523 | mask = 0x33f00000; | 524 | mask = 0x33f00000; |
524 | data = 0x00000000; | 525 | data = 0x00000000; |
525 | if (!(next->bios.ramcfg_11_01_04)) | 526 | if (!next->bios.ramcfg_11_01_04) |
526 | data |= 0x20200000; | 527 | data |= 0x20200000; |
527 | if (!(next->bios.ramcfg_11_07_80)) | 528 | if (!next->bios.ramcfg_11_07_80) |
528 | data |= 0x12800000; | 529 | data |= 0x12800000; |
529 | /*XXX: see note above about there probably being some condition | 530 | /*XXX: see note above about there probably being some condition |
530 | * for the 10f824 stuff that uses ramcfg 3... | 531 | * for the 10f824 stuff that uses ramcfg 3... |
531 | */ | 532 | */ |
532 | if ( (next->bios.ramcfg_11_03_f0)) { | 533 | if (next->bios.ramcfg_11_03_f0) { |
533 | if (next->bios.rammap_11_08_0c) { | 534 | if (next->bios.rammap_11_08_0c) { |
534 | if (!(next->bios.ramcfg_11_07_80)) | 535 | if (!next->bios.ramcfg_11_07_80) |
535 | mask |= 0x00000020; | 536 | mask |= 0x00000020; |
536 | else | 537 | else |
537 | data |= 0x00000020; | 538 | data |= 0x00000020; |
@@ -563,7 +564,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
563 | ram_wait(fuc, 0x100710, 0x80000000, 0x80000000, 200000); | 564 | ram_wait(fuc, 0x100710, 0x80000000, 0x80000000, 200000); |
564 | } | 565 | } |
565 | 566 | ||
566 | data = (next->bios.timing_20_30_07) << 8; | 567 | data = next->bios.timing_20_30_07 << 8; |
567 | if (next->bios.ramcfg_11_01_01) | 568 | if (next->bios.ramcfg_11_01_01) |
568 | data |= 0x80000000; | 569 | data |= 0x80000000; |
569 | ram_mask(fuc, 0x100778, 0x00000700, data); | 570 | ram_mask(fuc, 0x100778, 0x00000700, data); |
@@ -588,7 +589,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
588 | ram_wr32(fuc, 0x10f310, 0x00000001); /* REFRESH */ | 589 | ram_wr32(fuc, 0x10f310, 0x00000001); /* REFRESH */ |
589 | ram_wr32(fuc, 0x10f210, 0x80000000); /* REFRESH_AUTO = 1 */ | 590 | ram_wr32(fuc, 0x10f210, 0x80000000); /* REFRESH_AUTO = 1 */ |
590 | 591 | ||
591 | if ((next->bios.ramcfg_11_08_10) && (ram->mode == 2) /*XXX*/) { | 592 | if (next->bios.ramcfg_11_08_10 && (ram->mode == 2) /*XXX*/) { |
592 | u32 temp = ram_mask(fuc, 0x10f294, 0xff000000, 0x24000000); | 593 | u32 temp = ram_mask(fuc, 0x10f294, 0xff000000, 0x24000000); |
593 | nve0_ram_train(fuc, 0xbc0e0000, 0xa4010000); /*XXX*/ | 594 | nve0_ram_train(fuc, 0xbc0e0000, 0xa4010000); /*XXX*/ |
594 | ram_nsec(fuc, 1000); | 595 | ram_nsec(fuc, 1000); |
@@ -621,8 +622,8 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
621 | data = ram_rd32(fuc, 0x10f978); | 622 | data = ram_rd32(fuc, 0x10f978); |
622 | data &= ~0x00046144; | 623 | data &= ~0x00046144; |
623 | data |= 0x0000000b; | 624 | data |= 0x0000000b; |
624 | if (!(next->bios.ramcfg_11_07_08)) { | 625 | if (!next->bios.ramcfg_11_07_08) { |
625 | if (!(next->bios.ramcfg_11_07_04)) | 626 | if (!next->bios.ramcfg_11_07_04) |
626 | data |= 0x0000200c; | 627 | data |= 0x0000200c; |
627 | else | 628 | else |
628 | data |= 0x00000000; | 629 | data |= 0x00000000; |
@@ -636,11 +637,11 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
636 | ram_wr32(fuc, 0x10f830, data); | 637 | ram_wr32(fuc, 0x10f830, data); |
637 | } | 638 | } |
638 | 639 | ||
639 | if (!(next->bios.ramcfg_11_07_08)) { | 640 | if (!next->bios.ramcfg_11_07_08) { |
640 | data = 0x88020000; | 641 | data = 0x88020000; |
641 | if ( (next->bios.ramcfg_11_07_04)) | 642 | if ( next->bios.ramcfg_11_07_04) |
642 | data |= 0x10000000; | 643 | data |= 0x10000000; |
643 | if (!(next->bios.rammap_11_08_10)) | 644 | if (!next->bios.rammap_11_08_10) |
644 | data |= 0x00080000; | 645 | data |= 0x00080000; |
645 | } else { | 646 | } else { |
646 | data = 0xa40e0000; | 647 | data = 0xa40e0000; |
@@ -689,8 +690,8 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
689 | const u32 runk0 = ram->fN1 << 16; | 690 | const u32 runk0 = ram->fN1 << 16; |
690 | const u32 runk1 = ram->fN1; | 691 | const u32 runk1 = ram->fN1; |
691 | struct nouveau_ram_data *next = ram->base.next; | 692 | struct nouveau_ram_data *next = ram->base.next; |
692 | int vc = !(next->bios.ramcfg_11_02_08); | 693 | int vc = !next->bios.ramcfg_11_02_08; |
693 | int mv = !(next->bios.ramcfg_11_02_04); | 694 | int mv = !next->bios.ramcfg_11_02_04; |
694 | u32 mask, data; | 695 | u32 mask, data; |
695 | 696 | ||
696 | ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000); | 697 | ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000); |
@@ -705,7 +706,7 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
705 | } | 706 | } |
706 | 707 | ||
707 | ram_mask(fuc, 0x10f200, 0x00000800, 0x00000000); | 708 | ram_mask(fuc, 0x10f200, 0x00000800, 0x00000000); |
708 | if ((next->bios.ramcfg_11_03_f0)) | 709 | if (next->bios.ramcfg_11_03_f0) |
709 | ram_mask(fuc, 0x10f808, 0x04000000, 0x04000000); | 710 | ram_mask(fuc, 0x10f808, 0x04000000, 0x04000000); |
710 | 711 | ||
711 | ram_wr32(fuc, 0x10f314, 0x00000001); /* PRECHARGE */ | 712 | ram_wr32(fuc, 0x10f314, 0x00000001); /* PRECHARGE */ |
@@ -761,7 +762,7 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
761 | 762 | ||
762 | ram_mask(fuc, 0x1373f4, 0x00000000, 0x00010010); | 763 | ram_mask(fuc, 0x1373f4, 0x00000000, 0x00010010); |
763 | data = ram_rd32(fuc, 0x1373ec) & ~0x00030000; | 764 | data = ram_rd32(fuc, 0x1373ec) & ~0x00030000; |
764 | data |= (next->bios.ramcfg_11_03_30) << 12; | 765 | data |= next->bios.ramcfg_11_03_30 << 16; |
765 | ram_wr32(fuc, 0x1373ec, data); | 766 | ram_wr32(fuc, 0x1373ec, data); |
766 | ram_mask(fuc, 0x1373f4, 0x00000003, 0x00000000); | 767 | ram_mask(fuc, 0x1373f4, 0x00000003, 0x00000000); |
767 | ram_mask(fuc, 0x1373f4, 0x00000010, 0x00000000); | 768 | ram_mask(fuc, 0x1373f4, 0x00000010, 0x00000000); |
@@ -793,8 +794,8 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
793 | } | 794 | } |
794 | } | 795 | } |
795 | 796 | ||
796 | if ( (next->bios.ramcfg_11_02_40) || | 797 | if (next->bios.ramcfg_11_02_40 || |
797 | (next->bios.ramcfg_11_07_10)) { | 798 | next->bios.ramcfg_11_07_10) { |
798 | ram_mask(fuc, 0x132040, 0x00010000, 0x00010000); | 799 | ram_mask(fuc, 0x132040, 0x00010000, 0x00010000); |
799 | ram_nsec(fuc, 20000); | 800 | ram_nsec(fuc, 20000); |
800 | } | 801 | } |
@@ -810,13 +811,13 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
810 | 811 | ||
811 | mask = 0x00010000; | 812 | mask = 0x00010000; |
812 | data = 0x00000000; | 813 | data = 0x00000000; |
813 | if (!(next->bios.ramcfg_11_02_80)) | 814 | if (!next->bios.ramcfg_11_02_80) |
814 | data |= 0x03000000; | 815 | data |= 0x03000000; |
815 | if (!(next->bios.ramcfg_11_02_40)) | 816 | if (!next->bios.ramcfg_11_02_40) |
816 | data |= 0x00002000; | 817 | data |= 0x00002000; |
817 | if (!(next->bios.ramcfg_11_07_10)) | 818 | if (!next->bios.ramcfg_11_07_10) |
818 | data |= 0x00004000; | 819 | data |= 0x00004000; |
819 | if (!(next->bios.ramcfg_11_07_08)) | 820 | if (!next->bios.ramcfg_11_07_08) |
820 | data |= 0x00000003; | 821 | data |= 0x00000003; |
821 | else | 822 | else |
822 | data |= 0x14000000; | 823 | data |= 0x14000000; |
@@ -844,16 +845,16 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
844 | 845 | ||
845 | mask = 0x33f00000; | 846 | mask = 0x33f00000; |
846 | data = 0x00000000; | 847 | data = 0x00000000; |
847 | if (!(next->bios.ramcfg_11_01_04)) | 848 | if (!next->bios.ramcfg_11_01_04) |
848 | data |= 0x20200000; | 849 | data |= 0x20200000; |
849 | if (!(next->bios.ramcfg_11_07_80)) | 850 | if (!next->bios.ramcfg_11_07_80) |
850 | data |= 0x12800000; | 851 | data |= 0x12800000; |
851 | /*XXX: see note above about there probably being some condition | 852 | /*XXX: see note above about there probably being some condition |
852 | * for the 10f824 stuff that uses ramcfg 3... | 853 | * for the 10f824 stuff that uses ramcfg 3... |
853 | */ | 854 | */ |
854 | if ( (next->bios.ramcfg_11_03_f0)) { | 855 | if (next->bios.ramcfg_11_03_f0) { |
855 | if (next->bios.rammap_11_08_0c) { | 856 | if (next->bios.rammap_11_08_0c) { |
856 | if (!(next->bios.ramcfg_11_07_80)) | 857 | if (!next->bios.ramcfg_11_07_80) |
857 | mask |= 0x00000020; | 858 | mask |= 0x00000020; |
858 | else | 859 | else |
859 | data |= 0x00000020; | 860 | data |= 0x00000020; |
@@ -876,7 +877,7 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
876 | data = next->bios.timing_20_2c_1fc0; | 877 | data = next->bios.timing_20_2c_1fc0; |
877 | ram_mask(fuc, 0x10f24c, 0x7f000000, data << 24); | 878 | ram_mask(fuc, 0x10f24c, 0x7f000000, data << 24); |
878 | 879 | ||
879 | ram_mask(fuc, 0x10f224, 0x001f0000, next->bios.timing_20_30_f8); | 880 | ram_mask(fuc, 0x10f224, 0x001f0000, next->bios.timing_20_30_f8 << 16); |
880 | 881 | ||
881 | ram_wr32(fuc, 0x10f090, 0x4000007f); | 882 | ram_wr32(fuc, 0x10f090, 0x4000007f); |
882 | ram_nsec(fuc, 1000); | 883 | ram_nsec(fuc, 1000); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/i2c/gf117.c b/drivers/gpu/drm/nouveau/core/subdev/i2c/gf117.c new file mode 100644 index 000000000000..fa891c39866b --- /dev/null +++ b/drivers/gpu/drm/nouveau/core/subdev/i2c/gf117.c | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Red Hat Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | |||
25 | #include "nv50.h" | ||
26 | |||
27 | struct nouveau_oclass * | ||
28 | gf117_i2c_oclass = &(struct nouveau_i2c_impl) { | ||
29 | .base.handle = NV_SUBDEV(I2C, 0xd7), | ||
30 | .base.ofuncs = &(struct nouveau_ofuncs) { | ||
31 | .ctor = _nouveau_i2c_ctor, | ||
32 | .dtor = _nouveau_i2c_dtor, | ||
33 | .init = _nouveau_i2c_init, | ||
34 | .fini = _nouveau_i2c_fini, | ||
35 | }, | ||
36 | .sclass = nvd0_i2c_sclass, | ||
37 | .pad_x = &nv04_i2c_pad_oclass, | ||
38 | .pad_s = &nv04_i2c_pad_oclass, | ||
39 | }.base; | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ibus/nve0.c b/drivers/gpu/drm/nouveau/core/subdev/ibus/nve0.c index 7120124dceac..ebef970a0645 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ibus/nve0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ibus/nve0.c | |||
@@ -95,6 +95,23 @@ nve0_ibus_intr(struct nouveau_subdev *subdev) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | static int | 97 | static int |
98 | nve0_ibus_init(struct nouveau_object *object) | ||
99 | { | ||
100 | struct nve0_ibus_priv *priv = (void *)object; | ||
101 | int ret = nouveau_ibus_init(&priv->base); | ||
102 | if (ret == 0) { | ||
103 | nv_mask(priv, 0x122318, 0x0003ffff, 0x00001000); | ||
104 | nv_mask(priv, 0x12231c, 0x0003ffff, 0x00000200); | ||
105 | nv_mask(priv, 0x122310, 0x0003ffff, 0x00000800); | ||
106 | nv_mask(priv, 0x122348, 0x0003ffff, 0x00000100); | ||
107 | nv_mask(priv, 0x1223b0, 0x0003ffff, 0x00000fff); | ||
108 | nv_mask(priv, 0x122348, 0x0003ffff, 0x00000200); | ||
109 | nv_mask(priv, 0x122358, 0x0003ffff, 0x00002880); | ||
110 | } | ||
111 | return ret; | ||
112 | } | ||
113 | |||
114 | static int | ||
98 | nve0_ibus_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | 115 | nve0_ibus_ctor(struct nouveau_object *parent, struct nouveau_object *engine, |
99 | struct nouveau_oclass *oclass, void *data, u32 size, | 116 | struct nouveau_oclass *oclass, void *data, u32 size, |
100 | struct nouveau_object **pobject) | 117 | struct nouveau_object **pobject) |
@@ -117,7 +134,7 @@ nve0_ibus_oclass = { | |||
117 | .ofuncs = &(struct nouveau_ofuncs) { | 134 | .ofuncs = &(struct nouveau_ofuncs) { |
118 | .ctor = nve0_ibus_ctor, | 135 | .ctor = nve0_ibus_ctor, |
119 | .dtor = _nouveau_ibus_dtor, | 136 | .dtor = _nouveau_ibus_dtor, |
120 | .init = _nouveau_ibus_init, | 137 | .init = nve0_ibus_init, |
121 | .fini = _nouveau_ibus_fini, | 138 | .fini = _nouveau_ibus_fini, |
122 | }, | 139 | }, |
123 | }; | 140 | }; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/host.fuc b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/host.fuc index 2284ecb1c9b8..c2bb616a8da5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/host.fuc +++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/host.fuc | |||
@@ -83,7 +83,7 @@ host_send: | |||
83 | // increment GET | 83 | // increment GET |
84 | add b32 $r1 0x1 | 84 | add b32 $r1 0x1 |
85 | and $r14 $r1 #fifo_qmaskf | 85 | and $r14 $r1 #fifo_qmaskf |
86 | nv_iowr(NV_PPWR_FIFO_GET(0), $r1) | 86 | nv_iowr(NV_PPWR_FIFO_GET(0), $r14) |
87 | bra #host_send | 87 | bra #host_send |
88 | host_send_done: | 88 | host_send_done: |
89 | ret | 89 | ret |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h index 4bd43a99fdcc..39a5dc150a05 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h +++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h | |||
@@ -1018,7 +1018,7 @@ uint32_t nv108_pwr_code[] = { | |||
1018 | 0xb600023f, | 1018 | 0xb600023f, |
1019 | 0x1ec40110, | 1019 | 0x1ec40110, |
1020 | 0x04b0400f, | 1020 | 0x04b0400f, |
1021 | 0xbd0001f6, | 1021 | 0xbd000ef6, |
1022 | 0xc70ef404, | 1022 | 0xc70ef404, |
1023 | /* 0x0328: host_send_done */ | 1023 | /* 0x0328: host_send_done */ |
1024 | /* 0x032a: host_recv */ | 1024 | /* 0x032a: host_recv */ |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h index 5a73fa620978..254205cd5166 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h +++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h | |||
@@ -1124,7 +1124,7 @@ uint32_t nva3_pwr_code[] = { | |||
1124 | 0x0f1ec401, | 1124 | 0x0f1ec401, |
1125 | 0x04b007f1, | 1125 | 0x04b007f1, |
1126 | 0xd00604b6, | 1126 | 0xd00604b6, |
1127 | 0x04bd0001, | 1127 | 0x04bd000e, |
1128 | /* 0x03cb: host_send_done */ | 1128 | /* 0x03cb: host_send_done */ |
1129 | 0xf8ba0ef4, | 1129 | 0xf8ba0ef4, |
1130 | /* 0x03cd: host_recv */ | 1130 | /* 0x03cd: host_recv */ |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h index 4dba00d2dd1a..7ac87405d01b 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h | |||
@@ -1124,7 +1124,7 @@ uint32_t nvc0_pwr_code[] = { | |||
1124 | 0x0f1ec401, | 1124 | 0x0f1ec401, |
1125 | 0x04b007f1, | 1125 | 0x04b007f1, |
1126 | 0xd00604b6, | 1126 | 0xd00604b6, |
1127 | 0x04bd0001, | 1127 | 0x04bd000e, |
1128 | /* 0x03cb: host_send_done */ | 1128 | /* 0x03cb: host_send_done */ |
1129 | 0xf8ba0ef4, | 1129 | 0xf8ba0ef4, |
1130 | /* 0x03cd: host_recv */ | 1130 | /* 0x03cd: host_recv */ |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h index 5e24c6bc041d..cd9ff1a73284 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h | |||
@@ -1033,7 +1033,7 @@ uint32_t nvd0_pwr_code[] = { | |||
1033 | 0xb6026b21, | 1033 | 0xb6026b21, |
1034 | 0x1ec40110, | 1034 | 0x1ec40110, |
1035 | 0xb007f10f, | 1035 | 0xb007f10f, |
1036 | 0x0001d004, | 1036 | 0x000ed004, |
1037 | 0x0ef404bd, | 1037 | 0x0ef404bd, |
1038 | /* 0x0365: host_send_done */ | 1038 | /* 0x0365: host_send_done */ |
1039 | /* 0x0367: host_recv */ | 1039 | /* 0x0367: host_recv */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 26b5647188ef..47ad74255bf1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -736,6 +736,9 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
736 | fb->bits_per_pixel, fb->pitches[0], crtc->x, crtc->y, | 736 | fb->bits_per_pixel, fb->pitches[0], crtc->x, crtc->y, |
737 | new_bo->bo.offset }; | 737 | new_bo->bo.offset }; |
738 | 738 | ||
739 | /* Keep vblanks on during flip, for the target crtc of this flip */ | ||
740 | drm_vblank_get(dev, nouveau_crtc(crtc)->index); | ||
741 | |||
739 | /* Emit a page flip */ | 742 | /* Emit a page flip */ |
740 | if (nv_device(drm->device)->card_type >= NV_50) { | 743 | if (nv_device(drm->device)->card_type >= NV_50) { |
741 | ret = nv50_display_flip_next(crtc, fb, chan, swap_interval); | 744 | ret = nv50_display_flip_next(crtc, fb, chan, swap_interval); |
@@ -779,6 +782,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
779 | return 0; | 782 | return 0; |
780 | 783 | ||
781 | fail_unreserve: | 784 | fail_unreserve: |
785 | drm_vblank_put(dev, nouveau_crtc(crtc)->index); | ||
782 | ttm_bo_unreserve(&old_bo->bo); | 786 | ttm_bo_unreserve(&old_bo->bo); |
783 | fail_unpin: | 787 | fail_unpin: |
784 | mutex_unlock(&chan->cli->mutex); | 788 | mutex_unlock(&chan->cli->mutex); |
@@ -817,6 +821,9 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, | |||
817 | drm_send_vblank_event(dev, crtcid, s->event); | 821 | drm_send_vblank_event(dev, crtcid, s->event); |
818 | } | 822 | } |
819 | 823 | ||
824 | /* Give up ownership of vblank for page-flipped crtc */ | ||
825 | drm_vblank_put(dev, s->crtc); | ||
826 | |||
820 | list_del(&s->head); | 827 | list_del(&s->head); |
821 | if (ps) | 828 | if (ps) |
822 | *ps = *s; | 829 | *ps = *s; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index ddd83756b9a2..5425ffe3931d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -652,12 +652,12 @@ int nouveau_pmops_resume(struct device *dev) | |||
652 | ret = nouveau_do_resume(drm_dev); | 652 | ret = nouveau_do_resume(drm_dev); |
653 | if (ret) | 653 | if (ret) |
654 | return ret; | 654 | return ret; |
655 | if (drm_dev->mode_config.num_crtc) | ||
656 | nouveau_fbcon_set_suspend(drm_dev, 0); | ||
657 | 655 | ||
658 | nouveau_fbcon_zfill_all(drm_dev); | 656 | if (drm_dev->mode_config.num_crtc) { |
659 | if (drm_dev->mode_config.num_crtc) | ||
660 | nouveau_display_resume(drm_dev); | 657 | nouveau_display_resume(drm_dev); |
658 | nouveau_fbcon_set_suspend(drm_dev, 0); | ||
659 | } | ||
660 | |||
661 | return 0; | 661 | return 0; |
662 | } | 662 | } |
663 | 663 | ||
@@ -683,11 +683,12 @@ static int nouveau_pmops_thaw(struct device *dev) | |||
683 | ret = nouveau_do_resume(drm_dev); | 683 | ret = nouveau_do_resume(drm_dev); |
684 | if (ret) | 684 | if (ret) |
685 | return ret; | 685 | return ret; |
686 | if (drm_dev->mode_config.num_crtc) | 686 | |
687 | nouveau_fbcon_set_suspend(drm_dev, 0); | 687 | if (drm_dev->mode_config.num_crtc) { |
688 | nouveau_fbcon_zfill_all(drm_dev); | ||
689 | if (drm_dev->mode_config.num_crtc) | ||
690 | nouveau_display_resume(drm_dev); | 688 | nouveau_display_resume(drm_dev); |
689 | nouveau_fbcon_set_suspend(drm_dev, 0); | ||
690 | } | ||
691 | |||
691 | return 0; | 692 | return 0; |
692 | } | 693 | } |
693 | 694 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 64a42cfd3717..191665ee7f52 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -531,17 +531,10 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state) | |||
531 | if (state == 1) | 531 | if (state == 1) |
532 | nouveau_fbcon_save_disable_accel(dev); | 532 | nouveau_fbcon_save_disable_accel(dev); |
533 | fb_set_suspend(drm->fbcon->helper.fbdev, state); | 533 | fb_set_suspend(drm->fbcon->helper.fbdev, state); |
534 | if (state == 0) | 534 | if (state == 0) { |
535 | nouveau_fbcon_restore_accel(dev); | 535 | nouveau_fbcon_restore_accel(dev); |
536 | nouveau_fbcon_zfill(dev, drm->fbcon); | ||
537 | } | ||
536 | console_unlock(); | 538 | console_unlock(); |
537 | } | 539 | } |
538 | } | 540 | } |
539 | |||
540 | void | ||
541 | nouveau_fbcon_zfill_all(struct drm_device *dev) | ||
542 | { | ||
543 | struct nouveau_drm *drm = nouveau_drm(dev); | ||
544 | if (drm->fbcon) { | ||
545 | nouveau_fbcon_zfill(dev, drm->fbcon); | ||
546 | } | ||
547 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.h b/drivers/gpu/drm/nouveau/nouveau_fbcon.h index fdfc0c94fbcc..fcff797d2084 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.h +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.h | |||
@@ -61,7 +61,6 @@ void nouveau_fbcon_gpu_lockup(struct fb_info *info); | |||
61 | int nouveau_fbcon_init(struct drm_device *dev); | 61 | int nouveau_fbcon_init(struct drm_device *dev); |
62 | void nouveau_fbcon_fini(struct drm_device *dev); | 62 | void nouveau_fbcon_fini(struct drm_device *dev); |
63 | void nouveau_fbcon_set_suspend(struct drm_device *dev, int state); | 63 | void nouveau_fbcon_set_suspend(struct drm_device *dev, int state); |
64 | void nouveau_fbcon_zfill_all(struct drm_device *dev); | ||
65 | void nouveau_fbcon_save_disable_accel(struct drm_device *dev); | 64 | void nouveau_fbcon_save_disable_accel(struct drm_device *dev); |
66 | void nouveau_fbcon_restore_accel(struct drm_device *dev); | 65 | void nouveau_fbcon_restore_accel(struct drm_device *dev); |
67 | 66 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index afdf607df3e6..4c534b7b04da 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -1741,7 +1741,8 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode) | |||
1741 | } | 1741 | } |
1742 | } | 1742 | } |
1743 | 1743 | ||
1744 | mthd = (ffs(nv_encoder->dcb->sorconf.link) - 1) << 2; | 1744 | mthd = (ffs(nv_encoder->dcb->heads) - 1) << 3; |
1745 | mthd |= (ffs(nv_encoder->dcb->sorconf.link) - 1) << 2; | ||
1745 | mthd |= nv_encoder->or; | 1746 | mthd |= nv_encoder->or; |
1746 | 1747 | ||
1747 | if (nv_encoder->dcb->type == DCB_OUTPUT_DP) { | 1748 | if (nv_encoder->dcb->type == DCB_OUTPUT_DP) { |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 26c12a3fe430..a03c73411a56 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1052,7 +1052,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
1052 | int encoder_mode = atombios_get_encoder_mode(radeon_crtc->encoder); | 1052 | int encoder_mode = atombios_get_encoder_mode(radeon_crtc->encoder); |
1053 | 1053 | ||
1054 | /* pass the actual clock to atombios_crtc_program_pll for DCE5,6 for HDMI */ | 1054 | /* pass the actual clock to atombios_crtc_program_pll for DCE5,6 for HDMI */ |
1055 | if (ASIC_IS_DCE5(rdev) && !ASIC_IS_DCE8(rdev) && | 1055 | if (ASIC_IS_DCE5(rdev) && |
1056 | (encoder_mode == ATOM_ENCODER_MODE_HDMI) && | 1056 | (encoder_mode == ATOM_ENCODER_MODE_HDMI) && |
1057 | (radeon_crtc->bpc > 8)) | 1057 | (radeon_crtc->bpc > 8)) |
1058 | clock = radeon_crtc->adjusted_clock; | 1058 | clock = radeon_crtc->adjusted_clock; |
@@ -1136,6 +1136,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1136 | u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); | 1136 | u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); |
1137 | u32 tmp, viewport_w, viewport_h; | 1137 | u32 tmp, viewport_w, viewport_h; |
1138 | int r; | 1138 | int r; |
1139 | bool bypass_lut = false; | ||
1139 | 1140 | ||
1140 | /* no fb bound */ | 1141 | /* no fb bound */ |
1141 | if (!atomic && !crtc->primary->fb) { | 1142 | if (!atomic && !crtc->primary->fb) { |
@@ -1174,33 +1175,73 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1174 | radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL); | 1175 | radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL); |
1175 | radeon_bo_unreserve(rbo); | 1176 | radeon_bo_unreserve(rbo); |
1176 | 1177 | ||
1177 | switch (target_fb->bits_per_pixel) { | 1178 | switch (target_fb->pixel_format) { |
1178 | case 8: | 1179 | case DRM_FORMAT_C8: |
1179 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_8BPP) | | 1180 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_8BPP) | |
1180 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_INDEXED)); | 1181 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_INDEXED)); |
1181 | break; | 1182 | break; |
1182 | case 15: | 1183 | case DRM_FORMAT_XRGB4444: |
1184 | case DRM_FORMAT_ARGB4444: | ||
1185 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | | ||
1186 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB4444)); | ||
1187 | #ifdef __BIG_ENDIAN | ||
1188 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); | ||
1189 | #endif | ||
1190 | break; | ||
1191 | case DRM_FORMAT_XRGB1555: | ||
1192 | case DRM_FORMAT_ARGB1555: | ||
1183 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | | 1193 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | |
1184 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB1555)); | 1194 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB1555)); |
1195 | #ifdef __BIG_ENDIAN | ||
1196 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); | ||
1197 | #endif | ||
1198 | break; | ||
1199 | case DRM_FORMAT_BGRX5551: | ||
1200 | case DRM_FORMAT_BGRA5551: | ||
1201 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | | ||
1202 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_BGRA5551)); | ||
1203 | #ifdef __BIG_ENDIAN | ||
1204 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); | ||
1205 | #endif | ||
1185 | break; | 1206 | break; |
1186 | case 16: | 1207 | case DRM_FORMAT_RGB565: |
1187 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | | 1208 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | |
1188 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); | 1209 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); |
1189 | #ifdef __BIG_ENDIAN | 1210 | #ifdef __BIG_ENDIAN |
1190 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); | 1211 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); |
1191 | #endif | 1212 | #endif |
1192 | break; | 1213 | break; |
1193 | case 24: | 1214 | case DRM_FORMAT_XRGB8888: |
1194 | case 32: | 1215 | case DRM_FORMAT_ARGB8888: |
1195 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | | 1216 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | |
1196 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); | 1217 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); |
1197 | #ifdef __BIG_ENDIAN | 1218 | #ifdef __BIG_ENDIAN |
1198 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); | 1219 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); |
1199 | #endif | 1220 | #endif |
1200 | break; | 1221 | break; |
1222 | case DRM_FORMAT_XRGB2101010: | ||
1223 | case DRM_FORMAT_ARGB2101010: | ||
1224 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | | ||
1225 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB2101010)); | ||
1226 | #ifdef __BIG_ENDIAN | ||
1227 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); | ||
1228 | #endif | ||
1229 | /* Greater 8 bpc fb needs to bypass hw-lut to retain precision */ | ||
1230 | bypass_lut = true; | ||
1231 | break; | ||
1232 | case DRM_FORMAT_BGRX1010102: | ||
1233 | case DRM_FORMAT_BGRA1010102: | ||
1234 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | | ||
1235 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_BGRA1010102)); | ||
1236 | #ifdef __BIG_ENDIAN | ||
1237 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); | ||
1238 | #endif | ||
1239 | /* Greater 8 bpc fb needs to bypass hw-lut to retain precision */ | ||
1240 | bypass_lut = true; | ||
1241 | break; | ||
1201 | default: | 1242 | default: |
1202 | DRM_ERROR("Unsupported screen depth %d\n", | 1243 | DRM_ERROR("Unsupported screen format %s\n", |
1203 | target_fb->bits_per_pixel); | 1244 | drm_get_format_name(target_fb->pixel_format)); |
1204 | return -EINVAL; | 1245 | return -EINVAL; |
1205 | } | 1246 | } |
1206 | 1247 | ||
@@ -1329,6 +1370,18 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1329 | WREG32(EVERGREEN_GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); | 1370 | WREG32(EVERGREEN_GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); |
1330 | WREG32(EVERGREEN_GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); | 1371 | WREG32(EVERGREEN_GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); |
1331 | 1372 | ||
1373 | /* | ||
1374 | * The LUT only has 256 slots for indexing by a 8 bpc fb. Bypass the LUT | ||
1375 | * for > 8 bpc scanout to avoid truncation of fb indices to 8 msb's, to | ||
1376 | * retain the full precision throughout the pipeline. | ||
1377 | */ | ||
1378 | WREG32_P(EVERGREEN_GRPH_LUT_10BIT_BYPASS_CONTROL + radeon_crtc->crtc_offset, | ||
1379 | (bypass_lut ? EVERGREEN_LUT_10BIT_BYPASS_EN : 0), | ||
1380 | ~EVERGREEN_LUT_10BIT_BYPASS_EN); | ||
1381 | |||
1382 | if (bypass_lut) | ||
1383 | DRM_DEBUG_KMS("Bypassing hardware LUT due to 10 bit fb scanout.\n"); | ||
1384 | |||
1332 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); | 1385 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); |
1333 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); | 1386 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); |
1334 | WREG32(EVERGREEN_GRPH_X_START + radeon_crtc->crtc_offset, 0); | 1387 | WREG32(EVERGREEN_GRPH_X_START + radeon_crtc->crtc_offset, 0); |
@@ -1396,6 +1449,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1396 | u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; | 1449 | u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; |
1397 | u32 tmp, viewport_w, viewport_h; | 1450 | u32 tmp, viewport_w, viewport_h; |
1398 | int r; | 1451 | int r; |
1452 | bool bypass_lut = false; | ||
1399 | 1453 | ||
1400 | /* no fb bound */ | 1454 | /* no fb bound */ |
1401 | if (!atomic && !crtc->primary->fb) { | 1455 | if (!atomic && !crtc->primary->fb) { |
@@ -1433,18 +1487,30 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1433 | radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL); | 1487 | radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL); |
1434 | radeon_bo_unreserve(rbo); | 1488 | radeon_bo_unreserve(rbo); |
1435 | 1489 | ||
1436 | switch (target_fb->bits_per_pixel) { | 1490 | switch (target_fb->pixel_format) { |
1437 | case 8: | 1491 | case DRM_FORMAT_C8: |
1438 | fb_format = | 1492 | fb_format = |
1439 | AVIVO_D1GRPH_CONTROL_DEPTH_8BPP | | 1493 | AVIVO_D1GRPH_CONTROL_DEPTH_8BPP | |
1440 | AVIVO_D1GRPH_CONTROL_8BPP_INDEXED; | 1494 | AVIVO_D1GRPH_CONTROL_8BPP_INDEXED; |
1441 | break; | 1495 | break; |
1442 | case 15: | 1496 | case DRM_FORMAT_XRGB4444: |
1497 | case DRM_FORMAT_ARGB4444: | ||
1498 | fb_format = | ||
1499 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | | ||
1500 | AVIVO_D1GRPH_CONTROL_16BPP_ARGB4444; | ||
1501 | #ifdef __BIG_ENDIAN | ||
1502 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; | ||
1503 | #endif | ||
1504 | break; | ||
1505 | case DRM_FORMAT_XRGB1555: | ||
1443 | fb_format = | 1506 | fb_format = |
1444 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | | 1507 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | |
1445 | AVIVO_D1GRPH_CONTROL_16BPP_ARGB1555; | 1508 | AVIVO_D1GRPH_CONTROL_16BPP_ARGB1555; |
1509 | #ifdef __BIG_ENDIAN | ||
1510 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; | ||
1511 | #endif | ||
1446 | break; | 1512 | break; |
1447 | case 16: | 1513 | case DRM_FORMAT_RGB565: |
1448 | fb_format = | 1514 | fb_format = |
1449 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | | 1515 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | |
1450 | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; | 1516 | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; |
@@ -1452,8 +1518,8 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1452 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; | 1518 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; |
1453 | #endif | 1519 | #endif |
1454 | break; | 1520 | break; |
1455 | case 24: | 1521 | case DRM_FORMAT_XRGB8888: |
1456 | case 32: | 1522 | case DRM_FORMAT_ARGB8888: |
1457 | fb_format = | 1523 | fb_format = |
1458 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | | 1524 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | |
1459 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; | 1525 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; |
@@ -1461,9 +1527,20 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1461 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT; | 1527 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT; |
1462 | #endif | 1528 | #endif |
1463 | break; | 1529 | break; |
1530 | case DRM_FORMAT_XRGB2101010: | ||
1531 | case DRM_FORMAT_ARGB2101010: | ||
1532 | fb_format = | ||
1533 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | | ||
1534 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB2101010; | ||
1535 | #ifdef __BIG_ENDIAN | ||
1536 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT; | ||
1537 | #endif | ||
1538 | /* Greater 8 bpc fb needs to bypass hw-lut to retain precision */ | ||
1539 | bypass_lut = true; | ||
1540 | break; | ||
1464 | default: | 1541 | default: |
1465 | DRM_ERROR("Unsupported screen depth %d\n", | 1542 | DRM_ERROR("Unsupported screen format %s\n", |
1466 | target_fb->bits_per_pixel); | 1543 | drm_get_format_name(target_fb->pixel_format)); |
1467 | return -EINVAL; | 1544 | return -EINVAL; |
1468 | } | 1545 | } |
1469 | 1546 | ||
@@ -1502,6 +1579,13 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1502 | if (rdev->family >= CHIP_R600) | 1579 | if (rdev->family >= CHIP_R600) |
1503 | WREG32(R600_D1GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); | 1580 | WREG32(R600_D1GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); |
1504 | 1581 | ||
1582 | /* LUT only has 256 slots for 8 bpc fb. Bypass for > 8 bpc scanout for precision */ | ||
1583 | WREG32_P(AVIVO_D1GRPH_LUT_SEL + radeon_crtc->crtc_offset, | ||
1584 | (bypass_lut ? AVIVO_LUT_10BIT_BYPASS_EN : 0), ~AVIVO_LUT_10BIT_BYPASS_EN); | ||
1585 | |||
1586 | if (bypass_lut) | ||
1587 | DRM_DEBUG_KMS("Bypassing hardware LUT due to 10 bit fb scanout.\n"); | ||
1588 | |||
1505 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); | 1589 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); |
1506 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); | 1590 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); |
1507 | WREG32(AVIVO_D1GRPH_X_START + radeon_crtc->crtc_offset, 0); | 1591 | WREG32(AVIVO_D1GRPH_X_START + radeon_crtc->crtc_offset, 0); |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index c5b1f2da3954..b1e11f8434e2 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -127,7 +127,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, | |||
127 | /* flags not zero */ | 127 | /* flags not zero */ |
128 | if (args.v1.ucReplyStatus == 2) { | 128 | if (args.v1.ucReplyStatus == 2) { |
129 | DRM_DEBUG_KMS("dp_aux_ch flags not zero\n"); | 129 | DRM_DEBUG_KMS("dp_aux_ch flags not zero\n"); |
130 | r = -EBUSY; | 130 | r = -EIO; |
131 | goto done; | 131 | goto done; |
132 | } | 132 | } |
133 | 133 | ||
@@ -403,16 +403,18 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector) | |||
403 | { | 403 | { |
404 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; | 404 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; |
405 | u8 msg[DP_DPCD_SIZE]; | 405 | u8 msg[DP_DPCD_SIZE]; |
406 | int ret, i; | 406 | int ret; |
407 | |||
408 | char dpcd_hex_dump[DP_DPCD_SIZE * 3]; | ||
407 | 409 | ||
408 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, | 410 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
409 | DP_DPCD_SIZE); | 411 | DP_DPCD_SIZE); |
410 | if (ret > 0) { | 412 | if (ret > 0) { |
411 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | 413 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); |
412 | DRM_DEBUG_KMS("DPCD: "); | 414 | |
413 | for (i = 0; i < DP_DPCD_SIZE; i++) | 415 | hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd), |
414 | DRM_DEBUG_KMS("%02x ", msg[i]); | 416 | 32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false); |
415 | DRM_DEBUG_KMS("\n"); | 417 | DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump); |
416 | 418 | ||
417 | radeon_dp_probe_oui(radeon_connector); | 419 | radeon_dp_probe_oui(radeon_connector); |
418 | 420 | ||
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index 10dae4106c08..584090ac3eb9 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c | |||
@@ -1179,7 +1179,7 @@ static int ci_stop_dpm(struct radeon_device *rdev) | |||
1179 | tmp &= ~GLOBAL_PWRMGT_EN; | 1179 | tmp &= ~GLOBAL_PWRMGT_EN; |
1180 | WREG32_SMC(GENERAL_PWRMGT, tmp); | 1180 | WREG32_SMC(GENERAL_PWRMGT, tmp); |
1181 | 1181 | ||
1182 | tmp = RREG32(SCLK_PWRMGT_CNTL); | 1182 | tmp = RREG32_SMC(SCLK_PWRMGT_CNTL); |
1183 | tmp &= ~DYNAMIC_PM_EN; | 1183 | tmp &= ~DYNAMIC_PM_EN; |
1184 | WREG32_SMC(SCLK_PWRMGT_CNTL, tmp); | 1184 | WREG32_SMC(SCLK_PWRMGT_CNTL, tmp); |
1185 | 1185 | ||
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index dcd4518a9b08..0b2471107137 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -7676,14 +7676,16 @@ restart_ih: | |||
7676 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); | 7676 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); |
7677 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); | 7677 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); |
7678 | mc_client = RREG32(VM_CONTEXT1_PROTECTION_FAULT_MCCLIENT); | 7678 | mc_client = RREG32(VM_CONTEXT1_PROTECTION_FAULT_MCCLIENT); |
7679 | /* reset addr and status */ | ||
7680 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
7681 | if (addr == 0x0 && status == 0x0) | ||
7682 | break; | ||
7679 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); | 7683 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); |
7680 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", | 7684 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", |
7681 | addr); | 7685 | addr); |
7682 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", | 7686 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
7683 | status); | 7687 | status); |
7684 | cik_vm_decode_fault(rdev, status, addr, mc_client); | 7688 | cik_vm_decode_fault(rdev, status, addr, mc_client); |
7685 | /* reset addr and status */ | ||
7686 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
7687 | break; | 7689 | break; |
7688 | case 167: /* VCE */ | 7690 | case 167: /* VCE */ |
7689 | DRM_DEBUG("IH: VCE int: 0x%08x\n", src_data); | 7691 | DRM_DEBUG("IH: VCE int: 0x%08x\n", src_data); |
diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h index ae88660f34ea..0c6e1b55d968 100644 --- a/drivers/gpu/drm/radeon/cikd.h +++ b/drivers/gpu/drm/radeon/cikd.h | |||
@@ -1752,12 +1752,12 @@ | |||
1752 | #define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */ | 1752 | #define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */ |
1753 | #define EOP_TCL1_ACTION_EN (1 << 16) | 1753 | #define EOP_TCL1_ACTION_EN (1 << 16) |
1754 | #define EOP_TC_ACTION_EN (1 << 17) /* L2 */ | 1754 | #define EOP_TC_ACTION_EN (1 << 17) /* L2 */ |
1755 | #define EOP_TCL2_VOLATILE (1 << 24) | ||
1755 | #define EOP_CACHE_POLICY(x) ((x) << 25) | 1756 | #define EOP_CACHE_POLICY(x) ((x) << 25) |
1756 | /* 0 - LRU | 1757 | /* 0 - LRU |
1757 | * 1 - Stream | 1758 | * 1 - Stream |
1758 | * 2 - Bypass | 1759 | * 2 - Bypass |
1759 | */ | 1760 | */ |
1760 | #define EOP_TCL2_VOLATILE (1 << 27) | ||
1761 | #define DATA_SEL(x) ((x) << 29) | 1761 | #define DATA_SEL(x) ((x) << 29) |
1762 | /* 0 - discard | 1762 | /* 0 - discard |
1763 | * 1 - send low 32bit data | 1763 | * 1 - send low 32bit data |
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c index 5a9a5f4d7888..47d31e915758 100644 --- a/drivers/gpu/drm/radeon/cypress_dpm.c +++ b/drivers/gpu/drm/radeon/cypress_dpm.c | |||
@@ -1551,7 +1551,7 @@ int cypress_populate_smc_voltage_tables(struct radeon_device *rdev, | |||
1551 | 1551 | ||
1552 | table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0; | 1552 | table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0; |
1553 | table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] = | 1553 | table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] = |
1554 | cpu_to_be32(eg_pi->vddc_voltage_table.mask_low); | 1554 | cpu_to_be32(eg_pi->vddci_voltage_table.mask_low); |
1555 | } | 1555 | } |
1556 | 1556 | ||
1557 | return 0; | 1557 | return 0; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index e2f605224e8c..f7ece0ff431b 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -189,7 +189,7 @@ static const u32 evergreen_golden_registers[] = | |||
189 | 0x8c1c, 0xffffffff, 0x00001010, | 189 | 0x8c1c, 0xffffffff, 0x00001010, |
190 | 0x28350, 0xffffffff, 0x00000000, | 190 | 0x28350, 0xffffffff, 0x00000000, |
191 | 0xa008, 0xffffffff, 0x00010000, | 191 | 0xa008, 0xffffffff, 0x00010000, |
192 | 0x5cc, 0xffffffff, 0x00000001, | 192 | 0x5c4, 0xffffffff, 0x00000001, |
193 | 0x9508, 0xffffffff, 0x00000002, | 193 | 0x9508, 0xffffffff, 0x00000002, |
194 | 0x913c, 0x0000000f, 0x0000000a | 194 | 0x913c, 0x0000000f, 0x0000000a |
195 | }; | 195 | }; |
@@ -476,7 +476,7 @@ static const u32 cedar_golden_registers[] = | |||
476 | 0x8c1c, 0xffffffff, 0x00001010, | 476 | 0x8c1c, 0xffffffff, 0x00001010, |
477 | 0x28350, 0xffffffff, 0x00000000, | 477 | 0x28350, 0xffffffff, 0x00000000, |
478 | 0xa008, 0xffffffff, 0x00010000, | 478 | 0xa008, 0xffffffff, 0x00010000, |
479 | 0x5cc, 0xffffffff, 0x00000001, | 479 | 0x5c4, 0xffffffff, 0x00000001, |
480 | 0x9508, 0xffffffff, 0x00000002 | 480 | 0x9508, 0xffffffff, 0x00000002 |
481 | }; | 481 | }; |
482 | 482 | ||
@@ -635,7 +635,7 @@ static const u32 juniper_mgcg_init[] = | |||
635 | static const u32 supersumo_golden_registers[] = | 635 | static const u32 supersumo_golden_registers[] = |
636 | { | 636 | { |
637 | 0x5eb4, 0xffffffff, 0x00000002, | 637 | 0x5eb4, 0xffffffff, 0x00000002, |
638 | 0x5cc, 0xffffffff, 0x00000001, | 638 | 0x5c4, 0xffffffff, 0x00000001, |
639 | 0x7030, 0xffffffff, 0x00000011, | 639 | 0x7030, 0xffffffff, 0x00000011, |
640 | 0x7c30, 0xffffffff, 0x00000011, | 640 | 0x7c30, 0xffffffff, 0x00000011, |
641 | 0x6104, 0x01000300, 0x00000000, | 641 | 0x6104, 0x01000300, 0x00000000, |
@@ -719,7 +719,7 @@ static const u32 sumo_golden_registers[] = | |||
719 | static const u32 wrestler_golden_registers[] = | 719 | static const u32 wrestler_golden_registers[] = |
720 | { | 720 | { |
721 | 0x5eb4, 0xffffffff, 0x00000002, | 721 | 0x5eb4, 0xffffffff, 0x00000002, |
722 | 0x5cc, 0xffffffff, 0x00000001, | 722 | 0x5c4, 0xffffffff, 0x00000001, |
723 | 0x7030, 0xffffffff, 0x00000011, | 723 | 0x7030, 0xffffffff, 0x00000011, |
724 | 0x7c30, 0xffffffff, 0x00000011, | 724 | 0x7c30, 0xffffffff, 0x00000011, |
725 | 0x6104, 0x01000300, 0x00000000, | 725 | 0x6104, 0x01000300, 0x00000000, |
@@ -5066,14 +5066,16 @@ restart_ih: | |||
5066 | case 147: | 5066 | case 147: |
5067 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); | 5067 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); |
5068 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); | 5068 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); |
5069 | /* reset addr and status */ | ||
5070 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
5071 | if (addr == 0x0 && status == 0x0) | ||
5072 | break; | ||
5069 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); | 5073 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); |
5070 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", | 5074 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", |
5071 | addr); | 5075 | addr); |
5072 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", | 5076 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
5073 | status); | 5077 | status); |
5074 | cayman_vm_decode_fault(rdev, status, addr); | 5078 | cayman_vm_decode_fault(rdev, status, addr); |
5075 | /* reset addr and status */ | ||
5076 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
5077 | break; | 5079 | break; |
5078 | case 176: /* CP_INT in ring buffer */ | 5080 | case 176: /* CP_INT in ring buffer */ |
5079 | case 177: /* CP_INT in IB1 */ | 5081 | case 177: /* CP_INT in IB1 */ |
diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h index a0f63ff5a5e9..333d143fca2c 100644 --- a/drivers/gpu/drm/radeon/evergreen_reg.h +++ b/drivers/gpu/drm/radeon/evergreen_reg.h | |||
@@ -116,6 +116,8 @@ | |||
116 | # define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1 | 116 | # define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1 |
117 | # define EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1 2 | 117 | # define EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1 2 |
118 | # define EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1 4 | 118 | # define EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1 4 |
119 | #define EVERGREEN_GRPH_LUT_10BIT_BYPASS_CONTROL 0x6808 | ||
120 | # define EVERGREEN_LUT_10BIT_BYPASS_EN (1 << 8) | ||
119 | #define EVERGREEN_GRPH_SWAP_CONTROL 0x680c | 121 | #define EVERGREEN_GRPH_SWAP_CONTROL 0x680c |
120 | # define EVERGREEN_GRPH_ENDIAN_SWAP(x) (((x) & 0x3) << 0) | 122 | # define EVERGREEN_GRPH_ENDIAN_SWAP(x) (((x) & 0x3) << 0) |
121 | # define EVERGREEN_GRPH_ENDIAN_NONE 0 | 123 | # define EVERGREEN_GRPH_ENDIAN_NONE 0 |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 3f6e817d97ee..9ef8c38f2d66 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -2726,7 +2726,7 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
2726 | pi->caps_sclk_ds = true; | 2726 | pi->caps_sclk_ds = true; |
2727 | pi->enable_auto_thermal_throttling = true; | 2727 | pi->enable_auto_thermal_throttling = true; |
2728 | pi->disable_nb_ps3_in_battery = false; | 2728 | pi->disable_nb_ps3_in_battery = false; |
2729 | pi->bapm_enable = false; | 2729 | pi->bapm_enable = true; |
2730 | pi->voltage_drop_t = 0; | 2730 | pi->voltage_drop_t = 0; |
2731 | pi->caps_sclk_throttle_low_notification = false; | 2731 | pi->caps_sclk_throttle_low_notification = false; |
2732 | pi->caps_fps = false; /* true? */ | 2732 | pi->caps_fps = false; /* true? */ |
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index 004c931606c4..01fc4888e6fe 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c | |||
@@ -1315,7 +1315,7 @@ static void ni_populate_smc_voltage_tables(struct radeon_device *rdev, | |||
1315 | 1315 | ||
1316 | table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0; | 1316 | table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0; |
1317 | table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = | 1317 | table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = |
1318 | cpu_to_be32(eg_pi->vddc_voltage_table.mask_low); | 1318 | cpu_to_be32(eg_pi->vddci_voltage_table.mask_low); |
1319 | } | 1319 | } |
1320 | } | 1320 | } |
1321 | 1321 | ||
diff --git a/drivers/gpu/drm/radeon/r500_reg.h b/drivers/gpu/drm/radeon/r500_reg.h index 1dd0d32993d5..136b7bc7cd20 100644 --- a/drivers/gpu/drm/radeon/r500_reg.h +++ b/drivers/gpu/drm/radeon/r500_reg.h | |||
@@ -402,6 +402,7 @@ | |||
402 | * block and vice versa. This applies to GRPH, CUR, etc. | 402 | * block and vice versa. This applies to GRPH, CUR, etc. |
403 | */ | 403 | */ |
404 | #define AVIVO_D1GRPH_LUT_SEL 0x6108 | 404 | #define AVIVO_D1GRPH_LUT_SEL 0x6108 |
405 | # define AVIVO_LUT_10BIT_BYPASS_EN (1 << 8) | ||
405 | #define AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS 0x6110 | 406 | #define AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS 0x6110 |
406 | #define R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6914 | 407 | #define R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6914 |
407 | #define R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6114 | 408 | #define R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6114 |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 4b0bbf88d5c0..29d9cc04c04e 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -102,6 +102,7 @@ extern int radeon_runtime_pm; | |||
102 | extern int radeon_hard_reset; | 102 | extern int radeon_hard_reset; |
103 | extern int radeon_vm_size; | 103 | extern int radeon_vm_size; |
104 | extern int radeon_vm_block_size; | 104 | extern int radeon_vm_block_size; |
105 | extern int radeon_deep_color; | ||
105 | 106 | ||
106 | /* | 107 | /* |
107 | * Copy from radeon_drv.h so we don't have to include both and have conflicting | 108 | * Copy from radeon_drv.h so we don't have to include both and have conflicting |
@@ -749,10 +750,6 @@ union radeon_irq_stat_regs { | |||
749 | struct cik_irq_stat_regs cik; | 750 | struct cik_irq_stat_regs cik; |
750 | }; | 751 | }; |
751 | 752 | ||
752 | #define RADEON_MAX_HPD_PINS 7 | ||
753 | #define RADEON_MAX_CRTCS 6 | ||
754 | #define RADEON_MAX_AFMT_BLOCKS 7 | ||
755 | |||
756 | struct radeon_irq { | 753 | struct radeon_irq { |
757 | bool installed; | 754 | bool installed; |
758 | spinlock_t lock; | 755 | spinlock_t lock; |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 30844814c25a..173f378428a9 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -1227,11 +1227,19 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
1227 | rdev->clock.default_dispclk = | 1227 | rdev->clock.default_dispclk = |
1228 | le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); | 1228 | le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); |
1229 | if (rdev->clock.default_dispclk == 0) { | 1229 | if (rdev->clock.default_dispclk == 0) { |
1230 | if (ASIC_IS_DCE5(rdev)) | 1230 | if (ASIC_IS_DCE6(rdev)) |
1231 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ | ||
1232 | else if (ASIC_IS_DCE5(rdev)) | ||
1231 | rdev->clock.default_dispclk = 54000; /* 540 Mhz */ | 1233 | rdev->clock.default_dispclk = 54000; /* 540 Mhz */ |
1232 | else | 1234 | else |
1233 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ | 1235 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ |
1234 | } | 1236 | } |
1237 | /* set a reasonable default for DP */ | ||
1238 | if (ASIC_IS_DCE6(rdev) && (rdev->clock.default_dispclk < 53900)) { | ||
1239 | DRM_INFO("Changing default dispclk from %dMhz to 600Mhz\n", | ||
1240 | rdev->clock.default_dispclk / 100); | ||
1241 | rdev->clock.default_dispclk = 60000; | ||
1242 | } | ||
1235 | rdev->clock.dp_extclk = | 1243 | rdev->clock.dp_extclk = |
1236 | le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); | 1244 | le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); |
1237 | rdev->clock.current_dispclk = rdev->clock.default_dispclk; | 1245 | rdev->clock.current_dispclk = rdev->clock.default_dispclk; |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 933c5c39654d..44831197e82e 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -199,6 +199,9 @@ int radeon_get_monitor_bpc(struct drm_connector *connector) | |||
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | if ((radeon_deep_color == 0) && (bpc > 8)) | ||
203 | bpc = 8; | ||
204 | |||
202 | DRM_DEBUG("%s: Display bpc=%d, returned bpc=%d\n", | 205 | DRM_DEBUG("%s: Display bpc=%d, returned bpc=%d\n", |
203 | connector->name, connector->display_info.bpc, bpc); | 206 | connector->name, connector->display_info.bpc, bpc); |
204 | 207 | ||
@@ -1288,17 +1291,15 @@ static int radeon_dvi_mode_valid(struct drm_connector *connector, | |||
1288 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) || | 1291 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) || |
1289 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) | 1292 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) |
1290 | return MODE_OK; | 1293 | return MODE_OK; |
1291 | else if (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_A) { | 1294 | else if (ASIC_IS_DCE6(rdev) && drm_detect_hdmi_monitor(radeon_connector->edid)) { |
1292 | if (ASIC_IS_DCE6(rdev)) { | 1295 | /* HDMI 1.3+ supports max clock of 340 Mhz */ |
1293 | /* HDMI 1.3+ supports max clock of 340 Mhz */ | 1296 | if (mode->clock > 340000) |
1294 | if (mode->clock > 340000) | ||
1295 | return MODE_CLOCK_HIGH; | ||
1296 | else | ||
1297 | return MODE_OK; | ||
1298 | } else | ||
1299 | return MODE_CLOCK_HIGH; | 1297 | return MODE_CLOCK_HIGH; |
1300 | } else | 1298 | else |
1299 | return MODE_OK; | ||
1300 | } else { | ||
1301 | return MODE_CLOCK_HIGH; | 1301 | return MODE_CLOCK_HIGH; |
1302 | } | ||
1302 | } | 1303 | } |
1303 | 1304 | ||
1304 | /* check against the max pixel clock */ | 1305 | /* check against the max pixel clock */ |
@@ -1549,6 +1550,8 @@ out: | |||
1549 | static int radeon_dp_mode_valid(struct drm_connector *connector, | 1550 | static int radeon_dp_mode_valid(struct drm_connector *connector, |
1550 | struct drm_display_mode *mode) | 1551 | struct drm_display_mode *mode) |
1551 | { | 1552 | { |
1553 | struct drm_device *dev = connector->dev; | ||
1554 | struct radeon_device *rdev = dev->dev_private; | ||
1552 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1555 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1553 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; | 1556 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; |
1554 | 1557 | ||
@@ -1579,14 +1582,23 @@ static int radeon_dp_mode_valid(struct drm_connector *connector, | |||
1579 | return MODE_PANEL; | 1582 | return MODE_PANEL; |
1580 | } | 1583 | } |
1581 | } | 1584 | } |
1582 | return MODE_OK; | ||
1583 | } else { | 1585 | } else { |
1584 | if ((radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || | 1586 | if ((radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
1585 | (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) | 1587 | (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) { |
1586 | return radeon_dp_mode_valid_helper(connector, mode); | 1588 | return radeon_dp_mode_valid_helper(connector, mode); |
1587 | else | 1589 | } else { |
1588 | return MODE_OK; | 1590 | if (ASIC_IS_DCE6(rdev) && drm_detect_hdmi_monitor(radeon_connector->edid)) { |
1591 | /* HDMI 1.3+ supports max clock of 340 Mhz */ | ||
1592 | if (mode->clock > 340000) | ||
1593 | return MODE_CLOCK_HIGH; | ||
1594 | } else { | ||
1595 | if (mode->clock > 165000) | ||
1596 | return MODE_CLOCK_HIGH; | ||
1597 | } | ||
1598 | } | ||
1589 | } | 1599 | } |
1600 | |||
1601 | return MODE_OK; | ||
1590 | } | 1602 | } |
1591 | 1603 | ||
1592 | static const struct drm_connector_helper_funcs radeon_dp_connector_helper_funcs = { | 1604 | static const struct drm_connector_helper_funcs radeon_dp_connector_helper_funcs = { |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 5ed617056b9c..13896edcf0b6 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -66,7 +66,8 @@ static void avivo_crtc_load_lut(struct drm_crtc *crtc) | |||
66 | (radeon_crtc->lut_b[i] << 0)); | 66 | (radeon_crtc->lut_b[i] << 0)); |
67 | } | 67 | } |
68 | 68 | ||
69 | WREG32(AVIVO_D1GRPH_LUT_SEL + radeon_crtc->crtc_offset, radeon_crtc->crtc_id); | 69 | /* Only change bit 0 of LUT_SEL, other bits are set elsewhere */ |
70 | WREG32_P(AVIVO_D1GRPH_LUT_SEL + radeon_crtc->crtc_offset, radeon_crtc->crtc_id, ~1); | ||
70 | } | 71 | } |
71 | 72 | ||
72 | static void dce4_crtc_load_lut(struct drm_crtc *crtc) | 73 | static void dce4_crtc_load_lut(struct drm_crtc *crtc) |
@@ -284,7 +285,6 @@ static void radeon_unpin_work_func(struct work_struct *__work) | |||
284 | void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) | 285 | void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) |
285 | { | 286 | { |
286 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 287 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
287 | struct radeon_flip_work *work; | ||
288 | unsigned long flags; | 288 | unsigned long flags; |
289 | u32 update_pending; | 289 | u32 update_pending; |
290 | int vpos, hpos; | 290 | int vpos, hpos; |
@@ -294,8 +294,11 @@ void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) | |||
294 | return; | 294 | return; |
295 | 295 | ||
296 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); | 296 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); |
297 | work = radeon_crtc->flip_work; | 297 | if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) { |
298 | if (work == NULL) { | 298 | DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != " |
299 | "RADEON_FLIP_SUBMITTED(%d)\n", | ||
300 | radeon_crtc->flip_status, | ||
301 | RADEON_FLIP_SUBMITTED); | ||
299 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 302 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
300 | return; | 303 | return; |
301 | } | 304 | } |
@@ -343,12 +346,17 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) | |||
343 | 346 | ||
344 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); | 347 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); |
345 | work = radeon_crtc->flip_work; | 348 | work = radeon_crtc->flip_work; |
346 | if (work == NULL) { | 349 | if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) { |
350 | DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != " | ||
351 | "RADEON_FLIP_SUBMITTED(%d)\n", | ||
352 | radeon_crtc->flip_status, | ||
353 | RADEON_FLIP_SUBMITTED); | ||
347 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 354 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
348 | return; | 355 | return; |
349 | } | 356 | } |
350 | 357 | ||
351 | /* Pageflip completed. Clean up. */ | 358 | /* Pageflip completed. Clean up. */ |
359 | radeon_crtc->flip_status = RADEON_FLIP_NONE; | ||
352 | radeon_crtc->flip_work = NULL; | 360 | radeon_crtc->flip_work = NULL; |
353 | 361 | ||
354 | /* wakeup userspace */ | 362 | /* wakeup userspace */ |
@@ -357,8 +365,9 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) | |||
357 | 365 | ||
358 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 366 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
359 | 367 | ||
368 | drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id); | ||
360 | radeon_fence_unref(&work->fence); | 369 | radeon_fence_unref(&work->fence); |
361 | radeon_irq_kms_pflip_irq_get(rdev, work->crtc_id); | 370 | radeon_irq_kms_pflip_irq_put(rdev, work->crtc_id); |
362 | queue_work(radeon_crtc->flip_queue, &work->unpin_work); | 371 | queue_work(radeon_crtc->flip_queue, &work->unpin_work); |
363 | } | 372 | } |
364 | 373 | ||
@@ -459,6 +468,12 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
459 | base &= ~7; | 468 | base &= ~7; |
460 | } | 469 | } |
461 | 470 | ||
471 | r = drm_vblank_get(crtc->dev, radeon_crtc->crtc_id); | ||
472 | if (r) { | ||
473 | DRM_ERROR("failed to get vblank before flip\n"); | ||
474 | goto pflip_cleanup; | ||
475 | } | ||
476 | |||
462 | /* We borrow the event spin lock for protecting flip_work */ | 477 | /* We borrow the event spin lock for protecting flip_work */ |
463 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | 478 | spin_lock_irqsave(&crtc->dev->event_lock, flags); |
464 | 479 | ||
@@ -468,11 +483,22 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
468 | /* do the flip (mmio) */ | 483 | /* do the flip (mmio) */ |
469 | radeon_page_flip(rdev, radeon_crtc->crtc_id, base); | 484 | radeon_page_flip(rdev, radeon_crtc->crtc_id, base); |
470 | 485 | ||
486 | radeon_crtc->flip_status = RADEON_FLIP_SUBMITTED; | ||
471 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 487 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
472 | up_read(&rdev->exclusive_lock); | 488 | up_read(&rdev->exclusive_lock); |
473 | 489 | ||
474 | return; | 490 | return; |
475 | 491 | ||
492 | pflip_cleanup: | ||
493 | if (unlikely(radeon_bo_reserve(work->new_rbo, false) != 0)) { | ||
494 | DRM_ERROR("failed to reserve new rbo in error path\n"); | ||
495 | goto cleanup; | ||
496 | } | ||
497 | if (unlikely(radeon_bo_unpin(work->new_rbo) != 0)) { | ||
498 | DRM_ERROR("failed to unpin new rbo in error path\n"); | ||
499 | } | ||
500 | radeon_bo_unreserve(work->new_rbo); | ||
501 | |||
476 | cleanup: | 502 | cleanup: |
477 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | 503 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); |
478 | radeon_fence_unref(&work->fence); | 504 | radeon_fence_unref(&work->fence); |
@@ -526,7 +552,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, | |||
526 | /* We borrow the event spin lock for protecting flip_work */ | 552 | /* We borrow the event spin lock for protecting flip_work */ |
527 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | 553 | spin_lock_irqsave(&crtc->dev->event_lock, flags); |
528 | 554 | ||
529 | if (radeon_crtc->flip_work) { | 555 | if (radeon_crtc->flip_status != RADEON_FLIP_NONE) { |
530 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); | 556 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); |
531 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 557 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
532 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | 558 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); |
@@ -534,6 +560,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, | |||
534 | kfree(work); | 560 | kfree(work); |
535 | return -EBUSY; | 561 | return -EBUSY; |
536 | } | 562 | } |
563 | radeon_crtc->flip_status = RADEON_FLIP_PENDING; | ||
537 | radeon_crtc->flip_work = work; | 564 | radeon_crtc->flip_work = work; |
538 | 565 | ||
539 | /* update crtc fb */ | 566 | /* update crtc fb */ |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 6e3017413386..cb1421369e3a 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -175,6 +175,7 @@ int radeon_runtime_pm = -1; | |||
175 | int radeon_hard_reset = 0; | 175 | int radeon_hard_reset = 0; |
176 | int radeon_vm_size = 4096; | 176 | int radeon_vm_size = 4096; |
177 | int radeon_vm_block_size = 9; | 177 | int radeon_vm_block_size = 9; |
178 | int radeon_deep_color = 0; | ||
178 | 179 | ||
179 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); | 180 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); |
180 | module_param_named(no_wb, radeon_no_wb, int, 0444); | 181 | module_param_named(no_wb, radeon_no_wb, int, 0444); |
@@ -248,6 +249,9 @@ module_param_named(vm_size, radeon_vm_size, int, 0444); | |||
248 | MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default 9)"); | 249 | MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default 9)"); |
249 | module_param_named(vm_block_size, radeon_vm_block_size, int, 0444); | 250 | module_param_named(vm_block_size, radeon_vm_block_size, int, 0444); |
250 | 251 | ||
252 | MODULE_PARM_DESC(deep_color, "Deep Color support (1 = enable, 0 = disable (default))"); | ||
253 | module_param_named(deep_color, radeon_deep_color, int, 0444); | ||
254 | |||
251 | static struct pci_device_id pciidlist[] = { | 255 | static struct pci_device_id pciidlist[] = { |
252 | radeon_PCI_IDS | 256 | radeon_PCI_IDS |
253 | }; | 257 | }; |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index ad0e4b8cc7e3..0592ddb0904b 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -46,6 +46,10 @@ struct radeon_device; | |||
46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) | 46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) |
47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) | 47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) |
48 | 48 | ||
49 | #define RADEON_MAX_HPD_PINS 7 | ||
50 | #define RADEON_MAX_CRTCS 6 | ||
51 | #define RADEON_MAX_AFMT_BLOCKS 7 | ||
52 | |||
49 | enum radeon_rmx_type { | 53 | enum radeon_rmx_type { |
50 | RMX_OFF, | 54 | RMX_OFF, |
51 | RMX_FULL, | 55 | RMX_FULL, |
@@ -233,8 +237,8 @@ struct radeon_mode_info { | |||
233 | struct card_info *atom_card_info; | 237 | struct card_info *atom_card_info; |
234 | enum radeon_connector_table connector_table; | 238 | enum radeon_connector_table connector_table; |
235 | bool mode_config_initialized; | 239 | bool mode_config_initialized; |
236 | struct radeon_crtc *crtcs[6]; | 240 | struct radeon_crtc *crtcs[RADEON_MAX_CRTCS]; |
237 | struct radeon_afmt *afmt[7]; | 241 | struct radeon_afmt *afmt[RADEON_MAX_AFMT_BLOCKS]; |
238 | /* DVI-I properties */ | 242 | /* DVI-I properties */ |
239 | struct drm_property *coherent_mode_property; | 243 | struct drm_property *coherent_mode_property; |
240 | /* DAC enable load detect */ | 244 | /* DAC enable load detect */ |
@@ -302,6 +306,12 @@ struct radeon_atom_ss { | |||
302 | uint16_t amount; | 306 | uint16_t amount; |
303 | }; | 307 | }; |
304 | 308 | ||
309 | enum radeon_flip_status { | ||
310 | RADEON_FLIP_NONE, | ||
311 | RADEON_FLIP_PENDING, | ||
312 | RADEON_FLIP_SUBMITTED | ||
313 | }; | ||
314 | |||
305 | struct radeon_crtc { | 315 | struct radeon_crtc { |
306 | struct drm_crtc base; | 316 | struct drm_crtc base; |
307 | int crtc_id; | 317 | int crtc_id; |
@@ -327,6 +337,7 @@ struct radeon_crtc { | |||
327 | /* page flipping */ | 337 | /* page flipping */ |
328 | struct workqueue_struct *flip_queue; | 338 | struct workqueue_struct *flip_queue; |
329 | struct radeon_flip_work *flip_work; | 339 | struct radeon_flip_work *flip_work; |
340 | enum radeon_flip_status flip_status; | ||
330 | /* pll sharing */ | 341 | /* pll sharing */ |
331 | struct radeon_atom_ss ss; | 342 | struct radeon_atom_ss ss; |
332 | bool ss_enabled; | 343 | bool ss_enabled; |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 12c663e86ca1..e447e390d09a 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -73,8 +73,10 @@ void radeon_pm_acpi_event_handler(struct radeon_device *rdev) | |||
73 | rdev->pm.dpm.ac_power = true; | 73 | rdev->pm.dpm.ac_power = true; |
74 | else | 74 | else |
75 | rdev->pm.dpm.ac_power = false; | 75 | rdev->pm.dpm.ac_power = false; |
76 | if (rdev->asic->dpm.enable_bapm) | 76 | if (rdev->family == CHIP_ARUBA) { |
77 | radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); | 77 | if (rdev->asic->dpm.enable_bapm) |
78 | radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); | ||
79 | } | ||
78 | mutex_unlock(&rdev->pm.mutex); | 80 | mutex_unlock(&rdev->pm.mutex); |
79 | } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { | 81 | } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { |
80 | if (rdev->pm.profile == PM_PROFILE_AUTO) { | 82 | if (rdev->pm.profile == PM_PROFILE_AUTO) { |
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c index 899d9126cad6..eecff6bbd341 100644 --- a/drivers/gpu/drm/radeon/radeon_vm.c +++ b/drivers/gpu/drm/radeon/radeon_vm.c | |||
@@ -495,7 +495,7 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, | |||
495 | mutex_unlock(&vm->mutex); | 495 | mutex_unlock(&vm->mutex); |
496 | 496 | ||
497 | r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8, | 497 | r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8, |
498 | RADEON_GPU_PAGE_SIZE, false, | 498 | RADEON_GPU_PAGE_SIZE, true, |
499 | RADEON_GEM_DOMAIN_VRAM, NULL, &pt); | 499 | RADEON_GEM_DOMAIN_VRAM, NULL, &pt); |
500 | if (r) | 500 | if (r) |
501 | return r; | 501 | return r; |
@@ -992,7 +992,7 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) | |||
992 | return -ENOMEM; | 992 | return -ENOMEM; |
993 | } | 993 | } |
994 | 994 | ||
995 | r = radeon_bo_create(rdev, pd_size, align, false, | 995 | r = radeon_bo_create(rdev, pd_size, align, true, |
996 | RADEON_GEM_DOMAIN_VRAM, NULL, | 996 | RADEON_GEM_DOMAIN_VRAM, NULL, |
997 | &vm->page_directory); | 997 | &vm->page_directory); |
998 | if (r) | 998 | if (r) |
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index da041a43d82e..3c76e1dcdf04 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c | |||
@@ -2329,12 +2329,6 @@ void rv770_get_engine_memory_ss(struct radeon_device *rdev) | |||
2329 | pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, | 2329 | pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, |
2330 | ASIC_INTERNAL_MEMORY_SS, 0); | 2330 | ASIC_INTERNAL_MEMORY_SS, 0); |
2331 | 2331 | ||
2332 | /* disable ss, causes hangs on some cayman boards */ | ||
2333 | if (rdev->family == CHIP_CAYMAN) { | ||
2334 | pi->sclk_ss = false; | ||
2335 | pi->mclk_ss = false; | ||
2336 | } | ||
2337 | |||
2338 | if (pi->sclk_ss || pi->mclk_ss) | 2332 | if (pi->sclk_ss || pi->mclk_ss) |
2339 | pi->dynamic_ss = true; | 2333 | pi->dynamic_ss = true; |
2340 | else | 2334 | else |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 730cee2c34cf..eba0225259a4 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -6376,14 +6376,16 @@ restart_ih: | |||
6376 | case 147: | 6376 | case 147: |
6377 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); | 6377 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); |
6378 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); | 6378 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); |
6379 | /* reset addr and status */ | ||
6380 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
6381 | if (addr == 0x0 && status == 0x0) | ||
6382 | break; | ||
6379 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); | 6383 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); |
6380 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", | 6384 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", |
6381 | addr); | 6385 | addr); |
6382 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", | 6386 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
6383 | status); | 6387 | status); |
6384 | si_vm_decode_fault(rdev, status, addr); | 6388 | si_vm_decode_fault(rdev, status, addr); |
6385 | /* reset addr and status */ | ||
6386 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
6387 | break; | 6389 | break; |
6388 | case 176: /* RINGID0 CP_INT */ | 6390 | case 176: /* RINGID0 CP_INT */ |
6389 | radeon_fence_process(rdev, RADEON_RING_TYPE_GFX_INDEX); | 6391 | radeon_fence_process(rdev, RADEON_RING_TYPE_GFX_INDEX); |
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c index 2a2822c03329..20da6ff183df 100644 --- a/drivers/gpu/drm/radeon/trinity_dpm.c +++ b/drivers/gpu/drm/radeon/trinity_dpm.c | |||
@@ -1874,7 +1874,15 @@ int trinity_dpm_init(struct radeon_device *rdev) | |||
1874 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) | 1874 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) |
1875 | pi->at[i] = TRINITY_AT_DFLT; | 1875 | pi->at[i] = TRINITY_AT_DFLT; |
1876 | 1876 | ||
1877 | pi->enable_bapm = false; | 1877 | /* There are stability issues reported on latops with |
1878 | * bapm installed when switching between AC and battery | ||
1879 | * power. At the same time, some desktop boards hang | ||
1880 | * if it's not enabled and dpm is enabled. | ||
1881 | */ | ||
1882 | if (rdev->flags & RADEON_IS_MOBILITY) | ||
1883 | pi->enable_bapm = false; | ||
1884 | else | ||
1885 | pi->enable_bapm = true; | ||
1878 | pi->enable_nbps_policy = true; | 1886 | pi->enable_nbps_policy = true; |
1879 | pi->enable_sclk_ds = true; | 1887 | pi->enable_sclk_ds = true; |
1880 | pi->enable_gfx_power_gating = true; | 1888 | pi->enable_gfx_power_gating = true; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c index a89ad938eacf..b031b48dbb3c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | |||
@@ -179,7 +179,6 @@ static int vmw_fb_set_par(struct fb_info *info) | |||
179 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset); | 179 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset); |
180 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres); | 180 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres); |
181 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres); | 181 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres); |
182 | vmw_write(vmw_priv, SVGA_REG_BYTES_PER_LINE, info->fix.line_length); | ||
183 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); | 182 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); |
184 | } | 183 | } |
185 | 184 | ||
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 800c8b60f7a2..5e79c6ad914f 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -810,7 +810,7 @@ config HID_ZYDACRON | |||
810 | 810 | ||
811 | config HID_SENSOR_HUB | 811 | config HID_SENSOR_HUB |
812 | tristate "HID Sensors framework support" | 812 | tristate "HID Sensors framework support" |
813 | depends on HID | 813 | depends on HID && HAS_IOMEM |
814 | select MFD_CORE | 814 | select MFD_CORE |
815 | default n | 815 | default n |
816 | ---help--- | 816 | ---help--- |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 6d00bb9366fa..48b66bbffc94 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -323,6 +323,7 @@ | |||
323 | 323 | ||
324 | #define USB_VENDOR_ID_ETURBOTOUCH 0x22b9 | 324 | #define USB_VENDOR_ID_ETURBOTOUCH 0x22b9 |
325 | #define USB_DEVICE_ID_ETURBOTOUCH 0x0006 | 325 | #define USB_DEVICE_ID_ETURBOTOUCH 0x0006 |
326 | #define USB_DEVICE_ID_ETURBOTOUCH_2968 0x2968 | ||
326 | 327 | ||
327 | #define USB_VENDOR_ID_EZKEY 0x0518 | 328 | #define USB_VENDOR_ID_EZKEY 0x0518 |
328 | #define USB_DEVICE_ID_BTC_8193 0x0002 | 329 | #define USB_DEVICE_ID_BTC_8193 0x0002 |
@@ -715,6 +716,8 @@ | |||
715 | 716 | ||
716 | #define USB_VENDOR_ID_PENMOUNT 0x14e1 | 717 | #define USB_VENDOR_ID_PENMOUNT 0x14e1 |
717 | #define USB_DEVICE_ID_PENMOUNT_PCI 0x3500 | 718 | #define USB_DEVICE_ID_PENMOUNT_PCI 0x3500 |
719 | #define USB_DEVICE_ID_PENMOUNT_1610 0x1610 | ||
720 | #define USB_DEVICE_ID_PENMOUNT_1640 0x1640 | ||
718 | 721 | ||
719 | #define USB_VENDOR_ID_PETALYNX 0x18b1 | 722 | #define USB_VENDOR_ID_PETALYNX 0x18b1 |
720 | #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 | 723 | #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 |
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 2451c7e5febd..578bbe65902b 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c | |||
@@ -428,6 +428,7 @@ static int rmi_raw_event(struct hid_device *hdev, | |||
428 | return 0; | 428 | return 0; |
429 | } | 429 | } |
430 | 430 | ||
431 | #ifdef CONFIG_PM | ||
431 | static int rmi_post_reset(struct hid_device *hdev) | 432 | static int rmi_post_reset(struct hid_device *hdev) |
432 | { | 433 | { |
433 | return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); | 434 | return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); |
@@ -437,6 +438,7 @@ static int rmi_post_resume(struct hid_device *hdev) | |||
437 | { | 438 | { |
438 | return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); | 439 | return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); |
439 | } | 440 | } |
441 | #endif /* CONFIG_PM */ | ||
440 | 442 | ||
441 | #define RMI4_MAX_PAGE 0xff | 443 | #define RMI4_MAX_PAGE 0xff |
442 | #define RMI4_PAGE_SIZE 0x0100 | 444 | #define RMI4_PAGE_SIZE 0x0100 |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index a8d5c8faf8cf..e244e449cbba 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -159,17 +159,18 @@ int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev, | |||
159 | { | 159 | { |
160 | struct hid_sensor_hub_callbacks_list *callback; | 160 | struct hid_sensor_hub_callbacks_list *callback; |
161 | struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); | 161 | struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); |
162 | unsigned long flags; | ||
162 | 163 | ||
163 | spin_lock(&pdata->dyn_callback_lock); | 164 | spin_lock_irqsave(&pdata->dyn_callback_lock, flags); |
164 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) | 165 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) |
165 | if (callback->usage_id == usage_id && | 166 | if (callback->usage_id == usage_id && |
166 | callback->hsdev == hsdev) { | 167 | callback->hsdev == hsdev) { |
167 | spin_unlock(&pdata->dyn_callback_lock); | 168 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
168 | return -EINVAL; | 169 | return -EINVAL; |
169 | } | 170 | } |
170 | callback = kzalloc(sizeof(*callback), GFP_ATOMIC); | 171 | callback = kzalloc(sizeof(*callback), GFP_ATOMIC); |
171 | if (!callback) { | 172 | if (!callback) { |
172 | spin_unlock(&pdata->dyn_callback_lock); | 173 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
173 | return -ENOMEM; | 174 | return -ENOMEM; |
174 | } | 175 | } |
175 | callback->hsdev = hsdev; | 176 | callback->hsdev = hsdev; |
@@ -177,7 +178,7 @@ int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev, | |||
177 | callback->usage_id = usage_id; | 178 | callback->usage_id = usage_id; |
178 | callback->priv = NULL; | 179 | callback->priv = NULL; |
179 | list_add_tail(&callback->list, &pdata->dyn_callback_list); | 180 | list_add_tail(&callback->list, &pdata->dyn_callback_list); |
180 | spin_unlock(&pdata->dyn_callback_lock); | 181 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
181 | 182 | ||
182 | return 0; | 183 | return 0; |
183 | } | 184 | } |
@@ -188,8 +189,9 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev, | |||
188 | { | 189 | { |
189 | struct hid_sensor_hub_callbacks_list *callback; | 190 | struct hid_sensor_hub_callbacks_list *callback; |
190 | struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); | 191 | struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); |
192 | unsigned long flags; | ||
191 | 193 | ||
192 | spin_lock(&pdata->dyn_callback_lock); | 194 | spin_lock_irqsave(&pdata->dyn_callback_lock, flags); |
193 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) | 195 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) |
194 | if (callback->usage_id == usage_id && | 196 | if (callback->usage_id == usage_id && |
195 | callback->hsdev == hsdev) { | 197 | callback->hsdev == hsdev) { |
@@ -197,7 +199,7 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev, | |||
197 | kfree(callback); | 199 | kfree(callback); |
198 | break; | 200 | break; |
199 | } | 201 | } |
200 | spin_unlock(&pdata->dyn_callback_lock); | 202 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
201 | 203 | ||
202 | return 0; | 204 | return 0; |
203 | } | 205 | } |
@@ -378,15 +380,16 @@ static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message) | |||
378 | { | 380 | { |
379 | struct sensor_hub_data *pdata = hid_get_drvdata(hdev); | 381 | struct sensor_hub_data *pdata = hid_get_drvdata(hdev); |
380 | struct hid_sensor_hub_callbacks_list *callback; | 382 | struct hid_sensor_hub_callbacks_list *callback; |
383 | unsigned long flags; | ||
381 | 384 | ||
382 | hid_dbg(hdev, " sensor_hub_suspend\n"); | 385 | hid_dbg(hdev, " sensor_hub_suspend\n"); |
383 | spin_lock(&pdata->dyn_callback_lock); | 386 | spin_lock_irqsave(&pdata->dyn_callback_lock, flags); |
384 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) { | 387 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) { |
385 | if (callback->usage_callback->suspend) | 388 | if (callback->usage_callback->suspend) |
386 | callback->usage_callback->suspend( | 389 | callback->usage_callback->suspend( |
387 | callback->hsdev, callback->priv); | 390 | callback->hsdev, callback->priv); |
388 | } | 391 | } |
389 | spin_unlock(&pdata->dyn_callback_lock); | 392 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
390 | 393 | ||
391 | return 0; | 394 | return 0; |
392 | } | 395 | } |
@@ -395,15 +398,16 @@ static int sensor_hub_resume(struct hid_device *hdev) | |||
395 | { | 398 | { |
396 | struct sensor_hub_data *pdata = hid_get_drvdata(hdev); | 399 | struct sensor_hub_data *pdata = hid_get_drvdata(hdev); |
397 | struct hid_sensor_hub_callbacks_list *callback; | 400 | struct hid_sensor_hub_callbacks_list *callback; |
401 | unsigned long flags; | ||
398 | 402 | ||
399 | hid_dbg(hdev, " sensor_hub_resume\n"); | 403 | hid_dbg(hdev, " sensor_hub_resume\n"); |
400 | spin_lock(&pdata->dyn_callback_lock); | 404 | spin_lock_irqsave(&pdata->dyn_callback_lock, flags); |
401 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) { | 405 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) { |
402 | if (callback->usage_callback->resume) | 406 | if (callback->usage_callback->resume) |
403 | callback->usage_callback->resume( | 407 | callback->usage_callback->resume( |
404 | callback->hsdev, callback->priv); | 408 | callback->hsdev, callback->priv); |
405 | } | 409 | } |
406 | spin_unlock(&pdata->dyn_callback_lock); | 410 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
407 | 411 | ||
408 | return 0; | 412 | return 0; |
409 | } | 413 | } |
@@ -632,6 +636,7 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
632 | if (name == NULL) { | 636 | if (name == NULL) { |
633 | hid_err(hdev, "Failed MFD device name\n"); | 637 | hid_err(hdev, "Failed MFD device name\n"); |
634 | ret = -ENOMEM; | 638 | ret = -ENOMEM; |
639 | kfree(hsdev); | ||
635 | goto err_no_mem; | 640 | goto err_no_mem; |
636 | } | 641 | } |
637 | sd->hid_sensor_hub_client_devs[ | 642 | sd->hid_sensor_hub_client_devs[ |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 59badc10a08c..31e6727cd009 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -49,6 +49,7 @@ static const struct hid_blacklist { | |||
49 | 49 | ||
50 | { USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II, HID_QUIRK_MULTI_INPUT }, | 50 | { USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II, HID_QUIRK_MULTI_INPUT }, |
51 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT }, | 51 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT }, |
52 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH_2968, HID_QUIRK_MULTI_INPUT }, | ||
52 | { USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD, HID_QUIRK_MULTI_INPUT }, | 53 | { USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD, HID_QUIRK_MULTI_INPUT }, |
53 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | 54 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, |
54 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, | 55 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, |
@@ -76,6 +77,8 @@ static const struct hid_blacklist { | |||
76 | { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, | 77 | { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, |
77 | { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, | 78 | { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, |
78 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, | 79 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, |
80 | { USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1610, HID_QUIRK_NOGET }, | ||
81 | { USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1640, HID_QUIRK_NOGET }, | ||
79 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS }, | 82 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS }, |
80 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS }, | 83 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS }, |
81 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS }, | 84 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS }, |
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index e84f4526eb36..ae22e3c1fc4c 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c | |||
@@ -339,9 +339,13 @@ static void process_chn_event(u32 relid) | |||
339 | */ | 339 | */ |
340 | 340 | ||
341 | do { | 341 | do { |
342 | hv_begin_read(&channel->inbound); | 342 | if (read_state) |
343 | hv_begin_read(&channel->inbound); | ||
343 | channel->onchannel_callback(arg); | 344 | channel->onchannel_callback(arg); |
344 | bytes_to_read = hv_end_read(&channel->inbound); | 345 | if (read_state) |
346 | bytes_to_read = hv_end_read(&channel->inbound); | ||
347 | else | ||
348 | bytes_to_read = 0; | ||
345 | } while (read_state && (bytes_to_read != 0)); | 349 | } while (read_state && (bytes_to_read != 0)); |
346 | } else { | 350 | } else { |
347 | pr_err("no channel callback for relid - %u\n", relid); | 351 | pr_err("no channel callback for relid - %u\n", relid); |
diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index ea852537307e..521c14625b3a 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c | |||
@@ -127,6 +127,17 @@ kvp_work_func(struct work_struct *dummy) | |||
127 | kvp_respond_to_host(NULL, HV_E_FAIL); | 127 | kvp_respond_to_host(NULL, HV_E_FAIL); |
128 | } | 128 | } |
129 | 129 | ||
130 | static void poll_channel(struct vmbus_channel *channel) | ||
131 | { | ||
132 | if (channel->target_cpu != smp_processor_id()) | ||
133 | smp_call_function_single(channel->target_cpu, | ||
134 | hv_kvp_onchannelcallback, | ||
135 | channel, true); | ||
136 | else | ||
137 | hv_kvp_onchannelcallback(channel); | ||
138 | } | ||
139 | |||
140 | |||
130 | static int kvp_handle_handshake(struct hv_kvp_msg *msg) | 141 | static int kvp_handle_handshake(struct hv_kvp_msg *msg) |
131 | { | 142 | { |
132 | int ret = 1; | 143 | int ret = 1; |
@@ -155,7 +166,7 @@ static int kvp_handle_handshake(struct hv_kvp_msg *msg) | |||
155 | kvp_register(dm_reg_value); | 166 | kvp_register(dm_reg_value); |
156 | kvp_transaction.active = false; | 167 | kvp_transaction.active = false; |
157 | if (kvp_transaction.kvp_context) | 168 | if (kvp_transaction.kvp_context) |
158 | hv_kvp_onchannelcallback(kvp_transaction.kvp_context); | 169 | poll_channel(kvp_transaction.kvp_context); |
159 | } | 170 | } |
160 | return ret; | 171 | return ret; |
161 | } | 172 | } |
@@ -568,7 +579,7 @@ response_done: | |||
568 | 579 | ||
569 | vmbus_sendpacket(channel, recv_buffer, buf_len, req_id, | 580 | vmbus_sendpacket(channel, recv_buffer, buf_len, req_id, |
570 | VM_PKT_DATA_INBAND, 0); | 581 | VM_PKT_DATA_INBAND, 0); |
571 | 582 | poll_channel(channel); | |
572 | } | 583 | } |
573 | 584 | ||
574 | /* | 585 | /* |
@@ -603,7 +614,7 @@ void hv_kvp_onchannelcallback(void *context) | |||
603 | return; | 614 | return; |
604 | } | 615 | } |
605 | 616 | ||
606 | vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen, | 617 | vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 4, &recvlen, |
607 | &requestid); | 618 | &requestid); |
608 | 619 | ||
609 | if (recvlen > 0) { | 620 | if (recvlen > 0) { |
diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index dd761806f0e8..3b9c9ef0deb8 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c | |||
@@ -319,7 +319,7 @@ static int util_probe(struct hv_device *dev, | |||
319 | (struct hv_util_service *)dev_id->driver_data; | 319 | (struct hv_util_service *)dev_id->driver_data; |
320 | int ret; | 320 | int ret; |
321 | 321 | ||
322 | srv->recv_buffer = kmalloc(PAGE_SIZE * 2, GFP_KERNEL); | 322 | srv->recv_buffer = kmalloc(PAGE_SIZE * 4, GFP_KERNEL); |
323 | if (!srv->recv_buffer) | 323 | if (!srv->recv_buffer) |
324 | return -ENOMEM; | 324 | return -ENOMEM; |
325 | if (srv->util_init) { | 325 | if (srv->util_init) { |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 08531a128f53..02d3d85829f3 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -1052,7 +1052,7 @@ config SENSORS_PC87427 | |||
1052 | will be called pc87427. | 1052 | will be called pc87427. |
1053 | 1053 | ||
1054 | config SENSORS_NTC_THERMISTOR | 1054 | config SENSORS_NTC_THERMISTOR |
1055 | tristate "NTC thermistor support" | 1055 | tristate "NTC thermistor support from Murata" |
1056 | depends on !OF || IIO=n || IIO | 1056 | depends on !OF || IIO=n || IIO |
1057 | help | 1057 | help |
1058 | This driver supports NTC thermistors sensor reading and its | 1058 | This driver supports NTC thermistors sensor reading and its |
@@ -1060,7 +1060,8 @@ config SENSORS_NTC_THERMISTOR | |||
1060 | send notifications about the temperature. | 1060 | send notifications about the temperature. |
1061 | 1061 | ||
1062 | Currently, this driver supports | 1062 | Currently, this driver supports |
1063 | NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333. | 1063 | NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333 |
1064 | from Murata. | ||
1064 | 1065 | ||
1065 | This driver can also be built as a module. If so, the module | 1066 | This driver can also be built as a module. If so, the module |
1066 | will be called ntc-thermistor. | 1067 | will be called ntc-thermistor. |
@@ -1176,6 +1177,7 @@ config SENSORS_DME1737 | |||
1176 | config SENSORS_EMC1403 | 1177 | config SENSORS_EMC1403 |
1177 | tristate "SMSC EMC1403/23 thermal sensor" | 1178 | tristate "SMSC EMC1403/23 thermal sensor" |
1178 | depends on I2C | 1179 | depends on I2C |
1180 | select REGMAP_I2C | ||
1179 | help | 1181 | help |
1180 | If you say yes here you get support for the SMSC EMC1403/23 | 1182 | If you say yes here you get support for the SMSC EMC1403/23 |
1181 | temperature monitoring chip. | 1183 | temperature monitoring chip. |
diff --git a/drivers/hwmon/adc128d818.c b/drivers/hwmon/adc128d818.c index 5ffd81f19d01..0625e50d7a6e 100644 --- a/drivers/hwmon/adc128d818.c +++ b/drivers/hwmon/adc128d818.c | |||
@@ -239,50 +239,50 @@ static ssize_t adc128_show_alarm(struct device *dev, | |||
239 | return sprintf(buf, "%u\n", !!(alarms & mask)); | 239 | return sprintf(buf, "%u\n", !!(alarms & mask)); |
240 | } | 240 | } |
241 | 241 | ||
242 | static SENSOR_DEVICE_ATTR_2(in0_input, S_IWUSR | S_IRUGO, | 242 | static SENSOR_DEVICE_ATTR_2(in0_input, S_IRUGO, |
243 | adc128_show_in, adc128_set_in, 0, 0); | 243 | adc128_show_in, NULL, 0, 0); |
244 | static SENSOR_DEVICE_ATTR_2(in0_min, S_IWUSR | S_IRUGO, | 244 | static SENSOR_DEVICE_ATTR_2(in0_min, S_IWUSR | S_IRUGO, |
245 | adc128_show_in, adc128_set_in, 0, 1); | 245 | adc128_show_in, adc128_set_in, 0, 1); |
246 | static SENSOR_DEVICE_ATTR_2(in0_max, S_IWUSR | S_IRUGO, | 246 | static SENSOR_DEVICE_ATTR_2(in0_max, S_IWUSR | S_IRUGO, |
247 | adc128_show_in, adc128_set_in, 0, 2); | 247 | adc128_show_in, adc128_set_in, 0, 2); |
248 | 248 | ||
249 | static SENSOR_DEVICE_ATTR_2(in1_input, S_IWUSR | S_IRUGO, | 249 | static SENSOR_DEVICE_ATTR_2(in1_input, S_IRUGO, |
250 | adc128_show_in, adc128_set_in, 1, 0); | 250 | adc128_show_in, NULL, 1, 0); |
251 | static SENSOR_DEVICE_ATTR_2(in1_min, S_IWUSR | S_IRUGO, | 251 | static SENSOR_DEVICE_ATTR_2(in1_min, S_IWUSR | S_IRUGO, |
252 | adc128_show_in, adc128_set_in, 1, 1); | 252 | adc128_show_in, adc128_set_in, 1, 1); |
253 | static SENSOR_DEVICE_ATTR_2(in1_max, S_IWUSR | S_IRUGO, | 253 | static SENSOR_DEVICE_ATTR_2(in1_max, S_IWUSR | S_IRUGO, |
254 | adc128_show_in, adc128_set_in, 1, 2); | 254 | adc128_show_in, adc128_set_in, 1, 2); |
255 | 255 | ||
256 | static SENSOR_DEVICE_ATTR_2(in2_input, S_IWUSR | S_IRUGO, | 256 | static SENSOR_DEVICE_ATTR_2(in2_input, S_IRUGO, |
257 | adc128_show_in, adc128_set_in, 2, 0); | 257 | adc128_show_in, NULL, 2, 0); |
258 | static SENSOR_DEVICE_ATTR_2(in2_min, S_IWUSR | S_IRUGO, | 258 | static SENSOR_DEVICE_ATTR_2(in2_min, S_IWUSR | S_IRUGO, |
259 | adc128_show_in, adc128_set_in, 2, 1); | 259 | adc128_show_in, adc128_set_in, 2, 1); |
260 | static SENSOR_DEVICE_ATTR_2(in2_max, S_IWUSR | S_IRUGO, | 260 | static SENSOR_DEVICE_ATTR_2(in2_max, S_IWUSR | S_IRUGO, |
261 | adc128_show_in, adc128_set_in, 2, 2); | 261 | adc128_show_in, adc128_set_in, 2, 2); |
262 | 262 | ||
263 | static SENSOR_DEVICE_ATTR_2(in3_input, S_IWUSR | S_IRUGO, | 263 | static SENSOR_DEVICE_ATTR_2(in3_input, S_IRUGO, |
264 | adc128_show_in, adc128_set_in, 3, 0); | 264 | adc128_show_in, NULL, 3, 0); |
265 | static SENSOR_DEVICE_ATTR_2(in3_min, S_IWUSR | S_IRUGO, | 265 | static SENSOR_DEVICE_ATTR_2(in3_min, S_IWUSR | S_IRUGO, |
266 | adc128_show_in, adc128_set_in, 3, 1); | 266 | adc128_show_in, adc128_set_in, 3, 1); |
267 | static SENSOR_DEVICE_ATTR_2(in3_max, S_IWUSR | S_IRUGO, | 267 | static SENSOR_DEVICE_ATTR_2(in3_max, S_IWUSR | S_IRUGO, |
268 | adc128_show_in, adc128_set_in, 3, 2); | 268 | adc128_show_in, adc128_set_in, 3, 2); |
269 | 269 | ||
270 | static SENSOR_DEVICE_ATTR_2(in4_input, S_IWUSR | S_IRUGO, | 270 | static SENSOR_DEVICE_ATTR_2(in4_input, S_IRUGO, |
271 | adc128_show_in, adc128_set_in, 4, 0); | 271 | adc128_show_in, NULL, 4, 0); |
272 | static SENSOR_DEVICE_ATTR_2(in4_min, S_IWUSR | S_IRUGO, | 272 | static SENSOR_DEVICE_ATTR_2(in4_min, S_IWUSR | S_IRUGO, |
273 | adc128_show_in, adc128_set_in, 4, 1); | 273 | adc128_show_in, adc128_set_in, 4, 1); |
274 | static SENSOR_DEVICE_ATTR_2(in4_max, S_IWUSR | S_IRUGO, | 274 | static SENSOR_DEVICE_ATTR_2(in4_max, S_IWUSR | S_IRUGO, |
275 | adc128_show_in, adc128_set_in, 4, 2); | 275 | adc128_show_in, adc128_set_in, 4, 2); |
276 | 276 | ||
277 | static SENSOR_DEVICE_ATTR_2(in5_input, S_IWUSR | S_IRUGO, | 277 | static SENSOR_DEVICE_ATTR_2(in5_input, S_IRUGO, |
278 | adc128_show_in, adc128_set_in, 5, 0); | 278 | adc128_show_in, NULL, 5, 0); |
279 | static SENSOR_DEVICE_ATTR_2(in5_min, S_IWUSR | S_IRUGO, | 279 | static SENSOR_DEVICE_ATTR_2(in5_min, S_IWUSR | S_IRUGO, |
280 | adc128_show_in, adc128_set_in, 5, 1); | 280 | adc128_show_in, adc128_set_in, 5, 1); |
281 | static SENSOR_DEVICE_ATTR_2(in5_max, S_IWUSR | S_IRUGO, | 281 | static SENSOR_DEVICE_ATTR_2(in5_max, S_IWUSR | S_IRUGO, |
282 | adc128_show_in, adc128_set_in, 5, 2); | 282 | adc128_show_in, adc128_set_in, 5, 2); |
283 | 283 | ||
284 | static SENSOR_DEVICE_ATTR_2(in6_input, S_IWUSR | S_IRUGO, | 284 | static SENSOR_DEVICE_ATTR_2(in6_input, S_IRUGO, |
285 | adc128_show_in, adc128_set_in, 6, 0); | 285 | adc128_show_in, NULL, 6, 0); |
286 | static SENSOR_DEVICE_ATTR_2(in6_min, S_IWUSR | S_IRUGO, | 286 | static SENSOR_DEVICE_ATTR_2(in6_min, S_IWUSR | S_IRUGO, |
287 | adc128_show_in, adc128_set_in, 6, 1); | 287 | adc128_show_in, adc128_set_in, 6, 1); |
288 | static SENSOR_DEVICE_ATTR_2(in6_max, S_IWUSR | S_IRUGO, | 288 | static SENSOR_DEVICE_ATTR_2(in6_max, S_IWUSR | S_IRUGO, |
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 3eb4281689b5..d74241bb278c 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c | |||
@@ -185,7 +185,7 @@ static ssize_t set_temp_max(struct device *dev, | |||
185 | struct adm1021_data *data = dev_get_drvdata(dev); | 185 | struct adm1021_data *data = dev_get_drvdata(dev); |
186 | struct i2c_client *client = data->client; | 186 | struct i2c_client *client = data->client; |
187 | long temp; | 187 | long temp; |
188 | int err; | 188 | int reg_val, err; |
189 | 189 | ||
190 | err = kstrtol(buf, 10, &temp); | 190 | err = kstrtol(buf, 10, &temp); |
191 | if (err) | 191 | if (err) |
@@ -193,10 +193,11 @@ static ssize_t set_temp_max(struct device *dev, | |||
193 | temp /= 1000; | 193 | temp /= 1000; |
194 | 194 | ||
195 | mutex_lock(&data->update_lock); | 195 | mutex_lock(&data->update_lock); |
196 | data->temp_max[index] = clamp_val(temp, -128, 127); | 196 | reg_val = clamp_val(temp, -128, 127); |
197 | data->temp_max[index] = reg_val * 1000; | ||
197 | if (!read_only) | 198 | if (!read_only) |
198 | i2c_smbus_write_byte_data(client, ADM1021_REG_TOS_W(index), | 199 | i2c_smbus_write_byte_data(client, ADM1021_REG_TOS_W(index), |
199 | data->temp_max[index]); | 200 | reg_val); |
200 | mutex_unlock(&data->update_lock); | 201 | mutex_unlock(&data->update_lock); |
201 | 202 | ||
202 | return count; | 203 | return count; |
@@ -210,7 +211,7 @@ static ssize_t set_temp_min(struct device *dev, | |||
210 | struct adm1021_data *data = dev_get_drvdata(dev); | 211 | struct adm1021_data *data = dev_get_drvdata(dev); |
211 | struct i2c_client *client = data->client; | 212 | struct i2c_client *client = data->client; |
212 | long temp; | 213 | long temp; |
213 | int err; | 214 | int reg_val, err; |
214 | 215 | ||
215 | err = kstrtol(buf, 10, &temp); | 216 | err = kstrtol(buf, 10, &temp); |
216 | if (err) | 217 | if (err) |
@@ -218,10 +219,11 @@ static ssize_t set_temp_min(struct device *dev, | |||
218 | temp /= 1000; | 219 | temp /= 1000; |
219 | 220 | ||
220 | mutex_lock(&data->update_lock); | 221 | mutex_lock(&data->update_lock); |
221 | data->temp_min[index] = clamp_val(temp, -128, 127); | 222 | reg_val = clamp_val(temp, -128, 127); |
223 | data->temp_min[index] = reg_val * 1000; | ||
222 | if (!read_only) | 224 | if (!read_only) |
223 | i2c_smbus_write_byte_data(client, ADM1021_REG_THYST_W(index), | 225 | i2c_smbus_write_byte_data(client, ADM1021_REG_THYST_W(index), |
224 | data->temp_min[index]); | 226 | reg_val); |
225 | mutex_unlock(&data->update_lock); | 227 | mutex_unlock(&data->update_lock); |
226 | 228 | ||
227 | return count; | 229 | return count; |
diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c index 78339e880bd6..2804571b269e 100644 --- a/drivers/hwmon/adm1029.c +++ b/drivers/hwmon/adm1029.c | |||
@@ -232,6 +232,9 @@ static ssize_t set_fan_div(struct device *dev, | |||
232 | /* Update the value */ | 232 | /* Update the value */ |
233 | reg = (reg & 0x3F) | (val << 6); | 233 | reg = (reg & 0x3F) | (val << 6); |
234 | 234 | ||
235 | /* Update the cache */ | ||
236 | data->fan_div[attr->index] = reg; | ||
237 | |||
235 | /* Write value */ | 238 | /* Write value */ |
236 | i2c_smbus_write_byte_data(client, | 239 | i2c_smbus_write_byte_data(client, |
237 | ADM1029_REG_FAN_DIV[attr->index], reg); | 240 | ADM1029_REG_FAN_DIV[attr->index], reg); |
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index a8a540ca8c34..51c1a5a165ab 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
@@ -365,6 +365,7 @@ set_auto_temp_min(struct device *dev, struct device_attribute *attr, | |||
365 | if (ret) | 365 | if (ret) |
366 | return ret; | 366 | return ret; |
367 | 367 | ||
368 | val = clamp_val(val, 0, 127000); | ||
368 | mutex_lock(&data->update_lock); | 369 | mutex_lock(&data->update_lock); |
369 | data->auto_temp[nr] = AUTO_TEMP_MIN_TO_REG(val, data->auto_temp[nr]); | 370 | data->auto_temp[nr] = AUTO_TEMP_MIN_TO_REG(val, data->auto_temp[nr]); |
370 | adm1031_write_value(client, ADM1031_REG_AUTO_TEMP(nr), | 371 | adm1031_write_value(client, ADM1031_REG_AUTO_TEMP(nr), |
@@ -394,6 +395,7 @@ set_auto_temp_max(struct device *dev, struct device_attribute *attr, | |||
394 | if (ret) | 395 | if (ret) |
395 | return ret; | 396 | return ret; |
396 | 397 | ||
398 | val = clamp_val(val, 0, 127000); | ||
397 | mutex_lock(&data->update_lock); | 399 | mutex_lock(&data->update_lock); |
398 | data->temp_max[nr] = AUTO_TEMP_MAX_TO_REG(val, data->auto_temp[nr], | 400 | data->temp_max[nr] = AUTO_TEMP_MAX_TO_REG(val, data->auto_temp[nr], |
399 | data->pwm[nr]); | 401 | data->pwm[nr]); |
@@ -696,7 +698,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, | |||
696 | if (ret) | 698 | if (ret) |
697 | return ret; | 699 | return ret; |
698 | 700 | ||
699 | val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875); | 701 | val = clamp_val(val, -55000, 127000); |
700 | mutex_lock(&data->update_lock); | 702 | mutex_lock(&data->update_lock); |
701 | data->temp_min[nr] = TEMP_TO_REG(val); | 703 | data->temp_min[nr] = TEMP_TO_REG(val); |
702 | adm1031_write_value(client, ADM1031_REG_TEMP_MIN(nr), | 704 | adm1031_write_value(client, ADM1031_REG_TEMP_MIN(nr), |
@@ -717,7 +719,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, | |||
717 | if (ret) | 719 | if (ret) |
718 | return ret; | 720 | return ret; |
719 | 721 | ||
720 | val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875); | 722 | val = clamp_val(val, -55000, 127000); |
721 | mutex_lock(&data->update_lock); | 723 | mutex_lock(&data->update_lock); |
722 | data->temp_max[nr] = TEMP_TO_REG(val); | 724 | data->temp_max[nr] = TEMP_TO_REG(val); |
723 | adm1031_write_value(client, ADM1031_REG_TEMP_MAX(nr), | 725 | adm1031_write_value(client, ADM1031_REG_TEMP_MAX(nr), |
@@ -738,7 +740,7 @@ static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr, | |||
738 | if (ret) | 740 | if (ret) |
739 | return ret; | 741 | return ret; |
740 | 742 | ||
741 | val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875); | 743 | val = clamp_val(val, -55000, 127000); |
742 | mutex_lock(&data->update_lock); | 744 | mutex_lock(&data->update_lock); |
743 | data->temp_crit[nr] = TEMP_TO_REG(val); | 745 | data->temp_crit[nr] = TEMP_TO_REG(val); |
744 | adm1031_write_value(client, ADM1031_REG_TEMP_CRIT(nr), | 746 | adm1031_write_value(client, ADM1031_REG_TEMP_CRIT(nr), |
diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c index eea817296513..9f2be3dd28f3 100644 --- a/drivers/hwmon/amc6821.c +++ b/drivers/hwmon/amc6821.c | |||
@@ -704,7 +704,7 @@ static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, | |||
704 | get_temp_alarm, NULL, IDX_TEMP1_MAX); | 704 | get_temp_alarm, NULL, IDX_TEMP1_MAX); |
705 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, | 705 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, |
706 | get_temp_alarm, NULL, IDX_TEMP1_CRIT); | 706 | get_temp_alarm, NULL, IDX_TEMP1_CRIT); |
707 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO | S_IWUSR, | 707 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, |
708 | get_temp, NULL, IDX_TEMP2_INPUT); | 708 | get_temp, NULL, IDX_TEMP2_INPUT); |
709 | static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, get_temp, | 709 | static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, get_temp, |
710 | set_temp, IDX_TEMP2_MIN); | 710 | set_temp, IDX_TEMP2_MIN); |
diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c index fd892dd48e4c..78002de46cb6 100644 --- a/drivers/hwmon/emc2103.c +++ b/drivers/hwmon/emc2103.c | |||
@@ -250,9 +250,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *da, | |||
250 | if (result < 0) | 250 | if (result < 0) |
251 | return result; | 251 | return result; |
252 | 252 | ||
253 | val = DIV_ROUND_CLOSEST(val, 1000); | 253 | val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -63, 127); |
254 | if ((val < -63) || (val > 127)) | ||
255 | return -EINVAL; | ||
256 | 254 | ||
257 | mutex_lock(&data->update_lock); | 255 | mutex_lock(&data->update_lock); |
258 | data->temp_min[nr] = val; | 256 | data->temp_min[nr] = val; |
@@ -274,9 +272,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *da, | |||
274 | if (result < 0) | 272 | if (result < 0) |
275 | return result; | 273 | return result; |
276 | 274 | ||
277 | val = DIV_ROUND_CLOSEST(val, 1000); | 275 | val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -63, 127); |
278 | if ((val < -63) || (val > 127)) | ||
279 | return -EINVAL; | ||
280 | 276 | ||
281 | mutex_lock(&data->update_lock); | 277 | mutex_lock(&data->update_lock); |
282 | data->temp_max[nr] = val; | 278 | data->temp_max[nr] = val; |
@@ -390,15 +386,14 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *da, | |||
390 | { | 386 | { |
391 | struct emc2103_data *data = emc2103_update_device(dev); | 387 | struct emc2103_data *data = emc2103_update_device(dev); |
392 | struct i2c_client *client = to_i2c_client(dev); | 388 | struct i2c_client *client = to_i2c_client(dev); |
393 | long rpm_target; | 389 | unsigned long rpm_target; |
394 | 390 | ||
395 | int result = kstrtol(buf, 10, &rpm_target); | 391 | int result = kstrtoul(buf, 10, &rpm_target); |
396 | if (result < 0) | 392 | if (result < 0) |
397 | return result; | 393 | return result; |
398 | 394 | ||
399 | /* Datasheet states 16384 as maximum RPM target (table 3.2) */ | 395 | /* Datasheet states 16384 as maximum RPM target (table 3.2) */ |
400 | if ((rpm_target < 0) || (rpm_target > 16384)) | 396 | rpm_target = clamp_val(rpm_target, 0, 16384); |
401 | return -EINVAL; | ||
402 | 397 | ||
403 | mutex_lock(&data->update_lock); | 398 | mutex_lock(&data->update_lock); |
404 | 399 | ||
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index ba35e4d530b5..2566c43dd1e9 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c | |||
@@ -538,7 +538,7 @@ static int gpio_fan_probe(struct platform_device *pdev) | |||
538 | 538 | ||
539 | /* Make this driver part of hwmon class. */ | 539 | /* Make this driver part of hwmon class. */ |
540 | fan_data->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, | 540 | fan_data->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, |
541 | "gpio-fan", fan_data, | 541 | "gpio_fan", fan_data, |
542 | gpio_fan_groups); | 542 | gpio_fan_groups); |
543 | if (IS_ERR(fan_data->hwmon_dev)) | 543 | if (IS_ERR(fan_data->hwmon_dev)) |
544 | return PTR_ERR(fan_data->hwmon_dev); | 544 | return PTR_ERR(fan_data->hwmon_dev); |
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index e76feb86a1d4..ae66f42c4d6d 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c | |||
@@ -163,6 +163,18 @@ static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | static const struct of_device_id ntc_match[] = { | 165 | static const struct of_device_id ntc_match[] = { |
166 | { .compatible = "murata,ncp15wb473", | ||
167 | .data = &ntc_thermistor_id[0] }, | ||
168 | { .compatible = "murata,ncp18wb473", | ||
169 | .data = &ntc_thermistor_id[1] }, | ||
170 | { .compatible = "murata,ncp21wb473", | ||
171 | .data = &ntc_thermistor_id[2] }, | ||
172 | { .compatible = "murata,ncp03wb473", | ||
173 | .data = &ntc_thermistor_id[3] }, | ||
174 | { .compatible = "murata,ncp15wl333", | ||
175 | .data = &ntc_thermistor_id[4] }, | ||
176 | |||
177 | /* Usage of vendor name "ntc" is deprecated */ | ||
166 | { .compatible = "ntc,ncp15wb473", | 178 | { .compatible = "ntc,ncp15wb473", |
167 | .data = &ntc_thermistor_id[0] }, | 179 | .data = &ntc_thermistor_id[0] }, |
168 | { .compatible = "ntc,ncp18wb473", | 180 | { .compatible = "ntc,ncp18wb473", |
@@ -500,7 +512,7 @@ static int ntc_thermistor_probe(struct platform_device *pdev) | |||
500 | } | 512 | } |
501 | 513 | ||
502 | dev_info(&pdev->dev, "Thermistor type: %s successfully probed.\n", | 514 | dev_info(&pdev->dev, "Thermistor type: %s successfully probed.\n", |
503 | pdev->name); | 515 | pdev_id->name); |
504 | 516 | ||
505 | return 0; | 517 | return 0; |
506 | err_after_sysfs: | 518 | err_after_sysfs: |
@@ -534,7 +546,7 @@ static struct platform_driver ntc_thermistor_driver = { | |||
534 | 546 | ||
535 | module_platform_driver(ntc_thermistor_driver); | 547 | module_platform_driver(ntc_thermistor_driver); |
536 | 548 | ||
537 | MODULE_DESCRIPTION("NTC Thermistor Driver"); | 549 | MODULE_DESCRIPTION("NTC Thermistor Driver from Murata"); |
538 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); | 550 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); |
539 | MODULE_LICENSE("GPL"); | 551 | MODULE_LICENSE("GPL"); |
540 | MODULE_ALIAS("platform:ntc-thermistor"); | 552 | MODULE_ALIAS("platform:ntc-thermistor"); |
diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c index 6ed76ceb9270..32487c19cbfc 100644 --- a/drivers/hwmon/w83l786ng.c +++ b/drivers/hwmon/w83l786ng.c | |||
@@ -249,7 +249,7 @@ static ssize_t show_##reg(struct device *dev, struct device_attribute *attr, \ | |||
249 | int nr = to_sensor_dev_attr(attr)->index; \ | 249 | int nr = to_sensor_dev_attr(attr)->index; \ |
250 | struct w83l786ng_data *data = w83l786ng_update_device(dev); \ | 250 | struct w83l786ng_data *data = w83l786ng_update_device(dev); \ |
251 | return sprintf(buf, "%d\n", \ | 251 | return sprintf(buf, "%d\n", \ |
252 | FAN_FROM_REG(data->fan[nr], DIV_FROM_REG(data->fan_div[nr]))); \ | 252 | FAN_FROM_REG(data->reg[nr], DIV_FROM_REG(data->fan_div[nr]))); \ |
253 | } | 253 | } |
254 | 254 | ||
255 | show_fan_reg(fan); | 255 | show_fan_reg(fan); |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 620d1004a1e7..9f7d5859cf65 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -676,6 +676,16 @@ config I2C_RIIC | |||
676 | This driver can also be built as a module. If so, the module | 676 | This driver can also be built as a module. If so, the module |
677 | will be called i2c-riic. | 677 | will be called i2c-riic. |
678 | 678 | ||
679 | config I2C_RK3X | ||
680 | tristate "Rockchip RK3xxx I2C adapter" | ||
681 | depends on OF | ||
682 | help | ||
683 | Say Y here to include support for the I2C adapter in Rockchip RK3xxx | ||
684 | SoCs. | ||
685 | |||
686 | This driver can also be built as a module. If so, the module will | ||
687 | be called i2c-rk3x. | ||
688 | |||
679 | config HAVE_S3C2410_I2C | 689 | config HAVE_S3C2410_I2C |
680 | bool | 690 | bool |
681 | help | 691 | help |
@@ -764,6 +774,19 @@ config I2C_STU300 | |||
764 | This driver can also be built as a module. If so, the module | 774 | This driver can also be built as a module. If so, the module |
765 | will be called i2c-stu300. | 775 | will be called i2c-stu300. |
766 | 776 | ||
777 | config I2C_SUN6I_P2WI | ||
778 | tristate "Allwinner sun6i internal P2WI controller" | ||
779 | depends on RESET_CONTROLLER | ||
780 | depends on MACH_SUN6I || COMPILE_TEST | ||
781 | help | ||
782 | If you say yes to this option, support will be included for the | ||
783 | P2WI (Push/Pull 2 Wire Interface) controller embedded in some sunxi | ||
784 | SOCs. | ||
785 | The P2WI looks like an SMBus controller (which supports only byte | ||
786 | accesses), except that it only supports one slave device. | ||
787 | This interface is used to connect to specific PMIC devices (like the | ||
788 | AXP221). | ||
789 | |||
767 | config I2C_TEGRA | 790 | config I2C_TEGRA |
768 | tristate "NVIDIA Tegra internal I2C controller" | 791 | tristate "NVIDIA Tegra internal I2C controller" |
769 | depends on ARCH_TEGRA | 792 | depends on ARCH_TEGRA |
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 298692cc6000..dd9a7f8e873f 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile | |||
@@ -66,6 +66,7 @@ obj-$(CONFIG_I2C_PXA) += i2c-pxa.o | |||
66 | obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o | 66 | obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o |
67 | obj-$(CONFIG_I2C_QUP) += i2c-qup.o | 67 | obj-$(CONFIG_I2C_QUP) += i2c-qup.o |
68 | obj-$(CONFIG_I2C_RIIC) += i2c-riic.o | 68 | obj-$(CONFIG_I2C_RIIC) += i2c-riic.o |
69 | obj-$(CONFIG_I2C_RK3X) += i2c-rk3x.o | ||
69 | obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o | 70 | obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o |
70 | obj-$(CONFIG_I2C_S6000) += i2c-s6000.o | 71 | obj-$(CONFIG_I2C_S6000) += i2c-s6000.o |
71 | obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o | 72 | obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o |
@@ -74,6 +75,7 @@ obj-$(CONFIG_I2C_SIMTEC) += i2c-simtec.o | |||
74 | obj-$(CONFIG_I2C_SIRF) += i2c-sirf.o | 75 | obj-$(CONFIG_I2C_SIRF) += i2c-sirf.o |
75 | obj-$(CONFIG_I2C_ST) += i2c-st.o | 76 | obj-$(CONFIG_I2C_ST) += i2c-st.o |
76 | obj-$(CONFIG_I2C_STU300) += i2c-stu300.o | 77 | obj-$(CONFIG_I2C_STU300) += i2c-stu300.o |
78 | obj-$(CONFIG_I2C_SUN6I_P2WI) += i2c-sun6i-p2wi.o | ||
77 | obj-$(CONFIG_I2C_TEGRA) += i2c-tegra.o | 79 | obj-$(CONFIG_I2C_TEGRA) += i2c-tegra.o |
78 | obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o | 80 | obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o |
79 | obj-$(CONFIG_I2C_WMT) += i2c-wmt.o | 81 | obj-$(CONFIG_I2C_WMT) += i2c-wmt.o |
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c new file mode 100644 index 000000000000..a9791509966a --- /dev/null +++ b/drivers/i2c/busses/i2c-rk3x.c | |||
@@ -0,0 +1,763 @@ | |||
1 | /* | ||
2 | * Driver for I2C adapter in Rockchip RK3xxx SoC | ||
3 | * | ||
4 | * Max Schwarz <max.schwarz@online.de> | ||
5 | * based on the patches by Rockchip Inc. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/i2c.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/errno.h> | ||
17 | #include <linux/err.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/of_address.h> | ||
21 | #include <linux/of_irq.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/clk.h> | ||
24 | #include <linux/wait.h> | ||
25 | #include <linux/mfd/syscon.h> | ||
26 | #include <linux/regmap.h> | ||
27 | |||
28 | |||
29 | /* Register Map */ | ||
30 | #define REG_CON 0x00 /* control register */ | ||
31 | #define REG_CLKDIV 0x04 /* clock divisor register */ | ||
32 | #define REG_MRXADDR 0x08 /* slave address for REGISTER_TX */ | ||
33 | #define REG_MRXRADDR 0x0c /* slave register address for REGISTER_TX */ | ||
34 | #define REG_MTXCNT 0x10 /* number of bytes to be transmitted */ | ||
35 | #define REG_MRXCNT 0x14 /* number of bytes to be received */ | ||
36 | #define REG_IEN 0x18 /* interrupt enable */ | ||
37 | #define REG_IPD 0x1c /* interrupt pending */ | ||
38 | #define REG_FCNT 0x20 /* finished count */ | ||
39 | |||
40 | /* Data buffer offsets */ | ||
41 | #define TXBUFFER_BASE 0x100 | ||
42 | #define RXBUFFER_BASE 0x200 | ||
43 | |||
44 | /* REG_CON bits */ | ||
45 | #define REG_CON_EN BIT(0) | ||
46 | enum { | ||
47 | REG_CON_MOD_TX = 0, /* transmit data */ | ||
48 | REG_CON_MOD_REGISTER_TX, /* select register and restart */ | ||
49 | REG_CON_MOD_RX, /* receive data */ | ||
50 | REG_CON_MOD_REGISTER_RX, /* broken: transmits read addr AND writes | ||
51 | * register addr */ | ||
52 | }; | ||
53 | #define REG_CON_MOD(mod) ((mod) << 1) | ||
54 | #define REG_CON_MOD_MASK (BIT(1) | BIT(2)) | ||
55 | #define REG_CON_START BIT(3) | ||
56 | #define REG_CON_STOP BIT(4) | ||
57 | #define REG_CON_LASTACK BIT(5) /* 1: send NACK after last received byte */ | ||
58 | #define REG_CON_ACTACK BIT(6) /* 1: stop if NACK is received */ | ||
59 | |||
60 | /* REG_MRXADDR bits */ | ||
61 | #define REG_MRXADDR_VALID(x) BIT(24 + (x)) /* [x*8+7:x*8] of MRX[R]ADDR valid */ | ||
62 | |||
63 | /* REG_IEN/REG_IPD bits */ | ||
64 | #define REG_INT_BTF BIT(0) /* a byte was transmitted */ | ||
65 | #define REG_INT_BRF BIT(1) /* a byte was received */ | ||
66 | #define REG_INT_MBTF BIT(2) /* master data transmit finished */ | ||
67 | #define REG_INT_MBRF BIT(3) /* master data receive finished */ | ||
68 | #define REG_INT_START BIT(4) /* START condition generated */ | ||
69 | #define REG_INT_STOP BIT(5) /* STOP condition generated */ | ||
70 | #define REG_INT_NAKRCV BIT(6) /* NACK received */ | ||
71 | #define REG_INT_ALL 0x7f | ||
72 | |||
73 | /* Constants */ | ||
74 | #define WAIT_TIMEOUT 200 /* ms */ | ||
75 | #define DEFAULT_SCL_RATE (100 * 1000) /* Hz */ | ||
76 | |||
77 | enum rk3x_i2c_state { | ||
78 | STATE_IDLE, | ||
79 | STATE_START, | ||
80 | STATE_READ, | ||
81 | STATE_WRITE, | ||
82 | STATE_STOP | ||
83 | }; | ||
84 | |||
85 | /** | ||
86 | * @grf_offset: offset inside the grf regmap for setting the i2c type | ||
87 | */ | ||
88 | struct rk3x_i2c_soc_data { | ||
89 | int grf_offset; | ||
90 | }; | ||
91 | |||
92 | struct rk3x_i2c { | ||
93 | struct i2c_adapter adap; | ||
94 | struct device *dev; | ||
95 | struct rk3x_i2c_soc_data *soc_data; | ||
96 | |||
97 | /* Hardware resources */ | ||
98 | void __iomem *regs; | ||
99 | struct clk *clk; | ||
100 | |||
101 | /* Settings */ | ||
102 | unsigned int scl_frequency; | ||
103 | |||
104 | /* Synchronization & notification */ | ||
105 | spinlock_t lock; | ||
106 | wait_queue_head_t wait; | ||
107 | bool busy; | ||
108 | |||
109 | /* Current message */ | ||
110 | struct i2c_msg *msg; | ||
111 | u8 addr; | ||
112 | unsigned int mode; | ||
113 | bool is_last_msg; | ||
114 | |||
115 | /* I2C state machine */ | ||
116 | enum rk3x_i2c_state state; | ||
117 | unsigned int processed; /* sent/received bytes */ | ||
118 | int error; | ||
119 | }; | ||
120 | |||
121 | static inline void i2c_writel(struct rk3x_i2c *i2c, u32 value, | ||
122 | unsigned int offset) | ||
123 | { | ||
124 | writel(value, i2c->regs + offset); | ||
125 | } | ||
126 | |||
127 | static inline u32 i2c_readl(struct rk3x_i2c *i2c, unsigned int offset) | ||
128 | { | ||
129 | return readl(i2c->regs + offset); | ||
130 | } | ||
131 | |||
132 | /* Reset all interrupt pending bits */ | ||
133 | static inline void rk3x_i2c_clean_ipd(struct rk3x_i2c *i2c) | ||
134 | { | ||
135 | i2c_writel(i2c, REG_INT_ALL, REG_IPD); | ||
136 | } | ||
137 | |||
138 | /** | ||
139 | * Generate a START condition, which triggers a REG_INT_START interrupt. | ||
140 | */ | ||
141 | static void rk3x_i2c_start(struct rk3x_i2c *i2c) | ||
142 | { | ||
143 | u32 val; | ||
144 | |||
145 | rk3x_i2c_clean_ipd(i2c); | ||
146 | i2c_writel(i2c, REG_INT_START, REG_IEN); | ||
147 | |||
148 | /* enable adapter with correct mode, send START condition */ | ||
149 | val = REG_CON_EN | REG_CON_MOD(i2c->mode) | REG_CON_START; | ||
150 | |||
151 | /* if we want to react to NACK, set ACTACK bit */ | ||
152 | if (!(i2c->msg->flags & I2C_M_IGNORE_NAK)) | ||
153 | val |= REG_CON_ACTACK; | ||
154 | |||
155 | i2c_writel(i2c, val, REG_CON); | ||
156 | } | ||
157 | |||
158 | /** | ||
159 | * Generate a STOP condition, which triggers a REG_INT_STOP interrupt. | ||
160 | * | ||
161 | * @error: Error code to return in rk3x_i2c_xfer | ||
162 | */ | ||
163 | static void rk3x_i2c_stop(struct rk3x_i2c *i2c, int error) | ||
164 | { | ||
165 | unsigned int ctrl; | ||
166 | |||
167 | i2c->processed = 0; | ||
168 | i2c->msg = NULL; | ||
169 | i2c->error = error; | ||
170 | |||
171 | if (i2c->is_last_msg) { | ||
172 | /* Enable stop interrupt */ | ||
173 | i2c_writel(i2c, REG_INT_STOP, REG_IEN); | ||
174 | |||
175 | i2c->state = STATE_STOP; | ||
176 | |||
177 | ctrl = i2c_readl(i2c, REG_CON); | ||
178 | ctrl |= REG_CON_STOP; | ||
179 | i2c_writel(i2c, ctrl, REG_CON); | ||
180 | } else { | ||
181 | /* Signal rk3x_i2c_xfer to start the next message. */ | ||
182 | i2c->busy = false; | ||
183 | i2c->state = STATE_IDLE; | ||
184 | |||
185 | /* | ||
186 | * The HW is actually not capable of REPEATED START. But we can | ||
187 | * get the intended effect by resetting its internal state | ||
188 | * and issuing an ordinary START. | ||
189 | */ | ||
190 | i2c_writel(i2c, 0, REG_CON); | ||
191 | |||
192 | /* signal that we are finished with the current msg */ | ||
193 | wake_up(&i2c->wait); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * Setup a read according to i2c->msg | ||
199 | */ | ||
200 | static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c) | ||
201 | { | ||
202 | unsigned int len = i2c->msg->len - i2c->processed; | ||
203 | u32 con; | ||
204 | |||
205 | con = i2c_readl(i2c, REG_CON); | ||
206 | |||
207 | /* | ||
208 | * The hw can read up to 32 bytes at a time. If we need more than one | ||
209 | * chunk, send an ACK after the last byte of the current chunk. | ||
210 | */ | ||
211 | if (unlikely(len > 32)) { | ||
212 | len = 32; | ||
213 | con &= ~REG_CON_LASTACK; | ||
214 | } else { | ||
215 | con |= REG_CON_LASTACK; | ||
216 | } | ||
217 | |||
218 | /* make sure we are in plain RX mode if we read a second chunk */ | ||
219 | if (i2c->processed != 0) { | ||
220 | con &= ~REG_CON_MOD_MASK; | ||
221 | con |= REG_CON_MOD(REG_CON_MOD_RX); | ||
222 | } | ||
223 | |||
224 | i2c_writel(i2c, con, REG_CON); | ||
225 | i2c_writel(i2c, len, REG_MRXCNT); | ||
226 | } | ||
227 | |||
228 | /** | ||
229 | * Fill the transmit buffer with data from i2c->msg | ||
230 | */ | ||
231 | static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c) | ||
232 | { | ||
233 | unsigned int i, j; | ||
234 | u32 cnt = 0; | ||
235 | u32 val; | ||
236 | u8 byte; | ||
237 | |||
238 | for (i = 0; i < 8; ++i) { | ||
239 | val = 0; | ||
240 | for (j = 0; j < 4; ++j) { | ||
241 | if (i2c->processed == i2c->msg->len) | ||
242 | break; | ||
243 | |||
244 | if (i2c->processed == 0 && cnt == 0) | ||
245 | byte = (i2c->addr & 0x7f) << 1; | ||
246 | else | ||
247 | byte = i2c->msg->buf[i2c->processed++]; | ||
248 | |||
249 | val |= byte << (j * 8); | ||
250 | cnt++; | ||
251 | } | ||
252 | |||
253 | i2c_writel(i2c, val, TXBUFFER_BASE + 4 * i); | ||
254 | |||
255 | if (i2c->processed == i2c->msg->len) | ||
256 | break; | ||
257 | } | ||
258 | |||
259 | i2c_writel(i2c, cnt, REG_MTXCNT); | ||
260 | } | ||
261 | |||
262 | |||
263 | /* IRQ handlers for individual states */ | ||
264 | |||
265 | static void rk3x_i2c_handle_start(struct rk3x_i2c *i2c, unsigned int ipd) | ||
266 | { | ||
267 | if (!(ipd & REG_INT_START)) { | ||
268 | rk3x_i2c_stop(i2c, -EIO); | ||
269 | dev_warn(i2c->dev, "unexpected irq in START: 0x%x\n", ipd); | ||
270 | rk3x_i2c_clean_ipd(i2c); | ||
271 | return; | ||
272 | } | ||
273 | |||
274 | /* ack interrupt */ | ||
275 | i2c_writel(i2c, REG_INT_START, REG_IPD); | ||
276 | |||
277 | /* disable start bit */ | ||
278 | i2c_writel(i2c, i2c_readl(i2c, REG_CON) & ~REG_CON_START, REG_CON); | ||
279 | |||
280 | /* enable appropriate interrupts and transition */ | ||
281 | if (i2c->mode == REG_CON_MOD_TX) { | ||
282 | i2c_writel(i2c, REG_INT_MBTF | REG_INT_NAKRCV, REG_IEN); | ||
283 | i2c->state = STATE_WRITE; | ||
284 | rk3x_i2c_fill_transmit_buf(i2c); | ||
285 | } else { | ||
286 | /* in any other case, we are going to be reading. */ | ||
287 | i2c_writel(i2c, REG_INT_MBRF | REG_INT_NAKRCV, REG_IEN); | ||
288 | i2c->state = STATE_READ; | ||
289 | rk3x_i2c_prepare_read(i2c); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | static void rk3x_i2c_handle_write(struct rk3x_i2c *i2c, unsigned int ipd) | ||
294 | { | ||
295 | if (!(ipd & REG_INT_MBTF)) { | ||
296 | rk3x_i2c_stop(i2c, -EIO); | ||
297 | dev_err(i2c->dev, "unexpected irq in WRITE: 0x%x\n", ipd); | ||
298 | rk3x_i2c_clean_ipd(i2c); | ||
299 | return; | ||
300 | } | ||
301 | |||
302 | /* ack interrupt */ | ||
303 | i2c_writel(i2c, REG_INT_MBTF, REG_IPD); | ||
304 | |||
305 | /* are we finished? */ | ||
306 | if (i2c->processed == i2c->msg->len) | ||
307 | rk3x_i2c_stop(i2c, i2c->error); | ||
308 | else | ||
309 | rk3x_i2c_fill_transmit_buf(i2c); | ||
310 | } | ||
311 | |||
312 | static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd) | ||
313 | { | ||
314 | unsigned int i; | ||
315 | unsigned int len = i2c->msg->len - i2c->processed; | ||
316 | u32 uninitialized_var(val); | ||
317 | u8 byte; | ||
318 | |||
319 | /* we only care for MBRF here. */ | ||
320 | if (!(ipd & REG_INT_MBRF)) | ||
321 | return; | ||
322 | |||
323 | /* ack interrupt */ | ||
324 | i2c_writel(i2c, REG_INT_MBRF, REG_IPD); | ||
325 | |||
326 | /* read the data from receive buffer */ | ||
327 | for (i = 0; i < len; ++i) { | ||
328 | if (i % 4 == 0) | ||
329 | val = i2c_readl(i2c, RXBUFFER_BASE + (i / 4) * 4); | ||
330 | |||
331 | byte = (val >> ((i % 4) * 8)) & 0xff; | ||
332 | i2c->msg->buf[i2c->processed++] = byte; | ||
333 | } | ||
334 | |||
335 | /* are we finished? */ | ||
336 | if (i2c->processed == i2c->msg->len) | ||
337 | rk3x_i2c_stop(i2c, i2c->error); | ||
338 | else | ||
339 | rk3x_i2c_prepare_read(i2c); | ||
340 | } | ||
341 | |||
342 | static void rk3x_i2c_handle_stop(struct rk3x_i2c *i2c, unsigned int ipd) | ||
343 | { | ||
344 | unsigned int con; | ||
345 | |||
346 | if (!(ipd & REG_INT_STOP)) { | ||
347 | rk3x_i2c_stop(i2c, -EIO); | ||
348 | dev_err(i2c->dev, "unexpected irq in STOP: 0x%x\n", ipd); | ||
349 | rk3x_i2c_clean_ipd(i2c); | ||
350 | return; | ||
351 | } | ||
352 | |||
353 | /* ack interrupt */ | ||
354 | i2c_writel(i2c, REG_INT_STOP, REG_IPD); | ||
355 | |||
356 | /* disable STOP bit */ | ||
357 | con = i2c_readl(i2c, REG_CON); | ||
358 | con &= ~REG_CON_STOP; | ||
359 | i2c_writel(i2c, con, REG_CON); | ||
360 | |||
361 | i2c->busy = false; | ||
362 | i2c->state = STATE_IDLE; | ||
363 | |||
364 | /* signal rk3x_i2c_xfer that we are finished */ | ||
365 | wake_up(&i2c->wait); | ||
366 | } | ||
367 | |||
368 | static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id) | ||
369 | { | ||
370 | struct rk3x_i2c *i2c = dev_id; | ||
371 | unsigned int ipd; | ||
372 | |||
373 | spin_lock(&i2c->lock); | ||
374 | |||
375 | ipd = i2c_readl(i2c, REG_IPD); | ||
376 | if (i2c->state == STATE_IDLE) { | ||
377 | dev_warn(i2c->dev, "irq in STATE_IDLE, ipd = 0x%x\n", ipd); | ||
378 | rk3x_i2c_clean_ipd(i2c); | ||
379 | goto out; | ||
380 | } | ||
381 | |||
382 | dev_dbg(i2c->dev, "IRQ: state %d, ipd: %x\n", i2c->state, ipd); | ||
383 | |||
384 | /* Clean interrupt bits we don't care about */ | ||
385 | ipd &= ~(REG_INT_BRF | REG_INT_BTF); | ||
386 | |||
387 | if (ipd & REG_INT_NAKRCV) { | ||
388 | /* | ||
389 | * We got a NACK in the last operation. Depending on whether | ||
390 | * IGNORE_NAK is set, we have to stop the operation and report | ||
391 | * an error. | ||
392 | */ | ||
393 | i2c_writel(i2c, REG_INT_NAKRCV, REG_IPD); | ||
394 | |||
395 | ipd &= ~REG_INT_NAKRCV; | ||
396 | |||
397 | if (!(i2c->msg->flags & I2C_M_IGNORE_NAK)) | ||
398 | rk3x_i2c_stop(i2c, -ENXIO); | ||
399 | } | ||
400 | |||
401 | /* is there anything left to handle? */ | ||
402 | if (unlikely(ipd == 0)) | ||
403 | goto out; | ||
404 | |||
405 | switch (i2c->state) { | ||
406 | case STATE_START: | ||
407 | rk3x_i2c_handle_start(i2c, ipd); | ||
408 | break; | ||
409 | case STATE_WRITE: | ||
410 | rk3x_i2c_handle_write(i2c, ipd); | ||
411 | break; | ||
412 | case STATE_READ: | ||
413 | rk3x_i2c_handle_read(i2c, ipd); | ||
414 | break; | ||
415 | case STATE_STOP: | ||
416 | rk3x_i2c_handle_stop(i2c, ipd); | ||
417 | break; | ||
418 | case STATE_IDLE: | ||
419 | break; | ||
420 | } | ||
421 | |||
422 | out: | ||
423 | spin_unlock(&i2c->lock); | ||
424 | return IRQ_HANDLED; | ||
425 | } | ||
426 | |||
427 | static void rk3x_i2c_set_scl_rate(struct rk3x_i2c *i2c, unsigned long scl_rate) | ||
428 | { | ||
429 | unsigned long i2c_rate = clk_get_rate(i2c->clk); | ||
430 | unsigned int div; | ||
431 | |||
432 | /* SCL rate = (clk rate) / (8 * DIV) */ | ||
433 | div = DIV_ROUND_UP(i2c_rate, scl_rate * 8); | ||
434 | |||
435 | /* The lower and upper half of the CLKDIV reg describe the length of | ||
436 | * SCL low & high periods. */ | ||
437 | div = DIV_ROUND_UP(div, 2); | ||
438 | |||
439 | i2c_writel(i2c, (div << 16) | (div & 0xffff), REG_CLKDIV); | ||
440 | } | ||
441 | |||
442 | /** | ||
443 | * Setup I2C registers for an I2C operation specified by msgs, num. | ||
444 | * | ||
445 | * Must be called with i2c->lock held. | ||
446 | * | ||
447 | * @msgs: I2C msgs to process | ||
448 | * @num: Number of msgs | ||
449 | * | ||
450 | * returns: Number of I2C msgs processed or negative in case of error | ||
451 | */ | ||
452 | static int rk3x_i2c_setup(struct rk3x_i2c *i2c, struct i2c_msg *msgs, int num) | ||
453 | { | ||
454 | u32 addr = (msgs[0].addr & 0x7f) << 1; | ||
455 | int ret = 0; | ||
456 | |||
457 | /* | ||
458 | * The I2C adapter can issue a small (len < 4) write packet before | ||
459 | * reading. This speeds up SMBus-style register reads. | ||
460 | * The MRXADDR/MRXRADDR hold the slave address and the slave register | ||
461 | * address in this case. | ||
462 | */ | ||
463 | |||
464 | if (num >= 2 && msgs[0].len < 4 && | ||
465 | !(msgs[0].flags & I2C_M_RD) && (msgs[1].flags & I2C_M_RD)) { | ||
466 | u32 reg_addr = 0; | ||
467 | int i; | ||
468 | |||
469 | dev_dbg(i2c->dev, "Combined write/read from addr 0x%x\n", | ||
470 | addr >> 1); | ||
471 | |||
472 | /* Fill MRXRADDR with the register address(es) */ | ||
473 | for (i = 0; i < msgs[0].len; ++i) { | ||
474 | reg_addr |= msgs[0].buf[i] << (i * 8); | ||
475 | reg_addr |= REG_MRXADDR_VALID(i); | ||
476 | } | ||
477 | |||
478 | /* msgs[0] is handled by hw. */ | ||
479 | i2c->msg = &msgs[1]; | ||
480 | |||
481 | i2c->mode = REG_CON_MOD_REGISTER_TX; | ||
482 | |||
483 | i2c_writel(i2c, addr | REG_MRXADDR_VALID(0), REG_MRXADDR); | ||
484 | i2c_writel(i2c, reg_addr, REG_MRXRADDR); | ||
485 | |||
486 | ret = 2; | ||
487 | } else { | ||
488 | /* | ||
489 | * We'll have to do it the boring way and process the msgs | ||
490 | * one-by-one. | ||
491 | */ | ||
492 | |||
493 | if (msgs[0].flags & I2C_M_RD) { | ||
494 | addr |= 1; /* set read bit */ | ||
495 | |||
496 | /* | ||
497 | * We have to transmit the slave addr first. Use | ||
498 | * MOD_REGISTER_TX for that purpose. | ||
499 | */ | ||
500 | i2c->mode = REG_CON_MOD_REGISTER_TX; | ||
501 | i2c_writel(i2c, addr | REG_MRXADDR_VALID(0), | ||
502 | REG_MRXADDR); | ||
503 | i2c_writel(i2c, 0, REG_MRXRADDR); | ||
504 | } else { | ||
505 | i2c->mode = REG_CON_MOD_TX; | ||
506 | } | ||
507 | |||
508 | i2c->msg = &msgs[0]; | ||
509 | |||
510 | ret = 1; | ||
511 | } | ||
512 | |||
513 | i2c->addr = msgs[0].addr; | ||
514 | i2c->busy = true; | ||
515 | i2c->state = STATE_START; | ||
516 | i2c->processed = 0; | ||
517 | i2c->error = 0; | ||
518 | |||
519 | rk3x_i2c_clean_ipd(i2c); | ||
520 | |||
521 | return ret; | ||
522 | } | ||
523 | |||
524 | static int rk3x_i2c_xfer(struct i2c_adapter *adap, | ||
525 | struct i2c_msg *msgs, int num) | ||
526 | { | ||
527 | struct rk3x_i2c *i2c = (struct rk3x_i2c *)adap->algo_data; | ||
528 | unsigned long timeout, flags; | ||
529 | int ret = 0; | ||
530 | int i; | ||
531 | |||
532 | spin_lock_irqsave(&i2c->lock, flags); | ||
533 | |||
534 | clk_enable(i2c->clk); | ||
535 | |||
536 | /* The clock rate might have changed, so setup the divider again */ | ||
537 | rk3x_i2c_set_scl_rate(i2c, i2c->scl_frequency); | ||
538 | |||
539 | i2c->is_last_msg = false; | ||
540 | |||
541 | /* | ||
542 | * Process msgs. We can handle more than one message at once (see | ||
543 | * rk3x_i2c_setup()). | ||
544 | */ | ||
545 | for (i = 0; i < num; i += ret) { | ||
546 | ret = rk3x_i2c_setup(i2c, msgs + i, num - i); | ||
547 | |||
548 | if (ret < 0) { | ||
549 | dev_err(i2c->dev, "rk3x_i2c_setup() failed\n"); | ||
550 | break; | ||
551 | } | ||
552 | |||
553 | if (i + ret >= num) | ||
554 | i2c->is_last_msg = true; | ||
555 | |||
556 | spin_unlock_irqrestore(&i2c->lock, flags); | ||
557 | |||
558 | rk3x_i2c_start(i2c); | ||
559 | |||
560 | timeout = wait_event_timeout(i2c->wait, !i2c->busy, | ||
561 | msecs_to_jiffies(WAIT_TIMEOUT)); | ||
562 | |||
563 | spin_lock_irqsave(&i2c->lock, flags); | ||
564 | |||
565 | if (timeout == 0) { | ||
566 | dev_err(i2c->dev, "timeout, ipd: 0x%02x, state: %d\n", | ||
567 | i2c_readl(i2c, REG_IPD), i2c->state); | ||
568 | |||
569 | /* Force a STOP condition without interrupt */ | ||
570 | i2c_writel(i2c, 0, REG_IEN); | ||
571 | i2c_writel(i2c, REG_CON_EN | REG_CON_STOP, REG_CON); | ||
572 | |||
573 | i2c->state = STATE_IDLE; | ||
574 | |||
575 | ret = -ETIMEDOUT; | ||
576 | break; | ||
577 | } | ||
578 | |||
579 | if (i2c->error) { | ||
580 | ret = i2c->error; | ||
581 | break; | ||
582 | } | ||
583 | } | ||
584 | |||
585 | clk_disable(i2c->clk); | ||
586 | spin_unlock_irqrestore(&i2c->lock, flags); | ||
587 | |||
588 | return ret; | ||
589 | } | ||
590 | |||
591 | static u32 rk3x_i2c_func(struct i2c_adapter *adap) | ||
592 | { | ||
593 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; | ||
594 | } | ||
595 | |||
596 | static const struct i2c_algorithm rk3x_i2c_algorithm = { | ||
597 | .master_xfer = rk3x_i2c_xfer, | ||
598 | .functionality = rk3x_i2c_func, | ||
599 | }; | ||
600 | |||
601 | static struct rk3x_i2c_soc_data soc_data[3] = { | ||
602 | { .grf_offset = 0x154 }, /* rk3066 */ | ||
603 | { .grf_offset = 0x0a4 }, /* rk3188 */ | ||
604 | { .grf_offset = -1 }, /* no I2C switching needed */ | ||
605 | }; | ||
606 | |||
607 | static const struct of_device_id rk3x_i2c_match[] = { | ||
608 | { .compatible = "rockchip,rk3066-i2c", .data = (void *)&soc_data[0] }, | ||
609 | { .compatible = "rockchip,rk3188-i2c", .data = (void *)&soc_data[1] }, | ||
610 | { .compatible = "rockchip,rk3288-i2c", .data = (void *)&soc_data[2] }, | ||
611 | {}, | ||
612 | }; | ||
613 | |||
614 | static int rk3x_i2c_probe(struct platform_device *pdev) | ||
615 | { | ||
616 | struct device_node *np = pdev->dev.of_node; | ||
617 | const struct of_device_id *match; | ||
618 | struct rk3x_i2c *i2c; | ||
619 | struct resource *mem; | ||
620 | int ret = 0; | ||
621 | int bus_nr; | ||
622 | u32 value; | ||
623 | int irq; | ||
624 | |||
625 | i2c = devm_kzalloc(&pdev->dev, sizeof(struct rk3x_i2c), GFP_KERNEL); | ||
626 | if (!i2c) | ||
627 | return -ENOMEM; | ||
628 | |||
629 | match = of_match_node(rk3x_i2c_match, np); | ||
630 | i2c->soc_data = (struct rk3x_i2c_soc_data *)match->data; | ||
631 | |||
632 | if (of_property_read_u32(pdev->dev.of_node, "clock-frequency", | ||
633 | &i2c->scl_frequency)) { | ||
634 | dev_info(&pdev->dev, "using default SCL frequency: %d\n", | ||
635 | DEFAULT_SCL_RATE); | ||
636 | i2c->scl_frequency = DEFAULT_SCL_RATE; | ||
637 | } | ||
638 | |||
639 | if (i2c->scl_frequency == 0 || i2c->scl_frequency > 400 * 1000) { | ||
640 | dev_warn(&pdev->dev, "invalid SCL frequency specified.\n"); | ||
641 | dev_warn(&pdev->dev, "using default SCL frequency: %d\n", | ||
642 | DEFAULT_SCL_RATE); | ||
643 | i2c->scl_frequency = DEFAULT_SCL_RATE; | ||
644 | } | ||
645 | |||
646 | strlcpy(i2c->adap.name, "rk3x-i2c", sizeof(i2c->adap.name)); | ||
647 | i2c->adap.owner = THIS_MODULE; | ||
648 | i2c->adap.algo = &rk3x_i2c_algorithm; | ||
649 | i2c->adap.retries = 3; | ||
650 | i2c->adap.dev.of_node = np; | ||
651 | i2c->adap.algo_data = i2c; | ||
652 | i2c->adap.dev.parent = &pdev->dev; | ||
653 | |||
654 | i2c->dev = &pdev->dev; | ||
655 | |||
656 | spin_lock_init(&i2c->lock); | ||
657 | init_waitqueue_head(&i2c->wait); | ||
658 | |||
659 | i2c->clk = devm_clk_get(&pdev->dev, NULL); | ||
660 | if (IS_ERR(i2c->clk)) { | ||
661 | dev_err(&pdev->dev, "cannot get clock\n"); | ||
662 | return PTR_ERR(i2c->clk); | ||
663 | } | ||
664 | |||
665 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
666 | i2c->regs = devm_ioremap_resource(&pdev->dev, mem); | ||
667 | if (IS_ERR(i2c->regs)) | ||
668 | return PTR_ERR(i2c->regs); | ||
669 | |||
670 | /* Try to set the I2C adapter number from dt */ | ||
671 | bus_nr = of_alias_get_id(np, "i2c"); | ||
672 | |||
673 | /* | ||
674 | * Switch to new interface if the SoC also offers the old one. | ||
675 | * The control bit is located in the GRF register space. | ||
676 | */ | ||
677 | if (i2c->soc_data->grf_offset >= 0) { | ||
678 | struct regmap *grf; | ||
679 | |||
680 | grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); | ||
681 | if (IS_ERR(grf)) { | ||
682 | dev_err(&pdev->dev, | ||
683 | "rk3x-i2c needs 'rockchip,grf' property\n"); | ||
684 | return PTR_ERR(grf); | ||
685 | } | ||
686 | |||
687 | if (bus_nr < 0) { | ||
688 | dev_err(&pdev->dev, "rk3x-i2c needs i2cX alias"); | ||
689 | return -EINVAL; | ||
690 | } | ||
691 | |||
692 | /* 27+i: write mask, 11+i: value */ | ||
693 | value = BIT(27 + bus_nr) | BIT(11 + bus_nr); | ||
694 | |||
695 | ret = regmap_write(grf, i2c->soc_data->grf_offset, value); | ||
696 | if (ret != 0) { | ||
697 | dev_err(i2c->dev, "Could not write to GRF: %d\n", ret); | ||
698 | return ret; | ||
699 | } | ||
700 | } | ||
701 | |||
702 | /* IRQ setup */ | ||
703 | irq = platform_get_irq(pdev, 0); | ||
704 | if (irq < 0) { | ||
705 | dev_err(&pdev->dev, "cannot find rk3x IRQ\n"); | ||
706 | return irq; | ||
707 | } | ||
708 | |||
709 | ret = devm_request_irq(&pdev->dev, irq, rk3x_i2c_irq, | ||
710 | 0, dev_name(&pdev->dev), i2c); | ||
711 | if (ret < 0) { | ||
712 | dev_err(&pdev->dev, "cannot request IRQ\n"); | ||
713 | return ret; | ||
714 | } | ||
715 | |||
716 | platform_set_drvdata(pdev, i2c); | ||
717 | |||
718 | ret = clk_prepare(i2c->clk); | ||
719 | if (ret < 0) { | ||
720 | dev_err(&pdev->dev, "Could not prepare clock\n"); | ||
721 | return ret; | ||
722 | } | ||
723 | |||
724 | ret = i2c_add_adapter(&i2c->adap); | ||
725 | if (ret < 0) { | ||
726 | dev_err(&pdev->dev, "Could not register adapter\n"); | ||
727 | goto err_clk; | ||
728 | } | ||
729 | |||
730 | dev_info(&pdev->dev, "Initialized RK3xxx I2C bus at %p\n", i2c->regs); | ||
731 | |||
732 | return 0; | ||
733 | |||
734 | err_clk: | ||
735 | clk_unprepare(i2c->clk); | ||
736 | return ret; | ||
737 | } | ||
738 | |||
739 | static int rk3x_i2c_remove(struct platform_device *pdev) | ||
740 | { | ||
741 | struct rk3x_i2c *i2c = platform_get_drvdata(pdev); | ||
742 | |||
743 | i2c_del_adapter(&i2c->adap); | ||
744 | clk_unprepare(i2c->clk); | ||
745 | |||
746 | return 0; | ||
747 | } | ||
748 | |||
749 | static struct platform_driver rk3x_i2c_driver = { | ||
750 | .probe = rk3x_i2c_probe, | ||
751 | .remove = rk3x_i2c_remove, | ||
752 | .driver = { | ||
753 | .owner = THIS_MODULE, | ||
754 | .name = "rk3x-i2c", | ||
755 | .of_match_table = rk3x_i2c_match, | ||
756 | }, | ||
757 | }; | ||
758 | |||
759 | module_platform_driver(rk3x_i2c_driver); | ||
760 | |||
761 | MODULE_DESCRIPTION("Rockchip RK3xxx I2C Bus driver"); | ||
762 | MODULE_AUTHOR("Max Schwarz <max.schwarz@online.de>"); | ||
763 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/i2c/busses/i2c-sun6i-p2wi.c b/drivers/i2c/busses/i2c-sun6i-p2wi.c new file mode 100644 index 000000000000..4d75d4759709 --- /dev/null +++ b/drivers/i2c/busses/i2c-sun6i-p2wi.c | |||
@@ -0,0 +1,344 @@ | |||
1 | /* | ||
2 | * P2WI (Push-Pull Two Wire Interface) bus driver. | ||
3 | * | ||
4 | * Author: Boris BREZILLON <boris.brezillon@free-electrons.com> | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public License | ||
7 | * version 2. This program is licensed "as is" without any warranty of any | ||
8 | * kind, whether express or implied. | ||
9 | * | ||
10 | * The P2WI controller looks like an SMBus controller which only supports byte | ||
11 | * data transfers. But, it differs from standard SMBus protocol on several | ||
12 | * aspects: | ||
13 | * - it supports only one slave device, and thus drop the address field | ||
14 | * - it adds a parity bit every 8bits of data | ||
15 | * - only one read access is required to read a byte (instead of a write | ||
16 | * followed by a read access in standard SMBus protocol) | ||
17 | * - there's no Ack bit after each byte transfer | ||
18 | * | ||
19 | * This means this bus cannot be used to interface with standard SMBus | ||
20 | * devices (the only known device to support this interface is the AXP221 | ||
21 | * PMIC). | ||
22 | * | ||
23 | */ | ||
24 | #include <linux/clk.h> | ||
25 | #include <linux/i2c.h> | ||
26 | #include <linux/io.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/of.h> | ||
30 | #include <linux/platform_device.h> | ||
31 | #include <linux/reset.h> | ||
32 | |||
33 | |||
34 | /* P2WI registers */ | ||
35 | #define P2WI_CTRL 0x0 | ||
36 | #define P2WI_CCR 0x4 | ||
37 | #define P2WI_INTE 0x8 | ||
38 | #define P2WI_INTS 0xc | ||
39 | #define P2WI_DADDR0 0x10 | ||
40 | #define P2WI_DADDR1 0x14 | ||
41 | #define P2WI_DLEN 0x18 | ||
42 | #define P2WI_DATA0 0x1c | ||
43 | #define P2WI_DATA1 0x20 | ||
44 | #define P2WI_LCR 0x24 | ||
45 | #define P2WI_PMCR 0x28 | ||
46 | |||
47 | /* CTRL fields */ | ||
48 | #define P2WI_CTRL_START_TRANS BIT(7) | ||
49 | #define P2WI_CTRL_ABORT_TRANS BIT(6) | ||
50 | #define P2WI_CTRL_GLOBAL_INT_ENB BIT(1) | ||
51 | #define P2WI_CTRL_SOFT_RST BIT(0) | ||
52 | |||
53 | /* CLK CTRL fields */ | ||
54 | #define P2WI_CCR_SDA_OUT_DELAY(v) (((v) & 0x7) << 8) | ||
55 | #define P2WI_CCR_MAX_CLK_DIV 0xff | ||
56 | #define P2WI_CCR_CLK_DIV(v) ((v) & P2WI_CCR_MAX_CLK_DIV) | ||
57 | |||
58 | /* STATUS fields */ | ||
59 | #define P2WI_INTS_TRANS_ERR_ID(v) (((v) >> 8) & 0xff) | ||
60 | #define P2WI_INTS_LOAD_BSY BIT(2) | ||
61 | #define P2WI_INTS_TRANS_ERR BIT(1) | ||
62 | #define P2WI_INTS_TRANS_OVER BIT(0) | ||
63 | |||
64 | /* DATA LENGTH fields*/ | ||
65 | #define P2WI_DLEN_READ BIT(4) | ||
66 | #define P2WI_DLEN_DATA_LENGTH(v) ((v - 1) & 0x7) | ||
67 | |||
68 | /* LINE CTRL fields*/ | ||
69 | #define P2WI_LCR_SCL_STATE BIT(5) | ||
70 | #define P2WI_LCR_SDA_STATE BIT(4) | ||
71 | #define P2WI_LCR_SCL_CTL BIT(3) | ||
72 | #define P2WI_LCR_SCL_CTL_EN BIT(2) | ||
73 | #define P2WI_LCR_SDA_CTL BIT(1) | ||
74 | #define P2WI_LCR_SDA_CTL_EN BIT(0) | ||
75 | |||
76 | /* PMU MODE CTRL fields */ | ||
77 | #define P2WI_PMCR_PMU_INIT_SEND BIT(31) | ||
78 | #define P2WI_PMCR_PMU_INIT_DATA(v) (((v) & 0xff) << 16) | ||
79 | #define P2WI_PMCR_PMU_MODE_REG(v) (((v) & 0xff) << 8) | ||
80 | #define P2WI_PMCR_PMU_DEV_ADDR(v) ((v) & 0xff) | ||
81 | |||
82 | #define P2WI_MAX_FREQ 6000000 | ||
83 | |||
84 | struct p2wi { | ||
85 | struct i2c_adapter adapter; | ||
86 | struct completion complete; | ||
87 | unsigned int status; | ||
88 | void __iomem *regs; | ||
89 | struct clk *clk; | ||
90 | struct reset_control *rstc; | ||
91 | int slave_addr; | ||
92 | }; | ||
93 | |||
94 | static irqreturn_t p2wi_interrupt(int irq, void *dev_id) | ||
95 | { | ||
96 | struct p2wi *p2wi = dev_id; | ||
97 | unsigned long status; | ||
98 | |||
99 | status = readl(p2wi->regs + P2WI_INTS); | ||
100 | p2wi->status = status; | ||
101 | |||
102 | /* Clear interrupts */ | ||
103 | status &= (P2WI_INTS_LOAD_BSY | P2WI_INTS_TRANS_ERR | | ||
104 | P2WI_INTS_TRANS_OVER); | ||
105 | writel(status, p2wi->regs + P2WI_INTS); | ||
106 | |||
107 | complete(&p2wi->complete); | ||
108 | |||
109 | return IRQ_HANDLED; | ||
110 | } | ||
111 | |||
112 | static u32 p2wi_functionality(struct i2c_adapter *adap) | ||
113 | { | ||
114 | return I2C_FUNC_SMBUS_BYTE_DATA; | ||
115 | } | ||
116 | |||
117 | static int p2wi_smbus_xfer(struct i2c_adapter *adap, u16 addr, | ||
118 | unsigned short flags, char read_write, | ||
119 | u8 command, int size, union i2c_smbus_data *data) | ||
120 | { | ||
121 | struct p2wi *p2wi = i2c_get_adapdata(adap); | ||
122 | unsigned long dlen = P2WI_DLEN_DATA_LENGTH(1); | ||
123 | |||
124 | if (p2wi->slave_addr >= 0 && addr != p2wi->slave_addr) { | ||
125 | dev_err(&adap->dev, "invalid P2WI address\n"); | ||
126 | return -EINVAL; | ||
127 | } | ||
128 | |||
129 | if (!data) | ||
130 | return -EINVAL; | ||
131 | |||
132 | writel(command, p2wi->regs + P2WI_DADDR0); | ||
133 | |||
134 | if (read_write == I2C_SMBUS_READ) | ||
135 | dlen |= P2WI_DLEN_READ; | ||
136 | else | ||
137 | writel(data->byte, p2wi->regs + P2WI_DATA0); | ||
138 | |||
139 | writel(dlen, p2wi->regs + P2WI_DLEN); | ||
140 | |||
141 | if (readl(p2wi->regs + P2WI_CTRL) & P2WI_CTRL_START_TRANS) { | ||
142 | dev_err(&adap->dev, "P2WI bus busy\n"); | ||
143 | return -EBUSY; | ||
144 | } | ||
145 | |||
146 | reinit_completion(&p2wi->complete); | ||
147 | |||
148 | writel(P2WI_INTS_LOAD_BSY | P2WI_INTS_TRANS_ERR | P2WI_INTS_TRANS_OVER, | ||
149 | p2wi->regs + P2WI_INTE); | ||
150 | |||
151 | writel(P2WI_CTRL_START_TRANS | P2WI_CTRL_GLOBAL_INT_ENB, | ||
152 | p2wi->regs + P2WI_CTRL); | ||
153 | |||
154 | wait_for_completion(&p2wi->complete); | ||
155 | |||
156 | if (p2wi->status & P2WI_INTS_LOAD_BSY) { | ||
157 | dev_err(&adap->dev, "P2WI bus busy\n"); | ||
158 | return -EBUSY; | ||
159 | } | ||
160 | |||
161 | if (p2wi->status & P2WI_INTS_TRANS_ERR) { | ||
162 | dev_err(&adap->dev, "P2WI bus xfer error\n"); | ||
163 | return -ENXIO; | ||
164 | } | ||
165 | |||
166 | if (read_write == I2C_SMBUS_READ) | ||
167 | data->byte = readl(p2wi->regs + P2WI_DATA0); | ||
168 | |||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | static const struct i2c_algorithm p2wi_algo = { | ||
173 | .smbus_xfer = p2wi_smbus_xfer, | ||
174 | .functionality = p2wi_functionality, | ||
175 | }; | ||
176 | |||
177 | static const struct of_device_id p2wi_of_match_table[] = { | ||
178 | { .compatible = "allwinner,sun6i-a31-p2wi" }, | ||
179 | {} | ||
180 | }; | ||
181 | MODULE_DEVICE_TABLE(of, p2wi_of_match_table); | ||
182 | |||
183 | static int p2wi_probe(struct platform_device *pdev) | ||
184 | { | ||
185 | struct device *dev = &pdev->dev; | ||
186 | struct device_node *np = dev->of_node; | ||
187 | struct device_node *childnp; | ||
188 | unsigned long parent_clk_freq; | ||
189 | u32 clk_freq = 100000; | ||
190 | struct resource *r; | ||
191 | struct p2wi *p2wi; | ||
192 | u32 slave_addr; | ||
193 | int clk_div; | ||
194 | int irq; | ||
195 | int ret; | ||
196 | |||
197 | of_property_read_u32(np, "clock-frequency", &clk_freq); | ||
198 | if (clk_freq > P2WI_MAX_FREQ) { | ||
199 | dev_err(dev, | ||
200 | "required clock-frequency (%u Hz) is too high (max = 6MHz)", | ||
201 | clk_freq); | ||
202 | return -EINVAL; | ||
203 | } | ||
204 | |||
205 | if (of_get_child_count(np) > 1) { | ||
206 | dev_err(dev, "P2WI only supports one slave device\n"); | ||
207 | return -EINVAL; | ||
208 | } | ||
209 | |||
210 | p2wi = devm_kzalloc(dev, sizeof(struct p2wi), GFP_KERNEL); | ||
211 | if (!p2wi) | ||
212 | return -ENOMEM; | ||
213 | |||
214 | p2wi->slave_addr = -1; | ||
215 | |||
216 | /* | ||
217 | * Authorize a p2wi node without any children to be able to use an | ||
218 | * i2c-dev from userpace. | ||
219 | * In this case the slave_addr is set to -1 and won't be checked when | ||
220 | * launching a P2WI transfer. | ||
221 | */ | ||
222 | childnp = of_get_next_available_child(np, NULL); | ||
223 | if (childnp) { | ||
224 | ret = of_property_read_u32(childnp, "reg", &slave_addr); | ||
225 | if (ret) { | ||
226 | dev_err(dev, "invalid slave address on node %s\n", | ||
227 | childnp->full_name); | ||
228 | return -EINVAL; | ||
229 | } | ||
230 | |||
231 | p2wi->slave_addr = slave_addr; | ||
232 | } | ||
233 | |||
234 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
235 | p2wi->regs = devm_ioremap_resource(dev, r); | ||
236 | if (IS_ERR(p2wi->regs)) | ||
237 | return PTR_ERR(p2wi->regs); | ||
238 | |||
239 | strlcpy(p2wi->adapter.name, pdev->name, sizeof(p2wi->adapter.name)); | ||
240 | irq = platform_get_irq(pdev, 0); | ||
241 | if (irq < 0) { | ||
242 | dev_err(dev, "failed to retrieve irq: %d\n", irq); | ||
243 | return irq; | ||
244 | } | ||
245 | |||
246 | p2wi->clk = devm_clk_get(dev, NULL); | ||
247 | if (IS_ERR(p2wi->clk)) { | ||
248 | ret = PTR_ERR(p2wi->clk); | ||
249 | dev_err(dev, "failed to retrieve clk: %d\n", ret); | ||
250 | return ret; | ||
251 | } | ||
252 | |||
253 | ret = clk_prepare_enable(p2wi->clk); | ||
254 | if (ret) { | ||
255 | dev_err(dev, "failed to enable clk: %d\n", ret); | ||
256 | return ret; | ||
257 | } | ||
258 | |||
259 | parent_clk_freq = clk_get_rate(p2wi->clk); | ||
260 | |||
261 | p2wi->rstc = devm_reset_control_get(dev, NULL); | ||
262 | if (IS_ERR(p2wi->rstc)) { | ||
263 | ret = PTR_ERR(p2wi->rstc); | ||
264 | dev_err(dev, "failed to retrieve reset controller: %d\n", ret); | ||
265 | goto err_clk_disable; | ||
266 | } | ||
267 | |||
268 | ret = reset_control_deassert(p2wi->rstc); | ||
269 | if (ret) { | ||
270 | dev_err(dev, "failed to deassert reset line: %d\n", ret); | ||
271 | goto err_clk_disable; | ||
272 | } | ||
273 | |||
274 | init_completion(&p2wi->complete); | ||
275 | p2wi->adapter.dev.parent = dev; | ||
276 | p2wi->adapter.algo = &p2wi_algo; | ||
277 | p2wi->adapter.owner = THIS_MODULE; | ||
278 | p2wi->adapter.dev.of_node = pdev->dev.of_node; | ||
279 | platform_set_drvdata(pdev, p2wi); | ||
280 | i2c_set_adapdata(&p2wi->adapter, p2wi); | ||
281 | |||
282 | ret = devm_request_irq(dev, irq, p2wi_interrupt, 0, pdev->name, p2wi); | ||
283 | if (ret) { | ||
284 | dev_err(dev, "can't register interrupt handler irq%d: %d\n", | ||
285 | irq, ret); | ||
286 | goto err_reset_assert; | ||
287 | } | ||
288 | |||
289 | writel(P2WI_CTRL_SOFT_RST, p2wi->regs + P2WI_CTRL); | ||
290 | |||
291 | clk_div = parent_clk_freq / clk_freq; | ||
292 | if (!clk_div) { | ||
293 | dev_warn(dev, | ||
294 | "clock-frequency is too high, setting it to %lu Hz\n", | ||
295 | parent_clk_freq); | ||
296 | clk_div = 1; | ||
297 | } else if (clk_div > P2WI_CCR_MAX_CLK_DIV) { | ||
298 | dev_warn(dev, | ||
299 | "clock-frequency is too low, setting it to %lu Hz\n", | ||
300 | parent_clk_freq / P2WI_CCR_MAX_CLK_DIV); | ||
301 | clk_div = P2WI_CCR_MAX_CLK_DIV; | ||
302 | } | ||
303 | |||
304 | writel(P2WI_CCR_SDA_OUT_DELAY(1) | P2WI_CCR_CLK_DIV(clk_div), | ||
305 | p2wi->regs + P2WI_CCR); | ||
306 | |||
307 | ret = i2c_add_adapter(&p2wi->adapter); | ||
308 | if (!ret) | ||
309 | return 0; | ||
310 | |||
311 | err_reset_assert: | ||
312 | reset_control_assert(p2wi->rstc); | ||
313 | |||
314 | err_clk_disable: | ||
315 | clk_disable_unprepare(p2wi->clk); | ||
316 | |||
317 | return ret; | ||
318 | } | ||
319 | |||
320 | static int p2wi_remove(struct platform_device *dev) | ||
321 | { | ||
322 | struct p2wi *p2wi = platform_get_drvdata(dev); | ||
323 | |||
324 | reset_control_assert(p2wi->rstc); | ||
325 | clk_disable_unprepare(p2wi->clk); | ||
326 | i2c_del_adapter(&p2wi->adapter); | ||
327 | |||
328 | return 0; | ||
329 | } | ||
330 | |||
331 | static struct platform_driver p2wi_driver = { | ||
332 | .probe = p2wi_probe, | ||
333 | .remove = p2wi_remove, | ||
334 | .driver = { | ||
335 | .owner = THIS_MODULE, | ||
336 | .name = "i2c-sunxi-p2wi", | ||
337 | .of_match_table = p2wi_of_match_table, | ||
338 | }, | ||
339 | }; | ||
340 | module_platform_driver(p2wi_driver); | ||
341 | |||
342 | MODULE_AUTHOR("Boris BREZILLON <boris.brezillon@free-electrons.com>"); | ||
343 | MODULE_DESCRIPTION("Allwinner P2WI driver"); | ||
344 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig index f7f9865b8b89..f6d313e528de 100644 --- a/drivers/i2c/muxes/Kconfig +++ b/drivers/i2c/muxes/Kconfig | |||
@@ -40,6 +40,7 @@ config I2C_MUX_PCA9541 | |||
40 | 40 | ||
41 | config I2C_MUX_PCA954x | 41 | config I2C_MUX_PCA954x |
42 | tristate "Philips PCA954x I2C Mux/switches" | 42 | tristate "Philips PCA954x I2C Mux/switches" |
43 | depends on GPIOLIB | ||
43 | help | 44 | help |
44 | If you say yes here you get support for the Philips PCA954x | 45 | If you say yes here you get support for the Philips PCA954x |
45 | I2C mux/switch devices. | 46 | I2C mux/switch devices. |
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c index 69abf9163df7..54e464e4bb72 100644 --- a/drivers/iio/accel/hid-sensor-accel-3d.c +++ b/drivers/iio/accel/hid-sensor-accel-3d.c | |||
@@ -110,7 +110,6 @@ static int accel_3d_read_raw(struct iio_dev *indio_dev, | |||
110 | struct accel_3d_state *accel_state = iio_priv(indio_dev); | 110 | struct accel_3d_state *accel_state = iio_priv(indio_dev); |
111 | int report_id = -1; | 111 | int report_id = -1; |
112 | u32 address; | 112 | u32 address; |
113 | int ret; | ||
114 | int ret_type; | 113 | int ret_type; |
115 | s32 poll_value; | 114 | s32 poll_value; |
116 | 115 | ||
@@ -151,14 +150,12 @@ static int accel_3d_read_raw(struct iio_dev *indio_dev, | |||
151 | ret_type = IIO_VAL_INT; | 150 | ret_type = IIO_VAL_INT; |
152 | break; | 151 | break; |
153 | case IIO_CHAN_INFO_SAMP_FREQ: | 152 | case IIO_CHAN_INFO_SAMP_FREQ: |
154 | ret = hid_sensor_read_samp_freq_value( | 153 | ret_type = hid_sensor_read_samp_freq_value( |
155 | &accel_state->common_attributes, val, val2); | 154 | &accel_state->common_attributes, val, val2); |
156 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
157 | break; | 155 | break; |
158 | case IIO_CHAN_INFO_HYSTERESIS: | 156 | case IIO_CHAN_INFO_HYSTERESIS: |
159 | ret = hid_sensor_read_raw_hyst_value( | 157 | ret_type = hid_sensor_read_raw_hyst_value( |
160 | &accel_state->common_attributes, val, val2); | 158 | &accel_state->common_attributes, val, val2); |
161 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
162 | break; | 159 | break; |
163 | default: | 160 | default: |
164 | ret_type = -EINVAL; | 161 | ret_type = -EINVAL; |
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c index 39b4cb48d738..6eba301ee03d 100644 --- a/drivers/iio/adc/ad799x.c +++ b/drivers/iio/adc/ad799x.c | |||
@@ -427,9 +427,12 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev, | |||
427 | int ret; | 427 | int ret; |
428 | struct ad799x_state *st = iio_priv(indio_dev); | 428 | struct ad799x_state *st = iio_priv(indio_dev); |
429 | 429 | ||
430 | if (val < 0 || val > RES_MASK(chan->scan_type.realbits)) | ||
431 | return -EINVAL; | ||
432 | |||
430 | mutex_lock(&indio_dev->mlock); | 433 | mutex_lock(&indio_dev->mlock); |
431 | ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), | 434 | ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), |
432 | val); | 435 | val << chan->scan_type.shift); |
433 | mutex_unlock(&indio_dev->mlock); | 436 | mutex_unlock(&indio_dev->mlock); |
434 | 437 | ||
435 | return ret; | 438 | return ret; |
@@ -452,7 +455,8 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev, | |||
452 | mutex_unlock(&indio_dev->mlock); | 455 | mutex_unlock(&indio_dev->mlock); |
453 | if (ret < 0) | 456 | if (ret < 0) |
454 | return ret; | 457 | return ret; |
455 | *val = valin; | 458 | *val = (valin >> chan->scan_type.shift) & |
459 | RES_MASK(chan->scan_type.realbits); | ||
456 | 460 | ||
457 | return IIO_VAL_INT; | 461 | return IIO_VAL_INT; |
458 | } | 462 | } |
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 3b5bacd4d8da..2b6a9ce9927c 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
@@ -510,12 +510,11 @@ static int at91_adc_channel_init(struct iio_dev *idev) | |||
510 | return idev->num_channels; | 510 | return idev->num_channels; |
511 | } | 511 | } |
512 | 512 | ||
513 | static u8 at91_adc_get_trigger_value_by_name(struct iio_dev *idev, | 513 | static int at91_adc_get_trigger_value_by_name(struct iio_dev *idev, |
514 | struct at91_adc_trigger *triggers, | 514 | struct at91_adc_trigger *triggers, |
515 | const char *trigger_name) | 515 | const char *trigger_name) |
516 | { | 516 | { |
517 | struct at91_adc_state *st = iio_priv(idev); | 517 | struct at91_adc_state *st = iio_priv(idev); |
518 | u8 value = 0; | ||
519 | int i; | 518 | int i; |
520 | 519 | ||
521 | for (i = 0; i < st->trigger_number; i++) { | 520 | for (i = 0; i < st->trigger_number; i++) { |
@@ -528,15 +527,16 @@ static u8 at91_adc_get_trigger_value_by_name(struct iio_dev *idev, | |||
528 | return -ENOMEM; | 527 | return -ENOMEM; |
529 | 528 | ||
530 | if (strcmp(trigger_name, name) == 0) { | 529 | if (strcmp(trigger_name, name) == 0) { |
531 | value = triggers[i].value; | ||
532 | kfree(name); | 530 | kfree(name); |
533 | break; | 531 | if (triggers[i].value == 0) |
532 | return -EINVAL; | ||
533 | return triggers[i].value; | ||
534 | } | 534 | } |
535 | 535 | ||
536 | kfree(name); | 536 | kfree(name); |
537 | } | 537 | } |
538 | 538 | ||
539 | return value; | 539 | return -EINVAL; |
540 | } | 540 | } |
541 | 541 | ||
542 | static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) | 542 | static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) |
@@ -546,14 +546,14 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) | |||
546 | struct iio_buffer *buffer = idev->buffer; | 546 | struct iio_buffer *buffer = idev->buffer; |
547 | struct at91_adc_reg_desc *reg = st->registers; | 547 | struct at91_adc_reg_desc *reg = st->registers; |
548 | u32 status = at91_adc_readl(st, reg->trigger_register); | 548 | u32 status = at91_adc_readl(st, reg->trigger_register); |
549 | u8 value; | 549 | int value; |
550 | u8 bit; | 550 | u8 bit; |
551 | 551 | ||
552 | value = at91_adc_get_trigger_value_by_name(idev, | 552 | value = at91_adc_get_trigger_value_by_name(idev, |
553 | st->trigger_list, | 553 | st->trigger_list, |
554 | idev->trig->name); | 554 | idev->trig->name); |
555 | if (value == 0) | 555 | if (value < 0) |
556 | return -EINVAL; | 556 | return value; |
557 | 557 | ||
558 | if (state) { | 558 | if (state) { |
559 | st->buffer = kmalloc(idev->scan_bytes, GFP_KERNEL); | 559 | st->buffer = kmalloc(idev->scan_bytes, GFP_KERNEL); |
diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c index 6989c16aec2b..b58d6302521f 100644 --- a/drivers/iio/adc/men_z188_adc.c +++ b/drivers/iio/adc/men_z188_adc.c | |||
@@ -121,8 +121,8 @@ static int men_z188_probe(struct mcb_device *dev, | |||
121 | indio_dev->num_channels = ARRAY_SIZE(z188_adc_iio_channels); | 121 | indio_dev->num_channels = ARRAY_SIZE(z188_adc_iio_channels); |
122 | 122 | ||
123 | mem = mcb_request_mem(dev, "z188-adc"); | 123 | mem = mcb_request_mem(dev, "z188-adc"); |
124 | if (!mem) | 124 | if (IS_ERR(mem)) |
125 | return -ENOMEM; | 125 | return PTR_ERR(mem); |
126 | 126 | ||
127 | adc->base = ioremap(mem->start, resource_size(mem)); | 127 | adc->base = ioremap(mem->start, resource_size(mem)); |
128 | if (adc->base == NULL) | 128 | if (adc->base == NULL) |
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index a4db3026bec6..d5dc4c6ce86c 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c | |||
@@ -374,7 +374,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
374 | return -EAGAIN; | 374 | return -EAGAIN; |
375 | } | 375 | } |
376 | } | 376 | } |
377 | map_val = chan->channel + TOTAL_CHANNELS; | 377 | map_val = adc_dev->channel_step[chan->scan_index]; |
378 | 378 | ||
379 | /* | 379 | /* |
380 | * We check the complete FIFO. We programmed just one entry but in case | 380 | * We check the complete FIFO. We programmed just one entry but in case |
diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c index 7de1c4c87942..eb86786e698e 100644 --- a/drivers/iio/adc/twl4030-madc.c +++ b/drivers/iio/adc/twl4030-madc.c | |||
@@ -645,6 +645,7 @@ int twl4030_get_madc_conversion(int channel_no) | |||
645 | req.channels = (1 << channel_no); | 645 | req.channels = (1 << channel_no); |
646 | req.method = TWL4030_MADC_SW2; | 646 | req.method = TWL4030_MADC_SW2; |
647 | req.active = 0; | 647 | req.active = 0; |
648 | req.raw = 0; | ||
648 | req.func_cb = NULL; | 649 | req.func_cb = NULL; |
649 | ret = twl4030_madc_conversion(&req); | 650 | ret = twl4030_madc_conversion(&req); |
650 | if (ret < 0) | 651 | if (ret < 0) |
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index 73282cee0c81..a3109a6f4d86 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c | |||
@@ -75,6 +75,9 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state) | |||
75 | (s32)report_val); | 75 | (s32)report_val); |
76 | } | 76 | } |
77 | 77 | ||
78 | sensor_hub_get_feature(st->hsdev, st->power_state.report_id, | ||
79 | st->power_state.index, | ||
80 | &state_val); | ||
78 | return 0; | 81 | return 0; |
79 | } | 82 | } |
80 | EXPORT_SYMBOL(hid_sensor_power_state); | 83 | EXPORT_SYMBOL(hid_sensor_power_state); |
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c index 40f4e4935d0d..fa034a3dad78 100644 --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c | |||
@@ -110,7 +110,6 @@ static int gyro_3d_read_raw(struct iio_dev *indio_dev, | |||
110 | struct gyro_3d_state *gyro_state = iio_priv(indio_dev); | 110 | struct gyro_3d_state *gyro_state = iio_priv(indio_dev); |
111 | int report_id = -1; | 111 | int report_id = -1; |
112 | u32 address; | 112 | u32 address; |
113 | int ret; | ||
114 | int ret_type; | 113 | int ret_type; |
115 | s32 poll_value; | 114 | s32 poll_value; |
116 | 115 | ||
@@ -151,14 +150,12 @@ static int gyro_3d_read_raw(struct iio_dev *indio_dev, | |||
151 | ret_type = IIO_VAL_INT; | 150 | ret_type = IIO_VAL_INT; |
152 | break; | 151 | break; |
153 | case IIO_CHAN_INFO_SAMP_FREQ: | 152 | case IIO_CHAN_INFO_SAMP_FREQ: |
154 | ret = hid_sensor_read_samp_freq_value( | 153 | ret_type = hid_sensor_read_samp_freq_value( |
155 | &gyro_state->common_attributes, val, val2); | 154 | &gyro_state->common_attributes, val, val2); |
156 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
157 | break; | 155 | break; |
158 | case IIO_CHAN_INFO_HYSTERESIS: | 156 | case IIO_CHAN_INFO_HYSTERESIS: |
159 | ret = hid_sensor_read_raw_hyst_value( | 157 | ret_type = hid_sensor_read_raw_hyst_value( |
160 | &gyro_state->common_attributes, val, val2); | 158 | &gyro_state->common_attributes, val, val2); |
161 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
162 | break; | 159 | break; |
163 | default: | 160 | default: |
164 | ret_type = -EINVAL; | 161 | ret_type = -EINVAL; |
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index d833d55052ea..c7497009d60a 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
@@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, | |||
183 | else if (name && index >= 0) { | 183 | else if (name && index >= 0) { |
184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", | 184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", |
185 | np->full_name, name ? name : "", index); | 185 | np->full_name, name ? name : "", index); |
186 | return chan; | 186 | return NULL; |
187 | } | 187 | } |
188 | 188 | ||
189 | /* | 189 | /* |
@@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, | |||
193 | */ | 193 | */ |
194 | np = np->parent; | 194 | np = np->parent; |
195 | if (np && !of_get_property(np, "io-channel-ranges", NULL)) | 195 | if (np && !of_get_property(np, "io-channel-ranges", NULL)) |
196 | break; | 196 | return NULL; |
197 | } | 197 | } |
198 | |||
198 | return chan; | 199 | return chan; |
199 | } | 200 | } |
200 | 201 | ||
@@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev, | |||
317 | if (channel != NULL) | 318 | if (channel != NULL) |
318 | return channel; | 319 | return channel; |
319 | } | 320 | } |
321 | |||
320 | return iio_channel_get_sys(name, channel_name); | 322 | return iio_channel_get_sys(name, channel_name); |
321 | } | 323 | } |
322 | EXPORT_SYMBOL_GPL(iio_channel_get); | 324 | EXPORT_SYMBOL_GPL(iio_channel_get); |
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index f34c94380b41..96e71e103ea7 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c | |||
@@ -79,7 +79,6 @@ static int als_read_raw(struct iio_dev *indio_dev, | |||
79 | struct als_state *als_state = iio_priv(indio_dev); | 79 | struct als_state *als_state = iio_priv(indio_dev); |
80 | int report_id = -1; | 80 | int report_id = -1; |
81 | u32 address; | 81 | u32 address; |
82 | int ret; | ||
83 | int ret_type; | 82 | int ret_type; |
84 | s32 poll_value; | 83 | s32 poll_value; |
85 | 84 | ||
@@ -129,14 +128,12 @@ static int als_read_raw(struct iio_dev *indio_dev, | |||
129 | ret_type = IIO_VAL_INT; | 128 | ret_type = IIO_VAL_INT; |
130 | break; | 129 | break; |
131 | case IIO_CHAN_INFO_SAMP_FREQ: | 130 | case IIO_CHAN_INFO_SAMP_FREQ: |
132 | ret = hid_sensor_read_samp_freq_value( | 131 | ret_type = hid_sensor_read_samp_freq_value( |
133 | &als_state->common_attributes, val, val2); | 132 | &als_state->common_attributes, val, val2); |
134 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
135 | break; | 133 | break; |
136 | case IIO_CHAN_INFO_HYSTERESIS: | 134 | case IIO_CHAN_INFO_HYSTERESIS: |
137 | ret = hid_sensor_read_raw_hyst_value( | 135 | ret_type = hid_sensor_read_raw_hyst_value( |
138 | &als_state->common_attributes, val, val2); | 136 | &als_state->common_attributes, val, val2); |
139 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
140 | break; | 137 | break; |
141 | default: | 138 | default: |
142 | ret_type = -EINVAL; | 139 | ret_type = -EINVAL; |
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c index d203ef4d892f..412bae86d6ae 100644 --- a/drivers/iio/light/hid-sensor-prox.c +++ b/drivers/iio/light/hid-sensor-prox.c | |||
@@ -74,7 +74,6 @@ static int prox_read_raw(struct iio_dev *indio_dev, | |||
74 | struct prox_state *prox_state = iio_priv(indio_dev); | 74 | struct prox_state *prox_state = iio_priv(indio_dev); |
75 | int report_id = -1; | 75 | int report_id = -1; |
76 | u32 address; | 76 | u32 address; |
77 | int ret; | ||
78 | int ret_type; | 77 | int ret_type; |
79 | s32 poll_value; | 78 | s32 poll_value; |
80 | 79 | ||
@@ -125,14 +124,12 @@ static int prox_read_raw(struct iio_dev *indio_dev, | |||
125 | ret_type = IIO_VAL_INT; | 124 | ret_type = IIO_VAL_INT; |
126 | break; | 125 | break; |
127 | case IIO_CHAN_INFO_SAMP_FREQ: | 126 | case IIO_CHAN_INFO_SAMP_FREQ: |
128 | ret = hid_sensor_read_samp_freq_value( | 127 | ret_type = hid_sensor_read_samp_freq_value( |
129 | &prox_state->common_attributes, val, val2); | 128 | &prox_state->common_attributes, val, val2); |
130 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
131 | break; | 129 | break; |
132 | case IIO_CHAN_INFO_HYSTERESIS: | 130 | case IIO_CHAN_INFO_HYSTERESIS: |
133 | ret = hid_sensor_read_raw_hyst_value( | 131 | ret_type = hid_sensor_read_raw_hyst_value( |
134 | &prox_state->common_attributes, val, val2); | 132 | &prox_state->common_attributes, val, val2); |
135 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
136 | break; | 133 | break; |
137 | default: | 134 | default: |
138 | ret_type = -EINVAL; | 135 | ret_type = -EINVAL; |
diff --git a/drivers/iio/light/tcs3472.c b/drivers/iio/light/tcs3472.c index fe063a0a21cd..752569985d1d 100644 --- a/drivers/iio/light/tcs3472.c +++ b/drivers/iio/light/tcs3472.c | |||
@@ -52,6 +52,7 @@ | |||
52 | 52 | ||
53 | struct tcs3472_data { | 53 | struct tcs3472_data { |
54 | struct i2c_client *client; | 54 | struct i2c_client *client; |
55 | struct mutex lock; | ||
55 | u8 enable; | 56 | u8 enable; |
56 | u8 control; | 57 | u8 control; |
57 | u8 atime; | 58 | u8 atime; |
@@ -116,10 +117,17 @@ static int tcs3472_read_raw(struct iio_dev *indio_dev, | |||
116 | 117 | ||
117 | switch (mask) { | 118 | switch (mask) { |
118 | case IIO_CHAN_INFO_RAW: | 119 | case IIO_CHAN_INFO_RAW: |
120 | if (iio_buffer_enabled(indio_dev)) | ||
121 | return -EBUSY; | ||
122 | |||
123 | mutex_lock(&data->lock); | ||
119 | ret = tcs3472_req_data(data); | 124 | ret = tcs3472_req_data(data); |
120 | if (ret < 0) | 125 | if (ret < 0) { |
126 | mutex_unlock(&data->lock); | ||
121 | return ret; | 127 | return ret; |
128 | } | ||
122 | ret = i2c_smbus_read_word_data(data->client, chan->address); | 129 | ret = i2c_smbus_read_word_data(data->client, chan->address); |
130 | mutex_unlock(&data->lock); | ||
123 | if (ret < 0) | 131 | if (ret < 0) |
124 | return ret; | 132 | return ret; |
125 | *val = ret; | 133 | *val = ret; |
@@ -255,6 +263,7 @@ static int tcs3472_probe(struct i2c_client *client, | |||
255 | data = iio_priv(indio_dev); | 263 | data = iio_priv(indio_dev); |
256 | i2c_set_clientdata(client, indio_dev); | 264 | i2c_set_clientdata(client, indio_dev); |
257 | data->client = client; | 265 | data->client = client; |
266 | mutex_init(&data->lock); | ||
258 | 267 | ||
259 | indio_dev->dev.parent = &client->dev; | 268 | indio_dev->dev.parent = &client->dev; |
260 | indio_dev->info = &tcs3472_info; | 269 | indio_dev->info = &tcs3472_info; |
diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 09ea5c481f4c..ea08313af0d2 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c | |||
@@ -373,8 +373,6 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) | |||
373 | { | 373 | { |
374 | struct ak8975_data *data = iio_priv(indio_dev); | 374 | struct ak8975_data *data = iio_priv(indio_dev); |
375 | struct i2c_client *client = data->client; | 375 | struct i2c_client *client = data->client; |
376 | u16 meas_reg; | ||
377 | s16 raw; | ||
378 | int ret; | 376 | int ret; |
379 | 377 | ||
380 | mutex_lock(&data->lock); | 378 | mutex_lock(&data->lock); |
@@ -422,16 +420,11 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) | |||
422 | dev_err(&client->dev, "Read axis data fails\n"); | 420 | dev_err(&client->dev, "Read axis data fails\n"); |
423 | goto exit; | 421 | goto exit; |
424 | } | 422 | } |
425 | meas_reg = ret; | ||
426 | 423 | ||
427 | mutex_unlock(&data->lock); | 424 | mutex_unlock(&data->lock); |
428 | 425 | ||
429 | /* Endian conversion of the measured values. */ | ||
430 | raw = (s16) (le16_to_cpu(meas_reg)); | ||
431 | |||
432 | /* Clamp to valid range. */ | 426 | /* Clamp to valid range. */ |
433 | raw = clamp_t(s16, raw, -4096, 4095); | 427 | *val = clamp_t(s16, ret, -4096, 4095); |
434 | *val = raw; | ||
435 | return IIO_VAL_INT; | 428 | return IIO_VAL_INT; |
436 | 429 | ||
437 | exit: | 430 | exit: |
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c index 41cf29e2a371..b2b0937d5133 100644 --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c | |||
@@ -110,7 +110,6 @@ static int magn_3d_read_raw(struct iio_dev *indio_dev, | |||
110 | struct magn_3d_state *magn_state = iio_priv(indio_dev); | 110 | struct magn_3d_state *magn_state = iio_priv(indio_dev); |
111 | int report_id = -1; | 111 | int report_id = -1; |
112 | u32 address; | 112 | u32 address; |
113 | int ret; | ||
114 | int ret_type; | 113 | int ret_type; |
115 | s32 poll_value; | 114 | s32 poll_value; |
116 | 115 | ||
@@ -153,14 +152,12 @@ static int magn_3d_read_raw(struct iio_dev *indio_dev, | |||
153 | ret_type = IIO_VAL_INT; | 152 | ret_type = IIO_VAL_INT; |
154 | break; | 153 | break; |
155 | case IIO_CHAN_INFO_SAMP_FREQ: | 154 | case IIO_CHAN_INFO_SAMP_FREQ: |
156 | ret = hid_sensor_read_samp_freq_value( | 155 | ret_type = hid_sensor_read_samp_freq_value( |
157 | &magn_state->common_attributes, val, val2); | 156 | &magn_state->common_attributes, val, val2); |
158 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
159 | break; | 157 | break; |
160 | case IIO_CHAN_INFO_HYSTERESIS: | 158 | case IIO_CHAN_INFO_HYSTERESIS: |
161 | ret = hid_sensor_read_raw_hyst_value( | 159 | ret_type = hid_sensor_read_raw_hyst_value( |
162 | &magn_state->common_attributes, val, val2); | 160 | &magn_state->common_attributes, val, val2); |
163 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
164 | break; | 161 | break; |
165 | default: | 162 | default: |
166 | ret_type = -EINVAL; | 163 | ret_type = -EINVAL; |
diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c index 1cd190c73788..2c0d2a4fed8c 100644 --- a/drivers/iio/pressure/hid-sensor-press.c +++ b/drivers/iio/pressure/hid-sensor-press.c | |||
@@ -78,7 +78,6 @@ static int press_read_raw(struct iio_dev *indio_dev, | |||
78 | struct press_state *press_state = iio_priv(indio_dev); | 78 | struct press_state *press_state = iio_priv(indio_dev); |
79 | int report_id = -1; | 79 | int report_id = -1; |
80 | u32 address; | 80 | u32 address; |
81 | int ret; | ||
82 | int ret_type; | 81 | int ret_type; |
83 | s32 poll_value; | 82 | s32 poll_value; |
84 | 83 | ||
@@ -128,14 +127,12 @@ static int press_read_raw(struct iio_dev *indio_dev, | |||
128 | ret_type = IIO_VAL_INT; | 127 | ret_type = IIO_VAL_INT; |
129 | break; | 128 | break; |
130 | case IIO_CHAN_INFO_SAMP_FREQ: | 129 | case IIO_CHAN_INFO_SAMP_FREQ: |
131 | ret = hid_sensor_read_samp_freq_value( | 130 | ret_type = hid_sensor_read_samp_freq_value( |
132 | &press_state->common_attributes, val, val2); | 131 | &press_state->common_attributes, val, val2); |
133 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
134 | break; | 132 | break; |
135 | case IIO_CHAN_INFO_HYSTERESIS: | 133 | case IIO_CHAN_INFO_HYSTERESIS: |
136 | ret = hid_sensor_read_raw_hyst_value( | 134 | ret_type = hid_sensor_read_raw_hyst_value( |
137 | &press_state->common_attributes, val, val2); | 135 | &press_state->common_attributes, val, val2); |
138 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
139 | break; | 136 | break; |
140 | default: | 137 | default: |
141 | ret_type = -EINVAL; | 138 | ret_type = -EINVAL; |
diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c index ba6d0c520e63..01b2e0b18878 100644 --- a/drivers/iio/pressure/mpl3115.c +++ b/drivers/iio/pressure/mpl3115.c | |||
@@ -98,7 +98,7 @@ static int mpl3115_read_raw(struct iio_dev *indio_dev, | |||
98 | mutex_unlock(&data->lock); | 98 | mutex_unlock(&data->lock); |
99 | if (ret < 0) | 99 | if (ret < 0) |
100 | return ret; | 100 | return ret; |
101 | *val = sign_extend32(be32_to_cpu(tmp) >> 12, 23); | 101 | *val = be32_to_cpu(tmp) >> 12; |
102 | return IIO_VAL_INT; | 102 | return IIO_VAL_INT; |
103 | case IIO_TEMP: /* in 0.0625 celsius / LSB */ | 103 | case IIO_TEMP: /* in 0.0625 celsius / LSB */ |
104 | mutex_lock(&data->lock); | 104 | mutex_lock(&data->lock); |
@@ -112,7 +112,7 @@ static int mpl3115_read_raw(struct iio_dev *indio_dev, | |||
112 | mutex_unlock(&data->lock); | 112 | mutex_unlock(&data->lock); |
113 | if (ret < 0) | 113 | if (ret < 0) |
114 | return ret; | 114 | return ret; |
115 | *val = sign_extend32(be32_to_cpu(tmp) >> 20, 15); | 115 | *val = sign_extend32(be32_to_cpu(tmp) >> 20, 11); |
116 | return IIO_VAL_INT; | 116 | return IIO_VAL_INT; |
117 | default: | 117 | default: |
118 | return -EINVAL; | 118 | return -EINVAL; |
@@ -185,7 +185,7 @@ static const struct iio_chan_spec mpl3115_channels[] = { | |||
185 | BIT(IIO_CHAN_INFO_SCALE), | 185 | BIT(IIO_CHAN_INFO_SCALE), |
186 | .scan_index = 0, | 186 | .scan_index = 0, |
187 | .scan_type = { | 187 | .scan_type = { |
188 | .sign = 's', | 188 | .sign = 'u', |
189 | .realbits = 20, | 189 | .realbits = 20, |
190 | .storagebits = 32, | 190 | .storagebits = 32, |
191 | .shift = 12, | 191 | .shift = 12, |
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c index d4daa05efe60..499b4366a98d 100644 --- a/drivers/iommu/amd_iommu_v2.c +++ b/drivers/iommu/amd_iommu_v2.c | |||
@@ -45,7 +45,7 @@ struct pri_queue { | |||
45 | struct pasid_state { | 45 | struct pasid_state { |
46 | struct list_head list; /* For global state-list */ | 46 | struct list_head list; /* For global state-list */ |
47 | atomic_t count; /* Reference count */ | 47 | atomic_t count; /* Reference count */ |
48 | atomic_t mmu_notifier_count; /* Counting nested mmu_notifier | 48 | unsigned mmu_notifier_count; /* Counting nested mmu_notifier |
49 | calls */ | 49 | calls */ |
50 | struct task_struct *task; /* Task bound to this PASID */ | 50 | struct task_struct *task; /* Task bound to this PASID */ |
51 | struct mm_struct *mm; /* mm_struct for the faults */ | 51 | struct mm_struct *mm; /* mm_struct for the faults */ |
@@ -53,7 +53,8 @@ struct pasid_state { | |||
53 | struct pri_queue pri[PRI_QUEUE_SIZE]; /* PRI tag states */ | 53 | struct pri_queue pri[PRI_QUEUE_SIZE]; /* PRI tag states */ |
54 | struct device_state *device_state; /* Link to our device_state */ | 54 | struct device_state *device_state; /* Link to our device_state */ |
55 | int pasid; /* PASID index */ | 55 | int pasid; /* PASID index */ |
56 | spinlock_t lock; /* Protect pri_queues */ | 56 | spinlock_t lock; /* Protect pri_queues and |
57 | mmu_notifer_count */ | ||
57 | wait_queue_head_t wq; /* To wait for count == 0 */ | 58 | wait_queue_head_t wq; /* To wait for count == 0 */ |
58 | }; | 59 | }; |
59 | 60 | ||
@@ -431,15 +432,19 @@ static void mn_invalidate_range_start(struct mmu_notifier *mn, | |||
431 | { | 432 | { |
432 | struct pasid_state *pasid_state; | 433 | struct pasid_state *pasid_state; |
433 | struct device_state *dev_state; | 434 | struct device_state *dev_state; |
435 | unsigned long flags; | ||
434 | 436 | ||
435 | pasid_state = mn_to_state(mn); | 437 | pasid_state = mn_to_state(mn); |
436 | dev_state = pasid_state->device_state; | 438 | dev_state = pasid_state->device_state; |
437 | 439 | ||
438 | if (atomic_add_return(1, &pasid_state->mmu_notifier_count) == 1) { | 440 | spin_lock_irqsave(&pasid_state->lock, flags); |
441 | if (pasid_state->mmu_notifier_count == 0) { | ||
439 | amd_iommu_domain_set_gcr3(dev_state->domain, | 442 | amd_iommu_domain_set_gcr3(dev_state->domain, |
440 | pasid_state->pasid, | 443 | pasid_state->pasid, |
441 | __pa(empty_page_table)); | 444 | __pa(empty_page_table)); |
442 | } | 445 | } |
446 | pasid_state->mmu_notifier_count += 1; | ||
447 | spin_unlock_irqrestore(&pasid_state->lock, flags); | ||
443 | } | 448 | } |
444 | 449 | ||
445 | static void mn_invalidate_range_end(struct mmu_notifier *mn, | 450 | static void mn_invalidate_range_end(struct mmu_notifier *mn, |
@@ -448,15 +453,19 @@ static void mn_invalidate_range_end(struct mmu_notifier *mn, | |||
448 | { | 453 | { |
449 | struct pasid_state *pasid_state; | 454 | struct pasid_state *pasid_state; |
450 | struct device_state *dev_state; | 455 | struct device_state *dev_state; |
456 | unsigned long flags; | ||
451 | 457 | ||
452 | pasid_state = mn_to_state(mn); | 458 | pasid_state = mn_to_state(mn); |
453 | dev_state = pasid_state->device_state; | 459 | dev_state = pasid_state->device_state; |
454 | 460 | ||
455 | if (atomic_dec_and_test(&pasid_state->mmu_notifier_count)) { | 461 | spin_lock_irqsave(&pasid_state->lock, flags); |
462 | pasid_state->mmu_notifier_count -= 1; | ||
463 | if (pasid_state->mmu_notifier_count == 0) { | ||
456 | amd_iommu_domain_set_gcr3(dev_state->domain, | 464 | amd_iommu_domain_set_gcr3(dev_state->domain, |
457 | pasid_state->pasid, | 465 | pasid_state->pasid, |
458 | __pa(pasid_state->mm->pgd)); | 466 | __pa(pasid_state->mm->pgd)); |
459 | } | 467 | } |
468 | spin_unlock_irqrestore(&pasid_state->lock, flags); | ||
460 | } | 469 | } |
461 | 470 | ||
462 | static void mn_release(struct mmu_notifier *mn, struct mm_struct *mm) | 471 | static void mn_release(struct mmu_notifier *mn, struct mm_struct *mm) |
@@ -650,7 +659,6 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid, | |||
650 | goto out; | 659 | goto out; |
651 | 660 | ||
652 | atomic_set(&pasid_state->count, 1); | 661 | atomic_set(&pasid_state->count, 1); |
653 | atomic_set(&pasid_state->mmu_notifier_count, 0); | ||
654 | init_waitqueue_head(&pasid_state->wq); | 662 | init_waitqueue_head(&pasid_state->wq); |
655 | spin_lock_init(&pasid_state->lock); | 663 | spin_lock_init(&pasid_state->lock); |
656 | 664 | ||
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 6bb32773c3ac..51b6b77dc3e5 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -3816,14 +3816,11 @@ int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info) | |||
3816 | ((void *)rmrr) + rmrr->header.length, | 3816 | ((void *)rmrr) + rmrr->header.length, |
3817 | rmrr->segment, rmrru->devices, | 3817 | rmrr->segment, rmrru->devices, |
3818 | rmrru->devices_cnt); | 3818 | rmrru->devices_cnt); |
3819 | if (ret > 0) | 3819 | if(ret < 0) |
3820 | break; | ||
3821 | else if(ret < 0) | ||
3822 | return ret; | 3820 | return ret; |
3823 | } else if (info->event == BUS_NOTIFY_DEL_DEVICE) { | 3821 | } else if (info->event == BUS_NOTIFY_DEL_DEVICE) { |
3824 | if (dmar_remove_dev_scope(info, rmrr->segment, | 3822 | dmar_remove_dev_scope(info, rmrr->segment, |
3825 | rmrru->devices, rmrru->devices_cnt)) | 3823 | rmrru->devices, rmrru->devices_cnt); |
3826 | break; | ||
3827 | } | 3824 | } |
3828 | } | 3825 | } |
3829 | 3826 | ||
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index c887e6eebc41..574aba0eba4e 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c | |||
@@ -334,6 +334,15 @@ static void armada_mpic_send_doorbell(const struct cpumask *mask, | |||
334 | 334 | ||
335 | static void armada_xp_mpic_smp_cpu_init(void) | 335 | static void armada_xp_mpic_smp_cpu_init(void) |
336 | { | 336 | { |
337 | u32 control; | ||
338 | int nr_irqs, i; | ||
339 | |||
340 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); | ||
341 | nr_irqs = (control >> 2) & 0x3ff; | ||
342 | |||
343 | for (i = 0; i < nr_irqs; i++) | ||
344 | writel(i, per_cpu_int_base + ARMADA_370_XP_INT_SET_MASK_OFFS); | ||
345 | |||
337 | /* Clear pending IPIs */ | 346 | /* Clear pending IPIs */ |
338 | writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); | 347 | writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); |
339 | 348 | ||
@@ -474,7 +483,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node, | |||
474 | struct device_node *parent) | 483 | struct device_node *parent) |
475 | { | 484 | { |
476 | struct resource main_int_res, per_cpu_int_res; | 485 | struct resource main_int_res, per_cpu_int_res; |
477 | int parent_irq; | 486 | int parent_irq, nr_irqs, i; |
478 | u32 control; | 487 | u32 control; |
479 | 488 | ||
480 | BUG_ON(of_address_to_resource(node, 0, &main_int_res)); | 489 | BUG_ON(of_address_to_resource(node, 0, &main_int_res)); |
@@ -496,9 +505,13 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node, | |||
496 | BUG_ON(!per_cpu_int_base); | 505 | BUG_ON(!per_cpu_int_base); |
497 | 506 | ||
498 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); | 507 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); |
508 | nr_irqs = (control >> 2) & 0x3ff; | ||
509 | |||
510 | for (i = 0; i < nr_irqs; i++) | ||
511 | writel(i, main_int_base + ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS); | ||
499 | 512 | ||
500 | armada_370_xp_mpic_domain = | 513 | armada_370_xp_mpic_domain = |
501 | irq_domain_add_linear(node, (control >> 2) & 0x3ff, | 514 | irq_domain_add_linear(node, nr_irqs, |
502 | &armada_370_xp_mpic_irq_ops, NULL); | 515 | &armada_370_xp_mpic_irq_ops, NULL); |
503 | 516 | ||
504 | BUG_ON(!armada_370_xp_mpic_domain); | 517 | BUG_ON(!armada_370_xp_mpic_domain); |
diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index 8ee2a36d5840..c15c840987d2 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c | |||
@@ -150,7 +150,7 @@ int __init brcmstb_l2_intc_of_init(struct device_node *np, | |||
150 | 150 | ||
151 | /* Allocate a single Generic IRQ chip for this node */ | 151 | /* Allocate a single Generic IRQ chip for this node */ |
152 | ret = irq_alloc_domain_generic_chips(data->domain, 32, 1, | 152 | ret = irq_alloc_domain_generic_chips(data->domain, 32, 1, |
153 | np->full_name, handle_level_irq, clr, 0, 0); | 153 | np->full_name, handle_edge_irq, clr, 0, 0); |
154 | if (ret) { | 154 | if (ret) { |
155 | pr_err("failed to allocate generic irq chip\n"); | 155 | pr_err("failed to allocate generic irq chip\n"); |
156 | goto out_free_domain; | 156 | goto out_free_domain; |
diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c index 3fdda3a40269..6ce6bd3441bf 100644 --- a/drivers/irqchip/spear-shirq.c +++ b/drivers/irqchip/spear-shirq.c | |||
@@ -125,7 +125,7 @@ static struct spear_shirq spear320_shirq_ras2 = { | |||
125 | }; | 125 | }; |
126 | 126 | ||
127 | static struct spear_shirq spear320_shirq_ras3 = { | 127 | static struct spear_shirq spear320_shirq_ras3 = { |
128 | .irq_nr = 3, | 128 | .irq_nr = 7, |
129 | .irq_bit_off = 0, | 129 | .irq_bit_off = 0, |
130 | .invalid_irq = 1, | 130 | .invalid_irq = 1, |
131 | .regs = { | 131 | .regs = { |
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig index d9edcc94c2a8..97465ac5a2d5 100644 --- a/drivers/isdn/hisax/Kconfig +++ b/drivers/isdn/hisax/Kconfig | |||
@@ -16,7 +16,7 @@ config ISDN_DRV_HISAX | |||
16 | also to the configuration option of the driver for your particular | 16 | also to the configuration option of the driver for your particular |
17 | card, below. | 17 | card, below. |
18 | 18 | ||
19 | if ISDN_DRV_HISAX!=n | 19 | if ISDN_DRV_HISAX |
20 | 20 | ||
21 | comment "D-channel protocol features" | 21 | comment "D-channel protocol features" |
22 | 22 | ||
@@ -348,10 +348,6 @@ config HISAX_ENTERNOW_PCI | |||
348 | This enables HiSax support for the Formula-n enter:now PCI | 348 | This enables HiSax support for the Formula-n enter:now PCI |
349 | ISDN card. | 349 | ISDN card. |
350 | 350 | ||
351 | endif | ||
352 | |||
353 | if ISDN_DRV_HISAX | ||
354 | |||
355 | config HISAX_DEBUG | 351 | config HISAX_DEBUG |
356 | bool "HiSax debugging" | 352 | bool "HiSax debugging" |
357 | help | 353 | help |
@@ -420,11 +416,6 @@ config HISAX_FRITZ_PCIPNP | |||
420 | (the latter also needs you to select "ISA Plug and Play support" | 416 | (the latter also needs you to select "ISA Plug and Play support" |
421 | from the menu "Plug and Play configuration") | 417 | from the menu "Plug and Play configuration") |
422 | 418 | ||
423 | config HISAX_AVM_A1_PCMCIA | ||
424 | bool | ||
425 | depends on HISAX_AVM_A1_CS | ||
426 | default y | ||
427 | |||
428 | endif | 419 | endif |
429 | 420 | ||
430 | endmenu | 421 | endmenu |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index 23b4a3b28dbc..4eab93aa570b 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
@@ -1257,7 +1257,8 @@ static unsigned int smu_fpoll(struct file *file, poll_table *wait) | |||
1257 | if (pp->busy && pp->cmd.status != 1) | 1257 | if (pp->busy && pp->cmd.status != 1) |
1258 | mask |= POLLIN; | 1258 | mask |= POLLIN; |
1259 | spin_unlock_irqrestore(&pp->lock, flags); | 1259 | spin_unlock_irqrestore(&pp->lock, flags); |
1260 | } if (pp->mode == smu_file_events) { | 1260 | } |
1261 | if (pp->mode == smu_file_events) { | ||
1261 | /* Not yet implemented */ | 1262 | /* Not yet implemented */ |
1262 | } | 1263 | } |
1263 | return mask; | 1264 | return mask; |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 53b213226c01..4cba2d808afb 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 Christophe Saout <christophe@saout.de> | 2 | * Copyright (C) 2003 Jana Saout <jana@saout.de> |
3 | * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org> | 3 | * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org> |
4 | * Copyright (C) 2006-2009 Red Hat, Inc. All rights reserved. | 4 | * Copyright (C) 2006-2009 Red Hat, Inc. All rights reserved. |
5 | * Copyright (C) 2013 Milan Broz <gmazyland@gmail.com> | 5 | * Copyright (C) 2013 Milan Broz <gmazyland@gmail.com> |
@@ -1996,6 +1996,6 @@ static void __exit dm_crypt_exit(void) | |||
1996 | module_init(dm_crypt_init); | 1996 | module_init(dm_crypt_init); |
1997 | module_exit(dm_crypt_exit); | 1997 | module_exit(dm_crypt_exit); |
1998 | 1998 | ||
1999 | MODULE_AUTHOR("Christophe Saout <christophe@saout.de>"); | 1999 | MODULE_AUTHOR("Jana Saout <jana@saout.de>"); |
2000 | MODULE_DESCRIPTION(DM_NAME " target for transparent encryption / decryption"); | 2000 | MODULE_DESCRIPTION(DM_NAME " target for transparent encryption / decryption"); |
2001 | MODULE_LICENSE("GPL"); | 2001 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index 3842ac738f98..db404a0f7e2c 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/device-mapper.h> | 10 | #include <linux/device-mapper.h> |
11 | 11 | ||
12 | #include <linux/bio.h> | 12 | #include <linux/bio.h> |
13 | #include <linux/completion.h> | ||
13 | #include <linux/mempool.h> | 14 | #include <linux/mempool.h> |
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
@@ -32,7 +33,7 @@ struct dm_io_client { | |||
32 | struct io { | 33 | struct io { |
33 | unsigned long error_bits; | 34 | unsigned long error_bits; |
34 | atomic_t count; | 35 | atomic_t count; |
35 | struct task_struct *sleeper; | 36 | struct completion *wait; |
36 | struct dm_io_client *client; | 37 | struct dm_io_client *client; |
37 | io_notify_fn callback; | 38 | io_notify_fn callback; |
38 | void *context; | 39 | void *context; |
@@ -121,8 +122,8 @@ static void dec_count(struct io *io, unsigned int region, int error) | |||
121 | invalidate_kernel_vmap_range(io->vma_invalidate_address, | 122 | invalidate_kernel_vmap_range(io->vma_invalidate_address, |
122 | io->vma_invalidate_size); | 123 | io->vma_invalidate_size); |
123 | 124 | ||
124 | if (io->sleeper) | 125 | if (io->wait) |
125 | wake_up_process(io->sleeper); | 126 | complete(io->wait); |
126 | 127 | ||
127 | else { | 128 | else { |
128 | unsigned long r = io->error_bits; | 129 | unsigned long r = io->error_bits; |
@@ -387,6 +388,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions, | |||
387 | */ | 388 | */ |
388 | volatile char io_[sizeof(struct io) + __alignof__(struct io) - 1]; | 389 | volatile char io_[sizeof(struct io) + __alignof__(struct io) - 1]; |
389 | struct io *io = (struct io *)PTR_ALIGN(&io_, __alignof__(struct io)); | 390 | struct io *io = (struct io *)PTR_ALIGN(&io_, __alignof__(struct io)); |
391 | DECLARE_COMPLETION_ONSTACK(wait); | ||
390 | 392 | ||
391 | if (num_regions > 1 && (rw & RW_MASK) != WRITE) { | 393 | if (num_regions > 1 && (rw & RW_MASK) != WRITE) { |
392 | WARN_ON(1); | 394 | WARN_ON(1); |
@@ -395,7 +397,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions, | |||
395 | 397 | ||
396 | io->error_bits = 0; | 398 | io->error_bits = 0; |
397 | atomic_set(&io->count, 1); /* see dispatch_io() */ | 399 | atomic_set(&io->count, 1); /* see dispatch_io() */ |
398 | io->sleeper = current; | 400 | io->wait = &wait; |
399 | io->client = client; | 401 | io->client = client; |
400 | 402 | ||
401 | io->vma_invalidate_address = dp->vma_invalidate_address; | 403 | io->vma_invalidate_address = dp->vma_invalidate_address; |
@@ -403,15 +405,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions, | |||
403 | 405 | ||
404 | dispatch_io(rw, num_regions, where, dp, io, 1); | 406 | dispatch_io(rw, num_regions, where, dp, io, 1); |
405 | 407 | ||
406 | while (1) { | 408 | wait_for_completion_io(&wait); |
407 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
408 | |||
409 | if (!atomic_read(&io->count)) | ||
410 | break; | ||
411 | |||
412 | io_schedule(); | ||
413 | } | ||
414 | set_current_state(TASK_RUNNING); | ||
415 | 409 | ||
416 | if (error_bits) | 410 | if (error_bits) |
417 | *error_bits = io->error_bits; | 411 | *error_bits = io->error_bits; |
@@ -434,7 +428,7 @@ static int async_io(struct dm_io_client *client, unsigned int num_regions, | |||
434 | io = mempool_alloc(client->pool, GFP_NOIO); | 428 | io = mempool_alloc(client->pool, GFP_NOIO); |
435 | io->error_bits = 0; | 429 | io->error_bits = 0; |
436 | atomic_set(&io->count, 1); /* see dispatch_io() */ | 430 | atomic_set(&io->count, 1); /* see dispatch_io() */ |
437 | io->sleeper = NULL; | 431 | io->wait = NULL; |
438 | io->client = client; | 432 | io->client = client; |
439 | io->callback = fn; | 433 | io->callback = fn; |
440 | io->context = context; | 434 | io->context = context; |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 3f6fd9d33ba3..f4167b013d99 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -1611,8 +1611,9 @@ static int multipath_busy(struct dm_target *ti) | |||
1611 | 1611 | ||
1612 | spin_lock_irqsave(&m->lock, flags); | 1612 | spin_lock_irqsave(&m->lock, flags); |
1613 | 1613 | ||
1614 | /* pg_init in progress, requeue until done */ | 1614 | /* pg_init in progress or no paths available */ |
1615 | if (!pg_ready(m)) { | 1615 | if (m->pg_init_in_progress || |
1616 | (!m->nr_valid_paths && m->queue_if_no_path)) { | ||
1616 | busy = 1; | 1617 | busy = 1; |
1617 | goto out; | 1618 | goto out; |
1618 | } | 1619 | } |
diff --git a/drivers/md/dm-zero.c b/drivers/md/dm-zero.c index c99003e0d47a..b9a64bbce304 100644 --- a/drivers/md/dm-zero.c +++ b/drivers/md/dm-zero.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 Christophe Saout <christophe@saout.de> | 2 | * Copyright (C) 2003 Jana Saout <jana@saout.de> |
3 | * | 3 | * |
4 | * This file is released under the GPL. | 4 | * This file is released under the GPL. |
5 | */ | 5 | */ |
@@ -79,6 +79,6 @@ static void __exit dm_zero_exit(void) | |||
79 | module_init(dm_zero_init) | 79 | module_init(dm_zero_init) |
80 | module_exit(dm_zero_exit) | 80 | module_exit(dm_zero_exit) |
81 | 81 | ||
82 | MODULE_AUTHOR("Christophe Saout <christophe@saout.de>"); | 82 | MODULE_AUTHOR("Jana Saout <jana@saout.de>"); |
83 | MODULE_DESCRIPTION(DM_NAME " dummy target returning zeros"); | 83 | MODULE_DESCRIPTION(DM_NAME " dummy target returning zeros"); |
84 | MODULE_LICENSE("GPL"); | 84 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 437d99045ef2..32b958dbc499 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -54,6 +54,8 @@ static void do_deferred_remove(struct work_struct *w); | |||
54 | 54 | ||
55 | static DECLARE_WORK(deferred_remove_work, do_deferred_remove); | 55 | static DECLARE_WORK(deferred_remove_work, do_deferred_remove); |
56 | 56 | ||
57 | static struct workqueue_struct *deferred_remove_workqueue; | ||
58 | |||
57 | /* | 59 | /* |
58 | * For bio-based dm. | 60 | * For bio-based dm. |
59 | * One of these is allocated per bio. | 61 | * One of these is allocated per bio. |
@@ -276,16 +278,24 @@ static int __init local_init(void) | |||
276 | if (r) | 278 | if (r) |
277 | goto out_free_rq_tio_cache; | 279 | goto out_free_rq_tio_cache; |
278 | 280 | ||
281 | deferred_remove_workqueue = alloc_workqueue("kdmremove", WQ_UNBOUND, 1); | ||
282 | if (!deferred_remove_workqueue) { | ||
283 | r = -ENOMEM; | ||
284 | goto out_uevent_exit; | ||
285 | } | ||
286 | |||
279 | _major = major; | 287 | _major = major; |
280 | r = register_blkdev(_major, _name); | 288 | r = register_blkdev(_major, _name); |
281 | if (r < 0) | 289 | if (r < 0) |
282 | goto out_uevent_exit; | 290 | goto out_free_workqueue; |
283 | 291 | ||
284 | if (!_major) | 292 | if (!_major) |
285 | _major = r; | 293 | _major = r; |
286 | 294 | ||
287 | return 0; | 295 | return 0; |
288 | 296 | ||
297 | out_free_workqueue: | ||
298 | destroy_workqueue(deferred_remove_workqueue); | ||
289 | out_uevent_exit: | 299 | out_uevent_exit: |
290 | dm_uevent_exit(); | 300 | dm_uevent_exit(); |
291 | out_free_rq_tio_cache: | 301 | out_free_rq_tio_cache: |
@@ -299,6 +309,7 @@ out_free_io_cache: | |||
299 | static void local_exit(void) | 309 | static void local_exit(void) |
300 | { | 310 | { |
301 | flush_scheduled_work(); | 311 | flush_scheduled_work(); |
312 | destroy_workqueue(deferred_remove_workqueue); | ||
302 | 313 | ||
303 | kmem_cache_destroy(_rq_tio_cache); | 314 | kmem_cache_destroy(_rq_tio_cache); |
304 | kmem_cache_destroy(_io_cache); | 315 | kmem_cache_destroy(_io_cache); |
@@ -407,7 +418,7 @@ static void dm_blk_close(struct gendisk *disk, fmode_t mode) | |||
407 | 418 | ||
408 | if (atomic_dec_and_test(&md->open_count) && | 419 | if (atomic_dec_and_test(&md->open_count) && |
409 | (test_bit(DMF_DEFERRED_REMOVE, &md->flags))) | 420 | (test_bit(DMF_DEFERRED_REMOVE, &md->flags))) |
410 | schedule_work(&deferred_remove_work); | 421 | queue_work(deferred_remove_workqueue, &deferred_remove_work); |
411 | 422 | ||
412 | dm_put(md); | 423 | dm_put(md); |
413 | 424 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 34846856dbc6..32fc19c540d4 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5599,7 +5599,7 @@ static int get_array_info(struct mddev * mddev, void __user * arg) | |||
5599 | if (mddev->in_sync) | 5599 | if (mddev->in_sync) |
5600 | info.state = (1<<MD_SB_CLEAN); | 5600 | info.state = (1<<MD_SB_CLEAN); |
5601 | if (mddev->bitmap && mddev->bitmap_info.offset) | 5601 | if (mddev->bitmap && mddev->bitmap_info.offset) |
5602 | info.state = (1<<MD_SB_BITMAP_PRESENT); | 5602 | info.state |= (1<<MD_SB_BITMAP_PRESENT); |
5603 | info.active_disks = insync; | 5603 | info.active_disks = insync; |
5604 | info.working_disks = working; | 5604 | info.working_disks = working; |
5605 | info.failed_disks = failed; | 5605 | info.failed_disks = failed; |
@@ -7501,6 +7501,19 @@ void md_do_sync(struct md_thread *thread) | |||
7501 | rdev->recovery_offset < j) | 7501 | rdev->recovery_offset < j) |
7502 | j = rdev->recovery_offset; | 7502 | j = rdev->recovery_offset; |
7503 | rcu_read_unlock(); | 7503 | rcu_read_unlock(); |
7504 | |||
7505 | /* If there is a bitmap, we need to make sure all | ||
7506 | * writes that started before we added a spare | ||
7507 | * complete before we start doing a recovery. | ||
7508 | * Otherwise the write might complete and (via | ||
7509 | * bitmap_endwrite) set a bit in the bitmap after the | ||
7510 | * recovery has checked that bit and skipped that | ||
7511 | * region. | ||
7512 | */ | ||
7513 | if (mddev->bitmap) { | ||
7514 | mddev->pers->quiesce(mddev, 1); | ||
7515 | mddev->pers->quiesce(mddev, 0); | ||
7516 | } | ||
7504 | } | 7517 | } |
7505 | 7518 | ||
7506 | printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev)); | 7519 | printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev)); |
diff --git a/drivers/memstick/host/rtsx_pci_ms.c b/drivers/memstick/host/rtsx_pci_ms.c index 2a635b6fdaf7..c880ba685754 100644 --- a/drivers/memstick/host/rtsx_pci_ms.c +++ b/drivers/memstick/host/rtsx_pci_ms.c | |||
@@ -601,6 +601,7 @@ static int rtsx_pci_ms_drv_remove(struct platform_device *pdev) | |||
601 | pcr->slots[RTSX_MS_CARD].card_event = NULL; | 601 | pcr->slots[RTSX_MS_CARD].card_event = NULL; |
602 | msh = host->msh; | 602 | msh = host->msh; |
603 | host->eject = true; | 603 | host->eject = true; |
604 | cancel_work_sync(&host->handle_req); | ||
604 | 605 | ||
605 | mutex_lock(&host->host_mutex); | 606 | mutex_lock(&host->host_mutex); |
606 | if (host->req) { | 607 | if (host->req) { |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index ee8204cc31e9..6cc4b6acc22a 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -760,6 +760,7 @@ config MFD_SYSCON | |||
760 | config MFD_DAVINCI_VOICECODEC | 760 | config MFD_DAVINCI_VOICECODEC |
761 | tristate | 761 | tristate |
762 | select MFD_CORE | 762 | select MFD_CORE |
763 | select REGMAP_MMIO | ||
763 | 764 | ||
764 | config MFD_TI_AM335X_TSCADC | 765 | config MFD_TI_AM335X_TSCADC |
765 | tristate "TI ADC / Touch Screen chip support" | 766 | tristate "TI ADC / Touch Screen chip support" |
@@ -1225,7 +1226,7 @@ config MFD_WM8994 | |||
1225 | functionaltiy of the device other drivers must be enabled. | 1226 | functionaltiy of the device other drivers must be enabled. |
1226 | 1227 | ||
1227 | config MFD_STW481X | 1228 | config MFD_STW481X |
1228 | bool "Support for ST Microelectronics STw481x" | 1229 | tristate "Support for ST Microelectronics STw481x" |
1229 | depends on I2C && ARCH_NOMADIK | 1230 | depends on I2C && ARCH_NOMADIK |
1230 | select REGMAP_I2C | 1231 | select REGMAP_I2C |
1231 | select MFD_CORE | 1232 | select MFD_CORE |
@@ -1248,7 +1249,7 @@ config MCP_SA11X0 | |||
1248 | 1249 | ||
1249 | # Chip drivers | 1250 | # Chip drivers |
1250 | config MCP_UCB1200 | 1251 | config MCP_UCB1200 |
1251 | bool "Support for UCB1200 / UCB1300" | 1252 | tristate "Support for UCB1200 / UCB1300" |
1252 | depends on MCP_SA11X0 | 1253 | depends on MCP_SA11X0 |
1253 | select MCP | 1254 | select MCP |
1254 | 1255 | ||
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index a8ee4a36a1d8..cf2e6a198c6b 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
@@ -591,7 +591,7 @@ static int ab8500_irq_init(struct ab8500 *ab8500, struct device_node *np) | |||
591 | num_irqs = AB8500_NR_IRQS; | 591 | num_irqs = AB8500_NR_IRQS; |
592 | 592 | ||
593 | /* If ->irq_base is zero this will give a linear mapping */ | 593 | /* If ->irq_base is zero this will give a linear mapping */ |
594 | ab8500->domain = irq_domain_add_simple(NULL, | 594 | ab8500->domain = irq_domain_add_simple(ab8500->dev->of_node, |
595 | num_irqs, 0, | 595 | num_irqs, 0, |
596 | &ab8500_irq_ops, ab8500); | 596 | &ab8500_irq_ops, ab8500); |
597 | 597 | ||
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index a43d0c467274..ee9402324a23 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -54,7 +54,7 @@ config AD525X_DPOT_SPI | |||
54 | config ATMEL_PWM | 54 | config ATMEL_PWM |
55 | tristate "Atmel AT32/AT91 PWM support" | 55 | tristate "Atmel AT32/AT91 PWM support" |
56 | depends on HAVE_CLK | 56 | depends on HAVE_CLK |
57 | depends on AVR32 || AT91SAM9263 || AT91SAM9RL || AT91SAM9G45 | 57 | depends on AVR32 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 |
58 | help | 58 | help |
59 | This option enables device driver support for the PWM channels | 59 | This option enables device driver support for the PWM channels |
60 | on certain Atmel processors. Pulse Width Modulation is used for | 60 | on certain Atmel processors. Pulse Width Modulation is used for |
diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c index 73068e50e56d..3250fc1df0aa 100644 --- a/drivers/misc/vexpress-syscfg.c +++ b/drivers/misc/vexpress-syscfg.c | |||
@@ -199,7 +199,7 @@ static struct regmap *vexpress_syscfg_regmap_init(struct device *dev, | |||
199 | func = kzalloc(sizeof(*func) + sizeof(*func->template) * num, | 199 | func = kzalloc(sizeof(*func) + sizeof(*func->template) * num, |
200 | GFP_KERNEL); | 200 | GFP_KERNEL); |
201 | if (!func) | 201 | if (!func) |
202 | return NULL; | 202 | return ERR_PTR(-ENOMEM); |
203 | 203 | ||
204 | func->syscfg = syscfg; | 204 | func->syscfg = syscfg; |
205 | func->num_templates = num; | 205 | func->num_templates = num; |
@@ -231,10 +231,14 @@ static struct regmap *vexpress_syscfg_regmap_init(struct device *dev, | |||
231 | func->regmap = regmap_init(dev, NULL, func, | 231 | func->regmap = regmap_init(dev, NULL, func, |
232 | &vexpress_syscfg_regmap_config); | 232 | &vexpress_syscfg_regmap_config); |
233 | 233 | ||
234 | if (IS_ERR(func->regmap)) | 234 | if (IS_ERR(func->regmap)) { |
235 | void *err = func->regmap; | ||
236 | |||
235 | kfree(func); | 237 | kfree(func); |
236 | else | 238 | return err; |
237 | list_add(&func->list, &syscfg->funcs); | 239 | } |
240 | |||
241 | list_add(&func->list, &syscfg->funcs); | ||
238 | 242 | ||
239 | return func->regmap; | 243 | return func->regmap; |
240 | } | 244 | } |
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 2421835d5daf..191617492181 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c | |||
@@ -17,7 +17,8 @@ | |||
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
19 | * | 19 | * |
20 | * Maintained by: Dmitry Torokhov <dtor@vmware.com> | 20 | * Maintained by: Xavier Deguillard <xdeguillard@vmware.com> |
21 | * Philip Moltmann <moltmann@vmware.com> | ||
21 | */ | 22 | */ |
22 | 23 | ||
23 | /* | 24 | /* |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 04f35f960cb8..3a451b6cd3d5 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1025,10 +1025,14 @@ static netdev_features_t bond_fix_features(struct net_device *dev, | |||
1025 | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ | 1025 | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ |
1026 | NETIF_F_HIGHDMA | NETIF_F_LRO) | 1026 | NETIF_F_HIGHDMA | NETIF_F_LRO) |
1027 | 1027 | ||
1028 | #define BOND_ENC_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | NETIF_F_RXCSUM |\ | ||
1029 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL) | ||
1030 | |||
1028 | static void bond_compute_features(struct bonding *bond) | 1031 | static void bond_compute_features(struct bonding *bond) |
1029 | { | 1032 | { |
1030 | unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; | 1033 | unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; |
1031 | netdev_features_t vlan_features = BOND_VLAN_FEATURES; | 1034 | netdev_features_t vlan_features = BOND_VLAN_FEATURES; |
1035 | netdev_features_t enc_features = BOND_ENC_FEATURES; | ||
1032 | struct net_device *bond_dev = bond->dev; | 1036 | struct net_device *bond_dev = bond->dev; |
1033 | struct list_head *iter; | 1037 | struct list_head *iter; |
1034 | struct slave *slave; | 1038 | struct slave *slave; |
@@ -1044,6 +1048,9 @@ static void bond_compute_features(struct bonding *bond) | |||
1044 | vlan_features = netdev_increment_features(vlan_features, | 1048 | vlan_features = netdev_increment_features(vlan_features, |
1045 | slave->dev->vlan_features, BOND_VLAN_FEATURES); | 1049 | slave->dev->vlan_features, BOND_VLAN_FEATURES); |
1046 | 1050 | ||
1051 | enc_features = netdev_increment_features(enc_features, | ||
1052 | slave->dev->hw_enc_features, | ||
1053 | BOND_ENC_FEATURES); | ||
1047 | dst_release_flag &= slave->dev->priv_flags; | 1054 | dst_release_flag &= slave->dev->priv_flags; |
1048 | if (slave->dev->hard_header_len > max_hard_header_len) | 1055 | if (slave->dev->hard_header_len > max_hard_header_len) |
1049 | max_hard_header_len = slave->dev->hard_header_len; | 1056 | max_hard_header_len = slave->dev->hard_header_len; |
@@ -1054,6 +1061,7 @@ static void bond_compute_features(struct bonding *bond) | |||
1054 | 1061 | ||
1055 | done: | 1062 | done: |
1056 | bond_dev->vlan_features = vlan_features; | 1063 | bond_dev->vlan_features = vlan_features; |
1064 | bond_dev->hw_enc_features = enc_features; | ||
1057 | bond_dev->hard_header_len = max_hard_header_len; | 1065 | bond_dev->hard_header_len = max_hard_header_len; |
1058 | bond_dev->gso_max_segs = gso_max_segs; | 1066 | bond_dev->gso_max_segs = gso_max_segs; |
1059 | netif_set_gso_max_size(bond_dev, gso_max_size); | 1067 | netif_set_gso_max_size(bond_dev, gso_max_size); |
@@ -3975,6 +3983,7 @@ void bond_setup(struct net_device *bond_dev) | |||
3975 | NETIF_F_HW_VLAN_CTAG_FILTER; | 3983 | NETIF_F_HW_VLAN_CTAG_FILTER; |
3976 | 3984 | ||
3977 | bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); | 3985 | bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); |
3986 | bond_dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
3978 | bond_dev->features |= bond_dev->hw_features; | 3987 | bond_dev->features |= bond_dev->hw_features; |
3979 | } | 3988 | } |
3980 | 3989 | ||
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index dcf9196f6316..ea4d4f1a6411 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/delay.h> | 52 | #include <linux/delay.h> |
53 | #include <linux/init.h> | 53 | #include <linux/init.h> |
54 | #include <linux/kernel.h> | 54 | #include <linux/kernel.h> |
55 | #include <linux/workqueue.h> | ||
55 | #include <linux/can.h> | 56 | #include <linux/can.h> |
56 | #include <linux/can/skb.h> | 57 | #include <linux/can/skb.h> |
57 | 58 | ||
@@ -85,6 +86,7 @@ struct slcan { | |||
85 | struct tty_struct *tty; /* ptr to TTY structure */ | 86 | struct tty_struct *tty; /* ptr to TTY structure */ |
86 | struct net_device *dev; /* easy for intr handling */ | 87 | struct net_device *dev; /* easy for intr handling */ |
87 | spinlock_t lock; | 88 | spinlock_t lock; |
89 | struct work_struct tx_work; /* Flushes transmit buffer */ | ||
88 | 90 | ||
89 | /* These are pointers to the malloc()ed frame buffers. */ | 91 | /* These are pointers to the malloc()ed frame buffers. */ |
90 | unsigned char rbuff[SLC_MTU]; /* receiver buffer */ | 92 | unsigned char rbuff[SLC_MTU]; /* receiver buffer */ |
@@ -309,36 +311,46 @@ static void slc_encaps(struct slcan *sl, struct can_frame *cf) | |||
309 | sl->dev->stats.tx_bytes += cf->can_dlc; | 311 | sl->dev->stats.tx_bytes += cf->can_dlc; |
310 | } | 312 | } |
311 | 313 | ||
312 | /* | 314 | /* Write out any remaining transmit buffer. Scheduled when tty is writable */ |
313 | * Called by the driver when there's room for more data. If we have | 315 | static void slcan_transmit(struct work_struct *work) |
314 | * more packets to send, we send them here. | ||
315 | */ | ||
316 | static void slcan_write_wakeup(struct tty_struct *tty) | ||
317 | { | 316 | { |
317 | struct slcan *sl = container_of(work, struct slcan, tx_work); | ||
318 | int actual; | 318 | int actual; |
319 | struct slcan *sl = (struct slcan *) tty->disc_data; | ||
320 | 319 | ||
320 | spin_lock_bh(&sl->lock); | ||
321 | /* First make sure we're connected. */ | 321 | /* First make sure we're connected. */ |
322 | if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) | 322 | if (!sl->tty || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) { |
323 | spin_unlock_bh(&sl->lock); | ||
323 | return; | 324 | return; |
325 | } | ||
324 | 326 | ||
325 | spin_lock_bh(&sl->lock); | ||
326 | if (sl->xleft <= 0) { | 327 | if (sl->xleft <= 0) { |
327 | /* Now serial buffer is almost free & we can start | 328 | /* Now serial buffer is almost free & we can start |
328 | * transmission of another packet */ | 329 | * transmission of another packet */ |
329 | sl->dev->stats.tx_packets++; | 330 | sl->dev->stats.tx_packets++; |
330 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 331 | clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); |
331 | spin_unlock_bh(&sl->lock); | 332 | spin_unlock_bh(&sl->lock); |
332 | netif_wake_queue(sl->dev); | 333 | netif_wake_queue(sl->dev); |
333 | return; | 334 | return; |
334 | } | 335 | } |
335 | 336 | ||
336 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); | 337 | actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft); |
337 | sl->xleft -= actual; | 338 | sl->xleft -= actual; |
338 | sl->xhead += actual; | 339 | sl->xhead += actual; |
339 | spin_unlock_bh(&sl->lock); | 340 | spin_unlock_bh(&sl->lock); |
340 | } | 341 | } |
341 | 342 | ||
343 | /* | ||
344 | * Called by the driver when there's room for more data. | ||
345 | * Schedule the transmit. | ||
346 | */ | ||
347 | static void slcan_write_wakeup(struct tty_struct *tty) | ||
348 | { | ||
349 | struct slcan *sl = tty->disc_data; | ||
350 | |||
351 | schedule_work(&sl->tx_work); | ||
352 | } | ||
353 | |||
342 | /* Send a can_frame to a TTY queue. */ | 354 | /* Send a can_frame to a TTY queue. */ |
343 | static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev) | 355 | static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev) |
344 | { | 356 | { |
@@ -528,6 +540,7 @@ static struct slcan *slc_alloc(dev_t line) | |||
528 | sl->magic = SLCAN_MAGIC; | 540 | sl->magic = SLCAN_MAGIC; |
529 | sl->dev = dev; | 541 | sl->dev = dev; |
530 | spin_lock_init(&sl->lock); | 542 | spin_lock_init(&sl->lock); |
543 | INIT_WORK(&sl->tx_work, slcan_transmit); | ||
531 | slcan_devs[i] = dev; | 544 | slcan_devs[i] = dev; |
532 | 545 | ||
533 | return sl; | 546 | return sl; |
@@ -626,8 +639,12 @@ static void slcan_close(struct tty_struct *tty) | |||
626 | if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty) | 639 | if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty) |
627 | return; | 640 | return; |
628 | 641 | ||
642 | spin_lock_bh(&sl->lock); | ||
629 | tty->disc_data = NULL; | 643 | tty->disc_data = NULL; |
630 | sl->tty = NULL; | 644 | sl->tty = NULL; |
645 | spin_unlock_bh(&sl->lock); | ||
646 | |||
647 | flush_work(&sl->tx_work); | ||
631 | 648 | ||
632 | /* Flush network side */ | 649 | /* Flush network side */ |
633 | unregister_netdev(sl->dev); | 650 | unregister_netdev(sl->dev); |
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 28460676b8ca..d81e7167a8b5 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c | |||
@@ -736,6 +736,7 @@ static int emac_open(struct net_device *dev) | |||
736 | 736 | ||
737 | ret = emac_mdio_probe(dev); | 737 | ret = emac_mdio_probe(dev); |
738 | if (ret < 0) { | 738 | if (ret < 0) { |
739 | free_irq(dev->irq, dev); | ||
739 | netdev_err(dev, "cannot probe MDIO bus\n"); | 740 | netdev_err(dev, "cannot probe MDIO bus\n"); |
740 | return ret; | 741 | return ret; |
741 | } | 742 | } |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index df2792d8383d..8afa579e7c40 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -3224,7 +3224,7 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp, | |||
3224 | return 0; | 3224 | return 0; |
3225 | } | 3225 | } |
3226 | 3226 | ||
3227 | #define NVRAM_CMD_TIMEOUT 100 | 3227 | #define NVRAM_CMD_TIMEOUT 5000 |
3228 | 3228 | ||
3229 | static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd) | 3229 | static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd) |
3230 | { | 3230 | { |
@@ -3232,7 +3232,7 @@ static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd) | |||
3232 | 3232 | ||
3233 | tw32(NVRAM_CMD, nvram_cmd); | 3233 | tw32(NVRAM_CMD, nvram_cmd); |
3234 | for (i = 0; i < NVRAM_CMD_TIMEOUT; i++) { | 3234 | for (i = 0; i < NVRAM_CMD_TIMEOUT; i++) { |
3235 | udelay(10); | 3235 | usleep_range(10, 40); |
3236 | if (tr32(NVRAM_CMD) & NVRAM_CMD_DONE) { | 3236 | if (tr32(NVRAM_CMD) & NVRAM_CMD_DONE) { |
3237 | udelay(10); | 3237 | udelay(10); |
3238 | break; | 3238 | break; |
@@ -7854,8 +7854,8 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb) | |||
7854 | netif_wake_queue(tp->dev); | 7854 | netif_wake_queue(tp->dev); |
7855 | } | 7855 | } |
7856 | 7856 | ||
7857 | segs = skb_gso_segment(skb, tp->dev->features & ~NETIF_F_TSO); | 7857 | segs = skb_gso_segment(skb, tp->dev->features & ~(NETIF_F_TSO | NETIF_F_TSO6)); |
7858 | if (IS_ERR(segs)) | 7858 | if (IS_ERR(segs) || !segs) |
7859 | goto tg3_tso_bug_end; | 7859 | goto tg3_tso_bug_end; |
7860 | 7860 | ||
7861 | do { | 7861 | do { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 2f8d6b910383..a83271cf17c3 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -4057,22 +4057,19 @@ int cxgb4_unregister_uld(enum cxgb4_uld type) | |||
4057 | EXPORT_SYMBOL(cxgb4_unregister_uld); | 4057 | EXPORT_SYMBOL(cxgb4_unregister_uld); |
4058 | 4058 | ||
4059 | /* Check if netdev on which event is occured belongs to us or not. Return | 4059 | /* Check if netdev on which event is occured belongs to us or not. Return |
4060 | * suceess (1) if it belongs otherwise failure (0). | 4060 | * success (true) if it belongs otherwise failure (false). |
4061 | * Called with rcu_read_lock() held. | ||
4061 | */ | 4062 | */ |
4062 | static int cxgb4_netdev(struct net_device *netdev) | 4063 | static bool cxgb4_netdev(const struct net_device *netdev) |
4063 | { | 4064 | { |
4064 | struct adapter *adap; | 4065 | struct adapter *adap; |
4065 | int i; | 4066 | int i; |
4066 | 4067 | ||
4067 | spin_lock(&adap_rcu_lock); | ||
4068 | list_for_each_entry_rcu(adap, &adap_rcu_list, rcu_node) | 4068 | list_for_each_entry_rcu(adap, &adap_rcu_list, rcu_node) |
4069 | for (i = 0; i < MAX_NPORTS; i++) | 4069 | for (i = 0; i < MAX_NPORTS; i++) |
4070 | if (adap->port[i] == netdev) { | 4070 | if (adap->port[i] == netdev) |
4071 | spin_unlock(&adap_rcu_lock); | 4071 | return true; |
4072 | return 1; | 4072 | return false; |
4073 | } | ||
4074 | spin_unlock(&adap_rcu_lock); | ||
4075 | return 0; | ||
4076 | } | 4073 | } |
4077 | 4074 | ||
4078 | static int clip_add(struct net_device *event_dev, struct inet6_ifaddr *ifa, | 4075 | static int clip_add(struct net_device *event_dev, struct inet6_ifaddr *ifa, |
@@ -6396,6 +6393,7 @@ static void remove_one(struct pci_dev *pdev) | |||
6396 | adapter->flags &= ~DEV_ENABLED; | 6393 | adapter->flags &= ~DEV_ENABLED; |
6397 | } | 6394 | } |
6398 | pci_release_regions(pdev); | 6395 | pci_release_regions(pdev); |
6396 | synchronize_rcu(); | ||
6399 | kfree(adapter); | 6397 | kfree(adapter); |
6400 | } else | 6398 | } else |
6401 | pci_release_regions(pdev); | 6399 | pci_release_regions(pdev); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index bba67681aeaa..931478e7bd28 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -3962,6 +3962,7 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf) | |||
3962 | p->lport = j; | 3962 | p->lport = j; |
3963 | p->rss_size = rss_size; | 3963 | p->rss_size = rss_size; |
3964 | memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN); | 3964 | memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN); |
3965 | adap->port[i]->dev_port = j; | ||
3965 | 3966 | ||
3966 | ret = ntohl(c.u.info.lstatus_to_modtype); | 3967 | ret = ntohl(c.u.info.lstatus_to_modtype); |
3967 | p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ? | 3968 | p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ? |
diff --git a/drivers/net/ethernet/dec/tulip/timer.c b/drivers/net/ethernet/dec/tulip/timer.c index 768379b8aee9..523d9dde50a2 100644 --- a/drivers/net/ethernet/dec/tulip/timer.c +++ b/drivers/net/ethernet/dec/tulip/timer.c | |||
@@ -158,7 +158,7 @@ void comet_timer(unsigned long data) | |||
158 | { | 158 | { |
159 | struct net_device *dev = (struct net_device *)data; | 159 | struct net_device *dev = (struct net_device *)data; |
160 | struct tulip_private *tp = netdev_priv(dev); | 160 | struct tulip_private *tp = netdev_priv(dev); |
161 | int next_tick = 60*HZ; | 161 | int next_tick = 2*HZ; |
162 | 162 | ||
163 | if (tulip_debug > 1) | 163 | if (tulip_debug > 1) |
164 | netdev_dbg(dev, "Comet link status %04x partner capability %04x\n", | 164 | netdev_dbg(dev, "Comet link status %04x partner capability %04x\n", |
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 2e7c5553955e..c2f5d2d3b932 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -557,9 +557,7 @@ static inline u16 be_max_qs(struct be_adapter *adapter) | |||
557 | #define be_pvid_tagging_enabled(adapter) (adapter->pvid) | 557 | #define be_pvid_tagging_enabled(adapter) (adapter->pvid) |
558 | 558 | ||
559 | /* Is BE in QNQ multi-channel mode */ | 559 | /* Is BE in QNQ multi-channel mode */ |
560 | #define be_is_qnq_mode(adapter) (adapter->mc_type == FLEX10 || \ | 560 | #define be_is_qnq_mode(adapter) (adapter->function_mode & QNQ_MODE) |
561 | adapter->mc_type == vNIC1 || \ | ||
562 | adapter->mc_type == UFP) | ||
563 | 561 | ||
564 | #define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \ | 562 | #define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \ |
565 | adapter->pdev->device == OC_DEVICE_ID4) | 563 | adapter->pdev->device == OC_DEVICE_ID4) |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index 3e0a6b243806..59b3c056f329 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
@@ -1091,7 +1091,7 @@ struct be_cmd_resp_modify_eq_delay { | |||
1091 | * based on the skew/IPL. | 1091 | * based on the skew/IPL. |
1092 | */ | 1092 | */ |
1093 | #define RDMA_ENABLED 0x4 | 1093 | #define RDMA_ENABLED 0x4 |
1094 | #define FLEX10_MODE 0x400 | 1094 | #define QNQ_MODE 0x400 |
1095 | #define VNIC_MODE 0x20000 | 1095 | #define VNIC_MODE 0x20000 |
1096 | #define UMC_ENABLED 0x1000000 | 1096 | #define UMC_ENABLED 0x1000000 |
1097 | struct be_cmd_req_query_fw_cfg { | 1097 | struct be_cmd_req_query_fw_cfg { |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 6822b3d76d85..34a26e42f19d 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -3254,9 +3254,9 @@ err: | |||
3254 | 3254 | ||
3255 | static u8 be_convert_mc_type(u32 function_mode) | 3255 | static u8 be_convert_mc_type(u32 function_mode) |
3256 | { | 3256 | { |
3257 | if (function_mode & VNIC_MODE && function_mode & FLEX10_MODE) | 3257 | if (function_mode & VNIC_MODE && function_mode & QNQ_MODE) |
3258 | return vNIC1; | 3258 | return vNIC1; |
3259 | else if (function_mode & FLEX10_MODE) | 3259 | else if (function_mode & QNQ_MODE) |
3260 | return FLEX10; | 3260 | return FLEX10; |
3261 | else if (function_mode & VNIC_MODE) | 3261 | else if (function_mode & VNIC_MODE) |
3262 | return vNIC2; | 3262 | return vNIC2; |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 38d9d276ab8b..77037fd377b8 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -320,6 +320,11 @@ static void *swap_buffer(void *bufaddr, int len) | |||
320 | return bufaddr; | 320 | return bufaddr; |
321 | } | 321 | } |
322 | 322 | ||
323 | static inline bool is_ipv4_pkt(struct sk_buff *skb) | ||
324 | { | ||
325 | return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4; | ||
326 | } | ||
327 | |||
323 | static int | 328 | static int |
324 | fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev) | 329 | fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev) |
325 | { | 330 | { |
@@ -330,7 +335,8 @@ fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev) | |||
330 | if (unlikely(skb_cow_head(skb, 0))) | 335 | if (unlikely(skb_cow_head(skb, 0))) |
331 | return -1; | 336 | return -1; |
332 | 337 | ||
333 | ip_hdr(skb)->check = 0; | 338 | if (is_ipv4_pkt(skb)) |
339 | ip_hdr(skb)->check = 0; | ||
334 | *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0; | 340 | *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0; |
335 | 341 | ||
336 | return 0; | 342 | return 0; |
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 7f81ae66cc89..e912b6887d40 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
@@ -4199,6 +4199,13 @@ static struct dmi_system_id skge_32bit_dma_boards[] = { | |||
4199 | DMI_MATCH(DMI_BOARD_NAME, "P5NSLI") | 4199 | DMI_MATCH(DMI_BOARD_NAME, "P5NSLI") |
4200 | }, | 4200 | }, |
4201 | }, | 4201 | }, |
4202 | { | ||
4203 | .ident = "FUJITSU SIEMENS A8NE-FM", | ||
4204 | .matches = { | ||
4205 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTek Computer INC."), | ||
4206 | DMI_MATCH(DMI_BOARD_NAME, "A8NE-FM") | ||
4207 | }, | ||
4208 | }, | ||
4202 | {} | 4209 | {} |
4203 | }; | 4210 | }; |
4204 | 4211 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 5f42f6d6e4c6..82ab427290c3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -2439,7 +2439,8 @@ slave_start: | |||
2439 | (num_vfs_argc > 1 || probe_vfs_argc > 1)) { | 2439 | (num_vfs_argc > 1 || probe_vfs_argc > 1)) { |
2440 | mlx4_err(dev, | 2440 | mlx4_err(dev, |
2441 | "Invalid syntax of num_vfs/probe_vfs with IB port - single port VFs syntax is only supported when all ports are configured as ethernet\n"); | 2441 | "Invalid syntax of num_vfs/probe_vfs with IB port - single port VFs syntax is only supported when all ports are configured as ethernet\n"); |
2442 | goto err_close; | 2442 | err = -EINVAL; |
2443 | goto err_master_mfunc; | ||
2443 | } | 2444 | } |
2444 | for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]); i++) { | 2445 | for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]); i++) { |
2445 | unsigned j; | 2446 | unsigned j; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index ff380dac6629..b988d16cd34e 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1212,7 +1212,12 @@ static int cpsw_ndo_open(struct net_device *ndev) | |||
1212 | for_each_slave(priv, cpsw_slave_open, priv); | 1212 | for_each_slave(priv, cpsw_slave_open, priv); |
1213 | 1213 | ||
1214 | /* Add default VLAN */ | 1214 | /* Add default VLAN */ |
1215 | cpsw_add_default_vlan(priv); | 1215 | if (!priv->data.dual_emac) |
1216 | cpsw_add_default_vlan(priv); | ||
1217 | else | ||
1218 | cpsw_ale_add_vlan(priv->ale, priv->data.default_vlan, | ||
1219 | ALE_ALL_PORTS << priv->host_port, | ||
1220 | ALE_ALL_PORTS << priv->host_port, 0, 0); | ||
1216 | 1221 | ||
1217 | if (!cpsw_common_res_usage_state(priv)) { | 1222 | if (!cpsw_common_res_usage_state(priv)) { |
1218 | /* setup tx dma to fixed prio and zero offset */ | 1223 | /* setup tx dma to fixed prio and zero offset */ |
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c index 14389f841d43..4c70360967c2 100644 --- a/drivers/net/ethernet/tile/tilegx.c +++ b/drivers/net/ethernet/tile/tilegx.c | |||
@@ -2191,7 +2191,6 @@ static void tile_net_setup(struct net_device *dev) | |||
2191 | static void tile_net_dev_init(const char *name, const uint8_t *mac) | 2191 | static void tile_net_dev_init(const char *name, const uint8_t *mac) |
2192 | { | 2192 | { |
2193 | int ret; | 2193 | int ret; |
2194 | int i; | ||
2195 | struct net_device *dev; | 2194 | struct net_device *dev; |
2196 | struct tile_net_priv *priv; | 2195 | struct tile_net_priv *priv; |
2197 | 2196 | ||
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index c041f63a6d30..4ed38eaecea8 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
@@ -189,7 +189,7 @@ static int netvsc_destroy_buf(struct netvsc_device *net_device) | |||
189 | "unable to teardown send buffer's gpadl\n"); | 189 | "unable to teardown send buffer's gpadl\n"); |
190 | return ret; | 190 | return ret; |
191 | } | 191 | } |
192 | net_device->recv_buf_gpadl_handle = 0; | 192 | net_device->send_buf_gpadl_handle = 0; |
193 | } | 193 | } |
194 | if (net_device->send_buf) { | 194 | if (net_device->send_buf) { |
195 | /* Free up the receive buffer */ | 195 | /* Free up the receive buffer */ |
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 4517b149ed07..50899416f668 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c | |||
@@ -1137,6 +1137,8 @@ static int at86rf230_probe(struct spi_device *spi) | |||
1137 | dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK; | 1137 | dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK; |
1138 | 1138 | ||
1139 | irq_type = irq_get_trigger_type(spi->irq); | 1139 | irq_type = irq_get_trigger_type(spi->irq); |
1140 | if (!irq_type) | ||
1141 | irq_type = IRQF_TRIGGER_RISING; | ||
1140 | if (irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { | 1142 | if (irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { |
1141 | irq_worker = at86rf230_irqwork; | 1143 | irq_worker = at86rf230_irqwork; |
1142 | irq_handler = at86rf230_isr; | 1144 | irq_handler = at86rf230_isr; |
@@ -1168,7 +1170,8 @@ static int at86rf230_probe(struct spi_device *spi) | |||
1168 | if (rc) | 1170 | if (rc) |
1169 | goto err_hw_init; | 1171 | goto err_hw_init; |
1170 | 1172 | ||
1171 | rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, IRQF_SHARED, | 1173 | rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, |
1174 | IRQF_SHARED | irq_type, | ||
1172 | dev_name(&spi->dev), lp); | 1175 | dev_name(&spi->dev), lp); |
1173 | if (rc) | 1176 | if (rc) |
1174 | goto err_hw_init; | 1177 | goto err_hw_init; |
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 6c622aedbae1..fdc1b418fa6a 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c | |||
@@ -16,9 +16,13 @@ | |||
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/netdevice.h> | 17 | #include <linux/netdevice.h> |
18 | #include <linux/etherdevice.h> | 18 | #include <linux/etherdevice.h> |
19 | #include <linux/of_gpio.h> | ||
20 | #include <linux/gpio/consumer.h> | ||
19 | 21 | ||
20 | #define AT803X_INTR_ENABLE 0x12 | 22 | #define AT803X_INTR_ENABLE 0x12 |
21 | #define AT803X_INTR_STATUS 0x13 | 23 | #define AT803X_INTR_STATUS 0x13 |
24 | #define AT803X_SMART_SPEED 0x14 | ||
25 | #define AT803X_LED_CONTROL 0x18 | ||
22 | #define AT803X_WOL_ENABLE 0x01 | 26 | #define AT803X_WOL_ENABLE 0x01 |
23 | #define AT803X_DEVICE_ADDR 0x03 | 27 | #define AT803X_DEVICE_ADDR 0x03 |
24 | #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C | 28 | #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C |
@@ -35,10 +39,52 @@ | |||
35 | #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 | 39 | #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 |
36 | #define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) | 40 | #define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) |
37 | 41 | ||
42 | #define ATH8030_PHY_ID 0x004dd076 | ||
43 | #define ATH8031_PHY_ID 0x004dd074 | ||
44 | #define ATH8035_PHY_ID 0x004dd072 | ||
45 | |||
38 | MODULE_DESCRIPTION("Atheros 803x PHY driver"); | 46 | MODULE_DESCRIPTION("Atheros 803x PHY driver"); |
39 | MODULE_AUTHOR("Matus Ujhelyi"); | 47 | MODULE_AUTHOR("Matus Ujhelyi"); |
40 | MODULE_LICENSE("GPL"); | 48 | MODULE_LICENSE("GPL"); |
41 | 49 | ||
50 | struct at803x_priv { | ||
51 | bool phy_reset:1; | ||
52 | struct gpio_desc *gpiod_reset; | ||
53 | }; | ||
54 | |||
55 | struct at803x_context { | ||
56 | u16 bmcr; | ||
57 | u16 advertise; | ||
58 | u16 control1000; | ||
59 | u16 int_enable; | ||
60 | u16 smart_speed; | ||
61 | u16 led_control; | ||
62 | }; | ||
63 | |||
64 | /* save relevant PHY registers to private copy */ | ||
65 | static void at803x_context_save(struct phy_device *phydev, | ||
66 | struct at803x_context *context) | ||
67 | { | ||
68 | context->bmcr = phy_read(phydev, MII_BMCR); | ||
69 | context->advertise = phy_read(phydev, MII_ADVERTISE); | ||
70 | context->control1000 = phy_read(phydev, MII_CTRL1000); | ||
71 | context->int_enable = phy_read(phydev, AT803X_INTR_ENABLE); | ||
72 | context->smart_speed = phy_read(phydev, AT803X_SMART_SPEED); | ||
73 | context->led_control = phy_read(phydev, AT803X_LED_CONTROL); | ||
74 | } | ||
75 | |||
76 | /* restore relevant PHY registers from private copy */ | ||
77 | static void at803x_context_restore(struct phy_device *phydev, | ||
78 | const struct at803x_context *context) | ||
79 | { | ||
80 | phy_write(phydev, MII_BMCR, context->bmcr); | ||
81 | phy_write(phydev, MII_ADVERTISE, context->advertise); | ||
82 | phy_write(phydev, MII_CTRL1000, context->control1000); | ||
83 | phy_write(phydev, AT803X_INTR_ENABLE, context->int_enable); | ||
84 | phy_write(phydev, AT803X_SMART_SPEED, context->smart_speed); | ||
85 | phy_write(phydev, AT803X_LED_CONTROL, context->led_control); | ||
86 | } | ||
87 | |||
42 | static int at803x_set_wol(struct phy_device *phydev, | 88 | static int at803x_set_wol(struct phy_device *phydev, |
43 | struct ethtool_wolinfo *wol) | 89 | struct ethtool_wolinfo *wol) |
44 | { | 90 | { |
@@ -142,6 +188,26 @@ static int at803x_resume(struct phy_device *phydev) | |||
142 | return 0; | 188 | return 0; |
143 | } | 189 | } |
144 | 190 | ||
191 | static int at803x_probe(struct phy_device *phydev) | ||
192 | { | ||
193 | struct device *dev = &phydev->dev; | ||
194 | struct at803x_priv *priv; | ||
195 | |||
196 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); | ||
197 | if (!priv) | ||
198 | return -ENOMEM; | ||
199 | |||
200 | priv->gpiod_reset = devm_gpiod_get(dev, "reset"); | ||
201 | if (IS_ERR(priv->gpiod_reset)) | ||
202 | priv->gpiod_reset = NULL; | ||
203 | else | ||
204 | gpiod_direction_output(priv->gpiod_reset, 1); | ||
205 | |||
206 | phydev->priv = priv; | ||
207 | |||
208 | return 0; | ||
209 | } | ||
210 | |||
145 | static int at803x_config_init(struct phy_device *phydev) | 211 | static int at803x_config_init(struct phy_device *phydev) |
146 | { | 212 | { |
147 | int ret; | 213 | int ret; |
@@ -189,58 +255,99 @@ static int at803x_config_intr(struct phy_device *phydev) | |||
189 | return err; | 255 | return err; |
190 | } | 256 | } |
191 | 257 | ||
258 | static void at803x_link_change_notify(struct phy_device *phydev) | ||
259 | { | ||
260 | struct at803x_priv *priv = phydev->priv; | ||
261 | |||
262 | /* | ||
263 | * Conduct a hardware reset for AT8030 every time a link loss is | ||
264 | * signalled. This is necessary to circumvent a hardware bug that | ||
265 | * occurs when the cable is unplugged while TX packets are pending | ||
266 | * in the FIFO. In such cases, the FIFO enters an error mode it | ||
267 | * cannot recover from by software. | ||
268 | */ | ||
269 | if (phydev->drv->phy_id == ATH8030_PHY_ID) { | ||
270 | if (phydev->state == PHY_NOLINK) { | ||
271 | if (priv->gpiod_reset && !priv->phy_reset) { | ||
272 | struct at803x_context context; | ||
273 | |||
274 | at803x_context_save(phydev, &context); | ||
275 | |||
276 | gpiod_set_value(priv->gpiod_reset, 0); | ||
277 | msleep(1); | ||
278 | gpiod_set_value(priv->gpiod_reset, 1); | ||
279 | msleep(1); | ||
280 | |||
281 | at803x_context_restore(phydev, &context); | ||
282 | |||
283 | dev_dbg(&phydev->dev, "%s(): phy was reset\n", | ||
284 | __func__); | ||
285 | priv->phy_reset = true; | ||
286 | } | ||
287 | } else { | ||
288 | priv->phy_reset = false; | ||
289 | } | ||
290 | } | ||
291 | } | ||
292 | |||
192 | static struct phy_driver at803x_driver[] = { | 293 | static struct phy_driver at803x_driver[] = { |
193 | { | 294 | { |
194 | /* ATHEROS 8035 */ | 295 | /* ATHEROS 8035 */ |
195 | .phy_id = 0x004dd072, | 296 | .phy_id = ATH8035_PHY_ID, |
196 | .name = "Atheros 8035 ethernet", | 297 | .name = "Atheros 8035 ethernet", |
197 | .phy_id_mask = 0xffffffef, | 298 | .phy_id_mask = 0xffffffef, |
198 | .config_init = at803x_config_init, | 299 | .probe = at803x_probe, |
199 | .set_wol = at803x_set_wol, | 300 | .config_init = at803x_config_init, |
200 | .get_wol = at803x_get_wol, | 301 | .link_change_notify = at803x_link_change_notify, |
201 | .suspend = at803x_suspend, | 302 | .set_wol = at803x_set_wol, |
202 | .resume = at803x_resume, | 303 | .get_wol = at803x_get_wol, |
203 | .features = PHY_GBIT_FEATURES, | 304 | .suspend = at803x_suspend, |
204 | .flags = PHY_HAS_INTERRUPT, | 305 | .resume = at803x_resume, |
205 | .config_aneg = genphy_config_aneg, | 306 | .features = PHY_GBIT_FEATURES, |
206 | .read_status = genphy_read_status, | 307 | .flags = PHY_HAS_INTERRUPT, |
207 | .driver = { | 308 | .config_aneg = genphy_config_aneg, |
309 | .read_status = genphy_read_status, | ||
310 | .driver = { | ||
208 | .owner = THIS_MODULE, | 311 | .owner = THIS_MODULE, |
209 | }, | 312 | }, |
210 | }, { | 313 | }, { |
211 | /* ATHEROS 8030 */ | 314 | /* ATHEROS 8030 */ |
212 | .phy_id = 0x004dd076, | 315 | .phy_id = ATH8030_PHY_ID, |
213 | .name = "Atheros 8030 ethernet", | 316 | .name = "Atheros 8030 ethernet", |
214 | .phy_id_mask = 0xffffffef, | 317 | .phy_id_mask = 0xffffffef, |
215 | .config_init = at803x_config_init, | 318 | .probe = at803x_probe, |
216 | .set_wol = at803x_set_wol, | 319 | .config_init = at803x_config_init, |
217 | .get_wol = at803x_get_wol, | 320 | .link_change_notify = at803x_link_change_notify, |
218 | .suspend = at803x_suspend, | 321 | .set_wol = at803x_set_wol, |
219 | .resume = at803x_resume, | 322 | .get_wol = at803x_get_wol, |
220 | .features = PHY_GBIT_FEATURES, | 323 | .suspend = at803x_suspend, |
221 | .flags = PHY_HAS_INTERRUPT, | 324 | .resume = at803x_resume, |
222 | .config_aneg = genphy_config_aneg, | 325 | .features = PHY_GBIT_FEATURES, |
223 | .read_status = genphy_read_status, | 326 | .flags = PHY_HAS_INTERRUPT, |
224 | .driver = { | 327 | .config_aneg = genphy_config_aneg, |
328 | .read_status = genphy_read_status, | ||
329 | .driver = { | ||
225 | .owner = THIS_MODULE, | 330 | .owner = THIS_MODULE, |
226 | }, | 331 | }, |
227 | }, { | 332 | }, { |
228 | /* ATHEROS 8031 */ | 333 | /* ATHEROS 8031 */ |
229 | .phy_id = 0x004dd074, | 334 | .phy_id = ATH8031_PHY_ID, |
230 | .name = "Atheros 8031 ethernet", | 335 | .name = "Atheros 8031 ethernet", |
231 | .phy_id_mask = 0xffffffef, | 336 | .phy_id_mask = 0xffffffef, |
232 | .config_init = at803x_config_init, | 337 | .probe = at803x_probe, |
233 | .set_wol = at803x_set_wol, | 338 | .config_init = at803x_config_init, |
234 | .get_wol = at803x_get_wol, | 339 | .link_change_notify = at803x_link_change_notify, |
235 | .suspend = at803x_suspend, | 340 | .set_wol = at803x_set_wol, |
236 | .resume = at803x_resume, | 341 | .get_wol = at803x_get_wol, |
237 | .features = PHY_GBIT_FEATURES, | 342 | .suspend = at803x_suspend, |
238 | .flags = PHY_HAS_INTERRUPT, | 343 | .resume = at803x_resume, |
239 | .config_aneg = genphy_config_aneg, | 344 | .features = PHY_GBIT_FEATURES, |
240 | .read_status = genphy_read_status, | 345 | .flags = PHY_HAS_INTERRUPT, |
241 | .ack_interrupt = &at803x_ack_interrupt, | 346 | .config_aneg = genphy_config_aneg, |
242 | .config_intr = &at803x_config_intr, | 347 | .read_status = genphy_read_status, |
243 | .driver = { | 348 | .ack_interrupt = &at803x_ack_interrupt, |
349 | .config_intr = &at803x_config_intr, | ||
350 | .driver = { | ||
244 | .owner = THIS_MODULE, | 351 | .owner = THIS_MODULE, |
245 | }, | 352 | }, |
246 | } }; | 353 | } }; |
@@ -260,9 +367,9 @@ module_init(atheros_init); | |||
260 | module_exit(atheros_exit); | 367 | module_exit(atheros_exit); |
261 | 368 | ||
262 | static struct mdio_device_id __maybe_unused atheros_tbl[] = { | 369 | static struct mdio_device_id __maybe_unused atheros_tbl[] = { |
263 | { 0x004dd076, 0xffffffef }, | 370 | { ATH8030_PHY_ID, 0xffffffef }, |
264 | { 0x004dd074, 0xffffffef }, | 371 | { ATH8031_PHY_ID, 0xffffffef }, |
265 | { 0x004dd072, 0xffffffef }, | 372 | { ATH8035_PHY_ID, 0xffffffef }, |
266 | { } | 373 | { } |
267 | }; | 374 | }; |
268 | 375 | ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 3bc079a67a3d..f7c61812ea4a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -720,6 +720,9 @@ void phy_state_machine(struct work_struct *work) | |||
720 | 720 | ||
721 | mutex_lock(&phydev->lock); | 721 | mutex_lock(&phydev->lock); |
722 | 722 | ||
723 | if (phydev->drv->link_change_notify) | ||
724 | phydev->drv->link_change_notify(phydev); | ||
725 | |||
723 | switch (phydev->state) { | 726 | switch (phydev->state) { |
724 | case PHY_DOWN: | 727 | case PHY_DOWN: |
725 | case PHY_STARTING: | 728 | case PHY_STARTING: |
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c index ad4a94e9ff57..87526443841f 100644 --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c | |||
@@ -83,6 +83,7 @@ | |||
83 | #include <linux/delay.h> | 83 | #include <linux/delay.h> |
84 | #include <linux/init.h> | 84 | #include <linux/init.h> |
85 | #include <linux/slab.h> | 85 | #include <linux/slab.h> |
86 | #include <linux/workqueue.h> | ||
86 | #include "slip.h" | 87 | #include "slip.h" |
87 | #ifdef CONFIG_INET | 88 | #ifdef CONFIG_INET |
88 | #include <linux/ip.h> | 89 | #include <linux/ip.h> |
@@ -416,36 +417,46 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len) | |||
416 | #endif | 417 | #endif |
417 | } | 418 | } |
418 | 419 | ||
419 | /* | 420 | /* Write out any remaining transmit buffer. Scheduled when tty is writable */ |
420 | * Called by the driver when there's room for more data. If we have | 421 | static void slip_transmit(struct work_struct *work) |
421 | * more packets to send, we send them here. | ||
422 | */ | ||
423 | static void slip_write_wakeup(struct tty_struct *tty) | ||
424 | { | 422 | { |
423 | struct slip *sl = container_of(work, struct slip, tx_work); | ||
425 | int actual; | 424 | int actual; |
426 | struct slip *sl = tty->disc_data; | ||
427 | 425 | ||
426 | spin_lock_bh(&sl->lock); | ||
428 | /* First make sure we're connected. */ | 427 | /* First make sure we're connected. */ |
429 | if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) | 428 | if (!sl->tty || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) { |
429 | spin_unlock_bh(&sl->lock); | ||
430 | return; | 430 | return; |
431 | } | ||
431 | 432 | ||
432 | spin_lock_bh(&sl->lock); | ||
433 | if (sl->xleft <= 0) { | 433 | if (sl->xleft <= 0) { |
434 | /* Now serial buffer is almost free & we can start | 434 | /* Now serial buffer is almost free & we can start |
435 | * transmission of another packet */ | 435 | * transmission of another packet */ |
436 | sl->dev->stats.tx_packets++; | 436 | sl->dev->stats.tx_packets++; |
437 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 437 | clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); |
438 | spin_unlock_bh(&sl->lock); | 438 | spin_unlock_bh(&sl->lock); |
439 | sl_unlock(sl); | 439 | sl_unlock(sl); |
440 | return; | 440 | return; |
441 | } | 441 | } |
442 | 442 | ||
443 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); | 443 | actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft); |
444 | sl->xleft -= actual; | 444 | sl->xleft -= actual; |
445 | sl->xhead += actual; | 445 | sl->xhead += actual; |
446 | spin_unlock_bh(&sl->lock); | 446 | spin_unlock_bh(&sl->lock); |
447 | } | 447 | } |
448 | 448 | ||
449 | /* | ||
450 | * Called by the driver when there's room for more data. | ||
451 | * Schedule the transmit. | ||
452 | */ | ||
453 | static void slip_write_wakeup(struct tty_struct *tty) | ||
454 | { | ||
455 | struct slip *sl = tty->disc_data; | ||
456 | |||
457 | schedule_work(&sl->tx_work); | ||
458 | } | ||
459 | |||
449 | static void sl_tx_timeout(struct net_device *dev) | 460 | static void sl_tx_timeout(struct net_device *dev) |
450 | { | 461 | { |
451 | struct slip *sl = netdev_priv(dev); | 462 | struct slip *sl = netdev_priv(dev); |
@@ -749,6 +760,7 @@ static struct slip *sl_alloc(dev_t line) | |||
749 | sl->magic = SLIP_MAGIC; | 760 | sl->magic = SLIP_MAGIC; |
750 | sl->dev = dev; | 761 | sl->dev = dev; |
751 | spin_lock_init(&sl->lock); | 762 | spin_lock_init(&sl->lock); |
763 | INIT_WORK(&sl->tx_work, slip_transmit); | ||
752 | sl->mode = SL_MODE_DEFAULT; | 764 | sl->mode = SL_MODE_DEFAULT; |
753 | #ifdef CONFIG_SLIP_SMART | 765 | #ifdef CONFIG_SLIP_SMART |
754 | /* initialize timer_list struct */ | 766 | /* initialize timer_list struct */ |
@@ -872,8 +884,12 @@ static void slip_close(struct tty_struct *tty) | |||
872 | if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty) | 884 | if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty) |
873 | return; | 885 | return; |
874 | 886 | ||
887 | spin_lock_bh(&sl->lock); | ||
875 | tty->disc_data = NULL; | 888 | tty->disc_data = NULL; |
876 | sl->tty = NULL; | 889 | sl->tty = NULL; |
890 | spin_unlock_bh(&sl->lock); | ||
891 | |||
892 | flush_work(&sl->tx_work); | ||
877 | 893 | ||
878 | /* VSV = very important to remove timers */ | 894 | /* VSV = very important to remove timers */ |
879 | #ifdef CONFIG_SLIP_SMART | 895 | #ifdef CONFIG_SLIP_SMART |
diff --git a/drivers/net/slip/slip.h b/drivers/net/slip/slip.h index 67673cf1266b..cf32aadf508f 100644 --- a/drivers/net/slip/slip.h +++ b/drivers/net/slip/slip.h | |||
@@ -53,6 +53,7 @@ struct slip { | |||
53 | struct tty_struct *tty; /* ptr to TTY structure */ | 53 | struct tty_struct *tty; /* ptr to TTY structure */ |
54 | struct net_device *dev; /* easy for intr handling */ | 54 | struct net_device *dev; /* easy for intr handling */ |
55 | spinlock_t lock; | 55 | spinlock_t lock; |
56 | struct work_struct tx_work; /* Flushes transmit buffer */ | ||
56 | 57 | ||
57 | #ifdef SL_INCLUDE_CSLIP | 58 | #ifdef SL_INCLUDE_CSLIP |
58 | struct slcompress *slcomp; /* for header compression */ | 59 | struct slcompress *slcomp; /* for header compression */ |
diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c index f9822bc75425..5d95a13dbe2a 100644 --- a/drivers/net/usb/huawei_cdc_ncm.c +++ b/drivers/net/usb/huawei_cdc_ncm.c | |||
@@ -84,12 +84,13 @@ static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev, | |||
84 | ctx = drvstate->ctx; | 84 | ctx = drvstate->ctx; |
85 | 85 | ||
86 | if (usbnet_dev->status) | 86 | if (usbnet_dev->status) |
87 | /* CDC-WMC r1.1 requires wMaxCommand to be "at least 256 | 87 | /* The wMaxCommand buffer must be big enough to hold |
88 | * decimal (0x100)" | 88 | * any message from the modem. Experience has shown |
89 | * that some replies are more than 256 bytes long | ||
89 | */ | 90 | */ |
90 | subdriver = usb_cdc_wdm_register(ctx->control, | 91 | subdriver = usb_cdc_wdm_register(ctx->control, |
91 | &usbnet_dev->status->desc, | 92 | &usbnet_dev->status->desc, |
92 | 256, /* wMaxCommand */ | 93 | 1024, /* wMaxCommand */ |
93 | huawei_cdc_ncm_wdm_manage_power); | 94 | huawei_cdc_ncm_wdm_manage_power); |
94 | if (IS_ERR(subdriver)) { | 95 | if (IS_ERR(subdriver)) { |
95 | ret = PTR_ERR(subdriver); | 96 | ret = PTR_ERR(subdriver); |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 97394345e5dd..b76f7dcde0db 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -2589,8 +2589,8 @@ vmxnet3_open(struct net_device *netdev) | |||
2589 | for (i = 0; i < adapter->num_tx_queues; i++) | 2589 | for (i = 0; i < adapter->num_tx_queues; i++) |
2590 | spin_lock_init(&adapter->tx_queue[i].tx_lock); | 2590 | spin_lock_init(&adapter->tx_queue[i].tx_lock); |
2591 | 2591 | ||
2592 | err = vmxnet3_create_queues(adapter, VMXNET3_DEF_TX_RING_SIZE, | 2592 | err = vmxnet3_create_queues(adapter, adapter->tx_ring_size, |
2593 | VMXNET3_DEF_RX_RING_SIZE, | 2593 | adapter->rx_ring_size, |
2594 | VMXNET3_DEF_RX_RING_SIZE); | 2594 | VMXNET3_DEF_RX_RING_SIZE); |
2595 | if (err) | 2595 | if (err) |
2596 | goto queue_err; | 2596 | goto queue_err; |
@@ -2968,6 +2968,9 @@ vmxnet3_probe_device(struct pci_dev *pdev, | |||
2968 | adapter->netdev = netdev; | 2968 | adapter->netdev = netdev; |
2969 | adapter->pdev = pdev; | 2969 | adapter->pdev = pdev; |
2970 | 2970 | ||
2971 | adapter->tx_ring_size = VMXNET3_DEF_TX_RING_SIZE; | ||
2972 | adapter->rx_ring_size = VMXNET3_DEF_RX_RING_SIZE; | ||
2973 | |||
2971 | spin_lock_init(&adapter->cmd_lock); | 2974 | spin_lock_init(&adapter->cmd_lock); |
2972 | adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter, | 2975 | adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter, |
2973 | sizeof(struct vmxnet3_adapter), | 2976 | sizeof(struct vmxnet3_adapter), |
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index 40c1c7b0d9e0..b725fd9e7803 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c | |||
@@ -449,8 +449,8 @@ vmxnet3_get_ringparam(struct net_device *netdev, | |||
449 | param->rx_mini_max_pending = 0; | 449 | param->rx_mini_max_pending = 0; |
450 | param->rx_jumbo_max_pending = 0; | 450 | param->rx_jumbo_max_pending = 0; |
451 | 451 | ||
452 | param->rx_pending = adapter->rx_queue[0].rx_ring[0].size; | 452 | param->rx_pending = adapter->rx_ring_size; |
453 | param->tx_pending = adapter->tx_queue[0].tx_ring.size; | 453 | param->tx_pending = adapter->tx_ring_size; |
454 | param->rx_mini_pending = 0; | 454 | param->rx_mini_pending = 0; |
455 | param->rx_jumbo_pending = 0; | 455 | param->rx_jumbo_pending = 0; |
456 | } | 456 | } |
@@ -529,9 +529,11 @@ vmxnet3_set_ringparam(struct net_device *netdev, | |||
529 | * size */ | 529 | * size */ |
530 | netdev_err(netdev, "failed to apply new sizes, " | 530 | netdev_err(netdev, "failed to apply new sizes, " |
531 | "try the default ones\n"); | 531 | "try the default ones\n"); |
532 | new_rx_ring_size = VMXNET3_DEF_RX_RING_SIZE; | ||
533 | new_tx_ring_size = VMXNET3_DEF_TX_RING_SIZE; | ||
532 | err = vmxnet3_create_queues(adapter, | 534 | err = vmxnet3_create_queues(adapter, |
533 | VMXNET3_DEF_TX_RING_SIZE, | 535 | new_tx_ring_size, |
534 | VMXNET3_DEF_RX_RING_SIZE, | 536 | new_rx_ring_size, |
535 | VMXNET3_DEF_RX_RING_SIZE); | 537 | VMXNET3_DEF_RX_RING_SIZE); |
536 | if (err) { | 538 | if (err) { |
537 | netdev_err(netdev, "failed to create queues " | 539 | netdev_err(netdev, "failed to create queues " |
@@ -545,6 +547,8 @@ vmxnet3_set_ringparam(struct net_device *netdev, | |||
545 | netdev_err(netdev, "failed to re-activate, error %d." | 547 | netdev_err(netdev, "failed to re-activate, error %d." |
546 | " Closing it\n", err); | 548 | " Closing it\n", err); |
547 | } | 549 | } |
550 | adapter->tx_ring_size = new_tx_ring_size; | ||
551 | adapter->rx_ring_size = new_rx_ring_size; | ||
548 | 552 | ||
549 | out: | 553 | out: |
550 | clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); | 554 | clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); |
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index 190569d02450..29ee77f2c97f 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -349,6 +349,11 @@ struct vmxnet3_adapter { | |||
349 | u32 link_speed; /* in mbps */ | 349 | u32 link_speed; /* in mbps */ |
350 | 350 | ||
351 | u64 tx_timeout_count; | 351 | u64 tx_timeout_count; |
352 | |||
353 | /* Ring sizes */ | ||
354 | u32 tx_ring_size; | ||
355 | u32 rx_ring_size; | ||
356 | |||
352 | struct work_struct work; | 357 | struct work_struct work; |
353 | 358 | ||
354 | unsigned long state; /* VMXNET3_STATE_BIT_xxx */ | 359 | unsigned long state; /* VMXNET3_STATE_BIT_xxx */ |
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index e3f67b8d3f80..40fd9b7b1426 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -36,7 +36,7 @@ config B43_SSB | |||
36 | choice | 36 | choice |
37 | prompt "Supported bus types" | 37 | prompt "Supported bus types" |
38 | depends on B43 | 38 | depends on B43 |
39 | default B43_BCMA_AND_SSB | 39 | default B43_BUSES_BCMA_AND_SSB |
40 | 40 | ||
41 | config B43_BUSES_BCMA_AND_SSB | 41 | config B43_BUSES_BCMA_AND_SSB |
42 | bool "BCMA and SSB" | 42 | bool "BCMA and SSB" |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 32538ac5f7e4..0d6a0bb1f876 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -5221,6 +5221,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
5221 | /* We don't support 5 GHz on some PHYs yet */ | 5221 | /* We don't support 5 GHz on some PHYs yet */ |
5222 | switch (dev->phy.type) { | 5222 | switch (dev->phy.type) { |
5223 | case B43_PHYTYPE_A: | 5223 | case B43_PHYTYPE_A: |
5224 | case B43_PHYTYPE_G: | ||
5224 | case B43_PHYTYPE_N: | 5225 | case B43_PHYTYPE_N: |
5225 | case B43_PHYTYPE_LP: | 5226 | case B43_PHYTYPE_LP: |
5226 | case B43_PHYTYPE_HT: | 5227 | case B43_PHYTYPE_HT: |
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 4f38f19b8e3d..6e6ef3fc2247 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -811,9 +811,13 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
811 | break; | 811 | break; |
812 | case B43_PHYTYPE_G: | 812 | case B43_PHYTYPE_G: |
813 | status.band = IEEE80211_BAND_2GHZ; | 813 | status.band = IEEE80211_BAND_2GHZ; |
814 | /* chanid is the radio channel cookie value as used | 814 | /* Somewhere between 478.104 and 508.1084 firmware for G-PHY |
815 | * to tune the radio. */ | 815 | * has been modified to be compatible with N-PHY and others. |
816 | status.freq = chanid + 2400; | 816 | */ |
817 | if (dev->fw.rev >= 508) | ||
818 | status.freq = ieee80211_channel_to_frequency(chanid, status.band); | ||
819 | else | ||
820 | status.freq = chanid + 2400; | ||
817 | break; | 821 | break; |
818 | case B43_PHYTYPE_N: | 822 | case B43_PHYTYPE_N: |
819 | case B43_PHYTYPE_LP: | 823 | case B43_PHYTYPE_LP: |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 574d4b597468..2cc9b6fca490 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -50,7 +50,7 @@ mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb, | |||
50 | return -1; | 50 | return -1; |
51 | } | 51 | } |
52 | mapping.len = size; | 52 | mapping.len = size; |
53 | memcpy(skb->cb, &mapping, sizeof(mapping)); | 53 | mwifiex_store_mapping(skb, &mapping); |
54 | return 0; | 54 | return 0; |
55 | } | 55 | } |
56 | 56 | ||
@@ -60,7 +60,7 @@ static void mwifiex_unmap_pci_memory(struct mwifiex_adapter *adapter, | |||
60 | struct pcie_service_card *card = adapter->card; | 60 | struct pcie_service_card *card = adapter->card; |
61 | struct mwifiex_dma_mapping mapping; | 61 | struct mwifiex_dma_mapping mapping; |
62 | 62 | ||
63 | MWIFIEX_SKB_PACB(skb, &mapping); | 63 | mwifiex_get_mapping(skb, &mapping); |
64 | pci_unmap_single(card->dev, mapping.addr, mapping.len, flags); | 64 | pci_unmap_single(card->dev, mapping.addr, mapping.len, flags); |
65 | } | 65 | } |
66 | 66 | ||
diff --git a/drivers/net/wireless/mwifiex/util.h b/drivers/net/wireless/mwifiex/util.h index ddae57021397..caadb3737b9e 100644 --- a/drivers/net/wireless/mwifiex/util.h +++ b/drivers/net/wireless/mwifiex/util.h | |||
@@ -20,32 +20,55 @@ | |||
20 | #ifndef _MWIFIEX_UTIL_H_ | 20 | #ifndef _MWIFIEX_UTIL_H_ |
21 | #define _MWIFIEX_UTIL_H_ | 21 | #define _MWIFIEX_UTIL_H_ |
22 | 22 | ||
23 | struct mwifiex_dma_mapping { | ||
24 | dma_addr_t addr; | ||
25 | size_t len; | ||
26 | }; | ||
27 | |||
28 | struct mwifiex_cb { | ||
29 | struct mwifiex_dma_mapping dma_mapping; | ||
30 | union { | ||
31 | struct mwifiex_rxinfo rx_info; | ||
32 | struct mwifiex_txinfo tx_info; | ||
33 | }; | ||
34 | }; | ||
35 | |||
23 | static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) | 36 | static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) |
24 | { | 37 | { |
25 | return (struct mwifiex_rxinfo *)(skb->cb + sizeof(dma_addr_t)); | 38 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
39 | |||
40 | BUILD_BUG_ON(sizeof(struct mwifiex_cb) > sizeof(skb->cb)); | ||
41 | return &cb->rx_info; | ||
26 | } | 42 | } |
27 | 43 | ||
28 | static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) | 44 | static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) |
29 | { | 45 | { |
30 | return (struct mwifiex_txinfo *)(skb->cb + sizeof(dma_addr_t)); | 46 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
47 | |||
48 | return &cb->tx_info; | ||
31 | } | 49 | } |
32 | 50 | ||
33 | struct mwifiex_dma_mapping { | 51 | static inline void mwifiex_store_mapping(struct sk_buff *skb, |
34 | dma_addr_t addr; | 52 | struct mwifiex_dma_mapping *mapping) |
35 | size_t len; | 53 | { |
36 | }; | 54 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
55 | |||
56 | memcpy(&cb->dma_mapping, mapping, sizeof(*mapping)); | ||
57 | } | ||
37 | 58 | ||
38 | static inline void MWIFIEX_SKB_PACB(struct sk_buff *skb, | 59 | static inline void mwifiex_get_mapping(struct sk_buff *skb, |
39 | struct mwifiex_dma_mapping *mapping) | 60 | struct mwifiex_dma_mapping *mapping) |
40 | { | 61 | { |
41 | memcpy(mapping, skb->cb, sizeof(*mapping)); | 62 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
63 | |||
64 | memcpy(mapping, &cb->dma_mapping, sizeof(*mapping)); | ||
42 | } | 65 | } |
43 | 66 | ||
44 | static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb) | 67 | static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb) |
45 | { | 68 | { |
46 | struct mwifiex_dma_mapping mapping; | 69 | struct mwifiex_dma_mapping mapping; |
47 | 70 | ||
48 | MWIFIEX_SKB_PACB(skb, &mapping); | 71 | mwifiex_get_mapping(skb, &mapping); |
49 | 72 | ||
50 | return mapping.addr; | 73 | return mapping.addr; |
51 | } | 74 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 2f1cd929c6f6..a511cccc9f01 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1681,8 +1681,13 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1681 | /* | 1681 | /* |
1682 | * Detect if this device has an hardware controlled radio. | 1682 | * Detect if this device has an hardware controlled radio. |
1683 | */ | 1683 | */ |
1684 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 1684 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) { |
1685 | __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); | 1685 | __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); |
1686 | /* | ||
1687 | * On this device RFKILL initialized during probe does not work. | ||
1688 | */ | ||
1689 | __set_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags); | ||
1690 | } | ||
1686 | 1691 | ||
1687 | /* | 1692 | /* |
1688 | * Check if the BBP tuning should be enabled. | 1693 | * Check if the BBP tuning should be enabled. |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index a49c3d73ea2c..e11dab2216c6 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -229,6 +229,27 @@ static enum hrtimer_restart rt2800usb_tx_sta_fifo_timeout(struct hrtimer *timer) | |||
229 | /* | 229 | /* |
230 | * Firmware functions | 230 | * Firmware functions |
231 | */ | 231 | */ |
232 | static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) | ||
233 | { | ||
234 | __le32 reg; | ||
235 | u32 fw_mode; | ||
236 | |||
237 | /* cannot use rt2x00usb_register_read here as it uses different | ||
238 | * mode (MULTI_READ vs. DEVICE_MODE) and does not pass the | ||
239 | * magic value USB_MODE_AUTORUN (0x11) to the device, thus the | ||
240 | * returned value would be invalid. | ||
241 | */ | ||
242 | rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE, | ||
243 | USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN, | ||
244 | ®, sizeof(reg), REGISTER_TIMEOUT_FIRMWARE); | ||
245 | fw_mode = le32_to_cpu(reg); | ||
246 | |||
247 | if ((fw_mode & 0x00000003) == 2) | ||
248 | return 1; | ||
249 | |||
250 | return 0; | ||
251 | } | ||
252 | |||
232 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 253 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
233 | { | 254 | { |
234 | return FIRMWARE_RT2870; | 255 | return FIRMWARE_RT2870; |
@@ -257,8 +278,13 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
257 | /* | 278 | /* |
258 | * Write firmware to device. | 279 | * Write firmware to device. |
259 | */ | 280 | */ |
260 | rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, | 281 | if (rt2800usb_autorun_detect(rt2x00dev)) { |
261 | data + offset, length); | 282 | rt2x00_info(rt2x00dev, |
283 | "Firmware loading not required - NIC in AutoRun mode\n"); | ||
284 | } else { | ||
285 | rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, | ||
286 | data + offset, length); | ||
287 | } | ||
262 | 288 | ||
263 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); | 289 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); |
264 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); | 290 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); |
@@ -735,11 +761,18 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
735 | /* | 761 | /* |
736 | * Device probe functions. | 762 | * Device probe functions. |
737 | */ | 763 | */ |
764 | static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev) | ||
765 | { | ||
766 | if (rt2800usb_autorun_detect(rt2x00dev)) | ||
767 | return 1; | ||
768 | return rt2800_efuse_detect(rt2x00dev); | ||
769 | } | ||
770 | |||
738 | static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) | 771 | static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) |
739 | { | 772 | { |
740 | int retval; | 773 | int retval; |
741 | 774 | ||
742 | if (rt2800_efuse_detect(rt2x00dev)) | 775 | if (rt2800usb_efuse_detect(rt2x00dev)) |
743 | retval = rt2800_read_eeprom_efuse(rt2x00dev); | 776 | retval = rt2800_read_eeprom_efuse(rt2x00dev); |
744 | else | 777 | else |
745 | retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, | 778 | retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 010b76505243..d13f25cd70d5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -693,6 +693,7 @@ enum rt2x00_capability_flags { | |||
693 | REQUIRE_SW_SEQNO, | 693 | REQUIRE_SW_SEQNO, |
694 | REQUIRE_HT_TX_DESC, | 694 | REQUIRE_HT_TX_DESC, |
695 | REQUIRE_PS_AUTOWAKE, | 695 | REQUIRE_PS_AUTOWAKE, |
696 | REQUIRE_DELAYED_RFKILL, | ||
696 | 697 | ||
697 | /* | 698 | /* |
698 | * Capabilities | 699 | * Capabilities |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 2bde6729f5e6..4fa43a2eeb73 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -1126,9 +1126,10 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
1126 | return; | 1126 | return; |
1127 | 1127 | ||
1128 | /* | 1128 | /* |
1129 | * Unregister extra components. | 1129 | * Stop rfkill polling. |
1130 | */ | 1130 | */ |
1131 | rt2x00rfkill_unregister(rt2x00dev); | 1131 | if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) |
1132 | rt2x00rfkill_unregister(rt2x00dev); | ||
1132 | 1133 | ||
1133 | /* | 1134 | /* |
1134 | * Allow the HW to uninitialize. | 1135 | * Allow the HW to uninitialize. |
@@ -1166,6 +1167,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
1166 | 1167 | ||
1167 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); | 1168 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); |
1168 | 1169 | ||
1170 | /* | ||
1171 | * Start rfkill polling. | ||
1172 | */ | ||
1173 | if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
1174 | rt2x00rfkill_register(rt2x00dev); | ||
1175 | |||
1169 | return 0; | 1176 | return 0; |
1170 | } | 1177 | } |
1171 | 1178 | ||
@@ -1375,7 +1382,12 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1375 | rt2x00link_register(rt2x00dev); | 1382 | rt2x00link_register(rt2x00dev); |
1376 | rt2x00leds_register(rt2x00dev); | 1383 | rt2x00leds_register(rt2x00dev); |
1377 | rt2x00debug_register(rt2x00dev); | 1384 | rt2x00debug_register(rt2x00dev); |
1378 | rt2x00rfkill_register(rt2x00dev); | 1385 | |
1386 | /* | ||
1387 | * Start rfkill polling. | ||
1388 | */ | ||
1389 | if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
1390 | rt2x00rfkill_register(rt2x00dev); | ||
1379 | 1391 | ||
1380 | return 0; | 1392 | return 0; |
1381 | 1393 | ||
@@ -1391,6 +1403,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
1391 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | 1403 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); |
1392 | 1404 | ||
1393 | /* | 1405 | /* |
1406 | * Stop rfkill polling. | ||
1407 | */ | ||
1408 | if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
1409 | rt2x00rfkill_unregister(rt2x00dev); | ||
1410 | |||
1411 | /* | ||
1394 | * Disable radio. | 1412 | * Disable radio. |
1395 | */ | 1413 | */ |
1396 | rt2x00lib_disable_radio(rt2x00dev); | 1414 | rt2x00lib_disable_radio(rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 212ac4842c16..004dff9b962d 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -487,6 +487,8 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
487 | crypto.cipher = rt2x00crypto_key_to_cipher(key); | 487 | crypto.cipher = rt2x00crypto_key_to_cipher(key); |
488 | if (crypto.cipher == CIPHER_NONE) | 488 | if (crypto.cipher == CIPHER_NONE) |
489 | return -EOPNOTSUPP; | 489 | return -EOPNOTSUPP; |
490 | if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev)) | ||
491 | return -EOPNOTSUPP; | ||
490 | 492 | ||
491 | crypto.cmd = cmd; | 493 | crypto.cmd = cmd; |
492 | 494 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index e7bcf62347d5..831b65f93feb 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -93,6 +93,7 @@ enum rt2x00usb_mode_offset { | |||
93 | USB_MODE_SLEEP = 7, /* RT73USB */ | 93 | USB_MODE_SLEEP = 7, /* RT73USB */ |
94 | USB_MODE_FIRMWARE = 8, /* RT73USB */ | 94 | USB_MODE_FIRMWARE = 8, /* RT73USB */ |
95 | USB_MODE_WAKEUP = 9, /* RT73USB */ | 95 | USB_MODE_WAKEUP = 9, /* RT73USB */ |
96 | USB_MODE_AUTORUN = 17, /* RT2800USB */ | ||
96 | }; | 97 | }; |
97 | 98 | ||
98 | /** | 99 | /** |
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index 4dd7c4a1923b..2532ce85d718 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h | |||
@@ -222,6 +222,7 @@ struct xenvif { | |||
222 | 222 | ||
223 | /* Queues */ | 223 | /* Queues */ |
224 | struct xenvif_queue *queues; | 224 | struct xenvif_queue *queues; |
225 | unsigned int num_queues; /* active queues, resource allocated */ | ||
225 | 226 | ||
226 | /* Miscellaneous private stuff. */ | 227 | /* Miscellaneous private stuff. */ |
227 | struct net_device *dev; | 228 | struct net_device *dev; |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 852da34b8961..9e97c7ca0ddd 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
@@ -137,32 +137,11 @@ static void xenvif_wake_queue_callback(unsigned long data) | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb, | ||
141 | void *accel_priv, select_queue_fallback_t fallback) | ||
142 | { | ||
143 | unsigned int num_queues = dev->real_num_tx_queues; | ||
144 | u32 hash; | ||
145 | u16 queue_index; | ||
146 | |||
147 | /* First, check if there is only one queue to optimise the | ||
148 | * single-queue or old frontend scenario. | ||
149 | */ | ||
150 | if (num_queues == 1) { | ||
151 | queue_index = 0; | ||
152 | } else { | ||
153 | /* Use skb_get_hash to obtain an L4 hash if available */ | ||
154 | hash = skb_get_hash(skb); | ||
155 | queue_index = hash % num_queues; | ||
156 | } | ||
157 | |||
158 | return queue_index; | ||
159 | } | ||
160 | |||
161 | static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) | 140 | static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) |
162 | { | 141 | { |
163 | struct xenvif *vif = netdev_priv(dev); | 142 | struct xenvif *vif = netdev_priv(dev); |
164 | struct xenvif_queue *queue = NULL; | 143 | struct xenvif_queue *queue = NULL; |
165 | unsigned int num_queues = dev->real_num_tx_queues; | 144 | unsigned int num_queues = vif->num_queues; |
166 | u16 index; | 145 | u16 index; |
167 | int min_slots_needed; | 146 | int min_slots_needed; |
168 | 147 | ||
@@ -225,7 +204,7 @@ static struct net_device_stats *xenvif_get_stats(struct net_device *dev) | |||
225 | { | 204 | { |
226 | struct xenvif *vif = netdev_priv(dev); | 205 | struct xenvif *vif = netdev_priv(dev); |
227 | struct xenvif_queue *queue = NULL; | 206 | struct xenvif_queue *queue = NULL; |
228 | unsigned int num_queues = dev->real_num_tx_queues; | 207 | unsigned int num_queues = vif->num_queues; |
229 | unsigned long rx_bytes = 0; | 208 | unsigned long rx_bytes = 0; |
230 | unsigned long rx_packets = 0; | 209 | unsigned long rx_packets = 0; |
231 | unsigned long tx_bytes = 0; | 210 | unsigned long tx_bytes = 0; |
@@ -256,7 +235,7 @@ out: | |||
256 | static void xenvif_up(struct xenvif *vif) | 235 | static void xenvif_up(struct xenvif *vif) |
257 | { | 236 | { |
258 | struct xenvif_queue *queue = NULL; | 237 | struct xenvif_queue *queue = NULL; |
259 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 238 | unsigned int num_queues = vif->num_queues; |
260 | unsigned int queue_index; | 239 | unsigned int queue_index; |
261 | 240 | ||
262 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { | 241 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { |
@@ -272,7 +251,7 @@ static void xenvif_up(struct xenvif *vif) | |||
272 | static void xenvif_down(struct xenvif *vif) | 251 | static void xenvif_down(struct xenvif *vif) |
273 | { | 252 | { |
274 | struct xenvif_queue *queue = NULL; | 253 | struct xenvif_queue *queue = NULL; |
275 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 254 | unsigned int num_queues = vif->num_queues; |
276 | unsigned int queue_index; | 255 | unsigned int queue_index; |
277 | 256 | ||
278 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { | 257 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { |
@@ -379,7 +358,7 @@ static void xenvif_get_ethtool_stats(struct net_device *dev, | |||
379 | struct ethtool_stats *stats, u64 * data) | 358 | struct ethtool_stats *stats, u64 * data) |
380 | { | 359 | { |
381 | struct xenvif *vif = netdev_priv(dev); | 360 | struct xenvif *vif = netdev_priv(dev); |
382 | unsigned int num_queues = dev->real_num_tx_queues; | 361 | unsigned int num_queues = vif->num_queues; |
383 | int i; | 362 | int i; |
384 | unsigned int queue_index; | 363 | unsigned int queue_index; |
385 | struct xenvif_stats *vif_stats; | 364 | struct xenvif_stats *vif_stats; |
@@ -424,7 +403,6 @@ static const struct net_device_ops xenvif_netdev_ops = { | |||
424 | .ndo_fix_features = xenvif_fix_features, | 403 | .ndo_fix_features = xenvif_fix_features, |
425 | .ndo_set_mac_address = eth_mac_addr, | 404 | .ndo_set_mac_address = eth_mac_addr, |
426 | .ndo_validate_addr = eth_validate_addr, | 405 | .ndo_validate_addr = eth_validate_addr, |
427 | .ndo_select_queue = xenvif_select_queue, | ||
428 | }; | 406 | }; |
429 | 407 | ||
430 | struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | 408 | struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, |
@@ -438,7 +416,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
438 | snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle); | 416 | snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle); |
439 | /* Allocate a netdev with the max. supported number of queues. | 417 | /* Allocate a netdev with the max. supported number of queues. |
440 | * When the guest selects the desired number, it will be updated | 418 | * When the guest selects the desired number, it will be updated |
441 | * via netif_set_real_num_tx_queues(). | 419 | * via netif_set_real_num_*_queues(). |
442 | */ | 420 | */ |
443 | dev = alloc_netdev_mq(sizeof(struct xenvif), name, ether_setup, | 421 | dev = alloc_netdev_mq(sizeof(struct xenvif), name, ether_setup, |
444 | xenvif_max_queues); | 422 | xenvif_max_queues); |
@@ -458,11 +436,9 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
458 | vif->dev = dev; | 436 | vif->dev = dev; |
459 | vif->disabled = false; | 437 | vif->disabled = false; |
460 | 438 | ||
461 | /* Start out with no queues. The call below does not require | 439 | /* Start out with no queues. */ |
462 | * rtnl_lock() as it happens before register_netdev(). | ||
463 | */ | ||
464 | vif->queues = NULL; | 440 | vif->queues = NULL; |
465 | netif_set_real_num_tx_queues(dev, 0); | 441 | vif->num_queues = 0; |
466 | 442 | ||
467 | dev->netdev_ops = &xenvif_netdev_ops; | 443 | dev->netdev_ops = &xenvif_netdev_ops; |
468 | dev->hw_features = NETIF_F_SG | | 444 | dev->hw_features = NETIF_F_SG | |
@@ -677,7 +653,7 @@ static void xenvif_wait_unmap_timeout(struct xenvif_queue *queue, | |||
677 | void xenvif_disconnect(struct xenvif *vif) | 653 | void xenvif_disconnect(struct xenvif *vif) |
678 | { | 654 | { |
679 | struct xenvif_queue *queue = NULL; | 655 | struct xenvif_queue *queue = NULL; |
680 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 656 | unsigned int num_queues = vif->num_queues; |
681 | unsigned int queue_index; | 657 | unsigned int queue_index; |
682 | 658 | ||
683 | if (netif_carrier_ok(vif->dev)) | 659 | if (netif_carrier_ok(vif->dev)) |
@@ -724,7 +700,7 @@ void xenvif_deinit_queue(struct xenvif_queue *queue) | |||
724 | void xenvif_free(struct xenvif *vif) | 700 | void xenvif_free(struct xenvif *vif) |
725 | { | 701 | { |
726 | struct xenvif_queue *queue = NULL; | 702 | struct xenvif_queue *queue = NULL; |
727 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 703 | unsigned int num_queues = vif->num_queues; |
728 | unsigned int queue_index; | 704 | unsigned int queue_index; |
729 | /* Here we want to avoid timeout messages if an skb can be legitimately | 705 | /* Here we want to avoid timeout messages if an skb can be legitimately |
730 | * stuck somewhere else. Realistically this could be an another vif's | 706 | * stuck somewhere else. Realistically this could be an another vif's |
@@ -748,12 +724,9 @@ void xenvif_free(struct xenvif *vif) | |||
748 | xenvif_deinit_queue(queue); | 724 | xenvif_deinit_queue(queue); |
749 | } | 725 | } |
750 | 726 | ||
751 | /* Free the array of queues. The call below does not require | ||
752 | * rtnl_lock() because it happens after unregister_netdev(). | ||
753 | */ | ||
754 | netif_set_real_num_tx_queues(vif->dev, 0); | ||
755 | vfree(vif->queues); | 727 | vfree(vif->queues); |
756 | vif->queues = NULL; | 728 | vif->queues = NULL; |
729 | vif->num_queues = 0; | ||
757 | 730 | ||
758 | free_netdev(vif->dev); | 731 | free_netdev(vif->dev); |
759 | 732 | ||
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 96c63dc2509e..3d85acd84bad 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -527,9 +527,7 @@ static void connect(struct backend_info *be) | |||
527 | /* Use the number of queues requested by the frontend */ | 527 | /* Use the number of queues requested by the frontend */ |
528 | be->vif->queues = vzalloc(requested_num_queues * | 528 | be->vif->queues = vzalloc(requested_num_queues * |
529 | sizeof(struct xenvif_queue)); | 529 | sizeof(struct xenvif_queue)); |
530 | rtnl_lock(); | 530 | be->vif->num_queues = requested_num_queues; |
531 | netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues); | ||
532 | rtnl_unlock(); | ||
533 | 531 | ||
534 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { | 532 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { |
535 | queue = &be->vif->queues[queue_index]; | 533 | queue = &be->vif->queues[queue_index]; |
@@ -546,9 +544,7 @@ static void connect(struct backend_info *be) | |||
546 | * earlier queues can be destroyed using the regular | 544 | * earlier queues can be destroyed using the regular |
547 | * disconnect logic. | 545 | * disconnect logic. |
548 | */ | 546 | */ |
549 | rtnl_lock(); | 547 | be->vif->num_queues = queue_index; |
550 | netif_set_real_num_tx_queues(be->vif->dev, queue_index); | ||
551 | rtnl_unlock(); | ||
552 | goto err; | 548 | goto err; |
553 | } | 549 | } |
554 | 550 | ||
@@ -561,13 +557,19 @@ static void connect(struct backend_info *be) | |||
561 | * and also clean up any previously initialised queues. | 557 | * and also clean up any previously initialised queues. |
562 | */ | 558 | */ |
563 | xenvif_deinit_queue(queue); | 559 | xenvif_deinit_queue(queue); |
564 | rtnl_lock(); | 560 | be->vif->num_queues = queue_index; |
565 | netif_set_real_num_tx_queues(be->vif->dev, queue_index); | ||
566 | rtnl_unlock(); | ||
567 | goto err; | 561 | goto err; |
568 | } | 562 | } |
569 | } | 563 | } |
570 | 564 | ||
565 | /* Initialisation completed, tell core driver the number of | ||
566 | * active queues. | ||
567 | */ | ||
568 | rtnl_lock(); | ||
569 | netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues); | ||
570 | netif_set_real_num_rx_queues(be->vif->dev, requested_num_queues); | ||
571 | rtnl_unlock(); | ||
572 | |||
571 | xenvif_carrier_on(be->vif); | 573 | xenvif_carrier_on(be->vif); |
572 | 574 | ||
573 | unregister_hotplug_status_watch(be); | 575 | unregister_hotplug_status_watch(be); |
@@ -582,13 +584,11 @@ static void connect(struct backend_info *be) | |||
582 | return; | 584 | return; |
583 | 585 | ||
584 | err: | 586 | err: |
585 | if (be->vif->dev->real_num_tx_queues > 0) | 587 | if (be->vif->num_queues > 0) |
586 | xenvif_disconnect(be->vif); /* Clean up existing queues */ | 588 | xenvif_disconnect(be->vif); /* Clean up existing queues */ |
587 | vfree(be->vif->queues); | 589 | vfree(be->vif->queues); |
588 | be->vif->queues = NULL; | 590 | be->vif->queues = NULL; |
589 | rtnl_lock(); | 591 | be->vif->num_queues = 0; |
590 | netif_set_real_num_tx_queues(be->vif->dev, 0); | ||
591 | rtnl_unlock(); | ||
592 | return; | 592 | return; |
593 | } | 593 | } |
594 | 594 | ||
@@ -596,7 +596,7 @@ err: | |||
596 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue) | 596 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue) |
597 | { | 597 | { |
598 | struct xenbus_device *dev = be->dev; | 598 | struct xenbus_device *dev = be->dev; |
599 | unsigned int num_queues = queue->vif->dev->real_num_tx_queues; | 599 | unsigned int num_queues = queue->vif->num_queues; |
600 | unsigned long tx_ring_ref, rx_ring_ref; | 600 | unsigned long tx_ring_ref, rx_ring_ref; |
601 | unsigned int tx_evtchn, rx_evtchn; | 601 | unsigned int tx_evtchn, rx_evtchn; |
602 | int err; | 602 | int err; |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 5a7872ac3566..2ccb4a02368b 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -1287,7 +1287,7 @@ static irqreturn_t xennet_rx_interrupt(int irq, void *dev_id) | |||
1287 | 1287 | ||
1288 | if (likely(netif_carrier_ok(dev) && | 1288 | if (likely(netif_carrier_ok(dev) && |
1289 | RING_HAS_UNCONSUMED_RESPONSES(&queue->rx))) | 1289 | RING_HAS_UNCONSUMED_RESPONSES(&queue->rx))) |
1290 | napi_schedule(&queue->napi); | 1290 | napi_schedule(&queue->napi); |
1291 | 1291 | ||
1292 | return IRQ_HANDLED; | 1292 | return IRQ_HANDLED; |
1293 | } | 1293 | } |
@@ -1437,10 +1437,11 @@ static void xennet_end_access(int ref, void *page) | |||
1437 | static void xennet_disconnect_backend(struct netfront_info *info) | 1437 | static void xennet_disconnect_backend(struct netfront_info *info) |
1438 | { | 1438 | { |
1439 | unsigned int i = 0; | 1439 | unsigned int i = 0; |
1440 | struct netfront_queue *queue = NULL; | ||
1441 | unsigned int num_queues = info->netdev->real_num_tx_queues; | 1440 | unsigned int num_queues = info->netdev->real_num_tx_queues; |
1442 | 1441 | ||
1443 | for (i = 0; i < num_queues; ++i) { | 1442 | for (i = 0; i < num_queues; ++i) { |
1443 | struct netfront_queue *queue = &info->queues[i]; | ||
1444 | |||
1444 | /* Stop old i/f to prevent errors whilst we rebuild the state. */ | 1445 | /* Stop old i/f to prevent errors whilst we rebuild the state. */ |
1445 | spin_lock_bh(&queue->rx_lock); | 1446 | spin_lock_bh(&queue->rx_lock); |
1446 | spin_lock_irq(&queue->tx_lock); | 1447 | spin_lock_irq(&queue->tx_lock); |
@@ -1698,8 +1699,6 @@ static int xennet_init_queue(struct netfront_queue *queue) | |||
1698 | goto exit_free_tx; | 1699 | goto exit_free_tx; |
1699 | } | 1700 | } |
1700 | 1701 | ||
1701 | netif_napi_add(queue->info->netdev, &queue->napi, xennet_poll, 64); | ||
1702 | |||
1703 | return 0; | 1702 | return 0; |
1704 | 1703 | ||
1705 | exit_free_tx: | 1704 | exit_free_tx: |
@@ -1790,6 +1789,70 @@ error: | |||
1790 | return err; | 1789 | return err; |
1791 | } | 1790 | } |
1792 | 1791 | ||
1792 | static void xennet_destroy_queues(struct netfront_info *info) | ||
1793 | { | ||
1794 | unsigned int i; | ||
1795 | |||
1796 | rtnl_lock(); | ||
1797 | |||
1798 | for (i = 0; i < info->netdev->real_num_tx_queues; i++) { | ||
1799 | struct netfront_queue *queue = &info->queues[i]; | ||
1800 | |||
1801 | if (netif_running(info->netdev)) | ||
1802 | napi_disable(&queue->napi); | ||
1803 | netif_napi_del(&queue->napi); | ||
1804 | } | ||
1805 | |||
1806 | rtnl_unlock(); | ||
1807 | |||
1808 | kfree(info->queues); | ||
1809 | info->queues = NULL; | ||
1810 | } | ||
1811 | |||
1812 | static int xennet_create_queues(struct netfront_info *info, | ||
1813 | unsigned int num_queues) | ||
1814 | { | ||
1815 | unsigned int i; | ||
1816 | int ret; | ||
1817 | |||
1818 | info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), | ||
1819 | GFP_KERNEL); | ||
1820 | if (!info->queues) | ||
1821 | return -ENOMEM; | ||
1822 | |||
1823 | rtnl_lock(); | ||
1824 | |||
1825 | for (i = 0; i < num_queues; i++) { | ||
1826 | struct netfront_queue *queue = &info->queues[i]; | ||
1827 | |||
1828 | queue->id = i; | ||
1829 | queue->info = info; | ||
1830 | |||
1831 | ret = xennet_init_queue(queue); | ||
1832 | if (ret < 0) { | ||
1833 | dev_warn(&info->netdev->dev, "only created %d queues\n", | ||
1834 | num_queues); | ||
1835 | num_queues = i; | ||
1836 | break; | ||
1837 | } | ||
1838 | |||
1839 | netif_napi_add(queue->info->netdev, &queue->napi, | ||
1840 | xennet_poll, 64); | ||
1841 | if (netif_running(info->netdev)) | ||
1842 | napi_enable(&queue->napi); | ||
1843 | } | ||
1844 | |||
1845 | netif_set_real_num_tx_queues(info->netdev, num_queues); | ||
1846 | |||
1847 | rtnl_unlock(); | ||
1848 | |||
1849 | if (num_queues == 0) { | ||
1850 | dev_err(&info->netdev->dev, "no queues\n"); | ||
1851 | return -EINVAL; | ||
1852 | } | ||
1853 | return 0; | ||
1854 | } | ||
1855 | |||
1793 | /* Common code used when first setting up, and when resuming. */ | 1856 | /* Common code used when first setting up, and when resuming. */ |
1794 | static int talk_to_netback(struct xenbus_device *dev, | 1857 | static int talk_to_netback(struct xenbus_device *dev, |
1795 | struct netfront_info *info) | 1858 | struct netfront_info *info) |
@@ -1826,42 +1889,20 @@ static int talk_to_netback(struct xenbus_device *dev, | |||
1826 | goto out; | 1889 | goto out; |
1827 | } | 1890 | } |
1828 | 1891 | ||
1829 | /* Allocate array of queues */ | 1892 | if (info->queues) |
1830 | info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), GFP_KERNEL); | 1893 | xennet_destroy_queues(info); |
1831 | if (!info->queues) { | 1894 | |
1832 | err = -ENOMEM; | 1895 | err = xennet_create_queues(info, num_queues); |
1833 | goto out; | 1896 | if (err < 0) |
1834 | } | 1897 | goto destroy_ring; |
1835 | rtnl_lock(); | ||
1836 | netif_set_real_num_tx_queues(info->netdev, num_queues); | ||
1837 | rtnl_unlock(); | ||
1838 | 1898 | ||
1839 | /* Create shared ring, alloc event channel -- for each queue */ | 1899 | /* Create shared ring, alloc event channel -- for each queue */ |
1840 | for (i = 0; i < num_queues; ++i) { | 1900 | for (i = 0; i < num_queues; ++i) { |
1841 | queue = &info->queues[i]; | 1901 | queue = &info->queues[i]; |
1842 | queue->id = i; | ||
1843 | queue->info = info; | ||
1844 | err = xennet_init_queue(queue); | ||
1845 | if (err) { | ||
1846 | /* xennet_init_queue() cleans up after itself on failure, | ||
1847 | * but we still have to clean up any previously initialised | ||
1848 | * queues. If i > 0, set num_queues to i, then goto | ||
1849 | * destroy_ring, which calls xennet_disconnect_backend() | ||
1850 | * to tidy up. | ||
1851 | */ | ||
1852 | if (i > 0) { | ||
1853 | rtnl_lock(); | ||
1854 | netif_set_real_num_tx_queues(info->netdev, i); | ||
1855 | rtnl_unlock(); | ||
1856 | goto destroy_ring; | ||
1857 | } else { | ||
1858 | goto out; | ||
1859 | } | ||
1860 | } | ||
1861 | err = setup_netfront(dev, queue, feature_split_evtchn); | 1902 | err = setup_netfront(dev, queue, feature_split_evtchn); |
1862 | if (err) { | 1903 | if (err) { |
1863 | /* As for xennet_init_queue(), setup_netfront() will tidy | 1904 | /* setup_netfront() will tidy up the current |
1864 | * up the current queue on error, but we need to clean up | 1905 | * queue on error, but we need to clean up |
1865 | * those already allocated. | 1906 | * those already allocated. |
1866 | */ | 1907 | */ |
1867 | if (i > 0) { | 1908 | if (i > 0) { |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 8368d96ae7b4..b9864806e9b8 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -227,7 +227,8 @@ static int __of_node_add(struct device_node *np) | |||
227 | np->kobj.kset = of_kset; | 227 | np->kobj.kset = of_kset; |
228 | if (!np->parent) { | 228 | if (!np->parent) { |
229 | /* Nodes without parents are new top level trees */ | 229 | /* Nodes without parents are new top level trees */ |
230 | rc = kobject_add(&np->kobj, NULL, safe_name(&of_kset->kobj, "base")); | 230 | rc = kobject_add(&np->kobj, NULL, "%s", |
231 | safe_name(&of_kset->kobj, "base")); | ||
231 | } else { | 232 | } else { |
232 | name = safe_name(&np->parent->kobj, kbasename(np->full_name)); | 233 | name = safe_name(&np->parent->kobj, kbasename(np->full_name)); |
233 | if (!name || !name[0]) | 234 | if (!name || !name[0]) |
@@ -1960,9 +1961,9 @@ int of_attach_node(struct device_node *np) | |||
1960 | 1961 | ||
1961 | raw_spin_lock_irqsave(&devtree_lock, flags); | 1962 | raw_spin_lock_irqsave(&devtree_lock, flags); |
1962 | np->sibling = np->parent->child; | 1963 | np->sibling = np->parent->child; |
1963 | np->allnext = of_allnodes; | 1964 | np->allnext = np->parent->allnext; |
1965 | np->parent->allnext = np; | ||
1964 | np->parent->child = np; | 1966 | np->parent->child = np; |
1965 | of_allnodes = np; | ||
1966 | of_node_clear_flag(np, OF_DETACHED); | 1967 | of_node_clear_flag(np, OF_DETACHED); |
1967 | raw_spin_unlock_irqrestore(&devtree_lock, flags); | 1968 | raw_spin_unlock_irqrestore(&devtree_lock, flags); |
1968 | 1969 | ||
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index c4cddf0cd96d..b777d8f46bd5 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -880,6 +880,21 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | |||
880 | const u64 phys_offset = __pa(PAGE_OFFSET); | 880 | const u64 phys_offset = __pa(PAGE_OFFSET); |
881 | base &= PAGE_MASK; | 881 | base &= PAGE_MASK; |
882 | size &= PAGE_MASK; | 882 | size &= PAGE_MASK; |
883 | |||
884 | if (sizeof(phys_addr_t) < sizeof(u64)) { | ||
885 | if (base > ULONG_MAX) { | ||
886 | pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", | ||
887 | base, base + size); | ||
888 | return; | ||
889 | } | ||
890 | |||
891 | if (base + size > ULONG_MAX) { | ||
892 | pr_warning("Ignoring memory range 0x%lx - 0x%llx\n", | ||
893 | ULONG_MAX, base + size); | ||
894 | size = ULONG_MAX - base; | ||
895 | } | ||
896 | } | ||
897 | |||
883 | if (base + size < phys_offset) { | 898 | if (base + size < phys_offset) { |
884 | pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", | 899 | pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", |
885 | base, base + size); | 900 | base, base + size); |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index fb4a59830648..a3bf2122a8d5 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -323,11 +323,13 @@ int of_phy_register_fixed_link(struct device_node *np) | |||
323 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); | 323 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); |
324 | if (fixed_link_node) { | 324 | if (fixed_link_node) { |
325 | status.link = 1; | 325 | status.link = 1; |
326 | status.duplex = of_property_read_bool(np, "full-duplex"); | 326 | status.duplex = of_property_read_bool(fixed_link_node, |
327 | "full-duplex"); | ||
327 | if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) | 328 | if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) |
328 | return -EINVAL; | 329 | return -EINVAL; |
329 | status.pause = of_property_read_bool(np, "pause"); | 330 | status.pause = of_property_read_bool(fixed_link_node, "pause"); |
330 | status.asym_pause = of_property_read_bool(np, "asym-pause"); | 331 | status.asym_pause = of_property_read_bool(fixed_link_node, |
332 | "asym-pause"); | ||
331 | of_node_put(fixed_link_node); | 333 | of_node_put(fixed_link_node); |
332 | return fixed_phy_register(PHY_POLL, &status, np); | 334 | return fixed_phy_register(PHY_POLL, &status, np); |
333 | } | 335 | } |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 6c48d73a7fd7..500436f9be7f 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -166,10 +166,6 @@ static void of_dma_configure(struct platform_device *pdev) | |||
166 | int ret; | 166 | int ret; |
167 | struct device *dev = &pdev->dev; | 167 | struct device *dev = &pdev->dev; |
168 | 168 | ||
169 | #if defined(CONFIG_MICROBLAZE) | ||
170 | pdev->archdata.dma_mask = 0xffffffffUL; | ||
171 | #endif | ||
172 | |||
173 | /* | 169 | /* |
174 | * Set default dma-mask to 32 bit. Drivers are expected to setup | 170 | * Set default dma-mask to 32 bit. Drivers are expected to setup |
175 | * the correct supported dma_mask. | 171 | * the correct supported dma_mask. |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 63a54a340863..1c8592b0e146 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -3135,8 +3135,13 @@ static int pci_af_flr(struct pci_dev *dev, int probe) | |||
3135 | if (probe) | 3135 | if (probe) |
3136 | return 0; | 3136 | return 0; |
3137 | 3137 | ||
3138 | /* Wait for Transaction Pending bit clean */ | 3138 | /* |
3139 | if (pci_wait_for_pending(dev, pos + PCI_AF_STATUS, PCI_AF_STATUS_TP)) | 3139 | * Wait for Transaction Pending bit to clear. A word-aligned test |
3140 | * is used, so we use the conrol offset rather than status and shift | ||
3141 | * the test bit to match. | ||
3142 | */ | ||
3143 | if (pci_wait_for_pending(dev, pos + PCI_AF_CTRL, | ||
3144 | PCI_AF_STATUS_TP << 8)) | ||
3140 | goto clear; | 3145 | goto clear; |
3141 | 3146 | ||
3142 | dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n"); | 3147 | dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n"); |
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 16a2f067c242..64b98d242ea6 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -112,6 +112,7 @@ config PHY_EXYNOS5250_SATA | |||
112 | config PHY_SUN4I_USB | 112 | config PHY_SUN4I_USB |
113 | tristate "Allwinner sunxi SoC USB PHY driver" | 113 | tristate "Allwinner sunxi SoC USB PHY driver" |
114 | depends on ARCH_SUNXI && HAS_IOMEM && OF | 114 | depends on ARCH_SUNXI && HAS_IOMEM && OF |
115 | depends on RESET_CONTROLLER | ||
115 | select GENERIC_PHY | 116 | select GENERIC_PHY |
116 | help | 117 | help |
117 | Enable this to support the transceiver that is part of Allwinner | 118 | Enable this to support the transceiver that is part of Allwinner |
@@ -122,6 +123,7 @@ config PHY_SUN4I_USB | |||
122 | 123 | ||
123 | config PHY_SAMSUNG_USB2 | 124 | config PHY_SAMSUNG_USB2 |
124 | tristate "Samsung USB 2.0 PHY driver" | 125 | tristate "Samsung USB 2.0 PHY driver" |
126 | depends on HAS_IOMEM | ||
125 | select GENERIC_PHY | 127 | select GENERIC_PHY |
126 | select MFD_SYSCON | 128 | select MFD_SYSCON |
127 | help | 129 | help |
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index c64a2f3b2d62..49c446530101 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c | |||
@@ -614,8 +614,9 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, | |||
614 | return phy; | 614 | return phy; |
615 | 615 | ||
616 | put_dev: | 616 | put_dev: |
617 | put_device(&phy->dev); | 617 | put_device(&phy->dev); /* calls phy_release() which frees resources */ |
618 | ida_remove(&phy_ida, phy->id); | 618 | return ERR_PTR(ret); |
619 | |||
619 | free_phy: | 620 | free_phy: |
620 | kfree(phy); | 621 | kfree(phy); |
621 | return ERR_PTR(ret); | 622 | return ERR_PTR(ret); |
@@ -799,7 +800,7 @@ static void phy_release(struct device *dev) | |||
799 | 800 | ||
800 | phy = to_phy(dev); | 801 | phy = to_phy(dev); |
801 | dev_vdbg(dev, "releasing '%s'\n", dev_name(dev)); | 802 | dev_vdbg(dev, "releasing '%s'\n", dev_name(dev)); |
802 | ida_remove(&phy_ida, phy->id); | 803 | ida_simple_remove(&phy_ida, phy->id); |
803 | kfree(phy); | 804 | kfree(phy); |
804 | } | 805 | } |
805 | 806 | ||
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 7007c11fe07d..34b396146c8a 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c | |||
@@ -233,8 +233,8 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
233 | if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { | 233 | if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { |
234 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 234 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
235 | phy->phy_base = devm_ioremap_resource(&pdev->dev, res); | 235 | phy->phy_base = devm_ioremap_resource(&pdev->dev, res); |
236 | if (!phy->phy_base) | 236 | if (IS_ERR(phy->phy_base)) |
237 | return -ENOMEM; | 237 | return PTR_ERR(phy->phy_base); |
238 | phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; | 238 | phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; |
239 | } | 239 | } |
240 | 240 | ||
@@ -262,7 +262,6 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
262 | otg->phy = &phy->phy; | 262 | otg->phy = &phy->phy; |
263 | 263 | ||
264 | platform_set_drvdata(pdev, phy); | 264 | platform_set_drvdata(pdev, phy); |
265 | pm_runtime_enable(phy->dev); | ||
266 | 265 | ||
267 | generic_phy = devm_phy_create(phy->dev, &ops, NULL); | 266 | generic_phy = devm_phy_create(phy->dev, &ops, NULL); |
268 | if (IS_ERR(generic_phy)) | 267 | if (IS_ERR(generic_phy)) |
@@ -270,10 +269,13 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
270 | 269 | ||
271 | phy_set_drvdata(generic_phy, phy); | 270 | phy_set_drvdata(generic_phy, phy); |
272 | 271 | ||
272 | pm_runtime_enable(phy->dev); | ||
273 | phy_provider = devm_of_phy_provider_register(phy->dev, | 273 | phy_provider = devm_of_phy_provider_register(phy->dev, |
274 | of_phy_simple_xlate); | 274 | of_phy_simple_xlate); |
275 | if (IS_ERR(phy_provider)) | 275 | if (IS_ERR(phy_provider)) { |
276 | pm_runtime_disable(phy->dev); | ||
276 | return PTR_ERR(phy_provider); | 277 | return PTR_ERR(phy_provider); |
278 | } | ||
277 | 279 | ||
278 | phy->wkupclk = devm_clk_get(phy->dev, "wkupclk"); | 280 | phy->wkupclk = devm_clk_get(phy->dev, "wkupclk"); |
279 | if (IS_ERR(phy->wkupclk)) { | 281 | if (IS_ERR(phy->wkupclk)) { |
@@ -317,6 +319,7 @@ static int omap_usb2_remove(struct platform_device *pdev) | |||
317 | if (!IS_ERR(phy->optclk)) | 319 | if (!IS_ERR(phy->optclk)) |
318 | clk_unprepare(phy->optclk); | 320 | clk_unprepare(phy->optclk); |
319 | usb_remove_phy(&phy->phy); | 321 | usb_remove_phy(&phy->phy); |
322 | pm_runtime_disable(phy->dev); | ||
320 | 323 | ||
321 | return 0; | 324 | return 0; |
322 | } | 325 | } |
diff --git a/drivers/phy/phy-samsung-usb2.c b/drivers/phy/phy-samsung-usb2.c index 8a8c6bc8709a..1e69a32c221d 100644 --- a/drivers/phy/phy-samsung-usb2.c +++ b/drivers/phy/phy-samsung-usb2.c | |||
@@ -107,6 +107,7 @@ static const struct of_device_id samsung_usb2_phy_of_match[] = { | |||
107 | #endif | 107 | #endif |
108 | { }, | 108 | { }, |
109 | }; | 109 | }; |
110 | MODULE_DEVICE_TABLE(of, samsung_usb2_phy_of_match); | ||
110 | 111 | ||
111 | static int samsung_usb2_phy_probe(struct platform_device *pdev) | 112 | static int samsung_usb2_phy_probe(struct platform_device *pdev) |
112 | { | 113 | { |
diff --git a/drivers/pinctrl/berlin/berlin.c b/drivers/pinctrl/berlin/berlin.c index edf5d2fd2b22..86db2235ab00 100644 --- a/drivers/pinctrl/berlin/berlin.c +++ b/drivers/pinctrl/berlin/berlin.c | |||
@@ -320,7 +320,7 @@ int berlin_pinctrl_probe(struct platform_device *pdev, | |||
320 | 320 | ||
321 | regmap = dev_get_regmap(&pdev->dev, NULL); | 321 | regmap = dev_get_regmap(&pdev->dev, NULL); |
322 | if (!regmap) | 322 | if (!regmap) |
323 | return PTR_ERR(regmap); | 323 | return -ENODEV; |
324 | 324 | ||
325 | pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); | 325 | pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); |
326 | if (!pctrl) | 326 | if (!pctrl) |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index f1ca75e6d7b1..5f38c7f67834 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c | |||
@@ -211,6 +211,10 @@ static int sunxi_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
211 | configlen++; | 211 | configlen++; |
212 | 212 | ||
213 | pinconfig = kzalloc(configlen * sizeof(*pinconfig), GFP_KERNEL); | 213 | pinconfig = kzalloc(configlen * sizeof(*pinconfig), GFP_KERNEL); |
214 | if (!pinconfig) { | ||
215 | kfree(*map); | ||
216 | return -ENOMEM; | ||
217 | } | ||
214 | 218 | ||
215 | if (!of_property_read_u32(node, "allwinner,drive", &val)) { | 219 | if (!of_property_read_u32(node, "allwinner,drive", &val)) { |
216 | u16 strength = (val + 1) * 10; | 220 | u16 strength = (val + 1) * 10; |
diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig index 6aea373547f6..ee3de3421f2d 100644 --- a/drivers/ptp/Kconfig +++ b/drivers/ptp/Kconfig | |||
@@ -74,7 +74,7 @@ config DP83640_PHY | |||
74 | 74 | ||
75 | config PTP_1588_CLOCK_PCH | 75 | config PTP_1588_CLOCK_PCH |
76 | tristate "Intel PCH EG20T as PTP clock" | 76 | tristate "Intel PCH EG20T as PTP clock" |
77 | depends on X86 || COMPILE_TEST | 77 | depends on X86_32 || COMPILE_TEST |
78 | depends on HAS_IOMEM && NET | 78 | depends on HAS_IOMEM && NET |
79 | select PTP_1588_CLOCK | 79 | select PTP_1588_CLOCK |
80 | help | 80 | help |
diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index 85585219ce82..ad9e0c9b7daf 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c | |||
@@ -433,6 +433,7 @@ static struct regulator_ops as3722_ldo3_extcntrl_ops = { | |||
433 | }; | 433 | }; |
434 | 434 | ||
435 | static const struct regulator_linear_range as3722_ldo_ranges[] = { | 435 | static const struct regulator_linear_range as3722_ldo_ranges[] = { |
436 | REGULATOR_LINEAR_RANGE(0, 0x00, 0x00, 0), | ||
436 | REGULATOR_LINEAR_RANGE(825000, 0x01, 0x24, 25000), | 437 | REGULATOR_LINEAR_RANGE(825000, 0x01, 0x24, 25000), |
437 | REGULATOR_LINEAR_RANGE(1725000, 0x40, 0x7F, 25000), | 438 | REGULATOR_LINEAR_RANGE(1725000, 0x40, 0x7F, 25000), |
438 | }; | 439 | }; |
@@ -609,6 +610,7 @@ static bool as3722_sd0_is_low_voltage(struct as3722_regulators *as3722_regs) | |||
609 | } | 610 | } |
610 | 611 | ||
611 | static const struct regulator_linear_range as3722_sd2345_ranges[] = { | 612 | static const struct regulator_linear_range as3722_sd2345_ranges[] = { |
613 | REGULATOR_LINEAR_RANGE(0, 0x00, 0x00, 0), | ||
612 | REGULATOR_LINEAR_RANGE(612500, 0x01, 0x40, 12500), | 614 | REGULATOR_LINEAR_RANGE(612500, 0x01, 0x40, 12500), |
613 | REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), | 615 | REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), |
614 | REGULATOR_LINEAR_RANGE(2650000, 0x71, 0x7F, 50000), | 616 | REGULATOR_LINEAR_RANGE(2650000, 0x71, 0x7F, 50000), |
diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c index 57544e254a78..58ece59367ae 100644 --- a/drivers/regulator/bcm590xx-regulator.c +++ b/drivers/regulator/bcm590xx-regulator.c | |||
@@ -119,6 +119,10 @@ static const unsigned int ldo_c_table[] = { | |||
119 | 2900000, 3000000, 3300000, | 119 | 2900000, 3000000, 3300000, |
120 | }; | 120 | }; |
121 | 121 | ||
122 | static const unsigned int ldo_vbus[] = { | ||
123 | 5000000, | ||
124 | }; | ||
125 | |||
122 | /* DCDC group CSR: supported voltages in microvolts */ | 126 | /* DCDC group CSR: supported voltages in microvolts */ |
123 | static const struct regulator_linear_range dcdc_csr_ranges[] = { | 127 | static const struct regulator_linear_range dcdc_csr_ranges[] = { |
124 | REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000), | 128 | REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000), |
@@ -192,6 +196,7 @@ static struct bcm590xx_info bcm590xx_regs[] = { | |||
192 | BCM590XX_REG_TABLE(gpldo4, ldo_a_table), | 196 | BCM590XX_REG_TABLE(gpldo4, ldo_a_table), |
193 | BCM590XX_REG_TABLE(gpldo5, ldo_a_table), | 197 | BCM590XX_REG_TABLE(gpldo5, ldo_a_table), |
194 | BCM590XX_REG_TABLE(gpldo6, ldo_a_table), | 198 | BCM590XX_REG_TABLE(gpldo6, ldo_a_table), |
199 | BCM590XX_REG_TABLE(vbus, ldo_vbus), | ||
195 | }; | 200 | }; |
196 | 201 | ||
197 | struct bcm590xx_reg { | 202 | struct bcm590xx_reg { |
diff --git a/drivers/regulator/ltc3589.c b/drivers/regulator/ltc3589.c index 110a99ee1162..c8105182b8b8 100644 --- a/drivers/regulator/ltc3589.c +++ b/drivers/regulator/ltc3589.c | |||
@@ -255,7 +255,7 @@ static int ltc3589_parse_regulators_dt(struct ltc3589 *ltc3589) | |||
255 | struct device_node *node; | 255 | struct device_node *node; |
256 | int i, ret; | 256 | int i, ret; |
257 | 257 | ||
258 | node = of_find_node_by_name(dev->of_node, "regulators"); | 258 | node = of_get_child_by_name(dev->of_node, "regulators"); |
259 | if (!node) { | 259 | if (!node) { |
260 | dev_err(dev, "regulators node not found\n"); | 260 | dev_err(dev, "regulators node not found\n"); |
261 | return -EINVAL; | 261 | return -EINVAL; |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 864ed02ce4b7..93b4ad842901 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -37,12 +37,14 @@ struct regs_info { | |||
37 | }; | 37 | }; |
38 | 38 | ||
39 | static const struct regulator_linear_range smps_low_ranges[] = { | 39 | static const struct regulator_linear_range smps_low_ranges[] = { |
40 | REGULATOR_LINEAR_RANGE(0, 0x0, 0x0, 0), | ||
40 | REGULATOR_LINEAR_RANGE(500000, 0x1, 0x6, 0), | 41 | REGULATOR_LINEAR_RANGE(500000, 0x1, 0x6, 0), |
41 | REGULATOR_LINEAR_RANGE(510000, 0x7, 0x79, 10000), | 42 | REGULATOR_LINEAR_RANGE(510000, 0x7, 0x79, 10000), |
42 | REGULATOR_LINEAR_RANGE(1650000, 0x7A, 0x7f, 0), | 43 | REGULATOR_LINEAR_RANGE(1650000, 0x7A, 0x7f, 0), |
43 | }; | 44 | }; |
44 | 45 | ||
45 | static const struct regulator_linear_range smps_high_ranges[] = { | 46 | static const struct regulator_linear_range smps_high_ranges[] = { |
47 | REGULATOR_LINEAR_RANGE(0, 0x0, 0x0, 0), | ||
46 | REGULATOR_LINEAR_RANGE(1000000, 0x1, 0x6, 0), | 48 | REGULATOR_LINEAR_RANGE(1000000, 0x1, 0x6, 0), |
47 | REGULATOR_LINEAR_RANGE(1020000, 0x7, 0x79, 20000), | 49 | REGULATOR_LINEAR_RANGE(1020000, 0x7, 0x79, 20000), |
48 | REGULATOR_LINEAR_RANGE(3300000, 0x7A, 0x7f, 0), | 50 | REGULATOR_LINEAR_RANGE(3300000, 0x7A, 0x7f, 0), |
@@ -323,6 +325,10 @@ static int palmas_set_mode_smps(struct regulator_dev *dev, unsigned int mode) | |||
323 | if (rail_enable) | 325 | if (rail_enable) |
324 | palmas_smps_write(pmic->palmas, | 326 | palmas_smps_write(pmic->palmas, |
325 | palmas_regs_info[id].ctrl_addr, reg); | 327 | palmas_regs_info[id].ctrl_addr, reg); |
328 | |||
329 | /* Switch the enable value to ensure this is used for enable */ | ||
330 | pmic->desc[id].enable_val = pmic->current_reg_mode[id]; | ||
331 | |||
326 | return 0; | 332 | return 0; |
327 | } | 333 | } |
328 | 334 | ||
@@ -962,6 +968,14 @@ static int palmas_regulators_probe(struct platform_device *pdev) | |||
962 | return ret; | 968 | return ret; |
963 | pmic->current_reg_mode[id] = reg & | 969 | pmic->current_reg_mode[id] = reg & |
964 | PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; | 970 | PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; |
971 | |||
972 | pmic->desc[id].enable_reg = | ||
973 | PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, | ||
974 | palmas_regs_info[id].ctrl_addr); | ||
975 | pmic->desc[id].enable_mask = | ||
976 | PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; | ||
977 | /* set_mode overrides this value */ | ||
978 | pmic->desc[id].enable_val = SMPS_CTRL_MODE_ON; | ||
965 | } | 979 | } |
966 | 980 | ||
967 | pmic->desc[id].type = REGULATOR_VOLTAGE; | 981 | pmic->desc[id].type = REGULATOR_VOLTAGE; |
diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c index 69b4b7750410..9effe48c605e 100644 --- a/drivers/regulator/tps65218-regulator.c +++ b/drivers/regulator/tps65218-regulator.c | |||
@@ -209,7 +209,7 @@ static const struct regulator_desc regulators[] = { | |||
209 | 1, -1, -1, TPS65218_REG_ENABLE1, | 209 | 1, -1, -1, TPS65218_REG_ENABLE1, |
210 | TPS65218_ENABLE1_DC6_EN, NULL, NULL, 0, 0), | 210 | TPS65218_ENABLE1_DC6_EN, NULL, NULL, 0, 0), |
211 | TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, tps65218_ldo1_dcdc34_ops, 64, | 211 | TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, tps65218_ldo1_dcdc34_ops, 64, |
212 | TPS65218_REG_CONTROL_DCDC4, | 212 | TPS65218_REG_CONTROL_LDO1, |
213 | TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2, | 213 | TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2, |
214 | TPS65218_ENABLE2_LDO1_EN, NULL, ldo1_dcdc3_ranges, | 214 | TPS65218_ENABLE2_LDO1_EN, NULL, ldo1_dcdc3_ranges, |
215 | 2, 0), | 215 | 2, 0), |
@@ -240,6 +240,7 @@ static int tps65218_regulator_probe(struct platform_device *pdev) | |||
240 | config.init_data = init_data; | 240 | config.init_data = init_data; |
241 | config.driver_data = tps; | 241 | config.driver_data = tps; |
242 | config.regmap = tps->regmap; | 242 | config.regmap = tps->regmap; |
243 | config.of_node = pdev->dev.of_node; | ||
243 | 244 | ||
244 | rdev = devm_regulator_register(&pdev->dev, ®ulators[id], &config); | 245 | rdev = devm_regulator_register(&pdev->dev, ®ulators[id], &config); |
245 | if (IS_ERR(rdev)) { | 246 | if (IS_ERR(rdev)) { |
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index ce1743d0b679..5e343bab9458 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig | |||
@@ -44,7 +44,7 @@ config STE_MODEM_RPROC | |||
44 | config DA8XX_REMOTEPROC | 44 | config DA8XX_REMOTEPROC |
45 | tristate "DA8xx/OMAP-L13x remoteproc support" | 45 | tristate "DA8xx/OMAP-L13x remoteproc support" |
46 | depends on ARCH_DAVINCI_DA8XX | 46 | depends on ARCH_DAVINCI_DA8XX |
47 | select CMA | 47 | select CMA if MMU |
48 | select REMOTEPROC | 48 | select REMOTEPROC |
49 | select RPMSG | 49 | select RPMSG |
50 | help | 50 | help |
diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c index 1ecfe3bd92ac..1cff2a21db67 100644 --- a/drivers/rtc/rtc-puv3.c +++ b/drivers/rtc/rtc-puv3.c | |||
@@ -71,7 +71,7 @@ static int puv3_rtc_setpie(struct device *dev, int enabled) | |||
71 | { | 71 | { |
72 | unsigned int tmp; | 72 | unsigned int tmp; |
73 | 73 | ||
74 | dev_debug(dev, "%s: pie=%d\n", __func__, enabled); | 74 | dev_dbg(dev, "%s: pie=%d\n", __func__, enabled); |
75 | 75 | ||
76 | spin_lock_irq(&puv3_rtc_pie_lock); | 76 | spin_lock_irq(&puv3_rtc_pie_lock); |
77 | tmp = readl(RTC_RTSR) & ~RTC_RTSR_HZE; | 77 | tmp = readl(RTC_RTSR) & ~RTC_RTSR_HZE; |
@@ -140,7 +140,7 @@ static int puv3_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
140 | rtc_tm_to_time(tm, &rtcalarm_count); | 140 | rtc_tm_to_time(tm, &rtcalarm_count); |
141 | writel(rtcalarm_count, RTC_RTAR); | 141 | writel(rtcalarm_count, RTC_RTAR); |
142 | 142 | ||
143 | puv3_rtc_setaie(&dev->dev, alrm->enabled); | 143 | puv3_rtc_setaie(dev, alrm->enabled); |
144 | 144 | ||
145 | if (alrm->enabled) | 145 | if (alrm->enabled) |
146 | enable_irq_wake(puv3_rtc_alarmno); | 146 | enable_irq_wake(puv3_rtc_alarmno); |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index ee0e85abe1fd..0f471750327e 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -593,7 +593,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char | |||
593 | dev_info->start = dcssblk_find_lowest_addr(dev_info); | 593 | dev_info->start = dcssblk_find_lowest_addr(dev_info); |
594 | dev_info->end = dcssblk_find_highest_addr(dev_info); | 594 | dev_info->end = dcssblk_find_highest_addr(dev_info); |
595 | 595 | ||
596 | dev_set_name(&dev_info->dev, dev_info->segment_name); | 596 | dev_set_name(&dev_info->dev, "%s", dev_info->segment_name); |
597 | dev_info->dev.release = dcssblk_release_segment; | 597 | dev_info->dev.release = dcssblk_release_segment; |
598 | dev_info->dev.groups = dcssblk_dev_attr_groups; | 598 | dev_info->dev.groups = dcssblk_dev_attr_groups; |
599 | INIT_LIST_HEAD(&dev_info->lh); | 599 | INIT_LIST_HEAD(&dev_info->lh); |
diff --git a/drivers/s390/char/Makefile b/drivers/s390/char/Makefile index 629fcc275e92..78b6ace7edcb 100644 --- a/drivers/s390/char/Makefile +++ b/drivers/s390/char/Makefile | |||
@@ -19,7 +19,6 @@ obj-$(CONFIG_SCLP_VT220_TTY) += sclp_vt220.o | |||
19 | obj-$(CONFIG_SCLP_CPI) += sclp_cpi.o | 19 | obj-$(CONFIG_SCLP_CPI) += sclp_cpi.o |
20 | obj-$(CONFIG_SCLP_ASYNC) += sclp_async.o | 20 | obj-$(CONFIG_SCLP_ASYNC) += sclp_async.o |
21 | 21 | ||
22 | obj-$(CONFIG_ZVM_WATCHDOG) += vmwatchdog.o | ||
23 | obj-$(CONFIG_VMLOGRDR) += vmlogrdr.o | 22 | obj-$(CONFIG_VMLOGRDR) += vmlogrdr.o |
24 | obj-$(CONFIG_VMCP) += vmcp.o | 23 | obj-$(CONFIG_VMCP) += vmcp.o |
25 | 24 | ||
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index cd9c91909596..b9a9f721716d 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c | |||
@@ -838,8 +838,6 @@ sclp_vt220_con_init(void) | |||
838 | { | 838 | { |
839 | int rc; | 839 | int rc; |
840 | 840 | ||
841 | if (!CONSOLE_IS_SCLP) | ||
842 | return 0; | ||
843 | rc = __sclp_vt220_init(sclp_console_pages); | 841 | rc = __sclp_vt220_init(sclp_console_pages); |
844 | if (rc) | 842 | if (rc) |
845 | return rc; | 843 | return rc; |
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index cf31d3321dab..a8848db7b09d 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -761,7 +761,7 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) | |||
761 | 761 | ||
762 | dev = kzalloc(sizeof(struct device), GFP_KERNEL); | 762 | dev = kzalloc(sizeof(struct device), GFP_KERNEL); |
763 | if (dev) { | 763 | if (dev) { |
764 | dev_set_name(dev, priv->internal_name); | 764 | dev_set_name(dev, "%s", priv->internal_name); |
765 | dev->bus = &iucv_bus; | 765 | dev->bus = &iucv_bus; |
766 | dev->parent = iucv_root; | 766 | dev->parent = iucv_root; |
767 | dev->driver = &vmlogrdr_driver; | 767 | dev->driver = &vmlogrdr_driver; |
diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c deleted file mode 100644 index d5eac985976b..000000000000 --- a/drivers/s390/char/vmwatchdog.c +++ /dev/null | |||
@@ -1,338 +0,0 @@ | |||
1 | /* | ||
2 | * Watchdog implementation based on z/VM Watchdog Timer API | ||
3 | * | ||
4 | * Copyright IBM Corp. 2004, 2009 | ||
5 | * | ||
6 | * The user space watchdog daemon can use this driver as | ||
7 | * /dev/vmwatchdog to have z/VM execute the specified CP | ||
8 | * command when the timeout expires. The default command is | ||
9 | * "IPL", which which cause an immediate reboot. | ||
10 | */ | ||
11 | #define KMSG_COMPONENT "vmwatchdog" | ||
12 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
13 | |||
14 | #include <linux/init.h> | ||
15 | #include <linux/fs.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/miscdevice.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/moduleparam.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/suspend.h> | ||
22 | #include <linux/watchdog.h> | ||
23 | |||
24 | #include <asm/ebcdic.h> | ||
25 | #include <asm/io.h> | ||
26 | #include <asm/uaccess.h> | ||
27 | |||
28 | #define MAX_CMDLEN 240 | ||
29 | #define MIN_INTERVAL 15 | ||
30 | static char vmwdt_cmd[MAX_CMDLEN] = "IPL"; | ||
31 | static bool vmwdt_conceal; | ||
32 | |||
33 | static bool vmwdt_nowayout = WATCHDOG_NOWAYOUT; | ||
34 | |||
35 | MODULE_LICENSE("GPL"); | ||
36 | MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>"); | ||
37 | MODULE_DESCRIPTION("z/VM Watchdog Timer"); | ||
38 | module_param_string(cmd, vmwdt_cmd, MAX_CMDLEN, 0644); | ||
39 | MODULE_PARM_DESC(cmd, "CP command that is run when the watchdog triggers"); | ||
40 | module_param_named(conceal, vmwdt_conceal, bool, 0644); | ||
41 | MODULE_PARM_DESC(conceal, "Enable the CONCEAL CP option while the watchdog " | ||
42 | " is active"); | ||
43 | module_param_named(nowayout, vmwdt_nowayout, bool, 0); | ||
44 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started" | ||
45 | " (default=CONFIG_WATCHDOG_NOWAYOUT)"); | ||
46 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
47 | |||
48 | static unsigned int vmwdt_interval = 60; | ||
49 | static unsigned long vmwdt_is_open; | ||
50 | static int vmwdt_expect_close; | ||
51 | |||
52 | static DEFINE_MUTEX(vmwdt_mutex); | ||
53 | |||
54 | #define VMWDT_OPEN 0 /* devnode is open or suspend in progress */ | ||
55 | #define VMWDT_RUNNING 1 /* The watchdog is armed */ | ||
56 | |||
57 | enum vmwdt_func { | ||
58 | /* function codes */ | ||
59 | wdt_init = 0, | ||
60 | wdt_change = 1, | ||
61 | wdt_cancel = 2, | ||
62 | /* flags */ | ||
63 | wdt_conceal = 0x80000000, | ||
64 | }; | ||
65 | |||
66 | static int __diag288(enum vmwdt_func func, unsigned int timeout, | ||
67 | char *cmd, size_t len) | ||
68 | { | ||
69 | register unsigned long __func asm("2") = func; | ||
70 | register unsigned long __timeout asm("3") = timeout; | ||
71 | register unsigned long __cmdp asm("4") = virt_to_phys(cmd); | ||
72 | register unsigned long __cmdl asm("5") = len; | ||
73 | int err; | ||
74 | |||
75 | err = -EINVAL; | ||
76 | asm volatile( | ||
77 | " diag %1,%3,0x288\n" | ||
78 | "0: la %0,0\n" | ||
79 | "1:\n" | ||
80 | EX_TABLE(0b,1b) | ||
81 | : "+d" (err) : "d"(__func), "d"(__timeout), | ||
82 | "d"(__cmdp), "d"(__cmdl) : "1", "cc"); | ||
83 | return err; | ||
84 | } | ||
85 | |||
86 | static int vmwdt_keepalive(void) | ||
87 | { | ||
88 | /* we allocate new memory every time to avoid having | ||
89 | * to track the state. static allocation is not an | ||
90 | * option since that might not be contiguous in real | ||
91 | * storage in case of a modular build */ | ||
92 | static char *ebc_cmd; | ||
93 | size_t len; | ||
94 | int ret; | ||
95 | unsigned int func; | ||
96 | |||
97 | ebc_cmd = kmalloc(MAX_CMDLEN, GFP_KERNEL); | ||
98 | if (!ebc_cmd) | ||
99 | return -ENOMEM; | ||
100 | |||
101 | len = strlcpy(ebc_cmd, vmwdt_cmd, MAX_CMDLEN); | ||
102 | ASCEBC(ebc_cmd, MAX_CMDLEN); | ||
103 | EBC_TOUPPER(ebc_cmd, MAX_CMDLEN); | ||
104 | |||
105 | func = vmwdt_conceal ? (wdt_init | wdt_conceal) : wdt_init; | ||
106 | set_bit(VMWDT_RUNNING, &vmwdt_is_open); | ||
107 | ret = __diag288(func, vmwdt_interval, ebc_cmd, len); | ||
108 | WARN_ON(ret != 0); | ||
109 | kfree(ebc_cmd); | ||
110 | return ret; | ||
111 | } | ||
112 | |||
113 | static int vmwdt_disable(void) | ||
114 | { | ||
115 | char cmd[] = {'\0'}; | ||
116 | int ret = __diag288(wdt_cancel, 0, cmd, 0); | ||
117 | WARN_ON(ret != 0); | ||
118 | clear_bit(VMWDT_RUNNING, &vmwdt_is_open); | ||
119 | return ret; | ||
120 | } | ||
121 | |||
122 | static int __init vmwdt_probe(void) | ||
123 | { | ||
124 | /* there is no real way to see if the watchdog is supported, | ||
125 | * so we try initializing it with a NOP command ("BEGIN") | ||
126 | * that won't cause any harm even if the following disable | ||
127 | * fails for some reason */ | ||
128 | char ebc_begin[] = { | ||
129 | 194, 197, 199, 201, 213 | ||
130 | }; | ||
131 | if (__diag288(wdt_init, 15, ebc_begin, sizeof(ebc_begin)) != 0) | ||
132 | return -EINVAL; | ||
133 | return vmwdt_disable(); | ||
134 | } | ||
135 | |||
136 | static int vmwdt_open(struct inode *i, struct file *f) | ||
137 | { | ||
138 | int ret; | ||
139 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) | ||
140 | return -EBUSY; | ||
141 | ret = vmwdt_keepalive(); | ||
142 | if (ret) | ||
143 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | ||
144 | return ret ? ret : nonseekable_open(i, f); | ||
145 | } | ||
146 | |||
147 | static int vmwdt_close(struct inode *i, struct file *f) | ||
148 | { | ||
149 | if (vmwdt_expect_close == 42) | ||
150 | vmwdt_disable(); | ||
151 | vmwdt_expect_close = 0; | ||
152 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | static struct watchdog_info vmwdt_info = { | ||
157 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | ||
158 | .firmware_version = 0, | ||
159 | .identity = "z/VM Watchdog Timer", | ||
160 | }; | ||
161 | |||
162 | static int __vmwdt_ioctl(unsigned int cmd, unsigned long arg) | ||
163 | { | ||
164 | switch (cmd) { | ||
165 | case WDIOC_GETSUPPORT: | ||
166 | if (copy_to_user((void __user *)arg, &vmwdt_info, | ||
167 | sizeof(vmwdt_info))) | ||
168 | return -EFAULT; | ||
169 | return 0; | ||
170 | case WDIOC_GETSTATUS: | ||
171 | case WDIOC_GETBOOTSTATUS: | ||
172 | return put_user(0, (int __user *)arg); | ||
173 | case WDIOC_GETTEMP: | ||
174 | return -EINVAL; | ||
175 | case WDIOC_SETOPTIONS: | ||
176 | { | ||
177 | int options, ret; | ||
178 | if (get_user(options, (int __user *)arg)) | ||
179 | return -EFAULT; | ||
180 | ret = -EINVAL; | ||
181 | if (options & WDIOS_DISABLECARD) { | ||
182 | ret = vmwdt_disable(); | ||
183 | if (ret) | ||
184 | return ret; | ||
185 | } | ||
186 | if (options & WDIOS_ENABLECARD) { | ||
187 | ret = vmwdt_keepalive(); | ||
188 | } | ||
189 | return ret; | ||
190 | } | ||
191 | case WDIOC_GETTIMEOUT: | ||
192 | return put_user(vmwdt_interval, (int __user *)arg); | ||
193 | case WDIOC_SETTIMEOUT: | ||
194 | { | ||
195 | int interval; | ||
196 | if (get_user(interval, (int __user *)arg)) | ||
197 | return -EFAULT; | ||
198 | if (interval < MIN_INTERVAL) | ||
199 | return -EINVAL; | ||
200 | vmwdt_interval = interval; | ||
201 | } | ||
202 | return vmwdt_keepalive(); | ||
203 | case WDIOC_KEEPALIVE: | ||
204 | return vmwdt_keepalive(); | ||
205 | } | ||
206 | return -EINVAL; | ||
207 | } | ||
208 | |||
209 | static long vmwdt_ioctl(struct file *f, unsigned int cmd, unsigned long arg) | ||
210 | { | ||
211 | int rc; | ||
212 | |||
213 | mutex_lock(&vmwdt_mutex); | ||
214 | rc = __vmwdt_ioctl(cmd, arg); | ||
215 | mutex_unlock(&vmwdt_mutex); | ||
216 | return (long) rc; | ||
217 | } | ||
218 | |||
219 | static ssize_t vmwdt_write(struct file *f, const char __user *buf, | ||
220 | size_t count, loff_t *ppos) | ||
221 | { | ||
222 | if(count) { | ||
223 | if (!vmwdt_nowayout) { | ||
224 | size_t i; | ||
225 | |||
226 | /* note: just in case someone wrote the magic character | ||
227 | * five months ago... */ | ||
228 | vmwdt_expect_close = 0; | ||
229 | |||
230 | for (i = 0; i != count; i++) { | ||
231 | char c; | ||
232 | if (get_user(c, buf+i)) | ||
233 | return -EFAULT; | ||
234 | if (c == 'V') | ||
235 | vmwdt_expect_close = 42; | ||
236 | } | ||
237 | } | ||
238 | /* someone wrote to us, we should restart timer */ | ||
239 | vmwdt_keepalive(); | ||
240 | } | ||
241 | return count; | ||
242 | } | ||
243 | |||
244 | static int vmwdt_resume(void) | ||
245 | { | ||
246 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | ||
247 | return NOTIFY_DONE; | ||
248 | } | ||
249 | |||
250 | /* | ||
251 | * It makes no sense to go into suspend while the watchdog is running. | ||
252 | * Depending on the memory size, the watchdog might trigger, while we | ||
253 | * are still saving the memory. | ||
254 | * We reuse the open flag to ensure that suspend and watchdog open are | ||
255 | * exclusive operations | ||
256 | */ | ||
257 | static int vmwdt_suspend(void) | ||
258 | { | ||
259 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) { | ||
260 | pr_err("The system cannot be suspended while the watchdog" | ||
261 | " is in use\n"); | ||
262 | return notifier_from_errno(-EBUSY); | ||
263 | } | ||
264 | if (test_bit(VMWDT_RUNNING, &vmwdt_is_open)) { | ||
265 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | ||
266 | pr_err("The system cannot be suspended while the watchdog" | ||
267 | " is running\n"); | ||
268 | return notifier_from_errno(-EBUSY); | ||
269 | } | ||
270 | return NOTIFY_DONE; | ||
271 | } | ||
272 | |||
273 | /* | ||
274 | * This function is called for suspend and resume. | ||
275 | */ | ||
276 | static int vmwdt_power_event(struct notifier_block *this, unsigned long event, | ||
277 | void *ptr) | ||
278 | { | ||
279 | switch (event) { | ||
280 | case PM_POST_HIBERNATION: | ||
281 | case PM_POST_SUSPEND: | ||
282 | return vmwdt_resume(); | ||
283 | case PM_HIBERNATION_PREPARE: | ||
284 | case PM_SUSPEND_PREPARE: | ||
285 | return vmwdt_suspend(); | ||
286 | default: | ||
287 | return NOTIFY_DONE; | ||
288 | } | ||
289 | } | ||
290 | |||
291 | static struct notifier_block vmwdt_power_notifier = { | ||
292 | .notifier_call = vmwdt_power_event, | ||
293 | }; | ||
294 | |||
295 | static const struct file_operations vmwdt_fops = { | ||
296 | .open = &vmwdt_open, | ||
297 | .release = &vmwdt_close, | ||
298 | .unlocked_ioctl = &vmwdt_ioctl, | ||
299 | .write = &vmwdt_write, | ||
300 | .owner = THIS_MODULE, | ||
301 | .llseek = noop_llseek, | ||
302 | }; | ||
303 | |||
304 | static struct miscdevice vmwdt_dev = { | ||
305 | .minor = WATCHDOG_MINOR, | ||
306 | .name = "watchdog", | ||
307 | .fops = &vmwdt_fops, | ||
308 | }; | ||
309 | |||
310 | static int __init vmwdt_init(void) | ||
311 | { | ||
312 | int ret; | ||
313 | |||
314 | ret = vmwdt_probe(); | ||
315 | if (ret) | ||
316 | return ret; | ||
317 | ret = register_pm_notifier(&vmwdt_power_notifier); | ||
318 | if (ret) | ||
319 | return ret; | ||
320 | /* | ||
321 | * misc_register() has to be the last action in module_init(), because | ||
322 | * file operations will be available right after this. | ||
323 | */ | ||
324 | ret = misc_register(&vmwdt_dev); | ||
325 | if (ret) { | ||
326 | unregister_pm_notifier(&vmwdt_power_notifier); | ||
327 | return ret; | ||
328 | } | ||
329 | return 0; | ||
330 | } | ||
331 | module_init(vmwdt_init); | ||
332 | |||
333 | static void __exit vmwdt_exit(void) | ||
334 | { | ||
335 | unregister_pm_notifier(&vmwdt_power_notifier); | ||
336 | misc_deregister(&vmwdt_dev); | ||
337 | } | ||
338 | module_exit(vmwdt_exit); | ||
diff --git a/drivers/s390/cio/airq.c b/drivers/s390/cio/airq.c index 445564c790f6..00bfbee0af9e 100644 --- a/drivers/s390/cio/airq.c +++ b/drivers/s390/cio/airq.c | |||
@@ -196,11 +196,11 @@ EXPORT_SYMBOL(airq_iv_release); | |||
196 | */ | 196 | */ |
197 | unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num) | 197 | unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num) |
198 | { | 198 | { |
199 | unsigned long bit, i; | 199 | unsigned long bit, i, flags; |
200 | 200 | ||
201 | if (!iv->avail || num == 0) | 201 | if (!iv->avail || num == 0) |
202 | return -1UL; | 202 | return -1UL; |
203 | spin_lock(&iv->lock); | 203 | spin_lock_irqsave(&iv->lock, flags); |
204 | bit = find_first_bit_inv(iv->avail, iv->bits); | 204 | bit = find_first_bit_inv(iv->avail, iv->bits); |
205 | while (bit + num <= iv->bits) { | 205 | while (bit + num <= iv->bits) { |
206 | for (i = 1; i < num; i++) | 206 | for (i = 1; i < num; i++) |
@@ -218,9 +218,8 @@ unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num) | |||
218 | } | 218 | } |
219 | if (bit + num > iv->bits) | 219 | if (bit + num > iv->bits) |
220 | bit = -1UL; | 220 | bit = -1UL; |
221 | spin_unlock(&iv->lock); | 221 | spin_unlock_irqrestore(&iv->lock, flags); |
222 | return bit; | 222 | return bit; |
223 | |||
224 | } | 223 | } |
225 | EXPORT_SYMBOL(airq_iv_alloc); | 224 | EXPORT_SYMBOL(airq_iv_alloc); |
226 | 225 | ||
@@ -232,11 +231,11 @@ EXPORT_SYMBOL(airq_iv_alloc); | |||
232 | */ | 231 | */ |
233 | void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num) | 232 | void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num) |
234 | { | 233 | { |
235 | unsigned long i; | 234 | unsigned long i, flags; |
236 | 235 | ||
237 | if (!iv->avail || num == 0) | 236 | if (!iv->avail || num == 0) |
238 | return; | 237 | return; |
239 | spin_lock(&iv->lock); | 238 | spin_lock_irqsave(&iv->lock, flags); |
240 | for (i = 0; i < num; i++) { | 239 | for (i = 0; i < num; i++) { |
241 | /* Clear (possibly left over) interrupt bit */ | 240 | /* Clear (possibly left over) interrupt bit */ |
242 | clear_bit_inv(bit + i, iv->vector); | 241 | clear_bit_inv(bit + i, iv->vector); |
@@ -248,7 +247,7 @@ void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num) | |||
248 | while (iv->end > 0 && !test_bit_inv(iv->end - 1, iv->avail)) | 247 | while (iv->end > 0 && !test_bit_inv(iv->end - 1, iv->avail)) |
249 | iv->end--; | 248 | iv->end--; |
250 | } | 249 | } |
251 | spin_unlock(&iv->lock); | 250 | spin_unlock_irqrestore(&iv->lock, flags); |
252 | } | 251 | } |
253 | EXPORT_SYMBOL(airq_iv_free); | 252 | EXPORT_SYMBOL(airq_iv_free); |
254 | 253 | ||
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index dfd7bc681c25..e443b0d0b236 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
@@ -184,7 +184,7 @@ static ssize_t ccwgroup_ungroup_store(struct device *dev, | |||
184 | const char *buf, size_t count) | 184 | const char *buf, size_t count) |
185 | { | 185 | { |
186 | struct ccwgroup_device *gdev = to_ccwgroupdev(dev); | 186 | struct ccwgroup_device *gdev = to_ccwgroupdev(dev); |
187 | int rc; | 187 | int rc = 0; |
188 | 188 | ||
189 | /* Prevent concurrent online/offline processing and ungrouping. */ | 189 | /* Prevent concurrent online/offline processing and ungrouping. */ |
190 | if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) | 190 | if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) |
@@ -196,11 +196,12 @@ static ssize_t ccwgroup_ungroup_store(struct device *dev, | |||
196 | 196 | ||
197 | if (device_remove_file_self(dev, attr)) | 197 | if (device_remove_file_self(dev, attr)) |
198 | ccwgroup_ungroup(gdev); | 198 | ccwgroup_ungroup(gdev); |
199 | else | ||
200 | rc = -ENODEV; | ||
199 | out: | 201 | out: |
200 | if (rc) { | 202 | if (rc) { |
201 | if (rc != -EAGAIN) | 203 | /* Release onoff "lock" when ungrouping failed. */ |
202 | /* Release onoff "lock" when ungrouping failed. */ | 204 | atomic_set(&gdev->onoff, 0); |
203 | atomic_set(&gdev->onoff, 0); | ||
204 | return rc; | 205 | return rc; |
205 | } | 206 | } |
206 | return count; | 207 | return count; |
@@ -227,6 +228,7 @@ static void ccwgroup_ungroup_workfn(struct work_struct *work) | |||
227 | container_of(work, struct ccwgroup_device, ungroup_work); | 228 | container_of(work, struct ccwgroup_device, ungroup_work); |
228 | 229 | ||
229 | ccwgroup_ungroup(gdev); | 230 | ccwgroup_ungroup(gdev); |
231 | put_device(&gdev->dev); | ||
230 | } | 232 | } |
231 | 233 | ||
232 | static void ccwgroup_release(struct device *dev) | 234 | static void ccwgroup_release(struct device *dev) |
@@ -412,8 +414,10 @@ static int ccwgroup_notifier(struct notifier_block *nb, unsigned long action, | |||
412 | { | 414 | { |
413 | struct ccwgroup_device *gdev = to_ccwgroupdev(data); | 415 | struct ccwgroup_device *gdev = to_ccwgroupdev(data); |
414 | 416 | ||
415 | if (action == BUS_NOTIFY_UNBIND_DRIVER) | 417 | if (action == BUS_NOTIFY_UNBIND_DRIVER) { |
418 | get_device(&gdev->dev); | ||
416 | schedule_work(&gdev->ungroup_work); | 419 | schedule_work(&gdev->ungroup_work); |
420 | } | ||
417 | 421 | ||
418 | return NOTIFY_OK; | 422 | return NOTIFY_OK; |
419 | } | 423 | } |
@@ -582,11 +586,7 @@ void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver) | |||
582 | __ccwgroup_match_all))) { | 586 | __ccwgroup_match_all))) { |
583 | struct ccwgroup_device *gdev = to_ccwgroupdev(dev); | 587 | struct ccwgroup_device *gdev = to_ccwgroupdev(dev); |
584 | 588 | ||
585 | mutex_lock(&gdev->reg_mutex); | 589 | ccwgroup_ungroup(gdev); |
586 | __ccwgroup_remove_symlinks(gdev); | ||
587 | device_unregister(dev); | ||
588 | __ccwgroup_remove_cdev_refs(gdev); | ||
589 | mutex_unlock(&gdev->reg_mutex); | ||
590 | put_device(dev); | 590 | put_device(dev); |
591 | } | 591 | } |
592 | driver_unregister(&cdriver->driver); | 592 | driver_unregister(&cdriver->driver); |
@@ -633,13 +633,7 @@ void ccwgroup_remove_ccwdev(struct ccw_device *cdev) | |||
633 | get_device(&gdev->dev); | 633 | get_device(&gdev->dev); |
634 | spin_unlock_irq(cdev->ccwlock); | 634 | spin_unlock_irq(cdev->ccwlock); |
635 | /* Unregister group device. */ | 635 | /* Unregister group device. */ |
636 | mutex_lock(&gdev->reg_mutex); | 636 | ccwgroup_ungroup(gdev); |
637 | if (device_is_registered(&gdev->dev)) { | ||
638 | __ccwgroup_remove_symlinks(gdev); | ||
639 | device_unregister(&gdev->dev); | ||
640 | __ccwgroup_remove_cdev_refs(gdev); | ||
641 | } | ||
642 | mutex_unlock(&gdev->reg_mutex); | ||
643 | /* Release ccwgroup device reference for local processing. */ | 637 | /* Release ccwgroup device reference for local processing. */ |
644 | put_device(&gdev->dev); | 638 | put_device(&gdev->dev); |
645 | } | 639 | } |
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 77f9c92df4b9..2905d8b0ec95 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c | |||
@@ -602,6 +602,7 @@ void __init init_cio_interrupts(void) | |||
602 | 602 | ||
603 | #ifdef CONFIG_CCW_CONSOLE | 603 | #ifdef CONFIG_CCW_CONSOLE |
604 | static struct subchannel *console_sch; | 604 | static struct subchannel *console_sch; |
605 | static struct lock_class_key console_sch_key; | ||
605 | 606 | ||
606 | /* | 607 | /* |
607 | * Use cio_tsch to update the subchannel status and call the interrupt handler | 608 | * Use cio_tsch to update the subchannel status and call the interrupt handler |
@@ -686,6 +687,7 @@ struct subchannel *cio_probe_console(void) | |||
686 | if (IS_ERR(sch)) | 687 | if (IS_ERR(sch)) |
687 | return sch; | 688 | return sch; |
688 | 689 | ||
690 | lockdep_set_class(sch->lock, &console_sch_key); | ||
689 | isc_register(CONSOLE_ISC); | 691 | isc_register(CONSOLE_ISC); |
690 | sch->config.isc = CONSOLE_ISC; | 692 | sch->config.isc = CONSOLE_ISC; |
691 | sch->config.intparm = (u32)(addr_t)sch; | 693 | sch->config.intparm = (u32)(addr_t)sch; |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index d8d9b5b5cc56..dfef5e63cb7b 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -678,18 +678,11 @@ static const struct attribute_group *ccwdev_attr_groups[] = { | |||
678 | NULL, | 678 | NULL, |
679 | }; | 679 | }; |
680 | 680 | ||
681 | /* this is a simple abstraction for device_register that sets the | 681 | static int ccw_device_add(struct ccw_device *cdev) |
682 | * correct bus type and adds the bus specific files */ | ||
683 | static int ccw_device_register(struct ccw_device *cdev) | ||
684 | { | 682 | { |
685 | struct device *dev = &cdev->dev; | 683 | struct device *dev = &cdev->dev; |
686 | int ret; | ||
687 | 684 | ||
688 | dev->bus = &ccw_bus_type; | 685 | dev->bus = &ccw_bus_type; |
689 | ret = dev_set_name(&cdev->dev, "0.%x.%04x", cdev->private->dev_id.ssid, | ||
690 | cdev->private->dev_id.devno); | ||
691 | if (ret) | ||
692 | return ret; | ||
693 | return device_add(dev); | 686 | return device_add(dev); |
694 | } | 687 | } |
695 | 688 | ||
@@ -764,22 +757,46 @@ static void ccw_device_todo(struct work_struct *work); | |||
764 | static int io_subchannel_initialize_dev(struct subchannel *sch, | 757 | static int io_subchannel_initialize_dev(struct subchannel *sch, |
765 | struct ccw_device *cdev) | 758 | struct ccw_device *cdev) |
766 | { | 759 | { |
767 | cdev->private->cdev = cdev; | 760 | struct ccw_device_private *priv = cdev->private; |
768 | cdev->private->int_class = IRQIO_CIO; | 761 | int ret; |
769 | atomic_set(&cdev->private->onoff, 0); | 762 | |
763 | priv->cdev = cdev; | ||
764 | priv->int_class = IRQIO_CIO; | ||
765 | priv->state = DEV_STATE_NOT_OPER; | ||
766 | priv->dev_id.devno = sch->schib.pmcw.dev; | ||
767 | priv->dev_id.ssid = sch->schid.ssid; | ||
768 | priv->schid = sch->schid; | ||
769 | |||
770 | INIT_WORK(&priv->todo_work, ccw_device_todo); | ||
771 | INIT_LIST_HEAD(&priv->cmb_list); | ||
772 | init_waitqueue_head(&priv->wait_q); | ||
773 | init_timer(&priv->timer); | ||
774 | |||
775 | atomic_set(&priv->onoff, 0); | ||
776 | cdev->ccwlock = sch->lock; | ||
770 | cdev->dev.parent = &sch->dev; | 777 | cdev->dev.parent = &sch->dev; |
771 | cdev->dev.release = ccw_device_release; | 778 | cdev->dev.release = ccw_device_release; |
772 | INIT_WORK(&cdev->private->todo_work, ccw_device_todo); | ||
773 | cdev->dev.groups = ccwdev_attr_groups; | 779 | cdev->dev.groups = ccwdev_attr_groups; |
774 | /* Do first half of device_register. */ | 780 | /* Do first half of device_register. */ |
775 | device_initialize(&cdev->dev); | 781 | device_initialize(&cdev->dev); |
782 | ret = dev_set_name(&cdev->dev, "0.%x.%04x", cdev->private->dev_id.ssid, | ||
783 | cdev->private->dev_id.devno); | ||
784 | if (ret) | ||
785 | goto out_put; | ||
776 | if (!get_device(&sch->dev)) { | 786 | if (!get_device(&sch->dev)) { |
777 | /* Release reference from device_initialize(). */ | 787 | ret = -ENODEV; |
778 | put_device(&cdev->dev); | 788 | goto out_put; |
779 | return -ENODEV; | ||
780 | } | 789 | } |
781 | cdev->private->flags.initialized = 1; | 790 | priv->flags.initialized = 1; |
791 | spin_lock_irq(sch->lock); | ||
792 | sch_set_cdev(sch, cdev); | ||
793 | spin_unlock_irq(sch->lock); | ||
782 | return 0; | 794 | return 0; |
795 | |||
796 | out_put: | ||
797 | /* Release reference from device_initialize(). */ | ||
798 | put_device(&cdev->dev); | ||
799 | return ret; | ||
783 | } | 800 | } |
784 | 801 | ||
785 | static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch) | 802 | static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch) |
@@ -858,7 +875,7 @@ static void io_subchannel_register(struct ccw_device *cdev) | |||
858 | dev_set_uevent_suppress(&sch->dev, 0); | 875 | dev_set_uevent_suppress(&sch->dev, 0); |
859 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); | 876 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
860 | /* make it known to the system */ | 877 | /* make it known to the system */ |
861 | ret = ccw_device_register(cdev); | 878 | ret = ccw_device_add(cdev); |
862 | if (ret) { | 879 | if (ret) { |
863 | CIO_MSG_EVENT(0, "Could not register ccw dev 0.%x.%04x: %d\n", | 880 | CIO_MSG_EVENT(0, "Could not register ccw dev 0.%x.%04x: %d\n", |
864 | cdev->private->dev_id.ssid, | 881 | cdev->private->dev_id.ssid, |
@@ -923,26 +940,11 @@ io_subchannel_recog_done(struct ccw_device *cdev) | |||
923 | 940 | ||
924 | static void io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch) | 941 | static void io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch) |
925 | { | 942 | { |
926 | struct ccw_device_private *priv; | ||
927 | |||
928 | cdev->ccwlock = sch->lock; | ||
929 | |||
930 | /* Init private data. */ | ||
931 | priv = cdev->private; | ||
932 | priv->dev_id.devno = sch->schib.pmcw.dev; | ||
933 | priv->dev_id.ssid = sch->schid.ssid; | ||
934 | priv->schid = sch->schid; | ||
935 | priv->state = DEV_STATE_NOT_OPER; | ||
936 | INIT_LIST_HEAD(&priv->cmb_list); | ||
937 | init_waitqueue_head(&priv->wait_q); | ||
938 | init_timer(&priv->timer); | ||
939 | |||
940 | /* Increase counter of devices currently in recognition. */ | 943 | /* Increase counter of devices currently in recognition. */ |
941 | atomic_inc(&ccw_device_init_count); | 944 | atomic_inc(&ccw_device_init_count); |
942 | 945 | ||
943 | /* Start async. device sensing. */ | 946 | /* Start async. device sensing. */ |
944 | spin_lock_irq(sch->lock); | 947 | spin_lock_irq(sch->lock); |
945 | sch_set_cdev(sch, cdev); | ||
946 | ccw_device_recognition(cdev); | 948 | ccw_device_recognition(cdev); |
947 | spin_unlock_irq(sch->lock); | 949 | spin_unlock_irq(sch->lock); |
948 | } | 950 | } |
@@ -1083,7 +1085,7 @@ static int io_subchannel_probe(struct subchannel *sch) | |||
1083 | dev_set_uevent_suppress(&sch->dev, 0); | 1085 | dev_set_uevent_suppress(&sch->dev, 0); |
1084 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); | 1086 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
1085 | cdev = sch_get_cdev(sch); | 1087 | cdev = sch_get_cdev(sch); |
1086 | rc = ccw_device_register(cdev); | 1088 | rc = ccw_device_add(cdev); |
1087 | if (rc) { | 1089 | if (rc) { |
1088 | /* Release online reference. */ | 1090 | /* Release online reference. */ |
1089 | put_device(&cdev->dev); | 1091 | put_device(&cdev->dev); |
@@ -1597,7 +1599,6 @@ int __init ccw_device_enable_console(struct ccw_device *cdev) | |||
1597 | if (rc) | 1599 | if (rc) |
1598 | return rc; | 1600 | return rc; |
1599 | sch->driver = &io_subchannel_driver; | 1601 | sch->driver = &io_subchannel_driver; |
1600 | sch_set_cdev(sch, cdev); | ||
1601 | io_subchannel_recog(cdev, sch); | 1602 | io_subchannel_recog(cdev, sch); |
1602 | /* Now wait for the async. recognition to come to an end. */ | 1603 | /* Now wait for the async. recognition to come to an end. */ |
1603 | spin_lock_irq(cdev->ccwlock); | 1604 | spin_lock_irq(cdev->ccwlock); |
@@ -1639,6 +1640,7 @@ struct ccw_device * __init ccw_device_create_console(struct ccw_driver *drv) | |||
1639 | put_device(&sch->dev); | 1640 | put_device(&sch->dev); |
1640 | return ERR_PTR(-ENOMEM); | 1641 | return ERR_PTR(-ENOMEM); |
1641 | } | 1642 | } |
1643 | set_io_private(sch, io_priv); | ||
1642 | cdev = io_subchannel_create_ccwdev(sch); | 1644 | cdev = io_subchannel_create_ccwdev(sch); |
1643 | if (IS_ERR(cdev)) { | 1645 | if (IS_ERR(cdev)) { |
1644 | put_device(&sch->dev); | 1646 | put_device(&sch->dev); |
@@ -1646,7 +1648,6 @@ struct ccw_device * __init ccw_device_create_console(struct ccw_driver *drv) | |||
1646 | return cdev; | 1648 | return cdev; |
1647 | } | 1649 | } |
1648 | cdev->drv = drv; | 1650 | cdev->drv = drv; |
1649 | set_io_private(sch, io_priv); | ||
1650 | ccw_device_set_int_class(cdev); | 1651 | ccw_device_set_int_class(cdev); |
1651 | return cdev; | 1652 | return cdev; |
1652 | } | 1653 | } |
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c index 4221b02085ad..f1f3baa8e6e4 100644 --- a/drivers/s390/cio/qdio_debug.c +++ b/drivers/s390/cio/qdio_debug.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/debugfs.h> | 7 | #include <linux/debugfs.h> |
8 | #include <linux/uaccess.h> | 8 | #include <linux/uaccess.h> |
9 | #include <linux/export.h> | 9 | #include <linux/export.h> |
10 | #include <linux/slab.h> | ||
10 | #include <asm/debug.h> | 11 | #include <asm/debug.h> |
11 | #include "qdio_debug.h" | 12 | #include "qdio_debug.h" |
12 | #include "qdio.h" | 13 | #include "qdio.h" |
@@ -16,11 +17,51 @@ debug_info_t *qdio_dbf_error; | |||
16 | 17 | ||
17 | static struct dentry *debugfs_root; | 18 | static struct dentry *debugfs_root; |
18 | #define QDIO_DEBUGFS_NAME_LEN 10 | 19 | #define QDIO_DEBUGFS_NAME_LEN 10 |
20 | #define QDIO_DBF_NAME_LEN 20 | ||
19 | 21 | ||
20 | void qdio_allocate_dbf(struct qdio_initialize *init_data, | 22 | struct qdio_dbf_entry { |
23 | char dbf_name[QDIO_DBF_NAME_LEN]; | ||
24 | debug_info_t *dbf_info; | ||
25 | struct list_head dbf_list; | ||
26 | }; | ||
27 | |||
28 | static LIST_HEAD(qdio_dbf_list); | ||
29 | static DEFINE_MUTEX(qdio_dbf_list_mutex); | ||
30 | |||
31 | static debug_info_t *qdio_get_dbf_entry(char *name) | ||
32 | { | ||
33 | struct qdio_dbf_entry *entry; | ||
34 | debug_info_t *rc = NULL; | ||
35 | |||
36 | mutex_lock(&qdio_dbf_list_mutex); | ||
37 | list_for_each_entry(entry, &qdio_dbf_list, dbf_list) { | ||
38 | if (strcmp(entry->dbf_name, name) == 0) { | ||
39 | rc = entry->dbf_info; | ||
40 | break; | ||
41 | } | ||
42 | } | ||
43 | mutex_unlock(&qdio_dbf_list_mutex); | ||
44 | return rc; | ||
45 | } | ||
46 | |||
47 | static void qdio_clear_dbf_list(void) | ||
48 | { | ||
49 | struct qdio_dbf_entry *entry, *tmp; | ||
50 | |||
51 | mutex_lock(&qdio_dbf_list_mutex); | ||
52 | list_for_each_entry_safe(entry, tmp, &qdio_dbf_list, dbf_list) { | ||
53 | list_del(&entry->dbf_list); | ||
54 | debug_unregister(entry->dbf_info); | ||
55 | kfree(entry); | ||
56 | } | ||
57 | mutex_unlock(&qdio_dbf_list_mutex); | ||
58 | } | ||
59 | |||
60 | int qdio_allocate_dbf(struct qdio_initialize *init_data, | ||
21 | struct qdio_irq *irq_ptr) | 61 | struct qdio_irq *irq_ptr) |
22 | { | 62 | { |
23 | char text[20]; | 63 | char text[QDIO_DBF_NAME_LEN]; |
64 | struct qdio_dbf_entry *new_entry; | ||
24 | 65 | ||
25 | DBF_EVENT("qfmt:%1d", init_data->q_format); | 66 | DBF_EVENT("qfmt:%1d", init_data->q_format); |
26 | DBF_HEX(init_data->adapter_name, 8); | 67 | DBF_HEX(init_data->adapter_name, 8); |
@@ -38,11 +79,34 @@ void qdio_allocate_dbf(struct qdio_initialize *init_data, | |||
38 | DBF_EVENT("irq:%8lx", (unsigned long)irq_ptr); | 79 | DBF_EVENT("irq:%8lx", (unsigned long)irq_ptr); |
39 | 80 | ||
40 | /* allocate trace view for the interface */ | 81 | /* allocate trace view for the interface */ |
41 | snprintf(text, 20, "qdio_%s", dev_name(&init_data->cdev->dev)); | 82 | snprintf(text, QDIO_DBF_NAME_LEN, "qdio_%s", |
42 | irq_ptr->debug_area = debug_register(text, 2, 1, 16); | 83 | dev_name(&init_data->cdev->dev)); |
43 | debug_register_view(irq_ptr->debug_area, &debug_hex_ascii_view); | 84 | irq_ptr->debug_area = qdio_get_dbf_entry(text); |
44 | debug_set_level(irq_ptr->debug_area, DBF_WARN); | 85 | if (irq_ptr->debug_area) |
45 | DBF_DEV_EVENT(DBF_ERR, irq_ptr, "dbf created"); | 86 | DBF_DEV_EVENT(DBF_ERR, irq_ptr, "dbf reused"); |
87 | else { | ||
88 | irq_ptr->debug_area = debug_register(text, 2, 1, 16); | ||
89 | if (!irq_ptr->debug_area) | ||
90 | return -ENOMEM; | ||
91 | if (debug_register_view(irq_ptr->debug_area, | ||
92 | &debug_hex_ascii_view)) { | ||
93 | debug_unregister(irq_ptr->debug_area); | ||
94 | return -ENOMEM; | ||
95 | } | ||
96 | debug_set_level(irq_ptr->debug_area, DBF_WARN); | ||
97 | DBF_DEV_EVENT(DBF_ERR, irq_ptr, "dbf created"); | ||
98 | new_entry = kzalloc(sizeof(struct qdio_dbf_entry), GFP_KERNEL); | ||
99 | if (!new_entry) { | ||
100 | debug_unregister(irq_ptr->debug_area); | ||
101 | return -ENOMEM; | ||
102 | } | ||
103 | strlcpy(new_entry->dbf_name, text, QDIO_DBF_NAME_LEN); | ||
104 | new_entry->dbf_info = irq_ptr->debug_area; | ||
105 | mutex_lock(&qdio_dbf_list_mutex); | ||
106 | list_add(&new_entry->dbf_list, &qdio_dbf_list); | ||
107 | mutex_unlock(&qdio_dbf_list_mutex); | ||
108 | } | ||
109 | return 0; | ||
46 | } | 110 | } |
47 | 111 | ||
48 | static int qstat_show(struct seq_file *m, void *v) | 112 | static int qstat_show(struct seq_file *m, void *v) |
@@ -300,6 +364,7 @@ int __init qdio_debug_init(void) | |||
300 | 364 | ||
301 | void qdio_debug_exit(void) | 365 | void qdio_debug_exit(void) |
302 | { | 366 | { |
367 | qdio_clear_dbf_list(); | ||
303 | debugfs_remove(debugfs_root); | 368 | debugfs_remove(debugfs_root); |
304 | if (qdio_dbf_setup) | 369 | if (qdio_dbf_setup) |
305 | debug_unregister(qdio_dbf_setup); | 370 | debug_unregister(qdio_dbf_setup); |
diff --git a/drivers/s390/cio/qdio_debug.h b/drivers/s390/cio/qdio_debug.h index dfac9bfefea3..f33ce8577619 100644 --- a/drivers/s390/cio/qdio_debug.h +++ b/drivers/s390/cio/qdio_debug.h | |||
@@ -75,7 +75,7 @@ static inline void DBF_DEV_HEX(struct qdio_irq *dev, void *addr, | |||
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | void qdio_allocate_dbf(struct qdio_initialize *init_data, | 78 | int qdio_allocate_dbf(struct qdio_initialize *init_data, |
79 | struct qdio_irq *irq_ptr); | 79 | struct qdio_irq *irq_ptr); |
80 | void qdio_setup_debug_entries(struct qdio_irq *irq_ptr, | 80 | void qdio_setup_debug_entries(struct qdio_irq *irq_ptr, |
81 | struct ccw_device *cdev); | 81 | struct ccw_device *cdev); |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 77466c4faabb..848e3b64ea6e 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
@@ -409,17 +409,16 @@ static inline void qdio_stop_polling(struct qdio_q *q) | |||
409 | set_buf_state(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT); | 409 | set_buf_state(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT); |
410 | } | 410 | } |
411 | 411 | ||
412 | static inline void account_sbals(struct qdio_q *q, int count) | 412 | static inline void account_sbals(struct qdio_q *q, unsigned int count) |
413 | { | 413 | { |
414 | int pos = 0; | 414 | int pos; |
415 | 415 | ||
416 | q->q_stats.nr_sbal_total += count; | 416 | q->q_stats.nr_sbal_total += count; |
417 | if (count == QDIO_MAX_BUFFERS_MASK) { | 417 | if (count == QDIO_MAX_BUFFERS_MASK) { |
418 | q->q_stats.nr_sbals[7]++; | 418 | q->q_stats.nr_sbals[7]++; |
419 | return; | 419 | return; |
420 | } | 420 | } |
421 | while (count >>= 1) | 421 | pos = ilog2(count); |
422 | pos++; | ||
423 | q->q_stats.nr_sbals[pos]++; | 422 | q->q_stats.nr_sbals[pos]++; |
424 | } | 423 | } |
425 | 424 | ||
@@ -1234,12 +1233,10 @@ int qdio_free(struct ccw_device *cdev) | |||
1234 | return -ENODEV; | 1233 | return -ENODEV; |
1235 | 1234 | ||
1236 | DBF_EVENT("qfree:%4x", cdev->private->schid.sch_no); | 1235 | DBF_EVENT("qfree:%4x", cdev->private->schid.sch_no); |
1236 | DBF_DEV_EVENT(DBF_ERR, irq_ptr, "dbf abandoned"); | ||
1237 | mutex_lock(&irq_ptr->setup_mutex); | 1237 | mutex_lock(&irq_ptr->setup_mutex); |
1238 | 1238 | ||
1239 | if (irq_ptr->debug_area != NULL) { | 1239 | irq_ptr->debug_area = NULL; |
1240 | debug_unregister(irq_ptr->debug_area); | ||
1241 | irq_ptr->debug_area = NULL; | ||
1242 | } | ||
1243 | cdev->private->qdio_data = NULL; | 1240 | cdev->private->qdio_data = NULL; |
1244 | mutex_unlock(&irq_ptr->setup_mutex); | 1241 | mutex_unlock(&irq_ptr->setup_mutex); |
1245 | 1242 | ||
@@ -1276,7 +1273,8 @@ int qdio_allocate(struct qdio_initialize *init_data) | |||
1276 | goto out_err; | 1273 | goto out_err; |
1277 | 1274 | ||
1278 | mutex_init(&irq_ptr->setup_mutex); | 1275 | mutex_init(&irq_ptr->setup_mutex); |
1279 | qdio_allocate_dbf(init_data, irq_ptr); | 1276 | if (qdio_allocate_dbf(init_data, irq_ptr)) |
1277 | goto out_rel; | ||
1280 | 1278 | ||
1281 | /* | 1279 | /* |
1282 | * Allocate a page for the chsc calls in qdio_establish. | 1280 | * Allocate a page for the chsc calls in qdio_establish. |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index 8eec1653c9cc..69ef4f8cfac8 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -77,12 +77,12 @@ MODULE_ALIAS("z90crypt"); | |||
77 | * Module parameter | 77 | * Module parameter |
78 | */ | 78 | */ |
79 | int ap_domain_index = -1; /* Adjunct Processor Domain Index */ | 79 | int ap_domain_index = -1; /* Adjunct Processor Domain Index */ |
80 | module_param_named(domain, ap_domain_index, int, 0000); | 80 | module_param_named(domain, ap_domain_index, int, S_IRUSR|S_IRGRP); |
81 | MODULE_PARM_DESC(domain, "domain index for ap devices"); | 81 | MODULE_PARM_DESC(domain, "domain index for ap devices"); |
82 | EXPORT_SYMBOL(ap_domain_index); | 82 | EXPORT_SYMBOL(ap_domain_index); |
83 | 83 | ||
84 | static int ap_thread_flag = 0; | 84 | static int ap_thread_flag = 0; |
85 | module_param_named(poll_thread, ap_thread_flag, int, 0000); | 85 | module_param_named(poll_thread, ap_thread_flag, int, S_IRUSR|S_IRGRP); |
86 | MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 0 (off)."); | 86 | MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 0 (off)."); |
87 | 87 | ||
88 | static struct device *ap_root_device = NULL; | 88 | static struct device *ap_root_device = NULL; |
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 5222ebe15705..0e18c5dcd91f 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c | |||
@@ -356,7 +356,7 @@ struct zcrypt_ops *zcrypt_msgtype_request(unsigned char *name, int variant) | |||
356 | 356 | ||
357 | zops = __ops_lookup(name, variant); | 357 | zops = __ops_lookup(name, variant); |
358 | if (!zops) { | 358 | if (!zops) { |
359 | request_module(name); | 359 | request_module("%s", name); |
360 | zops = __ops_lookup(name, variant); | 360 | zops = __ops_lookup(name, variant); |
361 | } | 361 | } |
362 | if ((!zops) || (!try_module_get(zops->owner))) | 362 | if ((!zops) || (!try_module_get(zops->owner))) |
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 554349029628..56467df3d6de 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -4198,6 +4198,8 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba) | |||
4198 | kfree(phba->ep_array); | 4198 | kfree(phba->ep_array); |
4199 | phba->ep_array = NULL; | 4199 | phba->ep_array = NULL; |
4200 | ret = -ENOMEM; | 4200 | ret = -ENOMEM; |
4201 | |||
4202 | goto free_memory; | ||
4201 | } | 4203 | } |
4202 | 4204 | ||
4203 | for (i = 0; i < phba->params.cxns_per_ctrl; i++) { | 4205 | for (i = 0; i < phba->params.cxns_per_ctrl; i++) { |
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index 6045aa78986a..07934b0b9ee1 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c | |||
@@ -1008,10 +1008,8 @@ int mgmt_set_ip(struct beiscsi_hba *phba, | |||
1008 | BE2_IPV6 : BE2_IPV4 ; | 1008 | BE2_IPV6 : BE2_IPV4 ; |
1009 | 1009 | ||
1010 | rc = mgmt_get_if_info(phba, ip_type, &if_info); | 1010 | rc = mgmt_get_if_info(phba, ip_type, &if_info); |
1011 | if (rc) { | 1011 | if (rc) |
1012 | kfree(if_info); | ||
1013 | return rc; | 1012 | return rc; |
1014 | } | ||
1015 | 1013 | ||
1016 | if (boot_proto == ISCSI_BOOTPROTO_DHCP) { | 1014 | if (boot_proto == ISCSI_BOOTPROTO_DHCP) { |
1017 | if (if_info->dhcp_state) { | 1015 | if (if_info->dhcp_state) { |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index f54843023466..785d0d71781e 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |||
@@ -516,23 +516,17 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) | |||
516 | skb_pull(skb, sizeof(struct fcoe_hdr)); | 516 | skb_pull(skb, sizeof(struct fcoe_hdr)); |
517 | fr_len = skb->len - sizeof(struct fcoe_crc_eof); | 517 | fr_len = skb->len - sizeof(struct fcoe_crc_eof); |
518 | 518 | ||
519 | stats = per_cpu_ptr(lport->stats, get_cpu()); | ||
520 | stats->RxFrames++; | ||
521 | stats->RxWords += fr_len / FCOE_WORD_TO_BYTE; | ||
522 | |||
523 | fp = (struct fc_frame *)skb; | 519 | fp = (struct fc_frame *)skb; |
524 | fc_frame_init(fp); | 520 | fc_frame_init(fp); |
525 | fr_dev(fp) = lport; | 521 | fr_dev(fp) = lport; |
526 | fr_sof(fp) = hp->fcoe_sof; | 522 | fr_sof(fp) = hp->fcoe_sof; |
527 | if (skb_copy_bits(skb, fr_len, &crc_eof, sizeof(crc_eof))) { | 523 | if (skb_copy_bits(skb, fr_len, &crc_eof, sizeof(crc_eof))) { |
528 | put_cpu(); | ||
529 | kfree_skb(skb); | 524 | kfree_skb(skb); |
530 | return; | 525 | return; |
531 | } | 526 | } |
532 | fr_eof(fp) = crc_eof.fcoe_eof; | 527 | fr_eof(fp) = crc_eof.fcoe_eof; |
533 | fr_crc(fp) = crc_eof.fcoe_crc32; | 528 | fr_crc(fp) = crc_eof.fcoe_crc32; |
534 | if (pskb_trim(skb, fr_len)) { | 529 | if (pskb_trim(skb, fr_len)) { |
535 | put_cpu(); | ||
536 | kfree_skb(skb); | 530 | kfree_skb(skb); |
537 | return; | 531 | return; |
538 | } | 532 | } |
@@ -544,7 +538,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) | |||
544 | port = lport_priv(vn_port); | 538 | port = lport_priv(vn_port); |
545 | if (!ether_addr_equal(port->data_src_addr, dest_mac)) { | 539 | if (!ether_addr_equal(port->data_src_addr, dest_mac)) { |
546 | BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); | 540 | BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); |
547 | put_cpu(); | ||
548 | kfree_skb(skb); | 541 | kfree_skb(skb); |
549 | return; | 542 | return; |
550 | } | 543 | } |
@@ -552,7 +545,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) | |||
552 | if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA && | 545 | if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA && |
553 | fh->fh_type == FC_TYPE_FCP) { | 546 | fh->fh_type == FC_TYPE_FCP) { |
554 | /* Drop FCP data. We dont this in L2 path */ | 547 | /* Drop FCP data. We dont this in L2 path */ |
555 | put_cpu(); | ||
556 | kfree_skb(skb); | 548 | kfree_skb(skb); |
557 | return; | 549 | return; |
558 | } | 550 | } |
@@ -562,7 +554,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) | |||
562 | case ELS_LOGO: | 554 | case ELS_LOGO: |
563 | if (ntoh24(fh->fh_s_id) == FC_FID_FLOGI) { | 555 | if (ntoh24(fh->fh_s_id) == FC_FID_FLOGI) { |
564 | /* drop non-FIP LOGO */ | 556 | /* drop non-FIP LOGO */ |
565 | put_cpu(); | ||
566 | kfree_skb(skb); | 557 | kfree_skb(skb); |
567 | return; | 558 | return; |
568 | } | 559 | } |
@@ -572,22 +563,23 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) | |||
572 | 563 | ||
573 | if (fh->fh_r_ctl == FC_RCTL_BA_ABTS) { | 564 | if (fh->fh_r_ctl == FC_RCTL_BA_ABTS) { |
574 | /* Drop incoming ABTS */ | 565 | /* Drop incoming ABTS */ |
575 | put_cpu(); | ||
576 | kfree_skb(skb); | 566 | kfree_skb(skb); |
577 | return; | 567 | return; |
578 | } | 568 | } |
579 | 569 | ||
570 | stats = per_cpu_ptr(lport->stats, smp_processor_id()); | ||
571 | stats->RxFrames++; | ||
572 | stats->RxWords += fr_len / FCOE_WORD_TO_BYTE; | ||
573 | |||
580 | if (le32_to_cpu(fr_crc(fp)) != | 574 | if (le32_to_cpu(fr_crc(fp)) != |
581 | ~crc32(~0, skb->data, fr_len)) { | 575 | ~crc32(~0, skb->data, fr_len)) { |
582 | if (stats->InvalidCRCCount < 5) | 576 | if (stats->InvalidCRCCount < 5) |
583 | printk(KERN_WARNING PFX "dropping frame with " | 577 | printk(KERN_WARNING PFX "dropping frame with " |
584 | "CRC error\n"); | 578 | "CRC error\n"); |
585 | stats->InvalidCRCCount++; | 579 | stats->InvalidCRCCount++; |
586 | put_cpu(); | ||
587 | kfree_skb(skb); | 580 | kfree_skb(skb); |
588 | return; | 581 | return; |
589 | } | 582 | } |
590 | put_cpu(); | ||
591 | fc_exch_recv(lport, fp); | 583 | fc_exch_recv(lport, fp); |
592 | } | 584 | } |
593 | 585 | ||
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index 32a5e0a2a669..7bc47fc7c686 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c | |||
@@ -282,6 +282,8 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba) | |||
282 | arr_sz, GFP_KERNEL); | 282 | arr_sz, GFP_KERNEL); |
283 | if (!cmgr->free_list_lock) { | 283 | if (!cmgr->free_list_lock) { |
284 | printk(KERN_ERR PFX "failed to alloc free_list_lock\n"); | 284 | printk(KERN_ERR PFX "failed to alloc free_list_lock\n"); |
285 | kfree(cmgr->free_list); | ||
286 | cmgr->free_list = NULL; | ||
285 | goto mem_err; | 287 | goto mem_err; |
286 | } | 288 | } |
287 | 289 | ||
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 2ebfb2bb0f42..7b23f21f22f1 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -185,6 +185,11 @@ static struct viosrp_crq *crq_queue_next_crq(struct crq_queue *queue) | |||
185 | if (crq->valid & 0x80) { | 185 | if (crq->valid & 0x80) { |
186 | if (++queue->cur == queue->size) | 186 | if (++queue->cur == queue->size) |
187 | queue->cur = 0; | 187 | queue->cur = 0; |
188 | |||
189 | /* Ensure the read of the valid bit occurs before reading any | ||
190 | * other bits of the CRQ entry | ||
191 | */ | ||
192 | rmb(); | ||
188 | } else | 193 | } else |
189 | crq = NULL; | 194 | crq = NULL; |
190 | spin_unlock_irqrestore(&queue->lock, flags); | 195 | spin_unlock_irqrestore(&queue->lock, flags); |
@@ -203,6 +208,11 @@ static int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata, | |||
203 | { | 208 | { |
204 | struct vio_dev *vdev = to_vio_dev(hostdata->dev); | 209 | struct vio_dev *vdev = to_vio_dev(hostdata->dev); |
205 | 210 | ||
211 | /* | ||
212 | * Ensure the command buffer is flushed to memory before handing it | ||
213 | * over to the VIOS to prevent it from fetching any stale data. | ||
214 | */ | ||
215 | mb(); | ||
206 | return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2); | 216 | return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2); |
207 | } | 217 | } |
208 | 218 | ||
@@ -797,7 +807,8 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code) | |||
797 | evt->hostdata->dev); | 807 | evt->hostdata->dev); |
798 | if (evt->cmnd_done) | 808 | if (evt->cmnd_done) |
799 | evt->cmnd_done(evt->cmnd); | 809 | evt->cmnd_done(evt->cmnd); |
800 | } else if (evt->done) | 810 | } else if (evt->done && evt->crq.format != VIOSRP_MAD_FORMAT && |
811 | evt->iu.srp.login_req.opcode != SRP_LOGIN_REQ) | ||
801 | evt->done(evt); | 812 | evt->done(evt); |
802 | free_event_struct(&evt->hostdata->pool, evt); | 813 | free_event_struct(&evt->hostdata->pool, evt); |
803 | spin_lock_irqsave(hostdata->host->host_lock, flags); | 814 | spin_lock_irqsave(hostdata->host->host_lock, flags); |
diff --git a/drivers/scsi/mvsas/mv_94xx.c b/drivers/scsi/mvsas/mv_94xx.c index 1e4479f3331a..9270d15ff1a4 100644 --- a/drivers/scsi/mvsas/mv_94xx.c +++ b/drivers/scsi/mvsas/mv_94xx.c | |||
@@ -564,7 +564,7 @@ static void mvs_94xx_interrupt_enable(struct mvs_info *mvi) | |||
564 | u32 tmp; | 564 | u32 tmp; |
565 | 565 | ||
566 | tmp = mr32(MVS_GBL_CTL); | 566 | tmp = mr32(MVS_GBL_CTL); |
567 | tmp |= (IRQ_SAS_A | IRQ_SAS_B); | 567 | tmp |= (MVS_IRQ_SAS_A | MVS_IRQ_SAS_B); |
568 | mw32(MVS_GBL_INT_STAT, tmp); | 568 | mw32(MVS_GBL_INT_STAT, tmp); |
569 | writel(tmp, regs + 0x0C); | 569 | writel(tmp, regs + 0x0C); |
570 | writel(tmp, regs + 0x10); | 570 | writel(tmp, regs + 0x10); |
@@ -580,7 +580,7 @@ static void mvs_94xx_interrupt_disable(struct mvs_info *mvi) | |||
580 | 580 | ||
581 | tmp = mr32(MVS_GBL_CTL); | 581 | tmp = mr32(MVS_GBL_CTL); |
582 | 582 | ||
583 | tmp &= ~(IRQ_SAS_A | IRQ_SAS_B); | 583 | tmp &= ~(MVS_IRQ_SAS_A | MVS_IRQ_SAS_B); |
584 | mw32(MVS_GBL_INT_STAT, tmp); | 584 | mw32(MVS_GBL_INT_STAT, tmp); |
585 | writel(tmp, regs + 0x0C); | 585 | writel(tmp, regs + 0x0C); |
586 | writel(tmp, regs + 0x10); | 586 | writel(tmp, regs + 0x10); |
@@ -596,7 +596,7 @@ static u32 mvs_94xx_isr_status(struct mvs_info *mvi, int irq) | |||
596 | if (!(mvi->flags & MVF_FLAG_SOC)) { | 596 | if (!(mvi->flags & MVF_FLAG_SOC)) { |
597 | stat = mr32(MVS_GBL_INT_STAT); | 597 | stat = mr32(MVS_GBL_INT_STAT); |
598 | 598 | ||
599 | if (!(stat & (IRQ_SAS_A | IRQ_SAS_B))) | 599 | if (!(stat & (MVS_IRQ_SAS_A | MVS_IRQ_SAS_B))) |
600 | return 0; | 600 | return 0; |
601 | } | 601 | } |
602 | return stat; | 602 | return stat; |
@@ -606,8 +606,8 @@ static irqreturn_t mvs_94xx_isr(struct mvs_info *mvi, int irq, u32 stat) | |||
606 | { | 606 | { |
607 | void __iomem *regs = mvi->regs; | 607 | void __iomem *regs = mvi->regs; |
608 | 608 | ||
609 | if (((stat & IRQ_SAS_A) && mvi->id == 0) || | 609 | if (((stat & MVS_IRQ_SAS_A) && mvi->id == 0) || |
610 | ((stat & IRQ_SAS_B) && mvi->id == 1)) { | 610 | ((stat & MVS_IRQ_SAS_B) && mvi->id == 1)) { |
611 | mw32_f(MVS_INT_STAT, CINT_DONE); | 611 | mw32_f(MVS_INT_STAT, CINT_DONE); |
612 | 612 | ||
613 | spin_lock(&mvi->lock); | 613 | spin_lock(&mvi->lock); |
diff --git a/drivers/scsi/mvsas/mv_94xx.h b/drivers/scsi/mvsas/mv_94xx.h index 487aa6f97412..14e197497b46 100644 --- a/drivers/scsi/mvsas/mv_94xx.h +++ b/drivers/scsi/mvsas/mv_94xx.h | |||
@@ -150,35 +150,35 @@ enum chip_register_bits { | |||
150 | 150 | ||
151 | enum pci_interrupt_cause { | 151 | enum pci_interrupt_cause { |
152 | /* MAIN_IRQ_CAUSE (R10200) Bits*/ | 152 | /* MAIN_IRQ_CAUSE (R10200) Bits*/ |
153 | IRQ_COM_IN_I2O_IOP0 = (1 << 0), | 153 | MVS_IRQ_COM_IN_I2O_IOP0 = (1 << 0), |
154 | IRQ_COM_IN_I2O_IOP1 = (1 << 1), | 154 | MVS_IRQ_COM_IN_I2O_IOP1 = (1 << 1), |
155 | IRQ_COM_IN_I2O_IOP2 = (1 << 2), | 155 | MVS_IRQ_COM_IN_I2O_IOP2 = (1 << 2), |
156 | IRQ_COM_IN_I2O_IOP3 = (1 << 3), | 156 | MVS_IRQ_COM_IN_I2O_IOP3 = (1 << 3), |
157 | IRQ_COM_OUT_I2O_HOS0 = (1 << 4), | 157 | MVS_IRQ_COM_OUT_I2O_HOS0 = (1 << 4), |
158 | IRQ_COM_OUT_I2O_HOS1 = (1 << 5), | 158 | MVS_IRQ_COM_OUT_I2O_HOS1 = (1 << 5), |
159 | IRQ_COM_OUT_I2O_HOS2 = (1 << 6), | 159 | MVS_IRQ_COM_OUT_I2O_HOS2 = (1 << 6), |
160 | IRQ_COM_OUT_I2O_HOS3 = (1 << 7), | 160 | MVS_IRQ_COM_OUT_I2O_HOS3 = (1 << 7), |
161 | IRQ_PCIF_TO_CPU_DRBL0 = (1 << 8), | 161 | MVS_IRQ_PCIF_TO_CPU_DRBL0 = (1 << 8), |
162 | IRQ_PCIF_TO_CPU_DRBL1 = (1 << 9), | 162 | MVS_IRQ_PCIF_TO_CPU_DRBL1 = (1 << 9), |
163 | IRQ_PCIF_TO_CPU_DRBL2 = (1 << 10), | 163 | MVS_IRQ_PCIF_TO_CPU_DRBL2 = (1 << 10), |
164 | IRQ_PCIF_TO_CPU_DRBL3 = (1 << 11), | 164 | MVS_IRQ_PCIF_TO_CPU_DRBL3 = (1 << 11), |
165 | IRQ_PCIF_DRBL0 = (1 << 12), | 165 | MVS_IRQ_PCIF_DRBL0 = (1 << 12), |
166 | IRQ_PCIF_DRBL1 = (1 << 13), | 166 | MVS_IRQ_PCIF_DRBL1 = (1 << 13), |
167 | IRQ_PCIF_DRBL2 = (1 << 14), | 167 | MVS_IRQ_PCIF_DRBL2 = (1 << 14), |
168 | IRQ_PCIF_DRBL3 = (1 << 15), | 168 | MVS_IRQ_PCIF_DRBL3 = (1 << 15), |
169 | IRQ_XOR_A = (1 << 16), | 169 | MVS_IRQ_XOR_A = (1 << 16), |
170 | IRQ_XOR_B = (1 << 17), | 170 | MVS_IRQ_XOR_B = (1 << 17), |
171 | IRQ_SAS_A = (1 << 18), | 171 | MVS_IRQ_SAS_A = (1 << 18), |
172 | IRQ_SAS_B = (1 << 19), | 172 | MVS_IRQ_SAS_B = (1 << 19), |
173 | IRQ_CPU_CNTRL = (1 << 20), | 173 | MVS_IRQ_CPU_CNTRL = (1 << 20), |
174 | IRQ_GPIO = (1 << 21), | 174 | MVS_IRQ_GPIO = (1 << 21), |
175 | IRQ_UART = (1 << 22), | 175 | MVS_IRQ_UART = (1 << 22), |
176 | IRQ_SPI = (1 << 23), | 176 | MVS_IRQ_SPI = (1 << 23), |
177 | IRQ_I2C = (1 << 24), | 177 | MVS_IRQ_I2C = (1 << 24), |
178 | IRQ_SGPIO = (1 << 25), | 178 | MVS_IRQ_SGPIO = (1 << 25), |
179 | IRQ_COM_ERR = (1 << 29), | 179 | MVS_IRQ_COM_ERR = (1 << 29), |
180 | IRQ_I2O_ERR = (1 << 30), | 180 | MVS_IRQ_I2O_ERR = (1 << 30), |
181 | IRQ_PCIE_ERR = (1 << 31), | 181 | MVS_IRQ_PCIE_ERR = (1 << 31), |
182 | }; | 182 | }; |
183 | 183 | ||
184 | union reg_phy_cfg { | 184 | union reg_phy_cfg { |
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index c4f31b21feb8..e90c89f1d480 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c | |||
@@ -677,7 +677,7 @@ static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha) | |||
677 | * pm8001_get_phy_settings_info : Read phy setting values. | 677 | * pm8001_get_phy_settings_info : Read phy setting values. |
678 | * @pm8001_ha : our hba. | 678 | * @pm8001_ha : our hba. |
679 | */ | 679 | */ |
680 | void pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha) | 680 | static int pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha) |
681 | { | 681 | { |
682 | 682 | ||
683 | #ifdef PM8001_READ_VPD | 683 | #ifdef PM8001_READ_VPD |
@@ -691,11 +691,15 @@ void pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha) | |||
691 | payload.offset = 0; | 691 | payload.offset = 0; |
692 | payload.length = 4096; | 692 | payload.length = 4096; |
693 | payload.func_specific = kzalloc(4096, GFP_KERNEL); | 693 | payload.func_specific = kzalloc(4096, GFP_KERNEL); |
694 | if (!payload.func_specific) | ||
695 | return -ENOMEM; | ||
694 | /* Read phy setting values from flash */ | 696 | /* Read phy setting values from flash */ |
695 | PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); | 697 | PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); |
696 | wait_for_completion(&completion); | 698 | wait_for_completion(&completion); |
697 | pm8001_set_phy_profile(pm8001_ha, sizeof(u8), payload.func_specific); | 699 | pm8001_set_phy_profile(pm8001_ha, sizeof(u8), payload.func_specific); |
700 | kfree(payload.func_specific); | ||
698 | #endif | 701 | #endif |
702 | return 0; | ||
699 | } | 703 | } |
700 | 704 | ||
701 | #ifdef PM8001_USE_MSIX | 705 | #ifdef PM8001_USE_MSIX |
@@ -879,8 +883,11 @@ static int pm8001_pci_probe(struct pci_dev *pdev, | |||
879 | pm8001_init_sas_add(pm8001_ha); | 883 | pm8001_init_sas_add(pm8001_ha); |
880 | /* phy setting support for motherboard controller */ | 884 | /* phy setting support for motherboard controller */ |
881 | if (pdev->subsystem_vendor != PCI_VENDOR_ID_ADAPTEC2 && | 885 | if (pdev->subsystem_vendor != PCI_VENDOR_ID_ADAPTEC2 && |
882 | pdev->subsystem_vendor != 0) | 886 | pdev->subsystem_vendor != 0) { |
883 | pm8001_get_phy_settings_info(pm8001_ha); | 887 | rc = pm8001_get_phy_settings_info(pm8001_ha); |
888 | if (rc) | ||
889 | goto err_out_shost; | ||
890 | } | ||
884 | pm8001_post_sas_ha_init(shost, chip); | 891 | pm8001_post_sas_ha_init(shost, chip); |
885 | rc = sas_register_ha(SHOST_TO_SAS_HA(shost)); | 892 | rc = sas_register_ha(SHOST_TO_SAS_HA(shost)); |
886 | if (rc) | 893 | if (rc) |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 4b188b0164e9..e632e14180cf 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
@@ -1128,7 +1128,7 @@ static void qlt_24xx_retry_term_exchange(struct scsi_qla_host *vha, | |||
1128 | ctio->u.status1.flags = | 1128 | ctio->u.status1.flags = |
1129 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | | 1129 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | |
1130 | CTIO7_FLAGS_TERMINATE); | 1130 | CTIO7_FLAGS_TERMINATE); |
1131 | ctio->u.status1.ox_id = entry->fcp_hdr_le.ox_id; | 1131 | ctio->u.status1.ox_id = cpu_to_le16(entry->fcp_hdr_le.ox_id); |
1132 | 1132 | ||
1133 | qla2x00_start_iocbs(vha, vha->req); | 1133 | qla2x00_start_iocbs(vha, vha->req); |
1134 | 1134 | ||
@@ -1262,6 +1262,7 @@ static void qlt_24xx_send_task_mgmt_ctio(struct scsi_qla_host *ha, | |||
1262 | { | 1262 | { |
1263 | struct atio_from_isp *atio = &mcmd->orig_iocb.atio; | 1263 | struct atio_from_isp *atio = &mcmd->orig_iocb.atio; |
1264 | struct ctio7_to_24xx *ctio; | 1264 | struct ctio7_to_24xx *ctio; |
1265 | uint16_t temp; | ||
1265 | 1266 | ||
1266 | ql_dbg(ql_dbg_tgt, ha, 0xe008, | 1267 | ql_dbg(ql_dbg_tgt, ha, 0xe008, |
1267 | "Sending task mgmt CTIO7 (ha=%p, atio=%p, resp_code=%x\n", | 1268 | "Sending task mgmt CTIO7 (ha=%p, atio=%p, resp_code=%x\n", |
@@ -1292,7 +1293,8 @@ static void qlt_24xx_send_task_mgmt_ctio(struct scsi_qla_host *ha, | |||
1292 | ctio->u.status1.flags = (atio->u.isp24.attr << 9) | | 1293 | ctio->u.status1.flags = (atio->u.isp24.attr << 9) | |
1293 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | | 1294 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | |
1294 | CTIO7_FLAGS_SEND_STATUS); | 1295 | CTIO7_FLAGS_SEND_STATUS); |
1295 | ctio->u.status1.ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id); | 1296 | temp = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id); |
1297 | ctio->u.status1.ox_id = cpu_to_le16(temp); | ||
1296 | ctio->u.status1.scsi_status = | 1298 | ctio->u.status1.scsi_status = |
1297 | __constant_cpu_to_le16(SS_RESPONSE_INFO_LEN_VALID); | 1299 | __constant_cpu_to_le16(SS_RESPONSE_INFO_LEN_VALID); |
1298 | ctio->u.status1.response_len = __constant_cpu_to_le16(8); | 1300 | ctio->u.status1.response_len = __constant_cpu_to_le16(8); |
@@ -1513,6 +1515,7 @@ static int qlt_24xx_build_ctio_pkt(struct qla_tgt_prm *prm, | |||
1513 | struct ctio7_to_24xx *pkt; | 1515 | struct ctio7_to_24xx *pkt; |
1514 | struct qla_hw_data *ha = vha->hw; | 1516 | struct qla_hw_data *ha = vha->hw; |
1515 | struct atio_from_isp *atio = &prm->cmd->atio; | 1517 | struct atio_from_isp *atio = &prm->cmd->atio; |
1518 | uint16_t temp; | ||
1516 | 1519 | ||
1517 | pkt = (struct ctio7_to_24xx *)vha->req->ring_ptr; | 1520 | pkt = (struct ctio7_to_24xx *)vha->req->ring_ptr; |
1518 | prm->pkt = pkt; | 1521 | prm->pkt = pkt; |
@@ -1541,13 +1544,13 @@ static int qlt_24xx_build_ctio_pkt(struct qla_tgt_prm *prm, | |||
1541 | pkt->initiator_id[2] = atio->u.isp24.fcp_hdr.s_id[0]; | 1544 | pkt->initiator_id[2] = atio->u.isp24.fcp_hdr.s_id[0]; |
1542 | pkt->exchange_addr = atio->u.isp24.exchange_addr; | 1545 | pkt->exchange_addr = atio->u.isp24.exchange_addr; |
1543 | pkt->u.status0.flags |= (atio->u.isp24.attr << 9); | 1546 | pkt->u.status0.flags |= (atio->u.isp24.attr << 9); |
1544 | pkt->u.status0.ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id); | 1547 | temp = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id); |
1548 | pkt->u.status0.ox_id = cpu_to_le16(temp); | ||
1545 | pkt->u.status0.relative_offset = cpu_to_le32(prm->cmd->offset); | 1549 | pkt->u.status0.relative_offset = cpu_to_le32(prm->cmd->offset); |
1546 | 1550 | ||
1547 | ql_dbg(ql_dbg_tgt, vha, 0xe00c, | 1551 | ql_dbg(ql_dbg_tgt, vha, 0xe00c, |
1548 | "qla_target(%d): handle(cmd) -> %08x, timeout %d, ox_id %#x\n", | 1552 | "qla_target(%d): handle(cmd) -> %08x, timeout %d, ox_id %#x\n", |
1549 | vha->vp_idx, pkt->handle, QLA_TGT_TIMEOUT, | 1553 | vha->vp_idx, pkt->handle, QLA_TGT_TIMEOUT, temp); |
1550 | le16_to_cpu(pkt->u.status0.ox_id)); | ||
1551 | return 0; | 1554 | return 0; |
1552 | } | 1555 | } |
1553 | 1556 | ||
@@ -2619,6 +2622,7 @@ static int __qlt_send_term_exchange(struct scsi_qla_host *vha, | |||
2619 | struct qla_hw_data *ha = vha->hw; | 2622 | struct qla_hw_data *ha = vha->hw; |
2620 | request_t *pkt; | 2623 | request_t *pkt; |
2621 | int ret = 0; | 2624 | int ret = 0; |
2625 | uint16_t temp; | ||
2622 | 2626 | ||
2623 | ql_dbg(ql_dbg_tgt, vha, 0xe01c, "Sending TERM EXCH CTIO (ha=%p)\n", ha); | 2627 | ql_dbg(ql_dbg_tgt, vha, 0xe01c, "Sending TERM EXCH CTIO (ha=%p)\n", ha); |
2624 | 2628 | ||
@@ -2655,7 +2659,8 @@ static int __qlt_send_term_exchange(struct scsi_qla_host *vha, | |||
2655 | ctio24->u.status1.flags = (atio->u.isp24.attr << 9) | | 2659 | ctio24->u.status1.flags = (atio->u.isp24.attr << 9) | |
2656 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | | 2660 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | |
2657 | CTIO7_FLAGS_TERMINATE); | 2661 | CTIO7_FLAGS_TERMINATE); |
2658 | ctio24->u.status1.ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id); | 2662 | temp = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id); |
2663 | ctio24->u.status1.ox_id = cpu_to_le16(temp); | ||
2659 | 2664 | ||
2660 | /* Most likely, it isn't needed */ | 2665 | /* Most likely, it isn't needed */ |
2661 | ctio24->u.status1.residual = get_unaligned((uint32_t *) | 2666 | ctio24->u.status1.residual = get_unaligned((uint32_t *) |
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index e0a58fd13f66..d1d24fb0160a 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h | |||
@@ -443,7 +443,7 @@ struct ctio7_to_24xx { | |||
443 | uint16_t reserved1; | 443 | uint16_t reserved1; |
444 | __le16 flags; | 444 | __le16 flags; |
445 | uint32_t residual; | 445 | uint32_t residual; |
446 | uint16_t ox_id; | 446 | __le16 ox_id; |
447 | uint16_t scsi_status; | 447 | uint16_t scsi_status; |
448 | uint32_t relative_offset; | 448 | uint32_t relative_offset; |
449 | uint32_t reserved2; | 449 | uint32_t reserved2; |
@@ -458,7 +458,7 @@ struct ctio7_to_24xx { | |||
458 | uint16_t sense_length; | 458 | uint16_t sense_length; |
459 | uint16_t flags; | 459 | uint16_t flags; |
460 | uint32_t residual; | 460 | uint32_t residual; |
461 | uint16_t ox_id; | 461 | __le16 ox_id; |
462 | uint16_t scsi_status; | 462 | uint16_t scsi_status; |
463 | uint16_t response_len; | 463 | uint16_t response_len; |
464 | uint16_t reserved; | 464 | uint16_t reserved; |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index cbe38e5e7955..7e957918f33f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -131,7 +131,7 @@ scmd_eh_abort_handler(struct work_struct *work) | |||
131 | "aborting command %p\n", scmd)); | 131 | "aborting command %p\n", scmd)); |
132 | rtn = scsi_try_to_abort_cmd(sdev->host->hostt, scmd); | 132 | rtn = scsi_try_to_abort_cmd(sdev->host->hostt, scmd); |
133 | if (rtn == SUCCESS) { | 133 | if (rtn == SUCCESS) { |
134 | scmd->result |= DID_TIME_OUT << 16; | 134 | set_host_byte(scmd, DID_TIME_OUT); |
135 | if (scsi_host_eh_past_deadline(sdev->host)) { | 135 | if (scsi_host_eh_past_deadline(sdev->host)) { |
136 | SCSI_LOG_ERROR_RECOVERY(3, | 136 | SCSI_LOG_ERROR_RECOVERY(3, |
137 | scmd_printk(KERN_INFO, scmd, | 137 | scmd_printk(KERN_INFO, scmd, |
@@ -167,7 +167,7 @@ scmd_eh_abort_handler(struct work_struct *work) | |||
167 | scmd_printk(KERN_WARNING, scmd, | 167 | scmd_printk(KERN_WARNING, scmd, |
168 | "scmd %p terminate " | 168 | "scmd %p terminate " |
169 | "aborted command\n", scmd)); | 169 | "aborted command\n", scmd)); |
170 | scmd->result |= DID_TIME_OUT << 16; | 170 | set_host_byte(scmd, DID_TIME_OUT); |
171 | scsi_finish_command(scmd); | 171 | scsi_finish_command(scmd); |
172 | } | 172 | } |
173 | } | 173 | } |
@@ -287,15 +287,15 @@ enum blk_eh_timer_return scsi_times_out(struct request *req) | |||
287 | else if (host->hostt->eh_timed_out) | 287 | else if (host->hostt->eh_timed_out) |
288 | rtn = host->hostt->eh_timed_out(scmd); | 288 | rtn = host->hostt->eh_timed_out(scmd); |
289 | 289 | ||
290 | if (rtn == BLK_EH_NOT_HANDLED && !host->hostt->no_async_abort) | 290 | if (rtn == BLK_EH_NOT_HANDLED) { |
291 | if (scsi_abort_command(scmd) == SUCCESS) | 291 | if (!host->hostt->no_async_abort && |
292 | scsi_abort_command(scmd) == SUCCESS) | ||
292 | return BLK_EH_NOT_HANDLED; | 293 | return BLK_EH_NOT_HANDLED; |
293 | 294 | ||
294 | scmd->result |= DID_TIME_OUT << 16; | 295 | set_host_byte(scmd, DID_TIME_OUT); |
295 | 296 | if (!scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD)) | |
296 | if (unlikely(rtn == BLK_EH_NOT_HANDLED && | 297 | rtn = BLK_EH_HANDLED; |
297 | !scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD))) | 298 | } |
298 | rtn = BLK_EH_HANDLED; | ||
299 | 299 | ||
300 | return rtn; | 300 | return rtn; |
301 | } | 301 | } |
@@ -1777,7 +1777,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) | |||
1777 | break; | 1777 | break; |
1778 | case DID_ABORT: | 1778 | case DID_ABORT: |
1779 | if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { | 1779 | if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { |
1780 | scmd->result |= DID_TIME_OUT << 16; | 1780 | set_host_byte(scmd, DID_TIME_OUT); |
1781 | return SUCCESS; | 1781 | return SUCCESS; |
1782 | } | 1782 | } |
1783 | case DID_NO_CONNECT: | 1783 | case DID_NO_CONNECT: |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index f80908f74ca9..521f5838594b 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -2549,6 +2549,7 @@ fc_rport_final_delete(struct work_struct *work) | |||
2549 | fc_flush_devloss(shost); | 2549 | fc_flush_devloss(shost); |
2550 | if (!cancel_delayed_work(&rport->dev_loss_work)) | 2550 | if (!cancel_delayed_work(&rport->dev_loss_work)) |
2551 | fc_flush_devloss(shost); | 2551 | fc_flush_devloss(shost); |
2552 | cancel_work_sync(&rport->scan_work); | ||
2552 | spin_lock_irqsave(shost->host_lock, flags); | 2553 | spin_lock_irqsave(shost->host_lock, flags); |
2553 | rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; | 2554 | rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; |
2554 | } | 2555 | } |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index e9689d57ccb6..6825eda1114a 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -2441,7 +2441,10 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) | |||
2441 | } | 2441 | } |
2442 | 2442 | ||
2443 | sdkp->DPOFUA = (data.device_specific & 0x10) != 0; | 2443 | sdkp->DPOFUA = (data.device_specific & 0x10) != 0; |
2444 | if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { | 2444 | if (sdp->broken_fua) { |
2445 | sd_first_printk(KERN_NOTICE, sdkp, "Disabling FUA\n"); | ||
2446 | sdkp->DPOFUA = 0; | ||
2447 | } else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { | ||
2445 | sd_first_printk(KERN_NOTICE, sdkp, | 2448 | sd_first_printk(KERN_NOTICE, sdkp, |
2446 | "Uses READ/WRITE(6), disabling FUA\n"); | 2449 | "Uses READ/WRITE(6), disabling FUA\n"); |
2447 | sdkp->DPOFUA = 0; | 2450 | sdkp->DPOFUA = 0; |
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 89ee5929eb6d..308256b5e4cb 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -237,6 +237,16 @@ static void virtscsi_req_done(struct virtqueue *vq) | |||
237 | virtscsi_vq_done(vscsi, req_vq, virtscsi_complete_cmd); | 237 | virtscsi_vq_done(vscsi, req_vq, virtscsi_complete_cmd); |
238 | }; | 238 | }; |
239 | 239 | ||
240 | static void virtscsi_poll_requests(struct virtio_scsi *vscsi) | ||
241 | { | ||
242 | int i, num_vqs; | ||
243 | |||
244 | num_vqs = vscsi->num_queues; | ||
245 | for (i = 0; i < num_vqs; i++) | ||
246 | virtscsi_vq_done(vscsi, &vscsi->req_vqs[i], | ||
247 | virtscsi_complete_cmd); | ||
248 | } | ||
249 | |||
240 | static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf) | 250 | static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf) |
241 | { | 251 | { |
242 | struct virtio_scsi_cmd *cmd = buf; | 252 | struct virtio_scsi_cmd *cmd = buf; |
@@ -253,6 +263,8 @@ static void virtscsi_ctrl_done(struct virtqueue *vq) | |||
253 | virtscsi_vq_done(vscsi, &vscsi->ctrl_vq, virtscsi_complete_free); | 263 | virtscsi_vq_done(vscsi, &vscsi->ctrl_vq, virtscsi_complete_free); |
254 | }; | 264 | }; |
255 | 265 | ||
266 | static void virtscsi_handle_event(struct work_struct *work); | ||
267 | |||
256 | static int virtscsi_kick_event(struct virtio_scsi *vscsi, | 268 | static int virtscsi_kick_event(struct virtio_scsi *vscsi, |
257 | struct virtio_scsi_event_node *event_node) | 269 | struct virtio_scsi_event_node *event_node) |
258 | { | 270 | { |
@@ -260,6 +272,7 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi, | |||
260 | struct scatterlist sg; | 272 | struct scatterlist sg; |
261 | unsigned long flags; | 273 | unsigned long flags; |
262 | 274 | ||
275 | INIT_WORK(&event_node->work, virtscsi_handle_event); | ||
263 | sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event)); | 276 | sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event)); |
264 | 277 | ||
265 | spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); | 278 | spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); |
@@ -377,7 +390,6 @@ static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf) | |||
377 | { | 390 | { |
378 | struct virtio_scsi_event_node *event_node = buf; | 391 | struct virtio_scsi_event_node *event_node = buf; |
379 | 392 | ||
380 | INIT_WORK(&event_node->work, virtscsi_handle_event); | ||
381 | schedule_work(&event_node->work); | 393 | schedule_work(&event_node->work); |
382 | } | 394 | } |
383 | 395 | ||
@@ -589,6 +601,18 @@ static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd) | |||
589 | cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED) | 601 | cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED) |
590 | ret = SUCCESS; | 602 | ret = SUCCESS; |
591 | 603 | ||
604 | /* | ||
605 | * The spec guarantees that all requests related to the TMF have | ||
606 | * been completed, but the callback might not have run yet if | ||
607 | * we're using independent interrupts (e.g. MSI). Poll the | ||
608 | * virtqueues once. | ||
609 | * | ||
610 | * In the abort case, sc->scsi_done will do nothing, because | ||
611 | * the block layer must have detected a timeout and as a result | ||
612 | * REQ_ATOM_COMPLETE has been set. | ||
613 | */ | ||
614 | virtscsi_poll_requests(vscsi); | ||
615 | |||
592 | out: | 616 | out: |
593 | mempool_free(cmd, virtscsi_cmd_pool); | 617 | mempool_free(cmd, virtscsi_cmd_pool); |
594 | return ret; | 618 | return ret; |
diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index f6759dc0153b..c41ff148a2b4 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c | |||
@@ -368,7 +368,7 @@ int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip, | |||
368 | * otherwise we use the default. Also we use the default FIFO | 368 | * otherwise we use the default. Also we use the default FIFO |
369 | * thresholds for now. | 369 | * thresholds for now. |
370 | */ | 370 | */ |
371 | *burst_code = chip_info ? chip_info->dma_burst_size : 16; | 371 | *burst_code = chip_info ? chip_info->dma_burst_size : 1; |
372 | *threshold = SSCR1_RxTresh(RX_THRESH_DFLT) | 372 | *threshold = SSCR1_RxTresh(RX_THRESH_DFLT) |
373 | | SSCR1_TxTresh(TX_THRESH_DFLT); | 373 | | SSCR1_TxTresh(TX_THRESH_DFLT); |
374 | 374 | ||
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index a98df7eeb42d..fe792106bdc5 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -118,6 +118,7 @@ static void lpss_ssp_setup(struct driver_data *drv_data) | |||
118 | */ | 118 | */ |
119 | orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); | 119 | orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
120 | 120 | ||
121 | /* Test SPI_CS_CONTROL_SW_MODE bit enabling */ | ||
121 | value = orig | SPI_CS_CONTROL_SW_MODE; | 122 | value = orig | SPI_CS_CONTROL_SW_MODE; |
122 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); | 123 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); |
123 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); | 124 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
@@ -126,10 +127,13 @@ static void lpss_ssp_setup(struct driver_data *drv_data) | |||
126 | goto detection_done; | 127 | goto detection_done; |
127 | } | 128 | } |
128 | 129 | ||
129 | value &= ~SPI_CS_CONTROL_SW_MODE; | 130 | orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
131 | |||
132 | /* Test SPI_CS_CONTROL_SW_MODE bit disabling */ | ||
133 | value = orig & ~SPI_CS_CONTROL_SW_MODE; | ||
130 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); | 134 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); |
131 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); | 135 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
132 | if (value != orig) { | 136 | if (value != (orig & ~SPI_CS_CONTROL_SW_MODE)) { |
133 | offset = 0x800; | 137 | offset = 0x800; |
134 | goto detection_done; | 138 | goto detection_done; |
135 | } | 139 | } |
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index fc1de86d3c8a..c08da380cb23 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c | |||
@@ -424,31 +424,6 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) | |||
424 | return 0; | 424 | return 0; |
425 | } | 425 | } |
426 | 426 | ||
427 | static void spi_qup_set_cs(struct spi_device *spi, bool enable) | ||
428 | { | ||
429 | struct spi_qup *controller = spi_master_get_devdata(spi->master); | ||
430 | |||
431 | u32 iocontol, mask; | ||
432 | |||
433 | iocontol = readl_relaxed(controller->base + SPI_IO_CONTROL); | ||
434 | |||
435 | /* Disable auto CS toggle and use manual */ | ||
436 | iocontol &= ~SPI_IO_C_MX_CS_MODE; | ||
437 | iocontol |= SPI_IO_C_FORCE_CS; | ||
438 | |||
439 | iocontol &= ~SPI_IO_C_CS_SELECT_MASK; | ||
440 | iocontol |= SPI_IO_C_CS_SELECT(spi->chip_select); | ||
441 | |||
442 | mask = SPI_IO_C_CS_N_POLARITY_0 << spi->chip_select; | ||
443 | |||
444 | if (enable) | ||
445 | iocontol |= mask; | ||
446 | else | ||
447 | iocontol &= ~mask; | ||
448 | |||
449 | writel_relaxed(iocontol, controller->base + SPI_IO_CONTROL); | ||
450 | } | ||
451 | |||
452 | static int spi_qup_transfer_one(struct spi_master *master, | 427 | static int spi_qup_transfer_one(struct spi_master *master, |
453 | struct spi_device *spi, | 428 | struct spi_device *spi, |
454 | struct spi_transfer *xfer) | 429 | struct spi_transfer *xfer) |
@@ -571,12 +546,16 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
571 | return -ENOMEM; | 546 | return -ENOMEM; |
572 | } | 547 | } |
573 | 548 | ||
549 | /* use num-cs unless not present or out of range */ | ||
550 | if (of_property_read_u16(dev->of_node, "num-cs", | ||
551 | &master->num_chipselect) || | ||
552 | (master->num_chipselect > SPI_NUM_CHIPSELECTS)) | ||
553 | master->num_chipselect = SPI_NUM_CHIPSELECTS; | ||
554 | |||
574 | master->bus_num = pdev->id; | 555 | master->bus_num = pdev->id; |
575 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; | 556 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; |
576 | master->num_chipselect = SPI_NUM_CHIPSELECTS; | ||
577 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); | 557 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); |
578 | master->max_speed_hz = max_freq; | 558 | master->max_speed_hz = max_freq; |
579 | master->set_cs = spi_qup_set_cs; | ||
580 | master->transfer_one = spi_qup_transfer_one; | 559 | master->transfer_one = spi_qup_transfer_one; |
581 | master->dev.of_node = pdev->dev.of_node; | 560 | master->dev.of_node = pdev->dev.of_node; |
582 | master->auto_runtime_pm = true; | 561 | master->auto_runtime_pm = true; |
@@ -640,16 +619,19 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
640 | if (ret) | 619 | if (ret) |
641 | goto error; | 620 | goto error; |
642 | 621 | ||
643 | ret = devm_spi_register_master(dev, master); | ||
644 | if (ret) | ||
645 | goto error; | ||
646 | |||
647 | pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); | 622 | pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); |
648 | pm_runtime_use_autosuspend(dev); | 623 | pm_runtime_use_autosuspend(dev); |
649 | pm_runtime_set_active(dev); | 624 | pm_runtime_set_active(dev); |
650 | pm_runtime_enable(dev); | 625 | pm_runtime_enable(dev); |
626 | |||
627 | ret = devm_spi_register_master(dev, master); | ||
628 | if (ret) | ||
629 | goto disable_pm; | ||
630 | |||
651 | return 0; | 631 | return 0; |
652 | 632 | ||
633 | disable_pm: | ||
634 | pm_runtime_disable(&pdev->dev); | ||
653 | error: | 635 | error: |
654 | clk_disable_unprepare(cclk); | 636 | clk_disable_unprepare(cclk); |
655 | clk_disable_unprepare(iclk); | 637 | clk_disable_unprepare(iclk); |
diff --git a/drivers/spi/spi-sh-sci.c b/drivers/spi/spi-sh-sci.c index 1f56ef651d1a..b83dd733684c 100644 --- a/drivers/spi/spi-sh-sci.c +++ b/drivers/spi/spi-sh-sci.c | |||
@@ -175,9 +175,9 @@ static int sh_sci_spi_remove(struct platform_device *dev) | |||
175 | { | 175 | { |
176 | struct sh_sci_spi *sp = platform_get_drvdata(dev); | 176 | struct sh_sci_spi *sp = platform_get_drvdata(dev); |
177 | 177 | ||
178 | iounmap(sp->membase); | ||
179 | setbits(sp, PIN_INIT, 0); | ||
180 | spi_bitbang_stop(&sp->bitbang); | 178 | spi_bitbang_stop(&sp->bitbang); |
179 | setbits(sp, PIN_INIT, 0); | ||
180 | iounmap(sp->membase); | ||
181 | spi_master_put(sp->bitbang.master); | 181 | spi_master_put(sp->bitbang.master); |
182 | return 0; | 182 | return 0; |
183 | } | 183 | } |
diff --git a/drivers/staging/android/timed_output.c b/drivers/staging/android/timed_output.c index 2c617834dc46..c341ac11c5a3 100644 --- a/drivers/staging/android/timed_output.c +++ b/drivers/staging/android/timed_output.c | |||
@@ -97,7 +97,6 @@ void timed_output_dev_unregister(struct timed_output_dev *tdev) | |||
97 | { | 97 | { |
98 | tdev->enable(tdev, 0); | 98 | tdev->enable(tdev, 0); |
99 | device_destroy(timed_output_class, MKDEV(0, tdev->index)); | 99 | device_destroy(timed_output_class, MKDEV(0, tdev->index)); |
100 | dev_set_drvdata(tdev->dev, NULL); | ||
101 | } | 100 | } |
102 | EXPORT_SYMBOL_GPL(timed_output_dev_unregister); | 101 | EXPORT_SYMBOL_GPL(timed_output_dev_unregister); |
103 | 102 | ||
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 5d56428d508a..a2f6957e7ee9 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig | |||
@@ -651,6 +651,7 @@ config COMEDI_ADDI_APCI_1516 | |||
651 | 651 | ||
652 | config COMEDI_ADDI_APCI_1564 | 652 | config COMEDI_ADDI_APCI_1564 |
653 | tristate "ADDI-DATA APCI_1564 support" | 653 | tristate "ADDI-DATA APCI_1564 support" |
654 | select COMEDI_ADDI_WATCHDOG | ||
654 | ---help--- | 655 | ---help--- |
655 | Enable support for ADDI-DATA APCI_1564 cards | 656 | Enable support for ADDI-DATA APCI_1564 cards |
656 | 657 | ||
diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig index b36feb080cba..fa38be0982f9 100644 --- a/drivers/staging/iio/Kconfig +++ b/drivers/staging/iio/Kconfig | |||
@@ -36,10 +36,11 @@ config IIO_SIMPLE_DUMMY_EVENTS | |||
36 | Add some dummy events to the simple dummy driver. | 36 | Add some dummy events to the simple dummy driver. |
37 | 37 | ||
38 | config IIO_SIMPLE_DUMMY_BUFFER | 38 | config IIO_SIMPLE_DUMMY_BUFFER |
39 | boolean "Buffered capture support" | 39 | boolean "Buffered capture support" |
40 | select IIO_KFIFO_BUF | 40 | select IIO_BUFFER |
41 | help | 41 | select IIO_KFIFO_BUF |
42 | Add buffered data capture to the simple dummy driver. | 42 | help |
43 | Add buffered data capture to the simple dummy driver. | ||
43 | 44 | ||
44 | endif # IIO_SIMPLE_DUMMY | 45 | endif # IIO_SIMPLE_DUMMY |
45 | 46 | ||
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c index 357cef2a6f4c..7194bd138762 100644 --- a/drivers/staging/iio/adc/ad7291.c +++ b/drivers/staging/iio/adc/ad7291.c | |||
@@ -465,7 +465,7 @@ static int ad7291_probe(struct i2c_client *client, | |||
465 | struct ad7291_platform_data *pdata = client->dev.platform_data; | 465 | struct ad7291_platform_data *pdata = client->dev.platform_data; |
466 | struct ad7291_chip_info *chip; | 466 | struct ad7291_chip_info *chip; |
467 | struct iio_dev *indio_dev; | 467 | struct iio_dev *indio_dev; |
468 | int ret = 0; | 468 | int ret; |
469 | 469 | ||
470 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); | 470 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); |
471 | if (!indio_dev) | 471 | if (!indio_dev) |
@@ -475,7 +475,7 @@ static int ad7291_probe(struct i2c_client *client, | |||
475 | if (pdata && pdata->use_external_ref) { | 475 | if (pdata && pdata->use_external_ref) { |
476 | chip->reg = devm_regulator_get(&client->dev, "vref"); | 476 | chip->reg = devm_regulator_get(&client->dev, "vref"); |
477 | if (IS_ERR(chip->reg)) | 477 | if (IS_ERR(chip->reg)) |
478 | return ret; | 478 | return PTR_ERR(chip->reg); |
479 | 479 | ||
480 | ret = regulator_enable(chip->reg); | 480 | ret = regulator_enable(chip->reg); |
481 | if (ret) | 481 | if (ret) |
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index dae8d1a9038e..52d7517b342e 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -846,6 +846,14 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val) | |||
846 | LRADC_CTRL1); | 846 | LRADC_CTRL1); |
847 | mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); | 847 | mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); |
848 | 848 | ||
849 | /* Enable / disable the divider per requirement */ | ||
850 | if (test_bit(chan, &lradc->is_divided)) | ||
851 | mxs_lradc_reg_set(lradc, 1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET, | ||
852 | LRADC_CTRL2); | ||
853 | else | ||
854 | mxs_lradc_reg_clear(lradc, | ||
855 | 1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET, LRADC_CTRL2); | ||
856 | |||
849 | /* Clean the slot's previous content, then set new one. */ | 857 | /* Clean the slot's previous content, then set new one. */ |
850 | mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(0), | 858 | mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(0), |
851 | LRADC_CTRL4); | 859 | LRADC_CTRL4); |
@@ -961,15 +969,11 @@ static int mxs_lradc_write_raw(struct iio_dev *iio_dev, | |||
961 | if (val == scale_avail[MXS_LRADC_DIV_DISABLED].integer && | 969 | if (val == scale_avail[MXS_LRADC_DIV_DISABLED].integer && |
962 | val2 == scale_avail[MXS_LRADC_DIV_DISABLED].nano) { | 970 | val2 == scale_avail[MXS_LRADC_DIV_DISABLED].nano) { |
963 | /* divider by two disabled */ | 971 | /* divider by two disabled */ |
964 | writel(1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET, | ||
965 | lradc->base + LRADC_CTRL2 + STMP_OFFSET_REG_CLR); | ||
966 | clear_bit(chan->channel, &lradc->is_divided); | 972 | clear_bit(chan->channel, &lradc->is_divided); |
967 | ret = 0; | 973 | ret = 0; |
968 | } else if (val == scale_avail[MXS_LRADC_DIV_ENABLED].integer && | 974 | } else if (val == scale_avail[MXS_LRADC_DIV_ENABLED].integer && |
969 | val2 == scale_avail[MXS_LRADC_DIV_ENABLED].nano) { | 975 | val2 == scale_avail[MXS_LRADC_DIV_ENABLED].nano) { |
970 | /* divider by two enabled */ | 976 | /* divider by two enabled */ |
971 | writel(1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET, | ||
972 | lradc->base + LRADC_CTRL2 + STMP_OFFSET_REG_SET); | ||
973 | set_bit(chan->channel, &lradc->is_divided); | 977 | set_bit(chan->channel, &lradc->is_divided); |
974 | ret = 0; | 978 | ret = 0; |
975 | } | 979 | } |
diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index 9e0f2a9c73ae..ab338e3ddd05 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c | |||
@@ -667,9 +667,13 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev) | |||
667 | chip->tsl2x7x_config[TSL2X7X_PRX_COUNT] = | 667 | chip->tsl2x7x_config[TSL2X7X_PRX_COUNT] = |
668 | chip->tsl2x7x_settings.prox_pulse_count; | 668 | chip->tsl2x7x_settings.prox_pulse_count; |
669 | chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHLO] = | 669 | chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHLO] = |
670 | chip->tsl2x7x_settings.prox_thres_low; | 670 | (chip->tsl2x7x_settings.prox_thres_low) & 0xFF; |
671 | chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHHI] = | ||
672 | (chip->tsl2x7x_settings.prox_thres_low >> 8) & 0xFF; | ||
671 | chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHLO] = | 673 | chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHLO] = |
672 | chip->tsl2x7x_settings.prox_thres_high; | 674 | (chip->tsl2x7x_settings.prox_thres_high) & 0xFF; |
675 | chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHHI] = | ||
676 | (chip->tsl2x7x_settings.prox_thres_high >> 8) & 0xFF; | ||
673 | 677 | ||
674 | /* and make sure we're not already on */ | 678 | /* and make sure we're not already on */ |
675 | if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) { | 679 | if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) { |
diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-drm/parallel-display.c index b5678328fc40..4ca61afdf622 100644 --- a/drivers/staging/imx-drm/parallel-display.c +++ b/drivers/staging/imx-drm/parallel-display.c | |||
@@ -173,6 +173,13 @@ static int imx_pd_register(struct drm_device *drm, | |||
173 | if (ret) | 173 | if (ret) |
174 | return ret; | 174 | return ret; |
175 | 175 | ||
176 | /* set the connector's dpms to OFF so that | ||
177 | * drm_helper_connector_dpms() won't return | ||
178 | * immediately since the current state is ON | ||
179 | * at this point. | ||
180 | */ | ||
181 | imxpd->connector.dpms = DRM_MODE_DPMS_OFF; | ||
182 | |||
176 | drm_encoder_helper_add(&imxpd->encoder, &imx_pd_encoder_helper_funcs); | 183 | drm_encoder_helper_add(&imxpd->encoder, &imx_pd_encoder_helper_funcs); |
177 | drm_encoder_init(drm, &imxpd->encoder, &imx_pd_encoder_funcs, | 184 | drm_encoder_init(drm, &imxpd->encoder, &imx_pd_encoder_funcs, |
178 | DRM_MODE_ENCODER_NONE); | 185 | DRM_MODE_ENCODER_NONE); |
diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index 0acacab95a48..46f5abcbaeeb 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | |||
@@ -298,7 +298,7 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter *padapter) | |||
298 | RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__)); | 298 | RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__)); |
299 | 299 | ||
300 | if (IS_8723A_A_CUT(pHalData->VersionID)) { | 300 | if (IS_8723A_A_CUT(pHalData->VersionID)) { |
301 | fw_name = "rtlwifi/rtl8723aufw.bin"; | 301 | fw_name = "rtlwifi/rtl8723aufw_A.bin"; |
302 | RT_TRACE(_module_hal_init_c_, _drv_info_, | 302 | RT_TRACE(_module_hal_init_c_, _drv_info_, |
303 | ("rtl8723a_FirmwareDownload: R8723FwImageArray_UMC " | 303 | ("rtl8723a_FirmwareDownload: R8723FwImageArray_UMC " |
304 | "for RTL8723A A CUT\n")); | 304 | "for RTL8723A A CUT\n")); |
diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c index 4e32003a4437..1fb34386a4e5 100644 --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c | |||
@@ -29,7 +29,9 @@ MODULE_AUTHOR("Realtek Semiconductor Corp."); | |||
29 | MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>"); | 29 | MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>"); |
30 | MODULE_AUTHOR("Jes Sorensen <Jes.Sorensen@redhat.com>"); | 30 | MODULE_AUTHOR("Jes Sorensen <Jes.Sorensen@redhat.com>"); |
31 | MODULE_VERSION(DRIVERVERSION); | 31 | MODULE_VERSION(DRIVERVERSION); |
32 | MODULE_FIRMWARE("rtlwifi/rtl8821aefw.bin"); | 32 | MODULE_FIRMWARE("rtlwifi/rtl8723aufw_A.bin"); |
33 | MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B.bin"); | ||
34 | MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B_NoBT.bin"); | ||
33 | 35 | ||
34 | /* module param defaults */ | 36 | /* module param defaults */ |
35 | static int rtw_chip_version = 0x00; | 37 | static int rtw_chip_version = 0x00; |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index 8945b4e3a2a6..cb50120ed7b5 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c | |||
@@ -280,8 +280,10 @@ static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt) | |||
280 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); | 280 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); |
281 | 281 | ||
282 | /* Wait until the state has moved to ON */ | 282 | /* Wait until the state has moved to ON */ |
283 | while (*pdata->dsp_prm_read(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST)& | 283 | while ((*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD, |
284 | OMAP_INTRANSITION_MASK); | 284 | OMAP2_PM_PWSTST) & |
285 | OMAP_INTRANSITION_MASK) | ||
286 | ; | ||
285 | /* Disable Automatic transition */ | 287 | /* Disable Automatic transition */ |
286 | (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, | 288 | (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, |
287 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); | 289 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 5663f4d19d02..1f4c794f5fcc 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -1309,7 +1309,7 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf, | |||
1309 | if (cmd->data_direction != DMA_TO_DEVICE) { | 1309 | if (cmd->data_direction != DMA_TO_DEVICE) { |
1310 | pr_err("Command ITT: 0x%08x received DataOUT for a" | 1310 | pr_err("Command ITT: 0x%08x received DataOUT for a" |
1311 | " NON-WRITE command.\n", cmd->init_task_tag); | 1311 | " NON-WRITE command.\n", cmd->init_task_tag); |
1312 | return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf); | 1312 | return iscsit_dump_data_payload(conn, payload_length, 1); |
1313 | } | 1313 | } |
1314 | se_cmd = &cmd->se_cmd; | 1314 | se_cmd = &cmd->se_cmd; |
1315 | iscsit_mod_dataout_timer(cmd); | 1315 | iscsit_mod_dataout_timer(cmd); |
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index 19b842c3e0b3..ab4915c0d933 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
@@ -174,7 +174,6 @@ static int chap_server_compute_md5( | |||
174 | char *nr_out_ptr, | 174 | char *nr_out_ptr, |
175 | unsigned int *nr_out_len) | 175 | unsigned int *nr_out_len) |
176 | { | 176 | { |
177 | char *endptr; | ||
178 | unsigned long id; | 177 | unsigned long id; |
179 | unsigned char id_as_uchar; | 178 | unsigned char id_as_uchar; |
180 | unsigned char digest[MD5_SIGNATURE_SIZE]; | 179 | unsigned char digest[MD5_SIGNATURE_SIZE]; |
@@ -320,9 +319,14 @@ static int chap_server_compute_md5( | |||
320 | } | 319 | } |
321 | 320 | ||
322 | if (type == HEX) | 321 | if (type == HEX) |
323 | id = simple_strtoul(&identifier[2], &endptr, 0); | 322 | ret = kstrtoul(&identifier[2], 0, &id); |
324 | else | 323 | else |
325 | id = simple_strtoul(identifier, &endptr, 0); | 324 | ret = kstrtoul(identifier, 0, &id); |
325 | |||
326 | if (ret < 0) { | ||
327 | pr_err("kstrtoul() failed for CHAP identifier: %d\n", ret); | ||
328 | goto out; | ||
329 | } | ||
326 | if (id > 255) { | 330 | if (id > 255) { |
327 | pr_err("chap identifier: %lu greater than 255\n", id); | 331 | pr_err("chap identifier: %lu greater than 255\n", id); |
328 | goto out; | 332 | goto out; |
@@ -351,6 +355,10 @@ static int chap_server_compute_md5( | |||
351 | pr_err("Unable to convert incoming challenge\n"); | 355 | pr_err("Unable to convert incoming challenge\n"); |
352 | goto out; | 356 | goto out; |
353 | } | 357 | } |
358 | if (challenge_len > 1024) { | ||
359 | pr_err("CHAP_C exceeds maximum binary size of 1024 bytes\n"); | ||
360 | goto out; | ||
361 | } | ||
354 | /* | 362 | /* |
355 | * During mutual authentication, the CHAP_C generated by the | 363 | * During mutual authentication, the CHAP_C generated by the |
356 | * initiator must not match the original CHAP_C generated by | 364 | * initiator must not match the original CHAP_C generated by |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index fecb69535a15..5e71ac609418 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -1216,7 +1216,7 @@ old_sess_out: | |||
1216 | static int __iscsi_target_login_thread(struct iscsi_np *np) | 1216 | static int __iscsi_target_login_thread(struct iscsi_np *np) |
1217 | { | 1217 | { |
1218 | u8 *buffer, zero_tsih = 0; | 1218 | u8 *buffer, zero_tsih = 0; |
1219 | int ret = 0, rc, stop; | 1219 | int ret = 0, rc; |
1220 | struct iscsi_conn *conn = NULL; | 1220 | struct iscsi_conn *conn = NULL; |
1221 | struct iscsi_login *login; | 1221 | struct iscsi_login *login; |
1222 | struct iscsi_portal_group *tpg = NULL; | 1222 | struct iscsi_portal_group *tpg = NULL; |
@@ -1230,6 +1230,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) | |||
1230 | if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { | 1230 | if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { |
1231 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; | 1231 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; |
1232 | complete(&np->np_restart_comp); | 1232 | complete(&np->np_restart_comp); |
1233 | } else if (np->np_thread_state == ISCSI_NP_THREAD_SHUTDOWN) { | ||
1234 | spin_unlock_bh(&np->np_thread_lock); | ||
1235 | goto exit; | ||
1233 | } else { | 1236 | } else { |
1234 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; | 1237 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; |
1235 | } | 1238 | } |
@@ -1422,10 +1425,8 @@ old_sess_out: | |||
1422 | } | 1425 | } |
1423 | 1426 | ||
1424 | out: | 1427 | out: |
1425 | stop = kthread_should_stop(); | 1428 | return 1; |
1426 | /* Wait for another socket.. */ | 1429 | |
1427 | if (!stop) | ||
1428 | return 1; | ||
1429 | exit: | 1430 | exit: |
1430 | iscsi_stop_login_thread_timer(np); | 1431 | iscsi_stop_login_thread_timer(np); |
1431 | spin_lock_bh(&np->np_thread_lock); | 1432 | spin_lock_bh(&np->np_thread_lock); |
@@ -1442,7 +1443,7 @@ int iscsi_target_login_thread(void *arg) | |||
1442 | 1443 | ||
1443 | allow_signal(SIGINT); | 1444 | allow_signal(SIGINT); |
1444 | 1445 | ||
1445 | while (!kthread_should_stop()) { | 1446 | while (1) { |
1446 | ret = __iscsi_target_login_thread(np); | 1447 | ret = __iscsi_target_login_thread(np); |
1447 | /* | 1448 | /* |
1448 | * We break and exit here unless another sock_accept() call | 1449 | * We break and exit here unless another sock_accept() call |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 53e157cb8c54..fd90b28f1d94 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -1295,6 +1295,8 @@ int iscsit_tx_login_rsp(struct iscsi_conn *conn, u8 status_class, u8 status_deta | |||
1295 | login->login_failed = 1; | 1295 | login->login_failed = 1; |
1296 | iscsit_collect_login_stats(conn, status_class, status_detail); | 1296 | iscsit_collect_login_stats(conn, status_class, status_detail); |
1297 | 1297 | ||
1298 | memset(&login->rsp[0], 0, ISCSI_HDR_LEN); | ||
1299 | |||
1298 | hdr = (struct iscsi_login_rsp *)&login->rsp[0]; | 1300 | hdr = (struct iscsi_login_rsp *)&login->rsp[0]; |
1299 | hdr->opcode = ISCSI_OP_LOGIN_RSP; | 1301 | hdr->opcode = ISCSI_OP_LOGIN_RSP; |
1300 | hdr->status_class = status_class; | 1302 | hdr->status_class = status_class; |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 6d2f37578b29..8c64b8776a96 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -239,6 +239,7 @@ static void tcm_loop_submission_work(struct work_struct *work) | |||
239 | return; | 239 | return; |
240 | 240 | ||
241 | out_done: | 241 | out_done: |
242 | kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); | ||
242 | sc->scsi_done(sc); | 243 | sc->scsi_done(sc); |
243 | return; | 244 | return; |
244 | } | 245 | } |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 11d26fe65bfb..98da90167159 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -616,6 +616,7 @@ void core_dev_unexport( | |||
616 | dev->export_count--; | 616 | dev->export_count--; |
617 | spin_unlock(&hba->device_lock); | 617 | spin_unlock(&hba->device_lock); |
618 | 618 | ||
619 | lun->lun_sep = NULL; | ||
619 | lun->lun_se_dev = NULL; | 620 | lun->lun_se_dev = NULL; |
620 | } | 621 | } |
621 | 622 | ||
diff --git a/drivers/tc/tc.c b/drivers/tc/tc.c index a8aaf6ac2ae2..946562389ca8 100644 --- a/drivers/tc/tc.c +++ b/drivers/tc/tc.c | |||
@@ -129,7 +129,10 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus) | |||
129 | 129 | ||
130 | tc_device_get_irq(tdev); | 130 | tc_device_get_irq(tdev); |
131 | 131 | ||
132 | device_register(&tdev->dev); | 132 | if (device_register(&tdev->dev)) { |
133 | put_device(&tdev->dev); | ||
134 | goto out_err; | ||
135 | } | ||
133 | list_add_tail(&tdev->node, &tbus->devices); | 136 | list_add_tail(&tdev->node, &tbus->devices); |
134 | 137 | ||
135 | out_err: | 138 | out_err: |
@@ -148,7 +151,10 @@ static int __init tc_init(void) | |||
148 | 151 | ||
149 | INIT_LIST_HEAD(&tc_bus.devices); | 152 | INIT_LIST_HEAD(&tc_bus.devices); |
150 | dev_set_name(&tc_bus.dev, "tc"); | 153 | dev_set_name(&tc_bus.dev, "tc"); |
151 | device_register(&tc_bus.dev); | 154 | if (device_register(&tc_bus.dev)) { |
155 | put_device(&tc_bus.dev); | ||
156 | return 0; | ||
157 | } | ||
152 | 158 | ||
153 | if (tc_bus.info.slot_size) { | 159 | if (tc_bus.info.slot_size) { |
154 | unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000; | 160 | unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000; |
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index a99c63152b8d..2c516f2eebed 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c | |||
@@ -306,7 +306,7 @@ static int imx_get_sensor_data(struct platform_device *pdev) | |||
306 | { | 306 | { |
307 | struct imx_thermal_data *data = platform_get_drvdata(pdev); | 307 | struct imx_thermal_data *data = platform_get_drvdata(pdev); |
308 | struct regmap *map; | 308 | struct regmap *map; |
309 | int t1, t2, n1, n2; | 309 | int t1, n1; |
310 | int ret; | 310 | int ret; |
311 | u32 val; | 311 | u32 val; |
312 | u64 temp64; | 312 | u64 temp64; |
@@ -333,14 +333,10 @@ static int imx_get_sensor_data(struct platform_device *pdev) | |||
333 | /* | 333 | /* |
334 | * Sensor data layout: | 334 | * Sensor data layout: |
335 | * [31:20] - sensor value @ 25C | 335 | * [31:20] - sensor value @ 25C |
336 | * [19:8] - sensor value of hot | ||
337 | * [7:0] - hot temperature value | ||
338 | * Use universal formula now and only need sensor value @ 25C | 336 | * Use universal formula now and only need sensor value @ 25C |
339 | * slope = 0.4297157 - (0.0015976 * 25C fuse) | 337 | * slope = 0.4297157 - (0.0015976 * 25C fuse) |
340 | */ | 338 | */ |
341 | n1 = val >> 20; | 339 | n1 = val >> 20; |
342 | n2 = (val & 0xfff00) >> 8; | ||
343 | t2 = val & 0xff; | ||
344 | t1 = 25; /* t1 always 25C */ | 340 | t1 = 25; /* t1 always 25C */ |
345 | 341 | ||
346 | /* | 342 | /* |
@@ -366,16 +362,16 @@ static int imx_get_sensor_data(struct platform_device *pdev) | |||
366 | data->c2 = n1 * data->c1 + 1000 * t1; | 362 | data->c2 = n1 * data->c1 + 1000 * t1; |
367 | 363 | ||
368 | /* | 364 | /* |
369 | * Set the default passive cooling trip point to 20 °C below the | 365 | * Set the default passive cooling trip point, |
370 | * maximum die temperature. Can be changed from userspace. | 366 | * can be changed from userspace. |
371 | */ | 367 | */ |
372 | data->temp_passive = 1000 * (t2 - 20); | 368 | data->temp_passive = IMX_TEMP_PASSIVE; |
373 | 369 | ||
374 | /* | 370 | /* |
375 | * The maximum die temperature is t2, let's give 5 °C cushion | 371 | * The maximum die temperature set to 20 C higher than |
376 | * for noise and possible temperature rise between measurements. | 372 | * IMX_TEMP_PASSIVE. |
377 | */ | 373 | */ |
378 | data->temp_critical = 1000 * (t2 - 5); | 374 | data->temp_critical = 1000 * 20 + data->temp_passive; |
379 | 375 | ||
380 | return 0; | 376 | return 0; |
381 | } | 377 | } |
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 04b1be7fa018..4b2b999b7611 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c | |||
@@ -156,8 +156,8 @@ static int of_thermal_bind(struct thermal_zone_device *thermal, | |||
156 | 156 | ||
157 | ret = thermal_zone_bind_cooling_device(thermal, | 157 | ret = thermal_zone_bind_cooling_device(thermal, |
158 | tbp->trip_id, cdev, | 158 | tbp->trip_id, cdev, |
159 | tbp->min, | 159 | tbp->max, |
160 | tbp->max); | 160 | tbp->min); |
161 | if (ret) | 161 | if (ret) |
162 | return ret; | 162 | return ret; |
163 | } | 163 | } |
@@ -712,11 +712,12 @@ thermal_of_build_thermal_zone(struct device_node *np) | |||
712 | } | 712 | } |
713 | 713 | ||
714 | i = 0; | 714 | i = 0; |
715 | for_each_child_of_node(child, gchild) | 715 | for_each_child_of_node(child, gchild) { |
716 | ret = thermal_of_populate_bind_params(gchild, &tz->tbps[i++], | 716 | ret = thermal_of_populate_bind_params(gchild, &tz->tbps[i++], |
717 | tz->trips, tz->ntrips); | 717 | tz->trips, tz->ntrips); |
718 | if (ret) | 718 | if (ret) |
719 | goto free_tbps; | 719 | goto free_tbps; |
720 | } | ||
720 | 721 | ||
721 | finish: | 722 | finish: |
722 | of_node_put(child); | 723 | of_node_put(child); |
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index fdb07199d9c2..1967bee4f076 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c | |||
@@ -140,6 +140,12 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon, | |||
140 | return NULL; | 140 | return NULL; |
141 | } | 141 | } |
142 | 142 | ||
143 | static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz) | ||
144 | { | ||
145 | unsigned long temp; | ||
146 | return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp); | ||
147 | } | ||
148 | |||
143 | int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) | 149 | int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) |
144 | { | 150 | { |
145 | struct thermal_hwmon_device *hwmon; | 151 | struct thermal_hwmon_device *hwmon; |
@@ -189,21 +195,18 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) | |||
189 | if (result) | 195 | if (result) |
190 | goto free_temp_mem; | 196 | goto free_temp_mem; |
191 | 197 | ||
192 | if (tz->ops->get_crit_temp) { | 198 | if (thermal_zone_crit_temp_valid(tz)) { |
193 | unsigned long temperature; | 199 | snprintf(temp->temp_crit.name, |
194 | if (!tz->ops->get_crit_temp(tz, &temperature)) { | 200 | sizeof(temp->temp_crit.name), |
195 | snprintf(temp->temp_crit.name, | ||
196 | sizeof(temp->temp_crit.name), | ||
197 | "temp%d_crit", hwmon->count); | 201 | "temp%d_crit", hwmon->count); |
198 | temp->temp_crit.attr.attr.name = temp->temp_crit.name; | 202 | temp->temp_crit.attr.attr.name = temp->temp_crit.name; |
199 | temp->temp_crit.attr.attr.mode = 0444; | 203 | temp->temp_crit.attr.attr.mode = 0444; |
200 | temp->temp_crit.attr.show = temp_crit_show; | 204 | temp->temp_crit.attr.show = temp_crit_show; |
201 | sysfs_attr_init(&temp->temp_crit.attr.attr); | 205 | sysfs_attr_init(&temp->temp_crit.attr.attr); |
202 | result = device_create_file(hwmon->device, | 206 | result = device_create_file(hwmon->device, |
203 | &temp->temp_crit.attr); | 207 | &temp->temp_crit.attr); |
204 | if (result) | 208 | if (result) |
205 | goto unregister_input; | 209 | goto unregister_input; |
206 | } | ||
207 | } | 210 | } |
208 | 211 | ||
209 | mutex_lock(&thermal_hwmon_list_lock); | 212 | mutex_lock(&thermal_hwmon_list_lock); |
@@ -250,7 +253,7 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) | |||
250 | } | 253 | } |
251 | 254 | ||
252 | device_remove_file(hwmon->device, &temp->temp_input.attr); | 255 | device_remove_file(hwmon->device, &temp->temp_input.attr); |
253 | if (tz->ops->get_crit_temp) | 256 | if (thermal_zone_crit_temp_valid(tz)) |
254 | device_remove_file(hwmon->device, &temp->temp_crit.attr); | 257 | device_remove_file(hwmon->device, &temp->temp_crit.attr); |
255 | 258 | ||
256 | mutex_lock(&thermal_hwmon_list_lock); | 259 | mutex_lock(&thermal_hwmon_list_lock); |
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index a1271b55103a..634b6ce0e63a 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c | |||
@@ -1155,7 +1155,7 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev) | |||
1155 | /* register shadow for context save and restore */ | 1155 | /* register shadow for context save and restore */ |
1156 | bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) * | 1156 | bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) * |
1157 | bgp->conf->sensor_count, GFP_KERNEL); | 1157 | bgp->conf->sensor_count, GFP_KERNEL); |
1158 | if (!bgp) { | 1158 | if (!bgp->regval) { |
1159 | dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n"); | 1159 | dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n"); |
1160 | return ERR_PTR(-ENOMEM); | 1160 | return ERR_PTR(-ENOMEM); |
1161 | } | 1161 | } |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index f95569dedc88..f44f1ba762c3 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -1214,15 +1214,16 @@ static void n_tty_receive_parity_error(struct tty_struct *tty, unsigned char c) | |||
1214 | { | 1214 | { |
1215 | struct n_tty_data *ldata = tty->disc_data; | 1215 | struct n_tty_data *ldata = tty->disc_data; |
1216 | 1216 | ||
1217 | if (I_IGNPAR(tty)) | 1217 | if (I_INPCK(tty)) { |
1218 | return; | 1218 | if (I_IGNPAR(tty)) |
1219 | if (I_PARMRK(tty)) { | 1219 | return; |
1220 | put_tty_queue('\377', ldata); | 1220 | if (I_PARMRK(tty)) { |
1221 | put_tty_queue('\0', ldata); | 1221 | put_tty_queue('\377', ldata); |
1222 | put_tty_queue(c, ldata); | 1222 | put_tty_queue('\0', ldata); |
1223 | } else if (I_INPCK(tty)) | 1223 | put_tty_queue(c, ldata); |
1224 | put_tty_queue('\0', ldata); | 1224 | } else |
1225 | else | 1225 | put_tty_queue('\0', ldata); |
1226 | } else | ||
1226 | put_tty_queue(c, ldata); | 1227 | put_tty_queue(c, ldata); |
1227 | if (waitqueue_active(&tty->read_wait)) | 1228 | if (waitqueue_active(&tty->read_wait)) |
1228 | wake_up_interruptible(&tty->read_wait); | 1229 | wake_up_interruptible(&tty->read_wait); |
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 27f7ad6b74c1..7a91c6d1eb7d 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
@@ -2357,7 +2357,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2357 | port->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 2357 | port->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
2358 | if (termios->c_iflag & INPCK) | 2358 | if (termios->c_iflag & INPCK) |
2359 | port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 2359 | port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
2360 | if (termios->c_iflag & (BRKINT | PARMRK)) | 2360 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
2361 | port->read_status_mask |= UART_LSR_BI; | 2361 | port->read_status_mask |= UART_LSR_BI; |
2362 | 2362 | ||
2363 | /* | 2363 | /* |
diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c index cfef801a49d4..4858b8a99d3b 100644 --- a/drivers/tty/serial/8250/8250_early.c +++ b/drivers/tty/serial/8250/8250_early.c | |||
@@ -144,8 +144,11 @@ static int __init early_serial8250_setup(struct earlycon_device *device, | |||
144 | if (!(device->port.membase || device->port.iobase)) | 144 | if (!(device->port.membase || device->port.iobase)) |
145 | return 0; | 145 | return 0; |
146 | 146 | ||
147 | if (!device->baud) | 147 | if (!device->baud) { |
148 | device->baud = probe_baud(&device->port); | 148 | device->baud = probe_baud(&device->port); |
149 | snprintf(device->options, sizeof(device->options), "%u", | ||
150 | device->baud); | ||
151 | } | ||
149 | 152 | ||
150 | init_port(device); | 153 | init_port(device); |
151 | 154 | ||
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index 501667e3e3f5..323376668b72 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c | |||
@@ -185,6 +185,12 @@ static void altera_uart_set_termios(struct uart_port *port, | |||
185 | uart_update_timeout(port, termios->c_cflag, baud); | 185 | uart_update_timeout(port, termios->c_cflag, baud); |
186 | altera_uart_writel(port, baudclk, ALTERA_UART_DIVISOR_REG); | 186 | altera_uart_writel(port, baudclk, ALTERA_UART_DIVISOR_REG); |
187 | spin_unlock_irqrestore(&port->lock, flags); | 187 | spin_unlock_irqrestore(&port->lock, flags); |
188 | |||
189 | /* | ||
190 | * FIXME: port->read_status_mask and port->ignore_status_mask | ||
191 | * need to be initialized based on termios settings for | ||
192 | * INPCK, IGNBRK, IGNPAR, PARMRK, BRKINT | ||
193 | */ | ||
188 | } | 194 | } |
189 | 195 | ||
190 | static void altera_uart_rx_chars(struct altera_uart *pp) | 196 | static void altera_uart_rx_chars(struct altera_uart *pp) |
diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c index 01c9e72433e1..971af1e22d0f 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c | |||
@@ -420,7 +420,7 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios, | |||
420 | uap->port.read_status_mask = UART01x_RSR_OE; | 420 | uap->port.read_status_mask = UART01x_RSR_OE; |
421 | if (termios->c_iflag & INPCK) | 421 | if (termios->c_iflag & INPCK) |
422 | uap->port.read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; | 422 | uap->port.read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; |
423 | if (termios->c_iflag & (BRKINT | PARMRK)) | 423 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
424 | uap->port.read_status_mask |= UART01x_RSR_BE; | 424 | uap->port.read_status_mask |= UART01x_RSR_BE; |
425 | 425 | ||
426 | /* | 426 | /* |
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 908a6e3142a2..0e26dcbd5ea4 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -1744,7 +1744,7 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1744 | port->read_status_mask = UART011_DR_OE | 255; | 1744 | port->read_status_mask = UART011_DR_OE | 255; |
1745 | if (termios->c_iflag & INPCK) | 1745 | if (termios->c_iflag & INPCK) |
1746 | port->read_status_mask |= UART011_DR_FE | UART011_DR_PE; | 1746 | port->read_status_mask |= UART011_DR_FE | UART011_DR_PE; |
1747 | if (termios->c_iflag & (BRKINT | PARMRK)) | 1747 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
1748 | port->read_status_mask |= UART011_DR_BE; | 1748 | port->read_status_mask |= UART011_DR_BE; |
1749 | 1749 | ||
1750 | /* | 1750 | /* |
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index c9f5c9dcc15c..008c223eaf26 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c | |||
@@ -177,7 +177,7 @@ static void arc_serial_tx_chars(struct arc_uart_port *uart) | |||
177 | uart->port.icount.tx++; | 177 | uart->port.icount.tx++; |
178 | uart->port.x_char = 0; | 178 | uart->port.x_char = 0; |
179 | sent = 1; | 179 | sent = 1; |
180 | } else if (xmit->tail != xmit->head) { /* TODO: uart_circ_empty */ | 180 | } else if (!uart_circ_empty(xmit)) { |
181 | ch = xmit->buf[xmit->tail]; | 181 | ch = xmit->buf[xmit->tail]; |
182 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | 182 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
183 | uart->port.icount.tx++; | 183 | uart->port.icount.tx++; |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 3fceae099c44..c4f750314100 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -1932,7 +1932,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1932 | port->read_status_mask = ATMEL_US_OVRE; | 1932 | port->read_status_mask = ATMEL_US_OVRE; |
1933 | if (termios->c_iflag & INPCK) | 1933 | if (termios->c_iflag & INPCK) |
1934 | port->read_status_mask |= (ATMEL_US_FRAME | ATMEL_US_PARE); | 1934 | port->read_status_mask |= (ATMEL_US_FRAME | ATMEL_US_PARE); |
1935 | if (termios->c_iflag & (BRKINT | PARMRK)) | 1935 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
1936 | port->read_status_mask |= ATMEL_US_RXBRK; | 1936 | port->read_status_mask |= ATMEL_US_RXBRK; |
1937 | 1937 | ||
1938 | if (atmel_use_pdc_rx(port)) | 1938 | if (atmel_use_pdc_rx(port)) |
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c index a47421e4627c..231519022b73 100644 --- a/drivers/tty/serial/bcm63xx_uart.c +++ b/drivers/tty/serial/bcm63xx_uart.c | |||
@@ -567,7 +567,7 @@ static void bcm_uart_set_termios(struct uart_port *port, | |||
567 | port->read_status_mask |= UART_FIFO_FRAMEERR_MASK; | 567 | port->read_status_mask |= UART_FIFO_FRAMEERR_MASK; |
568 | port->read_status_mask |= UART_FIFO_PARERR_MASK; | 568 | port->read_status_mask |= UART_FIFO_PARERR_MASK; |
569 | } | 569 | } |
570 | if (new->c_iflag & (BRKINT)) | 570 | if (new->c_iflag & (IGNBRK | BRKINT)) |
571 | port->read_status_mask |= UART_FIFO_BRKDET_MASK; | 571 | port->read_status_mask |= UART_FIFO_BRKDET_MASK; |
572 | 572 | ||
573 | port->ignore_status_mask = 0; | 573 | port->ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c index 869ceba2ec57..ac86a20992e9 100644 --- a/drivers/tty/serial/bfin_uart.c +++ b/drivers/tty/serial/bfin_uart.c | |||
@@ -833,7 +833,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, | |||
833 | port->read_status_mask = OE; | 833 | port->read_status_mask = OE; |
834 | if (termios->c_iflag & INPCK) | 834 | if (termios->c_iflag & INPCK) |
835 | port->read_status_mask |= (FE | PE); | 835 | port->read_status_mask |= (FE | PE); |
836 | if (termios->c_iflag & (BRKINT | PARMRK)) | 836 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
837 | port->read_status_mask |= BI; | 837 | port->read_status_mask |= BI; |
838 | 838 | ||
839 | /* | 839 | /* |
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c index 2f2b2e538a54..cdbbc788230a 100644 --- a/drivers/tty/serial/dz.c +++ b/drivers/tty/serial/dz.c | |||
@@ -625,7 +625,7 @@ static void dz_set_termios(struct uart_port *uport, struct ktermios *termios, | |||
625 | dport->port.read_status_mask = DZ_OERR; | 625 | dport->port.read_status_mask = DZ_OERR; |
626 | if (termios->c_iflag & INPCK) | 626 | if (termios->c_iflag & INPCK) |
627 | dport->port.read_status_mask |= DZ_FERR | DZ_PERR; | 627 | dport->port.read_status_mask |= DZ_FERR | DZ_PERR; |
628 | if (termios->c_iflag & (BRKINT | PARMRK)) | 628 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
629 | dport->port.read_status_mask |= DZ_BREAK; | 629 | dport->port.read_status_mask |= DZ_BREAK; |
630 | 630 | ||
631 | /* characters to ignore */ | 631 | /* characters to ignore */ |
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index 5131b5ee6164..a514ee6f5406 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <asm/serial.h> | 25 | #include <asm/serial.h> |
26 | 26 | ||
27 | static struct console early_con = { | 27 | static struct console early_con = { |
28 | .name = "earlycon", | 28 | .name = "uart", /* 8250 console switch requires this name */ |
29 | .flags = CON_PRINTBUFFER | CON_BOOT, | 29 | .flags = CON_PRINTBUFFER | CON_BOOT, |
30 | .index = -1, | 30 | .index = -1, |
31 | }; | 31 | }; |
diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c index b373f6416e8c..3b0ee9afd76f 100644 --- a/drivers/tty/serial/efm32-uart.c +++ b/drivers/tty/serial/efm32-uart.c | |||
@@ -407,7 +407,7 @@ static void efm32_uart_set_termios(struct uart_port *port, | |||
407 | if (new->c_iflag & INPCK) | 407 | if (new->c_iflag & INPCK) |
408 | port->read_status_mask |= | 408 | port->read_status_mask |= |
409 | UARTn_RXDATAX_FERR | UARTn_RXDATAX_PERR; | 409 | UARTn_RXDATAX_FERR | UARTn_RXDATAX_PERR; |
410 | if (new->c_iflag & (BRKINT | PARMRK)) | 410 | if (new->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
411 | port->read_status_mask |= SW_UARTn_RXDATAX_BERR; | 411 | port->read_status_mask |= SW_UARTn_RXDATAX_BERR; |
412 | 412 | ||
413 | port->ignore_status_mask = 0; | 413 | port->ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index c5eb897de9de..49385c86cfba 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c | |||
@@ -902,7 +902,7 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
902 | sport->port.read_status_mask = 0; | 902 | sport->port.read_status_mask = 0; |
903 | if (termios->c_iflag & INPCK) | 903 | if (termios->c_iflag & INPCK) |
904 | sport->port.read_status_mask |= (UARTSR1_FE | UARTSR1_PE); | 904 | sport->port.read_status_mask |= (UARTSR1_FE | UARTSR1_PE); |
905 | if (termios->c_iflag & (BRKINT | PARMRK)) | 905 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
906 | sport->port.read_status_mask |= UARTSR1_FE; | 906 | sport->port.read_status_mask |= UARTSR1_FE; |
907 | 907 | ||
908 | /* characters to ignore */ | 908 | /* characters to ignore */ |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index e2f93874989b..044e86d528ae 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -567,6 +567,9 @@ static void imx_start_tx(struct uart_port *port) | |||
567 | struct imx_port *sport = (struct imx_port *)port; | 567 | struct imx_port *sport = (struct imx_port *)port; |
568 | unsigned long temp; | 568 | unsigned long temp; |
569 | 569 | ||
570 | if (uart_circ_empty(&port->state->xmit)) | ||
571 | return; | ||
572 | |||
570 | if (USE_IRDA(sport)) { | 573 | if (USE_IRDA(sport)) { |
571 | /* half duplex in IrDA mode; have to disable receive mode */ | 574 | /* half duplex in IrDA mode; have to disable receive mode */ |
572 | temp = readl(sport->port.membase + UCR4); | 575 | temp = readl(sport->port.membase + UCR4); |
diff --git a/drivers/tty/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c index 1d9420548e16..99b7b8697861 100644 --- a/drivers/tty/serial/ip22zilog.c +++ b/drivers/tty/serial/ip22zilog.c | |||
@@ -603,6 +603,8 @@ static void ip22zilog_start_tx(struct uart_port *port) | |||
603 | } else { | 603 | } else { |
604 | struct circ_buf *xmit = &port->state->xmit; | 604 | struct circ_buf *xmit = &port->state->xmit; |
605 | 605 | ||
606 | if (uart_circ_empty(xmit)) | ||
607 | return; | ||
606 | writeb(xmit->buf[xmit->tail], &channel->data); | 608 | writeb(xmit->buf[xmit->tail], &channel->data); |
607 | ZSDELAY(); | 609 | ZSDELAY(); |
608 | ZS_WSYNC(channel); | 610 | ZS_WSYNC(channel); |
@@ -850,7 +852,7 @@ ip22zilog_convert_to_zs(struct uart_ip22zilog_port *up, unsigned int cflag, | |||
850 | up->port.read_status_mask = Rx_OVR; | 852 | up->port.read_status_mask = Rx_OVR; |
851 | if (iflag & INPCK) | 853 | if (iflag & INPCK) |
852 | up->port.read_status_mask |= CRC_ERR | PAR_ERR; | 854 | up->port.read_status_mask |= CRC_ERR | PAR_ERR; |
853 | if (iflag & (BRKINT | PARMRK)) | 855 | if (iflag & (IGNBRK | BRKINT | PARMRK)) |
854 | up->port.read_status_mask |= BRK_ABRT; | 856 | up->port.read_status_mask |= BRK_ABRT; |
855 | 857 | ||
856 | up->port.ignore_status_mask = 0; | 858 | up->port.ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c index 9cd9b4eba9fc..5702828fb62e 100644 --- a/drivers/tty/serial/m32r_sio.c +++ b/drivers/tty/serial/m32r_sio.c | |||
@@ -266,9 +266,11 @@ static void m32r_sio_start_tx(struct uart_port *port) | |||
266 | if (!(up->ier & UART_IER_THRI)) { | 266 | if (!(up->ier & UART_IER_THRI)) { |
267 | up->ier |= UART_IER_THRI; | 267 | up->ier |= UART_IER_THRI; |
268 | serial_out(up, UART_IER, up->ier); | 268 | serial_out(up, UART_IER, up->ier); |
269 | serial_out(up, UART_TX, xmit->buf[xmit->tail]); | 269 | if (!uart_circ_empty(xmit)) { |
270 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | 270 | serial_out(up, UART_TX, xmit->buf[xmit->tail]); |
271 | up->port.icount.tx++; | 271 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
272 | up->port.icount.tx++; | ||
273 | } | ||
272 | } | 274 | } |
273 | while((serial_in(up, UART_LSR) & UART_EMPTY) != UART_EMPTY); | 275 | while((serial_in(up, UART_LSR) & UART_EMPTY) != UART_EMPTY); |
274 | #else | 276 | #else |
@@ -737,7 +739,7 @@ static void m32r_sio_set_termios(struct uart_port *port, | |||
737 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 739 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
738 | if (termios->c_iflag & INPCK) | 740 | if (termios->c_iflag & INPCK) |
739 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 741 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
740 | if (termios->c_iflag & (BRKINT | PARMRK)) | 742 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
741 | up->port.read_status_mask |= UART_LSR_BI; | 743 | up->port.read_status_mask |= UART_LSR_BI; |
742 | 744 | ||
743 | /* | 745 | /* |
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index 2a99d0c61b9e..ba285cd45b59 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c | |||
@@ -835,7 +835,7 @@ static void max310x_set_termios(struct uart_port *port, | |||
835 | if (termios->c_iflag & INPCK) | 835 | if (termios->c_iflag & INPCK) |
836 | port->read_status_mask |= MAX310X_LSR_RXPAR_BIT | | 836 | port->read_status_mask |= MAX310X_LSR_RXPAR_BIT | |
837 | MAX310X_LSR_FRERR_BIT; | 837 | MAX310X_LSR_FRERR_BIT; |
838 | if (termios->c_iflag & (BRKINT | PARMRK)) | 838 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
839 | port->read_status_mask |= MAX310X_LSR_RXBRK_BIT; | 839 | port->read_status_mask |= MAX310X_LSR_RXBRK_BIT; |
840 | 840 | ||
841 | /* Set status ignore mask */ | 841 | /* Set status ignore mask */ |
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c index 0edfaf8cd269..a6f085717f94 100644 --- a/drivers/tty/serial/mcf.c +++ b/drivers/tty/serial/mcf.c | |||
@@ -248,6 +248,12 @@ static void mcf_set_termios(struct uart_port *port, struct ktermios *termios, | |||
248 | mr1 |= MCFUART_MR1_PARITYNONE; | 248 | mr1 |= MCFUART_MR1_PARITYNONE; |
249 | } | 249 | } |
250 | 250 | ||
251 | /* | ||
252 | * FIXME: port->read_status_mask and port->ignore_status_mask | ||
253 | * need to be initialized based on termios settings for | ||
254 | * INPCK, IGNBRK, IGNPAR, PARMRK, BRKINT | ||
255 | */ | ||
256 | |||
251 | if (termios->c_cflag & CSTOPB) | 257 | if (termios->c_cflag & CSTOPB) |
252 | mr2 |= MCFUART_MR2_STOP2; | 258 | mr2 |= MCFUART_MR2_STOP2; |
253 | else | 259 | else |
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c index 52c930fac210..445799dc9846 100644 --- a/drivers/tty/serial/mfd.c +++ b/drivers/tty/serial/mfd.c | |||
@@ -977,7 +977,7 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, | |||
977 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 977 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
978 | if (termios->c_iflag & INPCK) | 978 | if (termios->c_iflag & INPCK) |
979 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 979 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
980 | if (termios->c_iflag & (BRKINT | PARMRK)) | 980 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
981 | up->port.read_status_mask |= UART_LSR_BI; | 981 | up->port.read_status_mask |= UART_LSR_BI; |
982 | 982 | ||
983 | /* Characters to ignore */ | 983 | /* Characters to ignore */ |
diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c index e30a3ca3cea3..759c6a6fa74a 100644 --- a/drivers/tty/serial/mpsc.c +++ b/drivers/tty/serial/mpsc.c | |||
@@ -1458,7 +1458,7 @@ static void mpsc_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1458 | pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_PE | 1458 | pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_PE |
1459 | | SDMA_DESC_CMDSTAT_FR; | 1459 | | SDMA_DESC_CMDSTAT_FR; |
1460 | 1460 | ||
1461 | if (termios->c_iflag & (BRKINT | PARMRK)) | 1461 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
1462 | pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_BR; | 1462 | pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_BR; |
1463 | 1463 | ||
1464 | /* Characters/events to ignore */ | 1464 | /* Characters/events to ignore */ |
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 778e376f197e..72000a6d5af0 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c | |||
@@ -582,7 +582,7 @@ static void msm_set_termios(struct uart_port *port, struct ktermios *termios, | |||
582 | port->read_status_mask = 0; | 582 | port->read_status_mask = 0; |
583 | if (termios->c_iflag & INPCK) | 583 | if (termios->c_iflag & INPCK) |
584 | port->read_status_mask |= UART_SR_PAR_FRAME_ERR; | 584 | port->read_status_mask |= UART_SR_PAR_FRAME_ERR; |
585 | if (termios->c_iflag & (BRKINT | PARMRK)) | 585 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
586 | port->read_status_mask |= UART_SR_RX_BREAK; | 586 | port->read_status_mask |= UART_SR_RX_BREAK; |
587 | 587 | ||
588 | uart_update_timeout(port, termios->c_cflag, baud); | 588 | uart_update_timeout(port, termios->c_cflag, baud); |
@@ -991,7 +991,7 @@ static const struct of_device_id msm_uartdm_table[] = { | |||
991 | { } | 991 | { } |
992 | }; | 992 | }; |
993 | 993 | ||
994 | static int __init msm_serial_probe(struct platform_device *pdev) | 994 | static int msm_serial_probe(struct platform_device *pdev) |
995 | { | 995 | { |
996 | struct msm_port *msm_port; | 996 | struct msm_port *msm_port; |
997 | struct resource *resource; | 997 | struct resource *resource; |
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 4b5b3c2fe328..86de4477d98a 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c | |||
@@ -604,7 +604,7 @@ static void mxs_auart_settermios(struct uart_port *u, | |||
604 | 604 | ||
605 | if (termios->c_iflag & INPCK) | 605 | if (termios->c_iflag & INPCK) |
606 | u->read_status_mask |= AUART_STAT_PERR; | 606 | u->read_status_mask |= AUART_STAT_PERR; |
607 | if (termios->c_iflag & (BRKINT | PARMRK)) | 607 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
608 | u->read_status_mask |= AUART_STAT_BERR; | 608 | u->read_status_mask |= AUART_STAT_BERR; |
609 | 609 | ||
610 | /* | 610 | /* |
diff --git a/drivers/tty/serial/netx-serial.c b/drivers/tty/serial/netx-serial.c index 0a4dd70d29eb..7a6745601d4e 100644 --- a/drivers/tty/serial/netx-serial.c +++ b/drivers/tty/serial/netx-serial.c | |||
@@ -419,7 +419,7 @@ netx_set_termios(struct uart_port *port, struct ktermios *termios, | |||
419 | } | 419 | } |
420 | 420 | ||
421 | port->read_status_mask = 0; | 421 | port->read_status_mask = 0; |
422 | if (termios->c_iflag & (BRKINT | PARMRK)) | 422 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
423 | port->read_status_mask |= SR_BE; | 423 | port->read_status_mask |= SR_BE; |
424 | if (termios->c_iflag & INPCK) | 424 | if (termios->c_iflag & INPCK) |
425 | port->read_status_mask |= SR_PE | SR_FE; | 425 | port->read_status_mask |= SR_PE | SR_FE; |
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index e9d420ff3931..f7ad5b903055 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c | |||
@@ -653,6 +653,8 @@ static void pmz_start_tx(struct uart_port *port) | |||
653 | } else { | 653 | } else { |
654 | struct circ_buf *xmit = &port->state->xmit; | 654 | struct circ_buf *xmit = &port->state->xmit; |
655 | 655 | ||
656 | if (uart_circ_empty(xmit)) | ||
657 | goto out; | ||
656 | write_zsdata(uap, xmit->buf[xmit->tail]); | 658 | write_zsdata(uap, xmit->buf[xmit->tail]); |
657 | zssync(uap); | 659 | zssync(uap); |
658 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | 660 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
@@ -661,6 +663,7 @@ static void pmz_start_tx(struct uart_port *port) | |||
661 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 663 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
662 | uart_write_wakeup(&uap->port); | 664 | uart_write_wakeup(&uap->port); |
663 | } | 665 | } |
666 | out: | ||
664 | pmz_debug("pmz: start_tx() done.\n"); | 667 | pmz_debug("pmz: start_tx() done.\n"); |
665 | } | 668 | } |
666 | 669 | ||
@@ -1092,7 +1095,7 @@ static void pmz_convert_to_zs(struct uart_pmac_port *uap, unsigned int cflag, | |||
1092 | uap->port.read_status_mask = Rx_OVR; | 1095 | uap->port.read_status_mask = Rx_OVR; |
1093 | if (iflag & INPCK) | 1096 | if (iflag & INPCK) |
1094 | uap->port.read_status_mask |= CRC_ERR | PAR_ERR; | 1097 | uap->port.read_status_mask |= CRC_ERR | PAR_ERR; |
1095 | if (iflag & (BRKINT | PARMRK)) | 1098 | if (iflag & (IGNBRK | BRKINT | PARMRK)) |
1096 | uap->port.read_status_mask |= BRK_ABRT; | 1099 | uap->port.read_status_mask |= BRK_ABRT; |
1097 | 1100 | ||
1098 | uap->port.ignore_status_mask = 0; | 1101 | uap->port.ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/pnx8xxx_uart.c b/drivers/tty/serial/pnx8xxx_uart.c index de6c05c63683..2ba24a45c97f 100644 --- a/drivers/tty/serial/pnx8xxx_uart.c +++ b/drivers/tty/serial/pnx8xxx_uart.c | |||
@@ -477,7 +477,7 @@ pnx8xxx_set_termios(struct uart_port *port, struct ktermios *termios, | |||
477 | sport->port.read_status_mask |= | 477 | sport->port.read_status_mask |= |
478 | FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) | | 478 | FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) | |
479 | FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR); | 479 | FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR); |
480 | if (termios->c_iflag & (BRKINT | PARMRK)) | 480 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
481 | sport->port.read_status_mask |= | 481 | sport->port.read_status_mask |= |
482 | ISTAT_TO_SM(PNX8XXX_UART_INT_BREAK); | 482 | ISTAT_TO_SM(PNX8XXX_UART_INT_BREAK); |
483 | 483 | ||
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index 9e7ee39f8b2a..c638c53cd2b6 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c | |||
@@ -492,7 +492,7 @@ serial_pxa_set_termios(struct uart_port *port, struct ktermios *termios, | |||
492 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 492 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
493 | if (termios->c_iflag & INPCK) | 493 | if (termios->c_iflag & INPCK) |
494 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 494 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
495 | if (termios->c_iflag & (BRKINT | PARMRK)) | 495 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
496 | up->port.read_status_mask |= UART_LSR_BI; | 496 | up->port.read_status_mask |= UART_LSR_BI; |
497 | 497 | ||
498 | /* | 498 | /* |
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 329337711bb0..c1d3ebdf3b97 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
@@ -66,7 +66,7 @@ static void dbg(const char *fmt, ...) | |||
66 | char buff[256]; | 66 | char buff[256]; |
67 | 67 | ||
68 | va_start(va, fmt); | 68 | va_start(va, fmt); |
69 | vscnprintf(buff, sizeof(buf), fmt, va); | 69 | vscnprintf(buff, sizeof(buff), fmt, va); |
70 | va_end(va); | 70 | va_end(va); |
71 | 71 | ||
72 | printascii(buff); | 72 | printascii(buff); |
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c index a7cdec2962dd..771f361c47ea 100644 --- a/drivers/tty/serial/sb1250-duart.c +++ b/drivers/tty/serial/sb1250-duart.c | |||
@@ -596,7 +596,7 @@ static void sbd_set_termios(struct uart_port *uport, struct ktermios *termios, | |||
596 | if (termios->c_iflag & INPCK) | 596 | if (termios->c_iflag & INPCK) |
597 | uport->read_status_mask |= M_DUART_FRM_ERR | | 597 | uport->read_status_mask |= M_DUART_FRM_ERR | |
598 | M_DUART_PARITY_ERR; | 598 | M_DUART_PARITY_ERR; |
599 | if (termios->c_iflag & (BRKINT | PARMRK)) | 599 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
600 | uport->read_status_mask |= M_DUART_RCVD_BRK; | 600 | uport->read_status_mask |= M_DUART_RCVD_BRK; |
601 | 601 | ||
602 | uport->ignore_status_mask = 0; | 602 | uport->ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c index 5443b46345ed..e84b6a3bdd18 100644 --- a/drivers/tty/serial/sccnxp.c +++ b/drivers/tty/serial/sccnxp.c | |||
@@ -665,7 +665,7 @@ static void sccnxp_set_termios(struct uart_port *port, | |||
665 | port->read_status_mask = SR_OVR; | 665 | port->read_status_mask = SR_OVR; |
666 | if (termios->c_iflag & INPCK) | 666 | if (termios->c_iflag & INPCK) |
667 | port->read_status_mask |= SR_PE | SR_FE; | 667 | port->read_status_mask |= SR_PE | SR_FE; |
668 | if (termios->c_iflag & (BRKINT | PARMRK)) | 668 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
669 | port->read_status_mask |= SR_BRK; | 669 | port->read_status_mask |= SR_BRK; |
670 | 670 | ||
671 | /* Set status ignore mask */ | 671 | /* Set status ignore mask */ |
diff --git a/drivers/tty/serial/serial_ks8695.c b/drivers/tty/serial/serial_ks8695.c index e1caa99e3d3b..5c79bdab985d 100644 --- a/drivers/tty/serial/serial_ks8695.c +++ b/drivers/tty/serial/serial_ks8695.c | |||
@@ -437,7 +437,7 @@ static void ks8695uart_set_termios(struct uart_port *port, struct ktermios *term | |||
437 | port->read_status_mask = URLS_URROE; | 437 | port->read_status_mask = URLS_URROE; |
438 | if (termios->c_iflag & INPCK) | 438 | if (termios->c_iflag & INPCK) |
439 | port->read_status_mask |= (URLS_URFE | URLS_URPE); | 439 | port->read_status_mask |= (URLS_URFE | URLS_URPE); |
440 | if (termios->c_iflag & (BRKINT | PARMRK)) | 440 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
441 | port->read_status_mask |= URLS_URBI; | 441 | port->read_status_mask |= URLS_URBI; |
442 | 442 | ||
443 | /* | 443 | /* |
diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c index 60f49b9d7e39..ea8546092c7e 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c | |||
@@ -697,7 +697,7 @@ serial_txx9_set_termios(struct uart_port *port, struct ktermios *termios, | |||
697 | TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS; | 697 | TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS; |
698 | if (termios->c_iflag & INPCK) | 698 | if (termios->c_iflag & INPCK) |
699 | up->port.read_status_mask |= TXX9_SIDISR_UFER | TXX9_SIDISR_UPER; | 699 | up->port.read_status_mask |= TXX9_SIDISR_UFER | TXX9_SIDISR_UPER; |
700 | if (termios->c_iflag & (BRKINT | PARMRK)) | 700 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
701 | up->port.read_status_mask |= TXX9_SIDISR_UBRK; | 701 | up->port.read_status_mask |= TXX9_SIDISR_UBRK; |
702 | 702 | ||
703 | /* | 703 | /* |
diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c index 1f2be48c92ce..9b4d71cff00d 100644 --- a/drivers/tty/serial/sirfsoc_uart.c +++ b/drivers/tty/serial/sirfsoc_uart.c | |||
@@ -896,7 +896,7 @@ static void sirfsoc_uart_set_termios(struct uart_port *port, | |||
896 | if (termios->c_iflag & INPCK) | 896 | if (termios->c_iflag & INPCK) |
897 | port->read_status_mask |= uint_en->sirfsoc_frm_err_en; | 897 | port->read_status_mask |= uint_en->sirfsoc_frm_err_en; |
898 | } | 898 | } |
899 | if (termios->c_iflag & (BRKINT | PARMRK)) | 899 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
900 | port->read_status_mask |= uint_en->sirfsoc_rxd_brk_en; | 900 | port->read_status_mask |= uint_en->sirfsoc_rxd_brk_en; |
901 | if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) { | 901 | if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) { |
902 | if (termios->c_iflag & IGNPAR) | 902 | if (termios->c_iflag & IGNPAR) |
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index c7f61ac27132..f48b1cc07eea 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c | |||
@@ -547,7 +547,7 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios, | |||
547 | ascport->port.read_status_mask = ASC_RXBUF_DUMMY_OE; | 547 | ascport->port.read_status_mask = ASC_RXBUF_DUMMY_OE; |
548 | if (termios->c_iflag & INPCK) | 548 | if (termios->c_iflag & INPCK) |
549 | ascport->port.read_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE; | 549 | ascport->port.read_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE; |
550 | if (termios->c_iflag & (BRKINT | PARMRK)) | 550 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
551 | ascport->port.read_status_mask |= ASC_RXBUF_DUMMY_BE; | 551 | ascport->port.read_status_mask |= ASC_RXBUF_DUMMY_BE; |
552 | 552 | ||
553 | /* | 553 | /* |
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c index 5faa8e905e98..2f57df9a71d9 100644 --- a/drivers/tty/serial/sunsab.c +++ b/drivers/tty/serial/sunsab.c | |||
@@ -427,6 +427,9 @@ static void sunsab_start_tx(struct uart_port *port) | |||
427 | struct circ_buf *xmit = &up->port.state->xmit; | 427 | struct circ_buf *xmit = &up->port.state->xmit; |
428 | int i; | 428 | int i; |
429 | 429 | ||
430 | if (uart_circ_empty(xmit)) | ||
431 | return; | ||
432 | |||
430 | up->interrupt_mask1 &= ~(SAB82532_IMR1_ALLS|SAB82532_IMR1_XPR); | 433 | up->interrupt_mask1 &= ~(SAB82532_IMR1_ALLS|SAB82532_IMR1_XPR); |
431 | writeb(up->interrupt_mask1, &up->regs->w.imr1); | 434 | writeb(up->interrupt_mask1, &up->regs->w.imr1); |
432 | 435 | ||
@@ -719,7 +722,7 @@ static void sunsab_convert_to_sab(struct uart_sunsab_port *up, unsigned int cfla | |||
719 | if (iflag & INPCK) | 722 | if (iflag & INPCK) |
720 | up->port.read_status_mask |= (SAB82532_ISR0_PERR | | 723 | up->port.read_status_mask |= (SAB82532_ISR0_PERR | |
721 | SAB82532_ISR0_FERR); | 724 | SAB82532_ISR0_FERR); |
722 | if (iflag & (BRKINT | PARMRK)) | 725 | if (iflag & (IGNBRK | BRKINT | PARMRK)) |
723 | up->port.read_status_mask |= (SAB82532_ISR1_BRK << 8); | 726 | up->port.read_status_mask |= (SAB82532_ISR1_BRK << 8); |
724 | 727 | ||
725 | /* | 728 | /* |
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index 9a0f24f83720..5326ae195e5f 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c | |||
@@ -834,7 +834,7 @@ sunsu_change_speed(struct uart_port *port, unsigned int cflag, | |||
834 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 834 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
835 | if (iflag & INPCK) | 835 | if (iflag & INPCK) |
836 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 836 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
837 | if (iflag & (BRKINT | PARMRK)) | 837 | if (iflag & (IGNBRK | BRKINT | PARMRK)) |
838 | up->port.read_status_mask |= UART_LSR_BI; | 838 | up->port.read_status_mask |= UART_LSR_BI; |
839 | 839 | ||
840 | /* | 840 | /* |
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index a2c40ed287d2..02df3940b95e 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c | |||
@@ -703,6 +703,8 @@ static void sunzilog_start_tx(struct uart_port *port) | |||
703 | } else { | 703 | } else { |
704 | struct circ_buf *xmit = &port->state->xmit; | 704 | struct circ_buf *xmit = &port->state->xmit; |
705 | 705 | ||
706 | if (uart_circ_empty(xmit)) | ||
707 | return; | ||
706 | writeb(xmit->buf[xmit->tail], &channel->data); | 708 | writeb(xmit->buf[xmit->tail], &channel->data); |
707 | ZSDELAY(); | 709 | ZSDELAY(); |
708 | ZS_WSYNC(channel); | 710 | ZS_WSYNC(channel); |
@@ -915,7 +917,7 @@ sunzilog_convert_to_zs(struct uart_sunzilog_port *up, unsigned int cflag, | |||
915 | up->port.read_status_mask = Rx_OVR; | 917 | up->port.read_status_mask = Rx_OVR; |
916 | if (iflag & INPCK) | 918 | if (iflag & INPCK) |
917 | up->port.read_status_mask |= CRC_ERR | PAR_ERR; | 919 | up->port.read_status_mask |= CRC_ERR | PAR_ERR; |
918 | if (iflag & (BRKINT | PARMRK)) | 920 | if (iflag & (IGNBRK | BRKINT | PARMRK)) |
919 | up->port.read_status_mask |= BRK_ABRT; | 921 | up->port.read_status_mask |= BRK_ABRT; |
920 | 922 | ||
921 | up->port.ignore_status_mask = 0; | 923 | up->port.ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index d569ca58bab6..1c52074c38df 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c | |||
@@ -936,7 +936,7 @@ static void qe_uart_set_termios(struct uart_port *port, | |||
936 | port->read_status_mask = BD_SC_EMPTY | BD_SC_OV; | 936 | port->read_status_mask = BD_SC_EMPTY | BD_SC_OV; |
937 | if (termios->c_iflag & INPCK) | 937 | if (termios->c_iflag & INPCK) |
938 | port->read_status_mask |= BD_SC_FR | BD_SC_PR; | 938 | port->read_status_mask |= BD_SC_FR | BD_SC_PR; |
939 | if (termios->c_iflag & (BRKINT | PARMRK)) | 939 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
940 | port->read_status_mask |= BD_SC_BR; | 940 | port->read_status_mask |= BD_SC_BR; |
941 | 941 | ||
942 | /* | 942 | /* |
diff --git a/drivers/tty/serial/vr41xx_siu.c b/drivers/tty/serial/vr41xx_siu.c index a63c14bc9a24..db0c8a4ab03e 100644 --- a/drivers/tty/serial/vr41xx_siu.c +++ b/drivers/tty/serial/vr41xx_siu.c | |||
@@ -559,7 +559,7 @@ static void siu_set_termios(struct uart_port *port, struct ktermios *new, | |||
559 | port->read_status_mask = UART_LSR_THRE | UART_LSR_OE | UART_LSR_DR; | 559 | port->read_status_mask = UART_LSR_THRE | UART_LSR_OE | UART_LSR_DR; |
560 | if (c_iflag & INPCK) | 560 | if (c_iflag & INPCK) |
561 | port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 561 | port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
562 | if (c_iflag & (BRKINT | PARMRK)) | 562 | if (c_iflag & (IGNBRK | BRKINT | PARMRK)) |
563 | port->read_status_mask |= UART_LSR_BI; | 563 | port->read_status_mask |= UART_LSR_BI; |
564 | 564 | ||
565 | port->ignore_status_mask = 0; | 565 | port->ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/zs.c b/drivers/tty/serial/zs.c index 6a169877109b..2b65bb7ffb8a 100644 --- a/drivers/tty/serial/zs.c +++ b/drivers/tty/serial/zs.c | |||
@@ -923,7 +923,7 @@ static void zs_set_termios(struct uart_port *uport, struct ktermios *termios, | |||
923 | uport->read_status_mask = Rx_OVR; | 923 | uport->read_status_mask = Rx_OVR; |
924 | if (termios->c_iflag & INPCK) | 924 | if (termios->c_iflag & INPCK) |
925 | uport->read_status_mask |= FRM_ERR | PAR_ERR; | 925 | uport->read_status_mask |= FRM_ERR | PAR_ERR; |
926 | if (termios->c_iflag & (BRKINT | PARMRK)) | 926 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
927 | uport->read_status_mask |= Rx_BRK; | 927 | uport->read_status_mask |= Rx_BRK; |
928 | 928 | ||
929 | uport->ignore_status_mask = 0; | 929 | uport->ignore_status_mask = 0; |
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 5e0f6ff2e2f5..b33b00b386de 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -3226,8 +3226,7 @@ int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt | |||
3226 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | 3226 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
3227 | con_back = ®istered_con_driver[i]; | 3227 | con_back = ®istered_con_driver[i]; |
3228 | 3228 | ||
3229 | if (con_back->con && | 3229 | if (con_back->con && con_back->con != csw) { |
3230 | !(con_back->flag & CON_DRIVER_FLAG_MODULE)) { | ||
3231 | defcsw = con_back->con; | 3230 | defcsw = con_back->con; |
3232 | retval = 0; | 3231 | retval = 0; |
3233 | break; | 3232 | break; |
@@ -3332,6 +3331,7 @@ static int vt_unbind(struct con_driver *con) | |||
3332 | { | 3331 | { |
3333 | const struct consw *csw = NULL; | 3332 | const struct consw *csw = NULL; |
3334 | int i, more = 1, first = -1, last = -1, deflt = 0; | 3333 | int i, more = 1, first = -1, last = -1, deflt = 0; |
3334 | int ret; | ||
3335 | 3335 | ||
3336 | if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || | 3336 | if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || |
3337 | con_is_graphics(con->con, con->first, con->last)) | 3337 | con_is_graphics(con->con, con->first, con->last)) |
@@ -3357,8 +3357,10 @@ static int vt_unbind(struct con_driver *con) | |||
3357 | 3357 | ||
3358 | if (first != -1) { | 3358 | if (first != -1) { |
3359 | console_lock(); | 3359 | console_lock(); |
3360 | do_unbind_con_driver(csw, first, last, deflt); | 3360 | ret = do_unbind_con_driver(csw, first, last, deflt); |
3361 | console_unlock(); | 3361 | console_unlock(); |
3362 | if (ret != 0) | ||
3363 | return ret; | ||
3362 | } | 3364 | } |
3363 | 3365 | ||
3364 | first = -1; | 3366 | first = -1; |
@@ -3645,17 +3647,20 @@ err: | |||
3645 | */ | 3647 | */ |
3646 | int do_unregister_con_driver(const struct consw *csw) | 3648 | int do_unregister_con_driver(const struct consw *csw) |
3647 | { | 3649 | { |
3648 | int i, retval = -ENODEV; | 3650 | int i; |
3649 | 3651 | ||
3650 | /* cannot unregister a bound driver */ | 3652 | /* cannot unregister a bound driver */ |
3651 | if (con_is_bound(csw)) | 3653 | if (con_is_bound(csw)) |
3652 | goto err; | 3654 | return -EBUSY; |
3655 | |||
3656 | if (csw == conswitchp) | ||
3657 | return -EINVAL; | ||
3653 | 3658 | ||
3654 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | 3659 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
3655 | struct con_driver *con_driver = ®istered_con_driver[i]; | 3660 | struct con_driver *con_driver = ®istered_con_driver[i]; |
3656 | 3661 | ||
3657 | if (con_driver->con == csw && | 3662 | if (con_driver->con == csw && |
3658 | con_driver->flag & CON_DRIVER_FLAG_MODULE) { | 3663 | con_driver->flag & CON_DRIVER_FLAG_INIT) { |
3659 | vtconsole_deinit_device(con_driver); | 3664 | vtconsole_deinit_device(con_driver); |
3660 | device_destroy(vtconsole_class, | 3665 | device_destroy(vtconsole_class, |
3661 | MKDEV(0, con_driver->node)); | 3666 | MKDEV(0, con_driver->node)); |
@@ -3666,12 +3671,11 @@ int do_unregister_con_driver(const struct consw *csw) | |||
3666 | con_driver->flag = 0; | 3671 | con_driver->flag = 0; |
3667 | con_driver->first = 0; | 3672 | con_driver->first = 0; |
3668 | con_driver->last = 0; | 3673 | con_driver->last = 0; |
3669 | retval = 0; | 3674 | return 0; |
3670 | break; | ||
3671 | } | 3675 | } |
3672 | } | 3676 | } |
3673 | err: | 3677 | |
3674 | return retval; | 3678 | return -ENODEV; |
3675 | } | 3679 | } |
3676 | EXPORT_SYMBOL_GPL(do_unregister_con_driver); | 3680 | EXPORT_SYMBOL_GPL(do_unregister_con_driver); |
3677 | 3681 | ||
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index e371f5af11f5..a673e5b6a2e0 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -655,7 +655,7 @@ static int uio_mmap_physical(struct vm_area_struct *vma) | |||
655 | 655 | ||
656 | if (mem->addr & ~PAGE_MASK) | 656 | if (mem->addr & ~PAGE_MASK) |
657 | return -ENODEV; | 657 | return -ENODEV; |
658 | if (vma->vm_end - vma->vm_start > PAGE_ALIGN(mem->size)) | 658 | if (vma->vm_end - vma->vm_start > mem->size) |
659 | return -EINVAL; | 659 | return -EINVAL; |
660 | 660 | ||
661 | vma->vm_ops = &uio_physical_vm_ops; | 661 | vma->vm_ops = &uio_physical_vm_ops; |
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 69425b3cb6b7..9d2b673f90e3 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -1321,6 +1321,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
1321 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); | 1321 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
1322 | struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); | 1322 | struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); |
1323 | unsigned long flags; | 1323 | unsigned long flags; |
1324 | struct td_node *node, *tmpnode; | ||
1324 | 1325 | ||
1325 | if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || | 1326 | if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || |
1326 | hwep->ep.desc == NULL || list_empty(&hwreq->queue) || | 1327 | hwep->ep.desc == NULL || list_empty(&hwreq->queue) || |
@@ -1331,6 +1332,12 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
1331 | 1332 | ||
1332 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); | 1333 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); |
1333 | 1334 | ||
1335 | list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { | ||
1336 | dma_pool_free(hwep->td_pool, node->ptr, node->dma); | ||
1337 | list_del(&node->td); | ||
1338 | kfree(node); | ||
1339 | } | ||
1340 | |||
1334 | /* pop request */ | 1341 | /* pop request */ |
1335 | list_del_init(&hwreq->queue); | 1342 | list_del_init(&hwreq->queue); |
1336 | 1343 | ||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 879b66e13370..21b99b4b4082 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1526,18 +1526,6 @@ static int hub_configure(struct usb_hub *hub, | |||
1526 | dev_dbg(hub_dev, "%umA bus power budget for each child\n", | 1526 | dev_dbg(hub_dev, "%umA bus power budget for each child\n", |
1527 | hub->mA_per_port); | 1527 | hub->mA_per_port); |
1528 | 1528 | ||
1529 | /* Update the HCD's internal representation of this hub before khubd | ||
1530 | * starts getting port status changes for devices under the hub. | ||
1531 | */ | ||
1532 | if (hcd->driver->update_hub_device) { | ||
1533 | ret = hcd->driver->update_hub_device(hcd, hdev, | ||
1534 | &hub->tt, GFP_KERNEL); | ||
1535 | if (ret < 0) { | ||
1536 | message = "can't update HCD hub info"; | ||
1537 | goto fail; | ||
1538 | } | ||
1539 | } | ||
1540 | |||
1541 | ret = hub_hub_status(hub, &hubstatus, &hubchange); | 1529 | ret = hub_hub_status(hub, &hubstatus, &hubchange); |
1542 | if (ret < 0) { | 1530 | if (ret < 0) { |
1543 | message = "can't get hub status"; | 1531 | message = "can't get hub status"; |
@@ -1589,10 +1577,28 @@ static int hub_configure(struct usb_hub *hub, | |||
1589 | } | 1577 | } |
1590 | } | 1578 | } |
1591 | hdev->maxchild = i; | 1579 | hdev->maxchild = i; |
1580 | for (i = 0; i < hdev->maxchild; i++) { | ||
1581 | struct usb_port *port_dev = hub->ports[i]; | ||
1582 | |||
1583 | pm_runtime_put(&port_dev->dev); | ||
1584 | } | ||
1585 | |||
1592 | mutex_unlock(&usb_port_peer_mutex); | 1586 | mutex_unlock(&usb_port_peer_mutex); |
1593 | if (ret < 0) | 1587 | if (ret < 0) |
1594 | goto fail; | 1588 | goto fail; |
1595 | 1589 | ||
1590 | /* Update the HCD's internal representation of this hub before khubd | ||
1591 | * starts getting port status changes for devices under the hub. | ||
1592 | */ | ||
1593 | if (hcd->driver->update_hub_device) { | ||
1594 | ret = hcd->driver->update_hub_device(hcd, hdev, | ||
1595 | &hub->tt, GFP_KERNEL); | ||
1596 | if (ret < 0) { | ||
1597 | message = "can't update HCD hub info"; | ||
1598 | goto fail; | ||
1599 | } | ||
1600 | } | ||
1601 | |||
1596 | usb_hub_adjust_deviceremovable(hdev, hub->descriptor); | 1602 | usb_hub_adjust_deviceremovable(hdev, hub->descriptor); |
1597 | 1603 | ||
1598 | hub_activate(hub, HUB_INIT); | 1604 | hub_activate(hub, HUB_INIT); |
@@ -3458,7 +3464,8 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) | |||
3458 | struct usb_device *udev = port_dev->child; | 3464 | struct usb_device *udev = port_dev->child; |
3459 | 3465 | ||
3460 | if (udev && udev->can_submit) { | 3466 | if (udev && udev->can_submit) { |
3461 | dev_warn(&port_dev->dev, "not suspended yet\n"); | 3467 | dev_warn(&port_dev->dev, "device %s not suspended yet\n", |
3468 | dev_name(&udev->dev)); | ||
3462 | if (PMSG_IS_AUTO(msg)) | 3469 | if (PMSG_IS_AUTO(msg)) |
3463 | return -EBUSY; | 3470 | return -EBUSY; |
3464 | } | 3471 | } |
diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 0a7cdc0ef0a9..326308e53961 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h | |||
@@ -84,6 +84,7 @@ struct usb_hub { | |||
84 | * @dev: generic device interface | 84 | * @dev: generic device interface |
85 | * @port_owner: port's owner | 85 | * @port_owner: port's owner |
86 | * @peer: related usb2 and usb3 ports (share the same connector) | 86 | * @peer: related usb2 and usb3 ports (share the same connector) |
87 | * @req: default pm qos request for hubs without port power control | ||
87 | * @connect_type: port's connect type | 88 | * @connect_type: port's connect type |
88 | * @location: opaque representation of platform connector location | 89 | * @location: opaque representation of platform connector location |
89 | * @status_lock: synchronize port_event() vs usb_port_{suspend|resume} | 90 | * @status_lock: synchronize port_event() vs usb_port_{suspend|resume} |
@@ -95,6 +96,7 @@ struct usb_port { | |||
95 | struct device dev; | 96 | struct device dev; |
96 | struct usb_dev_state *port_owner; | 97 | struct usb_dev_state *port_owner; |
97 | struct usb_port *peer; | 98 | struct usb_port *peer; |
99 | struct dev_pm_qos_request *req; | ||
98 | enum usb_port_connect_type connect_type; | 100 | enum usb_port_connect_type connect_type; |
99 | usb_port_location_t location; | 101 | usb_port_location_t location; |
100 | struct mutex status_lock; | 102 | struct mutex status_lock; |
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 62036faf56c0..fe1b6d0967e3 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c | |||
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | #include "hub.h" | 22 | #include "hub.h" |
23 | 23 | ||
24 | static int usb_port_block_power_off; | ||
25 | |||
24 | static const struct attribute_group *port_dev_group[]; | 26 | static const struct attribute_group *port_dev_group[]; |
25 | 27 | ||
26 | static ssize_t connect_type_show(struct device *dev, | 28 | static ssize_t connect_type_show(struct device *dev, |
@@ -66,6 +68,7 @@ static void usb_port_device_release(struct device *dev) | |||
66 | { | 68 | { |
67 | struct usb_port *port_dev = to_usb_port(dev); | 69 | struct usb_port *port_dev = to_usb_port(dev); |
68 | 70 | ||
71 | kfree(port_dev->req); | ||
69 | kfree(port_dev); | 72 | kfree(port_dev); |
70 | } | 73 | } |
71 | 74 | ||
@@ -142,6 +145,9 @@ static int usb_port_runtime_suspend(struct device *dev) | |||
142 | == PM_QOS_FLAGS_ALL) | 145 | == PM_QOS_FLAGS_ALL) |
143 | return -EAGAIN; | 146 | return -EAGAIN; |
144 | 147 | ||
148 | if (usb_port_block_power_off) | ||
149 | return -EBUSY; | ||
150 | |||
145 | usb_autopm_get_interface(intf); | 151 | usb_autopm_get_interface(intf); |
146 | retval = usb_hub_set_port_power(hdev, hub, port1, false); | 152 | retval = usb_hub_set_port_power(hdev, hub, port1, false); |
147 | usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION); | 153 | usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION); |
@@ -190,11 +196,19 @@ static int link_peers(struct usb_port *left, struct usb_port *right) | |||
190 | if (left->peer || right->peer) { | 196 | if (left->peer || right->peer) { |
191 | struct usb_port *lpeer = left->peer; | 197 | struct usb_port *lpeer = left->peer; |
192 | struct usb_port *rpeer = right->peer; | 198 | struct usb_port *rpeer = right->peer; |
193 | 199 | char *method; | |
194 | WARN(1, "failed to peer %s and %s (%s -> %p) (%s -> %p)\n", | 200 | |
195 | dev_name(&left->dev), dev_name(&right->dev), | 201 | if (left->location && left->location == right->location) |
196 | dev_name(&left->dev), lpeer, | 202 | method = "location"; |
197 | dev_name(&right->dev), rpeer); | 203 | else |
204 | method = "default"; | ||
205 | |||
206 | pr_warn("usb: failed to peer %s and %s by %s (%s:%s) (%s:%s)\n", | ||
207 | dev_name(&left->dev), dev_name(&right->dev), method, | ||
208 | dev_name(&left->dev), | ||
209 | lpeer ? dev_name(&lpeer->dev) : "none", | ||
210 | dev_name(&right->dev), | ||
211 | rpeer ? dev_name(&rpeer->dev) : "none"); | ||
198 | return -EBUSY; | 212 | return -EBUSY; |
199 | } | 213 | } |
200 | 214 | ||
@@ -251,6 +265,7 @@ static void link_peers_report(struct usb_port *left, struct usb_port *right) | |||
251 | dev_warn(&left->dev, "failed to peer to %s (%d)\n", | 265 | dev_warn(&left->dev, "failed to peer to %s (%d)\n", |
252 | dev_name(&right->dev), rc); | 266 | dev_name(&right->dev), rc); |
253 | pr_warn_once("usb: port power management may be unreliable\n"); | 267 | pr_warn_once("usb: port power management may be unreliable\n"); |
268 | usb_port_block_power_off = 1; | ||
254 | } | 269 | } |
255 | } | 270 | } |
256 | 271 | ||
@@ -386,9 +401,13 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) | |||
386 | int retval; | 401 | int retval; |
387 | 402 | ||
388 | port_dev = kzalloc(sizeof(*port_dev), GFP_KERNEL); | 403 | port_dev = kzalloc(sizeof(*port_dev), GFP_KERNEL); |
389 | if (!port_dev) { | 404 | if (!port_dev) |
390 | retval = -ENOMEM; | 405 | return -ENOMEM; |
391 | goto exit; | 406 | |
407 | port_dev->req = kzalloc(sizeof(*(port_dev->req)), GFP_KERNEL); | ||
408 | if (!port_dev->req) { | ||
409 | kfree(port_dev); | ||
410 | return -ENOMEM; | ||
392 | } | 411 | } |
393 | 412 | ||
394 | hub->ports[port1 - 1] = port_dev; | 413 | hub->ports[port1 - 1] = port_dev; |
@@ -404,31 +423,53 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) | |||
404 | port1); | 423 | port1); |
405 | mutex_init(&port_dev->status_lock); | 424 | mutex_init(&port_dev->status_lock); |
406 | retval = device_register(&port_dev->dev); | 425 | retval = device_register(&port_dev->dev); |
407 | if (retval) | 426 | if (retval) { |
408 | goto error_register; | 427 | put_device(&port_dev->dev); |
428 | return retval; | ||
429 | } | ||
430 | |||
431 | /* Set default policy of port-poweroff disabled. */ | ||
432 | retval = dev_pm_qos_add_request(&port_dev->dev, port_dev->req, | ||
433 | DEV_PM_QOS_FLAGS, PM_QOS_FLAG_NO_POWER_OFF); | ||
434 | if (retval < 0) { | ||
435 | device_unregister(&port_dev->dev); | ||
436 | return retval; | ||
437 | } | ||
409 | 438 | ||
410 | find_and_link_peer(hub, port1); | 439 | find_and_link_peer(hub, port1); |
411 | 440 | ||
441 | /* | ||
442 | * Enable runtime pm and hold a refernce that hub_configure() | ||
443 | * will drop once the PM_QOS_NO_POWER_OFF flag state has been set | ||
444 | * and the hub has been fully registered (hdev->maxchild set). | ||
445 | */ | ||
412 | pm_runtime_set_active(&port_dev->dev); | 446 | pm_runtime_set_active(&port_dev->dev); |
447 | pm_runtime_get_noresume(&port_dev->dev); | ||
448 | pm_runtime_enable(&port_dev->dev); | ||
449 | device_enable_async_suspend(&port_dev->dev); | ||
413 | 450 | ||
414 | /* | 451 | /* |
415 | * Do not enable port runtime pm if the hub does not support | 452 | * Keep hidden the ability to enable port-poweroff if the hub |
416 | * power switching. Also, userspace must have final say of | 453 | * does not support power switching. |
417 | * whether a port is permitted to power-off. Do not enable | ||
418 | * runtime pm if we fail to expose pm_qos_no_power_off. | ||
419 | */ | 454 | */ |
420 | if (hub_is_port_power_switchable(hub) | 455 | if (!hub_is_port_power_switchable(hub)) |
421 | && dev_pm_qos_expose_flags(&port_dev->dev, | 456 | return 0; |
422 | PM_QOS_FLAG_NO_POWER_OFF) == 0) | ||
423 | pm_runtime_enable(&port_dev->dev); | ||
424 | 457 | ||
425 | device_enable_async_suspend(&port_dev->dev); | 458 | /* Attempt to let userspace take over the policy. */ |
426 | return 0; | 459 | retval = dev_pm_qos_expose_flags(&port_dev->dev, |
460 | PM_QOS_FLAG_NO_POWER_OFF); | ||
461 | if (retval < 0) { | ||
462 | dev_warn(&port_dev->dev, "failed to expose pm_qos_no_poweroff\n"); | ||
463 | return 0; | ||
464 | } | ||
427 | 465 | ||
428 | error_register: | 466 | /* Userspace owns the policy, drop the kernel 'no_poweroff' request. */ |
429 | put_device(&port_dev->dev); | 467 | retval = dev_pm_qos_remove_request(port_dev->req); |
430 | exit: | 468 | if (retval >= 0) { |
431 | return retval; | 469 | kfree(port_dev->req); |
470 | port_dev->req = NULL; | ||
471 | } | ||
472 | return 0; | ||
432 | } | 473 | } |
433 | 474 | ||
434 | void usb_hub_remove_port_device(struct usb_hub *hub, int port1) | 475 | void usb_hub_remove_port_device(struct usb_hub *hub, int port1) |
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index 8eb996e4f058..261c3b428220 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig | |||
@@ -45,6 +45,7 @@ comment "Platform Glue Driver Support" | |||
45 | config USB_DWC3_OMAP | 45 | config USB_DWC3_OMAP |
46 | tristate "Texas Instruments OMAP5 and similar Platforms" | 46 | tristate "Texas Instruments OMAP5 and similar Platforms" |
47 | depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) | 47 | depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) |
48 | depends on OF | ||
48 | default USB_DWC3 | 49 | default USB_DWC3 |
49 | help | 50 | help |
50 | Some platforms from Texas Instruments like OMAP5, DRA7xxx and | 51 | Some platforms from Texas Instruments like OMAP5, DRA7xxx and |
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 4af4c3567656..07a736acd0f2 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -322,7 +322,7 @@ static int dwc3_omap_remove_core(struct device *dev, void *c) | |||
322 | { | 322 | { |
323 | struct platform_device *pdev = to_platform_device(dev); | 323 | struct platform_device *pdev = to_platform_device(dev); |
324 | 324 | ||
325 | platform_device_unregister(pdev); | 325 | of_device_unregister(pdev); |
326 | 326 | ||
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
@@ -599,7 +599,7 @@ static int dwc3_omap_prepare(struct device *dev) | |||
599 | { | 599 | { |
600 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 600 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
601 | 601 | ||
602 | dwc3_omap_disable_irqs(omap); | 602 | dwc3_omap_write_irqmisc_set(omap, 0x00); |
603 | 603 | ||
604 | return 0; | 604 | return 0; |
605 | } | 605 | } |
@@ -607,8 +607,19 @@ static int dwc3_omap_prepare(struct device *dev) | |||
607 | static void dwc3_omap_complete(struct device *dev) | 607 | static void dwc3_omap_complete(struct device *dev) |
608 | { | 608 | { |
609 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 609 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
610 | u32 reg; | ||
610 | 611 | ||
611 | dwc3_omap_enable_irqs(omap); | 612 | reg = (USBOTGSS_IRQMISC_OEVT | |
613 | USBOTGSS_IRQMISC_DRVVBUS_RISE | | ||
614 | USBOTGSS_IRQMISC_CHRGVBUS_RISE | | ||
615 | USBOTGSS_IRQMISC_DISCHRGVBUS_RISE | | ||
616 | USBOTGSS_IRQMISC_IDPULLUP_RISE | | ||
617 | USBOTGSS_IRQMISC_DRVVBUS_FALL | | ||
618 | USBOTGSS_IRQMISC_CHRGVBUS_FALL | | ||
619 | USBOTGSS_IRQMISC_DISCHRGVBUS_FALL | | ||
620 | USBOTGSS_IRQMISC_IDPULLUP_FALL); | ||
621 | |||
622 | dwc3_omap_write_irqmisc_set(omap, reg); | ||
612 | } | 623 | } |
613 | 624 | ||
614 | static int dwc3_omap_suspend(struct device *dev) | 625 | static int dwc3_omap_suspend(struct device *dev) |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9d64dd02c57e..dab7927d1009 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -828,10 +828,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
828 | length, last ? " last" : "", | 828 | length, last ? " last" : "", |
829 | chain ? " chain" : ""); | 829 | chain ? " chain" : ""); |
830 | 830 | ||
831 | /* Skip the LINK-TRB on ISOC */ | ||
832 | if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && | ||
833 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) | ||
834 | dep->free_slot++; | ||
835 | 831 | ||
836 | trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; | 832 | trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; |
837 | 833 | ||
@@ -843,6 +839,10 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
843 | } | 839 | } |
844 | 840 | ||
845 | dep->free_slot++; | 841 | dep->free_slot++; |
842 | /* Skip the LINK-TRB on ISOC */ | ||
843 | if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && | ||
844 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) | ||
845 | dep->free_slot++; | ||
846 | 846 | ||
847 | trb->size = DWC3_TRB_SIZE_LENGTH(length); | 847 | trb->size = DWC3_TRB_SIZE_LENGTH(length); |
848 | trb->bpl = lower_32_bits(dma); | 848 | trb->bpl = lower_32_bits(dma); |
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 2ddcd635ca2a..97142146eead 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
@@ -1145,15 +1145,15 @@ static struct configfs_item_operations interf_item_ops = { | |||
1145 | .store_attribute = usb_os_desc_attr_store, | 1145 | .store_attribute = usb_os_desc_attr_store, |
1146 | }; | 1146 | }; |
1147 | 1147 | ||
1148 | static ssize_t rndis_grp_compatible_id_show(struct usb_os_desc *desc, | 1148 | static ssize_t interf_grp_compatible_id_show(struct usb_os_desc *desc, |
1149 | char *page) | 1149 | char *page) |
1150 | { | 1150 | { |
1151 | memcpy(page, desc->ext_compat_id, 8); | 1151 | memcpy(page, desc->ext_compat_id, 8); |
1152 | return 8; | 1152 | return 8; |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc, | 1155 | static ssize_t interf_grp_compatible_id_store(struct usb_os_desc *desc, |
1156 | const char *page, size_t len) | 1156 | const char *page, size_t len) |
1157 | { | 1157 | { |
1158 | int l; | 1158 | int l; |
1159 | 1159 | ||
@@ -1171,20 +1171,20 @@ static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc, | |||
1171 | return len; | 1171 | return len; |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | static struct usb_os_desc_attribute rndis_grp_attr_compatible_id = | 1174 | static struct usb_os_desc_attribute interf_grp_attr_compatible_id = |
1175 | __CONFIGFS_ATTR(compatible_id, S_IRUGO | S_IWUSR, | 1175 | __CONFIGFS_ATTR(compatible_id, S_IRUGO | S_IWUSR, |
1176 | rndis_grp_compatible_id_show, | 1176 | interf_grp_compatible_id_show, |
1177 | rndis_grp_compatible_id_store); | 1177 | interf_grp_compatible_id_store); |
1178 | 1178 | ||
1179 | static ssize_t rndis_grp_sub_compatible_id_show(struct usb_os_desc *desc, | 1179 | static ssize_t interf_grp_sub_compatible_id_show(struct usb_os_desc *desc, |
1180 | char *page) | 1180 | char *page) |
1181 | { | 1181 | { |
1182 | memcpy(page, desc->ext_compat_id + 8, 8); | 1182 | memcpy(page, desc->ext_compat_id + 8, 8); |
1183 | return 8; | 1183 | return 8; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc, | 1186 | static ssize_t interf_grp_sub_compatible_id_store(struct usb_os_desc *desc, |
1187 | const char *page, size_t len) | 1187 | const char *page, size_t len) |
1188 | { | 1188 | { |
1189 | int l; | 1189 | int l; |
1190 | 1190 | ||
@@ -1202,20 +1202,21 @@ static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc, | |||
1202 | return len; | 1202 | return len; |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | static struct usb_os_desc_attribute rndis_grp_attr_sub_compatible_id = | 1205 | static struct usb_os_desc_attribute interf_grp_attr_sub_compatible_id = |
1206 | __CONFIGFS_ATTR(sub_compatible_id, S_IRUGO | S_IWUSR, | 1206 | __CONFIGFS_ATTR(sub_compatible_id, S_IRUGO | S_IWUSR, |
1207 | rndis_grp_sub_compatible_id_show, | 1207 | interf_grp_sub_compatible_id_show, |
1208 | rndis_grp_sub_compatible_id_store); | 1208 | interf_grp_sub_compatible_id_store); |
1209 | 1209 | ||
1210 | static struct configfs_attribute *interf_grp_attrs[] = { | 1210 | static struct configfs_attribute *interf_grp_attrs[] = { |
1211 | &rndis_grp_attr_compatible_id.attr, | 1211 | &interf_grp_attr_compatible_id.attr, |
1212 | &rndis_grp_attr_sub_compatible_id.attr, | 1212 | &interf_grp_attr_sub_compatible_id.attr, |
1213 | NULL | 1213 | NULL |
1214 | }; | 1214 | }; |
1215 | 1215 | ||
1216 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, | 1216 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, |
1217 | int n_interf, | 1217 | int n_interf, |
1218 | struct usb_os_desc **desc, | 1218 | struct usb_os_desc **desc, |
1219 | char **names, | ||
1219 | struct module *owner) | 1220 | struct module *owner) |
1220 | { | 1221 | { |
1221 | struct config_group **f_default_groups, *os_desc_group, | 1222 | struct config_group **f_default_groups, *os_desc_group, |
@@ -1257,8 +1258,8 @@ int usb_os_desc_prepare_interf_dir(struct config_group *parent, | |||
1257 | d = desc[n_interf]; | 1258 | d = desc[n_interf]; |
1258 | d->owner = owner; | 1259 | d->owner = owner; |
1259 | config_group_init_type_name(&d->group, "", interface_type); | 1260 | config_group_init_type_name(&d->group, "", interface_type); |
1260 | config_item_set_name(&d->group.cg_item, "interface.%d", | 1261 | config_item_set_name(&d->group.cg_item, "interface.%s", |
1261 | n_interf); | 1262 | names[n_interf]); |
1262 | interface_groups[n_interf] = &d->group; | 1263 | interface_groups[n_interf] = &d->group; |
1263 | } | 1264 | } |
1264 | 1265 | ||
diff --git a/drivers/usb/gadget/configfs.h b/drivers/usb/gadget/configfs.h index a14ac792c698..36c468c4f5e9 100644 --- a/drivers/usb/gadget/configfs.h +++ b/drivers/usb/gadget/configfs.h | |||
@@ -8,6 +8,7 @@ void unregister_gadget_item(struct config_item *item); | |||
8 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, | 8 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, |
9 | int n_interf, | 9 | int n_interf, |
10 | struct usb_os_desc **desc, | 10 | struct usb_os_desc **desc, |
11 | char **names, | ||
11 | struct module *owner); | 12 | struct module *owner); |
12 | 13 | ||
13 | static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item) | 14 | static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item) |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 74202d67f911..8598c27c7d43 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -1483,11 +1483,13 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev) | |||
1483 | ffs->ep0req->context = ffs; | 1483 | ffs->ep0req->context = ffs; |
1484 | 1484 | ||
1485 | lang = ffs->stringtabs; | 1485 | lang = ffs->stringtabs; |
1486 | for (lang = ffs->stringtabs; *lang; ++lang) { | 1486 | if (lang) { |
1487 | struct usb_string *str = (*lang)->strings; | 1487 | for (; *lang; ++lang) { |
1488 | int id = first_id; | 1488 | struct usb_string *str = (*lang)->strings; |
1489 | for (; str->s; ++id, ++str) | 1489 | int id = first_id; |
1490 | str->id = id; | 1490 | for (; str->s; ++id, ++str) |
1491 | str->id = id; | ||
1492 | } | ||
1491 | } | 1493 | } |
1492 | 1494 | ||
1493 | ffs->gadget = cdev->gadget; | 1495 | ffs->gadget = cdev->gadget; |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index eed3ad878047..9c41e9515b8e 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
@@ -687,7 +687,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
687 | f->os_desc_table = kzalloc(sizeof(*f->os_desc_table), | 687 | f->os_desc_table = kzalloc(sizeof(*f->os_desc_table), |
688 | GFP_KERNEL); | 688 | GFP_KERNEL); |
689 | if (!f->os_desc_table) | 689 | if (!f->os_desc_table) |
690 | return PTR_ERR(f->os_desc_table); | 690 | return -ENOMEM; |
691 | f->os_desc_n = 1; | 691 | f->os_desc_n = 1; |
692 | f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc; | 692 | f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc; |
693 | } | 693 | } |
@@ -905,6 +905,7 @@ static struct usb_function_instance *rndis_alloc_inst(void) | |||
905 | { | 905 | { |
906 | struct f_rndis_opts *opts; | 906 | struct f_rndis_opts *opts; |
907 | struct usb_os_desc *descs[1]; | 907 | struct usb_os_desc *descs[1]; |
908 | char *names[1]; | ||
908 | 909 | ||
909 | opts = kzalloc(sizeof(*opts), GFP_KERNEL); | 910 | opts = kzalloc(sizeof(*opts), GFP_KERNEL); |
910 | if (!opts) | 911 | if (!opts) |
@@ -922,8 +923,9 @@ static struct usb_function_instance *rndis_alloc_inst(void) | |||
922 | INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop); | 923 | INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop); |
923 | 924 | ||
924 | descs[0] = &opts->rndis_os_desc; | 925 | descs[0] = &opts->rndis_os_desc; |
926 | names[0] = "rndis"; | ||
925 | usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, | 927 | usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, |
926 | THIS_MODULE); | 928 | names, THIS_MODULE); |
927 | config_group_init_type_name(&opts->func_inst.group, "", | 929 | config_group_init_type_name(&opts->func_inst.group, "", |
928 | &rndis_func_type); | 930 | &rndis_func_type); |
929 | 931 | ||
diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c index 99a37ed03e27..c7004ee89c90 100644 --- a/drivers/usb/gadget/gr_udc.c +++ b/drivers/usb/gadget/gr_udc.c | |||
@@ -1532,8 +1532,9 @@ static int gr_ep_enable(struct usb_ep *_ep, | |||
1532 | "%s mode: multiple trans./microframe not valid\n", | 1532 | "%s mode: multiple trans./microframe not valid\n", |
1533 | (mode == 2 ? "Bulk" : "Control")); | 1533 | (mode == 2 ? "Bulk" : "Control")); |
1534 | return -EINVAL; | 1534 | return -EINVAL; |
1535 | } else if (nt == 0x11) { | 1535 | } else if (nt == 0x3) { |
1536 | dev_err(dev->dev, "Invalid value for trans./microframe\n"); | 1536 | dev_err(dev->dev, |
1537 | "Invalid value 0x3 for additional trans./microframe\n"); | ||
1537 | return -EINVAL; | 1538 | return -EINVAL; |
1538 | } else if ((nt + 1) * max > buffer_size) { | 1539 | } else if ((nt + 1) * max > buffer_size) { |
1539 | dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n", | 1540 | dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n", |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index ee6c16416c30..2e4ce7704908 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1264,8 +1264,13 @@ dev_release (struct inode *inode, struct file *fd) | |||
1264 | 1264 | ||
1265 | kfree (dev->buf); | 1265 | kfree (dev->buf); |
1266 | dev->buf = NULL; | 1266 | dev->buf = NULL; |
1267 | put_dev (dev); | ||
1268 | 1267 | ||
1268 | /* other endpoints were all decoupled from this device */ | ||
1269 | spin_lock_irq(&dev->lock); | ||
1270 | dev->state = STATE_DEV_DISABLED; | ||
1271 | spin_unlock_irq(&dev->lock); | ||
1272 | |||
1273 | put_dev (dev); | ||
1269 | return 0; | 1274 | return 0; |
1270 | } | 1275 | } |
1271 | 1276 | ||
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 3d78a8844e43..97b027724ee7 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
@@ -1120,7 +1120,10 @@ void gether_disconnect(struct gether *link) | |||
1120 | 1120 | ||
1121 | DBG(dev, "%s\n", __func__); | 1121 | DBG(dev, "%s\n", __func__); |
1122 | 1122 | ||
1123 | netif_tx_lock(dev->net); | ||
1123 | netif_stop_queue(dev->net); | 1124 | netif_stop_queue(dev->net); |
1125 | netif_tx_unlock(dev->net); | ||
1126 | |||
1124 | netif_carrier_off(dev->net); | 1127 | netif_carrier_off(dev->net); |
1125 | 1128 | ||
1126 | /* disable endpoints, forcing (synchronous) completion | 1129 | /* disable endpoints, forcing (synchronous) completion |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 61b7817bd66b..03314f861bee 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -176,7 +176,7 @@ config USB_EHCI_HCD_AT91 | |||
176 | 176 | ||
177 | config USB_EHCI_MSM | 177 | config USB_EHCI_MSM |
178 | tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller" | 178 | tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller" |
179 | depends on ARCH_MSM | 179 | depends on ARCH_MSM || ARCH_QCOM |
180 | select USB_EHCI_ROOT_HUB_TT | 180 | select USB_EHCI_ROOT_HUB_TT |
181 | ---help--- | 181 | ---help--- |
182 | Enables support for the USB Host controller present on the | 182 | Enables support for the USB Host controller present on the |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 4a6d3dd68572..2f3acebb577a 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -656,6 +656,14 @@ static const struct dmi_system_id ehci_dmi_nohandoff_table[] = { | |||
656 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), | 656 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), |
657 | }, | 657 | }, |
658 | }, | 658 | }, |
659 | { | ||
660 | /* HASEE E200 */ | ||
661 | .matches = { | ||
662 | DMI_MATCH(DMI_BOARD_VENDOR, "HASEE"), | ||
663 | DMI_MATCH(DMI_BOARD_NAME, "E210"), | ||
664 | DMI_MATCH(DMI_BIOS_VERSION, "6.00"), | ||
665 | }, | ||
666 | }, | ||
659 | { } | 667 | { } |
660 | }; | 668 | }; |
661 | 669 | ||
@@ -665,9 +673,14 @@ static void ehci_bios_handoff(struct pci_dev *pdev, | |||
665 | { | 673 | { |
666 | int try_handoff = 1, tried_handoff = 0; | 674 | int try_handoff = 1, tried_handoff = 0; |
667 | 675 | ||
668 | /* The Pegatron Lucid tablet sporadically waits for 98 seconds trying | 676 | /* |
669 | * the handoff on its unused controller. Skip it. */ | 677 | * The Pegatron Lucid tablet sporadically waits for 98 seconds trying |
670 | if (pdev->vendor == 0x8086 && pdev->device == 0x283a) { | 678 | * the handoff on its unused controller. Skip it. |
679 | * | ||
680 | * The HASEE E200 hangs when the semaphore is set (bugzilla #77021). | ||
681 | */ | ||
682 | if (pdev->vendor == 0x8086 && (pdev->device == 0x283a || | ||
683 | pdev->device == 0x27cc)) { | ||
671 | if (dmi_check_system(ehci_dmi_nohandoff_table)) | 684 | if (dmi_check_system(ehci_dmi_nohandoff_table)) |
672 | try_handoff = 0; | 685 | try_handoff = 0; |
673 | } | 686 | } |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 6231ce6aa0c3..aa79e8749040 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/device.h> | ||
25 | #include <asm/unaligned.h> | 26 | #include <asm/unaligned.h> |
26 | 27 | ||
27 | #include "xhci.h" | 28 | #include "xhci.h" |
@@ -287,7 +288,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) | |||
287 | if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) { | 288 | if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) { |
288 | struct xhci_command *command; | 289 | struct xhci_command *command; |
289 | command = xhci_alloc_command(xhci, false, false, | 290 | command = xhci_alloc_command(xhci, false, false, |
290 | GFP_NOIO); | 291 | GFP_NOWAIT); |
291 | if (!command) { | 292 | if (!command) { |
292 | spin_unlock_irqrestore(&xhci->lock, flags); | 293 | spin_unlock_irqrestore(&xhci->lock, flags); |
293 | xhci_free_command(xhci, cmd); | 294 | xhci_free_command(xhci, cmd); |
@@ -1139,7 +1140,9 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
1139 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME | 1140 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME |
1140 | * is enabled, so also enable remote wake here. | 1141 | * is enabled, so also enable remote wake here. |
1141 | */ | 1142 | */ |
1142 | if (hcd->self.root_hub->do_remote_wakeup) { | 1143 | if (hcd->self.root_hub->do_remote_wakeup |
1144 | && device_may_wakeup(hcd->self.controller)) { | ||
1145 | |||
1143 | if (t1 & PORT_CONNECT) { | 1146 | if (t1 & PORT_CONNECT) { |
1144 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; | 1147 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; |
1145 | t2 &= ~PORT_WKCONN_E; | 1148 | t2 &= ~PORT_WKCONN_E; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index d67ff71209f5..749fc68eb5c1 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1433,8 +1433,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | |||
1433 | xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code); | 1433 | xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code); |
1434 | break; | 1434 | break; |
1435 | case TRB_RESET_DEV: | 1435 | case TRB_RESET_DEV: |
1436 | WARN_ON(slot_id != TRB_TO_SLOT_ID( | 1436 | /* SLOT_ID field in reset device cmd completion event TRB is 0. |
1437 | le32_to_cpu(cmd_trb->generic.field[3]))); | 1437 | * Use the SLOT_ID from the command TRB instead (xhci 4.6.11) |
1438 | */ | ||
1439 | slot_id = TRB_TO_SLOT_ID( | ||
1440 | le32_to_cpu(cmd_trb->generic.field[3])); | ||
1438 | xhci_handle_cmd_reset_dev(xhci, slot_id, event); | 1441 | xhci_handle_cmd_reset_dev(xhci, slot_id, event); |
1439 | break; | 1442 | break; |
1440 | case TRB_NEC_GET_FW: | 1443 | case TRB_NEC_GET_FW: |
@@ -3534,7 +3537,7 @@ static unsigned int xhci_get_burst_count(struct xhci_hcd *xhci, | |||
3534 | return 0; | 3537 | return 0; |
3535 | 3538 | ||
3536 | max_burst = urb->ep->ss_ep_comp.bMaxBurst; | 3539 | max_burst = urb->ep->ss_ep_comp.bMaxBurst; |
3537 | return roundup(total_packet_count, max_burst + 1) - 1; | 3540 | return DIV_ROUND_UP(total_packet_count, max_burst + 1) - 1; |
3538 | } | 3541 | } |
3539 | 3542 | ||
3540 | /* | 3543 | /* |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 2b8d9a24af09..7436d5f5e67a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -936,7 +936,7 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
936 | */ | 936 | */ |
937 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | 937 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
938 | { | 938 | { |
939 | u32 command, temp = 0; | 939 | u32 command, temp = 0, status; |
940 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 940 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
941 | struct usb_hcd *secondary_hcd; | 941 | struct usb_hcd *secondary_hcd; |
942 | int retval = 0; | 942 | int retval = 0; |
@@ -1054,8 +1054,12 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
1054 | 1054 | ||
1055 | done: | 1055 | done: |
1056 | if (retval == 0) { | 1056 | if (retval == 0) { |
1057 | usb_hcd_resume_root_hub(hcd); | 1057 | /* Resume root hubs only when have pending events. */ |
1058 | usb_hcd_resume_root_hub(xhci->shared_hcd); | 1058 | status = readl(&xhci->op_regs->status); |
1059 | if (status & STS_EINT) { | ||
1060 | usb_hcd_resume_root_hub(hcd); | ||
1061 | usb_hcd_resume_root_hub(xhci->shared_hcd); | ||
1062 | } | ||
1059 | } | 1063 | } |
1060 | 1064 | ||
1061 | /* | 1065 | /* |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 51a6da256772..829f446064ea 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <linux/moduleparam.h> | 7 | #include <linux/moduleparam.h> |
8 | #include <linux/scatterlist.h> | 8 | #include <linux/scatterlist.h> |
9 | #include <linux/mutex.h> | 9 | #include <linux/mutex.h> |
10 | 10 | #include <linux/timer.h> | |
11 | #include <linux/usb.h> | 11 | #include <linux/usb.h> |
12 | 12 | ||
13 | #define SIMPLE_IO_TIMEOUT 10000 /* in milliseconds */ | 13 | #define SIMPLE_IO_TIMEOUT 10000 /* in milliseconds */ |
@@ -484,6 +484,14 @@ alloc_sglist(int nents, int max, int vary) | |||
484 | return sg; | 484 | return sg; |
485 | } | 485 | } |
486 | 486 | ||
487 | static void sg_timeout(unsigned long _req) | ||
488 | { | ||
489 | struct usb_sg_request *req = (struct usb_sg_request *) _req; | ||
490 | |||
491 | req->status = -ETIMEDOUT; | ||
492 | usb_sg_cancel(req); | ||
493 | } | ||
494 | |||
487 | static int perform_sglist( | 495 | static int perform_sglist( |
488 | struct usbtest_dev *tdev, | 496 | struct usbtest_dev *tdev, |
489 | unsigned iterations, | 497 | unsigned iterations, |
@@ -495,6 +503,9 @@ static int perform_sglist( | |||
495 | { | 503 | { |
496 | struct usb_device *udev = testdev_to_usbdev(tdev); | 504 | struct usb_device *udev = testdev_to_usbdev(tdev); |
497 | int retval = 0; | 505 | int retval = 0; |
506 | struct timer_list sg_timer; | ||
507 | |||
508 | setup_timer_on_stack(&sg_timer, sg_timeout, (unsigned long) req); | ||
498 | 509 | ||
499 | while (retval == 0 && iterations-- > 0) { | 510 | while (retval == 0 && iterations-- > 0) { |
500 | retval = usb_sg_init(req, udev, pipe, | 511 | retval = usb_sg_init(req, udev, pipe, |
@@ -505,7 +516,10 @@ static int perform_sglist( | |||
505 | 516 | ||
506 | if (retval) | 517 | if (retval) |
507 | break; | 518 | break; |
519 | mod_timer(&sg_timer, jiffies + | ||
520 | msecs_to_jiffies(SIMPLE_IO_TIMEOUT)); | ||
508 | usb_sg_wait(req); | 521 | usb_sg_wait(req); |
522 | del_timer_sync(&sg_timer); | ||
509 | retval = req->status; | 523 | retval = req->status; |
510 | 524 | ||
511 | /* FIXME check resulting data pattern */ | 525 | /* FIXME check resulting data pattern */ |
diff --git a/drivers/usb/musb/musb_am335x.c b/drivers/usb/musb/musb_am335x.c index d2353781bd2d..1e58ed2361cc 100644 --- a/drivers/usb/musb/musb_am335x.c +++ b/drivers/usb/musb/musb_am335x.c | |||
@@ -19,21 +19,6 @@ err: | |||
19 | return ret; | 19 | return ret; |
20 | } | 20 | } |
21 | 21 | ||
22 | static int of_remove_populated_child(struct device *dev, void *d) | ||
23 | { | ||
24 | struct platform_device *pdev = to_platform_device(dev); | ||
25 | |||
26 | of_device_unregister(pdev); | ||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | static int am335x_child_remove(struct platform_device *pdev) | ||
31 | { | ||
32 | device_for_each_child(&pdev->dev, NULL, of_remove_populated_child); | ||
33 | pm_runtime_disable(&pdev->dev); | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | static const struct of_device_id am335x_child_of_match[] = { | 22 | static const struct of_device_id am335x_child_of_match[] = { |
38 | { .compatible = "ti,am33xx-usb" }, | 23 | { .compatible = "ti,am33xx-usb" }, |
39 | { }, | 24 | { }, |
@@ -42,13 +27,17 @@ MODULE_DEVICE_TABLE(of, am335x_child_of_match); | |||
42 | 27 | ||
43 | static struct platform_driver am335x_child_driver = { | 28 | static struct platform_driver am335x_child_driver = { |
44 | .probe = am335x_child_probe, | 29 | .probe = am335x_child_probe, |
45 | .remove = am335x_child_remove, | ||
46 | .driver = { | 30 | .driver = { |
47 | .name = "am335x-usb-childs", | 31 | .name = "am335x-usb-childs", |
48 | .of_match_table = am335x_child_of_match, | 32 | .of_match_table = am335x_child_of_match, |
49 | }, | 33 | }, |
50 | }; | 34 | }; |
51 | 35 | ||
52 | module_platform_driver(am335x_child_driver); | 36 | static int __init am335x_child_init(void) |
37 | { | ||
38 | return platform_driver_register(&am335x_child_driver); | ||
39 | } | ||
40 | module_init(am335x_child_init); | ||
41 | |||
53 | MODULE_DESCRIPTION("AM33xx child devices"); | 42 | MODULE_DESCRIPTION("AM33xx child devices"); |
54 | MODULE_LICENSE("GPL v2"); | 43 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 61da471b7aed..eff3c5cf84f4 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -849,7 +849,7 @@ b_host: | |||
849 | } | 849 | } |
850 | 850 | ||
851 | /* handle babble condition */ | 851 | /* handle babble condition */ |
852 | if (int_usb & MUSB_INTR_BABBLE) | 852 | if (int_usb & MUSB_INTR_BABBLE && is_host_active(musb)) |
853 | schedule_work(&musb->recover_work); | 853 | schedule_work(&musb->recover_work); |
854 | 854 | ||
855 | #if 0 | 855 | #if 0 |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 7b8bbf53127e..5341bb223b7c 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -318,7 +318,7 @@ static void cppi41_dma_callback(void *private_data) | |||
318 | } | 318 | } |
319 | list_add_tail(&cppi41_channel->tx_check, | 319 | list_add_tail(&cppi41_channel->tx_check, |
320 | &controller->early_tx_list); | 320 | &controller->early_tx_list); |
321 | if (!hrtimer_active(&controller->early_tx)) { | 321 | if (!hrtimer_is_queued(&controller->early_tx)) { |
322 | hrtimer_start_range_ns(&controller->early_tx, | 322 | hrtimer_start_range_ns(&controller->early_tx, |
323 | ktime_set(0, 140 * NSEC_PER_USEC), | 323 | ktime_set(0, 140 * NSEC_PER_USEC), |
324 | 40 * NSEC_PER_USEC, | 324 | 40 * NSEC_PER_USEC, |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 51beb13c7e1a..09529f94e72d 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -494,10 +494,9 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
494 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); | 494 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); |
495 | const struct dsps_musb_wrapper *wrp = glue->wrp; | 495 | const struct dsps_musb_wrapper *wrp = glue->wrp; |
496 | void __iomem *ctrl_base = musb->ctrl_base; | 496 | void __iomem *ctrl_base = musb->ctrl_base; |
497 | void __iomem *base = musb->mregs; | ||
498 | u32 reg; | 497 | u32 reg; |
499 | 498 | ||
500 | reg = dsps_readl(base, wrp->mode); | 499 | reg = dsps_readl(ctrl_base, wrp->mode); |
501 | 500 | ||
502 | switch (mode) { | 501 | switch (mode) { |
503 | case MUSB_HOST: | 502 | case MUSB_HOST: |
@@ -510,7 +509,7 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
510 | */ | 509 | */ |
511 | reg |= (1 << wrp->iddig_mux); | 510 | reg |= (1 << wrp->iddig_mux); |
512 | 511 | ||
513 | dsps_writel(base, wrp->mode, reg); | 512 | dsps_writel(ctrl_base, wrp->mode, reg); |
514 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); | 513 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); |
515 | break; | 514 | break; |
516 | case MUSB_PERIPHERAL: | 515 | case MUSB_PERIPHERAL: |
@@ -523,10 +522,10 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
523 | */ | 522 | */ |
524 | reg |= (1 << wrp->iddig_mux); | 523 | reg |= (1 << wrp->iddig_mux); |
525 | 524 | ||
526 | dsps_writel(base, wrp->mode, reg); | 525 | dsps_writel(ctrl_base, wrp->mode, reg); |
527 | break; | 526 | break; |
528 | case MUSB_OTG: | 527 | case MUSB_OTG: |
529 | dsps_writel(base, wrp->phy_utmi, 0x02); | 528 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); |
530 | break; | 529 | break; |
531 | default: | 530 | default: |
532 | dev_err(glue->dev, "unsupported mode %d\n", mode); | 531 | dev_err(glue->dev, "unsupported mode %d\n", mode); |
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index c2e45e632723..f202e5088461 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c | |||
@@ -274,7 +274,6 @@ static int ux500_probe(struct platform_device *pdev) | |||
274 | musb->dev.parent = &pdev->dev; | 274 | musb->dev.parent = &pdev->dev; |
275 | musb->dev.dma_mask = &pdev->dev.coherent_dma_mask; | 275 | musb->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
276 | musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; | 276 | musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; |
277 | musb->dev.of_node = pdev->dev.of_node; | ||
278 | 277 | ||
279 | glue->dev = &pdev->dev; | 278 | glue->dev = &pdev->dev; |
280 | glue->musb = musb; | 279 | glue->musb = musb; |
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index ced34f39bdd4..c929370cdaa6 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c | |||
@@ -1229,7 +1229,9 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
1229 | motg->chg_state = USB_CHG_STATE_UNDEFINED; | 1229 | motg->chg_state = USB_CHG_STATE_UNDEFINED; |
1230 | motg->chg_type = USB_INVALID_CHARGER; | 1230 | motg->chg_type = USB_INVALID_CHARGER; |
1231 | } | 1231 | } |
1232 | pm_runtime_put_sync(otg->phy->dev); | 1232 | |
1233 | if (otg->phy->state == OTG_STATE_B_IDLE) | ||
1234 | pm_runtime_put_sync(otg->phy->dev); | ||
1233 | break; | 1235 | break; |
1234 | case OTG_STATE_B_PERIPHERAL: | 1236 | case OTG_STATE_B_PERIPHERAL: |
1235 | dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); | 1237 | dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index d49f9c326035..4fd36530bfa3 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -681,6 +681,14 @@ usbhs_fifo_read_end: | |||
681 | usbhs_pipe_number(pipe), | 681 | usbhs_pipe_number(pipe), |
682 | pkt->length, pkt->actual, *is_done, pkt->zero); | 682 | pkt->length, pkt->actual, *is_done, pkt->zero); |
683 | 683 | ||
684 | /* | ||
685 | * Transmission end | ||
686 | */ | ||
687 | if (*is_done) { | ||
688 | if (usbhs_pipe_is_dcp(pipe)) | ||
689 | usbhs_dcp_control_transfer_done(pipe); | ||
690 | } | ||
691 | |||
684 | usbhs_fifo_read_busy: | 692 | usbhs_fifo_read_busy: |
685 | usbhsf_fifo_unselect(pipe, fifo); | 693 | usbhsf_fifo_unselect(pipe, fifo); |
686 | 694 | ||
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 762e4a5f5ae9..330df5ce435b 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -153,6 +153,7 @@ static const struct usb_device_id id_table[] = { | |||
153 | { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ | 153 | { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ |
154 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ | 154 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ |
155 | { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ | 155 | { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ |
156 | { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ | ||
156 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ | 157 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ |
157 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ | 158 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ |
158 | { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ | 159 | { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index edf3b124583c..8a3813be1b28 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -720,7 +720,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
720 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | 720 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, |
721 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, | 721 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, |
722 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, | 722 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, |
723 | { USB_DEVICE(TESTO_VID, TESTO_USB_INTERFACE_PID) }, | 723 | { USB_DEVICE(TESTO_VID, TESTO_1_PID) }, |
724 | { USB_DEVICE(TESTO_VID, TESTO_3_PID) }, | ||
724 | { USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) }, | 725 | { USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) }, |
725 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13M_PID) }, | 726 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13M_PID) }, |
726 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) }, | 727 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) }, |
@@ -944,6 +945,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
944 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, | 945 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, |
945 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, | 946 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, |
946 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, | 947 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, |
948 | /* Infineon Devices */ | ||
949 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, | ||
947 | { } /* Terminating entry */ | 950 | { } /* Terminating entry */ |
948 | }; | 951 | }; |
949 | 952 | ||
@@ -1566,14 +1569,17 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port) | |||
1566 | struct usb_device *udev = serial->dev; | 1569 | struct usb_device *udev = serial->dev; |
1567 | 1570 | ||
1568 | struct usb_interface *interface = serial->interface; | 1571 | struct usb_interface *interface = serial->interface; |
1569 | struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc; | 1572 | struct usb_endpoint_descriptor *ep_desc; |
1570 | 1573 | ||
1571 | unsigned num_endpoints; | 1574 | unsigned num_endpoints; |
1572 | int i; | 1575 | unsigned i; |
1573 | 1576 | ||
1574 | num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; | 1577 | num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; |
1575 | dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); | 1578 | dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); |
1576 | 1579 | ||
1580 | if (!num_endpoints) | ||
1581 | return; | ||
1582 | |||
1577 | /* NOTE: some customers have programmed FT232R/FT245R devices | 1583 | /* NOTE: some customers have programmed FT232R/FT245R devices |
1578 | * with an endpoint size of 0 - not good. In this case, we | 1584 | * with an endpoint size of 0 - not good. In this case, we |
1579 | * want to override the endpoint descriptor setting and use a | 1585 | * want to override the endpoint descriptor setting and use a |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 500474c48f4b..c4777bc6aee0 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -584,6 +584,12 @@ | |||
584 | #define RATOC_PRODUCT_ID_USB60F 0xb020 | 584 | #define RATOC_PRODUCT_ID_USB60F 0xb020 |
585 | 585 | ||
586 | /* | 586 | /* |
587 | * Infineon Technologies | ||
588 | */ | ||
589 | #define INFINEON_VID 0x058b | ||
590 | #define INFINEON_TRIBOARD_PID 0x0028 /* DAS JTAG TriBoard TC1798 V1.0 */ | ||
591 | |||
592 | /* | ||
587 | * Acton Research Corp. | 593 | * Acton Research Corp. |
588 | */ | 594 | */ |
589 | #define ACTON_VID 0x0647 /* Vendor ID */ | 595 | #define ACTON_VID 0x0647 /* Vendor ID */ |
@@ -798,7 +804,8 @@ | |||
798 | * Submitted by Colin Leroy | 804 | * Submitted by Colin Leroy |
799 | */ | 805 | */ |
800 | #define TESTO_VID 0x128D | 806 | #define TESTO_VID 0x128D |
801 | #define TESTO_USB_INTERFACE_PID 0x0001 | 807 | #define TESTO_1_PID 0x0001 |
808 | #define TESTO_3_PID 0x0003 | ||
802 | 809 | ||
803 | /* | 810 | /* |
804 | * Mobility Electronics products. | 811 | * Mobility Electronics products. |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 59c3108cc136..a9688940543d 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -352,6 +352,9 @@ static void option_instat_callback(struct urb *urb); | |||
352 | /* Zoom */ | 352 | /* Zoom */ |
353 | #define ZOOM_PRODUCT_4597 0x9607 | 353 | #define ZOOM_PRODUCT_4597 0x9607 |
354 | 354 | ||
355 | /* SpeedUp SU9800 usb 3g modem */ | ||
356 | #define SPEEDUP_PRODUCT_SU9800 0x9800 | ||
357 | |||
355 | /* Haier products */ | 358 | /* Haier products */ |
356 | #define HAIER_VENDOR_ID 0x201e | 359 | #define HAIER_VENDOR_ID 0x201e |
357 | #define HAIER_PRODUCT_CE100 0x2009 | 360 | #define HAIER_PRODUCT_CE100 0x2009 |
@@ -372,8 +375,12 @@ static void option_instat_callback(struct urb *urb); | |||
372 | /* Olivetti products */ | 375 | /* Olivetti products */ |
373 | #define OLIVETTI_VENDOR_ID 0x0b3c | 376 | #define OLIVETTI_VENDOR_ID 0x0b3c |
374 | #define OLIVETTI_PRODUCT_OLICARD100 0xc000 | 377 | #define OLIVETTI_PRODUCT_OLICARD100 0xc000 |
378 | #define OLIVETTI_PRODUCT_OLICARD120 0xc001 | ||
379 | #define OLIVETTI_PRODUCT_OLICARD140 0xc002 | ||
375 | #define OLIVETTI_PRODUCT_OLICARD145 0xc003 | 380 | #define OLIVETTI_PRODUCT_OLICARD145 0xc003 |
381 | #define OLIVETTI_PRODUCT_OLICARD155 0xc004 | ||
376 | #define OLIVETTI_PRODUCT_OLICARD200 0xc005 | 382 | #define OLIVETTI_PRODUCT_OLICARD200 0xc005 |
383 | #define OLIVETTI_PRODUCT_OLICARD160 0xc00a | ||
377 | #define OLIVETTI_PRODUCT_OLICARD500 0xc00b | 384 | #define OLIVETTI_PRODUCT_OLICARD500 0xc00b |
378 | 385 | ||
379 | /* Celot products */ | 386 | /* Celot products */ |
@@ -1480,6 +1487,8 @@ static const struct usb_device_id option_ids[] = { | |||
1480 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | 1487 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, |
1481 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff), /* ZTE MF91 */ | 1488 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff), /* ZTE MF91 */ |
1482 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | 1489 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, |
1490 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1428, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G v2 */ | ||
1491 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | ||
1483 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) }, | 1492 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) }, |
1484 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) }, | 1493 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) }, |
1485 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) }, | 1494 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) }, |
@@ -1577,6 +1586,7 @@ static const struct usb_device_id option_ids[] = { | |||
1577 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), | 1586 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), |
1578 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist | 1587 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist |
1579 | }, | 1588 | }, |
1589 | { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) }, | ||
1580 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, | 1590 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, |
1581 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, | 1591 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, |
1582 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, | 1592 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, |
@@ -1611,15 +1621,21 @@ static const struct usb_device_id option_ids[] = { | |||
1611 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, | 1621 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, |
1612 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ | 1622 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ |
1613 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | 1623 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, |
1614 | 1624 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100), | |
1615 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, | 1625 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
1626 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120), | ||
1627 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
1628 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD140), | ||
1629 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
1616 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) }, | 1630 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) }, |
1631 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD155), | ||
1632 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, | ||
1617 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), | 1633 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), |
1618 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist | 1634 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, |
1619 | }, | 1635 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD160), |
1636 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, | ||
1620 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500), | 1637 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500), |
1621 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist | 1638 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
1622 | }, | ||
1623 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 1639 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
1624 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ | 1640 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ |
1625 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, | 1641 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 9d38ddc8da49..866b5df36ed1 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -256,6 +256,10 @@ static int slave_configure(struct scsi_device *sdev) | |||
256 | if (us->fflags & US_FL_WRITE_CACHE) | 256 | if (us->fflags & US_FL_WRITE_CACHE) |
257 | sdev->wce_default_on = 1; | 257 | sdev->wce_default_on = 1; |
258 | 258 | ||
259 | /* A few buggy USB-ATA bridges don't understand FUA */ | ||
260 | if (us->fflags & US_FL_BROKEN_FUA) | ||
261 | sdev->broken_fua = 1; | ||
262 | |||
259 | } else { | 263 | } else { |
260 | 264 | ||
261 | /* Non-disk-type devices don't need to blacklist any pages | 265 | /* Non-disk-type devices don't need to blacklist any pages |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 174a447868cd..80a5b366255f 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1936,6 +1936,13 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, | |||
1936 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1936 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1937 | US_FL_IGNORE_RESIDUE ), | 1937 | US_FL_IGNORE_RESIDUE ), |
1938 | 1938 | ||
1939 | /* Reported by Michael Büsch <m@bues.ch> */ | ||
1940 | UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0114, | ||
1941 | "JMicron", | ||
1942 | "USB to ATA/ATAPI Bridge", | ||
1943 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1944 | US_FL_BROKEN_FUA ), | ||
1945 | |||
1939 | /* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br> | 1946 | /* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br> |
1940 | * JMicron responds to USN and several other SCSI ioctls with a | 1947 | * JMicron responds to USN and several other SCSI ioctls with a |
1941 | * residue that causes subsequent I/O requests to fail. */ | 1948 | * residue that causes subsequent I/O requests to fail. */ |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 971a760af4a1..8dae2f724a35 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -700,14 +700,6 @@ static void handle_rx_net(struct vhost_work *work) | |||
700 | handle_rx(net); | 700 | handle_rx(net); |
701 | } | 701 | } |
702 | 702 | ||
703 | static void vhost_net_free(void *addr) | ||
704 | { | ||
705 | if (is_vmalloc_addr(addr)) | ||
706 | vfree(addr); | ||
707 | else | ||
708 | kfree(addr); | ||
709 | } | ||
710 | |||
711 | static int vhost_net_open(struct inode *inode, struct file *f) | 703 | static int vhost_net_open(struct inode *inode, struct file *f) |
712 | { | 704 | { |
713 | struct vhost_net *n; | 705 | struct vhost_net *n; |
@@ -723,7 +715,7 @@ static int vhost_net_open(struct inode *inode, struct file *f) | |||
723 | } | 715 | } |
724 | vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL); | 716 | vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL); |
725 | if (!vqs) { | 717 | if (!vqs) { |
726 | vhost_net_free(n); | 718 | kvfree(n); |
727 | return -ENOMEM; | 719 | return -ENOMEM; |
728 | } | 720 | } |
729 | 721 | ||
@@ -840,7 +832,7 @@ static int vhost_net_release(struct inode *inode, struct file *f) | |||
840 | * since jobs can re-queue themselves. */ | 832 | * since jobs can re-queue themselves. */ |
841 | vhost_net_flush(n); | 833 | vhost_net_flush(n); |
842 | kfree(n->dev.vqs); | 834 | kfree(n->dev.vqs); |
843 | vhost_net_free(n); | 835 | kvfree(n); |
844 | return 0; | 836 | return 0; |
845 | } | 837 | } |
846 | 838 | ||
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 4f4ffa4c604e..69906cacd04f 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1503,14 +1503,6 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | |||
1503 | return 0; | 1503 | return 0; |
1504 | } | 1504 | } |
1505 | 1505 | ||
1506 | static void vhost_scsi_free(struct vhost_scsi *vs) | ||
1507 | { | ||
1508 | if (is_vmalloc_addr(vs)) | ||
1509 | vfree(vs); | ||
1510 | else | ||
1511 | kfree(vs); | ||
1512 | } | ||
1513 | |||
1514 | static int vhost_scsi_open(struct inode *inode, struct file *f) | 1506 | static int vhost_scsi_open(struct inode *inode, struct file *f) |
1515 | { | 1507 | { |
1516 | struct vhost_scsi *vs; | 1508 | struct vhost_scsi *vs; |
@@ -1550,7 +1542,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f) | |||
1550 | return 0; | 1542 | return 0; |
1551 | 1543 | ||
1552 | err_vqs: | 1544 | err_vqs: |
1553 | vhost_scsi_free(vs); | 1545 | kvfree(vs); |
1554 | err_vs: | 1546 | err_vs: |
1555 | return r; | 1547 | return r; |
1556 | } | 1548 | } |
@@ -1569,7 +1561,7 @@ static int vhost_scsi_release(struct inode *inode, struct file *f) | |||
1569 | /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ | 1561 | /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ |
1570 | vhost_scsi_flush(vs); | 1562 | vhost_scsi_flush(vs); |
1571 | kfree(vs->dev.vqs); | 1563 | kfree(vs->dev.vqs); |
1572 | vhost_scsi_free(vs); | 1564 | kvfree(vs); |
1573 | return 0; | 1565 | return 0; |
1574 | } | 1566 | } |
1575 | 1567 | ||
diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c index b63860f7beab..40bec8d64b0a 100644 --- a/drivers/video/console/dummycon.c +++ b/drivers/video/console/dummycon.c | |||
@@ -77,3 +77,4 @@ const struct consw dummy_con = { | |||
77 | .con_set_palette = DUMMY, | 77 | .con_set_palette = DUMMY, |
78 | .con_scrolldelta = DUMMY, | 78 | .con_scrolldelta = DUMMY, |
79 | }; | 79 | }; |
80 | EXPORT_SYMBOL_GPL(dummy_con); | ||
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index f267284b423b..6e6aa704fe84 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -1441,5 +1441,6 @@ const struct consw vga_con = { | |||
1441 | .con_build_attr = vgacon_build_attr, | 1441 | .con_build_attr = vgacon_build_attr, |
1442 | .con_invert_region = vgacon_invert_region, | 1442 | .con_invert_region = vgacon_invert_region, |
1443 | }; | 1443 | }; |
1444 | EXPORT_SYMBOL(vga_con); | ||
1444 | 1445 | ||
1445 | MODULE_LICENSE("GPL"); | 1446 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index e683b6ef9594..d36e830d6fc6 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c | |||
@@ -1057,6 +1057,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) | |||
1057 | goto put_display_node; | 1057 | goto put_display_node; |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | INIT_LIST_HEAD(&pdata->pwr_gpios); | ||
1060 | ret = -ENOMEM; | 1061 | ret = -ENOMEM; |
1061 | for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { | 1062 | for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { |
1062 | gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", | 1063 | gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", |
@@ -1082,6 +1083,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) | |||
1082 | dev_err(dev, "set direction output gpio %d failed\n", gpio); | 1083 | dev_err(dev, "set direction output gpio %d failed\n", gpio); |
1083 | goto put_display_node; | 1084 | goto put_display_node; |
1084 | } | 1085 | } |
1086 | list_add(&og->list, &pdata->pwr_gpios); | ||
1085 | } | 1087 | } |
1086 | 1088 | ||
1087 | if (is_gpio_power) | 1089 | if (is_gpio_power) |
diff --git a/drivers/video/fbdev/bfin_adv7393fb.c b/drivers/video/fbdev/bfin_adv7393fb.c index a54f7f7d763b..8fe41caac38e 100644 --- a/drivers/video/fbdev/bfin_adv7393fb.c +++ b/drivers/video/fbdev/bfin_adv7393fb.c | |||
@@ -408,7 +408,7 @@ static int bfin_adv7393_fb_probe(struct i2c_client *client, | |||
408 | /* Workaround "PPI Does Not Start Properly In Specific Mode" */ | 408 | /* Workaround "PPI Does Not Start Properly In Specific Mode" */ |
409 | if (ANOMALY_05000400) { | 409 | if (ANOMALY_05000400) { |
410 | ret = gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW, | 410 | ret = gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW, |
411 | "PPI0_FS3") | 411 | "PPI0_FS3"); |
412 | if (ret) { | 412 | if (ret) { |
413 | dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n"); | 413 | dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n"); |
414 | ret = -EBUSY; | 414 | ret = -EBUSY; |
diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c index 99af9e88b2d8..2f0822ee3ff9 100644 --- a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c +++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c | |||
@@ -121,9 +121,11 @@ static void __init omapdss_add_to_list(struct device_node *node, bool root) | |||
121 | { | 121 | { |
122 | struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), | 122 | struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), |
123 | GFP_KERNEL); | 123 | GFP_KERNEL); |
124 | n->node = node; | 124 | if (n) { |
125 | n->root = root; | 125 | n->node = node; |
126 | list_add(&n->list, &dss_conv_list); | 126 | n->root = root; |
127 | list_add(&n->list, &dss_conv_list); | ||
128 | } | ||
127 | } | 129 | } |
128 | 130 | ||
129 | static bool __init omapdss_list_contains(const struct device_node *node) | 131 | static bool __init omapdss_list_contains(const struct device_node *node) |
diff --git a/drivers/video/fbdev/vt8500lcdfb.c b/drivers/video/fbdev/vt8500lcdfb.c index a8f2b280f796..a1134c3f6c11 100644 --- a/drivers/video/fbdev/vt8500lcdfb.c +++ b/drivers/video/fbdev/vt8500lcdfb.c | |||
@@ -474,8 +474,6 @@ static int vt8500lcd_remove(struct platform_device *pdev) | |||
474 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 474 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
475 | release_mem_region(res->start, resource_size(res)); | 475 | release_mem_region(res->start, resource_size(res)); |
476 | 476 | ||
477 | kfree(fbi); | ||
478 | |||
479 | return 0; | 477 | return 0; |
480 | } | 478 | } |
481 | 479 | ||
diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c index 67b067a3e2ab..a5df5e89d456 100644 --- a/drivers/w1/masters/mxc_w1.c +++ b/drivers/w1/masters/mxc_w1.c | |||
@@ -66,7 +66,7 @@ static u8 mxc_w1_ds2_reset_bus(void *data) | |||
66 | 66 | ||
67 | udelay(100); | 67 | udelay(100); |
68 | } | 68 | } |
69 | return !!(reg_val & MXC_W1_CONTROL_PST); | 69 | return !(reg_val & MXC_W1_CONTROL_PST); |
70 | } | 70 | } |
71 | 71 | ||
72 | /* | 72 | /* |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index c845527b503a..76dd54122f76 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -1280,14 +1280,17 @@ config WATCHDOG_RTAS | |||
1280 | 1280 | ||
1281 | # S390 Architecture | 1281 | # S390 Architecture |
1282 | 1282 | ||
1283 | config ZVM_WATCHDOG | 1283 | config DIAG288_WATCHDOG |
1284 | tristate "z/VM Watchdog Timer" | 1284 | tristate "System z diag288 Watchdog" |
1285 | depends on S390 | 1285 | depends on S390 |
1286 | select WATCHDOG_CORE | ||
1286 | help | 1287 | help |
1287 | IBM s/390 and zSeries machines running under z/VM 5.1 or later | 1288 | IBM s/390 and zSeries machines running under z/VM 5.1 or later |
1288 | provide a virtual watchdog timer to their guest that cause a | 1289 | provide a virtual watchdog timer to their guest that cause a |
1289 | user define Control Program command to be executed after a | 1290 | user define Control Program command to be executed after a |
1290 | timeout. | 1291 | timeout. |
1292 | LPAR provides a very similar interface. This driver handles | ||
1293 | both. | ||
1291 | 1294 | ||
1292 | To compile this driver as a module, choose M here. The module | 1295 | To compile this driver as a module, choose M here. The module |
1293 | will be called vmwatchdog. | 1296 | will be called vmwatchdog. |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 7b8a91ed20e7..468c3204c3b1 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -153,6 +153,7 @@ obj-$(CONFIG_MEN_A21_WDT) += mena21_wdt.o | |||
153 | obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o | 153 | obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o |
154 | 154 | ||
155 | # S390 Architecture | 155 | # S390 Architecture |
156 | obj-$(CONFIG_DIAG288_WATCHDOG) += diag288_wdt.o | ||
156 | 157 | ||
157 | # SUPERH (sh + sh64) Architecture | 158 | # SUPERH (sh + sh64) Architecture |
158 | obj-$(CONFIG_SH_WDT) += shwdt.o | 159 | obj-$(CONFIG_SH_WDT) += shwdt.o |
diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c new file mode 100644 index 000000000000..429494b6c822 --- /dev/null +++ b/drivers/watchdog/diag288_wdt.c | |||
@@ -0,0 +1,316 @@ | |||
1 | /* | ||
2 | * Watchdog driver for z/VM and LPAR using the diag 288 interface. | ||
3 | * | ||
4 | * Under z/VM, expiration of the watchdog will send a "system restart" command | ||
5 | * to CP. | ||
6 | * | ||
7 | * The command can be altered using the module parameter "cmd". This is | ||
8 | * not recommended because it's only supported on z/VM but not whith LPAR. | ||
9 | * | ||
10 | * On LPAR, the watchdog will always trigger a system restart. the module | ||
11 | * paramter cmd is meaningless here. | ||
12 | * | ||
13 | * | ||
14 | * Copyright IBM Corp. 2004, 2013 | ||
15 | * Author(s): Arnd Bergmann (arndb@de.ibm.com) | ||
16 | * Philipp Hachtmann (phacht@de.ibm.com) | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #define KMSG_COMPONENT "diag288_wdt" | ||
21 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
22 | |||
23 | #include <linux/init.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/moduleparam.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/miscdevice.h> | ||
29 | #include <linux/watchdog.h> | ||
30 | #include <linux/suspend.h> | ||
31 | #include <asm/ebcdic.h> | ||
32 | #include <linux/io.h> | ||
33 | #include <linux/uaccess.h> | ||
34 | |||
35 | #define MAX_CMDLEN 240 | ||
36 | #define DEFAULT_CMD "SYSTEM RESTART" | ||
37 | |||
38 | #define MIN_INTERVAL 15 /* Minimal time supported by diag88 */ | ||
39 | #define MAX_INTERVAL 3600 /* One hour should be enough - pure estimation */ | ||
40 | |||
41 | #define WDT_DEFAULT_TIMEOUT 30 | ||
42 | |||
43 | /* Function codes - init, change, cancel */ | ||
44 | #define WDT_FUNC_INIT 0 | ||
45 | #define WDT_FUNC_CHANGE 1 | ||
46 | #define WDT_FUNC_CANCEL 2 | ||
47 | #define WDT_FUNC_CONCEAL 0x80000000 | ||
48 | |||
49 | /* Action codes for LPAR watchdog */ | ||
50 | #define LPARWDT_RESTART 0 | ||
51 | |||
52 | static char wdt_cmd[MAX_CMDLEN] = DEFAULT_CMD; | ||
53 | static bool conceal_on; | ||
54 | static bool nowayout_info = WATCHDOG_NOWAYOUT; | ||
55 | |||
56 | MODULE_LICENSE("GPL"); | ||
57 | MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>"); | ||
58 | MODULE_AUTHOR("Philipp Hachtmann <phacht@de.ibm.com>"); | ||
59 | |||
60 | MODULE_DESCRIPTION("System z diag288 Watchdog Timer"); | ||
61 | |||
62 | module_param_string(cmd, wdt_cmd, MAX_CMDLEN, 0644); | ||
63 | MODULE_PARM_DESC(cmd, "CP command that is run when the watchdog triggers (z/VM only)"); | ||
64 | |||
65 | module_param_named(conceal, conceal_on, bool, 0644); | ||
66 | MODULE_PARM_DESC(conceal, "Enable the CONCEAL CP option while the watchdog is active (z/VM only)"); | ||
67 | |||
68 | module_param_named(nowayout, nowayout_info, bool, 0444); | ||
69 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default = CONFIG_WATCHDOG_NOWAYOUT)"); | ||
70 | |||
71 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
72 | MODULE_ALIAS("vmwatchdog"); | ||
73 | |||
74 | static int __diag288(unsigned int func, unsigned int timeout, | ||
75 | unsigned long action, unsigned int len) | ||
76 | { | ||
77 | register unsigned long __func asm("2") = func; | ||
78 | register unsigned long __timeout asm("3") = timeout; | ||
79 | register unsigned long __action asm("4") = action; | ||
80 | register unsigned long __len asm("5") = len; | ||
81 | int err; | ||
82 | |||
83 | err = -EINVAL; | ||
84 | asm volatile( | ||
85 | " diag %1, %3, 0x288\n" | ||
86 | "0: la %0, 0\n" | ||
87 | "1:\n" | ||
88 | EX_TABLE(0b, 1b) | ||
89 | : "+d" (err) : "d"(__func), "d"(__timeout), | ||
90 | "d"(__action), "d"(__len) : "1", "cc"); | ||
91 | return err; | ||
92 | } | ||
93 | |||
94 | static int __diag288_vm(unsigned int func, unsigned int timeout, | ||
95 | char *cmd, size_t len) | ||
96 | { | ||
97 | return __diag288(func, timeout, virt_to_phys(cmd), len); | ||
98 | } | ||
99 | |||
100 | static int __diag288_lpar(unsigned int func, unsigned int timeout, | ||
101 | unsigned long action) | ||
102 | { | ||
103 | return __diag288(func, timeout, action, 0); | ||
104 | } | ||
105 | |||
106 | static int wdt_start(struct watchdog_device *dev) | ||
107 | { | ||
108 | char *ebc_cmd; | ||
109 | size_t len; | ||
110 | int ret; | ||
111 | unsigned int func; | ||
112 | |||
113 | ret = -ENODEV; | ||
114 | |||
115 | if (MACHINE_IS_VM) { | ||
116 | ebc_cmd = kmalloc(MAX_CMDLEN, GFP_KERNEL); | ||
117 | if (!ebc_cmd) | ||
118 | return -ENOMEM; | ||
119 | len = strlcpy(ebc_cmd, wdt_cmd, MAX_CMDLEN); | ||
120 | ASCEBC(ebc_cmd, MAX_CMDLEN); | ||
121 | EBC_TOUPPER(ebc_cmd, MAX_CMDLEN); | ||
122 | |||
123 | func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL) | ||
124 | : WDT_FUNC_INIT; | ||
125 | ret = __diag288_vm(func, dev->timeout, ebc_cmd, len); | ||
126 | WARN_ON(ret != 0); | ||
127 | kfree(ebc_cmd); | ||
128 | } | ||
129 | |||
130 | if (MACHINE_IS_LPAR) { | ||
131 | ret = __diag288_lpar(WDT_FUNC_INIT, | ||
132 | dev->timeout, LPARWDT_RESTART); | ||
133 | } | ||
134 | |||
135 | if (ret) { | ||
136 | pr_err("The watchdog cannot be activated\n"); | ||
137 | return ret; | ||
138 | } | ||
139 | pr_info("The watchdog was activated\n"); | ||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static int wdt_stop(struct watchdog_device *dev) | ||
144 | { | ||
145 | int ret; | ||
146 | |||
147 | ret = __diag288(WDT_FUNC_CANCEL, 0, 0, 0); | ||
148 | pr_info("The watchdog was deactivated\n"); | ||
149 | return ret; | ||
150 | } | ||
151 | |||
152 | static int wdt_ping(struct watchdog_device *dev) | ||
153 | { | ||
154 | char *ebc_cmd; | ||
155 | size_t len; | ||
156 | int ret; | ||
157 | unsigned int func; | ||
158 | |||
159 | ret = -ENODEV; | ||
160 | |||
161 | if (MACHINE_IS_VM) { | ||
162 | ebc_cmd = kmalloc(MAX_CMDLEN, GFP_KERNEL); | ||
163 | if (!ebc_cmd) | ||
164 | return -ENOMEM; | ||
165 | len = strlcpy(ebc_cmd, wdt_cmd, MAX_CMDLEN); | ||
166 | ASCEBC(ebc_cmd, MAX_CMDLEN); | ||
167 | EBC_TOUPPER(ebc_cmd, MAX_CMDLEN); | ||
168 | |||
169 | /* | ||
170 | * It seems to be ok to z/VM to use the init function to | ||
171 | * retrigger the watchdog. On LPAR WDT_FUNC_CHANGE must | ||
172 | * be used when the watchdog is running. | ||
173 | */ | ||
174 | func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL) | ||
175 | : WDT_FUNC_INIT; | ||
176 | |||
177 | ret = __diag288_vm(func, dev->timeout, ebc_cmd, len); | ||
178 | WARN_ON(ret != 0); | ||
179 | kfree(ebc_cmd); | ||
180 | } | ||
181 | |||
182 | if (MACHINE_IS_LPAR) | ||
183 | ret = __diag288_lpar(WDT_FUNC_CHANGE, dev->timeout, 0); | ||
184 | |||
185 | if (ret) | ||
186 | pr_err("The watchdog timer cannot be started or reset\n"); | ||
187 | return ret; | ||
188 | } | ||
189 | |||
190 | static int wdt_set_timeout(struct watchdog_device * dev, unsigned int new_to) | ||
191 | { | ||
192 | dev->timeout = new_to; | ||
193 | return wdt_ping(dev); | ||
194 | } | ||
195 | |||
196 | static struct watchdog_ops wdt_ops = { | ||
197 | .owner = THIS_MODULE, | ||
198 | .start = wdt_start, | ||
199 | .stop = wdt_stop, | ||
200 | .ping = wdt_ping, | ||
201 | .set_timeout = wdt_set_timeout, | ||
202 | }; | ||
203 | |||
204 | static struct watchdog_info wdt_info = { | ||
205 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, | ||
206 | .firmware_version = 0, | ||
207 | .identity = "z Watchdog", | ||
208 | }; | ||
209 | |||
210 | static struct watchdog_device wdt_dev = { | ||
211 | .parent = NULL, | ||
212 | .info = &wdt_info, | ||
213 | .ops = &wdt_ops, | ||
214 | .bootstatus = 0, | ||
215 | .timeout = WDT_DEFAULT_TIMEOUT, | ||
216 | .min_timeout = MIN_INTERVAL, | ||
217 | .max_timeout = MAX_INTERVAL, | ||
218 | }; | ||
219 | |||
220 | /* | ||
221 | * It makes no sense to go into suspend while the watchdog is running. | ||
222 | * Depending on the memory size, the watchdog might trigger, while we | ||
223 | * are still saving the memory. | ||
224 | * We reuse the open flag to ensure that suspend and watchdog open are | ||
225 | * exclusive operations | ||
226 | */ | ||
227 | static int wdt_suspend(void) | ||
228 | { | ||
229 | if (test_and_set_bit(WDOG_DEV_OPEN, &wdt_dev.status)) { | ||
230 | pr_err("Linux cannot be suspended while the watchdog is in use\n"); | ||
231 | return notifier_from_errno(-EBUSY); | ||
232 | } | ||
233 | if (test_bit(WDOG_ACTIVE, &wdt_dev.status)) { | ||
234 | clear_bit(WDOG_DEV_OPEN, &wdt_dev.status); | ||
235 | pr_err("Linux cannot be suspended while the watchdog is in use\n"); | ||
236 | return notifier_from_errno(-EBUSY); | ||
237 | } | ||
238 | return NOTIFY_DONE; | ||
239 | } | ||
240 | |||
241 | static int wdt_resume(void) | ||
242 | { | ||
243 | clear_bit(WDOG_DEV_OPEN, &wdt_dev.status); | ||
244 | return NOTIFY_DONE; | ||
245 | } | ||
246 | |||
247 | static int wdt_power_event(struct notifier_block *this, unsigned long event, | ||
248 | void *ptr) | ||
249 | { | ||
250 | switch (event) { | ||
251 | case PM_POST_HIBERNATION: | ||
252 | case PM_POST_SUSPEND: | ||
253 | return wdt_resume(); | ||
254 | case PM_HIBERNATION_PREPARE: | ||
255 | case PM_SUSPEND_PREPARE: | ||
256 | return wdt_suspend(); | ||
257 | default: | ||
258 | return NOTIFY_DONE; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | static struct notifier_block wdt_power_notifier = { | ||
263 | .notifier_call = wdt_power_event, | ||
264 | }; | ||
265 | |||
266 | static int __init diag288_init(void) | ||
267 | { | ||
268 | int ret; | ||
269 | char ebc_begin[] = { | ||
270 | 194, 197, 199, 201, 213 | ||
271 | }; | ||
272 | |||
273 | watchdog_set_nowayout(&wdt_dev, nowayout_info); | ||
274 | |||
275 | if (MACHINE_IS_VM) { | ||
276 | pr_info("The watchdog device driver detected a z/VM environment\n"); | ||
277 | if (__diag288_vm(WDT_FUNC_INIT, 15, | ||
278 | ebc_begin, sizeof(ebc_begin)) != 0) { | ||
279 | pr_err("The watchdog cannot be initialized\n"); | ||
280 | return -EINVAL; | ||
281 | } | ||
282 | } else if (MACHINE_IS_LPAR) { | ||
283 | pr_info("The watchdog device driver detected an LPAR environment\n"); | ||
284 | if (__diag288_lpar(WDT_FUNC_INIT, 30, LPARWDT_RESTART)) { | ||
285 | pr_err("The watchdog cannot be initialized\n"); | ||
286 | return -EINVAL; | ||
287 | } | ||
288 | } else { | ||
289 | pr_err("Linux runs in an environment that does not support the diag288 watchdog\n"); | ||
290 | return -ENODEV; | ||
291 | } | ||
292 | |||
293 | if (__diag288_lpar(WDT_FUNC_CANCEL, 0, 0)) { | ||
294 | pr_err("The watchdog cannot be deactivated\n"); | ||
295 | return -EINVAL; | ||
296 | } | ||
297 | |||
298 | ret = register_pm_notifier(&wdt_power_notifier); | ||
299 | if (ret) | ||
300 | return ret; | ||
301 | |||
302 | ret = watchdog_register_device(&wdt_dev); | ||
303 | if (ret) | ||
304 | unregister_pm_notifier(&wdt_power_notifier); | ||
305 | |||
306 | return ret; | ||
307 | } | ||
308 | |||
309 | static void __exit diag288_exit(void) | ||
310 | { | ||
311 | watchdog_unregister_device(&wdt_dev); | ||
312 | unregister_pm_notifier(&wdt_power_notifier); | ||
313 | } | ||
314 | |||
315 | module_init(diag288_init); | ||
316 | module_exit(diag288_exit); | ||
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 6d325bda76da..5d4de88fe5b8 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -1168,7 +1168,8 @@ int gnttab_resume(void) | |||
1168 | 1168 | ||
1169 | int gnttab_suspend(void) | 1169 | int gnttab_suspend(void) |
1170 | { | 1170 | { |
1171 | gnttab_interface->unmap_frames(); | 1171 | if (!xen_feature(XENFEAT_auto_translated_physmap)) |
1172 | gnttab_interface->unmap_frames(); | ||
1172 | return 0; | 1173 | return 0; |
1173 | } | 1174 | } |
1174 | 1175 | ||
diff --git a/firmware/Makefile b/firmware/Makefile index 5747417069ca..0862d34cf7d1 100644 --- a/firmware/Makefile +++ b/firmware/Makefile | |||
@@ -219,6 +219,12 @@ $(obj)/%.fw: $(obj)/%.H16 $(ihex2fw_dep) | |||
219 | obj-y += $(patsubst %,%.gen.o, $(fw-external-y)) | 219 | obj-y += $(patsubst %,%.gen.o, $(fw-external-y)) |
220 | obj-$(CONFIG_FIRMWARE_IN_KERNEL) += $(patsubst %,%.gen.o, $(fw-shipped-y)) | 220 | obj-$(CONFIG_FIRMWARE_IN_KERNEL) += $(patsubst %,%.gen.o, $(fw-shipped-y)) |
221 | 221 | ||
222 | ifeq ($(KBUILD_SRC),) | ||
223 | # Makefile.build only creates subdirectories for O= builds, but external | ||
224 | # firmware might live outside the kernel source tree | ||
225 | _dummy := $(foreach d,$(addprefix $(obj)/,$(dir $(fw-external-y))), $(shell [ -d $(d) ] || mkdir -p $(d))) | ||
226 | endif | ||
227 | |||
222 | # Remove .S files and binaries created from ihex | 228 | # Remove .S files and binaries created from ihex |
223 | # (during 'make clean' .config isn't included so they're all in $(fw-shipped-)) | 229 | # (during 'make clean' .config isn't included so they're all in $(fw-shipped-)) |
224 | targets := $(fw-shipped-) $(patsubst $(obj)/%,%, \ | 230 | targets := $(fw-shipped-) $(patsubst $(obj)/%,%, \ |
@@ -1021,6 +1021,7 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
1021 | 1021 | ||
1022 | /* everything turned out well, dispose of the aiocb. */ | 1022 | /* everything turned out well, dispose of the aiocb. */ |
1023 | kiocb_free(iocb); | 1023 | kiocb_free(iocb); |
1024 | put_reqs_available(ctx, 1); | ||
1024 | 1025 | ||
1025 | /* | 1026 | /* |
1026 | * We have to order our ring_info tail store above and test | 1027 | * We have to order our ring_info tail store above and test |
@@ -1062,6 +1063,9 @@ static long aio_read_events_ring(struct kioctx *ctx, | |||
1062 | if (head == tail) | 1063 | if (head == tail) |
1063 | goto out; | 1064 | goto out; |
1064 | 1065 | ||
1066 | head %= ctx->nr_events; | ||
1067 | tail %= ctx->nr_events; | ||
1068 | |||
1065 | while (ret < nr) { | 1069 | while (ret < nr) { |
1066 | long avail; | 1070 | long avail; |
1067 | struct io_event *ev; | 1071 | struct io_event *ev; |
@@ -1100,8 +1104,6 @@ static long aio_read_events_ring(struct kioctx *ctx, | |||
1100 | flush_dcache_page(ctx->ring_pages[0]); | 1104 | flush_dcache_page(ctx->ring_pages[0]); |
1101 | 1105 | ||
1102 | pr_debug("%li h%u t%u\n", ret, head, tail); | 1106 | pr_debug("%li h%u t%u\n", ret, head, tail); |
1103 | |||
1104 | put_reqs_available(ctx, ret); | ||
1105 | out: | 1107 | out: |
1106 | mutex_unlock(&ctx->ring_lock); | 1108 | mutex_unlock(&ctx->ring_lock); |
1107 | 1109 | ||
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index d7bd395ab586..1c55388ae633 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -210,7 +210,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
210 | int pipefd; | 210 | int pipefd; |
211 | struct autofs_sb_info *sbi; | 211 | struct autofs_sb_info *sbi; |
212 | struct autofs_info *ino; | 212 | struct autofs_info *ino; |
213 | int pgrp; | 213 | int pgrp = 0; |
214 | bool pgrp_set = false; | 214 | bool pgrp_set = false; |
215 | int ret = -EINVAL; | 215 | int ret = -EINVAL; |
216 | 216 | ||
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 92371c414228..1daea0b47187 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -821,7 +821,7 @@ static void free_workspace(int type, struct list_head *workspace) | |||
821 | 821 | ||
822 | spin_lock(workspace_lock); | 822 | spin_lock(workspace_lock); |
823 | if (*num_workspace < num_online_cpus()) { | 823 | if (*num_workspace < num_online_cpus()) { |
824 | list_add_tail(workspace, idle_workspace); | 824 | list_add(workspace, idle_workspace); |
825 | (*num_workspace)++; | 825 | (*num_workspace)++; |
826 | spin_unlock(workspace_lock); | 826 | spin_unlock(workspace_lock); |
827 | goto wake; | 827 | goto wake; |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index b7e2c1c1ef36..be91397f4e92 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1259,11 +1259,19 @@ struct btrfs_block_group_cache { | |||
1259 | spinlock_t lock; | 1259 | spinlock_t lock; |
1260 | u64 pinned; | 1260 | u64 pinned; |
1261 | u64 reserved; | 1261 | u64 reserved; |
1262 | u64 delalloc_bytes; | ||
1262 | u64 bytes_super; | 1263 | u64 bytes_super; |
1263 | u64 flags; | 1264 | u64 flags; |
1264 | u64 sectorsize; | 1265 | u64 sectorsize; |
1265 | u64 cache_generation; | 1266 | u64 cache_generation; |
1266 | 1267 | ||
1268 | /* | ||
1269 | * It is just used for the delayed data space allocation because | ||
1270 | * only the data space allocation and the relative metadata update | ||
1271 | * can be done cross the transaction. | ||
1272 | */ | ||
1273 | struct rw_semaphore data_rwsem; | ||
1274 | |||
1267 | /* for raid56, this is a full stripe, without parity */ | 1275 | /* for raid56, this is a full stripe, without parity */ |
1268 | unsigned long full_stripe_len; | 1276 | unsigned long full_stripe_len; |
1269 | 1277 | ||
@@ -3316,7 +3324,7 @@ int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans, | |||
3316 | struct btrfs_key *ins); | 3324 | struct btrfs_key *ins); |
3317 | int btrfs_reserve_extent(struct btrfs_root *root, u64 num_bytes, | 3325 | int btrfs_reserve_extent(struct btrfs_root *root, u64 num_bytes, |
3318 | u64 min_alloc_size, u64 empty_size, u64 hint_byte, | 3326 | u64 min_alloc_size, u64 empty_size, u64 hint_byte, |
3319 | struct btrfs_key *ins, int is_data); | 3327 | struct btrfs_key *ins, int is_data, int delalloc); |
3320 | int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 3328 | int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
3321 | struct extent_buffer *buf, int full_backref, int no_quota); | 3329 | struct extent_buffer *buf, int full_backref, int no_quota); |
3322 | int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 3330 | int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
@@ -3330,7 +3338,8 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, | |||
3330 | u64 bytenr, u64 num_bytes, u64 parent, u64 root_objectid, | 3338 | u64 bytenr, u64 num_bytes, u64 parent, u64 root_objectid, |
3331 | u64 owner, u64 offset, int no_quota); | 3339 | u64 owner, u64 offset, int no_quota); |
3332 | 3340 | ||
3333 | int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len); | 3341 | int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len, |
3342 | int delalloc); | ||
3334 | int btrfs_free_and_pin_reserved_extent(struct btrfs_root *root, | 3343 | int btrfs_free_and_pin_reserved_extent(struct btrfs_root *root, |
3335 | u64 start, u64 len); | 3344 | u64 start, u64 len); |
3336 | void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, | 3345 | void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, |
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 2af6e66fe788..eea26e1b2fda 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "check-integrity.h" | 36 | #include "check-integrity.h" |
37 | #include "rcu-string.h" | 37 | #include "rcu-string.h" |
38 | #include "dev-replace.h" | 38 | #include "dev-replace.h" |
39 | #include "sysfs.h" | ||
39 | 40 | ||
40 | static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | 41 | static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, |
41 | int scrub_ret); | 42 | int scrub_ret); |
@@ -562,6 +563,10 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | |||
562 | fs_info->fs_devices->latest_bdev = tgt_device->bdev; | 563 | fs_info->fs_devices->latest_bdev = tgt_device->bdev; |
563 | list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list); | 564 | list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list); |
564 | 565 | ||
566 | /* replace the sysfs entry */ | ||
567 | btrfs_kobj_rm_device(fs_info, src_device); | ||
568 | btrfs_kobj_add_device(fs_info, tgt_device); | ||
569 | |||
565 | btrfs_rm_dev_replace_blocked(fs_info); | 570 | btrfs_rm_dev_replace_blocked(fs_info); |
566 | 571 | ||
567 | btrfs_rm_dev_replace_srcdev(fs_info, src_device); | 572 | btrfs_rm_dev_replace_srcdev(fs_info, src_device); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8bb4aa19898f..08e65e9cf2aa 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -369,7 +369,8 @@ static int verify_parent_transid(struct extent_io_tree *io_tree, | |||
369 | out: | 369 | out: |
370 | unlock_extent_cached(io_tree, eb->start, eb->start + eb->len - 1, | 370 | unlock_extent_cached(io_tree, eb->start, eb->start + eb->len - 1, |
371 | &cached_state, GFP_NOFS); | 371 | &cached_state, GFP_NOFS); |
372 | btrfs_tree_read_unlock_blocking(eb); | 372 | if (need_lock) |
373 | btrfs_tree_read_unlock_blocking(eb); | ||
373 | return ret; | 374 | return ret; |
374 | } | 375 | } |
375 | 376 | ||
@@ -2904,7 +2905,9 @@ retry_root_backup: | |||
2904 | if (ret) | 2905 | if (ret) |
2905 | goto fail_qgroup; | 2906 | goto fail_qgroup; |
2906 | 2907 | ||
2908 | mutex_lock(&fs_info->cleaner_mutex); | ||
2907 | ret = btrfs_recover_relocation(tree_root); | 2909 | ret = btrfs_recover_relocation(tree_root); |
2910 | mutex_unlock(&fs_info->cleaner_mutex); | ||
2908 | if (ret < 0) { | 2911 | if (ret < 0) { |
2909 | printk(KERN_WARNING | 2912 | printk(KERN_WARNING |
2910 | "BTRFS: failed to recover relocation\n"); | 2913 | "BTRFS: failed to recover relocation\n"); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index fafb3e53ecde..813537f362f9 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -105,7 +105,8 @@ static int find_next_key(struct btrfs_path *path, int level, | |||
105 | static void dump_space_info(struct btrfs_space_info *info, u64 bytes, | 105 | static void dump_space_info(struct btrfs_space_info *info, u64 bytes, |
106 | int dump_block_groups); | 106 | int dump_block_groups); |
107 | static int btrfs_update_reserved_bytes(struct btrfs_block_group_cache *cache, | 107 | static int btrfs_update_reserved_bytes(struct btrfs_block_group_cache *cache, |
108 | u64 num_bytes, int reserve); | 108 | u64 num_bytes, int reserve, |
109 | int delalloc); | ||
109 | static int block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv, | 110 | static int block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv, |
110 | u64 num_bytes); | 111 | u64 num_bytes); |
111 | int btrfs_pin_extent(struct btrfs_root *root, | 112 | int btrfs_pin_extent(struct btrfs_root *root, |
@@ -3260,7 +3261,8 @@ again: | |||
3260 | 3261 | ||
3261 | spin_lock(&block_group->lock); | 3262 | spin_lock(&block_group->lock); |
3262 | if (block_group->cached != BTRFS_CACHE_FINISHED || | 3263 | if (block_group->cached != BTRFS_CACHE_FINISHED || |
3263 | !btrfs_test_opt(root, SPACE_CACHE)) { | 3264 | !btrfs_test_opt(root, SPACE_CACHE) || |
3265 | block_group->delalloc_bytes) { | ||
3264 | /* | 3266 | /* |
3265 | * don't bother trying to write stuff out _if_ | 3267 | * don't bother trying to write stuff out _if_ |
3266 | * a) we're not cached, | 3268 | * a) we're not cached, |
@@ -5613,6 +5615,7 @@ int btrfs_exclude_logged_extents(struct btrfs_root *log, | |||
5613 | * @cache: The cache we are manipulating | 5615 | * @cache: The cache we are manipulating |
5614 | * @num_bytes: The number of bytes in question | 5616 | * @num_bytes: The number of bytes in question |
5615 | * @reserve: One of the reservation enums | 5617 | * @reserve: One of the reservation enums |
5618 | * @delalloc: The blocks are allocated for the delalloc write | ||
5616 | * | 5619 | * |
5617 | * This is called by the allocator when it reserves space, or by somebody who is | 5620 | * This is called by the allocator when it reserves space, or by somebody who is |
5618 | * freeing space that was never actually used on disk. For example if you | 5621 | * freeing space that was never actually used on disk. For example if you |
@@ -5631,7 +5634,7 @@ int btrfs_exclude_logged_extents(struct btrfs_root *log, | |||
5631 | * succeeds. | 5634 | * succeeds. |
5632 | */ | 5635 | */ |
5633 | static int btrfs_update_reserved_bytes(struct btrfs_block_group_cache *cache, | 5636 | static int btrfs_update_reserved_bytes(struct btrfs_block_group_cache *cache, |
5634 | u64 num_bytes, int reserve) | 5637 | u64 num_bytes, int reserve, int delalloc) |
5635 | { | 5638 | { |
5636 | struct btrfs_space_info *space_info = cache->space_info; | 5639 | struct btrfs_space_info *space_info = cache->space_info; |
5637 | int ret = 0; | 5640 | int ret = 0; |
@@ -5650,12 +5653,18 @@ static int btrfs_update_reserved_bytes(struct btrfs_block_group_cache *cache, | |||
5650 | num_bytes, 0); | 5653 | num_bytes, 0); |
5651 | space_info->bytes_may_use -= num_bytes; | 5654 | space_info->bytes_may_use -= num_bytes; |
5652 | } | 5655 | } |
5656 | |||
5657 | if (delalloc) | ||
5658 | cache->delalloc_bytes += num_bytes; | ||
5653 | } | 5659 | } |
5654 | } else { | 5660 | } else { |
5655 | if (cache->ro) | 5661 | if (cache->ro) |
5656 | space_info->bytes_readonly += num_bytes; | 5662 | space_info->bytes_readonly += num_bytes; |
5657 | cache->reserved -= num_bytes; | 5663 | cache->reserved -= num_bytes; |
5658 | space_info->bytes_reserved -= num_bytes; | 5664 | space_info->bytes_reserved -= num_bytes; |
5665 | |||
5666 | if (delalloc) | ||
5667 | cache->delalloc_bytes -= num_bytes; | ||
5659 | } | 5668 | } |
5660 | spin_unlock(&cache->lock); | 5669 | spin_unlock(&cache->lock); |
5661 | spin_unlock(&space_info->lock); | 5670 | spin_unlock(&space_info->lock); |
@@ -5669,7 +5678,6 @@ void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, | |||
5669 | struct btrfs_caching_control *next; | 5678 | struct btrfs_caching_control *next; |
5670 | struct btrfs_caching_control *caching_ctl; | 5679 | struct btrfs_caching_control *caching_ctl; |
5671 | struct btrfs_block_group_cache *cache; | 5680 | struct btrfs_block_group_cache *cache; |
5672 | struct btrfs_space_info *space_info; | ||
5673 | 5681 | ||
5674 | down_write(&fs_info->commit_root_sem); | 5682 | down_write(&fs_info->commit_root_sem); |
5675 | 5683 | ||
@@ -5692,9 +5700,6 @@ void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, | |||
5692 | 5700 | ||
5693 | up_write(&fs_info->commit_root_sem); | 5701 | up_write(&fs_info->commit_root_sem); |
5694 | 5702 | ||
5695 | list_for_each_entry_rcu(space_info, &fs_info->space_info, list) | ||
5696 | percpu_counter_set(&space_info->total_bytes_pinned, 0); | ||
5697 | |||
5698 | update_global_block_rsv(fs_info); | 5703 | update_global_block_rsv(fs_info); |
5699 | } | 5704 | } |
5700 | 5705 | ||
@@ -5732,6 +5737,7 @@ static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end) | |||
5732 | spin_lock(&cache->lock); | 5737 | spin_lock(&cache->lock); |
5733 | cache->pinned -= len; | 5738 | cache->pinned -= len; |
5734 | space_info->bytes_pinned -= len; | 5739 | space_info->bytes_pinned -= len; |
5740 | percpu_counter_add(&space_info->total_bytes_pinned, -len); | ||
5735 | if (cache->ro) { | 5741 | if (cache->ro) { |
5736 | space_info->bytes_readonly += len; | 5742 | space_info->bytes_readonly += len; |
5737 | readonly = true; | 5743 | readonly = true; |
@@ -6206,7 +6212,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans, | |||
6206 | WARN_ON(test_bit(EXTENT_BUFFER_DIRTY, &buf->bflags)); | 6212 | WARN_ON(test_bit(EXTENT_BUFFER_DIRTY, &buf->bflags)); |
6207 | 6213 | ||
6208 | btrfs_add_free_space(cache, buf->start, buf->len); | 6214 | btrfs_add_free_space(cache, buf->start, buf->len); |
6209 | btrfs_update_reserved_bytes(cache, buf->len, RESERVE_FREE); | 6215 | btrfs_update_reserved_bytes(cache, buf->len, RESERVE_FREE, 0); |
6210 | trace_btrfs_reserved_extent_free(root, buf->start, buf->len); | 6216 | trace_btrfs_reserved_extent_free(root, buf->start, buf->len); |
6211 | pin = 0; | 6217 | pin = 0; |
6212 | } | 6218 | } |
@@ -6365,6 +6371,70 @@ enum btrfs_loop_type { | |||
6365 | LOOP_NO_EMPTY_SIZE = 3, | 6371 | LOOP_NO_EMPTY_SIZE = 3, |
6366 | }; | 6372 | }; |
6367 | 6373 | ||
6374 | static inline void | ||
6375 | btrfs_lock_block_group(struct btrfs_block_group_cache *cache, | ||
6376 | int delalloc) | ||
6377 | { | ||
6378 | if (delalloc) | ||
6379 | down_read(&cache->data_rwsem); | ||
6380 | } | ||
6381 | |||
6382 | static inline void | ||
6383 | btrfs_grab_block_group(struct btrfs_block_group_cache *cache, | ||
6384 | int delalloc) | ||
6385 | { | ||
6386 | btrfs_get_block_group(cache); | ||
6387 | if (delalloc) | ||
6388 | down_read(&cache->data_rwsem); | ||
6389 | } | ||
6390 | |||
6391 | static struct btrfs_block_group_cache * | ||
6392 | btrfs_lock_cluster(struct btrfs_block_group_cache *block_group, | ||
6393 | struct btrfs_free_cluster *cluster, | ||
6394 | int delalloc) | ||
6395 | { | ||
6396 | struct btrfs_block_group_cache *used_bg; | ||
6397 | bool locked = false; | ||
6398 | again: | ||
6399 | spin_lock(&cluster->refill_lock); | ||
6400 | if (locked) { | ||
6401 | if (used_bg == cluster->block_group) | ||
6402 | return used_bg; | ||
6403 | |||
6404 | up_read(&used_bg->data_rwsem); | ||
6405 | btrfs_put_block_group(used_bg); | ||
6406 | } | ||
6407 | |||
6408 | used_bg = cluster->block_group; | ||
6409 | if (!used_bg) | ||
6410 | return NULL; | ||
6411 | |||
6412 | if (used_bg == block_group) | ||
6413 | return used_bg; | ||
6414 | |||
6415 | btrfs_get_block_group(used_bg); | ||
6416 | |||
6417 | if (!delalloc) | ||
6418 | return used_bg; | ||
6419 | |||
6420 | if (down_read_trylock(&used_bg->data_rwsem)) | ||
6421 | return used_bg; | ||
6422 | |||
6423 | spin_unlock(&cluster->refill_lock); | ||
6424 | down_read(&used_bg->data_rwsem); | ||
6425 | locked = true; | ||
6426 | goto again; | ||
6427 | } | ||
6428 | |||
6429 | static inline void | ||
6430 | btrfs_release_block_group(struct btrfs_block_group_cache *cache, | ||
6431 | int delalloc) | ||
6432 | { | ||
6433 | if (delalloc) | ||
6434 | up_read(&cache->data_rwsem); | ||
6435 | btrfs_put_block_group(cache); | ||
6436 | } | ||
6437 | |||
6368 | /* | 6438 | /* |
6369 | * walks the btree of allocated extents and find a hole of a given size. | 6439 | * walks the btree of allocated extents and find a hole of a given size. |
6370 | * The key ins is changed to record the hole: | 6440 | * The key ins is changed to record the hole: |
@@ -6379,7 +6449,7 @@ enum btrfs_loop_type { | |||
6379 | static noinline int find_free_extent(struct btrfs_root *orig_root, | 6449 | static noinline int find_free_extent(struct btrfs_root *orig_root, |
6380 | u64 num_bytes, u64 empty_size, | 6450 | u64 num_bytes, u64 empty_size, |
6381 | u64 hint_byte, struct btrfs_key *ins, | 6451 | u64 hint_byte, struct btrfs_key *ins, |
6382 | u64 flags) | 6452 | u64 flags, int delalloc) |
6383 | { | 6453 | { |
6384 | int ret = 0; | 6454 | int ret = 0; |
6385 | struct btrfs_root *root = orig_root->fs_info->extent_root; | 6455 | struct btrfs_root *root = orig_root->fs_info->extent_root; |
@@ -6467,6 +6537,7 @@ static noinline int find_free_extent(struct btrfs_root *orig_root, | |||
6467 | up_read(&space_info->groups_sem); | 6537 | up_read(&space_info->groups_sem); |
6468 | } else { | 6538 | } else { |
6469 | index = get_block_group_index(block_group); | 6539 | index = get_block_group_index(block_group); |
6540 | btrfs_lock_block_group(block_group, delalloc); | ||
6470 | goto have_block_group; | 6541 | goto have_block_group; |
6471 | } | 6542 | } |
6472 | } else if (block_group) { | 6543 | } else if (block_group) { |
@@ -6481,7 +6552,7 @@ search: | |||
6481 | u64 offset; | 6552 | u64 offset; |
6482 | int cached; | 6553 | int cached; |
6483 | 6554 | ||
6484 | btrfs_get_block_group(block_group); | 6555 | btrfs_grab_block_group(block_group, delalloc); |
6485 | search_start = block_group->key.objectid; | 6556 | search_start = block_group->key.objectid; |
6486 | 6557 | ||
6487 | /* | 6558 | /* |
@@ -6529,16 +6600,16 @@ have_block_group: | |||
6529 | * the refill lock keeps out other | 6600 | * the refill lock keeps out other |
6530 | * people trying to start a new cluster | 6601 | * people trying to start a new cluster |
6531 | */ | 6602 | */ |
6532 | spin_lock(&last_ptr->refill_lock); | 6603 | used_block_group = btrfs_lock_cluster(block_group, |
6533 | used_block_group = last_ptr->block_group; | 6604 | last_ptr, |
6534 | if (used_block_group != block_group && | 6605 | delalloc); |
6535 | (!used_block_group || | 6606 | if (!used_block_group) |
6536 | used_block_group->ro || | ||
6537 | !block_group_bits(used_block_group, flags))) | ||
6538 | goto refill_cluster; | 6607 | goto refill_cluster; |
6539 | 6608 | ||
6540 | if (used_block_group != block_group) | 6609 | if (used_block_group != block_group && |
6541 | btrfs_get_block_group(used_block_group); | 6610 | (used_block_group->ro || |
6611 | !block_group_bits(used_block_group, flags))) | ||
6612 | goto release_cluster; | ||
6542 | 6613 | ||
6543 | offset = btrfs_alloc_from_cluster(used_block_group, | 6614 | offset = btrfs_alloc_from_cluster(used_block_group, |
6544 | last_ptr, | 6615 | last_ptr, |
@@ -6552,16 +6623,15 @@ have_block_group: | |||
6552 | used_block_group, | 6623 | used_block_group, |
6553 | search_start, num_bytes); | 6624 | search_start, num_bytes); |
6554 | if (used_block_group != block_group) { | 6625 | if (used_block_group != block_group) { |
6555 | btrfs_put_block_group(block_group); | 6626 | btrfs_release_block_group(block_group, |
6627 | delalloc); | ||
6556 | block_group = used_block_group; | 6628 | block_group = used_block_group; |
6557 | } | 6629 | } |
6558 | goto checks; | 6630 | goto checks; |
6559 | } | 6631 | } |
6560 | 6632 | ||
6561 | WARN_ON(last_ptr->block_group != used_block_group); | 6633 | WARN_ON(last_ptr->block_group != used_block_group); |
6562 | if (used_block_group != block_group) | 6634 | release_cluster: |
6563 | btrfs_put_block_group(used_block_group); | ||
6564 | refill_cluster: | ||
6565 | /* If we are on LOOP_NO_EMPTY_SIZE, we can't | 6635 | /* If we are on LOOP_NO_EMPTY_SIZE, we can't |
6566 | * set up a new clusters, so lets just skip it | 6636 | * set up a new clusters, so lets just skip it |
6567 | * and let the allocator find whatever block | 6637 | * and let the allocator find whatever block |
@@ -6578,8 +6648,10 @@ refill_cluster: | |||
6578 | * succeeding in the unclustered | 6648 | * succeeding in the unclustered |
6579 | * allocation. */ | 6649 | * allocation. */ |
6580 | if (loop >= LOOP_NO_EMPTY_SIZE && | 6650 | if (loop >= LOOP_NO_EMPTY_SIZE && |
6581 | last_ptr->block_group != block_group) { | 6651 | used_block_group != block_group) { |
6582 | spin_unlock(&last_ptr->refill_lock); | 6652 | spin_unlock(&last_ptr->refill_lock); |
6653 | btrfs_release_block_group(used_block_group, | ||
6654 | delalloc); | ||
6583 | goto unclustered_alloc; | 6655 | goto unclustered_alloc; |
6584 | } | 6656 | } |
6585 | 6657 | ||
@@ -6589,6 +6661,10 @@ refill_cluster: | |||
6589 | */ | 6661 | */ |
6590 | btrfs_return_cluster_to_free_space(NULL, last_ptr); | 6662 | btrfs_return_cluster_to_free_space(NULL, last_ptr); |
6591 | 6663 | ||
6664 | if (used_block_group != block_group) | ||
6665 | btrfs_release_block_group(used_block_group, | ||
6666 | delalloc); | ||
6667 | refill_cluster: | ||
6592 | if (loop >= LOOP_NO_EMPTY_SIZE) { | 6668 | if (loop >= LOOP_NO_EMPTY_SIZE) { |
6593 | spin_unlock(&last_ptr->refill_lock); | 6669 | spin_unlock(&last_ptr->refill_lock); |
6594 | goto unclustered_alloc; | 6670 | goto unclustered_alloc; |
@@ -6696,7 +6772,7 @@ checks: | |||
6696 | BUG_ON(offset > search_start); | 6772 | BUG_ON(offset > search_start); |
6697 | 6773 | ||
6698 | ret = btrfs_update_reserved_bytes(block_group, num_bytes, | 6774 | ret = btrfs_update_reserved_bytes(block_group, num_bytes, |
6699 | alloc_type); | 6775 | alloc_type, delalloc); |
6700 | if (ret == -EAGAIN) { | 6776 | if (ret == -EAGAIN) { |
6701 | btrfs_add_free_space(block_group, offset, num_bytes); | 6777 | btrfs_add_free_space(block_group, offset, num_bytes); |
6702 | goto loop; | 6778 | goto loop; |
@@ -6708,13 +6784,13 @@ checks: | |||
6708 | 6784 | ||
6709 | trace_btrfs_reserve_extent(orig_root, block_group, | 6785 | trace_btrfs_reserve_extent(orig_root, block_group, |
6710 | search_start, num_bytes); | 6786 | search_start, num_bytes); |
6711 | btrfs_put_block_group(block_group); | 6787 | btrfs_release_block_group(block_group, delalloc); |
6712 | break; | 6788 | break; |
6713 | loop: | 6789 | loop: |
6714 | failed_cluster_refill = false; | 6790 | failed_cluster_refill = false; |
6715 | failed_alloc = false; | 6791 | failed_alloc = false; |
6716 | BUG_ON(index != get_block_group_index(block_group)); | 6792 | BUG_ON(index != get_block_group_index(block_group)); |
6717 | btrfs_put_block_group(block_group); | 6793 | btrfs_release_block_group(block_group, delalloc); |
6718 | } | 6794 | } |
6719 | up_read(&space_info->groups_sem); | 6795 | up_read(&space_info->groups_sem); |
6720 | 6796 | ||
@@ -6827,7 +6903,7 @@ again: | |||
6827 | int btrfs_reserve_extent(struct btrfs_root *root, | 6903 | int btrfs_reserve_extent(struct btrfs_root *root, |
6828 | u64 num_bytes, u64 min_alloc_size, | 6904 | u64 num_bytes, u64 min_alloc_size, |
6829 | u64 empty_size, u64 hint_byte, | 6905 | u64 empty_size, u64 hint_byte, |
6830 | struct btrfs_key *ins, int is_data) | 6906 | struct btrfs_key *ins, int is_data, int delalloc) |
6831 | { | 6907 | { |
6832 | bool final_tried = false; | 6908 | bool final_tried = false; |
6833 | u64 flags; | 6909 | u64 flags; |
@@ -6837,7 +6913,7 @@ int btrfs_reserve_extent(struct btrfs_root *root, | |||
6837 | again: | 6913 | again: |
6838 | WARN_ON(num_bytes < root->sectorsize); | 6914 | WARN_ON(num_bytes < root->sectorsize); |
6839 | ret = find_free_extent(root, num_bytes, empty_size, hint_byte, ins, | 6915 | ret = find_free_extent(root, num_bytes, empty_size, hint_byte, ins, |
6840 | flags); | 6916 | flags, delalloc); |
6841 | 6917 | ||
6842 | if (ret == -ENOSPC) { | 6918 | if (ret == -ENOSPC) { |
6843 | if (!final_tried && ins->offset) { | 6919 | if (!final_tried && ins->offset) { |
@@ -6862,7 +6938,8 @@ again: | |||
6862 | } | 6938 | } |
6863 | 6939 | ||
6864 | static int __btrfs_free_reserved_extent(struct btrfs_root *root, | 6940 | static int __btrfs_free_reserved_extent(struct btrfs_root *root, |
6865 | u64 start, u64 len, int pin) | 6941 | u64 start, u64 len, |
6942 | int pin, int delalloc) | ||
6866 | { | 6943 | { |
6867 | struct btrfs_block_group_cache *cache; | 6944 | struct btrfs_block_group_cache *cache; |
6868 | int ret = 0; | 6945 | int ret = 0; |
@@ -6881,7 +6958,7 @@ static int __btrfs_free_reserved_extent(struct btrfs_root *root, | |||
6881 | pin_down_extent(root, cache, start, len, 1); | 6958 | pin_down_extent(root, cache, start, len, 1); |
6882 | else { | 6959 | else { |
6883 | btrfs_add_free_space(cache, start, len); | 6960 | btrfs_add_free_space(cache, start, len); |
6884 | btrfs_update_reserved_bytes(cache, len, RESERVE_FREE); | 6961 | btrfs_update_reserved_bytes(cache, len, RESERVE_FREE, delalloc); |
6885 | } | 6962 | } |
6886 | btrfs_put_block_group(cache); | 6963 | btrfs_put_block_group(cache); |
6887 | 6964 | ||
@@ -6891,15 +6968,15 @@ static int __btrfs_free_reserved_extent(struct btrfs_root *root, | |||
6891 | } | 6968 | } |
6892 | 6969 | ||
6893 | int btrfs_free_reserved_extent(struct btrfs_root *root, | 6970 | int btrfs_free_reserved_extent(struct btrfs_root *root, |
6894 | u64 start, u64 len) | 6971 | u64 start, u64 len, int delalloc) |
6895 | { | 6972 | { |
6896 | return __btrfs_free_reserved_extent(root, start, len, 0); | 6973 | return __btrfs_free_reserved_extent(root, start, len, 0, delalloc); |
6897 | } | 6974 | } |
6898 | 6975 | ||
6899 | int btrfs_free_and_pin_reserved_extent(struct btrfs_root *root, | 6976 | int btrfs_free_and_pin_reserved_extent(struct btrfs_root *root, |
6900 | u64 start, u64 len) | 6977 | u64 start, u64 len) |
6901 | { | 6978 | { |
6902 | return __btrfs_free_reserved_extent(root, start, len, 1); | 6979 | return __btrfs_free_reserved_extent(root, start, len, 1, 0); |
6903 | } | 6980 | } |
6904 | 6981 | ||
6905 | static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans, | 6982 | static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans, |
@@ -7114,7 +7191,7 @@ int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans, | |||
7114 | return -EINVAL; | 7191 | return -EINVAL; |
7115 | 7192 | ||
7116 | ret = btrfs_update_reserved_bytes(block_group, ins->offset, | 7193 | ret = btrfs_update_reserved_bytes(block_group, ins->offset, |
7117 | RESERVE_ALLOC_NO_ACCOUNT); | 7194 | RESERVE_ALLOC_NO_ACCOUNT, 0); |
7118 | BUG_ON(ret); /* logic error */ | 7195 | BUG_ON(ret); /* logic error */ |
7119 | ret = alloc_reserved_file_extent(trans, root, 0, root_objectid, | 7196 | ret = alloc_reserved_file_extent(trans, root, 0, root_objectid, |
7120 | 0, owner, offset, ins, 1); | 7197 | 0, owner, offset, ins, 1); |
@@ -7256,7 +7333,7 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
7256 | return ERR_CAST(block_rsv); | 7333 | return ERR_CAST(block_rsv); |
7257 | 7334 | ||
7258 | ret = btrfs_reserve_extent(root, blocksize, blocksize, | 7335 | ret = btrfs_reserve_extent(root, blocksize, blocksize, |
7259 | empty_size, hint, &ins, 0); | 7336 | empty_size, hint, &ins, 0, 0); |
7260 | if (ret) { | 7337 | if (ret) { |
7261 | unuse_block_rsv(root->fs_info, block_rsv, blocksize); | 7338 | unuse_block_rsv(root->fs_info, block_rsv, blocksize); |
7262 | return ERR_PTR(ret); | 7339 | return ERR_PTR(ret); |
@@ -8659,6 +8736,7 @@ btrfs_create_block_group_cache(struct btrfs_root *root, u64 start, u64 size) | |||
8659 | start); | 8736 | start); |
8660 | atomic_set(&cache->count, 1); | 8737 | atomic_set(&cache->count, 1); |
8661 | spin_lock_init(&cache->lock); | 8738 | spin_lock_init(&cache->lock); |
8739 | init_rwsem(&cache->data_rwsem); | ||
8662 | INIT_LIST_HEAD(&cache->list); | 8740 | INIT_LIST_HEAD(&cache->list); |
8663 | INIT_LIST_HEAD(&cache->cluster_list); | 8741 | INIT_LIST_HEAD(&cache->cluster_list); |
8664 | INIT_LIST_HEAD(&cache->new_bg_list); | 8742 | INIT_LIST_HEAD(&cache->new_bg_list); |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 15ce5f2a2b62..ccc264e7bde1 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -158,7 +158,6 @@ struct extent_buffer { | |||
158 | * to unlock | 158 | * to unlock |
159 | */ | 159 | */ |
160 | wait_queue_head_t read_lock_wq; | 160 | wait_queue_head_t read_lock_wq; |
161 | wait_queue_head_t lock_wq; | ||
162 | struct page *pages[INLINE_EXTENT_BUFFER_PAGES]; | 161 | struct page *pages[INLINE_EXTENT_BUFFER_PAGES]; |
163 | #ifdef CONFIG_BTRFS_DEBUG | 162 | #ifdef CONFIG_BTRFS_DEBUG |
164 | struct list_head leak_list; | 163 | struct list_head leak_list; |
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 1874aee69c86..225302b39afb 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -75,6 +75,8 @@ void free_extent_map(struct extent_map *em) | |||
75 | if (atomic_dec_and_test(&em->refs)) { | 75 | if (atomic_dec_and_test(&em->refs)) { |
76 | WARN_ON(extent_map_in_tree(em)); | 76 | WARN_ON(extent_map_in_tree(em)); |
77 | WARN_ON(!list_empty(&em->list)); | 77 | WARN_ON(!list_empty(&em->list)); |
78 | if (test_bit(EXTENT_FLAG_FS_MAPPING, &em->flags)) | ||
79 | kfree(em->bdev); | ||
78 | kmem_cache_free(extent_map_cache, em); | 80 | kmem_cache_free(extent_map_cache, em); |
79 | } | 81 | } |
80 | } | 82 | } |
diff --git a/fs/btrfs/extent_map.h b/fs/btrfs/extent_map.h index e7fd8a56a140..b2991fd8583e 100644 --- a/fs/btrfs/extent_map.h +++ b/fs/btrfs/extent_map.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #define EXTENT_FLAG_PREALLOC 3 /* pre-allocated extent */ | 15 | #define EXTENT_FLAG_PREALLOC 3 /* pre-allocated extent */ |
16 | #define EXTENT_FLAG_LOGGING 4 /* Logging this extent */ | 16 | #define EXTENT_FLAG_LOGGING 4 /* Logging this extent */ |
17 | #define EXTENT_FLAG_FILLING 5 /* Filling in a preallocated extent */ | 17 | #define EXTENT_FLAG_FILLING 5 /* Filling in a preallocated extent */ |
18 | #define EXTENT_FLAG_FS_MAPPING 6 /* filesystem extent mapping type */ | ||
18 | 19 | ||
19 | struct extent_map { | 20 | struct extent_map { |
20 | struct rb_node rb_node; | 21 | struct rb_node rb_node; |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 372b05ff1943..2b0a627cb5f9 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -274,18 +274,32 @@ struct io_ctl { | |||
274 | }; | 274 | }; |
275 | 275 | ||
276 | static int io_ctl_init(struct io_ctl *io_ctl, struct inode *inode, | 276 | static int io_ctl_init(struct io_ctl *io_ctl, struct inode *inode, |
277 | struct btrfs_root *root) | 277 | struct btrfs_root *root, int write) |
278 | { | 278 | { |
279 | int num_pages; | ||
280 | int check_crcs = 0; | ||
281 | |||
282 | num_pages = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> | ||
283 | PAGE_CACHE_SHIFT; | ||
284 | |||
285 | if (btrfs_ino(inode) != BTRFS_FREE_INO_OBJECTID) | ||
286 | check_crcs = 1; | ||
287 | |||
288 | /* Make sure we can fit our crcs into the first page */ | ||
289 | if (write && check_crcs && | ||
290 | (num_pages * sizeof(u32)) >= PAGE_CACHE_SIZE) | ||
291 | return -ENOSPC; | ||
292 | |||
279 | memset(io_ctl, 0, sizeof(struct io_ctl)); | 293 | memset(io_ctl, 0, sizeof(struct io_ctl)); |
280 | io_ctl->num_pages = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> | 294 | |
281 | PAGE_CACHE_SHIFT; | 295 | io_ctl->pages = kzalloc(sizeof(struct page *) * num_pages, GFP_NOFS); |
282 | io_ctl->pages = kzalloc(sizeof(struct page *) * io_ctl->num_pages, | ||
283 | GFP_NOFS); | ||
284 | if (!io_ctl->pages) | 296 | if (!io_ctl->pages) |
285 | return -ENOMEM; | 297 | return -ENOMEM; |
298 | |||
299 | io_ctl->num_pages = num_pages; | ||
286 | io_ctl->root = root; | 300 | io_ctl->root = root; |
287 | if (btrfs_ino(inode) != BTRFS_FREE_INO_OBJECTID) | 301 | io_ctl->check_crcs = check_crcs; |
288 | io_ctl->check_crcs = 1; | 302 | |
289 | return 0; | 303 | return 0; |
290 | } | 304 | } |
291 | 305 | ||
@@ -666,6 +680,13 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, | |||
666 | generation = btrfs_free_space_generation(leaf, header); | 680 | generation = btrfs_free_space_generation(leaf, header); |
667 | btrfs_release_path(path); | 681 | btrfs_release_path(path); |
668 | 682 | ||
683 | if (!BTRFS_I(inode)->generation) { | ||
684 | btrfs_info(root->fs_info, | ||
685 | "The free space cache file (%llu) is invalid. skip it\n", | ||
686 | offset); | ||
687 | return 0; | ||
688 | } | ||
689 | |||
669 | if (BTRFS_I(inode)->generation != generation) { | 690 | if (BTRFS_I(inode)->generation != generation) { |
670 | btrfs_err(root->fs_info, | 691 | btrfs_err(root->fs_info, |
671 | "free space inode generation (%llu) " | 692 | "free space inode generation (%llu) " |
@@ -677,7 +698,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, | |||
677 | if (!num_entries) | 698 | if (!num_entries) |
678 | return 0; | 699 | return 0; |
679 | 700 | ||
680 | ret = io_ctl_init(&io_ctl, inode, root); | 701 | ret = io_ctl_init(&io_ctl, inode, root, 0); |
681 | if (ret) | 702 | if (ret) |
682 | return ret; | 703 | return ret; |
683 | 704 | ||
@@ -957,19 +978,18 @@ fail: | |||
957 | } | 978 | } |
958 | 979 | ||
959 | static noinline_for_stack int | 980 | static noinline_for_stack int |
960 | add_ioctl_entries(struct btrfs_root *root, | 981 | write_pinned_extent_entries(struct btrfs_root *root, |
961 | struct inode *inode, | 982 | struct btrfs_block_group_cache *block_group, |
962 | struct btrfs_block_group_cache *block_group, | 983 | struct io_ctl *io_ctl, |
963 | struct io_ctl *io_ctl, | 984 | int *entries) |
964 | struct extent_state **cached_state, | ||
965 | struct list_head *bitmap_list, | ||
966 | int *entries) | ||
967 | { | 985 | { |
968 | u64 start, extent_start, extent_end, len; | 986 | u64 start, extent_start, extent_end, len; |
969 | struct list_head *pos, *n; | ||
970 | struct extent_io_tree *unpin = NULL; | 987 | struct extent_io_tree *unpin = NULL; |
971 | int ret; | 988 | int ret; |
972 | 989 | ||
990 | if (!block_group) | ||
991 | return 0; | ||
992 | |||
973 | /* | 993 | /* |
974 | * We want to add any pinned extents to our free space cache | 994 | * We want to add any pinned extents to our free space cache |
975 | * so we don't leak the space | 995 | * so we don't leak the space |
@@ -979,23 +999,19 @@ add_ioctl_entries(struct btrfs_root *root, | |||
979 | */ | 999 | */ |
980 | unpin = root->fs_info->pinned_extents; | 1000 | unpin = root->fs_info->pinned_extents; |
981 | 1001 | ||
982 | if (block_group) | 1002 | start = block_group->key.objectid; |
983 | start = block_group->key.objectid; | ||
984 | 1003 | ||
985 | while (block_group && (start < block_group->key.objectid + | 1004 | while (start < block_group->key.objectid + block_group->key.offset) { |
986 | block_group->key.offset)) { | ||
987 | ret = find_first_extent_bit(unpin, start, | 1005 | ret = find_first_extent_bit(unpin, start, |
988 | &extent_start, &extent_end, | 1006 | &extent_start, &extent_end, |
989 | EXTENT_DIRTY, NULL); | 1007 | EXTENT_DIRTY, NULL); |
990 | if (ret) { | 1008 | if (ret) |
991 | ret = 0; | 1009 | return 0; |
992 | break; | ||
993 | } | ||
994 | 1010 | ||
995 | /* This pinned extent is out of our range */ | 1011 | /* This pinned extent is out of our range */ |
996 | if (extent_start >= block_group->key.objectid + | 1012 | if (extent_start >= block_group->key.objectid + |
997 | block_group->key.offset) | 1013 | block_group->key.offset) |
998 | break; | 1014 | return 0; |
999 | 1015 | ||
1000 | extent_start = max(extent_start, start); | 1016 | extent_start = max(extent_start, start); |
1001 | extent_end = min(block_group->key.objectid + | 1017 | extent_end = min(block_group->key.objectid + |
@@ -1005,11 +1021,20 @@ add_ioctl_entries(struct btrfs_root *root, | |||
1005 | *entries += 1; | 1021 | *entries += 1; |
1006 | ret = io_ctl_add_entry(io_ctl, extent_start, len, NULL); | 1022 | ret = io_ctl_add_entry(io_ctl, extent_start, len, NULL); |
1007 | if (ret) | 1023 | if (ret) |
1008 | goto out_nospc; | 1024 | return -ENOSPC; |
1009 | 1025 | ||
1010 | start = extent_end; | 1026 | start = extent_end; |
1011 | } | 1027 | } |
1012 | 1028 | ||
1029 | return 0; | ||
1030 | } | ||
1031 | |||
1032 | static noinline_for_stack int | ||
1033 | write_bitmap_entries(struct io_ctl *io_ctl, struct list_head *bitmap_list) | ||
1034 | { | ||
1035 | struct list_head *pos, *n; | ||
1036 | int ret; | ||
1037 | |||
1013 | /* Write out the bitmaps */ | 1038 | /* Write out the bitmaps */ |
1014 | list_for_each_safe(pos, n, bitmap_list) { | 1039 | list_for_each_safe(pos, n, bitmap_list) { |
1015 | struct btrfs_free_space *entry = | 1040 | struct btrfs_free_space *entry = |
@@ -1017,36 +1042,24 @@ add_ioctl_entries(struct btrfs_root *root, | |||
1017 | 1042 | ||
1018 | ret = io_ctl_add_bitmap(io_ctl, entry->bitmap); | 1043 | ret = io_ctl_add_bitmap(io_ctl, entry->bitmap); |
1019 | if (ret) | 1044 | if (ret) |
1020 | goto out_nospc; | 1045 | return -ENOSPC; |
1021 | list_del_init(&entry->list); | 1046 | list_del_init(&entry->list); |
1022 | } | 1047 | } |
1023 | 1048 | ||
1024 | /* Zero out the rest of the pages just to make sure */ | 1049 | return 0; |
1025 | io_ctl_zero_remaining_pages(io_ctl); | 1050 | } |
1026 | |||
1027 | ret = btrfs_dirty_pages(root, inode, io_ctl->pages, io_ctl->num_pages, | ||
1028 | 0, i_size_read(inode), cached_state); | ||
1029 | io_ctl_drop_pages(io_ctl); | ||
1030 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0, | ||
1031 | i_size_read(inode) - 1, cached_state, GFP_NOFS); | ||
1032 | 1051 | ||
1033 | if (ret) | 1052 | static int flush_dirty_cache(struct inode *inode) |
1034 | goto fail; | 1053 | { |
1054 | int ret; | ||
1035 | 1055 | ||
1036 | ret = btrfs_wait_ordered_range(inode, 0, (u64)-1); | 1056 | ret = btrfs_wait_ordered_range(inode, 0, (u64)-1); |
1037 | if (ret) { | 1057 | if (ret) |
1038 | clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, inode->i_size - 1, | 1058 | clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, inode->i_size - 1, |
1039 | EXTENT_DIRTY | EXTENT_DELALLOC, 0, 0, NULL, | 1059 | EXTENT_DIRTY | EXTENT_DELALLOC, 0, 0, NULL, |
1040 | GFP_NOFS); | 1060 | GFP_NOFS); |
1041 | goto fail; | ||
1042 | } | ||
1043 | return 0; | ||
1044 | 1061 | ||
1045 | fail: | 1062 | return ret; |
1046 | return -1; | ||
1047 | |||
1048 | out_nospc: | ||
1049 | return -ENOSPC; | ||
1050 | } | 1063 | } |
1051 | 1064 | ||
1052 | static void noinline_for_stack | 1065 | static void noinline_for_stack |
@@ -1056,6 +1069,7 @@ cleanup_write_cache_enospc(struct inode *inode, | |||
1056 | struct list_head *bitmap_list) | 1069 | struct list_head *bitmap_list) |
1057 | { | 1070 | { |
1058 | struct list_head *pos, *n; | 1071 | struct list_head *pos, *n; |
1072 | |||
1059 | list_for_each_safe(pos, n, bitmap_list) { | 1073 | list_for_each_safe(pos, n, bitmap_list) { |
1060 | struct btrfs_free_space *entry = | 1074 | struct btrfs_free_space *entry = |
1061 | list_entry(pos, struct btrfs_free_space, list); | 1075 | list_entry(pos, struct btrfs_free_space, list); |
@@ -1088,64 +1102,104 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode, | |||
1088 | { | 1102 | { |
1089 | struct extent_state *cached_state = NULL; | 1103 | struct extent_state *cached_state = NULL; |
1090 | struct io_ctl io_ctl; | 1104 | struct io_ctl io_ctl; |
1091 | struct list_head bitmap_list; | 1105 | LIST_HEAD(bitmap_list); |
1092 | int entries = 0; | 1106 | int entries = 0; |
1093 | int bitmaps = 0; | 1107 | int bitmaps = 0; |
1094 | int ret; | 1108 | int ret; |
1095 | int err = -1; | ||
1096 | |||
1097 | INIT_LIST_HEAD(&bitmap_list); | ||
1098 | 1109 | ||
1099 | if (!i_size_read(inode)) | 1110 | if (!i_size_read(inode)) |
1100 | return -1; | 1111 | return -1; |
1101 | 1112 | ||
1102 | ret = io_ctl_init(&io_ctl, inode, root); | 1113 | ret = io_ctl_init(&io_ctl, inode, root, 1); |
1103 | if (ret) | 1114 | if (ret) |
1104 | return -1; | 1115 | return -1; |
1105 | 1116 | ||
1117 | if (block_group && (block_group->flags & BTRFS_BLOCK_GROUP_DATA)) { | ||
1118 | down_write(&block_group->data_rwsem); | ||
1119 | spin_lock(&block_group->lock); | ||
1120 | if (block_group->delalloc_bytes) { | ||
1121 | block_group->disk_cache_state = BTRFS_DC_WRITTEN; | ||
1122 | spin_unlock(&block_group->lock); | ||
1123 | up_write(&block_group->data_rwsem); | ||
1124 | BTRFS_I(inode)->generation = 0; | ||
1125 | ret = 0; | ||
1126 | goto out; | ||
1127 | } | ||
1128 | spin_unlock(&block_group->lock); | ||
1129 | } | ||
1130 | |||
1106 | /* Lock all pages first so we can lock the extent safely. */ | 1131 | /* Lock all pages first so we can lock the extent safely. */ |
1107 | io_ctl_prepare_pages(&io_ctl, inode, 0); | 1132 | io_ctl_prepare_pages(&io_ctl, inode, 0); |
1108 | 1133 | ||
1109 | lock_extent_bits(&BTRFS_I(inode)->io_tree, 0, i_size_read(inode) - 1, | 1134 | lock_extent_bits(&BTRFS_I(inode)->io_tree, 0, i_size_read(inode) - 1, |
1110 | 0, &cached_state); | 1135 | 0, &cached_state); |
1111 | 1136 | ||
1112 | |||
1113 | /* Make sure we can fit our crcs into the first page */ | ||
1114 | if (io_ctl.check_crcs && | ||
1115 | (io_ctl.num_pages * sizeof(u32)) >= PAGE_CACHE_SIZE) | ||
1116 | goto out_nospc; | ||
1117 | |||
1118 | io_ctl_set_generation(&io_ctl, trans->transid); | 1137 | io_ctl_set_generation(&io_ctl, trans->transid); |
1119 | 1138 | ||
1139 | /* Write out the extent entries in the free space cache */ | ||
1120 | ret = write_cache_extent_entries(&io_ctl, ctl, | 1140 | ret = write_cache_extent_entries(&io_ctl, ctl, |
1121 | block_group, &entries, &bitmaps, | 1141 | block_group, &entries, &bitmaps, |
1122 | &bitmap_list); | 1142 | &bitmap_list); |
1123 | if (ret) | 1143 | if (ret) |
1124 | goto out_nospc; | 1144 | goto out_nospc; |
1125 | 1145 | ||
1126 | ret = add_ioctl_entries(root, inode, block_group, &io_ctl, | 1146 | /* |
1127 | &cached_state, &bitmap_list, &entries); | 1147 | * Some spaces that are freed in the current transaction are pinned, |
1148 | * they will be added into free space cache after the transaction is | ||
1149 | * committed, we shouldn't lose them. | ||
1150 | */ | ||
1151 | ret = write_pinned_extent_entries(root, block_group, &io_ctl, &entries); | ||
1152 | if (ret) | ||
1153 | goto out_nospc; | ||
1128 | 1154 | ||
1129 | if (ret == -ENOSPC) | 1155 | /* At last, we write out all the bitmaps. */ |
1156 | ret = write_bitmap_entries(&io_ctl, &bitmap_list); | ||
1157 | if (ret) | ||
1130 | goto out_nospc; | 1158 | goto out_nospc; |
1131 | else if (ret) | 1159 | |
1160 | /* Zero out the rest of the pages just to make sure */ | ||
1161 | io_ctl_zero_remaining_pages(&io_ctl); | ||
1162 | |||
1163 | /* Everything is written out, now we dirty the pages in the file. */ | ||
1164 | ret = btrfs_dirty_pages(root, inode, io_ctl.pages, io_ctl.num_pages, | ||
1165 | 0, i_size_read(inode), &cached_state); | ||
1166 | if (ret) | ||
1167 | goto out_nospc; | ||
1168 | |||
1169 | if (block_group && (block_group->flags & BTRFS_BLOCK_GROUP_DATA)) | ||
1170 | up_write(&block_group->data_rwsem); | ||
1171 | /* | ||
1172 | * Release the pages and unlock the extent, we will flush | ||
1173 | * them out later | ||
1174 | */ | ||
1175 | io_ctl_drop_pages(&io_ctl); | ||
1176 | |||
1177 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0, | ||
1178 | i_size_read(inode) - 1, &cached_state, GFP_NOFS); | ||
1179 | |||
1180 | /* Flush the dirty pages in the cache file. */ | ||
1181 | ret = flush_dirty_cache(inode); | ||
1182 | if (ret) | ||
1132 | goto out; | 1183 | goto out; |
1133 | 1184 | ||
1134 | err = update_cache_item(trans, root, inode, path, offset, | 1185 | /* Update the cache item to tell everyone this cache file is valid. */ |
1186 | ret = update_cache_item(trans, root, inode, path, offset, | ||
1135 | entries, bitmaps); | 1187 | entries, bitmaps); |
1136 | |||
1137 | out: | 1188 | out: |
1138 | io_ctl_free(&io_ctl); | 1189 | io_ctl_free(&io_ctl); |
1139 | if (err) { | 1190 | if (ret) { |
1140 | invalidate_inode_pages2(inode->i_mapping); | 1191 | invalidate_inode_pages2(inode->i_mapping); |
1141 | BTRFS_I(inode)->generation = 0; | 1192 | BTRFS_I(inode)->generation = 0; |
1142 | } | 1193 | } |
1143 | btrfs_update_inode(trans, root, inode); | 1194 | btrfs_update_inode(trans, root, inode); |
1144 | return err; | 1195 | return ret; |
1145 | 1196 | ||
1146 | out_nospc: | 1197 | out_nospc: |
1147 | |||
1148 | cleanup_write_cache_enospc(inode, &io_ctl, &cached_state, &bitmap_list); | 1198 | cleanup_write_cache_enospc(inode, &io_ctl, &cached_state, &bitmap_list); |
1199 | |||
1200 | if (block_group && (block_group->flags & BTRFS_BLOCK_GROUP_DATA)) | ||
1201 | up_write(&block_group->data_rwsem); | ||
1202 | |||
1149 | goto out; | 1203 | goto out; |
1150 | } | 1204 | } |
1151 | 1205 | ||
@@ -1165,6 +1219,12 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
1165 | spin_unlock(&block_group->lock); | 1219 | spin_unlock(&block_group->lock); |
1166 | return 0; | 1220 | return 0; |
1167 | } | 1221 | } |
1222 | |||
1223 | if (block_group->delalloc_bytes) { | ||
1224 | block_group->disk_cache_state = BTRFS_DC_WRITTEN; | ||
1225 | spin_unlock(&block_group->lock); | ||
1226 | return 0; | ||
1227 | } | ||
1168 | spin_unlock(&block_group->lock); | 1228 | spin_unlock(&block_group->lock); |
1169 | 1229 | ||
1170 | inode = lookup_free_space_inode(root, block_group, path); | 1230 | inode = lookup_free_space_inode(root, block_group, path); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8925f66a1411..3668048e16f8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -693,7 +693,7 @@ retry: | |||
693 | ret = btrfs_reserve_extent(root, | 693 | ret = btrfs_reserve_extent(root, |
694 | async_extent->compressed_size, | 694 | async_extent->compressed_size, |
695 | async_extent->compressed_size, | 695 | async_extent->compressed_size, |
696 | 0, alloc_hint, &ins, 1); | 696 | 0, alloc_hint, &ins, 1, 1); |
697 | if (ret) { | 697 | if (ret) { |
698 | int i; | 698 | int i; |
699 | 699 | ||
@@ -794,7 +794,7 @@ retry: | |||
794 | out: | 794 | out: |
795 | return ret; | 795 | return ret; |
796 | out_free_reserve: | 796 | out_free_reserve: |
797 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset); | 797 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset, 1); |
798 | out_free: | 798 | out_free: |
799 | extent_clear_unlock_delalloc(inode, async_extent->start, | 799 | extent_clear_unlock_delalloc(inode, async_extent->start, |
800 | async_extent->start + | 800 | async_extent->start + |
@@ -917,7 +917,7 @@ static noinline int cow_file_range(struct inode *inode, | |||
917 | cur_alloc_size = disk_num_bytes; | 917 | cur_alloc_size = disk_num_bytes; |
918 | ret = btrfs_reserve_extent(root, cur_alloc_size, | 918 | ret = btrfs_reserve_extent(root, cur_alloc_size, |
919 | root->sectorsize, 0, alloc_hint, | 919 | root->sectorsize, 0, alloc_hint, |
920 | &ins, 1); | 920 | &ins, 1, 1); |
921 | if (ret < 0) | 921 | if (ret < 0) |
922 | goto out_unlock; | 922 | goto out_unlock; |
923 | 923 | ||
@@ -995,7 +995,7 @@ out: | |||
995 | return ret; | 995 | return ret; |
996 | 996 | ||
997 | out_reserve: | 997 | out_reserve: |
998 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset); | 998 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset, 1); |
999 | out_unlock: | 999 | out_unlock: |
1000 | extent_clear_unlock_delalloc(inode, start, end, locked_page, | 1000 | extent_clear_unlock_delalloc(inode, start, end, locked_page, |
1001 | EXTENT_LOCKED | EXTENT_DO_ACCOUNTING | | 1001 | EXTENT_LOCKED | EXTENT_DO_ACCOUNTING | |
@@ -2599,6 +2599,21 @@ out_kfree: | |||
2599 | return NULL; | 2599 | return NULL; |
2600 | } | 2600 | } |
2601 | 2601 | ||
2602 | static void btrfs_release_delalloc_bytes(struct btrfs_root *root, | ||
2603 | u64 start, u64 len) | ||
2604 | { | ||
2605 | struct btrfs_block_group_cache *cache; | ||
2606 | |||
2607 | cache = btrfs_lookup_block_group(root->fs_info, start); | ||
2608 | ASSERT(cache); | ||
2609 | |||
2610 | spin_lock(&cache->lock); | ||
2611 | cache->delalloc_bytes -= len; | ||
2612 | spin_unlock(&cache->lock); | ||
2613 | |||
2614 | btrfs_put_block_group(cache); | ||
2615 | } | ||
2616 | |||
2602 | /* as ordered data IO finishes, this gets called so we can finish | 2617 | /* as ordered data IO finishes, this gets called so we can finish |
2603 | * an ordered extent if the range of bytes in the file it covers are | 2618 | * an ordered extent if the range of bytes in the file it covers are |
2604 | * fully written. | 2619 | * fully written. |
@@ -2698,6 +2713,10 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent) | |||
2698 | logical_len, logical_len, | 2713 | logical_len, logical_len, |
2699 | compress_type, 0, 0, | 2714 | compress_type, 0, 0, |
2700 | BTRFS_FILE_EXTENT_REG); | 2715 | BTRFS_FILE_EXTENT_REG); |
2716 | if (!ret) | ||
2717 | btrfs_release_delalloc_bytes(root, | ||
2718 | ordered_extent->start, | ||
2719 | ordered_extent->disk_len); | ||
2701 | } | 2720 | } |
2702 | unpin_extent_cache(&BTRFS_I(inode)->extent_tree, | 2721 | unpin_extent_cache(&BTRFS_I(inode)->extent_tree, |
2703 | ordered_extent->file_offset, ordered_extent->len, | 2722 | ordered_extent->file_offset, ordered_extent->len, |
@@ -2750,7 +2769,7 @@ out: | |||
2750 | !test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags) && | 2769 | !test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags) && |
2751 | !test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) | 2770 | !test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) |
2752 | btrfs_free_reserved_extent(root, ordered_extent->start, | 2771 | btrfs_free_reserved_extent(root, ordered_extent->start, |
2753 | ordered_extent->disk_len); | 2772 | ordered_extent->disk_len, 1); |
2754 | } | 2773 | } |
2755 | 2774 | ||
2756 | 2775 | ||
@@ -6535,21 +6554,21 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode, | |||
6535 | 6554 | ||
6536 | alloc_hint = get_extent_allocation_hint(inode, start, len); | 6555 | alloc_hint = get_extent_allocation_hint(inode, start, len); |
6537 | ret = btrfs_reserve_extent(root, len, root->sectorsize, 0, | 6556 | ret = btrfs_reserve_extent(root, len, root->sectorsize, 0, |
6538 | alloc_hint, &ins, 1); | 6557 | alloc_hint, &ins, 1, 1); |
6539 | if (ret) | 6558 | if (ret) |
6540 | return ERR_PTR(ret); | 6559 | return ERR_PTR(ret); |
6541 | 6560 | ||
6542 | em = create_pinned_em(inode, start, ins.offset, start, ins.objectid, | 6561 | em = create_pinned_em(inode, start, ins.offset, start, ins.objectid, |
6543 | ins.offset, ins.offset, ins.offset, 0); | 6562 | ins.offset, ins.offset, ins.offset, 0); |
6544 | if (IS_ERR(em)) { | 6563 | if (IS_ERR(em)) { |
6545 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset); | 6564 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset, 1); |
6546 | return em; | 6565 | return em; |
6547 | } | 6566 | } |
6548 | 6567 | ||
6549 | ret = btrfs_add_ordered_extent_dio(inode, start, ins.objectid, | 6568 | ret = btrfs_add_ordered_extent_dio(inode, start, ins.objectid, |
6550 | ins.offset, ins.offset, 0); | 6569 | ins.offset, ins.offset, 0); |
6551 | if (ret) { | 6570 | if (ret) { |
6552 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset); | 6571 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset, 1); |
6553 | free_extent_map(em); | 6572 | free_extent_map(em); |
6554 | return ERR_PTR(ret); | 6573 | return ERR_PTR(ret); |
6555 | } | 6574 | } |
@@ -7437,7 +7456,7 @@ free_ordered: | |||
7437 | if (!test_bit(BTRFS_ORDERED_PREALLOC, &ordered->flags) && | 7456 | if (!test_bit(BTRFS_ORDERED_PREALLOC, &ordered->flags) && |
7438 | !test_bit(BTRFS_ORDERED_NOCOW, &ordered->flags)) | 7457 | !test_bit(BTRFS_ORDERED_NOCOW, &ordered->flags)) |
7439 | btrfs_free_reserved_extent(root, ordered->start, | 7458 | btrfs_free_reserved_extent(root, ordered->start, |
7440 | ordered->disk_len); | 7459 | ordered->disk_len, 1); |
7441 | btrfs_put_ordered_extent(ordered); | 7460 | btrfs_put_ordered_extent(ordered); |
7442 | btrfs_put_ordered_extent(ordered); | 7461 | btrfs_put_ordered_extent(ordered); |
7443 | } | 7462 | } |
@@ -8808,7 +8827,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode, | |||
8808 | cur_bytes = min(num_bytes, 256ULL * 1024 * 1024); | 8827 | cur_bytes = min(num_bytes, 256ULL * 1024 * 1024); |
8809 | cur_bytes = max(cur_bytes, min_size); | 8828 | cur_bytes = max(cur_bytes, min_size); |
8810 | ret = btrfs_reserve_extent(root, cur_bytes, min_size, 0, | 8829 | ret = btrfs_reserve_extent(root, cur_bytes, min_size, 0, |
8811 | *alloc_hint, &ins, 1); | 8830 | *alloc_hint, &ins, 1, 0); |
8812 | if (ret) { | 8831 | if (ret) { |
8813 | if (own_trans) | 8832 | if (own_trans) |
8814 | btrfs_end_transaction(trans, root); | 8833 | btrfs_end_transaction(trans, root); |
@@ -8822,7 +8841,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode, | |||
8822 | BTRFS_FILE_EXTENT_PREALLOC); | 8841 | BTRFS_FILE_EXTENT_PREALLOC); |
8823 | if (ret) { | 8842 | if (ret) { |
8824 | btrfs_free_reserved_extent(root, ins.objectid, | 8843 | btrfs_free_reserved_extent(root, ins.objectid, |
8825 | ins.offset); | 8844 | ins.offset, 0); |
8826 | btrfs_abort_transaction(trans, root, ret); | 8845 | btrfs_abort_transaction(trans, root, ret); |
8827 | if (own_trans) | 8846 | if (own_trans) |
8828 | btrfs_end_transaction(trans, root); | 8847 | btrfs_end_transaction(trans, root); |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 0d321c23069a..47aceb494d1d 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -136,19 +136,22 @@ static unsigned int btrfs_flags_to_ioctl(unsigned int flags) | |||
136 | void btrfs_update_iflags(struct inode *inode) | 136 | void btrfs_update_iflags(struct inode *inode) |
137 | { | 137 | { |
138 | struct btrfs_inode *ip = BTRFS_I(inode); | 138 | struct btrfs_inode *ip = BTRFS_I(inode); |
139 | 139 | unsigned int new_fl = 0; | |
140 | inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); | ||
141 | 140 | ||
142 | if (ip->flags & BTRFS_INODE_SYNC) | 141 | if (ip->flags & BTRFS_INODE_SYNC) |
143 | inode->i_flags |= S_SYNC; | 142 | new_fl |= S_SYNC; |
144 | if (ip->flags & BTRFS_INODE_IMMUTABLE) | 143 | if (ip->flags & BTRFS_INODE_IMMUTABLE) |
145 | inode->i_flags |= S_IMMUTABLE; | 144 | new_fl |= S_IMMUTABLE; |
146 | if (ip->flags & BTRFS_INODE_APPEND) | 145 | if (ip->flags & BTRFS_INODE_APPEND) |
147 | inode->i_flags |= S_APPEND; | 146 | new_fl |= S_APPEND; |
148 | if (ip->flags & BTRFS_INODE_NOATIME) | 147 | if (ip->flags & BTRFS_INODE_NOATIME) |
149 | inode->i_flags |= S_NOATIME; | 148 | new_fl |= S_NOATIME; |
150 | if (ip->flags & BTRFS_INODE_DIRSYNC) | 149 | if (ip->flags & BTRFS_INODE_DIRSYNC) |
151 | inode->i_flags |= S_DIRSYNC; | 150 | new_fl |= S_DIRSYNC; |
151 | |||
152 | set_mask_bits(&inode->i_flags, | ||
153 | S_SYNC | S_APPEND | S_IMMUTABLE | S_NOATIME | S_DIRSYNC, | ||
154 | new_fl); | ||
152 | } | 155 | } |
153 | 156 | ||
154 | /* | 157 | /* |
@@ -3139,7 +3142,6 @@ out: | |||
3139 | static void clone_update_extent_map(struct inode *inode, | 3142 | static void clone_update_extent_map(struct inode *inode, |
3140 | const struct btrfs_trans_handle *trans, | 3143 | const struct btrfs_trans_handle *trans, |
3141 | const struct btrfs_path *path, | 3144 | const struct btrfs_path *path, |
3142 | struct btrfs_file_extent_item *fi, | ||
3143 | const u64 hole_offset, | 3145 | const u64 hole_offset, |
3144 | const u64 hole_len) | 3146 | const u64 hole_len) |
3145 | { | 3147 | { |
@@ -3154,7 +3156,11 @@ static void clone_update_extent_map(struct inode *inode, | |||
3154 | return; | 3156 | return; |
3155 | } | 3157 | } |
3156 | 3158 | ||
3157 | if (fi) { | 3159 | if (path) { |
3160 | struct btrfs_file_extent_item *fi; | ||
3161 | |||
3162 | fi = btrfs_item_ptr(path->nodes[0], path->slots[0], | ||
3163 | struct btrfs_file_extent_item); | ||
3158 | btrfs_extent_item_to_extent_map(inode, path, fi, false, em); | 3164 | btrfs_extent_item_to_extent_map(inode, path, fi, false, em); |
3159 | em->generation = -1; | 3165 | em->generation = -1; |
3160 | if (btrfs_file_extent_type(path->nodes[0], fi) == | 3166 | if (btrfs_file_extent_type(path->nodes[0], fi) == |
@@ -3508,18 +3514,15 @@ process_slot: | |||
3508 | btrfs_item_ptr_offset(leaf, slot), | 3514 | btrfs_item_ptr_offset(leaf, slot), |
3509 | size); | 3515 | size); |
3510 | inode_add_bytes(inode, datal); | 3516 | inode_add_bytes(inode, datal); |
3511 | extent = btrfs_item_ptr(leaf, slot, | ||
3512 | struct btrfs_file_extent_item); | ||
3513 | } | 3517 | } |
3514 | 3518 | ||
3515 | /* If we have an implicit hole (NO_HOLES feature). */ | 3519 | /* If we have an implicit hole (NO_HOLES feature). */ |
3516 | if (drop_start < new_key.offset) | 3520 | if (drop_start < new_key.offset) |
3517 | clone_update_extent_map(inode, trans, | 3521 | clone_update_extent_map(inode, trans, |
3518 | path, NULL, drop_start, | 3522 | NULL, drop_start, |
3519 | new_key.offset - drop_start); | 3523 | new_key.offset - drop_start); |
3520 | 3524 | ||
3521 | clone_update_extent_map(inode, trans, path, | 3525 | clone_update_extent_map(inode, trans, path, 0, 0); |
3522 | extent, 0, 0); | ||
3523 | 3526 | ||
3524 | btrfs_mark_buffer_dirty(leaf); | 3527 | btrfs_mark_buffer_dirty(leaf); |
3525 | btrfs_release_path(path); | 3528 | btrfs_release_path(path); |
@@ -3562,12 +3565,10 @@ process_slot: | |||
3562 | btrfs_end_transaction(trans, root); | 3565 | btrfs_end_transaction(trans, root); |
3563 | goto out; | 3566 | goto out; |
3564 | } | 3567 | } |
3568 | clone_update_extent_map(inode, trans, NULL, last_dest_end, | ||
3569 | destoff + len - last_dest_end); | ||
3565 | ret = clone_finish_inode_update(trans, inode, destoff + len, | 3570 | ret = clone_finish_inode_update(trans, inode, destoff + len, |
3566 | destoff, olen); | 3571 | destoff, olen); |
3567 | if (ret) | ||
3568 | goto out; | ||
3569 | clone_update_extent_map(inode, trans, path, NULL, last_dest_end, | ||
3570 | destoff + len - last_dest_end); | ||
3571 | } | 3572 | } |
3572 | 3573 | ||
3573 | out: | 3574 | out: |
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index 01277b8f2373..5665d2149249 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c | |||
@@ -33,14 +33,14 @@ static void btrfs_assert_tree_read_locked(struct extent_buffer *eb); | |||
33 | */ | 33 | */ |
34 | void btrfs_set_lock_blocking_rw(struct extent_buffer *eb, int rw) | 34 | void btrfs_set_lock_blocking_rw(struct extent_buffer *eb, int rw) |
35 | { | 35 | { |
36 | if (eb->lock_nested) { | 36 | /* |
37 | read_lock(&eb->lock); | 37 | * no lock is required. The lock owner may change if |
38 | if (eb->lock_nested && current->pid == eb->lock_owner) { | 38 | * we have a read lock, but it won't change to or away |
39 | read_unlock(&eb->lock); | 39 | * from us. If we have the write lock, we are the owner |
40 | return; | 40 | * and it'll never change. |
41 | } | 41 | */ |
42 | read_unlock(&eb->lock); | 42 | if (eb->lock_nested && current->pid == eb->lock_owner) |
43 | } | 43 | return; |
44 | if (rw == BTRFS_WRITE_LOCK) { | 44 | if (rw == BTRFS_WRITE_LOCK) { |
45 | if (atomic_read(&eb->blocking_writers) == 0) { | 45 | if (atomic_read(&eb->blocking_writers) == 0) { |
46 | WARN_ON(atomic_read(&eb->spinning_writers) != 1); | 46 | WARN_ON(atomic_read(&eb->spinning_writers) != 1); |
@@ -65,14 +65,15 @@ void btrfs_set_lock_blocking_rw(struct extent_buffer *eb, int rw) | |||
65 | */ | 65 | */ |
66 | void btrfs_clear_lock_blocking_rw(struct extent_buffer *eb, int rw) | 66 | void btrfs_clear_lock_blocking_rw(struct extent_buffer *eb, int rw) |
67 | { | 67 | { |
68 | if (eb->lock_nested) { | 68 | /* |
69 | read_lock(&eb->lock); | 69 | * no lock is required. The lock owner may change if |
70 | if (eb->lock_nested && current->pid == eb->lock_owner) { | 70 | * we have a read lock, but it won't change to or away |
71 | read_unlock(&eb->lock); | 71 | * from us. If we have the write lock, we are the owner |
72 | return; | 72 | * and it'll never change. |
73 | } | 73 | */ |
74 | read_unlock(&eb->lock); | 74 | if (eb->lock_nested && current->pid == eb->lock_owner) |
75 | } | 75 | return; |
76 | |||
76 | if (rw == BTRFS_WRITE_LOCK_BLOCKING) { | 77 | if (rw == BTRFS_WRITE_LOCK_BLOCKING) { |
77 | BUG_ON(atomic_read(&eb->blocking_writers) != 1); | 78 | BUG_ON(atomic_read(&eb->blocking_writers) != 1); |
78 | write_lock(&eb->lock); | 79 | write_lock(&eb->lock); |
@@ -99,6 +100,9 @@ void btrfs_clear_lock_blocking_rw(struct extent_buffer *eb, int rw) | |||
99 | void btrfs_tree_read_lock(struct extent_buffer *eb) | 100 | void btrfs_tree_read_lock(struct extent_buffer *eb) |
100 | { | 101 | { |
101 | again: | 102 | again: |
103 | BUG_ON(!atomic_read(&eb->blocking_writers) && | ||
104 | current->pid == eb->lock_owner); | ||
105 | |||
102 | read_lock(&eb->lock); | 106 | read_lock(&eb->lock); |
103 | if (atomic_read(&eb->blocking_writers) && | 107 | if (atomic_read(&eb->blocking_writers) && |
104 | current->pid == eb->lock_owner) { | 108 | current->pid == eb->lock_owner) { |
@@ -132,7 +136,9 @@ int btrfs_try_tree_read_lock(struct extent_buffer *eb) | |||
132 | if (atomic_read(&eb->blocking_writers)) | 136 | if (atomic_read(&eb->blocking_writers)) |
133 | return 0; | 137 | return 0; |
134 | 138 | ||
135 | read_lock(&eb->lock); | 139 | if (!read_trylock(&eb->lock)) |
140 | return 0; | ||
141 | |||
136 | if (atomic_read(&eb->blocking_writers)) { | 142 | if (atomic_read(&eb->blocking_writers)) { |
137 | read_unlock(&eb->lock); | 143 | read_unlock(&eb->lock); |
138 | return 0; | 144 | return 0; |
@@ -151,7 +157,10 @@ int btrfs_try_tree_write_lock(struct extent_buffer *eb) | |||
151 | if (atomic_read(&eb->blocking_writers) || | 157 | if (atomic_read(&eb->blocking_writers) || |
152 | atomic_read(&eb->blocking_readers)) | 158 | atomic_read(&eb->blocking_readers)) |
153 | return 0; | 159 | return 0; |
154 | write_lock(&eb->lock); | 160 | |
161 | if (!write_trylock(&eb->lock)) | ||
162 | return 0; | ||
163 | |||
155 | if (atomic_read(&eb->blocking_writers) || | 164 | if (atomic_read(&eb->blocking_writers) || |
156 | atomic_read(&eb->blocking_readers)) { | 165 | atomic_read(&eb->blocking_readers)) { |
157 | write_unlock(&eb->lock); | 166 | write_unlock(&eb->lock); |
@@ -168,14 +177,15 @@ int btrfs_try_tree_write_lock(struct extent_buffer *eb) | |||
168 | */ | 177 | */ |
169 | void btrfs_tree_read_unlock(struct extent_buffer *eb) | 178 | void btrfs_tree_read_unlock(struct extent_buffer *eb) |
170 | { | 179 | { |
171 | if (eb->lock_nested) { | 180 | /* |
172 | read_lock(&eb->lock); | 181 | * if we're nested, we have the write lock. No new locking |
173 | if (eb->lock_nested && current->pid == eb->lock_owner) { | 182 | * is needed as long as we are the lock owner. |
174 | eb->lock_nested = 0; | 183 | * The write unlock will do a barrier for us, and the lock_nested |
175 | read_unlock(&eb->lock); | 184 | * field only matters to the lock owner. |
176 | return; | 185 | */ |
177 | } | 186 | if (eb->lock_nested && current->pid == eb->lock_owner) { |
178 | read_unlock(&eb->lock); | 187 | eb->lock_nested = 0; |
188 | return; | ||
179 | } | 189 | } |
180 | btrfs_assert_tree_read_locked(eb); | 190 | btrfs_assert_tree_read_locked(eb); |
181 | WARN_ON(atomic_read(&eb->spinning_readers) == 0); | 191 | WARN_ON(atomic_read(&eb->spinning_readers) == 0); |
@@ -189,14 +199,15 @@ void btrfs_tree_read_unlock(struct extent_buffer *eb) | |||
189 | */ | 199 | */ |
190 | void btrfs_tree_read_unlock_blocking(struct extent_buffer *eb) | 200 | void btrfs_tree_read_unlock_blocking(struct extent_buffer *eb) |
191 | { | 201 | { |
192 | if (eb->lock_nested) { | 202 | /* |
193 | read_lock(&eb->lock); | 203 | * if we're nested, we have the write lock. No new locking |
194 | if (eb->lock_nested && current->pid == eb->lock_owner) { | 204 | * is needed as long as we are the lock owner. |
195 | eb->lock_nested = 0; | 205 | * The write unlock will do a barrier for us, and the lock_nested |
196 | read_unlock(&eb->lock); | 206 | * field only matters to the lock owner. |
197 | return; | 207 | */ |
198 | } | 208 | if (eb->lock_nested && current->pid == eb->lock_owner) { |
199 | read_unlock(&eb->lock); | 209 | eb->lock_nested = 0; |
210 | return; | ||
200 | } | 211 | } |
201 | btrfs_assert_tree_read_locked(eb); | 212 | btrfs_assert_tree_read_locked(eb); |
202 | WARN_ON(atomic_read(&eb->blocking_readers) == 0); | 213 | WARN_ON(atomic_read(&eb->blocking_readers) == 0); |
@@ -244,6 +255,7 @@ void btrfs_tree_unlock(struct extent_buffer *eb) | |||
244 | BUG_ON(blockers > 1); | 255 | BUG_ON(blockers > 1); |
245 | 256 | ||
246 | btrfs_assert_tree_locked(eb); | 257 | btrfs_assert_tree_locked(eb); |
258 | eb->lock_owner = 0; | ||
247 | atomic_dec(&eb->write_locks); | 259 | atomic_dec(&eb->write_locks); |
248 | 260 | ||
249 | if (blockers) { | 261 | if (blockers) { |
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index 6efd70d3b64f..9626b4ad3b9a 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c | |||
@@ -54,7 +54,7 @@ static void print_extent_data_ref(struct extent_buffer *eb, | |||
54 | btrfs_extent_data_ref_count(eb, ref)); | 54 | btrfs_extent_data_ref_count(eb, ref)); |
55 | } | 55 | } |
56 | 56 | ||
57 | static void print_extent_item(struct extent_buffer *eb, int slot) | 57 | static void print_extent_item(struct extent_buffer *eb, int slot, int type) |
58 | { | 58 | { |
59 | struct btrfs_extent_item *ei; | 59 | struct btrfs_extent_item *ei; |
60 | struct btrfs_extent_inline_ref *iref; | 60 | struct btrfs_extent_inline_ref *iref; |
@@ -63,7 +63,6 @@ static void print_extent_item(struct extent_buffer *eb, int slot) | |||
63 | struct btrfs_disk_key key; | 63 | struct btrfs_disk_key key; |
64 | unsigned long end; | 64 | unsigned long end; |
65 | unsigned long ptr; | 65 | unsigned long ptr; |
66 | int type; | ||
67 | u32 item_size = btrfs_item_size_nr(eb, slot); | 66 | u32 item_size = btrfs_item_size_nr(eb, slot); |
68 | u64 flags; | 67 | u64 flags; |
69 | u64 offset; | 68 | u64 offset; |
@@ -88,7 +87,8 @@ static void print_extent_item(struct extent_buffer *eb, int slot) | |||
88 | btrfs_extent_refs(eb, ei), btrfs_extent_generation(eb, ei), | 87 | btrfs_extent_refs(eb, ei), btrfs_extent_generation(eb, ei), |
89 | flags); | 88 | flags); |
90 | 89 | ||
91 | if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) { | 90 | if ((type == BTRFS_EXTENT_ITEM_KEY) && |
91 | flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) { | ||
92 | struct btrfs_tree_block_info *info; | 92 | struct btrfs_tree_block_info *info; |
93 | info = (struct btrfs_tree_block_info *)(ei + 1); | 93 | info = (struct btrfs_tree_block_info *)(ei + 1); |
94 | btrfs_tree_block_key(eb, info, &key); | 94 | btrfs_tree_block_key(eb, info, &key); |
@@ -223,7 +223,8 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l) | |||
223 | btrfs_disk_root_refs(l, ri)); | 223 | btrfs_disk_root_refs(l, ri)); |
224 | break; | 224 | break; |
225 | case BTRFS_EXTENT_ITEM_KEY: | 225 | case BTRFS_EXTENT_ITEM_KEY: |
226 | print_extent_item(l, i); | 226 | case BTRFS_METADATA_ITEM_KEY: |
227 | print_extent_item(l, i, type); | ||
227 | break; | 228 | break; |
228 | case BTRFS_TREE_BLOCK_REF_KEY: | 229 | case BTRFS_TREE_BLOCK_REF_KEY: |
229 | printk(KERN_INFO "\t\ttree block backref\n"); | 230 | printk(KERN_INFO "\t\ttree block backref\n"); |
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 4055291a523e..4a88f073fdd7 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c | |||
@@ -1956,9 +1956,10 @@ static int __raid56_parity_recover(struct btrfs_raid_bio *rbio) | |||
1956 | * pages are going to be uptodate. | 1956 | * pages are going to be uptodate. |
1957 | */ | 1957 | */ |
1958 | for (stripe = 0; stripe < bbio->num_stripes; stripe++) { | 1958 | for (stripe = 0; stripe < bbio->num_stripes; stripe++) { |
1959 | if (rbio->faila == stripe || | 1959 | if (rbio->faila == stripe || rbio->failb == stripe) { |
1960 | rbio->failb == stripe) | 1960 | atomic_inc(&rbio->bbio->error); |
1961 | continue; | 1961 | continue; |
1962 | } | ||
1962 | 1963 | ||
1963 | for (pagenr = 0; pagenr < nr_pages; pagenr++) { | 1964 | for (pagenr = 0; pagenr < nr_pages; pagenr++) { |
1964 | struct page *p; | 1965 | struct page *p; |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index ac80188eec88..b6d198f5181e 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -2725,11 +2725,8 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, | |||
2725 | dev_extent = btrfs_item_ptr(l, slot, struct btrfs_dev_extent); | 2725 | dev_extent = btrfs_item_ptr(l, slot, struct btrfs_dev_extent); |
2726 | length = btrfs_dev_extent_length(l, dev_extent); | 2726 | length = btrfs_dev_extent_length(l, dev_extent); |
2727 | 2727 | ||
2728 | if (found_key.offset + length <= start) { | 2728 | if (found_key.offset + length <= start) |
2729 | key.offset = found_key.offset + length; | 2729 | goto skip; |
2730 | btrfs_release_path(path); | ||
2731 | continue; | ||
2732 | } | ||
2733 | 2730 | ||
2734 | chunk_tree = btrfs_dev_extent_chunk_tree(l, dev_extent); | 2731 | chunk_tree = btrfs_dev_extent_chunk_tree(l, dev_extent); |
2735 | chunk_objectid = btrfs_dev_extent_chunk_objectid(l, dev_extent); | 2732 | chunk_objectid = btrfs_dev_extent_chunk_objectid(l, dev_extent); |
@@ -2740,10 +2737,12 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, | |||
2740 | * the chunk from going away while we scrub it | 2737 | * the chunk from going away while we scrub it |
2741 | */ | 2738 | */ |
2742 | cache = btrfs_lookup_block_group(fs_info, chunk_offset); | 2739 | cache = btrfs_lookup_block_group(fs_info, chunk_offset); |
2743 | if (!cache) { | 2740 | |
2744 | ret = -ENOENT; | 2741 | /* some chunks are removed but not committed to disk yet, |
2745 | break; | 2742 | * continue scrubbing */ |
2746 | } | 2743 | if (!cache) |
2744 | goto skip; | ||
2745 | |||
2747 | dev_replace->cursor_right = found_key.offset + length; | 2746 | dev_replace->cursor_right = found_key.offset + length; |
2748 | dev_replace->cursor_left = found_key.offset; | 2747 | dev_replace->cursor_left = found_key.offset; |
2749 | dev_replace->item_needs_writeback = 1; | 2748 | dev_replace->item_needs_writeback = 1; |
@@ -2802,7 +2801,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, | |||
2802 | 2801 | ||
2803 | dev_replace->cursor_left = dev_replace->cursor_right; | 2802 | dev_replace->cursor_left = dev_replace->cursor_right; |
2804 | dev_replace->item_needs_writeback = 1; | 2803 | dev_replace->item_needs_writeback = 1; |
2805 | 2804 | skip: | |
2806 | key.offset = found_key.offset + length; | 2805 | key.offset = found_key.offset + length; |
2807 | btrfs_release_path(path); | 2806 | btrfs_release_path(path); |
2808 | } | 2807 | } |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 4662d92a4b73..8e16bca69c56 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -522,9 +522,10 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
522 | case Opt_ssd_spread: | 522 | case Opt_ssd_spread: |
523 | btrfs_set_and_info(root, SSD_SPREAD, | 523 | btrfs_set_and_info(root, SSD_SPREAD, |
524 | "use spread ssd allocation scheme"); | 524 | "use spread ssd allocation scheme"); |
525 | btrfs_set_opt(info->mount_opt, SSD); | ||
525 | break; | 526 | break; |
526 | case Opt_nossd: | 527 | case Opt_nossd: |
527 | btrfs_clear_and_info(root, NOSSD, | 528 | btrfs_set_and_info(root, NOSSD, |
528 | "not using ssd allocation scheme"); | 529 | "not using ssd allocation scheme"); |
529 | btrfs_clear_opt(info->mount_opt, SSD); | 530 | btrfs_clear_opt(info->mount_opt, SSD); |
530 | break; | 531 | break; |
@@ -1467,7 +1468,9 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
1467 | goto restore; | 1468 | goto restore; |
1468 | 1469 | ||
1469 | /* recover relocation */ | 1470 | /* recover relocation */ |
1471 | mutex_lock(&fs_info->cleaner_mutex); | ||
1470 | ret = btrfs_recover_relocation(root); | 1472 | ret = btrfs_recover_relocation(root); |
1473 | mutex_unlock(&fs_info->cleaner_mutex); | ||
1471 | if (ret) | 1474 | if (ret) |
1472 | goto restore; | 1475 | goto restore; |
1473 | 1476 | ||
@@ -1808,6 +1811,8 @@ static int btrfs_show_devname(struct seq_file *m, struct dentry *root) | |||
1808 | list_for_each_entry(dev, head, dev_list) { | 1811 | list_for_each_entry(dev, head, dev_list) { |
1809 | if (dev->missing) | 1812 | if (dev->missing) |
1810 | continue; | 1813 | continue; |
1814 | if (!dev->name) | ||
1815 | continue; | ||
1811 | if (!first_dev || dev->devid < first_dev->devid) | 1816 | if (!first_dev || dev->devid < first_dev->devid) |
1812 | first_dev = dev; | 1817 | first_dev = dev; |
1813 | } | 1818 | } |
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index df39458f1487..78699364f537 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c | |||
@@ -605,14 +605,37 @@ static void init_feature_attrs(void) | |||
605 | } | 605 | } |
606 | } | 606 | } |
607 | 607 | ||
608 | static int add_device_membership(struct btrfs_fs_info *fs_info) | 608 | int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info, |
609 | struct btrfs_device *one_device) | ||
610 | { | ||
611 | struct hd_struct *disk; | ||
612 | struct kobject *disk_kobj; | ||
613 | |||
614 | if (!fs_info->device_dir_kobj) | ||
615 | return -EINVAL; | ||
616 | |||
617 | if (one_device) { | ||
618 | disk = one_device->bdev->bd_part; | ||
619 | disk_kobj = &part_to_dev(disk)->kobj; | ||
620 | |||
621 | sysfs_remove_link(fs_info->device_dir_kobj, | ||
622 | disk_kobj->name); | ||
623 | } | ||
624 | |||
625 | return 0; | ||
626 | } | ||
627 | |||
628 | int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info, | ||
629 | struct btrfs_device *one_device) | ||
609 | { | 630 | { |
610 | int error = 0; | 631 | int error = 0; |
611 | struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; | 632 | struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; |
612 | struct btrfs_device *dev; | 633 | struct btrfs_device *dev; |
613 | 634 | ||
614 | fs_info->device_dir_kobj = kobject_create_and_add("devices", | 635 | if (!fs_info->device_dir_kobj) |
636 | fs_info->device_dir_kobj = kobject_create_and_add("devices", | ||
615 | &fs_info->super_kobj); | 637 | &fs_info->super_kobj); |
638 | |||
616 | if (!fs_info->device_dir_kobj) | 639 | if (!fs_info->device_dir_kobj) |
617 | return -ENOMEM; | 640 | return -ENOMEM; |
618 | 641 | ||
@@ -623,6 +646,9 @@ static int add_device_membership(struct btrfs_fs_info *fs_info) | |||
623 | if (!dev->bdev) | 646 | if (!dev->bdev) |
624 | continue; | 647 | continue; |
625 | 648 | ||
649 | if (one_device && one_device != dev) | ||
650 | continue; | ||
651 | |||
626 | disk = dev->bdev->bd_part; | 652 | disk = dev->bdev->bd_part; |
627 | disk_kobj = &part_to_dev(disk)->kobj; | 653 | disk_kobj = &part_to_dev(disk)->kobj; |
628 | 654 | ||
@@ -666,7 +692,7 @@ int btrfs_sysfs_add_one(struct btrfs_fs_info *fs_info) | |||
666 | if (error) | 692 | if (error) |
667 | goto failure; | 693 | goto failure; |
668 | 694 | ||
669 | error = add_device_membership(fs_info); | 695 | error = btrfs_kobj_add_device(fs_info, NULL); |
670 | if (error) | 696 | if (error) |
671 | goto failure; | 697 | goto failure; |
672 | 698 | ||
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h index 9ab576318a84..ac46df37504c 100644 --- a/fs/btrfs/sysfs.h +++ b/fs/btrfs/sysfs.h | |||
@@ -66,4 +66,8 @@ char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags); | |||
66 | extern const char * const btrfs_feature_set_names[3]; | 66 | extern const char * const btrfs_feature_set_names[3]; |
67 | extern struct kobj_type space_info_ktype; | 67 | extern struct kobj_type space_info_ktype; |
68 | extern struct kobj_type btrfs_raid_ktype; | 68 | extern struct kobj_type btrfs_raid_ktype; |
69 | int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info, | ||
70 | struct btrfs_device *one_device); | ||
71 | int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info, | ||
72 | struct btrfs_device *one_device); | ||
69 | #endif /* _BTRFS_SYSFS_H_ */ | 73 | #endif /* _BTRFS_SYSFS_H_ */ |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 511839c04f11..5f379affdf23 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -386,11 +386,13 @@ start_transaction(struct btrfs_root *root, u64 num_items, unsigned int type, | |||
386 | bool reloc_reserved = false; | 386 | bool reloc_reserved = false; |
387 | int ret; | 387 | int ret; |
388 | 388 | ||
389 | /* Send isn't supposed to start transactions. */ | ||
390 | ASSERT(current->journal_info != (void *)BTRFS_SEND_TRANS_STUB); | ||
391 | |||
389 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) | 392 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) |
390 | return ERR_PTR(-EROFS); | 393 | return ERR_PTR(-EROFS); |
391 | 394 | ||
392 | if (current->journal_info && | 395 | if (current->journal_info) { |
393 | current->journal_info != (void *)BTRFS_SEND_TRANS_STUB) { | ||
394 | WARN_ON(type & TRANS_EXTWRITERS); | 396 | WARN_ON(type & TRANS_EXTWRITERS); |
395 | h = current->journal_info; | 397 | h = current->journal_info; |
396 | h->use_count++; | 398 | h->use_count++; |
@@ -491,6 +493,7 @@ again: | |||
491 | smp_mb(); | 493 | smp_mb(); |
492 | if (cur_trans->state >= TRANS_STATE_BLOCKED && | 494 | if (cur_trans->state >= TRANS_STATE_BLOCKED && |
493 | may_wait_transaction(root, type)) { | 495 | may_wait_transaction(root, type)) { |
496 | current->journal_info = h; | ||
494 | btrfs_commit_transaction(h, root); | 497 | btrfs_commit_transaction(h, root); |
495 | goto again; | 498 | goto again; |
496 | } | 499 | } |
@@ -1615,11 +1618,6 @@ static int btrfs_flush_all_pending_stuffs(struct btrfs_trans_handle *trans, | |||
1615 | int ret; | 1618 | int ret; |
1616 | 1619 | ||
1617 | ret = btrfs_run_delayed_items(trans, root); | 1620 | ret = btrfs_run_delayed_items(trans, root); |
1618 | /* | ||
1619 | * running the delayed items may have added new refs. account | ||
1620 | * them now so that they hinder processing of more delayed refs | ||
1621 | * as little as possible. | ||
1622 | */ | ||
1623 | if (ret) | 1621 | if (ret) |
1624 | return ret; | 1622 | return ret; |
1625 | 1623 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index ffeed6d6326f..6104676857f5 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "rcu-string.h" | 40 | #include "rcu-string.h" |
41 | #include "math.h" | 41 | #include "math.h" |
42 | #include "dev-replace.h" | 42 | #include "dev-replace.h" |
43 | #include "sysfs.h" | ||
43 | 44 | ||
44 | static int init_first_rw_device(struct btrfs_trans_handle *trans, | 45 | static int init_first_rw_device(struct btrfs_trans_handle *trans, |
45 | struct btrfs_root *root, | 46 | struct btrfs_root *root, |
@@ -554,12 +555,14 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) | |||
554 | * This is ok to do without rcu read locked because we hold the | 555 | * This is ok to do without rcu read locked because we hold the |
555 | * uuid mutex so nothing we touch in here is going to disappear. | 556 | * uuid mutex so nothing we touch in here is going to disappear. |
556 | */ | 557 | */ |
557 | name = rcu_string_strdup(orig_dev->name->str, GFP_NOFS); | 558 | if (orig_dev->name) { |
558 | if (!name) { | 559 | name = rcu_string_strdup(orig_dev->name->str, GFP_NOFS); |
559 | kfree(device); | 560 | if (!name) { |
560 | goto error; | 561 | kfree(device); |
562 | goto error; | ||
563 | } | ||
564 | rcu_assign_pointer(device->name, name); | ||
561 | } | 565 | } |
562 | rcu_assign_pointer(device->name, name); | ||
563 | 566 | ||
564 | list_add(&device->dev_list, &fs_devices->devices); | 567 | list_add(&device->dev_list, &fs_devices->devices); |
565 | device->fs_devices = fs_devices; | 568 | device->fs_devices = fs_devices; |
@@ -1680,6 +1683,9 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1680 | if (device->bdev) | 1683 | if (device->bdev) |
1681 | device->fs_devices->open_devices--; | 1684 | device->fs_devices->open_devices--; |
1682 | 1685 | ||
1686 | /* remove sysfs entry */ | ||
1687 | btrfs_kobj_rm_device(root->fs_info, device); | ||
1688 | |||
1683 | call_rcu(&device->rcu, free_device); | 1689 | call_rcu(&device->rcu, free_device); |
1684 | 1690 | ||
1685 | num_devices = btrfs_super_num_devices(root->fs_info->super_copy) - 1; | 1691 | num_devices = btrfs_super_num_devices(root->fs_info->super_copy) - 1; |
@@ -2143,9 +2149,14 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
2143 | total_bytes = btrfs_super_num_devices(root->fs_info->super_copy); | 2149 | total_bytes = btrfs_super_num_devices(root->fs_info->super_copy); |
2144 | btrfs_set_super_num_devices(root->fs_info->super_copy, | 2150 | btrfs_set_super_num_devices(root->fs_info->super_copy, |
2145 | total_bytes + 1); | 2151 | total_bytes + 1); |
2152 | |||
2153 | /* add sysfs device entry */ | ||
2154 | btrfs_kobj_add_device(root->fs_info, device); | ||
2155 | |||
2146 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | 2156 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); |
2147 | 2157 | ||
2148 | if (seeding_dev) { | 2158 | if (seeding_dev) { |
2159 | char fsid_buf[BTRFS_UUID_UNPARSED_SIZE]; | ||
2149 | ret = init_first_rw_device(trans, root, device); | 2160 | ret = init_first_rw_device(trans, root, device); |
2150 | if (ret) { | 2161 | if (ret) { |
2151 | btrfs_abort_transaction(trans, root, ret); | 2162 | btrfs_abort_transaction(trans, root, ret); |
@@ -2156,6 +2167,14 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
2156 | btrfs_abort_transaction(trans, root, ret); | 2167 | btrfs_abort_transaction(trans, root, ret); |
2157 | goto error_trans; | 2168 | goto error_trans; |
2158 | } | 2169 | } |
2170 | |||
2171 | /* Sprouting would change fsid of the mounted root, | ||
2172 | * so rename the fsid on the sysfs | ||
2173 | */ | ||
2174 | snprintf(fsid_buf, BTRFS_UUID_UNPARSED_SIZE, "%pU", | ||
2175 | root->fs_info->fsid); | ||
2176 | if (kobject_rename(&root->fs_info->super_kobj, fsid_buf)) | ||
2177 | goto error_trans; | ||
2159 | } else { | 2178 | } else { |
2160 | ret = btrfs_add_device(trans, root, device); | 2179 | ret = btrfs_add_device(trans, root, device); |
2161 | if (ret) { | 2180 | if (ret) { |
@@ -2205,6 +2224,7 @@ error_trans: | |||
2205 | unlock_chunks(root); | 2224 | unlock_chunks(root); |
2206 | btrfs_end_transaction(trans, root); | 2225 | btrfs_end_transaction(trans, root); |
2207 | rcu_string_free(device->name); | 2226 | rcu_string_free(device->name); |
2227 | btrfs_kobj_rm_device(root->fs_info, device); | ||
2208 | kfree(device); | 2228 | kfree(device); |
2209 | error: | 2229 | error: |
2210 | blkdev_put(bdev, FMODE_EXCL); | 2230 | blkdev_put(bdev, FMODE_EXCL); |
@@ -2543,9 +2563,6 @@ static int btrfs_relocate_chunk(struct btrfs_root *root, | |||
2543 | remove_extent_mapping(em_tree, em); | 2563 | remove_extent_mapping(em_tree, em); |
2544 | write_unlock(&em_tree->lock); | 2564 | write_unlock(&em_tree->lock); |
2545 | 2565 | ||
2546 | kfree(map); | ||
2547 | em->bdev = NULL; | ||
2548 | |||
2549 | /* once for the tree */ | 2566 | /* once for the tree */ |
2550 | free_extent_map(em); | 2567 | free_extent_map(em); |
2551 | /* once for us */ | 2568 | /* once for us */ |
@@ -4301,9 +4318,11 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, | |||
4301 | 4318 | ||
4302 | em = alloc_extent_map(); | 4319 | em = alloc_extent_map(); |
4303 | if (!em) { | 4320 | if (!em) { |
4321 | kfree(map); | ||
4304 | ret = -ENOMEM; | 4322 | ret = -ENOMEM; |
4305 | goto error; | 4323 | goto error; |
4306 | } | 4324 | } |
4325 | set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); | ||
4307 | em->bdev = (struct block_device *)map; | 4326 | em->bdev = (struct block_device *)map; |
4308 | em->start = start; | 4327 | em->start = start; |
4309 | em->len = num_bytes; | 4328 | em->len = num_bytes; |
@@ -4346,7 +4365,6 @@ error_del_extent: | |||
4346 | /* One for the tree reference */ | 4365 | /* One for the tree reference */ |
4347 | free_extent_map(em); | 4366 | free_extent_map(em); |
4348 | error: | 4367 | error: |
4349 | kfree(map); | ||
4350 | kfree(devices_info); | 4368 | kfree(devices_info); |
4351 | return ret; | 4369 | return ret; |
4352 | } | 4370 | } |
@@ -4558,7 +4576,6 @@ void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree) | |||
4558 | write_unlock(&tree->map_tree.lock); | 4576 | write_unlock(&tree->map_tree.lock); |
4559 | if (!em) | 4577 | if (!em) |
4560 | break; | 4578 | break; |
4561 | kfree(em->bdev); | ||
4562 | /* once for us */ | 4579 | /* once for us */ |
4563 | free_extent_map(em); | 4580 | free_extent_map(em); |
4564 | /* once for the tree */ | 4581 | /* once for the tree */ |
@@ -5362,6 +5379,15 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree, | |||
5362 | return 0; | 5379 | return 0; |
5363 | } | 5380 | } |
5364 | 5381 | ||
5382 | static inline void btrfs_end_bbio(struct btrfs_bio *bbio, struct bio *bio, int err) | ||
5383 | { | ||
5384 | if (likely(bbio->flags & BTRFS_BIO_ORIG_BIO_SUBMITTED)) | ||
5385 | bio_endio_nodec(bio, err); | ||
5386 | else | ||
5387 | bio_endio(bio, err); | ||
5388 | kfree(bbio); | ||
5389 | } | ||
5390 | |||
5365 | static void btrfs_end_bio(struct bio *bio, int err) | 5391 | static void btrfs_end_bio(struct bio *bio, int err) |
5366 | { | 5392 | { |
5367 | struct btrfs_bio *bbio = bio->bi_private; | 5393 | struct btrfs_bio *bbio = bio->bi_private; |
@@ -5402,12 +5428,6 @@ static void btrfs_end_bio(struct bio *bio, int err) | |||
5402 | bio = bbio->orig_bio; | 5428 | bio = bbio->orig_bio; |
5403 | } | 5429 | } |
5404 | 5430 | ||
5405 | /* | ||
5406 | * We have original bio now. So increment bi_remaining to | ||
5407 | * account for it in endio | ||
5408 | */ | ||
5409 | atomic_inc(&bio->bi_remaining); | ||
5410 | |||
5411 | bio->bi_private = bbio->private; | 5431 | bio->bi_private = bbio->private; |
5412 | bio->bi_end_io = bbio->end_io; | 5432 | bio->bi_end_io = bbio->end_io; |
5413 | btrfs_io_bio(bio)->mirror_num = bbio->mirror_num; | 5433 | btrfs_io_bio(bio)->mirror_num = bbio->mirror_num; |
@@ -5424,9 +5444,8 @@ static void btrfs_end_bio(struct bio *bio, int err) | |||
5424 | set_bit(BIO_UPTODATE, &bio->bi_flags); | 5444 | set_bit(BIO_UPTODATE, &bio->bi_flags); |
5425 | err = 0; | 5445 | err = 0; |
5426 | } | 5446 | } |
5427 | kfree(bbio); | ||
5428 | 5447 | ||
5429 | bio_endio(bio, err); | 5448 | btrfs_end_bbio(bbio, bio, err); |
5430 | } else if (!is_orig_bio) { | 5449 | } else if (!is_orig_bio) { |
5431 | bio_put(bio); | 5450 | bio_put(bio); |
5432 | } | 5451 | } |
@@ -5589,12 +5608,15 @@ static void bbio_error(struct btrfs_bio *bbio, struct bio *bio, u64 logical) | |||
5589 | { | 5608 | { |
5590 | atomic_inc(&bbio->error); | 5609 | atomic_inc(&bbio->error); |
5591 | if (atomic_dec_and_test(&bbio->stripes_pending)) { | 5610 | if (atomic_dec_and_test(&bbio->stripes_pending)) { |
5611 | /* Shoud be the original bio. */ | ||
5612 | WARN_ON(bio != bbio->orig_bio); | ||
5613 | |||
5592 | bio->bi_private = bbio->private; | 5614 | bio->bi_private = bbio->private; |
5593 | bio->bi_end_io = bbio->end_io; | 5615 | bio->bi_end_io = bbio->end_io; |
5594 | btrfs_io_bio(bio)->mirror_num = bbio->mirror_num; | 5616 | btrfs_io_bio(bio)->mirror_num = bbio->mirror_num; |
5595 | bio->bi_iter.bi_sector = logical >> 9; | 5617 | bio->bi_iter.bi_sector = logical >> 9; |
5596 | kfree(bbio); | 5618 | |
5597 | bio_endio(bio, -EIO); | 5619 | btrfs_end_bbio(bbio, bio, -EIO); |
5598 | } | 5620 | } |
5599 | } | 5621 | } |
5600 | 5622 | ||
@@ -5681,6 +5703,7 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio, | |||
5681 | BUG_ON(!bio); /* -ENOMEM */ | 5703 | BUG_ON(!bio); /* -ENOMEM */ |
5682 | } else { | 5704 | } else { |
5683 | bio = first_bio; | 5705 | bio = first_bio; |
5706 | bbio->flags |= BTRFS_BIO_ORIG_BIO_SUBMITTED; | ||
5684 | } | 5707 | } |
5685 | 5708 | ||
5686 | submit_stripe_bio(root, bbio, bio, | 5709 | submit_stripe_bio(root, bbio, bio, |
@@ -5822,6 +5845,7 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, | |||
5822 | return -ENOMEM; | 5845 | return -ENOMEM; |
5823 | } | 5846 | } |
5824 | 5847 | ||
5848 | set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); | ||
5825 | em->bdev = (struct block_device *)map; | 5849 | em->bdev = (struct block_device *)map; |
5826 | em->start = logical; | 5850 | em->start = logical; |
5827 | em->len = length; | 5851 | em->len = length; |
@@ -5846,7 +5870,6 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, | |||
5846 | map->stripes[i].dev = btrfs_find_device(root->fs_info, devid, | 5870 | map->stripes[i].dev = btrfs_find_device(root->fs_info, devid, |
5847 | uuid, NULL); | 5871 | uuid, NULL); |
5848 | if (!map->stripes[i].dev && !btrfs_test_opt(root, DEGRADED)) { | 5872 | if (!map->stripes[i].dev && !btrfs_test_opt(root, DEGRADED)) { |
5849 | kfree(map); | ||
5850 | free_extent_map(em); | 5873 | free_extent_map(em); |
5851 | return -EIO; | 5874 | return -EIO; |
5852 | } | 5875 | } |
@@ -5854,7 +5877,6 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, | |||
5854 | map->stripes[i].dev = | 5877 | map->stripes[i].dev = |
5855 | add_missing_dev(root, devid, uuid); | 5878 | add_missing_dev(root, devid, uuid); |
5856 | if (!map->stripes[i].dev) { | 5879 | if (!map->stripes[i].dev) { |
5857 | kfree(map); | ||
5858 | free_extent_map(em); | 5880 | free_extent_map(em); |
5859 | return -EIO; | 5881 | return -EIO; |
5860 | } | 5882 | } |
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 1a15bbeb65e2..2aaa00c47816 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h | |||
@@ -190,11 +190,14 @@ struct btrfs_bio_stripe { | |||
190 | struct btrfs_bio; | 190 | struct btrfs_bio; |
191 | typedef void (btrfs_bio_end_io_t) (struct btrfs_bio *bio, int err); | 191 | typedef void (btrfs_bio_end_io_t) (struct btrfs_bio *bio, int err); |
192 | 192 | ||
193 | #define BTRFS_BIO_ORIG_BIO_SUBMITTED 0x1 | ||
194 | |||
193 | struct btrfs_bio { | 195 | struct btrfs_bio { |
194 | atomic_t stripes_pending; | 196 | atomic_t stripes_pending; |
195 | struct btrfs_fs_info *fs_info; | 197 | struct btrfs_fs_info *fs_info; |
196 | bio_end_io_t *end_io; | 198 | bio_end_io_t *end_io; |
197 | struct bio *orig_bio; | 199 | struct bio *orig_bio; |
200 | unsigned long flags; | ||
198 | void *private; | 201 | void *private; |
199 | atomic_t error; | 202 | atomic_t error; |
200 | int max_errors; | 203 | int max_errors; |
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c index 4f196314c0c1..b67d8fc81277 100644 --- a/fs/btrfs/zlib.c +++ b/fs/btrfs/zlib.c | |||
@@ -136,7 +136,7 @@ static int zlib_compress_pages(struct list_head *ws, | |||
136 | if (workspace->def_strm.total_in > 8192 && | 136 | if (workspace->def_strm.total_in > 8192 && |
137 | workspace->def_strm.total_in < | 137 | workspace->def_strm.total_in < |
138 | workspace->def_strm.total_out) { | 138 | workspace->def_strm.total_out) { |
139 | ret = -EIO; | 139 | ret = -E2BIG; |
140 | goto out; | 140 | goto out; |
141 | } | 141 | } |
142 | /* we need another page for writing out. Test this | 142 | /* we need another page for writing out. Test this |
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index 0227b45ef00a..15e9505aa35f 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c | |||
@@ -290,7 +290,8 @@ int | |||
290 | cifsConvertToUTF16(__le16 *target, const char *source, int srclen, | 290 | cifsConvertToUTF16(__le16 *target, const char *source, int srclen, |
291 | const struct nls_table *cp, int mapChars) | 291 | const struct nls_table *cp, int mapChars) |
292 | { | 292 | { |
293 | int i, j, charlen; | 293 | int i, charlen; |
294 | int j = 0; | ||
294 | char src_char; | 295 | char src_char; |
295 | __le16 dst_char; | 296 | __le16 dst_char; |
296 | wchar_t tmp; | 297 | wchar_t tmp; |
@@ -298,12 +299,11 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, | |||
298 | if (!mapChars) | 299 | if (!mapChars) |
299 | return cifs_strtoUTF16(target, source, PATH_MAX, cp); | 300 | return cifs_strtoUTF16(target, source, PATH_MAX, cp); |
300 | 301 | ||
301 | for (i = 0, j = 0; i < srclen; j++) { | 302 | for (i = 0; i < srclen; j++) { |
302 | src_char = source[i]; | 303 | src_char = source[i]; |
303 | charlen = 1; | 304 | charlen = 1; |
304 | switch (src_char) { | 305 | switch (src_char) { |
305 | case 0: | 306 | case 0: |
306 | put_unaligned(0, &target[j]); | ||
307 | goto ctoUTF16_out; | 307 | goto ctoUTF16_out; |
308 | case ':': | 308 | case ':': |
309 | dst_char = cpu_to_le16(UNI_COLON); | 309 | dst_char = cpu_to_le16(UNI_COLON); |
@@ -350,6 +350,7 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, | |||
350 | } | 350 | } |
351 | 351 | ||
352 | ctoUTF16_out: | 352 | ctoUTF16_out: |
353 | put_unaligned(0, &target[j]); /* Null terminate target unicode string */ | ||
353 | return j; | 354 | return j; |
354 | } | 355 | } |
355 | 356 | ||
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 2c90d07c0b3a..888398067420 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -725,6 +725,19 @@ out_nls: | |||
725 | goto out; | 725 | goto out; |
726 | } | 726 | } |
727 | 727 | ||
728 | static ssize_t | ||
729 | cifs_loose_read_iter(struct kiocb *iocb, struct iov_iter *iter) | ||
730 | { | ||
731 | ssize_t rc; | ||
732 | struct inode *inode = file_inode(iocb->ki_filp); | ||
733 | |||
734 | rc = cifs_revalidate_mapping(inode); | ||
735 | if (rc) | ||
736 | return rc; | ||
737 | |||
738 | return generic_file_read_iter(iocb, iter); | ||
739 | } | ||
740 | |||
728 | static ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | 741 | static ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) |
729 | { | 742 | { |
730 | struct inode *inode = file_inode(iocb->ki_filp); | 743 | struct inode *inode = file_inode(iocb->ki_filp); |
@@ -881,7 +894,7 @@ const struct inode_operations cifs_symlink_inode_ops = { | |||
881 | const struct file_operations cifs_file_ops = { | 894 | const struct file_operations cifs_file_ops = { |
882 | .read = new_sync_read, | 895 | .read = new_sync_read, |
883 | .write = new_sync_write, | 896 | .write = new_sync_write, |
884 | .read_iter = generic_file_read_iter, | 897 | .read_iter = cifs_loose_read_iter, |
885 | .write_iter = cifs_file_write_iter, | 898 | .write_iter = cifs_file_write_iter, |
886 | .open = cifs_open, | 899 | .open = cifs_open, |
887 | .release = cifs_close, | 900 | .release = cifs_close, |
@@ -939,7 +952,7 @@ const struct file_operations cifs_file_direct_ops = { | |||
939 | const struct file_operations cifs_file_nobrl_ops = { | 952 | const struct file_operations cifs_file_nobrl_ops = { |
940 | .read = new_sync_read, | 953 | .read = new_sync_read, |
941 | .write = new_sync_write, | 954 | .write = new_sync_write, |
942 | .read_iter = generic_file_read_iter, | 955 | .read_iter = cifs_loose_read_iter, |
943 | .write_iter = cifs_file_write_iter, | 956 | .write_iter = cifs_file_write_iter, |
944 | .open = cifs_open, | 957 | .open = cifs_open, |
945 | .release = cifs_close, | 958 | .release = cifs_close, |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 264ece71bdb2..68559fd557fb 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -374,7 +374,7 @@ cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, | |||
374 | oparms.cifs_sb = cifs_sb; | 374 | oparms.cifs_sb = cifs_sb; |
375 | oparms.desired_access = GENERIC_WRITE; | 375 | oparms.desired_access = GENERIC_WRITE; |
376 | oparms.create_options = create_options; | 376 | oparms.create_options = create_options; |
377 | oparms.disposition = FILE_OPEN; | 377 | oparms.disposition = FILE_CREATE; |
378 | oparms.path = path; | 378 | oparms.path = path; |
379 | oparms.fid = &fid; | 379 | oparms.fid = &fid; |
380 | oparms.reconnect = false; | 380 | oparms.reconnect = false; |
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 0762d143e252..fca382037ddd 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -194,7 +194,16 @@ static void ext4_init_block_bitmap(struct super_block *sb, | |||
194 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { | 194 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { |
195 | ext4_error(sb, "Checksum bad for group %u", block_group); | 195 | ext4_error(sb, "Checksum bad for group %u", block_group); |
196 | grp = ext4_get_group_info(sb, block_group); | 196 | grp = ext4_get_group_info(sb, block_group); |
197 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
198 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
199 | grp->bb_free); | ||
197 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 200 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
201 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
202 | int count; | ||
203 | count = ext4_free_inodes_count(sb, gdp); | ||
204 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
205 | count); | ||
206 | } | ||
198 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 207 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
199 | return; | 208 | return; |
200 | } | 209 | } |
@@ -359,6 +368,7 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
359 | { | 368 | { |
360 | ext4_fsblk_t blk; | 369 | ext4_fsblk_t blk; |
361 | struct ext4_group_info *grp = ext4_get_group_info(sb, block_group); | 370 | struct ext4_group_info *grp = ext4_get_group_info(sb, block_group); |
371 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
362 | 372 | ||
363 | if (buffer_verified(bh)) | 373 | if (buffer_verified(bh)) |
364 | return; | 374 | return; |
@@ -369,6 +379,9 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
369 | ext4_unlock_group(sb, block_group); | 379 | ext4_unlock_group(sb, block_group); |
370 | ext4_error(sb, "bg %u: block %llu: invalid block bitmap", | 380 | ext4_error(sb, "bg %u: block %llu: invalid block bitmap", |
371 | block_group, blk); | 381 | block_group, blk); |
382 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
383 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
384 | grp->bb_free); | ||
372 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 385 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
373 | return; | 386 | return; |
374 | } | 387 | } |
@@ -376,6 +389,9 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
376 | desc, bh))) { | 389 | desc, bh))) { |
377 | ext4_unlock_group(sb, block_group); | 390 | ext4_unlock_group(sb, block_group); |
378 | ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); | 391 | ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); |
392 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
393 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
394 | grp->bb_free); | ||
379 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 395 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
380 | return; | 396 | return; |
381 | } | 397 | } |
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c index 3f5c188953a4..0b7e28e7eaa4 100644 --- a/fs/ext4/extents_status.c +++ b/fs/ext4/extents_status.c | |||
@@ -966,10 +966,10 @@ retry: | |||
966 | continue; | 966 | continue; |
967 | } | 967 | } |
968 | 968 | ||
969 | if (ei->i_es_lru_nr == 0 || ei == locked_ei) | 969 | if (ei->i_es_lru_nr == 0 || ei == locked_ei || |
970 | !write_trylock(&ei->i_es_lock)) | ||
970 | continue; | 971 | continue; |
971 | 972 | ||
972 | write_lock(&ei->i_es_lock); | ||
973 | shrunk = __es_try_to_reclaim_extents(ei, nr_to_scan); | 973 | shrunk = __es_try_to_reclaim_extents(ei, nr_to_scan); |
974 | if (ei->i_es_lru_nr == 0) | 974 | if (ei->i_es_lru_nr == 0) |
975 | list_del_init(&ei->i_es_lru); | 975 | list_del_init(&ei->i_es_lru); |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 0ee59a6644e2..5b87fc36aab8 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -71,6 +71,7 @@ static unsigned ext4_init_inode_bitmap(struct super_block *sb, | |||
71 | struct ext4_group_desc *gdp) | 71 | struct ext4_group_desc *gdp) |
72 | { | 72 | { |
73 | struct ext4_group_info *grp; | 73 | struct ext4_group_info *grp; |
74 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
74 | J_ASSERT_BH(bh, buffer_locked(bh)); | 75 | J_ASSERT_BH(bh, buffer_locked(bh)); |
75 | 76 | ||
76 | /* If checksum is bad mark all blocks and inodes use to prevent | 77 | /* If checksum is bad mark all blocks and inodes use to prevent |
@@ -78,7 +79,16 @@ static unsigned ext4_init_inode_bitmap(struct super_block *sb, | |||
78 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { | 79 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { |
79 | ext4_error(sb, "Checksum bad for group %u", block_group); | 80 | ext4_error(sb, "Checksum bad for group %u", block_group); |
80 | grp = ext4_get_group_info(sb, block_group); | 81 | grp = ext4_get_group_info(sb, block_group); |
82 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
83 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
84 | grp->bb_free); | ||
81 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 85 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
86 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
87 | int count; | ||
88 | count = ext4_free_inodes_count(sb, gdp); | ||
89 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
90 | count); | ||
91 | } | ||
82 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 92 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
83 | return 0; | 93 | return 0; |
84 | } | 94 | } |
@@ -116,6 +126,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) | |||
116 | struct buffer_head *bh = NULL; | 126 | struct buffer_head *bh = NULL; |
117 | ext4_fsblk_t bitmap_blk; | 127 | ext4_fsblk_t bitmap_blk; |
118 | struct ext4_group_info *grp; | 128 | struct ext4_group_info *grp; |
129 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
119 | 130 | ||
120 | desc = ext4_get_group_desc(sb, block_group, NULL); | 131 | desc = ext4_get_group_desc(sb, block_group, NULL); |
121 | if (!desc) | 132 | if (!desc) |
@@ -185,6 +196,12 @@ verify: | |||
185 | ext4_error(sb, "Corrupt inode bitmap - block_group = %u, " | 196 | ext4_error(sb, "Corrupt inode bitmap - block_group = %u, " |
186 | "inode_bitmap = %llu", block_group, bitmap_blk); | 197 | "inode_bitmap = %llu", block_group, bitmap_blk); |
187 | grp = ext4_get_group_info(sb, block_group); | 198 | grp = ext4_get_group_info(sb, block_group); |
199 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
200 | int count; | ||
201 | count = ext4_free_inodes_count(sb, desc); | ||
202 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
203 | count); | ||
204 | } | ||
188 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 205 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
189 | return NULL; | 206 | return NULL; |
190 | } | 207 | } |
@@ -321,6 +338,12 @@ out: | |||
321 | fatal = err; | 338 | fatal = err; |
322 | } else { | 339 | } else { |
323 | ext4_error(sb, "bit already cleared for inode %lu", ino); | 340 | ext4_error(sb, "bit already cleared for inode %lu", ino); |
341 | if (gdp && !EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
342 | int count; | ||
343 | count = ext4_free_inodes_count(sb, gdp); | ||
344 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
345 | count); | ||
346 | } | ||
324 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 347 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
325 | } | 348 | } |
326 | 349 | ||
@@ -851,6 +874,13 @@ got: | |||
851 | goto out; | 874 | goto out; |
852 | } | 875 | } |
853 | 876 | ||
877 | BUFFER_TRACE(group_desc_bh, "get_write_access"); | ||
878 | err = ext4_journal_get_write_access(handle, group_desc_bh); | ||
879 | if (err) { | ||
880 | ext4_std_error(sb, err); | ||
881 | goto out; | ||
882 | } | ||
883 | |||
854 | /* We may have to initialize the block bitmap if it isn't already */ | 884 | /* We may have to initialize the block bitmap if it isn't already */ |
855 | if (ext4_has_group_desc_csum(sb) && | 885 | if (ext4_has_group_desc_csum(sb) && |
856 | gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { | 886 | gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { |
@@ -887,13 +917,6 @@ got: | |||
887 | } | 917 | } |
888 | } | 918 | } |
889 | 919 | ||
890 | BUFFER_TRACE(group_desc_bh, "get_write_access"); | ||
891 | err = ext4_journal_get_write_access(handle, group_desc_bh); | ||
892 | if (err) { | ||
893 | ext4_std_error(sb, err); | ||
894 | goto out; | ||
895 | } | ||
896 | |||
897 | /* Update the relevant bg descriptor fields */ | 920 | /* Update the relevant bg descriptor fields */ |
898 | if (ext4_has_group_desc_csum(sb)) { | 921 | if (ext4_has_group_desc_csum(sb)) { |
899 | int free; | 922 | int free; |
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index 8a57e9fcd1b9..fd69da194826 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c | |||
@@ -389,7 +389,13 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode, | |||
389 | return 0; | 389 | return 0; |
390 | failed: | 390 | failed: |
391 | for (; i >= 0; i--) { | 391 | for (; i >= 0; i--) { |
392 | if (i != indirect_blks && branch[i].bh) | 392 | /* |
393 | * We want to ext4_forget() only freshly allocated indirect | ||
394 | * blocks. Buffer for new_blocks[i-1] is at branch[i].bh and | ||
395 | * buffer at branch[0].bh is indirect block / inode already | ||
396 | * existing before ext4_alloc_branch() was called. | ||
397 | */ | ||
398 | if (i > 0 && i != indirect_blks && branch[i].bh) | ||
393 | ext4_forget(handle, 1, inode, branch[i].bh, | 399 | ext4_forget(handle, 1, inode, branch[i].bh, |
394 | branch[i].bh->b_blocknr); | 400 | branch[i].bh->b_blocknr); |
395 | ext4_free_blocks(handle, inode, NULL, new_blocks[i], | 401 | ext4_free_blocks(handle, inode, NULL, new_blocks[i], |
@@ -1310,16 +1316,24 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode, | |||
1310 | blk = *i_data; | 1316 | blk = *i_data; |
1311 | if (level > 0) { | 1317 | if (level > 0) { |
1312 | ext4_lblk_t first2; | 1318 | ext4_lblk_t first2; |
1319 | ext4_lblk_t count2; | ||
1320 | |||
1313 | bh = sb_bread(inode->i_sb, le32_to_cpu(blk)); | 1321 | bh = sb_bread(inode->i_sb, le32_to_cpu(blk)); |
1314 | if (!bh) { | 1322 | if (!bh) { |
1315 | EXT4_ERROR_INODE_BLOCK(inode, le32_to_cpu(blk), | 1323 | EXT4_ERROR_INODE_BLOCK(inode, le32_to_cpu(blk), |
1316 | "Read failure"); | 1324 | "Read failure"); |
1317 | return -EIO; | 1325 | return -EIO; |
1318 | } | 1326 | } |
1319 | first2 = (first > offset) ? first - offset : 0; | 1327 | if (first > offset) { |
1328 | first2 = first - offset; | ||
1329 | count2 = count; | ||
1330 | } else { | ||
1331 | first2 = 0; | ||
1332 | count2 = count - (offset - first); | ||
1333 | } | ||
1320 | ret = free_hole_blocks(handle, inode, bh, | 1334 | ret = free_hole_blocks(handle, inode, bh, |
1321 | (__le32 *)bh->b_data, level - 1, | 1335 | (__le32 *)bh->b_data, level - 1, |
1322 | first2, count - offset, | 1336 | first2, count2, |
1323 | inode->i_sb->s_blocksize >> 2); | 1337 | inode->i_sb->s_blocksize >> 2); |
1324 | if (ret) { | 1338 | if (ret) { |
1325 | brelse(bh); | 1339 | brelse(bh); |
@@ -1329,8 +1343,8 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode, | |||
1329 | if (level == 0 || | 1343 | if (level == 0 || |
1330 | (bh && all_zeroes((__le32 *)bh->b_data, | 1344 | (bh && all_zeroes((__le32 *)bh->b_data, |
1331 | (__le32 *)bh->b_data + addr_per_block))) { | 1345 | (__le32 *)bh->b_data + addr_per_block))) { |
1332 | ext4_free_data(handle, inode, parent_bh, &blk, &blk+1); | 1346 | ext4_free_data(handle, inode, parent_bh, |
1333 | *i_data = 0; | 1347 | i_data, i_data + 1); |
1334 | } | 1348 | } |
1335 | brelse(bh); | 1349 | brelse(bh); |
1336 | bh = NULL; | 1350 | bh = NULL; |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 59e31622cc6e..2dcb936be90e 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -722,6 +722,7 @@ void ext4_mb_generate_buddy(struct super_block *sb, | |||
722 | void *buddy, void *bitmap, ext4_group_t group) | 722 | void *buddy, void *bitmap, ext4_group_t group) |
723 | { | 723 | { |
724 | struct ext4_group_info *grp = ext4_get_group_info(sb, group); | 724 | struct ext4_group_info *grp = ext4_get_group_info(sb, group); |
725 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
725 | ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb); | 726 | ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb); |
726 | ext4_grpblk_t i = 0; | 727 | ext4_grpblk_t i = 0; |
727 | ext4_grpblk_t first; | 728 | ext4_grpblk_t first; |
@@ -751,14 +752,17 @@ void ext4_mb_generate_buddy(struct super_block *sb, | |||
751 | 752 | ||
752 | if (free != grp->bb_free) { | 753 | if (free != grp->bb_free) { |
753 | ext4_grp_locked_error(sb, group, 0, 0, | 754 | ext4_grp_locked_error(sb, group, 0, 0, |
754 | "%u clusters in bitmap, %u in gd; " | 755 | "block bitmap and bg descriptor " |
755 | "block bitmap corrupt.", | 756 | "inconsistent: %u vs %u free clusters", |
756 | free, grp->bb_free); | 757 | free, grp->bb_free); |
757 | /* | 758 | /* |
758 | * If we intend to continue, we consider group descriptor | 759 | * If we intend to continue, we consider group descriptor |
759 | * corrupt and update bb_free using bitmap value | 760 | * corrupt and update bb_free using bitmap value |
760 | */ | 761 | */ |
761 | grp->bb_free = free; | 762 | grp->bb_free = free; |
763 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
764 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
765 | grp->bb_free); | ||
762 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 766 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
763 | } | 767 | } |
764 | mb_set_largest_free_order(sb, grp); | 768 | mb_set_largest_free_order(sb, grp); |
@@ -1431,6 +1435,7 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, | |||
1431 | right_is_free = !mb_test_bit(last + 1, e4b->bd_bitmap); | 1435 | right_is_free = !mb_test_bit(last + 1, e4b->bd_bitmap); |
1432 | 1436 | ||
1433 | if (unlikely(block != -1)) { | 1437 | if (unlikely(block != -1)) { |
1438 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
1434 | ext4_fsblk_t blocknr; | 1439 | ext4_fsblk_t blocknr; |
1435 | 1440 | ||
1436 | blocknr = ext4_group_first_block_no(sb, e4b->bd_group); | 1441 | blocknr = ext4_group_first_block_no(sb, e4b->bd_group); |
@@ -1441,6 +1446,9 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, | |||
1441 | "freeing already freed block " | 1446 | "freeing already freed block " |
1442 | "(bit %u); block bitmap corrupt.", | 1447 | "(bit %u); block bitmap corrupt.", |
1443 | block); | 1448 | block); |
1449 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info)) | ||
1450 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
1451 | e4b->bd_info->bb_free); | ||
1444 | /* Mark the block group as corrupt. */ | 1452 | /* Mark the block group as corrupt. */ |
1445 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, | 1453 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, |
1446 | &e4b->bd_info->bb_state); | 1454 | &e4b->bd_info->bb_state); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index b9b9aabfb4d2..6df7bc611dbd 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1525,8 +1525,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, | |||
1525 | arg = JBD2_DEFAULT_MAX_COMMIT_AGE; | 1525 | arg = JBD2_DEFAULT_MAX_COMMIT_AGE; |
1526 | sbi->s_commit_interval = HZ * arg; | 1526 | sbi->s_commit_interval = HZ * arg; |
1527 | } else if (token == Opt_max_batch_time) { | 1527 | } else if (token == Opt_max_batch_time) { |
1528 | if (arg == 0) | ||
1529 | arg = EXT4_DEF_MAX_BATCH_TIME; | ||
1530 | sbi->s_max_batch_time = arg; | 1528 | sbi->s_max_batch_time = arg; |
1531 | } else if (token == Opt_min_batch_time) { | 1529 | } else if (token == Opt_min_batch_time) { |
1532 | sbi->s_min_batch_time = arg; | 1530 | sbi->s_min_batch_time = arg; |
@@ -2809,10 +2807,11 @@ static void print_daily_error_info(unsigned long arg) | |||
2809 | es = sbi->s_es; | 2807 | es = sbi->s_es; |
2810 | 2808 | ||
2811 | if (es->s_error_count) | 2809 | if (es->s_error_count) |
2812 | ext4_msg(sb, KERN_NOTICE, "error count: %u", | 2810 | /* fsck newer than v1.41.13 is needed to clean this condition. */ |
2811 | ext4_msg(sb, KERN_NOTICE, "error count since last fsck: %u", | ||
2813 | le32_to_cpu(es->s_error_count)); | 2812 | le32_to_cpu(es->s_error_count)); |
2814 | if (es->s_first_error_time) { | 2813 | if (es->s_first_error_time) { |
2815 | printk(KERN_NOTICE "EXT4-fs (%s): initial error at %u: %.*s:%d", | 2814 | printk(KERN_NOTICE "EXT4-fs (%s): initial error at time %u: %.*s:%d", |
2816 | sb->s_id, le32_to_cpu(es->s_first_error_time), | 2815 | sb->s_id, le32_to_cpu(es->s_first_error_time), |
2817 | (int) sizeof(es->s_first_error_func), | 2816 | (int) sizeof(es->s_first_error_func), |
2818 | es->s_first_error_func, | 2817 | es->s_first_error_func, |
@@ -2826,7 +2825,7 @@ static void print_daily_error_info(unsigned long arg) | |||
2826 | printk("\n"); | 2825 | printk("\n"); |
2827 | } | 2826 | } |
2828 | if (es->s_last_error_time) { | 2827 | if (es->s_last_error_time) { |
2829 | printk(KERN_NOTICE "EXT4-fs (%s): last error at %u: %.*s:%d", | 2828 | printk(KERN_NOTICE "EXT4-fs (%s): last error at time %u: %.*s:%d", |
2830 | sb->s_id, le32_to_cpu(es->s_last_error_time), | 2829 | sb->s_id, le32_to_cpu(es->s_last_error_time), |
2831 | (int) sizeof(es->s_last_error_func), | 2830 | (int) sizeof(es->s_last_error_func), |
2832 | es->s_last_error_func, | 2831 | es->s_last_error_func, |
@@ -3880,38 +3879,19 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3880 | goto failed_mount2; | 3879 | goto failed_mount2; |
3881 | } | 3880 | } |
3882 | } | 3881 | } |
3883 | |||
3884 | /* | ||
3885 | * set up enough so that it can read an inode, | ||
3886 | * and create new inode for buddy allocator | ||
3887 | */ | ||
3888 | sbi->s_gdb_count = db_count; | ||
3889 | if (!test_opt(sb, NOLOAD) && | ||
3890 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) | ||
3891 | sb->s_op = &ext4_sops; | ||
3892 | else | ||
3893 | sb->s_op = &ext4_nojournal_sops; | ||
3894 | |||
3895 | ext4_ext_init(sb); | ||
3896 | err = ext4_mb_init(sb); | ||
3897 | if (err) { | ||
3898 | ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)", | ||
3899 | err); | ||
3900 | goto failed_mount2; | ||
3901 | } | ||
3902 | |||
3903 | if (!ext4_check_descriptors(sb, &first_not_zeroed)) { | 3882 | if (!ext4_check_descriptors(sb, &first_not_zeroed)) { |
3904 | ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); | 3883 | ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); |
3905 | goto failed_mount2a; | 3884 | goto failed_mount2; |
3906 | } | 3885 | } |
3907 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) | 3886 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) |
3908 | if (!ext4_fill_flex_info(sb)) { | 3887 | if (!ext4_fill_flex_info(sb)) { |
3909 | ext4_msg(sb, KERN_ERR, | 3888 | ext4_msg(sb, KERN_ERR, |
3910 | "unable to initialize " | 3889 | "unable to initialize " |
3911 | "flex_bg meta info!"); | 3890 | "flex_bg meta info!"); |
3912 | goto failed_mount2a; | 3891 | goto failed_mount2; |
3913 | } | 3892 | } |
3914 | 3893 | ||
3894 | sbi->s_gdb_count = db_count; | ||
3915 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); | 3895 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); |
3916 | spin_lock_init(&sbi->s_next_gen_lock); | 3896 | spin_lock_init(&sbi->s_next_gen_lock); |
3917 | 3897 | ||
@@ -3946,6 +3926,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3946 | sbi->s_stripe = ext4_get_stripe_size(sbi); | 3926 | sbi->s_stripe = ext4_get_stripe_size(sbi); |
3947 | sbi->s_extent_max_zeroout_kb = 32; | 3927 | sbi->s_extent_max_zeroout_kb = 32; |
3948 | 3928 | ||
3929 | /* | ||
3930 | * set up enough so that it can read an inode | ||
3931 | */ | ||
3932 | if (!test_opt(sb, NOLOAD) && | ||
3933 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) | ||
3934 | sb->s_op = &ext4_sops; | ||
3935 | else | ||
3936 | sb->s_op = &ext4_nojournal_sops; | ||
3949 | sb->s_export_op = &ext4_export_ops; | 3937 | sb->s_export_op = &ext4_export_ops; |
3950 | sb->s_xattr = ext4_xattr_handlers; | 3938 | sb->s_xattr = ext4_xattr_handlers; |
3951 | #ifdef CONFIG_QUOTA | 3939 | #ifdef CONFIG_QUOTA |
@@ -4135,13 +4123,21 @@ no_journal: | |||
4135 | if (err) { | 4123 | if (err) { |
4136 | ext4_msg(sb, KERN_ERR, "failed to reserve %llu clusters for " | 4124 | ext4_msg(sb, KERN_ERR, "failed to reserve %llu clusters for " |
4137 | "reserved pool", ext4_calculate_resv_clusters(sb)); | 4125 | "reserved pool", ext4_calculate_resv_clusters(sb)); |
4138 | goto failed_mount5; | 4126 | goto failed_mount4a; |
4139 | } | 4127 | } |
4140 | 4128 | ||
4141 | err = ext4_setup_system_zone(sb); | 4129 | err = ext4_setup_system_zone(sb); |
4142 | if (err) { | 4130 | if (err) { |
4143 | ext4_msg(sb, KERN_ERR, "failed to initialize system " | 4131 | ext4_msg(sb, KERN_ERR, "failed to initialize system " |
4144 | "zone (%d)", err); | 4132 | "zone (%d)", err); |
4133 | goto failed_mount4a; | ||
4134 | } | ||
4135 | |||
4136 | ext4_ext_init(sb); | ||
4137 | err = ext4_mb_init(sb); | ||
4138 | if (err) { | ||
4139 | ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)", | ||
4140 | err); | ||
4145 | goto failed_mount5; | 4141 | goto failed_mount5; |
4146 | } | 4142 | } |
4147 | 4143 | ||
@@ -4218,8 +4214,11 @@ failed_mount8: | |||
4218 | failed_mount7: | 4214 | failed_mount7: |
4219 | ext4_unregister_li_request(sb); | 4215 | ext4_unregister_li_request(sb); |
4220 | failed_mount6: | 4216 | failed_mount6: |
4221 | ext4_release_system_zone(sb); | 4217 | ext4_mb_release(sb); |
4222 | failed_mount5: | 4218 | failed_mount5: |
4219 | ext4_ext_release(sb); | ||
4220 | ext4_release_system_zone(sb); | ||
4221 | failed_mount4a: | ||
4223 | dput(sb->s_root); | 4222 | dput(sb->s_root); |
4224 | sb->s_root = NULL; | 4223 | sb->s_root = NULL; |
4225 | failed_mount4: | 4224 | failed_mount4: |
@@ -4243,14 +4242,11 @@ failed_mount3: | |||
4243 | percpu_counter_destroy(&sbi->s_extent_cache_cnt); | 4242 | percpu_counter_destroy(&sbi->s_extent_cache_cnt); |
4244 | if (sbi->s_mmp_tsk) | 4243 | if (sbi->s_mmp_tsk) |
4245 | kthread_stop(sbi->s_mmp_tsk); | 4244 | kthread_stop(sbi->s_mmp_tsk); |
4246 | failed_mount2a: | ||
4247 | ext4_mb_release(sb); | ||
4248 | failed_mount2: | 4245 | failed_mount2: |
4249 | for (i = 0; i < db_count; i++) | 4246 | for (i = 0; i < db_count; i++) |
4250 | brelse(sbi->s_group_desc[i]); | 4247 | brelse(sbi->s_group_desc[i]); |
4251 | ext4_kvfree(sbi->s_group_desc); | 4248 | ext4_kvfree(sbi->s_group_desc); |
4252 | failed_mount: | 4249 | failed_mount: |
4253 | ext4_ext_release(sb); | ||
4254 | if (sbi->s_chksum_driver) | 4250 | if (sbi->s_chksum_driver) |
4255 | crypto_free_shash(sbi->s_chksum_driver); | 4251 | crypto_free_shash(sbi->s_chksum_driver); |
4256 | if (sbi->s_proc) { | 4252 | if (sbi->s_proc) { |
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 0924521306b4..f8cf619edb5f 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -608,8 +608,8 @@ static int __allocate_data_block(struct dnode_of_data *dn) | |||
608 | * b. do not use extent cache for better performance | 608 | * b. do not use extent cache for better performance |
609 | * c. give the block addresses to blockdev | 609 | * c. give the block addresses to blockdev |
610 | */ | 610 | */ |
611 | static int get_data_block(struct inode *inode, sector_t iblock, | 611 | static int __get_data_block(struct inode *inode, sector_t iblock, |
612 | struct buffer_head *bh_result, int create) | 612 | struct buffer_head *bh_result, int create, bool fiemap) |
613 | { | 613 | { |
614 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 614 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
615 | unsigned int blkbits = inode->i_sb->s_blocksize_bits; | 615 | unsigned int blkbits = inode->i_sb->s_blocksize_bits; |
@@ -637,7 +637,7 @@ static int get_data_block(struct inode *inode, sector_t iblock, | |||
637 | err = 0; | 637 | err = 0; |
638 | goto unlock_out; | 638 | goto unlock_out; |
639 | } | 639 | } |
640 | if (dn.data_blkaddr == NEW_ADDR) | 640 | if (dn.data_blkaddr == NEW_ADDR && !fiemap) |
641 | goto put_out; | 641 | goto put_out; |
642 | 642 | ||
643 | if (dn.data_blkaddr != NULL_ADDR) { | 643 | if (dn.data_blkaddr != NULL_ADDR) { |
@@ -671,7 +671,7 @@ get_next: | |||
671 | err = 0; | 671 | err = 0; |
672 | goto unlock_out; | 672 | goto unlock_out; |
673 | } | 673 | } |
674 | if (dn.data_blkaddr == NEW_ADDR) | 674 | if (dn.data_blkaddr == NEW_ADDR && !fiemap) |
675 | goto put_out; | 675 | goto put_out; |
676 | 676 | ||
677 | end_offset = ADDRS_PER_PAGE(dn.node_page, F2FS_I(inode)); | 677 | end_offset = ADDRS_PER_PAGE(dn.node_page, F2FS_I(inode)); |
@@ -708,10 +708,23 @@ out: | |||
708 | return err; | 708 | return err; |
709 | } | 709 | } |
710 | 710 | ||
711 | static int get_data_block(struct inode *inode, sector_t iblock, | ||
712 | struct buffer_head *bh_result, int create) | ||
713 | { | ||
714 | return __get_data_block(inode, iblock, bh_result, create, false); | ||
715 | } | ||
716 | |||
717 | static int get_data_block_fiemap(struct inode *inode, sector_t iblock, | ||
718 | struct buffer_head *bh_result, int create) | ||
719 | { | ||
720 | return __get_data_block(inode, iblock, bh_result, create, true); | ||
721 | } | ||
722 | |||
711 | int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | 723 | int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
712 | u64 start, u64 len) | 724 | u64 start, u64 len) |
713 | { | 725 | { |
714 | return generic_block_fiemap(inode, fieinfo, start, len, get_data_block); | 726 | return generic_block_fiemap(inode, fieinfo, |
727 | start, len, get_data_block_fiemap); | ||
715 | } | 728 | } |
716 | 729 | ||
717 | static int f2fs_read_data_page(struct file *file, struct page *page) | 730 | static int f2fs_read_data_page(struct file *file, struct page *page) |
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 966acb039e3b..a4addd72ebbd 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c | |||
@@ -376,11 +376,11 @@ static struct page *init_inode_metadata(struct inode *inode, | |||
376 | 376 | ||
377 | put_error: | 377 | put_error: |
378 | f2fs_put_page(page, 1); | 378 | f2fs_put_page(page, 1); |
379 | error: | ||
379 | /* once the failed inode becomes a bad inode, i_mode is S_IFREG */ | 380 | /* once the failed inode becomes a bad inode, i_mode is S_IFREG */ |
380 | truncate_inode_pages(&inode->i_data, 0); | 381 | truncate_inode_pages(&inode->i_data, 0); |
381 | truncate_blocks(inode, 0); | 382 | truncate_blocks(inode, 0); |
382 | remove_dirty_dir_inode(inode); | 383 | remove_dirty_dir_inode(inode); |
383 | error: | ||
384 | remove_inode_page(inode); | 384 | remove_inode_page(inode); |
385 | return ERR_PTR(err); | 385 | return ERR_PTR(err); |
386 | } | 386 | } |
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e51c732b0dd9..58df97e174d0 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -342,9 +342,6 @@ struct f2fs_sm_info { | |||
342 | struct dirty_seglist_info *dirty_info; /* dirty segment information */ | 342 | struct dirty_seglist_info *dirty_info; /* dirty segment information */ |
343 | struct curseg_info *curseg_array; /* active segment information */ | 343 | struct curseg_info *curseg_array; /* active segment information */ |
344 | 344 | ||
345 | struct list_head wblist_head; /* list of under-writeback pages */ | ||
346 | spinlock_t wblist_lock; /* lock for checkpoint */ | ||
347 | |||
348 | block_t seg0_blkaddr; /* block address of 0'th segment */ | 345 | block_t seg0_blkaddr; /* block address of 0'th segment */ |
349 | block_t main_blkaddr; /* start block address of main area */ | 346 | block_t main_blkaddr; /* start block address of main area */ |
350 | block_t ssa_blkaddr; /* start block address of SSA area */ | 347 | block_t ssa_blkaddr; /* start block address of SSA area */ |
@@ -644,7 +641,8 @@ static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi) | |||
644 | */ | 641 | */ |
645 | static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid) | 642 | static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid) |
646 | { | 643 | { |
647 | WARN_ON((nid >= NM_I(sbi)->max_nid)); | 644 | if (unlikely(nid < F2FS_ROOT_INO(sbi))) |
645 | return -EINVAL; | ||
648 | if (unlikely(nid >= NM_I(sbi)->max_nid)) | 646 | if (unlikely(nid >= NM_I(sbi)->max_nid)) |
649 | return -EINVAL; | 647 | return -EINVAL; |
650 | return 0; | 648 | return 0; |
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index c58e33075719..7d8b96275092 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -659,16 +659,19 @@ static int expand_inode_data(struct inode *inode, loff_t offset, | |||
659 | off_start = offset & (PAGE_CACHE_SIZE - 1); | 659 | off_start = offset & (PAGE_CACHE_SIZE - 1); |
660 | off_end = (offset + len) & (PAGE_CACHE_SIZE - 1); | 660 | off_end = (offset + len) & (PAGE_CACHE_SIZE - 1); |
661 | 661 | ||
662 | f2fs_lock_op(sbi); | ||
663 | |||
662 | for (index = pg_start; index <= pg_end; index++) { | 664 | for (index = pg_start; index <= pg_end; index++) { |
663 | struct dnode_of_data dn; | 665 | struct dnode_of_data dn; |
664 | 666 | ||
665 | f2fs_lock_op(sbi); | 667 | if (index == pg_end && !off_end) |
668 | goto noalloc; | ||
669 | |||
666 | set_new_dnode(&dn, inode, NULL, NULL, 0); | 670 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
667 | ret = f2fs_reserve_block(&dn, index); | 671 | ret = f2fs_reserve_block(&dn, index); |
668 | f2fs_unlock_op(sbi); | ||
669 | if (ret) | 672 | if (ret) |
670 | break; | 673 | break; |
671 | 674 | noalloc: | |
672 | if (pg_start == pg_end) | 675 | if (pg_start == pg_end) |
673 | new_size = offset + len; | 676 | new_size = offset + len; |
674 | else if (index == pg_start && off_start) | 677 | else if (index == pg_start && off_start) |
@@ -683,8 +686,9 @@ static int expand_inode_data(struct inode *inode, loff_t offset, | |||
683 | i_size_read(inode) < new_size) { | 686 | i_size_read(inode) < new_size) { |
684 | i_size_write(inode, new_size); | 687 | i_size_write(inode, new_size); |
685 | mark_inode_dirty(inode); | 688 | mark_inode_dirty(inode); |
686 | f2fs_write_inode(inode, NULL); | 689 | update_inode_page(inode); |
687 | } | 690 | } |
691 | f2fs_unlock_op(sbi); | ||
688 | 692 | ||
689 | return ret; | 693 | return ret; |
690 | } | 694 | } |
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index adc622c6bdce..2cf6962f6cc8 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c | |||
@@ -78,6 +78,7 @@ static int do_read_inode(struct inode *inode) | |||
78 | if (check_nid_range(sbi, inode->i_ino)) { | 78 | if (check_nid_range(sbi, inode->i_ino)) { |
79 | f2fs_msg(inode->i_sb, KERN_ERR, "bad inode number: %lu", | 79 | f2fs_msg(inode->i_sb, KERN_ERR, "bad inode number: %lu", |
80 | (unsigned long) inode->i_ino); | 80 | (unsigned long) inode->i_ino); |
81 | WARN_ON(1); | ||
81 | return -EINVAL; | 82 | return -EINVAL; |
82 | } | 83 | } |
83 | 84 | ||
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 9138c32aa698..a6bdddc33ce2 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c | |||
@@ -417,9 +417,6 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
417 | } | 417 | } |
418 | 418 | ||
419 | f2fs_set_link(new_dir, new_entry, new_page, old_inode); | 419 | f2fs_set_link(new_dir, new_entry, new_page, old_inode); |
420 | down_write(&F2FS_I(old_inode)->i_sem); | ||
421 | F2FS_I(old_inode)->i_pino = new_dir->i_ino; | ||
422 | up_write(&F2FS_I(old_inode)->i_sem); | ||
423 | 420 | ||
424 | new_inode->i_ctime = CURRENT_TIME; | 421 | new_inode->i_ctime = CURRENT_TIME; |
425 | down_write(&F2FS_I(new_inode)->i_sem); | 422 | down_write(&F2FS_I(new_inode)->i_sem); |
@@ -448,6 +445,10 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
448 | } | 445 | } |
449 | } | 446 | } |
450 | 447 | ||
448 | down_write(&F2FS_I(old_inode)->i_sem); | ||
449 | file_lost_pino(old_inode); | ||
450 | up_write(&F2FS_I(old_inode)->i_sem); | ||
451 | |||
451 | old_inode->i_ctime = CURRENT_TIME; | 452 | old_inode->i_ctime = CURRENT_TIME; |
452 | mark_inode_dirty(old_inode); | 453 | mark_inode_dirty(old_inode); |
453 | 454 | ||
@@ -457,9 +458,6 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
457 | if (old_dir != new_dir) { | 458 | if (old_dir != new_dir) { |
458 | f2fs_set_link(old_inode, old_dir_entry, | 459 | f2fs_set_link(old_inode, old_dir_entry, |
459 | old_dir_page, new_dir); | 460 | old_dir_page, new_dir); |
460 | down_write(&F2FS_I(old_inode)->i_sem); | ||
461 | F2FS_I(old_inode)->i_pino = new_dir->i_ino; | ||
462 | up_write(&F2FS_I(old_inode)->i_sem); | ||
463 | update_inode_page(old_inode); | 461 | update_inode_page(old_inode); |
464 | } else { | 462 | } else { |
465 | kunmap(old_dir_page); | 463 | kunmap(old_dir_page); |
@@ -474,7 +472,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
474 | return 0; | 472 | return 0; |
475 | 473 | ||
476 | put_out_dir: | 474 | put_out_dir: |
477 | f2fs_put_page(new_page, 1); | 475 | kunmap(new_page); |
476 | f2fs_put_page(new_page, 0); | ||
478 | out_dir: | 477 | out_dir: |
479 | if (old_dir_entry) { | 478 | if (old_dir_entry) { |
480 | kunmap(old_dir_page); | 479 | kunmap(old_dir_page); |
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 9dfb9a042fd2..4b697ccc9b0c 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
@@ -42,6 +42,8 @@ bool available_free_memory(struct f2fs_sb_info *sbi, int type) | |||
42 | mem_size = (nm_i->nat_cnt * sizeof(struct nat_entry)) >> 12; | 42 | mem_size = (nm_i->nat_cnt * sizeof(struct nat_entry)) >> 12; |
43 | res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 2); | 43 | res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 2); |
44 | } else if (type == DIRTY_DENTS) { | 44 | } else if (type == DIRTY_DENTS) { |
45 | if (sbi->sb->s_bdi->dirty_exceeded) | ||
46 | return false; | ||
45 | mem_size = get_pages(sbi, F2FS_DIRTY_DENTS); | 47 | mem_size = get_pages(sbi, F2FS_DIRTY_DENTS); |
46 | res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 1); | 48 | res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 1); |
47 | } | 49 | } |
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index f25f0e07e26f..d04613df710a 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -272,14 +272,15 @@ int create_flush_cmd_control(struct f2fs_sb_info *sbi) | |||
272 | return -ENOMEM; | 272 | return -ENOMEM; |
273 | spin_lock_init(&fcc->issue_lock); | 273 | spin_lock_init(&fcc->issue_lock); |
274 | init_waitqueue_head(&fcc->flush_wait_queue); | 274 | init_waitqueue_head(&fcc->flush_wait_queue); |
275 | sbi->sm_info->cmd_control_info = fcc; | ||
275 | fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi, | 276 | fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi, |
276 | "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev)); | 277 | "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev)); |
277 | if (IS_ERR(fcc->f2fs_issue_flush)) { | 278 | if (IS_ERR(fcc->f2fs_issue_flush)) { |
278 | err = PTR_ERR(fcc->f2fs_issue_flush); | 279 | err = PTR_ERR(fcc->f2fs_issue_flush); |
279 | kfree(fcc); | 280 | kfree(fcc); |
281 | sbi->sm_info->cmd_control_info = NULL; | ||
280 | return err; | 282 | return err; |
281 | } | 283 | } |
282 | sbi->sm_info->cmd_control_info = fcc; | ||
283 | 284 | ||
284 | return err; | 285 | return err; |
285 | } | 286 | } |
@@ -1885,8 +1886,6 @@ int build_segment_manager(struct f2fs_sb_info *sbi) | |||
1885 | 1886 | ||
1886 | /* init sm info */ | 1887 | /* init sm info */ |
1887 | sbi->sm_info = sm_info; | 1888 | sbi->sm_info = sm_info; |
1888 | INIT_LIST_HEAD(&sm_info->wblist_head); | ||
1889 | spin_lock_init(&sm_info->wblist_lock); | ||
1890 | sm_info->seg0_blkaddr = le32_to_cpu(raw_super->segment0_blkaddr); | 1889 | sm_info->seg0_blkaddr = le32_to_cpu(raw_super->segment0_blkaddr); |
1891 | sm_info->main_blkaddr = le32_to_cpu(raw_super->main_blkaddr); | 1890 | sm_info->main_blkaddr = le32_to_cpu(raw_super->main_blkaddr); |
1892 | sm_info->segment_count = le32_to_cpu(raw_super->segment_count); | 1891 | sm_info->segment_count = le32_to_cpu(raw_super->segment_count); |
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index b2b18637cb9e..8f96d9372ade 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c | |||
@@ -689,9 +689,7 @@ static struct inode *f2fs_nfs_get_inode(struct super_block *sb, | |||
689 | struct f2fs_sb_info *sbi = F2FS_SB(sb); | 689 | struct f2fs_sb_info *sbi = F2FS_SB(sb); |
690 | struct inode *inode; | 690 | struct inode *inode; |
691 | 691 | ||
692 | if (unlikely(ino < F2FS_ROOT_INO(sbi))) | 692 | if (check_nid_range(sbi, ino)) |
693 | return ERR_PTR(-ESTALE); | ||
694 | if (unlikely(ino >= NM_I(sbi)->max_nid)) | ||
695 | return ERR_PTR(-ESTALE); | 693 | return ERR_PTR(-ESTALE); |
696 | 694 | ||
697 | /* | 695 | /* |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 38cfcf5f6fce..6f0f590cc5a3 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -1588,9 +1588,12 @@ int jbd2_journal_stop(handle_t *handle) | |||
1588 | * to perform a synchronous write. We do this to detect the | 1588 | * to perform a synchronous write. We do this to detect the |
1589 | * case where a single process is doing a stream of sync | 1589 | * case where a single process is doing a stream of sync |
1590 | * writes. No point in waiting for joiners in that case. | 1590 | * writes. No point in waiting for joiners in that case. |
1591 | * | ||
1592 | * Setting max_batch_time to 0 disables this completely. | ||
1591 | */ | 1593 | */ |
1592 | pid = current->pid; | 1594 | pid = current->pid; |
1593 | if (handle->h_sync && journal->j_last_sync_writer != pid) { | 1595 | if (handle->h_sync && journal->j_last_sync_writer != pid && |
1596 | journal->j_max_batch_time) { | ||
1594 | u64 commit_time, trans_time; | 1597 | u64 commit_time, trans_time; |
1595 | 1598 | ||
1596 | journal->j_last_sync_writer = pid; | 1599 | journal->j_last_sync_writer = pid; |
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index e3d37f607f97..d895b4b7b661 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c | |||
@@ -39,6 +39,19 @@ struct kernfs_open_node { | |||
39 | struct list_head files; /* goes through kernfs_open_file.list */ | 39 | struct list_head files; /* goes through kernfs_open_file.list */ |
40 | }; | 40 | }; |
41 | 41 | ||
42 | /* | ||
43 | * kernfs_notify() may be called from any context and bounces notifications | ||
44 | * through a work item. To minimize space overhead in kernfs_node, the | ||
45 | * pending queue is implemented as a singly linked list of kernfs_nodes. | ||
46 | * The list is terminated with the self pointer so that whether a | ||
47 | * kernfs_node is on the list or not can be determined by testing the next | ||
48 | * pointer for NULL. | ||
49 | */ | ||
50 | #define KERNFS_NOTIFY_EOL ((void *)&kernfs_notify_list) | ||
51 | |||
52 | static DEFINE_SPINLOCK(kernfs_notify_lock); | ||
53 | static struct kernfs_node *kernfs_notify_list = KERNFS_NOTIFY_EOL; | ||
54 | |||
42 | static struct kernfs_open_file *kernfs_of(struct file *file) | 55 | static struct kernfs_open_file *kernfs_of(struct file *file) |
43 | { | 56 | { |
44 | return ((struct seq_file *)file->private_data)->private; | 57 | return ((struct seq_file *)file->private_data)->private; |
@@ -783,24 +796,25 @@ static unsigned int kernfs_fop_poll(struct file *filp, poll_table *wait) | |||
783 | return DEFAULT_POLLMASK|POLLERR|POLLPRI; | 796 | return DEFAULT_POLLMASK|POLLERR|POLLPRI; |
784 | } | 797 | } |
785 | 798 | ||
786 | /** | 799 | static void kernfs_notify_workfn(struct work_struct *work) |
787 | * kernfs_notify - notify a kernfs file | ||
788 | * @kn: file to notify | ||
789 | * | ||
790 | * Notify @kn such that poll(2) on @kn wakes up. | ||
791 | */ | ||
792 | void kernfs_notify(struct kernfs_node *kn) | ||
793 | { | 800 | { |
794 | struct kernfs_root *root = kernfs_root(kn); | 801 | struct kernfs_node *kn; |
795 | struct kernfs_open_node *on; | 802 | struct kernfs_open_node *on; |
796 | struct kernfs_super_info *info; | 803 | struct kernfs_super_info *info; |
797 | unsigned long flags; | 804 | repeat: |
798 | 805 | /* pop one off the notify_list */ | |
799 | if (WARN_ON(kernfs_type(kn) != KERNFS_FILE)) | 806 | spin_lock_irq(&kernfs_notify_lock); |
807 | kn = kernfs_notify_list; | ||
808 | if (kn == KERNFS_NOTIFY_EOL) { | ||
809 | spin_unlock_irq(&kernfs_notify_lock); | ||
800 | return; | 810 | return; |
811 | } | ||
812 | kernfs_notify_list = kn->attr.notify_next; | ||
813 | kn->attr.notify_next = NULL; | ||
814 | spin_unlock_irq(&kernfs_notify_lock); | ||
801 | 815 | ||
802 | /* kick poll */ | 816 | /* kick poll */ |
803 | spin_lock_irqsave(&kernfs_open_node_lock, flags); | 817 | spin_lock_irq(&kernfs_open_node_lock); |
804 | 818 | ||
805 | on = kn->attr.open; | 819 | on = kn->attr.open; |
806 | if (on) { | 820 | if (on) { |
@@ -808,12 +822,12 @@ void kernfs_notify(struct kernfs_node *kn) | |||
808 | wake_up_interruptible(&on->poll); | 822 | wake_up_interruptible(&on->poll); |
809 | } | 823 | } |
810 | 824 | ||
811 | spin_unlock_irqrestore(&kernfs_open_node_lock, flags); | 825 | spin_unlock_irq(&kernfs_open_node_lock); |
812 | 826 | ||
813 | /* kick fsnotify */ | 827 | /* kick fsnotify */ |
814 | mutex_lock(&kernfs_mutex); | 828 | mutex_lock(&kernfs_mutex); |
815 | 829 | ||
816 | list_for_each_entry(info, &root->supers, node) { | 830 | list_for_each_entry(info, &kernfs_root(kn)->supers, node) { |
817 | struct inode *inode; | 831 | struct inode *inode; |
818 | struct dentry *dentry; | 832 | struct dentry *dentry; |
819 | 833 | ||
@@ -833,6 +847,33 @@ void kernfs_notify(struct kernfs_node *kn) | |||
833 | } | 847 | } |
834 | 848 | ||
835 | mutex_unlock(&kernfs_mutex); | 849 | mutex_unlock(&kernfs_mutex); |
850 | kernfs_put(kn); | ||
851 | goto repeat; | ||
852 | } | ||
853 | |||
854 | /** | ||
855 | * kernfs_notify - notify a kernfs file | ||
856 | * @kn: file to notify | ||
857 | * | ||
858 | * Notify @kn such that poll(2) on @kn wakes up. Maybe be called from any | ||
859 | * context. | ||
860 | */ | ||
861 | void kernfs_notify(struct kernfs_node *kn) | ||
862 | { | ||
863 | static DECLARE_WORK(kernfs_notify_work, kernfs_notify_workfn); | ||
864 | unsigned long flags; | ||
865 | |||
866 | if (WARN_ON(kernfs_type(kn) != KERNFS_FILE)) | ||
867 | return; | ||
868 | |||
869 | spin_lock_irqsave(&kernfs_notify_lock, flags); | ||
870 | if (!kn->attr.notify_next) { | ||
871 | kernfs_get(kn); | ||
872 | kn->attr.notify_next = kernfs_notify_list; | ||
873 | kernfs_notify_list = kn; | ||
874 | schedule_work(&kernfs_notify_work); | ||
875 | } | ||
876 | spin_unlock_irqrestore(&kernfs_notify_lock, flags); | ||
836 | } | 877 | } |
837 | EXPORT_SYMBOL_GPL(kernfs_notify); | 878 | EXPORT_SYMBOL_GPL(kernfs_notify); |
838 | 879 | ||
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c index d171b98a6cdd..f973ae9b05f1 100644 --- a/fs/kernfs/mount.c +++ b/fs/kernfs/mount.c | |||
@@ -211,6 +211,36 @@ void kernfs_kill_sb(struct super_block *sb) | |||
211 | kernfs_put(root_kn); | 211 | kernfs_put(root_kn); |
212 | } | 212 | } |
213 | 213 | ||
214 | /** | ||
215 | * kernfs_pin_sb: try to pin the superblock associated with a kernfs_root | ||
216 | * @kernfs_root: the kernfs_root in question | ||
217 | * @ns: the namespace tag | ||
218 | * | ||
219 | * Pin the superblock so the superblock won't be destroyed in subsequent | ||
220 | * operations. This can be used to block ->kill_sb() which may be useful | ||
221 | * for kernfs users which dynamically manage superblocks. | ||
222 | * | ||
223 | * Returns NULL if there's no superblock associated to this kernfs_root, or | ||
224 | * -EINVAL if the superblock is being freed. | ||
225 | */ | ||
226 | struct super_block *kernfs_pin_sb(struct kernfs_root *root, const void *ns) | ||
227 | { | ||
228 | struct kernfs_super_info *info; | ||
229 | struct super_block *sb = NULL; | ||
230 | |||
231 | mutex_lock(&kernfs_mutex); | ||
232 | list_for_each_entry(info, &root->supers, node) { | ||
233 | if (info->ns == ns) { | ||
234 | sb = info->sb; | ||
235 | if (!atomic_inc_not_zero(&info->sb->s_active)) | ||
236 | sb = ERR_PTR(-EINVAL); | ||
237 | break; | ||
238 | } | ||
239 | } | ||
240 | mutex_unlock(&kernfs_mutex); | ||
241 | return sb; | ||
242 | } | ||
243 | |||
214 | void __init kernfs_init(void) | 244 | void __init kernfs_init(void) |
215 | { | 245 | { |
216 | kernfs_node_cache = kmem_cache_create("kernfs_node_cache", | 246 | kernfs_node_cache = kmem_cache_create("kernfs_node_cache", |
diff --git a/fs/locks.c b/fs/locks.c index da57c9b7e844..717fbc404e6b 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -431,7 +431,7 @@ static int lease_init(struct file *filp, long type, struct file_lock *fl) | |||
431 | if (assign_type(fl, type) != 0) | 431 | if (assign_type(fl, type) != 0) |
432 | return -EINVAL; | 432 | return -EINVAL; |
433 | 433 | ||
434 | fl->fl_owner = (fl_owner_t)filp; | 434 | fl->fl_owner = (fl_owner_t)current->files; |
435 | fl->fl_pid = current->tgid; | 435 | fl->fl_pid = current->tgid; |
436 | 436 | ||
437 | fl->fl_file = filp; | 437 | fl->fl_file = filp; |
diff --git a/fs/mbcache.c b/fs/mbcache.c index bf166e388f0d..187477ded6b3 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c | |||
@@ -73,6 +73,7 @@ | |||
73 | #include <linux/mbcache.h> | 73 | #include <linux/mbcache.h> |
74 | #include <linux/init.h> | 74 | #include <linux/init.h> |
75 | #include <linux/blockgroup_lock.h> | 75 | #include <linux/blockgroup_lock.h> |
76 | #include <linux/log2.h> | ||
76 | 77 | ||
77 | #ifdef MB_CACHE_DEBUG | 78 | #ifdef MB_CACHE_DEBUG |
78 | # define mb_debug(f...) do { \ | 79 | # define mb_debug(f...) do { \ |
@@ -93,7 +94,7 @@ | |||
93 | 94 | ||
94 | #define MB_CACHE_WRITER ((unsigned short)~0U >> 1) | 95 | #define MB_CACHE_WRITER ((unsigned short)~0U >> 1) |
95 | 96 | ||
96 | #define MB_CACHE_ENTRY_LOCK_BITS __builtin_log2(NR_BG_LOCKS) | 97 | #define MB_CACHE_ENTRY_LOCK_BITS ilog2(NR_BG_LOCKS) |
97 | #define MB_CACHE_ENTRY_LOCK_INDEX(ce) \ | 98 | #define MB_CACHE_ENTRY_LOCK_INDEX(ce) \ |
98 | (hash_long((unsigned long)ce, MB_CACHE_ENTRY_LOCK_BITS)) | 99 | (hash_long((unsigned long)ce, MB_CACHE_ENTRY_LOCK_BITS)) |
99 | 100 | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index c496f8a74639..9927913c97c2 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -147,6 +147,17 @@ int nfs_sync_mapping(struct address_space *mapping) | |||
147 | return ret; | 147 | return ret; |
148 | } | 148 | } |
149 | 149 | ||
150 | static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags) | ||
151 | { | ||
152 | struct nfs_inode *nfsi = NFS_I(inode); | ||
153 | |||
154 | if (inode->i_mapping->nrpages == 0) | ||
155 | flags &= ~NFS_INO_INVALID_DATA; | ||
156 | nfsi->cache_validity |= flags; | ||
157 | if (flags & NFS_INO_INVALID_DATA) | ||
158 | nfs_fscache_invalidate(inode); | ||
159 | } | ||
160 | |||
150 | /* | 161 | /* |
151 | * Invalidate the local caches | 162 | * Invalidate the local caches |
152 | */ | 163 | */ |
@@ -162,17 +173,16 @@ static void nfs_zap_caches_locked(struct inode *inode) | |||
162 | 173 | ||
163 | memset(NFS_I(inode)->cookieverf, 0, sizeof(NFS_I(inode)->cookieverf)); | 174 | memset(NFS_I(inode)->cookieverf, 0, sizeof(NFS_I(inode)->cookieverf)); |
164 | if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) { | 175 | if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) { |
165 | nfs_fscache_invalidate(inode); | 176 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR |
166 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | ||
167 | | NFS_INO_INVALID_DATA | 177 | | NFS_INO_INVALID_DATA |
168 | | NFS_INO_INVALID_ACCESS | 178 | | NFS_INO_INVALID_ACCESS |
169 | | NFS_INO_INVALID_ACL | 179 | | NFS_INO_INVALID_ACL |
170 | | NFS_INO_REVAL_PAGECACHE; | 180 | | NFS_INO_REVAL_PAGECACHE); |
171 | } else | 181 | } else |
172 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | 182 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR |
173 | | NFS_INO_INVALID_ACCESS | 183 | | NFS_INO_INVALID_ACCESS |
174 | | NFS_INO_INVALID_ACL | 184 | | NFS_INO_INVALID_ACL |
175 | | NFS_INO_REVAL_PAGECACHE; | 185 | | NFS_INO_REVAL_PAGECACHE); |
176 | nfs_zap_label_cache_locked(nfsi); | 186 | nfs_zap_label_cache_locked(nfsi); |
177 | } | 187 | } |
178 | 188 | ||
@@ -187,8 +197,7 @@ void nfs_zap_mapping(struct inode *inode, struct address_space *mapping) | |||
187 | { | 197 | { |
188 | if (mapping->nrpages != 0) { | 198 | if (mapping->nrpages != 0) { |
189 | spin_lock(&inode->i_lock); | 199 | spin_lock(&inode->i_lock); |
190 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA; | 200 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); |
191 | nfs_fscache_invalidate(inode); | ||
192 | spin_unlock(&inode->i_lock); | 201 | spin_unlock(&inode->i_lock); |
193 | } | 202 | } |
194 | } | 203 | } |
@@ -209,7 +218,7 @@ EXPORT_SYMBOL_GPL(nfs_zap_acl_cache); | |||
209 | void nfs_invalidate_atime(struct inode *inode) | 218 | void nfs_invalidate_atime(struct inode *inode) |
210 | { | 219 | { |
211 | spin_lock(&inode->i_lock); | 220 | spin_lock(&inode->i_lock); |
212 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME; | 221 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATIME); |
213 | spin_unlock(&inode->i_lock); | 222 | spin_unlock(&inode->i_lock); |
214 | } | 223 | } |
215 | EXPORT_SYMBOL_GPL(nfs_invalidate_atime); | 224 | EXPORT_SYMBOL_GPL(nfs_invalidate_atime); |
@@ -369,7 +378,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st | |||
369 | inode->i_mode = fattr->mode; | 378 | inode->i_mode = fattr->mode; |
370 | if ((fattr->valid & NFS_ATTR_FATTR_MODE) == 0 | 379 | if ((fattr->valid & NFS_ATTR_FATTR_MODE) == 0 |
371 | && nfs_server_capable(inode, NFS_CAP_MODE)) | 380 | && nfs_server_capable(inode, NFS_CAP_MODE)) |
372 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 381 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
373 | /* Why so? Because we want revalidate for devices/FIFOs, and | 382 | /* Why so? Because we want revalidate for devices/FIFOs, and |
374 | * that's precisely what we have in nfs_file_inode_operations. | 383 | * that's precisely what we have in nfs_file_inode_operations. |
375 | */ | 384 | */ |
@@ -415,36 +424,36 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st | |||
415 | if (fattr->valid & NFS_ATTR_FATTR_ATIME) | 424 | if (fattr->valid & NFS_ATTR_FATTR_ATIME) |
416 | inode->i_atime = fattr->atime; | 425 | inode->i_atime = fattr->atime; |
417 | else if (nfs_server_capable(inode, NFS_CAP_ATIME)) | 426 | else if (nfs_server_capable(inode, NFS_CAP_ATIME)) |
418 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 427 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
419 | if (fattr->valid & NFS_ATTR_FATTR_MTIME) | 428 | if (fattr->valid & NFS_ATTR_FATTR_MTIME) |
420 | inode->i_mtime = fattr->mtime; | 429 | inode->i_mtime = fattr->mtime; |
421 | else if (nfs_server_capable(inode, NFS_CAP_MTIME)) | 430 | else if (nfs_server_capable(inode, NFS_CAP_MTIME)) |
422 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 431 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
423 | if (fattr->valid & NFS_ATTR_FATTR_CTIME) | 432 | if (fattr->valid & NFS_ATTR_FATTR_CTIME) |
424 | inode->i_ctime = fattr->ctime; | 433 | inode->i_ctime = fattr->ctime; |
425 | else if (nfs_server_capable(inode, NFS_CAP_CTIME)) | 434 | else if (nfs_server_capable(inode, NFS_CAP_CTIME)) |
426 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 435 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
427 | if (fattr->valid & NFS_ATTR_FATTR_CHANGE) | 436 | if (fattr->valid & NFS_ATTR_FATTR_CHANGE) |
428 | inode->i_version = fattr->change_attr; | 437 | inode->i_version = fattr->change_attr; |
429 | else if (nfs_server_capable(inode, NFS_CAP_CHANGE_ATTR)) | 438 | else if (nfs_server_capable(inode, NFS_CAP_CHANGE_ATTR)) |
430 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 439 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
431 | if (fattr->valid & NFS_ATTR_FATTR_SIZE) | 440 | if (fattr->valid & NFS_ATTR_FATTR_SIZE) |
432 | inode->i_size = nfs_size_to_loff_t(fattr->size); | 441 | inode->i_size = nfs_size_to_loff_t(fattr->size); |
433 | else | 442 | else |
434 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | 443 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR |
435 | | NFS_INO_REVAL_PAGECACHE; | 444 | | NFS_INO_REVAL_PAGECACHE); |
436 | if (fattr->valid & NFS_ATTR_FATTR_NLINK) | 445 | if (fattr->valid & NFS_ATTR_FATTR_NLINK) |
437 | set_nlink(inode, fattr->nlink); | 446 | set_nlink(inode, fattr->nlink); |
438 | else if (nfs_server_capable(inode, NFS_CAP_NLINK)) | 447 | else if (nfs_server_capable(inode, NFS_CAP_NLINK)) |
439 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 448 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
440 | if (fattr->valid & NFS_ATTR_FATTR_OWNER) | 449 | if (fattr->valid & NFS_ATTR_FATTR_OWNER) |
441 | inode->i_uid = fattr->uid; | 450 | inode->i_uid = fattr->uid; |
442 | else if (nfs_server_capable(inode, NFS_CAP_OWNER)) | 451 | else if (nfs_server_capable(inode, NFS_CAP_OWNER)) |
443 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 452 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
444 | if (fattr->valid & NFS_ATTR_FATTR_GROUP) | 453 | if (fattr->valid & NFS_ATTR_FATTR_GROUP) |
445 | inode->i_gid = fattr->gid; | 454 | inode->i_gid = fattr->gid; |
446 | else if (nfs_server_capable(inode, NFS_CAP_OWNER_GROUP)) | 455 | else if (nfs_server_capable(inode, NFS_CAP_OWNER_GROUP)) |
447 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 456 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
448 | if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) | 457 | if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) |
449 | inode->i_blocks = fattr->du.nfs2.blocks; | 458 | inode->i_blocks = fattr->du.nfs2.blocks; |
450 | if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) { | 459 | if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) { |
@@ -550,6 +559,9 @@ static int nfs_vmtruncate(struct inode * inode, loff_t offset) | |||
550 | 559 | ||
551 | spin_lock(&inode->i_lock); | 560 | spin_lock(&inode->i_lock); |
552 | i_size_write(inode, offset); | 561 | i_size_write(inode, offset); |
562 | /* Optimisation */ | ||
563 | if (offset == 0) | ||
564 | NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_DATA; | ||
553 | spin_unlock(&inode->i_lock); | 565 | spin_unlock(&inode->i_lock); |
554 | 566 | ||
555 | truncate_pagecache(inode, offset); | 567 | truncate_pagecache(inode, offset); |
@@ -578,7 +590,8 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr) | |||
578 | inode->i_uid = attr->ia_uid; | 590 | inode->i_uid = attr->ia_uid; |
579 | if ((attr->ia_valid & ATTR_GID) != 0) | 591 | if ((attr->ia_valid & ATTR_GID) != 0) |
580 | inode->i_gid = attr->ia_gid; | 592 | inode->i_gid = attr->ia_gid; |
581 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; | 593 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ACCESS |
594 | | NFS_INO_INVALID_ACL); | ||
582 | spin_unlock(&inode->i_lock); | 595 | spin_unlock(&inode->i_lock); |
583 | } | 596 | } |
584 | if ((attr->ia_valid & ATTR_SIZE) != 0) { | 597 | if ((attr->ia_valid & ATTR_SIZE) != 0) { |
@@ -1101,7 +1114,7 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr | |||
1101 | && inode->i_version == fattr->pre_change_attr) { | 1114 | && inode->i_version == fattr->pre_change_attr) { |
1102 | inode->i_version = fattr->change_attr; | 1115 | inode->i_version = fattr->change_attr; |
1103 | if (S_ISDIR(inode->i_mode)) | 1116 | if (S_ISDIR(inode->i_mode)) |
1104 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 1117 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); |
1105 | ret |= NFS_INO_INVALID_ATTR; | 1118 | ret |= NFS_INO_INVALID_ATTR; |
1106 | } | 1119 | } |
1107 | /* If we have atomic WCC data, we may update some attributes */ | 1120 | /* If we have atomic WCC data, we may update some attributes */ |
@@ -1117,7 +1130,7 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr | |||
1117 | && timespec_equal(&inode->i_mtime, &fattr->pre_mtime)) { | 1130 | && timespec_equal(&inode->i_mtime, &fattr->pre_mtime)) { |
1118 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); | 1131 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); |
1119 | if (S_ISDIR(inode->i_mode)) | 1132 | if (S_ISDIR(inode->i_mode)) |
1120 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 1133 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); |
1121 | ret |= NFS_INO_INVALID_ATTR; | 1134 | ret |= NFS_INO_INVALID_ATTR; |
1122 | } | 1135 | } |
1123 | if ((fattr->valid & NFS_ATTR_FATTR_PRESIZE) | 1136 | if ((fattr->valid & NFS_ATTR_FATTR_PRESIZE) |
@@ -1128,9 +1141,6 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr | |||
1128 | ret |= NFS_INO_INVALID_ATTR; | 1141 | ret |= NFS_INO_INVALID_ATTR; |
1129 | } | 1142 | } |
1130 | 1143 | ||
1131 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) | ||
1132 | nfs_fscache_invalidate(inode); | ||
1133 | |||
1134 | return ret; | 1144 | return ret; |
1135 | } | 1145 | } |
1136 | 1146 | ||
@@ -1189,7 +1199,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat | |||
1189 | invalid |= NFS_INO_INVALID_ATIME; | 1199 | invalid |= NFS_INO_INVALID_ATIME; |
1190 | 1200 | ||
1191 | if (invalid != 0) | 1201 | if (invalid != 0) |
1192 | nfsi->cache_validity |= invalid; | 1202 | nfs_set_cache_invalid(inode, invalid); |
1193 | 1203 | ||
1194 | nfsi->read_cache_jiffies = fattr->time_start; | 1204 | nfsi->read_cache_jiffies = fattr->time_start; |
1195 | return 0; | 1205 | return 0; |
@@ -1402,13 +1412,11 @@ EXPORT_SYMBOL_GPL(nfs_refresh_inode); | |||
1402 | 1412 | ||
1403 | static int nfs_post_op_update_inode_locked(struct inode *inode, struct nfs_fattr *fattr) | 1413 | static int nfs_post_op_update_inode_locked(struct inode *inode, struct nfs_fattr *fattr) |
1404 | { | 1414 | { |
1405 | struct nfs_inode *nfsi = NFS_I(inode); | 1415 | unsigned long invalid = NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; |
1406 | 1416 | ||
1407 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; | 1417 | if (S_ISDIR(inode->i_mode)) |
1408 | if (S_ISDIR(inode->i_mode)) { | 1418 | invalid |= NFS_INO_INVALID_DATA; |
1409 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 1419 | nfs_set_cache_invalid(inode, invalid); |
1410 | nfs_fscache_invalidate(inode); | ||
1411 | } | ||
1412 | if ((fattr->valid & NFS_ATTR_FATTR) == 0) | 1420 | if ((fattr->valid & NFS_ATTR_FATTR) == 0) |
1413 | return 0; | 1421 | return 0; |
1414 | return nfs_refresh_inode_locked(inode, fattr); | 1422 | return nfs_refresh_inode_locked(inode, fattr); |
@@ -1601,6 +1609,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1601 | if ((nfsi->npages == 0) || new_isize > cur_isize) { | 1609 | if ((nfsi->npages == 0) || new_isize > cur_isize) { |
1602 | i_size_write(inode, new_isize); | 1610 | i_size_write(inode, new_isize); |
1603 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; | 1611 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; |
1612 | invalid &= ~NFS_INO_REVAL_PAGECACHE; | ||
1604 | } | 1613 | } |
1605 | dprintk("NFS: isize change on server for file %s/%ld " | 1614 | dprintk("NFS: isize change on server for file %s/%ld " |
1606 | "(%Ld to %Ld)\n", | 1615 | "(%Ld to %Ld)\n", |
@@ -1702,10 +1711,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1702 | invalid &= ~NFS_INO_INVALID_DATA; | 1711 | invalid &= ~NFS_INO_INVALID_DATA; |
1703 | if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ) || | 1712 | if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ) || |
1704 | (save_cache_validity & NFS_INO_REVAL_FORCED)) | 1713 | (save_cache_validity & NFS_INO_REVAL_FORCED)) |
1705 | nfsi->cache_validity |= invalid; | 1714 | nfs_set_cache_invalid(inode, invalid); |
1706 | |||
1707 | if (invalid & NFS_INO_INVALID_DATA) | ||
1708 | nfs_fscache_invalidate(inode); | ||
1709 | 1715 | ||
1710 | return 0; | 1716 | return 0; |
1711 | out_err: | 1717 | out_err: |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index f63cb87cd730..ba2affa51941 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -230,7 +230,7 @@ int nfs_atomic_open(struct inode *, struct dentry *, struct file *, | |||
230 | extern struct file_system_type nfs4_fs_type; | 230 | extern struct file_system_type nfs4_fs_type; |
231 | 231 | ||
232 | /* nfs4namespace.c */ | 232 | /* nfs4namespace.c */ |
233 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *, struct inode *, struct qstr *); | 233 | struct rpc_clnt *nfs4_negotiate_security(struct rpc_clnt *, struct inode *, struct qstr *); |
234 | struct vfsmount *nfs4_submount(struct nfs_server *, struct dentry *, | 234 | struct vfsmount *nfs4_submount(struct nfs_server *, struct dentry *, |
235 | struct nfs_fh *, struct nfs_fattr *); | 235 | struct nfs_fh *, struct nfs_fattr *); |
236 | int nfs4_replace_transport(struct nfs_server *server, | 236 | int nfs4_replace_transport(struct nfs_server *server, |
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 3d5dbf80d46a..3d83cb1fdc70 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
@@ -139,16 +139,22 @@ static size_t nfs_parse_server_name(char *string, size_t len, | |||
139 | * @server: NFS server struct | 139 | * @server: NFS server struct |
140 | * @flavors: List of security tuples returned by SECINFO procedure | 140 | * @flavors: List of security tuples returned by SECINFO procedure |
141 | * | 141 | * |
142 | * Return the pseudoflavor of the first security mechanism in | 142 | * Return an rpc client that uses the first security mechanism in |
143 | * "flavors" that is locally supported. Return RPC_AUTH_UNIX if | 143 | * "flavors" that is locally supported. The "flavors" array |
144 | * no matching flavor is found in the array. The "flavors" array | ||
145 | * is searched in the order returned from the server, per RFC 3530 | 144 | * is searched in the order returned from the server, per RFC 3530 |
146 | * recommendation. | 145 | * recommendation and each flavor is checked for membership in the |
146 | * sec= mount option list if it exists. | ||
147 | * | ||
148 | * Return -EPERM if no matching flavor is found in the array. | ||
149 | * | ||
150 | * Please call rpc_shutdown_client() when you are done with this rpc client. | ||
151 | * | ||
147 | */ | 152 | */ |
148 | static rpc_authflavor_t nfs_find_best_sec(struct nfs_server *server, | 153 | static struct rpc_clnt *nfs_find_best_sec(struct rpc_clnt *clnt, |
154 | struct nfs_server *server, | ||
149 | struct nfs4_secinfo_flavors *flavors) | 155 | struct nfs4_secinfo_flavors *flavors) |
150 | { | 156 | { |
151 | rpc_authflavor_t pseudoflavor; | 157 | rpc_authflavor_t pflavor; |
152 | struct nfs4_secinfo4 *secinfo; | 158 | struct nfs4_secinfo4 *secinfo; |
153 | unsigned int i; | 159 | unsigned int i; |
154 | 160 | ||
@@ -159,62 +165,73 @@ static rpc_authflavor_t nfs_find_best_sec(struct nfs_server *server, | |||
159 | case RPC_AUTH_NULL: | 165 | case RPC_AUTH_NULL: |
160 | case RPC_AUTH_UNIX: | 166 | case RPC_AUTH_UNIX: |
161 | case RPC_AUTH_GSS: | 167 | case RPC_AUTH_GSS: |
162 | pseudoflavor = rpcauth_get_pseudoflavor(secinfo->flavor, | 168 | pflavor = rpcauth_get_pseudoflavor(secinfo->flavor, |
163 | &secinfo->flavor_info); | 169 | &secinfo->flavor_info); |
164 | /* make sure pseudoflavor matches sec= mount opt */ | 170 | /* does the pseudoflavor match a sec= mount opt? */ |
165 | if (pseudoflavor != RPC_AUTH_MAXFLAVOR && | 171 | if (pflavor != RPC_AUTH_MAXFLAVOR && |
166 | nfs_auth_info_match(&server->auth_info, | 172 | nfs_auth_info_match(&server->auth_info, pflavor)) { |
167 | pseudoflavor)) | 173 | struct rpc_clnt *new; |
168 | return pseudoflavor; | 174 | struct rpc_cred *cred; |
169 | break; | 175 | |
176 | /* Cloning creates an rpc_auth for the flavor */ | ||
177 | new = rpc_clone_client_set_auth(clnt, pflavor); | ||
178 | if (IS_ERR(new)) | ||
179 | continue; | ||
180 | /** | ||
181 | * Check that the user actually can use the | ||
182 | * flavor. This is mostly for RPC_AUTH_GSS | ||
183 | * where cr_init obtains a gss context | ||
184 | */ | ||
185 | cred = rpcauth_lookupcred(new->cl_auth, 0); | ||
186 | if (IS_ERR(cred)) { | ||
187 | rpc_shutdown_client(new); | ||
188 | continue; | ||
189 | } | ||
190 | put_rpccred(cred); | ||
191 | return new; | ||
192 | } | ||
170 | } | 193 | } |
171 | } | 194 | } |
172 | 195 | return ERR_PTR(-EPERM); | |
173 | /* if there were any sec= options then nothing matched */ | ||
174 | if (server->auth_info.flavor_len > 0) | ||
175 | return -EPERM; | ||
176 | |||
177 | return RPC_AUTH_UNIX; | ||
178 | } | 196 | } |
179 | 197 | ||
180 | static rpc_authflavor_t nfs4_negotiate_security(struct inode *inode, struct qstr *name) | 198 | /** |
199 | * nfs4_negotiate_security - in response to an NFS4ERR_WRONGSEC on lookup, | ||
200 | * return an rpc_clnt that uses the best available security flavor with | ||
201 | * respect to the secinfo flavor list and the sec= mount options. | ||
202 | * | ||
203 | * @clnt: RPC client to clone | ||
204 | * @inode: directory inode | ||
205 | * @name: lookup name | ||
206 | * | ||
207 | * Please call rpc_shutdown_client() when you are done with this rpc client. | ||
208 | */ | ||
209 | struct rpc_clnt * | ||
210 | nfs4_negotiate_security(struct rpc_clnt *clnt, struct inode *inode, | ||
211 | struct qstr *name) | ||
181 | { | 212 | { |
182 | struct page *page; | 213 | struct page *page; |
183 | struct nfs4_secinfo_flavors *flavors; | 214 | struct nfs4_secinfo_flavors *flavors; |
184 | rpc_authflavor_t flavor; | 215 | struct rpc_clnt *new; |
185 | int err; | 216 | int err; |
186 | 217 | ||
187 | page = alloc_page(GFP_KERNEL); | 218 | page = alloc_page(GFP_KERNEL); |
188 | if (!page) | 219 | if (!page) |
189 | return -ENOMEM; | 220 | return ERR_PTR(-ENOMEM); |
221 | |||
190 | flavors = page_address(page); | 222 | flavors = page_address(page); |
191 | 223 | ||
192 | err = nfs4_proc_secinfo(inode, name, flavors); | 224 | err = nfs4_proc_secinfo(inode, name, flavors); |
193 | if (err < 0) { | 225 | if (err < 0) { |
194 | flavor = err; | 226 | new = ERR_PTR(err); |
195 | goto out; | 227 | goto out; |
196 | } | 228 | } |
197 | 229 | ||
198 | flavor = nfs_find_best_sec(NFS_SERVER(inode), flavors); | 230 | new = nfs_find_best_sec(clnt, NFS_SERVER(inode), flavors); |
199 | 231 | ||
200 | out: | 232 | out: |
201 | put_page(page); | 233 | put_page(page); |
202 | return flavor; | 234 | return new; |
203 | } | ||
204 | |||
205 | /* | ||
206 | * Please call rpc_shutdown_client() when you are done with this client. | ||
207 | */ | ||
208 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *clnt, struct inode *inode, | ||
209 | struct qstr *name) | ||
210 | { | ||
211 | rpc_authflavor_t flavor; | ||
212 | |||
213 | flavor = nfs4_negotiate_security(inode, name); | ||
214 | if ((int)flavor < 0) | ||
215 | return ERR_PTR((int)flavor); | ||
216 | |||
217 | return rpc_clone_client_set_auth(clnt, flavor); | ||
218 | } | 235 | } |
219 | 236 | ||
220 | static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, | 237 | static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, |
@@ -397,11 +414,6 @@ struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry, | |||
397 | 414 | ||
398 | if (client->cl_auth->au_flavor != flavor) | 415 | if (client->cl_auth->au_flavor != flavor) |
399 | flavor = client->cl_auth->au_flavor; | 416 | flavor = client->cl_auth->au_flavor; |
400 | else { | ||
401 | rpc_authflavor_t new = nfs4_negotiate_security(dir, name); | ||
402 | if ((int)new >= 0) | ||
403 | flavor = new; | ||
404 | } | ||
405 | mnt = nfs_do_submount(dentry, fh, fattr, flavor); | 417 | mnt = nfs_do_submount(dentry, fh, fattr, flavor); |
406 | out: | 418 | out: |
407 | rpc_shutdown_client(client); | 419 | rpc_shutdown_client(client); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 285ad5334018..4bf3d97cc5a0 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3247,7 +3247,7 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, | |||
3247 | err = -EPERM; | 3247 | err = -EPERM; |
3248 | if (client != *clnt) | 3248 | if (client != *clnt) |
3249 | goto out; | 3249 | goto out; |
3250 | client = nfs4_create_sec_client(client, dir, name); | 3250 | client = nfs4_negotiate_security(client, dir, name); |
3251 | if (IS_ERR(client)) | 3251 | if (IS_ERR(client)) |
3252 | return PTR_ERR(client); | 3252 | return PTR_ERR(client); |
3253 | 3253 | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 3ee5af4e738e..98ff061ccaf3 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -934,12 +934,14 @@ static bool nfs_write_pageuptodate(struct page *page, struct inode *inode) | |||
934 | 934 | ||
935 | if (nfs_have_delegated_attributes(inode)) | 935 | if (nfs_have_delegated_attributes(inode)) |
936 | goto out; | 936 | goto out; |
937 | if (nfsi->cache_validity & (NFS_INO_INVALID_DATA|NFS_INO_REVAL_PAGECACHE)) | 937 | if (nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) |
938 | return false; | 938 | return false; |
939 | smp_rmb(); | 939 | smp_rmb(); |
940 | if (test_bit(NFS_INO_INVALIDATING, &nfsi->flags)) | 940 | if (test_bit(NFS_INO_INVALIDATING, &nfsi->flags)) |
941 | return false; | 941 | return false; |
942 | out: | 942 | out: |
943 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) | ||
944 | return false; | ||
943 | return PageUptodate(page) != 0; | 945 | return PageUptodate(page) != 0; |
944 | } | 946 | } |
945 | 947 | ||
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 6851b003f2a4..8f029db5d271 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -617,15 +617,6 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
617 | 617 | ||
618 | switch (create->cr_type) { | 618 | switch (create->cr_type) { |
619 | case NF4LNK: | 619 | case NF4LNK: |
620 | /* ugh! we have to null-terminate the linktext, or | ||
621 | * vfs_symlink() will choke. it is always safe to | ||
622 | * null-terminate by brute force, since at worst we | ||
623 | * will overwrite the first byte of the create namelen | ||
624 | * in the XDR buffer, which has already been extracted | ||
625 | * during XDR decode. | ||
626 | */ | ||
627 | create->cr_linkname[create->cr_linklen] = 0; | ||
628 | |||
629 | status = nfsd_symlink(rqstp, &cstate->current_fh, | 620 | status = nfsd_symlink(rqstp, &cstate->current_fh, |
630 | create->cr_name, create->cr_namelen, | 621 | create->cr_name, create->cr_namelen, |
631 | create->cr_linkname, create->cr_linklen, | 622 | create->cr_linkname, create->cr_linklen, |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index c0d45cec9958..2204e1fe5725 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/ratelimit.h> | 41 | #include <linux/ratelimit.h> |
42 | #include <linux/sunrpc/svcauth_gss.h> | 42 | #include <linux/sunrpc/svcauth_gss.h> |
43 | #include <linux/sunrpc/addr.h> | 43 | #include <linux/sunrpc/addr.h> |
44 | #include <linux/hash.h> | ||
44 | #include "xdr4.h" | 45 | #include "xdr4.h" |
45 | #include "xdr4cb.h" | 46 | #include "xdr4cb.h" |
46 | #include "vfs.h" | 47 | #include "vfs.h" |
@@ -364,6 +365,79 @@ static struct nfs4_ol_stateid * nfs4_alloc_stateid(struct nfs4_client *clp) | |||
364 | return openlockstateid(nfs4_alloc_stid(clp, stateid_slab)); | 365 | return openlockstateid(nfs4_alloc_stid(clp, stateid_slab)); |
365 | } | 366 | } |
366 | 367 | ||
368 | /* | ||
369 | * When we recall a delegation, we should be careful not to hand it | ||
370 | * out again straight away. | ||
371 | * To ensure this we keep a pair of bloom filters ('new' and 'old') | ||
372 | * in which the filehandles of recalled delegations are "stored". | ||
373 | * If a filehandle appear in either filter, a delegation is blocked. | ||
374 | * When a delegation is recalled, the filehandle is stored in the "new" | ||
375 | * filter. | ||
376 | * Every 30 seconds we swap the filters and clear the "new" one, | ||
377 | * unless both are empty of course. | ||
378 | * | ||
379 | * Each filter is 256 bits. We hash the filehandle to 32bit and use the | ||
380 | * low 3 bytes as hash-table indices. | ||
381 | * | ||
382 | * 'state_lock', which is always held when block_delegations() is called, | ||
383 | * is used to manage concurrent access. Testing does not need the lock | ||
384 | * except when swapping the two filters. | ||
385 | */ | ||
386 | static struct bloom_pair { | ||
387 | int entries, old_entries; | ||
388 | time_t swap_time; | ||
389 | int new; /* index into 'set' */ | ||
390 | DECLARE_BITMAP(set[2], 256); | ||
391 | } blocked_delegations; | ||
392 | |||
393 | static int delegation_blocked(struct knfsd_fh *fh) | ||
394 | { | ||
395 | u32 hash; | ||
396 | struct bloom_pair *bd = &blocked_delegations; | ||
397 | |||
398 | if (bd->entries == 0) | ||
399 | return 0; | ||
400 | if (seconds_since_boot() - bd->swap_time > 30) { | ||
401 | spin_lock(&state_lock); | ||
402 | if (seconds_since_boot() - bd->swap_time > 30) { | ||
403 | bd->entries -= bd->old_entries; | ||
404 | bd->old_entries = bd->entries; | ||
405 | memset(bd->set[bd->new], 0, | ||
406 | sizeof(bd->set[0])); | ||
407 | bd->new = 1-bd->new; | ||
408 | bd->swap_time = seconds_since_boot(); | ||
409 | } | ||
410 | spin_unlock(&state_lock); | ||
411 | } | ||
412 | hash = arch_fast_hash(&fh->fh_base, fh->fh_size, 0); | ||
413 | if (test_bit(hash&255, bd->set[0]) && | ||
414 | test_bit((hash>>8)&255, bd->set[0]) && | ||
415 | test_bit((hash>>16)&255, bd->set[0])) | ||
416 | return 1; | ||
417 | |||
418 | if (test_bit(hash&255, bd->set[1]) && | ||
419 | test_bit((hash>>8)&255, bd->set[1]) && | ||
420 | test_bit((hash>>16)&255, bd->set[1])) | ||
421 | return 1; | ||
422 | |||
423 | return 0; | ||
424 | } | ||
425 | |||
426 | static void block_delegations(struct knfsd_fh *fh) | ||
427 | { | ||
428 | u32 hash; | ||
429 | struct bloom_pair *bd = &blocked_delegations; | ||
430 | |||
431 | hash = arch_fast_hash(&fh->fh_base, fh->fh_size, 0); | ||
432 | |||
433 | __set_bit(hash&255, bd->set[bd->new]); | ||
434 | __set_bit((hash>>8)&255, bd->set[bd->new]); | ||
435 | __set_bit((hash>>16)&255, bd->set[bd->new]); | ||
436 | if (bd->entries == 0) | ||
437 | bd->swap_time = seconds_since_boot(); | ||
438 | bd->entries += 1; | ||
439 | } | ||
440 | |||
367 | static struct nfs4_delegation * | 441 | static struct nfs4_delegation * |
368 | alloc_init_deleg(struct nfs4_client *clp, struct nfs4_ol_stateid *stp, struct svc_fh *current_fh) | 442 | alloc_init_deleg(struct nfs4_client *clp, struct nfs4_ol_stateid *stp, struct svc_fh *current_fh) |
369 | { | 443 | { |
@@ -372,6 +446,8 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_ol_stateid *stp, struct sv | |||
372 | dprintk("NFSD alloc_init_deleg\n"); | 446 | dprintk("NFSD alloc_init_deleg\n"); |
373 | if (num_delegations > max_delegations) | 447 | if (num_delegations > max_delegations) |
374 | return NULL; | 448 | return NULL; |
449 | if (delegation_blocked(¤t_fh->fh_handle)) | ||
450 | return NULL; | ||
375 | dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab)); | 451 | dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab)); |
376 | if (dp == NULL) | 452 | if (dp == NULL) |
377 | return dp; | 453 | return dp; |
@@ -2770,6 +2846,8 @@ static void nfsd_break_one_deleg(struct nfs4_delegation *dp) | |||
2770 | /* Only place dl_time is set; protected by i_lock: */ | 2846 | /* Only place dl_time is set; protected by i_lock: */ |
2771 | dp->dl_time = get_seconds(); | 2847 | dp->dl_time = get_seconds(); |
2772 | 2848 | ||
2849 | block_delegations(&dp->dl_fh); | ||
2850 | |||
2773 | nfsd4_cb_recall(dp); | 2851 | nfsd4_cb_recall(dp); |
2774 | } | 2852 | } |
2775 | 2853 | ||
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 2d305a121f37..b56b1cc02718 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -600,7 +600,18 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create | |||
600 | READ_BUF(4); | 600 | READ_BUF(4); |
601 | create->cr_linklen = be32_to_cpup(p++); | 601 | create->cr_linklen = be32_to_cpup(p++); |
602 | READ_BUF(create->cr_linklen); | 602 | READ_BUF(create->cr_linklen); |
603 | SAVEMEM(create->cr_linkname, create->cr_linklen); | 603 | /* |
604 | * The VFS will want a null-terminated string, and | ||
605 | * null-terminating in place isn't safe since this might | ||
606 | * end on a page boundary: | ||
607 | */ | ||
608 | create->cr_linkname = | ||
609 | kmalloc(create->cr_linklen + 1, GFP_KERNEL); | ||
610 | if (!create->cr_linkname) | ||
611 | return nfserr_jukebox; | ||
612 | memcpy(create->cr_linkname, p, create->cr_linklen); | ||
613 | create->cr_linkname[create->cr_linklen] = '\0'; | ||
614 | defer_free(argp, kfree, create->cr_linkname); | ||
604 | break; | 615 | break; |
605 | case NF4BLK: | 616 | case NF4BLK: |
606 | case NF4CHR: | 617 | case NF4CHR: |
@@ -2630,7 +2641,7 @@ nfsd4_encode_rdattr_error(struct xdr_stream *xdr, __be32 nfserr) | |||
2630 | { | 2641 | { |
2631 | __be32 *p; | 2642 | __be32 *p; |
2632 | 2643 | ||
2633 | p = xdr_reserve_space(xdr, 6); | 2644 | p = xdr_reserve_space(xdr, 20); |
2634 | if (!p) | 2645 | if (!p) |
2635 | return NULL; | 2646 | return NULL; |
2636 | *p++ = htonl(2); | 2647 | *p++ = htonl(2); |
@@ -2687,6 +2698,7 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, | |||
2687 | nfserr = nfserr_toosmall; | 2698 | nfserr = nfserr_toosmall; |
2688 | goto fail; | 2699 | goto fail; |
2689 | case nfserr_noent: | 2700 | case nfserr_noent: |
2701 | xdr_truncate_encode(xdr, start_offset); | ||
2690 | goto skip_entry; | 2702 | goto skip_entry; |
2691 | default: | 2703 | default: |
2692 | /* | 2704 | /* |
@@ -3266,7 +3278,7 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd | |||
3266 | 3278 | ||
3267 | wire_count = htonl(maxcount); | 3279 | wire_count = htonl(maxcount); |
3268 | write_bytes_to_xdr_buf(xdr->buf, length_offset, &wire_count, 4); | 3280 | write_bytes_to_xdr_buf(xdr->buf, length_offset, &wire_count, 4); |
3269 | xdr_truncate_encode(xdr, length_offset + 4 + maxcount); | 3281 | xdr_truncate_encode(xdr, length_offset + 4 + ALIGN(maxcount, 4)); |
3270 | if (maxcount & 3) | 3282 | if (maxcount & 3) |
3271 | write_bytes_to_xdr_buf(xdr->buf, length_offset + 4 + maxcount, | 3283 | write_bytes_to_xdr_buf(xdr->buf, length_offset + 4 + maxcount, |
3272 | &zero, 4 - (maxcount&3)); | 3284 | &zero, 4 - (maxcount&3)); |
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index a106b3f2b22a..fae17c640df3 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
@@ -331,6 +331,7 @@ struct dlm_lock_resource | |||
331 | u16 state; | 331 | u16 state; |
332 | char lvb[DLM_LVB_LEN]; | 332 | char lvb[DLM_LVB_LEN]; |
333 | unsigned int inflight_locks; | 333 | unsigned int inflight_locks; |
334 | unsigned int inflight_assert_workers; | ||
334 | unsigned long refmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; | 335 | unsigned long refmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
335 | }; | 336 | }; |
336 | 337 | ||
@@ -910,6 +911,9 @@ void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, | |||
910 | void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | 911 | void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, |
911 | struct dlm_lock_resource *res); | 912 | struct dlm_lock_resource *res); |
912 | 913 | ||
914 | void __dlm_lockres_grab_inflight_worker(struct dlm_ctxt *dlm, | ||
915 | struct dlm_lock_resource *res); | ||
916 | |||
913 | void dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock); | 917 | void dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock); |
914 | void dlm_queue_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock); | 918 | void dlm_queue_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock); |
915 | void __dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock); | 919 | void __dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock); |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 3087a21d32f9..82abf0cc9a12 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -581,6 +581,7 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm, | |||
581 | atomic_set(&res->asts_reserved, 0); | 581 | atomic_set(&res->asts_reserved, 0); |
582 | res->migration_pending = 0; | 582 | res->migration_pending = 0; |
583 | res->inflight_locks = 0; | 583 | res->inflight_locks = 0; |
584 | res->inflight_assert_workers = 0; | ||
584 | 585 | ||
585 | res->dlm = dlm; | 586 | res->dlm = dlm; |
586 | 587 | ||
@@ -683,6 +684,43 @@ void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, | |||
683 | wake_up(&res->wq); | 684 | wake_up(&res->wq); |
684 | } | 685 | } |
685 | 686 | ||
687 | void __dlm_lockres_grab_inflight_worker(struct dlm_ctxt *dlm, | ||
688 | struct dlm_lock_resource *res) | ||
689 | { | ||
690 | assert_spin_locked(&res->spinlock); | ||
691 | res->inflight_assert_workers++; | ||
692 | mlog(0, "%s:%.*s: inflight assert worker++: now %u\n", | ||
693 | dlm->name, res->lockname.len, res->lockname.name, | ||
694 | res->inflight_assert_workers); | ||
695 | } | ||
696 | |||
697 | static void dlm_lockres_grab_inflight_worker(struct dlm_ctxt *dlm, | ||
698 | struct dlm_lock_resource *res) | ||
699 | { | ||
700 | spin_lock(&res->spinlock); | ||
701 | __dlm_lockres_grab_inflight_worker(dlm, res); | ||
702 | spin_unlock(&res->spinlock); | ||
703 | } | ||
704 | |||
705 | static void __dlm_lockres_drop_inflight_worker(struct dlm_ctxt *dlm, | ||
706 | struct dlm_lock_resource *res) | ||
707 | { | ||
708 | assert_spin_locked(&res->spinlock); | ||
709 | BUG_ON(res->inflight_assert_workers == 0); | ||
710 | res->inflight_assert_workers--; | ||
711 | mlog(0, "%s:%.*s: inflight assert worker--: now %u\n", | ||
712 | dlm->name, res->lockname.len, res->lockname.name, | ||
713 | res->inflight_assert_workers); | ||
714 | } | ||
715 | |||
716 | static void dlm_lockres_drop_inflight_worker(struct dlm_ctxt *dlm, | ||
717 | struct dlm_lock_resource *res) | ||
718 | { | ||
719 | spin_lock(&res->spinlock); | ||
720 | __dlm_lockres_drop_inflight_worker(dlm, res); | ||
721 | spin_unlock(&res->spinlock); | ||
722 | } | ||
723 | |||
686 | /* | 724 | /* |
687 | * lookup a lock resource by name. | 725 | * lookup a lock resource by name. |
688 | * may already exist in the hashtable. | 726 | * may already exist in the hashtable. |
@@ -1603,7 +1641,8 @@ send_response: | |||
1603 | mlog(ML_ERROR, "failed to dispatch assert master work\n"); | 1641 | mlog(ML_ERROR, "failed to dispatch assert master work\n"); |
1604 | response = DLM_MASTER_RESP_ERROR; | 1642 | response = DLM_MASTER_RESP_ERROR; |
1605 | dlm_lockres_put(res); | 1643 | dlm_lockres_put(res); |
1606 | } | 1644 | } else |
1645 | dlm_lockres_grab_inflight_worker(dlm, res); | ||
1607 | } else { | 1646 | } else { |
1608 | if (res) | 1647 | if (res) |
1609 | dlm_lockres_put(res); | 1648 | dlm_lockres_put(res); |
@@ -2118,6 +2157,8 @@ static void dlm_assert_master_worker(struct dlm_work_item *item, void *data) | |||
2118 | dlm_lockres_release_ast(dlm, res); | 2157 | dlm_lockres_release_ast(dlm, res); |
2119 | 2158 | ||
2120 | put: | 2159 | put: |
2160 | dlm_lockres_drop_inflight_worker(dlm, res); | ||
2161 | |||
2121 | dlm_lockres_put(res); | 2162 | dlm_lockres_put(res); |
2122 | 2163 | ||
2123 | mlog(0, "finished with dlm_assert_master_worker\n"); | 2164 | mlog(0, "finished with dlm_assert_master_worker\n"); |
@@ -3088,11 +3129,15 @@ static int dlm_add_migration_mle(struct dlm_ctxt *dlm, | |||
3088 | /* remove it so that only one mle will be found */ | 3129 | /* remove it so that only one mle will be found */ |
3089 | __dlm_unlink_mle(dlm, tmp); | 3130 | __dlm_unlink_mle(dlm, tmp); |
3090 | __dlm_mle_detach_hb_events(dlm, tmp); | 3131 | __dlm_mle_detach_hb_events(dlm, tmp); |
3091 | ret = DLM_MIGRATE_RESPONSE_MASTERY_REF; | 3132 | if (tmp->type == DLM_MLE_MASTER) { |
3092 | mlog(0, "%s:%.*s: master=%u, newmaster=%u, " | 3133 | ret = DLM_MIGRATE_RESPONSE_MASTERY_REF; |
3093 | "telling master to get ref for cleared out mle " | 3134 | mlog(0, "%s:%.*s: master=%u, newmaster=%u, " |
3094 | "during migration\n", dlm->name, namelen, name, | 3135 | "telling master to get ref " |
3095 | master, new_master); | 3136 | "for cleared out mle during " |
3137 | "migration\n", dlm->name, | ||
3138 | namelen, name, master, | ||
3139 | new_master); | ||
3140 | } | ||
3096 | } | 3141 | } |
3097 | spin_unlock(&tmp->spinlock); | 3142 | spin_unlock(&tmp->spinlock); |
3098 | } | 3143 | } |
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index 5de019437ea5..45067faf5695 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -1708,7 +1708,8 @@ int dlm_master_requery_handler(struct o2net_msg *msg, u32 len, void *data, | |||
1708 | mlog_errno(-ENOMEM); | 1708 | mlog_errno(-ENOMEM); |
1709 | /* retry!? */ | 1709 | /* retry!? */ |
1710 | BUG(); | 1710 | BUG(); |
1711 | } | 1711 | } else |
1712 | __dlm_lockres_grab_inflight_worker(dlm, res); | ||
1712 | } else /* put.. incase we are not the master */ | 1713 | } else /* put.. incase we are not the master */ |
1713 | dlm_lockres_put(res); | 1714 | dlm_lockres_put(res); |
1714 | spin_unlock(&res->spinlock); | 1715 | spin_unlock(&res->spinlock); |
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c index 9db869de829d..69aac6f088ad 100644 --- a/fs/ocfs2/dlm/dlmthread.c +++ b/fs/ocfs2/dlm/dlmthread.c | |||
@@ -259,12 +259,15 @@ static void dlm_run_purge_list(struct dlm_ctxt *dlm, | |||
259 | * refs on it. */ | 259 | * refs on it. */ |
260 | unused = __dlm_lockres_unused(lockres); | 260 | unused = __dlm_lockres_unused(lockres); |
261 | if (!unused || | 261 | if (!unused || |
262 | (lockres->state & DLM_LOCK_RES_MIGRATING)) { | 262 | (lockres->state & DLM_LOCK_RES_MIGRATING) || |
263 | (lockres->inflight_assert_workers != 0)) { | ||
263 | mlog(0, "%s: res %.*s is in use or being remastered, " | 264 | mlog(0, "%s: res %.*s is in use or being remastered, " |
264 | "used %d, state %d\n", dlm->name, | 265 | "used %d, state %d, assert master workers %u\n", |
265 | lockres->lockname.len, lockres->lockname.name, | 266 | dlm->name, lockres->lockname.len, |
266 | !unused, lockres->state); | 267 | lockres->lockname.name, |
267 | list_move_tail(&dlm->purge_list, &lockres->purge); | 268 | !unused, lockres->state, |
269 | lockres->inflight_assert_workers); | ||
270 | list_move_tail(&lockres->purge, &dlm->purge_list); | ||
268 | spin_unlock(&lockres->spinlock); | 271 | spin_unlock(&lockres->spinlock); |
269 | continue; | 272 | continue; |
270 | } | 273 | } |
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c index 5698b52cf5c9..2e3c9dbab68c 100644 --- a/fs/ocfs2/dlm/dlmunlock.c +++ b/fs/ocfs2/dlm/dlmunlock.c | |||
@@ -191,7 +191,9 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, | |||
191 | DLM_UNLOCK_CLEAR_CONVERT_TYPE); | 191 | DLM_UNLOCK_CLEAR_CONVERT_TYPE); |
192 | } else if (status == DLM_RECOVERING || | 192 | } else if (status == DLM_RECOVERING || |
193 | status == DLM_MIGRATING || | 193 | status == DLM_MIGRATING || |
194 | status == DLM_FORWARD) { | 194 | status == DLM_FORWARD || |
195 | status == DLM_NOLOCKMGR | ||
196 | ) { | ||
195 | /* must clear the actions because this unlock | 197 | /* must clear the actions because this unlock |
196 | * is about to be retried. cannot free or do | 198 | * is about to be retried. cannot free or do |
197 | * any list manipulation. */ | 199 | * any list manipulation. */ |
@@ -200,7 +202,8 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, | |||
200 | res->lockname.name, | 202 | res->lockname.name, |
201 | status==DLM_RECOVERING?"recovering": | 203 | status==DLM_RECOVERING?"recovering": |
202 | (status==DLM_MIGRATING?"migrating": | 204 | (status==DLM_MIGRATING?"migrating": |
203 | "forward")); | 205 | (status == DLM_FORWARD ? "forward" : |
206 | "nolockmanager"))); | ||
204 | actions = 0; | 207 | actions = 0; |
205 | } | 208 | } |
206 | if (flags & LKM_CANCEL) | 209 | if (flags & LKM_CANCEL) |
@@ -364,7 +367,10 @@ static enum dlm_status dlm_send_remote_unlock_request(struct dlm_ctxt *dlm, | |||
364 | * updated state to the recovery master. this thread | 367 | * updated state to the recovery master. this thread |
365 | * just needs to finish out the operation and call | 368 | * just needs to finish out the operation and call |
366 | * the unlockast. */ | 369 | * the unlockast. */ |
367 | ret = DLM_NORMAL; | 370 | if (dlm_is_node_dead(dlm, owner)) |
371 | ret = DLM_NORMAL; | ||
372 | else | ||
373 | ret = DLM_NOLOCKMGR; | ||
368 | } else { | 374 | } else { |
369 | /* something bad. this will BUG in ocfs2 */ | 375 | /* something bad. this will BUG in ocfs2 */ |
370 | ret = dlm_err_to_dlm_status(tmpret); | 376 | ret = dlm_err_to_dlm_status(tmpret); |
@@ -638,7 +644,9 @@ retry: | |||
638 | 644 | ||
639 | if (status == DLM_RECOVERING || | 645 | if (status == DLM_RECOVERING || |
640 | status == DLM_MIGRATING || | 646 | status == DLM_MIGRATING || |
641 | status == DLM_FORWARD) { | 647 | status == DLM_FORWARD || |
648 | status == DLM_NOLOCKMGR) { | ||
649 | |||
642 | /* We want to go away for a tiny bit to allow recovery | 650 | /* We want to go away for a tiny bit to allow recovery |
643 | * / migration to complete on this resource. I don't | 651 | * / migration to complete on this resource. I don't |
644 | * know of any wait queue we could sleep on as this | 652 | * know of any wait queue we could sleep on as this |
@@ -650,7 +658,7 @@ retry: | |||
650 | msleep(50); | 658 | msleep(50); |
651 | 659 | ||
652 | mlog(0, "retrying unlock due to pending recovery/" | 660 | mlog(0, "retrying unlock due to pending recovery/" |
653 | "migration/in-progress\n"); | 661 | "migration/in-progress/reconnect\n"); |
654 | goto retry; | 662 | goto retry; |
655 | } | 663 | } |
656 | 664 | ||
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 2060fc398445..8add6f1030d7 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -205,6 +205,21 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, umode_t mode) | |||
205 | return inode; | 205 | return inode; |
206 | } | 206 | } |
207 | 207 | ||
208 | static void ocfs2_cleanup_add_entry_failure(struct ocfs2_super *osb, | ||
209 | struct dentry *dentry, struct inode *inode) | ||
210 | { | ||
211 | struct ocfs2_dentry_lock *dl = dentry->d_fsdata; | ||
212 | |||
213 | ocfs2_simple_drop_lockres(osb, &dl->dl_lockres); | ||
214 | ocfs2_lock_res_free(&dl->dl_lockres); | ||
215 | BUG_ON(dl->dl_count != 1); | ||
216 | spin_lock(&dentry_attach_lock); | ||
217 | dentry->d_fsdata = NULL; | ||
218 | spin_unlock(&dentry_attach_lock); | ||
219 | kfree(dl); | ||
220 | iput(inode); | ||
221 | } | ||
222 | |||
208 | static int ocfs2_mknod(struct inode *dir, | 223 | static int ocfs2_mknod(struct inode *dir, |
209 | struct dentry *dentry, | 224 | struct dentry *dentry, |
210 | umode_t mode, | 225 | umode_t mode, |
@@ -231,6 +246,7 @@ static int ocfs2_mknod(struct inode *dir, | |||
231 | sigset_t oldset; | 246 | sigset_t oldset; |
232 | int did_block_signals = 0; | 247 | int did_block_signals = 0; |
233 | struct posix_acl *default_acl = NULL, *acl = NULL; | 248 | struct posix_acl *default_acl = NULL, *acl = NULL; |
249 | struct ocfs2_dentry_lock *dl = NULL; | ||
234 | 250 | ||
235 | trace_ocfs2_mknod(dir, dentry, dentry->d_name.len, dentry->d_name.name, | 251 | trace_ocfs2_mknod(dir, dentry, dentry->d_name.len, dentry->d_name.name, |
236 | (unsigned long long)OCFS2_I(dir)->ip_blkno, | 252 | (unsigned long long)OCFS2_I(dir)->ip_blkno, |
@@ -423,6 +439,8 @@ static int ocfs2_mknod(struct inode *dir, | |||
423 | goto leave; | 439 | goto leave; |
424 | } | 440 | } |
425 | 441 | ||
442 | dl = dentry->d_fsdata; | ||
443 | |||
426 | status = ocfs2_add_entry(handle, dentry, inode, | 444 | status = ocfs2_add_entry(handle, dentry, inode, |
427 | OCFS2_I(inode)->ip_blkno, parent_fe_bh, | 445 | OCFS2_I(inode)->ip_blkno, parent_fe_bh, |
428 | &lookup); | 446 | &lookup); |
@@ -469,6 +487,9 @@ leave: | |||
469 | * ocfs2_delete_inode will mutex_lock again. | 487 | * ocfs2_delete_inode will mutex_lock again. |
470 | */ | 488 | */ |
471 | if ((status < 0) && inode) { | 489 | if ((status < 0) && inode) { |
490 | if (dl) | ||
491 | ocfs2_cleanup_add_entry_failure(osb, dentry, inode); | ||
492 | |||
472 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SKIP_ORPHAN_DIR; | 493 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SKIP_ORPHAN_DIR; |
473 | clear_nlink(inode); | 494 | clear_nlink(inode); |
474 | iput(inode); | 495 | iput(inode); |
@@ -991,6 +1012,65 @@ leave: | |||
991 | return status; | 1012 | return status; |
992 | } | 1013 | } |
993 | 1014 | ||
1015 | static int ocfs2_check_if_ancestor(struct ocfs2_super *osb, | ||
1016 | u64 src_inode_no, u64 dest_inode_no) | ||
1017 | { | ||
1018 | int ret = 0, i = 0; | ||
1019 | u64 parent_inode_no = 0; | ||
1020 | u64 child_inode_no = src_inode_no; | ||
1021 | struct inode *child_inode; | ||
1022 | |||
1023 | #define MAX_LOOKUP_TIMES 32 | ||
1024 | while (1) { | ||
1025 | child_inode = ocfs2_iget(osb, child_inode_no, 0, 0); | ||
1026 | if (IS_ERR(child_inode)) { | ||
1027 | ret = PTR_ERR(child_inode); | ||
1028 | break; | ||
1029 | } | ||
1030 | |||
1031 | ret = ocfs2_inode_lock(child_inode, NULL, 0); | ||
1032 | if (ret < 0) { | ||
1033 | iput(child_inode); | ||
1034 | if (ret != -ENOENT) | ||
1035 | mlog_errno(ret); | ||
1036 | break; | ||
1037 | } | ||
1038 | |||
1039 | ret = ocfs2_lookup_ino_from_name(child_inode, "..", 2, | ||
1040 | &parent_inode_no); | ||
1041 | ocfs2_inode_unlock(child_inode, 0); | ||
1042 | iput(child_inode); | ||
1043 | if (ret < 0) { | ||
1044 | ret = -ENOENT; | ||
1045 | break; | ||
1046 | } | ||
1047 | |||
1048 | if (parent_inode_no == dest_inode_no) { | ||
1049 | ret = 1; | ||
1050 | break; | ||
1051 | } | ||
1052 | |||
1053 | if (parent_inode_no == osb->root_inode->i_ino) { | ||
1054 | ret = 0; | ||
1055 | break; | ||
1056 | } | ||
1057 | |||
1058 | child_inode_no = parent_inode_no; | ||
1059 | |||
1060 | if (++i >= MAX_LOOKUP_TIMES) { | ||
1061 | mlog(ML_NOTICE, "max lookup times reached, filesystem " | ||
1062 | "may have nested directories, " | ||
1063 | "src inode: %llu, dest inode: %llu.\n", | ||
1064 | (unsigned long long)src_inode_no, | ||
1065 | (unsigned long long)dest_inode_no); | ||
1066 | ret = 0; | ||
1067 | break; | ||
1068 | } | ||
1069 | } | ||
1070 | |||
1071 | return ret; | ||
1072 | } | ||
1073 | |||
994 | /* | 1074 | /* |
995 | * The only place this should be used is rename! | 1075 | * The only place this should be used is rename! |
996 | * if they have the same id, then the 1st one is the only one locked. | 1076 | * if they have the same id, then the 1st one is the only one locked. |
@@ -1002,6 +1082,7 @@ static int ocfs2_double_lock(struct ocfs2_super *osb, | |||
1002 | struct inode *inode2) | 1082 | struct inode *inode2) |
1003 | { | 1083 | { |
1004 | int status; | 1084 | int status; |
1085 | int inode1_is_ancestor, inode2_is_ancestor; | ||
1005 | struct ocfs2_inode_info *oi1 = OCFS2_I(inode1); | 1086 | struct ocfs2_inode_info *oi1 = OCFS2_I(inode1); |
1006 | struct ocfs2_inode_info *oi2 = OCFS2_I(inode2); | 1087 | struct ocfs2_inode_info *oi2 = OCFS2_I(inode2); |
1007 | struct buffer_head **tmpbh; | 1088 | struct buffer_head **tmpbh; |
@@ -1015,9 +1096,26 @@ static int ocfs2_double_lock(struct ocfs2_super *osb, | |||
1015 | if (*bh2) | 1096 | if (*bh2) |
1016 | *bh2 = NULL; | 1097 | *bh2 = NULL; |
1017 | 1098 | ||
1018 | /* we always want to lock the one with the lower lockid first. */ | 1099 | /* we always want to lock the one with the lower lockid first. |
1100 | * and if they are nested, we lock ancestor first */ | ||
1019 | if (oi1->ip_blkno != oi2->ip_blkno) { | 1101 | if (oi1->ip_blkno != oi2->ip_blkno) { |
1020 | if (oi1->ip_blkno < oi2->ip_blkno) { | 1102 | inode1_is_ancestor = ocfs2_check_if_ancestor(osb, oi2->ip_blkno, |
1103 | oi1->ip_blkno); | ||
1104 | if (inode1_is_ancestor < 0) { | ||
1105 | status = inode1_is_ancestor; | ||
1106 | goto bail; | ||
1107 | } | ||
1108 | |||
1109 | inode2_is_ancestor = ocfs2_check_if_ancestor(osb, oi1->ip_blkno, | ||
1110 | oi2->ip_blkno); | ||
1111 | if (inode2_is_ancestor < 0) { | ||
1112 | status = inode2_is_ancestor; | ||
1113 | goto bail; | ||
1114 | } | ||
1115 | |||
1116 | if ((inode1_is_ancestor == 1) || | ||
1117 | (oi1->ip_blkno < oi2->ip_blkno && | ||
1118 | inode2_is_ancestor == 0)) { | ||
1021 | /* switch id1 and id2 around */ | 1119 | /* switch id1 and id2 around */ |
1022 | tmpbh = bh2; | 1120 | tmpbh = bh2; |
1023 | bh2 = bh1; | 1121 | bh2 = bh1; |
@@ -1098,6 +1196,7 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1098 | struct ocfs2_dir_lookup_result old_entry_lookup = { NULL, }; | 1196 | struct ocfs2_dir_lookup_result old_entry_lookup = { NULL, }; |
1099 | struct ocfs2_dir_lookup_result orphan_insert = { NULL, }; | 1197 | struct ocfs2_dir_lookup_result orphan_insert = { NULL, }; |
1100 | struct ocfs2_dir_lookup_result target_insert = { NULL, }; | 1198 | struct ocfs2_dir_lookup_result target_insert = { NULL, }; |
1199 | bool should_add_orphan = false; | ||
1101 | 1200 | ||
1102 | /* At some point it might be nice to break this function up a | 1201 | /* At some point it might be nice to break this function up a |
1103 | * bit. */ | 1202 | * bit. */ |
@@ -1134,6 +1233,21 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1134 | goto bail; | 1233 | goto bail; |
1135 | } | 1234 | } |
1136 | rename_lock = 1; | 1235 | rename_lock = 1; |
1236 | |||
1237 | /* here we cannot guarantee the inodes haven't just been | ||
1238 | * changed, so check if they are nested again */ | ||
1239 | status = ocfs2_check_if_ancestor(osb, new_dir->i_ino, | ||
1240 | old_inode->i_ino); | ||
1241 | if (status < 0) { | ||
1242 | mlog_errno(status); | ||
1243 | goto bail; | ||
1244 | } else if (status == 1) { | ||
1245 | status = -EPERM; | ||
1246 | trace_ocfs2_rename_not_permitted( | ||
1247 | (unsigned long long)old_inode->i_ino, | ||
1248 | (unsigned long long)new_dir->i_ino); | ||
1249 | goto bail; | ||
1250 | } | ||
1137 | } | 1251 | } |
1138 | 1252 | ||
1139 | /* if old and new are the same, this'll just do one lock. */ | 1253 | /* if old and new are the same, this'll just do one lock. */ |
@@ -1304,6 +1418,7 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1304 | mlog_errno(status); | 1418 | mlog_errno(status); |
1305 | goto bail; | 1419 | goto bail; |
1306 | } | 1420 | } |
1421 | should_add_orphan = true; | ||
1307 | } | 1422 | } |
1308 | } else { | 1423 | } else { |
1309 | BUG_ON(new_dentry->d_parent->d_inode != new_dir); | 1424 | BUG_ON(new_dentry->d_parent->d_inode != new_dir); |
@@ -1348,17 +1463,6 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1348 | goto bail; | 1463 | goto bail; |
1349 | } | 1464 | } |
1350 | 1465 | ||
1351 | if (S_ISDIR(new_inode->i_mode) || | ||
1352 | (ocfs2_read_links_count(newfe) == 1)) { | ||
1353 | status = ocfs2_orphan_add(osb, handle, new_inode, | ||
1354 | newfe_bh, orphan_name, | ||
1355 | &orphan_insert, orphan_dir); | ||
1356 | if (status < 0) { | ||
1357 | mlog_errno(status); | ||
1358 | goto bail; | ||
1359 | } | ||
1360 | } | ||
1361 | |||
1362 | /* change the dirent to point to the correct inode */ | 1466 | /* change the dirent to point to the correct inode */ |
1363 | status = ocfs2_update_entry(new_dir, handle, &target_lookup_res, | 1467 | status = ocfs2_update_entry(new_dir, handle, &target_lookup_res, |
1364 | old_inode); | 1468 | old_inode); |
@@ -1373,6 +1477,15 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1373 | else | 1477 | else |
1374 | ocfs2_add_links_count(newfe, -1); | 1478 | ocfs2_add_links_count(newfe, -1); |
1375 | ocfs2_journal_dirty(handle, newfe_bh); | 1479 | ocfs2_journal_dirty(handle, newfe_bh); |
1480 | if (should_add_orphan) { | ||
1481 | status = ocfs2_orphan_add(osb, handle, new_inode, | ||
1482 | newfe_bh, orphan_name, | ||
1483 | &orphan_insert, orphan_dir); | ||
1484 | if (status < 0) { | ||
1485 | mlog_errno(status); | ||
1486 | goto bail; | ||
1487 | } | ||
1488 | } | ||
1376 | } else { | 1489 | } else { |
1377 | /* if the name was not found in new_dir, add it now */ | 1490 | /* if the name was not found in new_dir, add it now */ |
1378 | status = ocfs2_add_entry(handle, new_dentry, old_inode, | 1491 | status = ocfs2_add_entry(handle, new_dentry, old_inode, |
@@ -1642,6 +1755,7 @@ static int ocfs2_symlink(struct inode *dir, | |||
1642 | struct ocfs2_dir_lookup_result lookup = { NULL, }; | 1755 | struct ocfs2_dir_lookup_result lookup = { NULL, }; |
1643 | sigset_t oldset; | 1756 | sigset_t oldset; |
1644 | int did_block_signals = 0; | 1757 | int did_block_signals = 0; |
1758 | struct ocfs2_dentry_lock *dl = NULL; | ||
1645 | 1759 | ||
1646 | trace_ocfs2_symlink_begin(dir, dentry, symname, | 1760 | trace_ocfs2_symlink_begin(dir, dentry, symname, |
1647 | dentry->d_name.len, dentry->d_name.name); | 1761 | dentry->d_name.len, dentry->d_name.name); |
@@ -1830,6 +1944,8 @@ static int ocfs2_symlink(struct inode *dir, | |||
1830 | goto bail; | 1944 | goto bail; |
1831 | } | 1945 | } |
1832 | 1946 | ||
1947 | dl = dentry->d_fsdata; | ||
1948 | |||
1833 | status = ocfs2_add_entry(handle, dentry, inode, | 1949 | status = ocfs2_add_entry(handle, dentry, inode, |
1834 | le64_to_cpu(fe->i_blkno), parent_fe_bh, | 1950 | le64_to_cpu(fe->i_blkno), parent_fe_bh, |
1835 | &lookup); | 1951 | &lookup); |
@@ -1864,6 +1980,9 @@ bail: | |||
1864 | if (xattr_ac) | 1980 | if (xattr_ac) |
1865 | ocfs2_free_alloc_context(xattr_ac); | 1981 | ocfs2_free_alloc_context(xattr_ac); |
1866 | if ((status < 0) && inode) { | 1982 | if ((status < 0) && inode) { |
1983 | if (dl) | ||
1984 | ocfs2_cleanup_add_entry_failure(osb, dentry, inode); | ||
1985 | |||
1867 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SKIP_ORPHAN_DIR; | 1986 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SKIP_ORPHAN_DIR; |
1868 | clear_nlink(inode); | 1987 | clear_nlink(inode); |
1869 | iput(inode); | 1988 | iput(inode); |
diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h index 1b60c62aa9d6..6cb019b7c6a8 100644 --- a/fs/ocfs2/ocfs2_trace.h +++ b/fs/ocfs2/ocfs2_trace.h | |||
@@ -2292,6 +2292,8 @@ TRACE_EVENT(ocfs2_rename, | |||
2292 | __entry->new_len, __get_str(new_name)) | 2292 | __entry->new_len, __get_str(new_name)) |
2293 | ); | 2293 | ); |
2294 | 2294 | ||
2295 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_rename_not_permitted); | ||
2296 | |||
2295 | TRACE_EVENT(ocfs2_rename_target_exists, | 2297 | TRACE_EVENT(ocfs2_rename_target_exists, |
2296 | TP_PROTO(int new_len, const char *new_name), | 2298 | TP_PROTO(int new_len, const char *new_name), |
2297 | TP_ARGS(new_len, new_name), | 2299 | TP_ARGS(new_len, new_name), |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 714e53b9cc66..636aab69ead5 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -4288,9 +4288,16 @@ static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir, | |||
4288 | goto out; | 4288 | goto out; |
4289 | } | 4289 | } |
4290 | 4290 | ||
4291 | error = ocfs2_rw_lock(inode, 1); | ||
4292 | if (error) { | ||
4293 | mlog_errno(error); | ||
4294 | goto out; | ||
4295 | } | ||
4296 | |||
4291 | error = ocfs2_inode_lock(inode, &old_bh, 1); | 4297 | error = ocfs2_inode_lock(inode, &old_bh, 1); |
4292 | if (error) { | 4298 | if (error) { |
4293 | mlog_errno(error); | 4299 | mlog_errno(error); |
4300 | ocfs2_rw_unlock(inode, 1); | ||
4294 | goto out; | 4301 | goto out; |
4295 | } | 4302 | } |
4296 | 4303 | ||
@@ -4302,6 +4309,7 @@ static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir, | |||
4302 | up_write(&OCFS2_I(inode)->ip_xattr_sem); | 4309 | up_write(&OCFS2_I(inode)->ip_xattr_sem); |
4303 | 4310 | ||
4304 | ocfs2_inode_unlock(inode, 1); | 4311 | ocfs2_inode_unlock(inode, 1); |
4312 | ocfs2_rw_unlock(inode, 1); | ||
4305 | brelse(old_bh); | 4313 | brelse(old_bh); |
4306 | 4314 | ||
4307 | if (error) { | 4315 | if (error) { |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index c7a89cea5c5d..ddb662b32447 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1925,15 +1925,11 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) | |||
1925 | 1925 | ||
1926 | ocfs2_shutdown_local_alloc(osb); | 1926 | ocfs2_shutdown_local_alloc(osb); |
1927 | 1927 | ||
1928 | ocfs2_truncate_log_shutdown(osb); | ||
1929 | |||
1928 | /* This will disable recovery and flush any recovery work. */ | 1930 | /* This will disable recovery and flush any recovery work. */ |
1929 | ocfs2_recovery_exit(osb); | 1931 | ocfs2_recovery_exit(osb); |
1930 | 1932 | ||
1931 | /* | ||
1932 | * During dismount, when it recovers another node it will call | ||
1933 | * ocfs2_recover_orphans and queue delayed work osb_truncate_log_wq. | ||
1934 | */ | ||
1935 | ocfs2_truncate_log_shutdown(osb); | ||
1936 | |||
1937 | ocfs2_journal_shutdown(osb); | 1933 | ocfs2_journal_shutdown(osb); |
1938 | 1934 | ||
1939 | ocfs2_sync_blockdev(sb); | 1935 | ocfs2_sync_blockdev(sb); |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 9d231e9e5f0e..bf2d03f8fd3e 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -184,29 +184,11 @@ static int show_stat(struct seq_file *p, void *v) | |||
184 | 184 | ||
185 | static int stat_open(struct inode *inode, struct file *file) | 185 | static int stat_open(struct inode *inode, struct file *file) |
186 | { | 186 | { |
187 | size_t size = 1024 + 128 * num_possible_cpus(); | 187 | size_t size = 1024 + 128 * num_online_cpus(); |
188 | char *buf; | ||
189 | struct seq_file *m; | ||
190 | int res; | ||
191 | 188 | ||
192 | /* minimum size to display an interrupt count : 2 bytes */ | 189 | /* minimum size to display an interrupt count : 2 bytes */ |
193 | size += 2 * nr_irqs; | 190 | size += 2 * nr_irqs; |
194 | 191 | return single_open_size(file, show_stat, NULL, size); | |
195 | /* don't ask for more than the kmalloc() max size */ | ||
196 | if (size > KMALLOC_MAX_SIZE) | ||
197 | size = KMALLOC_MAX_SIZE; | ||
198 | buf = kmalloc(size, GFP_KERNEL); | ||
199 | if (!buf) | ||
200 | return -ENOMEM; | ||
201 | |||
202 | res = single_open(file, show_stat, NULL); | ||
203 | if (!res) { | ||
204 | m = file->private_data; | ||
205 | m->buf = buf; | ||
206 | m->size = ksize(buf); | ||
207 | } else | ||
208 | kfree(buf); | ||
209 | return res; | ||
210 | } | 192 | } |
211 | 193 | ||
212 | static const struct file_operations proc_stat_operations = { | 194 | static const struct file_operations proc_stat_operations = { |
diff --git a/fs/seq_file.c b/fs/seq_file.c index 1d641bb108d2..3857b720cb1b 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
@@ -8,8 +8,10 @@ | |||
8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
9 | #include <linux/export.h> | 9 | #include <linux/export.h> |
10 | #include <linux/seq_file.h> | 10 | #include <linux/seq_file.h> |
11 | #include <linux/vmalloc.h> | ||
11 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
12 | #include <linux/cred.h> | 13 | #include <linux/cred.h> |
14 | #include <linux/mm.h> | ||
13 | 15 | ||
14 | #include <asm/uaccess.h> | 16 | #include <asm/uaccess.h> |
15 | #include <asm/page.h> | 17 | #include <asm/page.h> |
@@ -30,6 +32,16 @@ static void seq_set_overflow(struct seq_file *m) | |||
30 | m->count = m->size; | 32 | m->count = m->size; |
31 | } | 33 | } |
32 | 34 | ||
35 | static void *seq_buf_alloc(unsigned long size) | ||
36 | { | ||
37 | void *buf; | ||
38 | |||
39 | buf = kmalloc(size, GFP_KERNEL | __GFP_NOWARN); | ||
40 | if (!buf && size > PAGE_SIZE) | ||
41 | buf = vmalloc(size); | ||
42 | return buf; | ||
43 | } | ||
44 | |||
33 | /** | 45 | /** |
34 | * seq_open - initialize sequential file | 46 | * seq_open - initialize sequential file |
35 | * @file: file we initialize | 47 | * @file: file we initialize |
@@ -96,7 +108,7 @@ static int traverse(struct seq_file *m, loff_t offset) | |||
96 | return 0; | 108 | return 0; |
97 | } | 109 | } |
98 | if (!m->buf) { | 110 | if (!m->buf) { |
99 | m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); | 111 | m->buf = seq_buf_alloc(m->size = PAGE_SIZE); |
100 | if (!m->buf) | 112 | if (!m->buf) |
101 | return -ENOMEM; | 113 | return -ENOMEM; |
102 | } | 114 | } |
@@ -135,9 +147,9 @@ static int traverse(struct seq_file *m, loff_t offset) | |||
135 | 147 | ||
136 | Eoverflow: | 148 | Eoverflow: |
137 | m->op->stop(m, p); | 149 | m->op->stop(m, p); |
138 | kfree(m->buf); | 150 | kvfree(m->buf); |
139 | m->count = 0; | 151 | m->count = 0; |
140 | m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); | 152 | m->buf = seq_buf_alloc(m->size <<= 1); |
141 | return !m->buf ? -ENOMEM : -EAGAIN; | 153 | return !m->buf ? -ENOMEM : -EAGAIN; |
142 | } | 154 | } |
143 | 155 | ||
@@ -192,7 +204,7 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
192 | 204 | ||
193 | /* grab buffer if we didn't have one */ | 205 | /* grab buffer if we didn't have one */ |
194 | if (!m->buf) { | 206 | if (!m->buf) { |
195 | m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); | 207 | m->buf = seq_buf_alloc(m->size = PAGE_SIZE); |
196 | if (!m->buf) | 208 | if (!m->buf) |
197 | goto Enomem; | 209 | goto Enomem; |
198 | } | 210 | } |
@@ -232,9 +244,9 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
232 | if (m->count < m->size) | 244 | if (m->count < m->size) |
233 | goto Fill; | 245 | goto Fill; |
234 | m->op->stop(m, p); | 246 | m->op->stop(m, p); |
235 | kfree(m->buf); | 247 | kvfree(m->buf); |
236 | m->count = 0; | 248 | m->count = 0; |
237 | m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); | 249 | m->buf = seq_buf_alloc(m->size <<= 1); |
238 | if (!m->buf) | 250 | if (!m->buf) |
239 | goto Enomem; | 251 | goto Enomem; |
240 | m->version = 0; | 252 | m->version = 0; |
@@ -350,7 +362,7 @@ EXPORT_SYMBOL(seq_lseek); | |||
350 | int seq_release(struct inode *inode, struct file *file) | 362 | int seq_release(struct inode *inode, struct file *file) |
351 | { | 363 | { |
352 | struct seq_file *m = file->private_data; | 364 | struct seq_file *m = file->private_data; |
353 | kfree(m->buf); | 365 | kvfree(m->buf); |
354 | kfree(m); | 366 | kfree(m); |
355 | return 0; | 367 | return 0; |
356 | } | 368 | } |
@@ -605,13 +617,13 @@ EXPORT_SYMBOL(single_open); | |||
605 | int single_open_size(struct file *file, int (*show)(struct seq_file *, void *), | 617 | int single_open_size(struct file *file, int (*show)(struct seq_file *, void *), |
606 | void *data, size_t size) | 618 | void *data, size_t size) |
607 | { | 619 | { |
608 | char *buf = kmalloc(size, GFP_KERNEL); | 620 | char *buf = seq_buf_alloc(size); |
609 | int ret; | 621 | int ret; |
610 | if (!buf) | 622 | if (!buf) |
611 | return -ENOMEM; | 623 | return -ENOMEM; |
612 | ret = single_open(file, show, data); | 624 | ret = single_open(file, show, data); |
613 | if (ret) { | 625 | if (ret) { |
614 | kfree(buf); | 626 | kvfree(buf); |
615 | return ret; | 627 | return ret; |
616 | } | 628 | } |
617 | ((struct seq_file *)file->private_data)->buf = buf; | 629 | ((struct seq_file *)file->private_data)->buf = buf; |
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 6eb1d3cb5104..9b9b6f29bbf3 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -53,7 +53,7 @@ struct acpi_power_register { | |||
53 | u8 bit_offset; | 53 | u8 bit_offset; |
54 | u8 access_size; | 54 | u8 access_size; |
55 | u64 address; | 55 | u64 address; |
56 | } __attribute__ ((packed)); | 56 | } __packed; |
57 | 57 | ||
58 | struct acpi_processor_cx { | 58 | struct acpi_processor_cx { |
59 | u8 valid; | 59 | u8 valid; |
@@ -83,7 +83,7 @@ struct acpi_psd_package { | |||
83 | u64 domain; | 83 | u64 domain; |
84 | u64 coord_type; | 84 | u64 coord_type; |
85 | u64 num_processors; | 85 | u64 num_processors; |
86 | } __attribute__ ((packed)); | 86 | } __packed; |
87 | 87 | ||
88 | struct acpi_pct_register { | 88 | struct acpi_pct_register { |
89 | u8 descriptor; | 89 | u8 descriptor; |
@@ -93,7 +93,7 @@ struct acpi_pct_register { | |||
93 | u8 bit_offset; | 93 | u8 bit_offset; |
94 | u8 reserved; | 94 | u8 reserved; |
95 | u64 address; | 95 | u64 address; |
96 | } __attribute__ ((packed)); | 96 | } __packed; |
97 | 97 | ||
98 | struct acpi_processor_px { | 98 | struct acpi_processor_px { |
99 | u64 core_frequency; /* megahertz */ | 99 | u64 core_frequency; /* megahertz */ |
@@ -124,7 +124,7 @@ struct acpi_tsd_package { | |||
124 | u64 domain; | 124 | u64 domain; |
125 | u64 coord_type; | 125 | u64 coord_type; |
126 | u64 num_processors; | 126 | u64 num_processors; |
127 | } __attribute__ ((packed)); | 127 | } __packed; |
128 | 128 | ||
129 | struct acpi_ptc_register { | 129 | struct acpi_ptc_register { |
130 | u8 descriptor; | 130 | u8 descriptor; |
@@ -134,7 +134,7 @@ struct acpi_ptc_register { | |||
134 | u8 bit_offset; | 134 | u8 bit_offset; |
135 | u8 reserved; | 135 | u8 reserved; |
136 | u64 address; | 136 | u64 address; |
137 | } __attribute__ ((packed)); | 137 | } __packed; |
138 | 138 | ||
139 | struct acpi_processor_tx_tss { | 139 | struct acpi_processor_tx_tss { |
140 | u64 freqpercentage; /* */ | 140 | u64 freqpercentage; /* */ |
diff --git a/include/acpi/video.h b/include/acpi/video.h index ea4c7bbded4d..843ef1adfbfa 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h | |||
@@ -22,6 +22,7 @@ extern void acpi_video_unregister(void); | |||
22 | extern void acpi_video_unregister_backlight(void); | 22 | extern void acpi_video_unregister_backlight(void); |
23 | extern int acpi_video_get_edid(struct acpi_device *device, int type, | 23 | extern int acpi_video_get_edid(struct acpi_device *device, int type, |
24 | int device_id, void **edid); | 24 | int device_id, void **edid); |
25 | extern bool acpi_video_verify_backlight_support(void); | ||
25 | #else | 26 | #else |
26 | static inline int acpi_video_register(void) { return 0; } | 27 | static inline int acpi_video_register(void) { return 0; } |
27 | static inline void acpi_video_unregister(void) { return; } | 28 | static inline void acpi_video_unregister(void) { return; } |
@@ -31,6 +32,7 @@ static inline int acpi_video_get_edid(struct acpi_device *device, int type, | |||
31 | { | 32 | { |
32 | return -ENODEV; | 33 | return -ENODEV; |
33 | } | 34 | } |
35 | static inline bool acpi_video_verify_backlight_support(void) { return false; } | ||
34 | #endif | 36 | #endif |
35 | 37 | ||
36 | #endif | 38 | #endif |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 471ba48c7ae4..c1c0b0cf39b4 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -693,7 +693,7 @@ | |||
693 | . = ALIGN(PAGE_SIZE); \ | 693 | . = ALIGN(PAGE_SIZE); \ |
694 | *(.data..percpu..page_aligned) \ | 694 | *(.data..percpu..page_aligned) \ |
695 | . = ALIGN(cacheline); \ | 695 | . = ALIGN(cacheline); \ |
696 | *(.data..percpu..readmostly) \ | 696 | *(.data..percpu..read_mostly) \ |
697 | . = ALIGN(cacheline); \ | 697 | . = ALIGN(cacheline); \ |
698 | *(.data..percpu) \ | 698 | *(.data..percpu) \ |
699 | *(.data..percpu..shared_aligned) \ | 699 | *(.data..percpu..shared_aligned) \ |
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h index 0572035673f3..a70d45647898 100644 --- a/include/drm/i915_pciids.h +++ b/include/drm/i915_pciids.h | |||
@@ -237,13 +237,21 @@ | |||
237 | #define INTEL_BDW_GT3D_IDS(info) \ | 237 | #define INTEL_BDW_GT3D_IDS(info) \ |
238 | _INTEL_BDW_D_IDS(3, info) | 238 | _INTEL_BDW_D_IDS(3, info) |
239 | 239 | ||
240 | #define INTEL_BDW_RSVDM_IDS(info) \ | ||
241 | _INTEL_BDW_M_IDS(4, info) | ||
242 | |||
243 | #define INTEL_BDW_RSVDD_IDS(info) \ | ||
244 | _INTEL_BDW_D_IDS(4, info) | ||
245 | |||
240 | #define INTEL_BDW_M_IDS(info) \ | 246 | #define INTEL_BDW_M_IDS(info) \ |
241 | INTEL_BDW_GT12M_IDS(info), \ | 247 | INTEL_BDW_GT12M_IDS(info), \ |
242 | INTEL_BDW_GT3M_IDS(info) | 248 | INTEL_BDW_GT3M_IDS(info), \ |
249 | INTEL_BDW_RSVDM_IDS(info) | ||
243 | 250 | ||
244 | #define INTEL_BDW_D_IDS(info) \ | 251 | #define INTEL_BDW_D_IDS(info) \ |
245 | INTEL_BDW_GT12D_IDS(info), \ | 252 | INTEL_BDW_GT12D_IDS(info), \ |
246 | INTEL_BDW_GT3D_IDS(info) | 253 | INTEL_BDW_GT3D_IDS(info), \ |
254 | INTEL_BDW_RSVDD_IDS(info) | ||
247 | 255 | ||
248 | #define INTEL_CHV_IDS(info) \ | 256 | #define INTEL_CHV_IDS(info) \ |
249 | INTEL_VGA_DEVICE(0x22b0, info), \ | 257 | INTEL_VGA_DEVICE(0x22b0, info), \ |
diff --git a/include/drm/i915_powerwell.h b/include/drm/i915_powerwell.h index cfdc884405b7..baa6f11b1837 100644 --- a/include/drm/i915_powerwell.h +++ b/include/drm/i915_powerwell.h | |||
@@ -30,7 +30,8 @@ | |||
30 | #define _I915_POWERWELL_H_ | 30 | #define _I915_POWERWELL_H_ |
31 | 31 | ||
32 | /* For use by hda_i915 driver */ | 32 | /* For use by hda_i915 driver */ |
33 | extern void i915_request_power_well(void); | 33 | extern int i915_request_power_well(void); |
34 | extern void i915_release_power_well(void); | 34 | extern int i915_release_power_well(void); |
35 | extern int i915_get_cdclk_freq(void); | ||
35 | 36 | ||
36 | #endif /* _I915_POWERWELL_H_ */ | 37 | #endif /* _I915_POWERWELL_H_ */ |
diff --git a/include/dt-bindings/clock/exynos5420.h b/include/dt-bindings/clock/exynos5420.h index 97dcb89d37d3..21d51ae1d242 100644 --- a/include/dt-bindings/clock/exynos5420.h +++ b/include/dt-bindings/clock/exynos5420.h | |||
@@ -63,7 +63,6 @@ | |||
63 | #define CLK_SCLK_MPHY_IXTAL24 161 | 63 | #define CLK_SCLK_MPHY_IXTAL24 161 |
64 | 64 | ||
65 | /* gate clocks */ | 65 | /* gate clocks */ |
66 | #define CLK_ACLK66_PERIC 256 | ||
67 | #define CLK_UART0 257 | 66 | #define CLK_UART0 257 |
68 | #define CLK_UART1 258 | 67 | #define CLK_UART1 258 |
69 | #define CLK_UART2 259 | 68 | #define CLK_UART2 259 |
@@ -203,6 +202,8 @@ | |||
203 | #define CLK_MOUT_G3D 641 | 202 | #define CLK_MOUT_G3D 641 |
204 | #define CLK_MOUT_VPLL 642 | 203 | #define CLK_MOUT_VPLL 642 |
205 | #define CLK_MOUT_MAUDIO0 643 | 204 | #define CLK_MOUT_MAUDIO0 643 |
205 | #define CLK_MOUT_USER_ACLK333 644 | ||
206 | #define CLK_MOUT_SW_ACLK333 645 | ||
206 | 207 | ||
207 | /* divider clocks */ | 208 | /* divider clocks */ |
208 | #define CLK_DOUT_PIXEL 768 | 209 | #define CLK_DOUT_PIXEL 768 |
diff --git a/include/dt-bindings/clock/imx6sl-clock.h b/include/dt-bindings/clock/imx6sl-clock.h index 7cf5c9969336..b91dd462ba85 100644 --- a/include/dt-bindings/clock/imx6sl-clock.h +++ b/include/dt-bindings/clock/imx6sl-clock.h | |||
@@ -145,6 +145,7 @@ | |||
145 | #define IMX6SL_CLK_USDHC4 132 | 145 | #define IMX6SL_CLK_USDHC4 132 |
146 | #define IMX6SL_CLK_PLL4_AUDIO_DIV 133 | 146 | #define IMX6SL_CLK_PLL4_AUDIO_DIV 133 |
147 | #define IMX6SL_CLK_SPBA 134 | 147 | #define IMX6SL_CLK_SPBA 134 |
148 | #define IMX6SL_CLK_END 135 | 148 | #define IMX6SL_CLK_ENET 135 |
149 | #define IMX6SL_CLK_END 136 | ||
149 | 150 | ||
150 | #endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */ | 151 | #endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */ |
diff --git a/include/dt-bindings/clock/stih415-clks.h b/include/dt-bindings/clock/stih415-clks.h index 0d2c7397e028..d80caa68aebd 100644 --- a/include/dt-bindings/clock/stih415-clks.h +++ b/include/dt-bindings/clock/stih415-clks.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define CLK_ETH1_PHY 4 | 10 | #define CLK_ETH1_PHY 4 |
11 | 11 | ||
12 | /* CLOCKGEN A1 */ | 12 | /* CLOCKGEN A1 */ |
13 | #define CLK_ICN_IF_2 0 | ||
13 | #define CLK_GMAC0_PHY 3 | 14 | #define CLK_GMAC0_PHY 3 |
14 | 15 | ||
15 | #endif | 16 | #endif |
diff --git a/include/dt-bindings/clock/stih416-clks.h b/include/dt-bindings/clock/stih416-clks.h index 552c779eb6af..f9bdbd13568d 100644 --- a/include/dt-bindings/clock/stih416-clks.h +++ b/include/dt-bindings/clock/stih416-clks.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define CLK_ETH1_PHY 4 | 10 | #define CLK_ETH1_PHY 4 |
11 | 11 | ||
12 | /* CLOCKGEN A1 */ | 12 | /* CLOCKGEN A1 */ |
13 | #define CLK_ICN_IF_2 0 | ||
13 | #define CLK_GMAC0_PHY 3 | 14 | #define CLK_GMAC0_PHY 3 |
14 | 15 | ||
15 | #endif | 16 | #endif |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 5a645769f020..d2633ee099d9 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -186,6 +186,15 @@ static inline void *bio_data(struct bio *bio) | |||
186 | #define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ | 186 | #define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ |
187 | __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q))) | 187 | __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q))) |
188 | 188 | ||
189 | /* | ||
190 | * Check if adding a bio_vec after bprv with offset would create a gap in | ||
191 | * the SG list. Most drivers don't care about this, but some do. | ||
192 | */ | ||
193 | static inline bool bvec_gap_to_prev(struct bio_vec *bprv, unsigned int offset) | ||
194 | { | ||
195 | return offset || ((bprv->bv_offset + bprv->bv_len) & (PAGE_SIZE - 1)); | ||
196 | } | ||
197 | |||
189 | #define bio_io_error(bio) bio_endio((bio), -EIO) | 198 | #define bio_io_error(bio) bio_endio((bio), -EIO) |
190 | 199 | ||
191 | /* | 200 | /* |
@@ -644,10 +653,6 @@ struct biovec_slab { | |||
644 | 653 | ||
645 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | 654 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
646 | 655 | ||
647 | |||
648 | |||
649 | #define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) | ||
650 | |||
651 | #define bip_for_each_vec(bvl, bip, iter) \ | 656 | #define bip_for_each_vec(bvl, bip, iter) \ |
652 | for_each_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter) | 657 | for_each_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter) |
653 | 658 | ||
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index a002cf191427..eb726b9c5762 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h | |||
@@ -42,7 +42,7 @@ struct blk_mq_hw_ctx { | |||
42 | unsigned int nr_ctx; | 42 | unsigned int nr_ctx; |
43 | struct blk_mq_ctx **ctxs; | 43 | struct blk_mq_ctx **ctxs; |
44 | 44 | ||
45 | unsigned int wait_index; | 45 | atomic_t wait_index; |
46 | 46 | ||
47 | struct blk_mq_tags *tags; | 47 | struct blk_mq_tags *tags; |
48 | 48 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 31e11051f1ba..8699bcf5f099 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -512,6 +512,7 @@ struct request_queue { | |||
512 | #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ | 512 | #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ |
513 | #define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ | 513 | #define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ |
514 | #define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/ | 514 | #define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/ |
515 | #define QUEUE_FLAG_SG_GAPS 22 /* queue doesn't support SG gaps */ | ||
515 | 516 | ||
516 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 517 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
517 | (1 << QUEUE_FLAG_STACKABLE) | \ | 518 | (1 << QUEUE_FLAG_STACKABLE) | \ |
@@ -920,7 +921,7 @@ static inline unsigned int blk_max_size_offset(struct request_queue *q, | |||
920 | sector_t offset) | 921 | sector_t offset) |
921 | { | 922 | { |
922 | if (!q->limits.chunk_sectors) | 923 | if (!q->limits.chunk_sectors) |
923 | return q->limits.max_hw_sectors; | 924 | return q->limits.max_sectors; |
924 | 925 | ||
925 | return q->limits.chunk_sectors - | 926 | return q->limits.chunk_sectors - |
926 | (offset & (q->limits.chunk_sectors - 1)); | 927 | (offset & (q->limits.chunk_sectors - 1)); |
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index 4ff262e2bf37..45a91474487d 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h | |||
@@ -133,7 +133,6 @@ extern struct request *elv_latter_request(struct request_queue *, struct request | |||
133 | extern int elv_register_queue(struct request_queue *q); | 133 | extern int elv_register_queue(struct request_queue *q); |
134 | extern void elv_unregister_queue(struct request_queue *q); | 134 | extern void elv_unregister_queue(struct request_queue *q); |
135 | extern int elv_may_queue(struct request_queue *, int); | 135 | extern int elv_may_queue(struct request_queue *, int); |
136 | extern void elv_abort_queue(struct request_queue *); | ||
137 | extern void elv_completed_request(struct request_queue *, struct request *); | 136 | extern void elv_completed_request(struct request_queue *, struct request *); |
138 | extern int elv_set_request(struct request_queue *q, struct request *rq, | 137 | extern int elv_set_request(struct request_queue *q, struct request *rq, |
139 | struct bio *bio, gfp_t gfp_mask); | 138 | struct bio *bio, gfp_t gfp_mask); |
@@ -144,7 +143,7 @@ extern void elv_drain_elevator(struct request_queue *); | |||
144 | * io scheduler registration | 143 | * io scheduler registration |
145 | */ | 144 | */ |
146 | extern void __init load_default_elevator_module(void); | 145 | extern void __init load_default_elevator_module(void); |
147 | extern int __init elv_register(struct elevator_type *); | 146 | extern int elv_register(struct elevator_type *); |
148 | extern void elv_unregister(struct elevator_type *); | 147 | extern void elv_unregister(struct elevator_type *); |
149 | 148 | ||
150 | /* | 149 | /* |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 338e6f758c6d..e11d60cc867b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1921,6 +1921,12 @@ static inline int break_lease(struct inode *inode, unsigned int mode) | |||
1921 | 1921 | ||
1922 | static inline int break_deleg(struct inode *inode, unsigned int mode) | 1922 | static inline int break_deleg(struct inode *inode, unsigned int mode) |
1923 | { | 1923 | { |
1924 | /* | ||
1925 | * Since this check is lockless, we must ensure that any refcounts | ||
1926 | * taken are done before checking inode->i_flock. Otherwise, we could | ||
1927 | * end up racing with tasks trying to set a new lease on this file. | ||
1928 | */ | ||
1929 | smp_mb(); | ||
1924 | if (inode->i_flock) | 1930 | if (inode->i_flock) |
1925 | return __break_lease(inode, mode, FL_DELEG); | 1931 | return __break_lease(inode, mode, FL_DELEG); |
1926 | return 0; | 1932 | return 0; |
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 17aa1cce6f8e..30faf797c2c3 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h | |||
@@ -91,6 +91,7 @@ struct kernfs_elem_attr { | |||
91 | const struct kernfs_ops *ops; | 91 | const struct kernfs_ops *ops; |
92 | struct kernfs_open_node *open; | 92 | struct kernfs_open_node *open; |
93 | loff_t size; | 93 | loff_t size; |
94 | struct kernfs_node *notify_next; /* for kernfs_notify() */ | ||
94 | }; | 95 | }; |
95 | 96 | ||
96 | /* | 97 | /* |
@@ -304,6 +305,7 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | |||
304 | struct kernfs_root *root, unsigned long magic, | 305 | struct kernfs_root *root, unsigned long magic, |
305 | bool *new_sb_created, const void *ns); | 306 | bool *new_sb_created, const void *ns); |
306 | void kernfs_kill_sb(struct super_block *sb); | 307 | void kernfs_kill_sb(struct super_block *sb); |
308 | struct super_block *kernfs_pin_sb(struct kernfs_root *root, const void *ns); | ||
307 | 309 | ||
308 | void kernfs_init(void); | 310 | void kernfs_init(void); |
309 | 311 | ||
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 6a45fb583ff1..447775ee2c4b 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
@@ -32,15 +32,24 @@ static inline void touch_nmi_watchdog(void) | |||
32 | #ifdef arch_trigger_all_cpu_backtrace | 32 | #ifdef arch_trigger_all_cpu_backtrace |
33 | static inline bool trigger_all_cpu_backtrace(void) | 33 | static inline bool trigger_all_cpu_backtrace(void) |
34 | { | 34 | { |
35 | arch_trigger_all_cpu_backtrace(); | 35 | arch_trigger_all_cpu_backtrace(true); |
36 | 36 | ||
37 | return true; | 37 | return true; |
38 | } | 38 | } |
39 | static inline bool trigger_allbutself_cpu_backtrace(void) | ||
40 | { | ||
41 | arch_trigger_all_cpu_backtrace(false); | ||
42 | return true; | ||
43 | } | ||
39 | #else | 44 | #else |
40 | static inline bool trigger_all_cpu_backtrace(void) | 45 | static inline bool trigger_all_cpu_backtrace(void) |
41 | { | 46 | { |
42 | return false; | 47 | return false; |
43 | } | 48 | } |
49 | static inline bool trigger_allbutself_cpu_backtrace(void) | ||
50 | { | ||
51 | return false; | ||
52 | } | ||
44 | #endif | 53 | #endif |
45 | 54 | ||
46 | #ifdef CONFIG_LOCKUP_DETECTOR | 55 | #ifdef CONFIG_LOCKUP_DETECTOR |
@@ -48,6 +57,7 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *); | |||
48 | u64 hw_nmi_get_sample_period(int watchdog_thresh); | 57 | u64 hw_nmi_get_sample_period(int watchdog_thresh); |
49 | extern int watchdog_user_enabled; | 58 | extern int watchdog_user_enabled; |
50 | extern int watchdog_thresh; | 59 | extern int watchdog_thresh; |
60 | extern int sysctl_softlockup_all_cpu_backtrace; | ||
51 | struct ctl_table; | 61 | struct ctl_table; |
52 | extern int proc_dowatchdog(struct ctl_table *, int , | 62 | extern int proc_dowatchdog(struct ctl_table *, int , |
53 | void __user *, size_t *, loff_t *); | 63 | void __user *, size_t *, loff_t *); |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 3c545b48aeab..8304959ad336 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -360,6 +360,9 @@ static inline void ClearPageCompound(struct page *page) | |||
360 | ClearPageHead(page); | 360 | ClearPageHead(page); |
361 | } | 361 | } |
362 | #endif | 362 | #endif |
363 | |||
364 | #define PG_head_mask ((1L << PG_head)) | ||
365 | |||
363 | #else | 366 | #else |
364 | /* | 367 | /* |
365 | * Reduce page flag use as much as possible by overlapping | 368 | * Reduce page flag use as much as possible by overlapping |
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index a5fc7d01aad6..dec01d6c3f80 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h | |||
@@ -146,10 +146,10 @@ | |||
146 | * Declaration/definition used for per-CPU variables that must be read mostly. | 146 | * Declaration/definition used for per-CPU variables that must be read mostly. |
147 | */ | 147 | */ |
148 | #define DECLARE_PER_CPU_READ_MOSTLY(type, name) \ | 148 | #define DECLARE_PER_CPU_READ_MOSTLY(type, name) \ |
149 | DECLARE_PER_CPU_SECTION(type, name, "..readmostly") | 149 | DECLARE_PER_CPU_SECTION(type, name, "..read_mostly") |
150 | 150 | ||
151 | #define DEFINE_PER_CPU_READ_MOSTLY(type, name) \ | 151 | #define DEFINE_PER_CPU_READ_MOSTLY(type, name) \ |
152 | DEFINE_PER_CPU_SECTION(type, name, "..readmostly") | 152 | DEFINE_PER_CPU_SECTION(type, name, "..read_mostly") |
153 | 153 | ||
154 | /* | 154 | /* |
155 | * Intermodule exports for per-CPU variables. sparse forgets about | 155 | * Intermodule exports for per-CPU variables. sparse forgets about |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 864ddafad8cc..68041446c450 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -536,6 +536,15 @@ struct phy_driver { | |||
536 | /* See set_wol, but for checking whether Wake on LAN is enabled. */ | 536 | /* See set_wol, but for checking whether Wake on LAN is enabled. */ |
537 | void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); | 537 | void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); |
538 | 538 | ||
539 | /* | ||
540 | * Called to inform a PHY device driver when the core is about to | ||
541 | * change the link state. This callback is supposed to be used as | ||
542 | * fixup hook for drivers that need to take action when the link | ||
543 | * state changes. Drivers are by no means allowed to mess with the | ||
544 | * PHY device structure in their implementations. | ||
545 | */ | ||
546 | void (*link_change_notify)(struct phy_device *dev); | ||
547 | |||
539 | struct device_driver driver; | 548 | struct device_driver driver; |
540 | }; | 549 | }; |
541 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) | 550 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) |
diff --git a/include/linux/profile.h b/include/linux/profile.h index aaad3861beb8..b537a25ffa17 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h | |||
@@ -44,6 +44,7 @@ extern int prof_on __read_mostly; | |||
44 | int profile_init(void); | 44 | int profile_init(void); |
45 | int profile_setup(char *str); | 45 | int profile_setup(char *str); |
46 | void profile_tick(int type); | 46 | void profile_tick(int type); |
47 | int setup_profiling_timer(unsigned int multiplier); | ||
47 | 48 | ||
48 | /* | 49 | /* |
49 | * Add multiple profiler hits to a given address: | 50 | * Add multiple profiler hits to a given address: |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 077904c8b70d..cc79eff4a1ad 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -334,6 +334,9 @@ static inline void user_single_step_siginfo(struct task_struct *tsk, | |||
334 | * calling arch_ptrace_stop() when it would be superfluous. For example, | 334 | * calling arch_ptrace_stop() when it would be superfluous. For example, |
335 | * if the thread has not been back to user mode since the last stop, the | 335 | * if the thread has not been back to user mode since the last stop, the |
336 | * thread state might indicate that nothing needs to be done. | 336 | * thread state might indicate that nothing needs to be done. |
337 | * | ||
338 | * This is guaranteed to be invoked once before a task stops for ptrace and | ||
339 | * may include arch-specific operations necessary prior to a ptrace stop. | ||
337 | */ | 340 | */ |
338 | #define arch_ptrace_stop_needed(code, info) (0) | 341 | #define arch_ptrace_stop_needed(code, info) (0) |
339 | #endif | 342 | #endif |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index a2d9d81038d1..14ec18d5e18b 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
@@ -395,6 +395,11 @@ static inline void regulator_bulk_free(int num_consumers, | |||
395 | { | 395 | { |
396 | } | 396 | } |
397 | 397 | ||
398 | static inline int regulator_can_change_voltage(struct regulator *regulator) | ||
399 | { | ||
400 | return 0; | ||
401 | } | ||
402 | |||
398 | static inline int regulator_set_voltage(struct regulator *regulator, | 403 | static inline int regulator_set_voltage(struct regulator *regulator, |
399 | int min_uV, int max_uV) | 404 | int min_uV, int max_uV) |
400 | { | 405 | { |
diff --git a/include/linux/socket.h b/include/linux/socket.h index 8e98297f1388..ec538fc287a6 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -305,8 +305,6 @@ struct ucred { | |||
305 | /* IPX options */ | 305 | /* IPX options */ |
306 | #define IPX_TYPE 1 | 306 | #define IPX_TYPE 1 |
307 | 307 | ||
308 | extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, | ||
309 | int offset, int len); | ||
310 | extern int csum_partial_copy_fromiovecend(unsigned char *kdata, | 308 | extern int csum_partial_copy_fromiovecend(unsigned char *kdata, |
311 | struct iovec *iov, | 309 | struct iovec *iov, |
312 | int offset, | 310 | int offset, |
@@ -315,8 +313,6 @@ extern unsigned long iov_pages(const struct iovec *iov, int offset, | |||
315 | unsigned long nr_segs); | 313 | unsigned long nr_segs); |
316 | 314 | ||
317 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode); | 315 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode); |
318 | extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, | ||
319 | int offset, int len); | ||
320 | extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); | 316 | extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); |
321 | extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); | 317 | extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); |
322 | 318 | ||
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index f76994b9396c..519064e0c943 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -327,6 +327,7 @@ extern unsigned long get_safe_page(gfp_t gfp_mask); | |||
327 | extern void hibernation_set_ops(const struct platform_hibernation_ops *ops); | 327 | extern void hibernation_set_ops(const struct platform_hibernation_ops *ops); |
328 | extern int hibernate(void); | 328 | extern int hibernate(void); |
329 | extern bool system_entering_hibernation(void); | 329 | extern bool system_entering_hibernation(void); |
330 | extern bool hibernation_available(void); | ||
330 | asmlinkage int swsusp_save(void); | 331 | asmlinkage int swsusp_save(void); |
331 | extern struct pbe *restore_pblist; | 332 | extern struct pbe *restore_pblist; |
332 | #else /* CONFIG_HIBERNATION */ | 333 | #else /* CONFIG_HIBERNATION */ |
@@ -339,6 +340,7 @@ static inline void swsusp_unset_page_free(struct page *p) {} | |||
339 | static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {} | 340 | static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {} |
340 | static inline int hibernate(void) { return -ENOSYS; } | 341 | static inline int hibernate(void) { return -ENOSYS; } |
341 | static inline bool system_entering_hibernation(void) { return false; } | 342 | static inline bool system_entering_hibernation(void) { return false; } |
343 | static inline bool hibernation_available(void) { return false; } | ||
342 | #endif /* CONFIG_HIBERNATION */ | 344 | #endif /* CONFIG_HIBERNATION */ |
343 | 345 | ||
344 | /* Hibernation and suspend events */ | 346 | /* Hibernation and suspend events */ |
diff --git a/include/linux/uio.h b/include/linux/uio.h index e2231e47cec1..09a7cffc224e 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
@@ -94,8 +94,20 @@ static inline size_t iov_iter_count(struct iov_iter *i) | |||
94 | return i->count; | 94 | return i->count; |
95 | } | 95 | } |
96 | 96 | ||
97 | static inline void iov_iter_truncate(struct iov_iter *i, size_t count) | 97 | /* |
98 | * Cap the iov_iter by given limit; note that the second argument is | ||
99 | * *not* the new size - it's upper limit for such. Passing it a value | ||
100 | * greater than the amount of data in iov_iter is fine - it'll just do | ||
101 | * nothing in that case. | ||
102 | */ | ||
103 | static inline void iov_iter_truncate(struct iov_iter *i, u64 count) | ||
98 | { | 104 | { |
105 | /* | ||
106 | * count doesn't have to fit in size_t - comparison extends both | ||
107 | * operands to u64 here and any value that would be truncated by | ||
108 | * conversion in assignement is by definition greater than all | ||
109 | * values of size_t, including old i->count. | ||
110 | */ | ||
99 | if (i->count > count) | 111 | if (i->count > count) |
100 | i->count = count; | 112 | i->count = count; |
101 | } | 113 | } |
@@ -111,6 +123,9 @@ static inline void iov_iter_reexpand(struct iov_iter *i, size_t count) | |||
111 | 123 | ||
112 | int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); | 124 | int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); |
113 | int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); | 125 | int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); |
114 | 126 | int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, | |
127 | int offset, int len); | ||
128 | int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, | ||
129 | int offset, int len); | ||
115 | 130 | ||
116 | #endif | 131 | #endif |
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index 1a64b26046ed..9b7de1b46437 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h | |||
@@ -70,7 +70,9 @@ | |||
70 | US_FLAG(NEEDS_CAP16, 0x00400000) \ | 70 | US_FLAG(NEEDS_CAP16, 0x00400000) \ |
71 | /* cannot handle READ_CAPACITY_10 */ \ | 71 | /* cannot handle READ_CAPACITY_10 */ \ |
72 | US_FLAG(IGNORE_UAS, 0x00800000) \ | 72 | US_FLAG(IGNORE_UAS, 0x00800000) \ |
73 | /* Device advertises UAS but it is broken */ | 73 | /* Device advertises UAS but it is broken */ \ |
74 | US_FLAG(BROKEN_FUA, 0x01000000) \ | ||
75 | /* Cannot handle FUA in WRITE or READ CDBs */ \ | ||
74 | 76 | ||
75 | #define US_FLAG(name, value) US_FL_##name = value , | 77 | #define US_FLAG(name, value) US_FL_##name = value , |
76 | enum { US_DO_ALL_FLAGS }; | 78 | enum { US_DO_ALL_FLAGS }; |
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 7ee6ce6564ae..713b0b88bd5a 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
@@ -503,9 +503,9 @@ enum nft_chain_flags { | |||
503 | * @net: net namespace that this chain belongs to | 503 | * @net: net namespace that this chain belongs to |
504 | * @table: table that this chain belongs to | 504 | * @table: table that this chain belongs to |
505 | * @handle: chain handle | 505 | * @handle: chain handle |
506 | * @flags: bitmask of enum nft_chain_flags | ||
507 | * @use: number of jump references to this chain | 506 | * @use: number of jump references to this chain |
508 | * @level: length of longest path to this chain | 507 | * @level: length of longest path to this chain |
508 | * @flags: bitmask of enum nft_chain_flags | ||
509 | * @name: name of the chain | 509 | * @name: name of the chain |
510 | */ | 510 | */ |
511 | struct nft_chain { | 511 | struct nft_chain { |
@@ -514,9 +514,9 @@ struct nft_chain { | |||
514 | struct net *net; | 514 | struct net *net; |
515 | struct nft_table *table; | 515 | struct nft_table *table; |
516 | u64 handle; | 516 | u64 handle; |
517 | u8 flags; | 517 | u32 use; |
518 | u16 use; | ||
519 | u16 level; | 518 | u16 level; |
519 | u8 flags; | ||
520 | char name[NFT_CHAIN_MAXNAMELEN]; | 520 | char name[NFT_CHAIN_MAXNAMELEN]; |
521 | }; | 521 | }; |
522 | 522 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index 07b7fcd60d80..173cae485de1 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1730,8 +1730,8 @@ sk_dst_get(struct sock *sk) | |||
1730 | 1730 | ||
1731 | rcu_read_lock(); | 1731 | rcu_read_lock(); |
1732 | dst = rcu_dereference(sk->sk_dst_cache); | 1732 | dst = rcu_dereference(sk->sk_dst_cache); |
1733 | if (dst) | 1733 | if (dst && !atomic_inc_not_zero(&dst->__refcnt)) |
1734 | dst_hold(dst); | 1734 | dst = NULL; |
1735 | rcu_read_unlock(); | 1735 | rcu_read_unlock(); |
1736 | return dst; | 1736 | return dst; |
1737 | } | 1737 | } |
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 42ed789ebafc..e0ae71098144 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -318,7 +318,7 @@ static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) | |||
318 | 318 | ||
319 | static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd) | 319 | static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd) |
320 | { | 320 | { |
321 | unsigned int xfer_len = blk_rq_bytes(scmd->request); | 321 | unsigned int xfer_len = scsi_out(scmd)->length; |
322 | unsigned int prot_op = scsi_get_prot_op(scmd); | 322 | unsigned int prot_op = scsi_get_prot_op(scmd); |
323 | unsigned int sector_size = scmd->device->sector_size; | 323 | unsigned int sector_size = scmd->device->sector_size; |
324 | 324 | ||
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 5853c913d2b0..27ab31017f09 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -173,6 +173,7 @@ struct scsi_device { | |||
173 | unsigned is_visible:1; /* is the device visible in sysfs */ | 173 | unsigned is_visible:1; /* is the device visible in sysfs */ |
174 | unsigned wce_default_on:1; /* Cache is ON by default */ | 174 | unsigned wce_default_on:1; /* Cache is ON by default */ |
175 | unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ | 175 | unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ |
176 | unsigned broken_fua:1; /* Don't set FUA bit */ | ||
176 | 177 | ||
177 | atomic_t disk_events_disable_depth; /* disable depth for disk events */ | 178 | atomic_t disk_events_disable_depth; /* disable depth for disk events */ |
178 | 179 | ||
diff --git a/include/sound/core.h b/include/sound/core.h index eedda2cdfe57..1df3f2fe5350 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -116,6 +116,8 @@ struct snd_card { | |||
116 | int user_ctl_count; /* count of all user controls */ | 116 | int user_ctl_count; /* count of all user controls */ |
117 | struct list_head controls; /* all controls for this card */ | 117 | struct list_head controls; /* all controls for this card */ |
118 | struct list_head ctl_files; /* active control files */ | 118 | struct list_head ctl_files; /* active control files */ |
119 | struct mutex user_ctl_lock; /* protects user controls against | ||
120 | concurrent access */ | ||
119 | 121 | ||
120 | struct snd_info_entry *proc_root; /* root for soundcard specific files */ | 122 | struct snd_info_entry *proc_root; /* root for soundcard specific files */ |
121 | struct snd_info_entry *proc_id; /* the card id */ | 123 | struct snd_info_entry *proc_id; /* the card id */ |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 0fd06fef9fac..26b4f2e13275 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -44,6 +44,12 @@ | |||
44 | #undef __field_ext | 44 | #undef __field_ext |
45 | #define __field_ext(type, item, filter_type) type item; | 45 | #define __field_ext(type, item, filter_type) type item; |
46 | 46 | ||
47 | #undef __field_struct | ||
48 | #define __field_struct(type, item) type item; | ||
49 | |||
50 | #undef __field_struct_ext | ||
51 | #define __field_struct_ext(type, item, filter_type) type item; | ||
52 | |||
47 | #undef __array | 53 | #undef __array |
48 | #define __array(type, item, len) type item[len]; | 54 | #define __array(type, item, len) type item[len]; |
49 | 55 | ||
@@ -122,6 +128,12 @@ | |||
122 | #undef __field_ext | 128 | #undef __field_ext |
123 | #define __field_ext(type, item, filter_type) | 129 | #define __field_ext(type, item, filter_type) |
124 | 130 | ||
131 | #undef __field_struct | ||
132 | #define __field_struct(type, item) | ||
133 | |||
134 | #undef __field_struct_ext | ||
135 | #define __field_struct_ext(type, item, filter_type) | ||
136 | |||
125 | #undef __array | 137 | #undef __array |
126 | #define __array(type, item, len) | 138 | #define __array(type, item, len) |
127 | 139 | ||
@@ -315,9 +327,21 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \ | |||
315 | if (ret) \ | 327 | if (ret) \ |
316 | return ret; | 328 | return ret; |
317 | 329 | ||
330 | #undef __field_struct_ext | ||
331 | #define __field_struct_ext(type, item, filter_type) \ | ||
332 | ret = trace_define_field(event_call, #type, #item, \ | ||
333 | offsetof(typeof(field), item), \ | ||
334 | sizeof(field.item), \ | ||
335 | 0, filter_type); \ | ||
336 | if (ret) \ | ||
337 | return ret; | ||
338 | |||
318 | #undef __field | 339 | #undef __field |
319 | #define __field(type, item) __field_ext(type, item, FILTER_OTHER) | 340 | #define __field(type, item) __field_ext(type, item, FILTER_OTHER) |
320 | 341 | ||
342 | #undef __field_struct | ||
343 | #define __field_struct(type, item) __field_struct_ext(type, item, FILTER_OTHER) | ||
344 | |||
321 | #undef __array | 345 | #undef __array |
322 | #define __array(type, item, len) \ | 346 | #define __array(type, item, len) \ |
323 | do { \ | 347 | do { \ |
@@ -379,6 +403,12 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ | |||
379 | #undef __field_ext | 403 | #undef __field_ext |
380 | #define __field_ext(type, item, filter_type) | 404 | #define __field_ext(type, item, filter_type) |
381 | 405 | ||
406 | #undef __field_struct | ||
407 | #define __field_struct(type, item) | ||
408 | |||
409 | #undef __field_struct_ext | ||
410 | #define __field_struct_ext(type, item, filter_type) | ||
411 | |||
382 | #undef __array | 412 | #undef __array |
383 | #define __array(type, item, len) | 413 | #define __array(type, item, len) |
384 | 414 | ||
@@ -550,6 +580,9 @@ static inline notrace int ftrace_get_offsets_##call( \ | |||
550 | #undef __field | 580 | #undef __field |
551 | #define __field(type, item) | 581 | #define __field(type, item) |
552 | 582 | ||
583 | #undef __field_struct | ||
584 | #define __field_struct(type, item) | ||
585 | |||
553 | #undef __array | 586 | #undef __array |
554 | #define __array(type, item, len) | 587 | #define __array(type, item, len) |
555 | 588 | ||
diff --git a/include/trace/syscall.h b/include/trace/syscall.h index fed853f3d7aa..9674145e2f6a 100644 --- a/include/trace/syscall.h +++ b/include/trace/syscall.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/tracepoint.h> | 4 | #include <linux/tracepoint.h> |
5 | #include <linux/unistd.h> | 5 | #include <linux/unistd.h> |
6 | #include <linux/ftrace_event.h> | 6 | #include <linux/ftrace_event.h> |
7 | #include <linux/thread_info.h> | ||
7 | 8 | ||
8 | #include <asm/ptrace.h> | 9 | #include <asm/ptrace.h> |
9 | 10 | ||
@@ -32,4 +33,18 @@ struct syscall_metadata { | |||
32 | struct ftrace_event_call *exit_event; | 33 | struct ftrace_event_call *exit_event; |
33 | }; | 34 | }; |
34 | 35 | ||
36 | #if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS) | ||
37 | static inline void syscall_tracepoint_update(struct task_struct *p) | ||
38 | { | ||
39 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | ||
40 | set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT); | ||
41 | else | ||
42 | clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT); | ||
43 | } | ||
44 | #else | ||
45 | static inline void syscall_tracepoint_update(struct task_struct *p) | ||
46 | { | ||
47 | } | ||
48 | #endif | ||
49 | |||
35 | #endif /* _TRACE_SYSCALL_H */ | 50 | #endif /* _TRACE_SYSCALL_H */ |
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h index 6f9c38ce45c7..2f47824e7a36 100644 --- a/include/uapi/linux/btrfs.h +++ b/include/uapi/linux/btrfs.h | |||
@@ -38,6 +38,7 @@ struct btrfs_ioctl_vol_args { | |||
38 | #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) | 38 | #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) |
39 | #define BTRFS_FSID_SIZE 16 | 39 | #define BTRFS_FSID_SIZE 16 |
40 | #define BTRFS_UUID_SIZE 16 | 40 | #define BTRFS_UUID_SIZE 16 |
41 | #define BTRFS_UUID_UNPARSED_SIZE 37 | ||
41 | 42 | ||
42 | #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) | 43 | #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) |
43 | 44 | ||
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 5312fae47218..9269de254874 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h | |||
@@ -705,6 +705,7 @@ enum perf_event_type { | |||
705 | * u32 min; | 705 | * u32 min; |
706 | * u64 ino; | 706 | * u64 ino; |
707 | * u64 ino_generation; | 707 | * u64 ino_generation; |
708 | * u32 prot, flags; | ||
708 | * char filename[]; | 709 | * char filename[]; |
709 | * struct sample_id sample_id; | 710 | * struct sample_id sample_id; |
710 | * }; | 711 | * }; |
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h index 2a4b4a72a4f9..24b68c59dcf8 100644 --- a/include/uapi/linux/usb/functionfs.h +++ b/include/uapi/linux/usb/functionfs.h | |||
@@ -33,6 +33,13 @@ struct usb_endpoint_descriptor_no_audio { | |||
33 | __u8 bInterval; | 33 | __u8 bInterval; |
34 | } __attribute__((packed)); | 34 | } __attribute__((packed)); |
35 | 35 | ||
36 | /* Legacy format, deprecated as of 3.14. */ | ||
37 | struct usb_functionfs_descs_head { | ||
38 | __le32 magic; | ||
39 | __le32 length; | ||
40 | __le32 fs_count; | ||
41 | __le32 hs_count; | ||
42 | } __attribute__((packed, deprecated)); | ||
36 | 43 | ||
37 | /* | 44 | /* |
38 | * Descriptors format: | 45 | * Descriptors format: |
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h index 21eed488783f..1964026b5e09 100644 --- a/include/uapi/sound/compress_offload.h +++ b/include/uapi/sound/compress_offload.h | |||
@@ -39,7 +39,7 @@ | |||
39 | struct snd_compressed_buffer { | 39 | struct snd_compressed_buffer { |
40 | __u32 fragment_size; | 40 | __u32 fragment_size; |
41 | __u32 fragments; | 41 | __u32 fragments; |
42 | }; | 42 | } __attribute__((packed, aligned(4))); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * struct snd_compr_params: compressed stream params | 45 | * struct snd_compr_params: compressed stream params |
@@ -51,7 +51,7 @@ struct snd_compr_params { | |||
51 | struct snd_compressed_buffer buffer; | 51 | struct snd_compressed_buffer buffer; |
52 | struct snd_codec codec; | 52 | struct snd_codec codec; |
53 | __u8 no_wake_mode; | 53 | __u8 no_wake_mode; |
54 | }; | 54 | } __attribute__((packed, aligned(4))); |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * struct snd_compr_tstamp: timestamp descriptor | 57 | * struct snd_compr_tstamp: timestamp descriptor |
@@ -70,7 +70,7 @@ struct snd_compr_tstamp { | |||
70 | __u32 pcm_frames; | 70 | __u32 pcm_frames; |
71 | __u32 pcm_io_frames; | 71 | __u32 pcm_io_frames; |
72 | __u32 sampling_rate; | 72 | __u32 sampling_rate; |
73 | }; | 73 | } __attribute__((packed, aligned(4))); |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * struct snd_compr_avail: avail descriptor | 76 | * struct snd_compr_avail: avail descriptor |
@@ -80,7 +80,7 @@ struct snd_compr_tstamp { | |||
80 | struct snd_compr_avail { | 80 | struct snd_compr_avail { |
81 | __u64 avail; | 81 | __u64 avail; |
82 | struct snd_compr_tstamp tstamp; | 82 | struct snd_compr_tstamp tstamp; |
83 | } __attribute__((packed)); | 83 | } __attribute__((packed, aligned(4))); |
84 | 84 | ||
85 | enum snd_compr_direction { | 85 | enum snd_compr_direction { |
86 | SND_COMPRESS_PLAYBACK = 0, | 86 | SND_COMPRESS_PLAYBACK = 0, |
@@ -107,7 +107,7 @@ struct snd_compr_caps { | |||
107 | __u32 max_fragments; | 107 | __u32 max_fragments; |
108 | __u32 codecs[MAX_NUM_CODECS]; | 108 | __u32 codecs[MAX_NUM_CODECS]; |
109 | __u32 reserved[11]; | 109 | __u32 reserved[11]; |
110 | }; | 110 | } __attribute__((packed, aligned(4))); |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * struct snd_compr_codec_caps: query capability of codec | 113 | * struct snd_compr_codec_caps: query capability of codec |
@@ -119,7 +119,7 @@ struct snd_compr_codec_caps { | |||
119 | __u32 codec; | 119 | __u32 codec; |
120 | __u32 num_descriptors; | 120 | __u32 num_descriptors; |
121 | struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; | 121 | struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; |
122 | }; | 122 | } __attribute__((packed, aligned(4))); |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the | 125 | * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the |
@@ -140,7 +140,7 @@ enum { | |||
140 | struct snd_compr_metadata { | 140 | struct snd_compr_metadata { |
141 | __u32 key; | 141 | __u32 key; |
142 | __u32 value[8]; | 142 | __u32 value[8]; |
143 | }; | 143 | } __attribute__((packed, aligned(4))); |
144 | 144 | ||
145 | /** | 145 | /** |
146 | * compress path ioctl definitions | 146 | * compress path ioctl definitions |
diff --git a/include/uapi/sound/compress_params.h b/include/uapi/sound/compress_params.h index 165e7059de75..d9bd9ca0d5b0 100644 --- a/include/uapi/sound/compress_params.h +++ b/include/uapi/sound/compress_params.h | |||
@@ -268,7 +268,7 @@ struct snd_enc_vorbis { | |||
268 | __u32 max_bit_rate; | 268 | __u32 max_bit_rate; |
269 | __u32 min_bit_rate; | 269 | __u32 min_bit_rate; |
270 | __u32 downmix; | 270 | __u32 downmix; |
271 | }; | 271 | } __attribute__((packed, aligned(4))); |
272 | 272 | ||
273 | 273 | ||
274 | /** | 274 | /** |
@@ -284,7 +284,7 @@ struct snd_enc_real { | |||
284 | __u32 quant_bits; | 284 | __u32 quant_bits; |
285 | __u32 start_region; | 285 | __u32 start_region; |
286 | __u32 num_regions; | 286 | __u32 num_regions; |
287 | }; | 287 | } __attribute__((packed, aligned(4))); |
288 | 288 | ||
289 | /** | 289 | /** |
290 | * struct snd_enc_flac | 290 | * struct snd_enc_flac |
@@ -308,12 +308,12 @@ struct snd_enc_real { | |||
308 | struct snd_enc_flac { | 308 | struct snd_enc_flac { |
309 | __u32 num; | 309 | __u32 num; |
310 | __u32 gain; | 310 | __u32 gain; |
311 | }; | 311 | } __attribute__((packed, aligned(4))); |
312 | 312 | ||
313 | struct snd_enc_generic { | 313 | struct snd_enc_generic { |
314 | __u32 bw; /* encoder bandwidth */ | 314 | __u32 bw; /* encoder bandwidth */ |
315 | __s32 reserved[15]; | 315 | __s32 reserved[15]; |
316 | }; | 316 | } __attribute__((packed, aligned(4))); |
317 | 317 | ||
318 | union snd_codec_options { | 318 | union snd_codec_options { |
319 | struct snd_enc_wma wma; | 319 | struct snd_enc_wma wma; |
@@ -321,7 +321,7 @@ union snd_codec_options { | |||
321 | struct snd_enc_real real; | 321 | struct snd_enc_real real; |
322 | struct snd_enc_flac flac; | 322 | struct snd_enc_flac flac; |
323 | struct snd_enc_generic generic; | 323 | struct snd_enc_generic generic; |
324 | }; | 324 | } __attribute__((packed, aligned(4))); |
325 | 325 | ||
326 | /** struct snd_codec_desc - description of codec capabilities | 326 | /** struct snd_codec_desc - description of codec capabilities |
327 | * @max_ch: Maximum number of audio channels | 327 | * @max_ch: Maximum number of audio channels |
@@ -358,7 +358,7 @@ struct snd_codec_desc { | |||
358 | __u32 formats; | 358 | __u32 formats; |
359 | __u32 min_buffer; | 359 | __u32 min_buffer; |
360 | __u32 reserved[15]; | 360 | __u32 reserved[15]; |
361 | }; | 361 | } __attribute__((packed, aligned(4))); |
362 | 362 | ||
363 | /** struct snd_codec | 363 | /** struct snd_codec |
364 | * @id: Identifies the supported audio encoder/decoder. | 364 | * @id: Identifies the supported audio encoder/decoder. |
@@ -399,6 +399,6 @@ struct snd_codec { | |||
399 | __u32 align; | 399 | __u32 align; |
400 | union snd_codec_options options; | 400 | union snd_codec_options options; |
401 | __u32 reserved[3]; | 401 | __u32 reserved[3]; |
402 | }; | 402 | } __attribute__((packed, aligned(4))); |
403 | 403 | ||
404 | #endif | 404 | #endif |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 7868fc3c0bc5..70776aec2562 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1648,10 +1648,13 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type, | |||
1648 | int flags, const char *unused_dev_name, | 1648 | int flags, const char *unused_dev_name, |
1649 | void *data) | 1649 | void *data) |
1650 | { | 1650 | { |
1651 | struct super_block *pinned_sb = NULL; | ||
1652 | struct cgroup_subsys *ss; | ||
1651 | struct cgroup_root *root; | 1653 | struct cgroup_root *root; |
1652 | struct cgroup_sb_opts opts; | 1654 | struct cgroup_sb_opts opts; |
1653 | struct dentry *dentry; | 1655 | struct dentry *dentry; |
1654 | int ret; | 1656 | int ret; |
1657 | int i; | ||
1655 | bool new_sb; | 1658 | bool new_sb; |
1656 | 1659 | ||
1657 | /* | 1660 | /* |
@@ -1677,6 +1680,27 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type, | |||
1677 | goto out_unlock; | 1680 | goto out_unlock; |
1678 | } | 1681 | } |
1679 | 1682 | ||
1683 | /* | ||
1684 | * Destruction of cgroup root is asynchronous, so subsystems may | ||
1685 | * still be dying after the previous unmount. Let's drain the | ||
1686 | * dying subsystems. We just need to ensure that the ones | ||
1687 | * unmounted previously finish dying and don't care about new ones | ||
1688 | * starting. Testing ref liveliness is good enough. | ||
1689 | */ | ||
1690 | for_each_subsys(ss, i) { | ||
1691 | if (!(opts.subsys_mask & (1 << i)) || | ||
1692 | ss->root == &cgrp_dfl_root) | ||
1693 | continue; | ||
1694 | |||
1695 | if (!percpu_ref_tryget_live(&ss->root->cgrp.self.refcnt)) { | ||
1696 | mutex_unlock(&cgroup_mutex); | ||
1697 | msleep(10); | ||
1698 | ret = restart_syscall(); | ||
1699 | goto out_free; | ||
1700 | } | ||
1701 | cgroup_put(&ss->root->cgrp); | ||
1702 | } | ||
1703 | |||
1680 | for_each_root(root) { | 1704 | for_each_root(root) { |
1681 | bool name_match = false; | 1705 | bool name_match = false; |
1682 | 1706 | ||
@@ -1717,15 +1741,23 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type, | |||
1717 | } | 1741 | } |
1718 | 1742 | ||
1719 | /* | 1743 | /* |
1720 | * A root's lifetime is governed by its root cgroup. | 1744 | * We want to reuse @root whose lifetime is governed by its |
1721 | * tryget_live failure indicate that the root is being | 1745 | * ->cgrp. Let's check whether @root is alive and keep it |
1722 | * destroyed. Wait for destruction to complete so that the | 1746 | * that way. As cgroup_kill_sb() can happen anytime, we |
1723 | * subsystems are free. We can use wait_queue for the wait | 1747 | * want to block it by pinning the sb so that @root doesn't |
1724 | * but this path is super cold. Let's just sleep for a bit | 1748 | * get killed before mount is complete. |
1725 | * and retry. | 1749 | * |
1750 | * With the sb pinned, tryget_live can reliably indicate | ||
1751 | * whether @root can be reused. If it's being killed, | ||
1752 | * drain it. We can use wait_queue for the wait but this | ||
1753 | * path is super cold. Let's just sleep a bit and retry. | ||
1726 | */ | 1754 | */ |
1727 | if (!percpu_ref_tryget_live(&root->cgrp.self.refcnt)) { | 1755 | pinned_sb = kernfs_pin_sb(root->kf_root, NULL); |
1756 | if (IS_ERR(pinned_sb) || | ||
1757 | !percpu_ref_tryget_live(&root->cgrp.self.refcnt)) { | ||
1728 | mutex_unlock(&cgroup_mutex); | 1758 | mutex_unlock(&cgroup_mutex); |
1759 | if (!IS_ERR_OR_NULL(pinned_sb)) | ||
1760 | deactivate_super(pinned_sb); | ||
1729 | msleep(10); | 1761 | msleep(10); |
1730 | ret = restart_syscall(); | 1762 | ret = restart_syscall(); |
1731 | goto out_free; | 1763 | goto out_free; |
@@ -1770,6 +1802,16 @@ out_free: | |||
1770 | CGROUP_SUPER_MAGIC, &new_sb); | 1802 | CGROUP_SUPER_MAGIC, &new_sb); |
1771 | if (IS_ERR(dentry) || !new_sb) | 1803 | if (IS_ERR(dentry) || !new_sb) |
1772 | cgroup_put(&root->cgrp); | 1804 | cgroup_put(&root->cgrp); |
1805 | |||
1806 | /* | ||
1807 | * If @pinned_sb, we're reusing an existing root and holding an | ||
1808 | * extra ref on its sb. Mount is complete. Put the extra ref. | ||
1809 | */ | ||
1810 | if (pinned_sb) { | ||
1811 | WARN_ON(new_sb); | ||
1812 | deactivate_super(pinned_sb); | ||
1813 | } | ||
1814 | |||
1773 | return dentry; | 1815 | return dentry; |
1774 | } | 1816 | } |
1775 | 1817 | ||
@@ -3328,7 +3370,7 @@ bool css_has_online_children(struct cgroup_subsys_state *css) | |||
3328 | 3370 | ||
3329 | rcu_read_lock(); | 3371 | rcu_read_lock(); |
3330 | css_for_each_child(child, css) { | 3372 | css_for_each_child(child, css) { |
3331 | if (css->flags & CSS_ONLINE) { | 3373 | if (child->flags & CSS_ONLINE) { |
3332 | ret = true; | 3374 | ret = true; |
3333 | break; | 3375 | break; |
3334 | } | 3376 | } |
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c index 019d45008448..5664985c46a0 100644 --- a/kernel/context_tracking.c +++ b/kernel/context_tracking.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
20 | #include <linux/hardirq.h> | 20 | #include <linux/hardirq.h> |
21 | #include <linux/export.h> | 21 | #include <linux/export.h> |
22 | #include <linux/kprobes.h> | ||
22 | 23 | ||
23 | #define CREATE_TRACE_POINTS | 24 | #define CREATE_TRACE_POINTS |
24 | #include <trace/events/context_tracking.h> | 25 | #include <trace/events/context_tracking.h> |
@@ -104,6 +105,7 @@ void context_tracking_user_enter(void) | |||
104 | } | 105 | } |
105 | local_irq_restore(flags); | 106 | local_irq_restore(flags); |
106 | } | 107 | } |
108 | NOKPROBE_SYMBOL(context_tracking_user_enter); | ||
107 | 109 | ||
108 | #ifdef CONFIG_PREEMPT | 110 | #ifdef CONFIG_PREEMPT |
109 | /** | 111 | /** |
@@ -181,6 +183,7 @@ void context_tracking_user_exit(void) | |||
181 | } | 183 | } |
182 | local_irq_restore(flags); | 184 | local_irq_restore(flags); |
183 | } | 185 | } |
186 | NOKPROBE_SYMBOL(context_tracking_user_exit); | ||
184 | 187 | ||
185 | /** | 188 | /** |
186 | * __context_tracking_task_switch - context switch the syscall callbacks | 189 | * __context_tracking_task_switch - context switch the syscall callbacks |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index f6b33c696224..116a4164720a 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1181,7 +1181,13 @@ done: | |||
1181 | 1181 | ||
1182 | int current_cpuset_is_being_rebound(void) | 1182 | int current_cpuset_is_being_rebound(void) |
1183 | { | 1183 | { |
1184 | return task_cs(current) == cpuset_being_rebound; | 1184 | int ret; |
1185 | |||
1186 | rcu_read_lock(); | ||
1187 | ret = task_cs(current) == cpuset_being_rebound; | ||
1188 | rcu_read_unlock(); | ||
1189 | |||
1190 | return ret; | ||
1185 | } | 1191 | } |
1186 | 1192 | ||
1187 | static int update_relax_domain_level(struct cpuset *cs, s64 val) | 1193 | static int update_relax_domain_level(struct cpuset *cs, s64 val) |
@@ -1617,7 +1623,17 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of, | |||
1617 | * resources, wait for the previously scheduled operations before | 1623 | * resources, wait for the previously scheduled operations before |
1618 | * proceeding, so that we don't end up keep removing tasks added | 1624 | * proceeding, so that we don't end up keep removing tasks added |
1619 | * after execution capability is restored. | 1625 | * after execution capability is restored. |
1626 | * | ||
1627 | * cpuset_hotplug_work calls back into cgroup core via | ||
1628 | * cgroup_transfer_tasks() and waiting for it from a cgroupfs | ||
1629 | * operation like this one can lead to a deadlock through kernfs | ||
1630 | * active_ref protection. Let's break the protection. Losing the | ||
1631 | * protection is okay as we check whether @cs is online after | ||
1632 | * grabbing cpuset_mutex anyway. This only happens on the legacy | ||
1633 | * hierarchies. | ||
1620 | */ | 1634 | */ |
1635 | css_get(&cs->css); | ||
1636 | kernfs_break_active_protection(of->kn); | ||
1621 | flush_work(&cpuset_hotplug_work); | 1637 | flush_work(&cpuset_hotplug_work); |
1622 | 1638 | ||
1623 | mutex_lock(&cpuset_mutex); | 1639 | mutex_lock(&cpuset_mutex); |
@@ -1645,6 +1661,8 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of, | |||
1645 | free_trial_cpuset(trialcs); | 1661 | free_trial_cpuset(trialcs); |
1646 | out_unlock: | 1662 | out_unlock: |
1647 | mutex_unlock(&cpuset_mutex); | 1663 | mutex_unlock(&cpuset_mutex); |
1664 | kernfs_unbreak_active_protection(of->kn); | ||
1665 | css_put(&cs->css); | ||
1648 | return retval ?: nbytes; | 1666 | return retval ?: nbytes; |
1649 | } | 1667 | } |
1650 | 1668 | ||
diff --git a/kernel/events/core.c b/kernel/events/core.c index 5fa58e4cffac..a33d9a2bcbd7 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/mm_types.h> | 40 | #include <linux/mm_types.h> |
41 | #include <linux/cgroup.h> | 41 | #include <linux/cgroup.h> |
42 | #include <linux/module.h> | 42 | #include <linux/module.h> |
43 | #include <linux/mman.h> | ||
43 | 44 | ||
44 | #include "internal.h" | 45 | #include "internal.h" |
45 | 46 | ||
@@ -5128,6 +5129,7 @@ struct perf_mmap_event { | |||
5128 | int maj, min; | 5129 | int maj, min; |
5129 | u64 ino; | 5130 | u64 ino; |
5130 | u64 ino_generation; | 5131 | u64 ino_generation; |
5132 | u32 prot, flags; | ||
5131 | 5133 | ||
5132 | struct { | 5134 | struct { |
5133 | struct perf_event_header header; | 5135 | struct perf_event_header header; |
@@ -5169,6 +5171,8 @@ static void perf_event_mmap_output(struct perf_event *event, | |||
5169 | mmap_event->event_id.header.size += sizeof(mmap_event->min); | 5171 | mmap_event->event_id.header.size += sizeof(mmap_event->min); |
5170 | mmap_event->event_id.header.size += sizeof(mmap_event->ino); | 5172 | mmap_event->event_id.header.size += sizeof(mmap_event->ino); |
5171 | mmap_event->event_id.header.size += sizeof(mmap_event->ino_generation); | 5173 | mmap_event->event_id.header.size += sizeof(mmap_event->ino_generation); |
5174 | mmap_event->event_id.header.size += sizeof(mmap_event->prot); | ||
5175 | mmap_event->event_id.header.size += sizeof(mmap_event->flags); | ||
5172 | } | 5176 | } |
5173 | 5177 | ||
5174 | perf_event_header__init_id(&mmap_event->event_id.header, &sample, event); | 5178 | perf_event_header__init_id(&mmap_event->event_id.header, &sample, event); |
@@ -5187,6 +5191,8 @@ static void perf_event_mmap_output(struct perf_event *event, | |||
5187 | perf_output_put(&handle, mmap_event->min); | 5191 | perf_output_put(&handle, mmap_event->min); |
5188 | perf_output_put(&handle, mmap_event->ino); | 5192 | perf_output_put(&handle, mmap_event->ino); |
5189 | perf_output_put(&handle, mmap_event->ino_generation); | 5193 | perf_output_put(&handle, mmap_event->ino_generation); |
5194 | perf_output_put(&handle, mmap_event->prot); | ||
5195 | perf_output_put(&handle, mmap_event->flags); | ||
5190 | } | 5196 | } |
5191 | 5197 | ||
5192 | __output_copy(&handle, mmap_event->file_name, | 5198 | __output_copy(&handle, mmap_event->file_name, |
@@ -5205,6 +5211,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) | |||
5205 | struct file *file = vma->vm_file; | 5211 | struct file *file = vma->vm_file; |
5206 | int maj = 0, min = 0; | 5212 | int maj = 0, min = 0; |
5207 | u64 ino = 0, gen = 0; | 5213 | u64 ino = 0, gen = 0; |
5214 | u32 prot = 0, flags = 0; | ||
5208 | unsigned int size; | 5215 | unsigned int size; |
5209 | char tmp[16]; | 5216 | char tmp[16]; |
5210 | char *buf = NULL; | 5217 | char *buf = NULL; |
@@ -5235,6 +5242,28 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) | |||
5235 | gen = inode->i_generation; | 5242 | gen = inode->i_generation; |
5236 | maj = MAJOR(dev); | 5243 | maj = MAJOR(dev); |
5237 | min = MINOR(dev); | 5244 | min = MINOR(dev); |
5245 | |||
5246 | if (vma->vm_flags & VM_READ) | ||
5247 | prot |= PROT_READ; | ||
5248 | if (vma->vm_flags & VM_WRITE) | ||
5249 | prot |= PROT_WRITE; | ||
5250 | if (vma->vm_flags & VM_EXEC) | ||
5251 | prot |= PROT_EXEC; | ||
5252 | |||
5253 | if (vma->vm_flags & VM_MAYSHARE) | ||
5254 | flags = MAP_SHARED; | ||
5255 | else | ||
5256 | flags = MAP_PRIVATE; | ||
5257 | |||
5258 | if (vma->vm_flags & VM_DENYWRITE) | ||
5259 | flags |= MAP_DENYWRITE; | ||
5260 | if (vma->vm_flags & VM_MAYEXEC) | ||
5261 | flags |= MAP_EXECUTABLE; | ||
5262 | if (vma->vm_flags & VM_LOCKED) | ||
5263 | flags |= MAP_LOCKED; | ||
5264 | if (vma->vm_flags & VM_HUGETLB) | ||
5265 | flags |= MAP_HUGETLB; | ||
5266 | |||
5238 | goto got_name; | 5267 | goto got_name; |
5239 | } else { | 5268 | } else { |
5240 | name = (char *)arch_vma_name(vma); | 5269 | name = (char *)arch_vma_name(vma); |
@@ -5275,6 +5304,8 @@ got_name: | |||
5275 | mmap_event->min = min; | 5304 | mmap_event->min = min; |
5276 | mmap_event->ino = ino; | 5305 | mmap_event->ino = ino; |
5277 | mmap_event->ino_generation = gen; | 5306 | mmap_event->ino_generation = gen; |
5307 | mmap_event->prot = prot; | ||
5308 | mmap_event->flags = flags; | ||
5278 | 5309 | ||
5279 | if (!(vma->vm_flags & VM_EXEC)) | 5310 | if (!(vma->vm_flags & VM_EXEC)) |
5280 | mmap_event->event_id.header.misc |= PERF_RECORD_MISC_MMAP_DATA; | 5311 | mmap_event->event_id.header.misc |= PERF_RECORD_MISC_MMAP_DATA; |
@@ -5315,6 +5346,8 @@ void perf_event_mmap(struct vm_area_struct *vma) | |||
5315 | /* .min (attr_mmap2 only) */ | 5346 | /* .min (attr_mmap2 only) */ |
5316 | /* .ino (attr_mmap2 only) */ | 5347 | /* .ino (attr_mmap2 only) */ |
5317 | /* .ino_generation (attr_mmap2 only) */ | 5348 | /* .ino_generation (attr_mmap2 only) */ |
5349 | /* .prot (attr_mmap2 only) */ | ||
5350 | /* .flags (attr_mmap2 only) */ | ||
5318 | }; | 5351 | }; |
5319 | 5352 | ||
5320 | perf_event_mmap_event(&mmap_event); | 5353 | perf_event_mmap_event(&mmap_event); |
@@ -6897,10 +6930,6 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr, | |||
6897 | if (ret) | 6930 | if (ret) |
6898 | return -EFAULT; | 6931 | return -EFAULT; |
6899 | 6932 | ||
6900 | /* disabled for now */ | ||
6901 | if (attr->mmap2) | ||
6902 | return -EINVAL; | ||
6903 | |||
6904 | if (attr->__reserved_1) | 6933 | if (attr->__reserved_1) |
6905 | return -EINVAL; | 6934 | return -EINVAL; |
6906 | 6935 | ||
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index c445e392e93f..6f3254e8c137 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -846,7 +846,7 @@ static void __uprobe_unregister(struct uprobe *uprobe, struct uprobe_consumer *u | |||
846 | { | 846 | { |
847 | int err; | 847 | int err; |
848 | 848 | ||
849 | if (!consumer_del(uprobe, uc)) /* WARN? */ | 849 | if (WARN_ON(!consumer_del(uprobe, uc))) |
850 | return; | 850 | return; |
851 | 851 | ||
852 | err = register_for_each_vma(uprobe, NULL); | 852 | err = register_for_each_vma(uprobe, NULL); |
@@ -927,7 +927,7 @@ int uprobe_apply(struct inode *inode, loff_t offset, | |||
927 | int ret = -ENOENT; | 927 | int ret = -ENOENT; |
928 | 928 | ||
929 | uprobe = find_uprobe(inode, offset); | 929 | uprobe = find_uprobe(inode, offset); |
930 | if (!uprobe) | 930 | if (WARN_ON(!uprobe)) |
931 | return ret; | 931 | return ret; |
932 | 932 | ||
933 | down_write(&uprobe->register_rwsem); | 933 | down_write(&uprobe->register_rwsem); |
@@ -952,7 +952,7 @@ void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consume | |||
952 | struct uprobe *uprobe; | 952 | struct uprobe *uprobe; |
953 | 953 | ||
954 | uprobe = find_uprobe(inode, offset); | 954 | uprobe = find_uprobe(inode, offset); |
955 | if (!uprobe) | 955 | if (WARN_ON(!uprobe)) |
956 | return; | 956 | return; |
957 | 957 | ||
958 | down_write(&uprobe->register_rwsem); | 958 | down_write(&uprobe->register_rwsem); |
diff --git a/kernel/fork.c b/kernel/fork.c index 6ff87f4429a4..962885edbe53 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1486,7 +1486,9 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1486 | 1486 | ||
1487 | total_forks++; | 1487 | total_forks++; |
1488 | spin_unlock(¤t->sighand->siglock); | 1488 | spin_unlock(¤t->sighand->siglock); |
1489 | syscall_tracepoint_update(p); | ||
1489 | write_unlock_irq(&tasklist_lock); | 1490 | write_unlock_irq(&tasklist_lock); |
1491 | |||
1490 | proc_fork_connector(p); | 1492 | proc_fork_connector(p); |
1491 | cgroup_post_fork(p); | 1493 | cgroup_post_fork(p); |
1492 | if (clone_flags & CLONE_THREAD) | 1494 | if (clone_flags & CLONE_THREAD) |
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 7339e42a85ab..1487a123db5c 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c | |||
@@ -455,9 +455,9 @@ EXPORT_SYMBOL_GPL(irq_alloc_hwirqs); | |||
455 | */ | 455 | */ |
456 | void irq_free_hwirqs(unsigned int from, int cnt) | 456 | void irq_free_hwirqs(unsigned int from, int cnt) |
457 | { | 457 | { |
458 | int i; | 458 | int i, j; |
459 | 459 | ||
460 | for (i = from; cnt > 0; i++, cnt--) { | 460 | for (i = from, j = cnt; j > 0; i++, j--) { |
461 | irq_set_status_flags(i, _IRQ_NOREQUEST | _IRQ_NOPROBE); | 461 | irq_set_status_flags(i, _IRQ_NOREQUEST | _IRQ_NOPROBE); |
462 | arch_teardown_hwirq(i); | 462 | arch_teardown_hwirq(i); |
463 | } | 463 | } |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 6748688813d0..369f41a94124 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -1617,6 +1617,7 @@ static int __init crash_save_vmcoreinfo_init(void) | |||
1617 | #ifdef CONFIG_MEMORY_FAILURE | 1617 | #ifdef CONFIG_MEMORY_FAILURE |
1618 | VMCOREINFO_NUMBER(PG_hwpoison); | 1618 | VMCOREINFO_NUMBER(PG_hwpoison); |
1619 | #endif | 1619 | #endif |
1620 | VMCOREINFO_NUMBER(PG_head_mask); | ||
1620 | VMCOREINFO_NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE); | 1621 | VMCOREINFO_NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE); |
1621 | 1622 | ||
1622 | arch_crash_save_vmcoreinfo(); | 1623 | arch_crash_save_vmcoreinfo(); |
diff --git a/kernel/locking/rtmutex-debug.h b/kernel/locking/rtmutex-debug.h index 14193d596d78..ab29b6a22669 100644 --- a/kernel/locking/rtmutex-debug.h +++ b/kernel/locking/rtmutex-debug.h | |||
@@ -31,3 +31,8 @@ static inline int debug_rt_mutex_detect_deadlock(struct rt_mutex_waiter *waiter, | |||
31 | { | 31 | { |
32 | return (waiter != NULL); | 32 | return (waiter != NULL); |
33 | } | 33 | } |
34 | |||
35 | static inline void rt_mutex_print_deadlock(struct rt_mutex_waiter *w) | ||
36 | { | ||
37 | debug_rt_mutex_print_deadlock(w); | ||
38 | } | ||
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index a620d4d08ca6..fc605941b9b8 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c | |||
@@ -83,6 +83,47 @@ static inline void mark_rt_mutex_waiters(struct rt_mutex *lock) | |||
83 | owner = *p; | 83 | owner = *p; |
84 | } while (cmpxchg(p, owner, owner | RT_MUTEX_HAS_WAITERS) != owner); | 84 | } while (cmpxchg(p, owner, owner | RT_MUTEX_HAS_WAITERS) != owner); |
85 | } | 85 | } |
86 | |||
87 | /* | ||
88 | * Safe fastpath aware unlock: | ||
89 | * 1) Clear the waiters bit | ||
90 | * 2) Drop lock->wait_lock | ||
91 | * 3) Try to unlock the lock with cmpxchg | ||
92 | */ | ||
93 | static inline bool unlock_rt_mutex_safe(struct rt_mutex *lock) | ||
94 | __releases(lock->wait_lock) | ||
95 | { | ||
96 | struct task_struct *owner = rt_mutex_owner(lock); | ||
97 | |||
98 | clear_rt_mutex_waiters(lock); | ||
99 | raw_spin_unlock(&lock->wait_lock); | ||
100 | /* | ||
101 | * If a new waiter comes in between the unlock and the cmpxchg | ||
102 | * we have two situations: | ||
103 | * | ||
104 | * unlock(wait_lock); | ||
105 | * lock(wait_lock); | ||
106 | * cmpxchg(p, owner, 0) == owner | ||
107 | * mark_rt_mutex_waiters(lock); | ||
108 | * acquire(lock); | ||
109 | * or: | ||
110 | * | ||
111 | * unlock(wait_lock); | ||
112 | * lock(wait_lock); | ||
113 | * mark_rt_mutex_waiters(lock); | ||
114 | * | ||
115 | * cmpxchg(p, owner, 0) != owner | ||
116 | * enqueue_waiter(); | ||
117 | * unlock(wait_lock); | ||
118 | * lock(wait_lock); | ||
119 | * wake waiter(); | ||
120 | * unlock(wait_lock); | ||
121 | * lock(wait_lock); | ||
122 | * acquire(lock); | ||
123 | */ | ||
124 | return rt_mutex_cmpxchg(lock, owner, NULL); | ||
125 | } | ||
126 | |||
86 | #else | 127 | #else |
87 | # define rt_mutex_cmpxchg(l,c,n) (0) | 128 | # define rt_mutex_cmpxchg(l,c,n) (0) |
88 | static inline void mark_rt_mutex_waiters(struct rt_mutex *lock) | 129 | static inline void mark_rt_mutex_waiters(struct rt_mutex *lock) |
@@ -90,6 +131,17 @@ static inline void mark_rt_mutex_waiters(struct rt_mutex *lock) | |||
90 | lock->owner = (struct task_struct *) | 131 | lock->owner = (struct task_struct *) |
91 | ((unsigned long)lock->owner | RT_MUTEX_HAS_WAITERS); | 132 | ((unsigned long)lock->owner | RT_MUTEX_HAS_WAITERS); |
92 | } | 133 | } |
134 | |||
135 | /* | ||
136 | * Simple slow path only version: lock->owner is protected by lock->wait_lock. | ||
137 | */ | ||
138 | static inline bool unlock_rt_mutex_safe(struct rt_mutex *lock) | ||
139 | __releases(lock->wait_lock) | ||
140 | { | ||
141 | lock->owner = NULL; | ||
142 | raw_spin_unlock(&lock->wait_lock); | ||
143 | return true; | ||
144 | } | ||
93 | #endif | 145 | #endif |
94 | 146 | ||
95 | static inline int | 147 | static inline int |
@@ -260,27 +312,36 @@ static void rt_mutex_adjust_prio(struct task_struct *task) | |||
260 | */ | 312 | */ |
261 | int max_lock_depth = 1024; | 313 | int max_lock_depth = 1024; |
262 | 314 | ||
315 | static inline struct rt_mutex *task_blocked_on_lock(struct task_struct *p) | ||
316 | { | ||
317 | return p->pi_blocked_on ? p->pi_blocked_on->lock : NULL; | ||
318 | } | ||
319 | |||
263 | /* | 320 | /* |
264 | * Adjust the priority chain. Also used for deadlock detection. | 321 | * Adjust the priority chain. Also used for deadlock detection. |
265 | * Decreases task's usage by one - may thus free the task. | 322 | * Decreases task's usage by one - may thus free the task. |
266 | * | 323 | * |
267 | * @task: the task owning the mutex (owner) for which a chain walk is probably | 324 | * @task: the task owning the mutex (owner) for which a chain walk is |
268 | * needed | 325 | * probably needed |
269 | * @deadlock_detect: do we have to carry out deadlock detection? | 326 | * @deadlock_detect: do we have to carry out deadlock detection? |
270 | * @orig_lock: the mutex (can be NULL if we are walking the chain to recheck | 327 | * @orig_lock: the mutex (can be NULL if we are walking the chain to recheck |
271 | * things for a task that has just got its priority adjusted, and | 328 | * things for a task that has just got its priority adjusted, and |
272 | * is waiting on a mutex) | 329 | * is waiting on a mutex) |
330 | * @next_lock: the mutex on which the owner of @orig_lock was blocked before | ||
331 | * we dropped its pi_lock. Is never dereferenced, only used for | ||
332 | * comparison to detect lock chain changes. | ||
273 | * @orig_waiter: rt_mutex_waiter struct for the task that has just donated | 333 | * @orig_waiter: rt_mutex_waiter struct for the task that has just donated |
274 | * its priority to the mutex owner (can be NULL in the case | 334 | * its priority to the mutex owner (can be NULL in the case |
275 | * depicted above or if the top waiter is gone away and we are | 335 | * depicted above or if the top waiter is gone away and we are |
276 | * actually deboosting the owner) | 336 | * actually deboosting the owner) |
277 | * @top_task: the current top waiter | 337 | * @top_task: the current top waiter |
278 | * | 338 | * |
279 | * Returns 0 or -EDEADLK. | 339 | * Returns 0 or -EDEADLK. |
280 | */ | 340 | */ |
281 | static int rt_mutex_adjust_prio_chain(struct task_struct *task, | 341 | static int rt_mutex_adjust_prio_chain(struct task_struct *task, |
282 | int deadlock_detect, | 342 | int deadlock_detect, |
283 | struct rt_mutex *orig_lock, | 343 | struct rt_mutex *orig_lock, |
344 | struct rt_mutex *next_lock, | ||
284 | struct rt_mutex_waiter *orig_waiter, | 345 | struct rt_mutex_waiter *orig_waiter, |
285 | struct task_struct *top_task) | 346 | struct task_struct *top_task) |
286 | { | 347 | { |
@@ -314,7 +375,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, | |||
314 | } | 375 | } |
315 | put_task_struct(task); | 376 | put_task_struct(task); |
316 | 377 | ||
317 | return deadlock_detect ? -EDEADLK : 0; | 378 | return -EDEADLK; |
318 | } | 379 | } |
319 | retry: | 380 | retry: |
320 | /* | 381 | /* |
@@ -339,6 +400,18 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, | |||
339 | goto out_unlock_pi; | 400 | goto out_unlock_pi; |
340 | 401 | ||
341 | /* | 402 | /* |
403 | * We dropped all locks after taking a refcount on @task, so | ||
404 | * the task might have moved on in the lock chain or even left | ||
405 | * the chain completely and blocks now on an unrelated lock or | ||
406 | * on @orig_lock. | ||
407 | * | ||
408 | * We stored the lock on which @task was blocked in @next_lock, | ||
409 | * so we can detect the chain change. | ||
410 | */ | ||
411 | if (next_lock != waiter->lock) | ||
412 | goto out_unlock_pi; | ||
413 | |||
414 | /* | ||
342 | * Drop out, when the task has no waiters. Note, | 415 | * Drop out, when the task has no waiters. Note, |
343 | * top_waiter can be NULL, when we are in the deboosting | 416 | * top_waiter can be NULL, when we are in the deboosting |
344 | * mode! | 417 | * mode! |
@@ -377,7 +450,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, | |||
377 | if (lock == orig_lock || rt_mutex_owner(lock) == top_task) { | 450 | if (lock == orig_lock || rt_mutex_owner(lock) == top_task) { |
378 | debug_rt_mutex_deadlock(deadlock_detect, orig_waiter, lock); | 451 | debug_rt_mutex_deadlock(deadlock_detect, orig_waiter, lock); |
379 | raw_spin_unlock(&lock->wait_lock); | 452 | raw_spin_unlock(&lock->wait_lock); |
380 | ret = deadlock_detect ? -EDEADLK : 0; | 453 | ret = -EDEADLK; |
381 | goto out_unlock_pi; | 454 | goto out_unlock_pi; |
382 | } | 455 | } |
383 | 456 | ||
@@ -422,11 +495,26 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, | |||
422 | __rt_mutex_adjust_prio(task); | 495 | __rt_mutex_adjust_prio(task); |
423 | } | 496 | } |
424 | 497 | ||
498 | /* | ||
499 | * Check whether the task which owns the current lock is pi | ||
500 | * blocked itself. If yes we store a pointer to the lock for | ||
501 | * the lock chain change detection above. After we dropped | ||
502 | * task->pi_lock next_lock cannot be dereferenced anymore. | ||
503 | */ | ||
504 | next_lock = task_blocked_on_lock(task); | ||
505 | |||
425 | raw_spin_unlock_irqrestore(&task->pi_lock, flags); | 506 | raw_spin_unlock_irqrestore(&task->pi_lock, flags); |
426 | 507 | ||
427 | top_waiter = rt_mutex_top_waiter(lock); | 508 | top_waiter = rt_mutex_top_waiter(lock); |
428 | raw_spin_unlock(&lock->wait_lock); | 509 | raw_spin_unlock(&lock->wait_lock); |
429 | 510 | ||
511 | /* | ||
512 | * We reached the end of the lock chain. Stop right here. No | ||
513 | * point to go back just to figure that out. | ||
514 | */ | ||
515 | if (!next_lock) | ||
516 | goto out_put_task; | ||
517 | |||
430 | if (!detect_deadlock && waiter != top_waiter) | 518 | if (!detect_deadlock && waiter != top_waiter) |
431 | goto out_put_task; | 519 | goto out_put_task; |
432 | 520 | ||
@@ -536,8 +624,9 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, | |||
536 | { | 624 | { |
537 | struct task_struct *owner = rt_mutex_owner(lock); | 625 | struct task_struct *owner = rt_mutex_owner(lock); |
538 | struct rt_mutex_waiter *top_waiter = waiter; | 626 | struct rt_mutex_waiter *top_waiter = waiter; |
539 | unsigned long flags; | 627 | struct rt_mutex *next_lock; |
540 | int chain_walk = 0, res; | 628 | int chain_walk = 0, res; |
629 | unsigned long flags; | ||
541 | 630 | ||
542 | /* | 631 | /* |
543 | * Early deadlock detection. We really don't want the task to | 632 | * Early deadlock detection. We really don't want the task to |
@@ -548,7 +637,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, | |||
548 | * which is wrong, as the other waiter is not in a deadlock | 637 | * which is wrong, as the other waiter is not in a deadlock |
549 | * situation. | 638 | * situation. |
550 | */ | 639 | */ |
551 | if (detect_deadlock && owner == task) | 640 | if (owner == task) |
552 | return -EDEADLK; | 641 | return -EDEADLK; |
553 | 642 | ||
554 | raw_spin_lock_irqsave(&task->pi_lock, flags); | 643 | raw_spin_lock_irqsave(&task->pi_lock, flags); |
@@ -569,20 +658,28 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, | |||
569 | if (!owner) | 658 | if (!owner) |
570 | return 0; | 659 | return 0; |
571 | 660 | ||
661 | raw_spin_lock_irqsave(&owner->pi_lock, flags); | ||
572 | if (waiter == rt_mutex_top_waiter(lock)) { | 662 | if (waiter == rt_mutex_top_waiter(lock)) { |
573 | raw_spin_lock_irqsave(&owner->pi_lock, flags); | ||
574 | rt_mutex_dequeue_pi(owner, top_waiter); | 663 | rt_mutex_dequeue_pi(owner, top_waiter); |
575 | rt_mutex_enqueue_pi(owner, waiter); | 664 | rt_mutex_enqueue_pi(owner, waiter); |
576 | 665 | ||
577 | __rt_mutex_adjust_prio(owner); | 666 | __rt_mutex_adjust_prio(owner); |
578 | if (owner->pi_blocked_on) | 667 | if (owner->pi_blocked_on) |
579 | chain_walk = 1; | 668 | chain_walk = 1; |
580 | raw_spin_unlock_irqrestore(&owner->pi_lock, flags); | 669 | } else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock)) { |
581 | } | ||
582 | else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock)) | ||
583 | chain_walk = 1; | 670 | chain_walk = 1; |
671 | } | ||
584 | 672 | ||
585 | if (!chain_walk) | 673 | /* Store the lock on which owner is blocked or NULL */ |
674 | next_lock = task_blocked_on_lock(owner); | ||
675 | |||
676 | raw_spin_unlock_irqrestore(&owner->pi_lock, flags); | ||
677 | /* | ||
678 | * Even if full deadlock detection is on, if the owner is not | ||
679 | * blocked itself, we can avoid finding this out in the chain | ||
680 | * walk. | ||
681 | */ | ||
682 | if (!chain_walk || !next_lock) | ||
586 | return 0; | 683 | return 0; |
587 | 684 | ||
588 | /* | 685 | /* |
@@ -594,8 +691,8 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, | |||
594 | 691 | ||
595 | raw_spin_unlock(&lock->wait_lock); | 692 | raw_spin_unlock(&lock->wait_lock); |
596 | 693 | ||
597 | res = rt_mutex_adjust_prio_chain(owner, detect_deadlock, lock, waiter, | 694 | res = rt_mutex_adjust_prio_chain(owner, detect_deadlock, lock, |
598 | task); | 695 | next_lock, waiter, task); |
599 | 696 | ||
600 | raw_spin_lock(&lock->wait_lock); | 697 | raw_spin_lock(&lock->wait_lock); |
601 | 698 | ||
@@ -605,7 +702,8 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, | |||
605 | /* | 702 | /* |
606 | * Wake up the next waiter on the lock. | 703 | * Wake up the next waiter on the lock. |
607 | * | 704 | * |
608 | * Remove the top waiter from the current tasks waiter list and wake it up. | 705 | * Remove the top waiter from the current tasks pi waiter list and |
706 | * wake it up. | ||
609 | * | 707 | * |
610 | * Called with lock->wait_lock held. | 708 | * Called with lock->wait_lock held. |
611 | */ | 709 | */ |
@@ -626,10 +724,23 @@ static void wakeup_next_waiter(struct rt_mutex *lock) | |||
626 | */ | 724 | */ |
627 | rt_mutex_dequeue_pi(current, waiter); | 725 | rt_mutex_dequeue_pi(current, waiter); |
628 | 726 | ||
629 | rt_mutex_set_owner(lock, NULL); | 727 | /* |
728 | * As we are waking up the top waiter, and the waiter stays | ||
729 | * queued on the lock until it gets the lock, this lock | ||
730 | * obviously has waiters. Just set the bit here and this has | ||
731 | * the added benefit of forcing all new tasks into the | ||
732 | * slow path making sure no task of lower priority than | ||
733 | * the top waiter can steal this lock. | ||
734 | */ | ||
735 | lock->owner = (void *) RT_MUTEX_HAS_WAITERS; | ||
630 | 736 | ||
631 | raw_spin_unlock_irqrestore(¤t->pi_lock, flags); | 737 | raw_spin_unlock_irqrestore(¤t->pi_lock, flags); |
632 | 738 | ||
739 | /* | ||
740 | * It's safe to dereference waiter as it cannot go away as | ||
741 | * long as we hold lock->wait_lock. The waiter task needs to | ||
742 | * acquire it in order to dequeue the waiter. | ||
743 | */ | ||
633 | wake_up_process(waiter->task); | 744 | wake_up_process(waiter->task); |
634 | } | 745 | } |
635 | 746 | ||
@@ -644,8 +755,8 @@ static void remove_waiter(struct rt_mutex *lock, | |||
644 | { | 755 | { |
645 | int first = (waiter == rt_mutex_top_waiter(lock)); | 756 | int first = (waiter == rt_mutex_top_waiter(lock)); |
646 | struct task_struct *owner = rt_mutex_owner(lock); | 757 | struct task_struct *owner = rt_mutex_owner(lock); |
758 | struct rt_mutex *next_lock = NULL; | ||
647 | unsigned long flags; | 759 | unsigned long flags; |
648 | int chain_walk = 0; | ||
649 | 760 | ||
650 | raw_spin_lock_irqsave(¤t->pi_lock, flags); | 761 | raw_spin_lock_irqsave(¤t->pi_lock, flags); |
651 | rt_mutex_dequeue(lock, waiter); | 762 | rt_mutex_dequeue(lock, waiter); |
@@ -669,13 +780,13 @@ static void remove_waiter(struct rt_mutex *lock, | |||
669 | } | 780 | } |
670 | __rt_mutex_adjust_prio(owner); | 781 | __rt_mutex_adjust_prio(owner); |
671 | 782 | ||
672 | if (owner->pi_blocked_on) | 783 | /* Store the lock on which owner is blocked or NULL */ |
673 | chain_walk = 1; | 784 | next_lock = task_blocked_on_lock(owner); |
674 | 785 | ||
675 | raw_spin_unlock_irqrestore(&owner->pi_lock, flags); | 786 | raw_spin_unlock_irqrestore(&owner->pi_lock, flags); |
676 | } | 787 | } |
677 | 788 | ||
678 | if (!chain_walk) | 789 | if (!next_lock) |
679 | return; | 790 | return; |
680 | 791 | ||
681 | /* gets dropped in rt_mutex_adjust_prio_chain()! */ | 792 | /* gets dropped in rt_mutex_adjust_prio_chain()! */ |
@@ -683,7 +794,7 @@ static void remove_waiter(struct rt_mutex *lock, | |||
683 | 794 | ||
684 | raw_spin_unlock(&lock->wait_lock); | 795 | raw_spin_unlock(&lock->wait_lock); |
685 | 796 | ||
686 | rt_mutex_adjust_prio_chain(owner, 0, lock, NULL, current); | 797 | rt_mutex_adjust_prio_chain(owner, 0, lock, next_lock, NULL, current); |
687 | 798 | ||
688 | raw_spin_lock(&lock->wait_lock); | 799 | raw_spin_lock(&lock->wait_lock); |
689 | } | 800 | } |
@@ -696,6 +807,7 @@ static void remove_waiter(struct rt_mutex *lock, | |||
696 | void rt_mutex_adjust_pi(struct task_struct *task) | 807 | void rt_mutex_adjust_pi(struct task_struct *task) |
697 | { | 808 | { |
698 | struct rt_mutex_waiter *waiter; | 809 | struct rt_mutex_waiter *waiter; |
810 | struct rt_mutex *next_lock; | ||
699 | unsigned long flags; | 811 | unsigned long flags; |
700 | 812 | ||
701 | raw_spin_lock_irqsave(&task->pi_lock, flags); | 813 | raw_spin_lock_irqsave(&task->pi_lock, flags); |
@@ -706,12 +818,13 @@ void rt_mutex_adjust_pi(struct task_struct *task) | |||
706 | raw_spin_unlock_irqrestore(&task->pi_lock, flags); | 818 | raw_spin_unlock_irqrestore(&task->pi_lock, flags); |
707 | return; | 819 | return; |
708 | } | 820 | } |
709 | 821 | next_lock = waiter->lock; | |
710 | raw_spin_unlock_irqrestore(&task->pi_lock, flags); | 822 | raw_spin_unlock_irqrestore(&task->pi_lock, flags); |
711 | 823 | ||
712 | /* gets dropped in rt_mutex_adjust_prio_chain()! */ | 824 | /* gets dropped in rt_mutex_adjust_prio_chain()! */ |
713 | get_task_struct(task); | 825 | get_task_struct(task); |
714 | rt_mutex_adjust_prio_chain(task, 0, NULL, NULL, task); | 826 | |
827 | rt_mutex_adjust_prio_chain(task, 0, NULL, next_lock, NULL, task); | ||
715 | } | 828 | } |
716 | 829 | ||
717 | /** | 830 | /** |
@@ -763,6 +876,26 @@ __rt_mutex_slowlock(struct rt_mutex *lock, int state, | |||
763 | return ret; | 876 | return ret; |
764 | } | 877 | } |
765 | 878 | ||
879 | static void rt_mutex_handle_deadlock(int res, int detect_deadlock, | ||
880 | struct rt_mutex_waiter *w) | ||
881 | { | ||
882 | /* | ||
883 | * If the result is not -EDEADLOCK or the caller requested | ||
884 | * deadlock detection, nothing to do here. | ||
885 | */ | ||
886 | if (res != -EDEADLOCK || detect_deadlock) | ||
887 | return; | ||
888 | |||
889 | /* | ||
890 | * Yell lowdly and stop the task right here. | ||
891 | */ | ||
892 | rt_mutex_print_deadlock(w); | ||
893 | while (1) { | ||
894 | set_current_state(TASK_INTERRUPTIBLE); | ||
895 | schedule(); | ||
896 | } | ||
897 | } | ||
898 | |||
766 | /* | 899 | /* |
767 | * Slow path lock function: | 900 | * Slow path lock function: |
768 | */ | 901 | */ |
@@ -802,8 +935,10 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state, | |||
802 | 935 | ||
803 | set_current_state(TASK_RUNNING); | 936 | set_current_state(TASK_RUNNING); |
804 | 937 | ||
805 | if (unlikely(ret)) | 938 | if (unlikely(ret)) { |
806 | remove_waiter(lock, &waiter); | 939 | remove_waiter(lock, &waiter); |
940 | rt_mutex_handle_deadlock(ret, detect_deadlock, &waiter); | ||
941 | } | ||
807 | 942 | ||
808 | /* | 943 | /* |
809 | * try_to_take_rt_mutex() sets the waiter bit | 944 | * try_to_take_rt_mutex() sets the waiter bit |
@@ -859,12 +994,49 @@ rt_mutex_slowunlock(struct rt_mutex *lock) | |||
859 | 994 | ||
860 | rt_mutex_deadlock_account_unlock(current); | 995 | rt_mutex_deadlock_account_unlock(current); |
861 | 996 | ||
862 | if (!rt_mutex_has_waiters(lock)) { | 997 | /* |
863 | lock->owner = NULL; | 998 | * We must be careful here if the fast path is enabled. If we |
864 | raw_spin_unlock(&lock->wait_lock); | 999 | * have no waiters queued we cannot set owner to NULL here |
865 | return; | 1000 | * because of: |
1001 | * | ||
1002 | * foo->lock->owner = NULL; | ||
1003 | * rtmutex_lock(foo->lock); <- fast path | ||
1004 | * free = atomic_dec_and_test(foo->refcnt); | ||
1005 | * rtmutex_unlock(foo->lock); <- fast path | ||
1006 | * if (free) | ||
1007 | * kfree(foo); | ||
1008 | * raw_spin_unlock(foo->lock->wait_lock); | ||
1009 | * | ||
1010 | * So for the fastpath enabled kernel: | ||
1011 | * | ||
1012 | * Nothing can set the waiters bit as long as we hold | ||
1013 | * lock->wait_lock. So we do the following sequence: | ||
1014 | * | ||
1015 | * owner = rt_mutex_owner(lock); | ||
1016 | * clear_rt_mutex_waiters(lock); | ||
1017 | * raw_spin_unlock(&lock->wait_lock); | ||
1018 | * if (cmpxchg(&lock->owner, owner, 0) == owner) | ||
1019 | * return; | ||
1020 | * goto retry; | ||
1021 | * | ||
1022 | * The fastpath disabled variant is simple as all access to | ||
1023 | * lock->owner is serialized by lock->wait_lock: | ||
1024 | * | ||
1025 | * lock->owner = NULL; | ||
1026 | * raw_spin_unlock(&lock->wait_lock); | ||
1027 | */ | ||
1028 | while (!rt_mutex_has_waiters(lock)) { | ||
1029 | /* Drops lock->wait_lock ! */ | ||
1030 | if (unlock_rt_mutex_safe(lock) == true) | ||
1031 | return; | ||
1032 | /* Relock the rtmutex and try again */ | ||
1033 | raw_spin_lock(&lock->wait_lock); | ||
866 | } | 1034 | } |
867 | 1035 | ||
1036 | /* | ||
1037 | * The wakeup next waiter path does not suffer from the above | ||
1038 | * race. See the comments there. | ||
1039 | */ | ||
868 | wakeup_next_waiter(lock); | 1040 | wakeup_next_waiter(lock); |
869 | 1041 | ||
870 | raw_spin_unlock(&lock->wait_lock); | 1042 | raw_spin_unlock(&lock->wait_lock); |
@@ -1112,7 +1284,8 @@ int rt_mutex_start_proxy_lock(struct rt_mutex *lock, | |||
1112 | return 1; | 1284 | return 1; |
1113 | } | 1285 | } |
1114 | 1286 | ||
1115 | ret = task_blocks_on_rt_mutex(lock, waiter, task, detect_deadlock); | 1287 | /* We enforce deadlock detection for futexes */ |
1288 | ret = task_blocks_on_rt_mutex(lock, waiter, task, 1); | ||
1116 | 1289 | ||
1117 | if (ret && !rt_mutex_owner(lock)) { | 1290 | if (ret && !rt_mutex_owner(lock)) { |
1118 | /* | 1291 | /* |
diff --git a/kernel/locking/rtmutex.h b/kernel/locking/rtmutex.h index a1a1dd06421d..f6a1f3c133b1 100644 --- a/kernel/locking/rtmutex.h +++ b/kernel/locking/rtmutex.h | |||
@@ -24,3 +24,8 @@ | |||
24 | #define debug_rt_mutex_print_deadlock(w) do { } while (0) | 24 | #define debug_rt_mutex_print_deadlock(w) do { } while (0) |
25 | #define debug_rt_mutex_detect_deadlock(w,d) (d) | 25 | #define debug_rt_mutex_detect_deadlock(w,d) (d) |
26 | #define debug_rt_mutex_reset_waiter(w) do { } while (0) | 26 | #define debug_rt_mutex_reset_waiter(w) do { } while (0) |
27 | |||
28 | static inline void rt_mutex_print_deadlock(struct rt_mutex_waiter *w) | ||
29 | { | ||
30 | WARN(1, "rtmutex deadlock detected\n"); | ||
31 | } | ||
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 49e0a20fd010..fcc2611d3f14 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | static int nocompress; | 36 | static int nocompress; |
37 | static int noresume; | 37 | static int noresume; |
38 | static int nohibernate; | ||
38 | static int resume_wait; | 39 | static int resume_wait; |
39 | static unsigned int resume_delay; | 40 | static unsigned int resume_delay; |
40 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; | 41 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; |
@@ -62,6 +63,11 @@ bool freezer_test_done; | |||
62 | 63 | ||
63 | static const struct platform_hibernation_ops *hibernation_ops; | 64 | static const struct platform_hibernation_ops *hibernation_ops; |
64 | 65 | ||
66 | bool hibernation_available(void) | ||
67 | { | ||
68 | return (nohibernate == 0); | ||
69 | } | ||
70 | |||
65 | /** | 71 | /** |
66 | * hibernation_set_ops - Set the global hibernate operations. | 72 | * hibernation_set_ops - Set the global hibernate operations. |
67 | * @ops: Hibernation operations to use in subsequent hibernation transitions. | 73 | * @ops: Hibernation operations to use in subsequent hibernation transitions. |
@@ -642,6 +648,11 @@ int hibernate(void) | |||
642 | { | 648 | { |
643 | int error; | 649 | int error; |
644 | 650 | ||
651 | if (!hibernation_available()) { | ||
652 | pr_debug("PM: Hibernation not available.\n"); | ||
653 | return -EPERM; | ||
654 | } | ||
655 | |||
645 | lock_system_sleep(); | 656 | lock_system_sleep(); |
646 | /* The snapshot device should not be opened while we're running */ | 657 | /* The snapshot device should not be opened while we're running */ |
647 | if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { | 658 | if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { |
@@ -734,7 +745,7 @@ static int software_resume(void) | |||
734 | /* | 745 | /* |
735 | * If the user said "noresume".. bail out early. | 746 | * If the user said "noresume".. bail out early. |
736 | */ | 747 | */ |
737 | if (noresume) | 748 | if (noresume || !hibernation_available()) |
738 | return 0; | 749 | return 0; |
739 | 750 | ||
740 | /* | 751 | /* |
@@ -900,6 +911,9 @@ static ssize_t disk_show(struct kobject *kobj, struct kobj_attribute *attr, | |||
900 | int i; | 911 | int i; |
901 | char *start = buf; | 912 | char *start = buf; |
902 | 913 | ||
914 | if (!hibernation_available()) | ||
915 | return sprintf(buf, "[disabled]\n"); | ||
916 | |||
903 | for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) { | 917 | for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) { |
904 | if (!hibernation_modes[i]) | 918 | if (!hibernation_modes[i]) |
905 | continue; | 919 | continue; |
@@ -934,6 +948,9 @@ static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
934 | char *p; | 948 | char *p; |
935 | int mode = HIBERNATION_INVALID; | 949 | int mode = HIBERNATION_INVALID; |
936 | 950 | ||
951 | if (!hibernation_available()) | ||
952 | return -EPERM; | ||
953 | |||
937 | p = memchr(buf, '\n', n); | 954 | p = memchr(buf, '\n', n); |
938 | len = p ? p - buf : n; | 955 | len = p ? p - buf : n; |
939 | 956 | ||
@@ -1101,6 +1118,10 @@ static int __init hibernate_setup(char *str) | |||
1101 | noresume = 1; | 1118 | noresume = 1; |
1102 | else if (!strncmp(str, "nocompress", 10)) | 1119 | else if (!strncmp(str, "nocompress", 10)) |
1103 | nocompress = 1; | 1120 | nocompress = 1; |
1121 | else if (!strncmp(str, "no", 2)) { | ||
1122 | noresume = 1; | ||
1123 | nohibernate = 1; | ||
1124 | } | ||
1104 | return 1; | 1125 | return 1; |
1105 | } | 1126 | } |
1106 | 1127 | ||
@@ -1125,9 +1146,23 @@ static int __init resumedelay_setup(char *str) | |||
1125 | return 1; | 1146 | return 1; |
1126 | } | 1147 | } |
1127 | 1148 | ||
1149 | static int __init nohibernate_setup(char *str) | ||
1150 | { | ||
1151 | noresume = 1; | ||
1152 | nohibernate = 1; | ||
1153 | return 1; | ||
1154 | } | ||
1155 | |||
1156 | static int __init kaslr_nohibernate_setup(char *str) | ||
1157 | { | ||
1158 | return nohibernate_setup(str); | ||
1159 | } | ||
1160 | |||
1128 | __setup("noresume", noresume_setup); | 1161 | __setup("noresume", noresume_setup); |
1129 | __setup("resume_offset=", resume_offset_setup); | 1162 | __setup("resume_offset=", resume_offset_setup); |
1130 | __setup("resume=", resume_setup); | 1163 | __setup("resume=", resume_setup); |
1131 | __setup("hibernate=", hibernate_setup); | 1164 | __setup("hibernate=", hibernate_setup); |
1132 | __setup("resumewait", resumewait_setup); | 1165 | __setup("resumewait", resumewait_setup); |
1133 | __setup("resumedelay=", resumedelay_setup); | 1166 | __setup("resumedelay=", resumedelay_setup); |
1167 | __setup("nohibernate", nohibernate_setup); | ||
1168 | __setup("kaslr", kaslr_nohibernate_setup); | ||
diff --git a/kernel/power/main.c b/kernel/power/main.c index 573410d6647e..8e90f330f139 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -300,13 +300,11 @@ static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr, | |||
300 | s += sprintf(s,"%s ", pm_states[i].label); | 300 | s += sprintf(s,"%s ", pm_states[i].label); |
301 | 301 | ||
302 | #endif | 302 | #endif |
303 | #ifdef CONFIG_HIBERNATION | 303 | if (hibernation_available()) |
304 | s += sprintf(s, "%s\n", "disk"); | 304 | s += sprintf(s, "disk "); |
305 | #else | ||
306 | if (s != buf) | 305 | if (s != buf) |
307 | /* convert the last space to a newline */ | 306 | /* convert the last space to a newline */ |
308 | *(s-1) = '\n'; | 307 | *(s-1) = '\n'; |
309 | #endif | ||
310 | return (s - buf); | 308 | return (s - buf); |
311 | } | 309 | } |
312 | 310 | ||
diff --git a/kernel/power/user.c b/kernel/power/user.c index 98d357584cd6..526e8911460a 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -49,6 +49,9 @@ static int snapshot_open(struct inode *inode, struct file *filp) | |||
49 | struct snapshot_data *data; | 49 | struct snapshot_data *data; |
50 | int error; | 50 | int error; |
51 | 51 | ||
52 | if (!hibernation_available()) | ||
53 | return -EPERM; | ||
54 | |||
52 | lock_system_sleep(); | 55 | lock_system_sleep(); |
53 | 56 | ||
54 | if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { | 57 | if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index ea2d5f6962ed..13e839dbca07 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -1416,9 +1416,10 @@ static int have_callable_console(void) | |||
1416 | /* | 1416 | /* |
1417 | * Can we actually use the console at this time on this cpu? | 1417 | * Can we actually use the console at this time on this cpu? |
1418 | * | 1418 | * |
1419 | * Console drivers may assume that per-cpu resources have been allocated. So | 1419 | * Console drivers may assume that per-cpu resources have |
1420 | * unless they're explicitly marked as being able to cope (CON_ANYTIME) don't | 1420 | * been allocated. So unless they're explicitly marked as |
1421 | * call them until this CPU is officially up. | 1421 | * being able to cope (CON_ANYTIME) don't call them until |
1422 | * this CPU is officially up. | ||
1422 | */ | 1423 | */ |
1423 | static inline int can_use_console(unsigned int cpu) | 1424 | static inline int can_use_console(unsigned int cpu) |
1424 | { | 1425 | { |
@@ -1431,10 +1432,8 @@ static inline int can_use_console(unsigned int cpu) | |||
1431 | * console_lock held, and 'console_locked' set) if it | 1432 | * console_lock held, and 'console_locked' set) if it |
1432 | * is successful, false otherwise. | 1433 | * is successful, false otherwise. |
1433 | */ | 1434 | */ |
1434 | static int console_trylock_for_printk(void) | 1435 | static int console_trylock_for_printk(unsigned int cpu) |
1435 | { | 1436 | { |
1436 | unsigned int cpu = smp_processor_id(); | ||
1437 | |||
1438 | if (!console_trylock()) | 1437 | if (!console_trylock()) |
1439 | return 0; | 1438 | return 0; |
1440 | /* | 1439 | /* |
@@ -1609,8 +1608,7 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
1609 | */ | 1608 | */ |
1610 | if (!oops_in_progress && !lockdep_recursing(current)) { | 1609 | if (!oops_in_progress && !lockdep_recursing(current)) { |
1611 | recursion_bug = 1; | 1610 | recursion_bug = 1; |
1612 | local_irq_restore(flags); | 1611 | goto out_restore_irqs; |
1613 | return 0; | ||
1614 | } | 1612 | } |
1615 | zap_locks(); | 1613 | zap_locks(); |
1616 | } | 1614 | } |
@@ -1718,27 +1716,21 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
1718 | 1716 | ||
1719 | logbuf_cpu = UINT_MAX; | 1717 | logbuf_cpu = UINT_MAX; |
1720 | raw_spin_unlock(&logbuf_lock); | 1718 | raw_spin_unlock(&logbuf_lock); |
1721 | lockdep_on(); | ||
1722 | local_irq_restore(flags); | ||
1723 | 1719 | ||
1724 | /* If called from the scheduler, we can not call up(). */ | 1720 | /* If called from the scheduler, we can not call up(). */ |
1725 | if (in_sched) | 1721 | if (!in_sched) { |
1726 | return printed_len; | 1722 | /* |
1727 | 1723 | * Try to acquire and then immediately release the console | |
1728 | /* | 1724 | * semaphore. The release will print out buffers and wake up |
1729 | * Disable preemption to avoid being preempted while holding | 1725 | * /dev/kmsg and syslog() users. |
1730 | * console_sem which would prevent anyone from printing to console | 1726 | */ |
1731 | */ | 1727 | if (console_trylock_for_printk(this_cpu)) |
1732 | preempt_disable(); | 1728 | console_unlock(); |
1733 | /* | 1729 | } |
1734 | * Try to acquire and then immediately release the console semaphore. | ||
1735 | * The release will print out buffers and wake up /dev/kmsg and syslog() | ||
1736 | * users. | ||
1737 | */ | ||
1738 | if (console_trylock_for_printk()) | ||
1739 | console_unlock(); | ||
1740 | preempt_enable(); | ||
1741 | 1730 | ||
1731 | lockdep_on(); | ||
1732 | out_restore_irqs: | ||
1733 | local_irq_restore(flags); | ||
1742 | return printed_len; | 1734 | return printed_len; |
1743 | } | 1735 | } |
1744 | EXPORT_SYMBOL(vprintk_emit); | 1736 | EXPORT_SYMBOL(vprintk_emit); |
diff --git a/kernel/smp.c b/kernel/smp.c index a1812d184aed..487653b5844f 100644 --- a/kernel/smp.c +++ b/kernel/smp.c | |||
@@ -30,6 +30,8 @@ static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data); | |||
30 | 30 | ||
31 | static DEFINE_PER_CPU_SHARED_ALIGNED(struct llist_head, call_single_queue); | 31 | static DEFINE_PER_CPU_SHARED_ALIGNED(struct llist_head, call_single_queue); |
32 | 32 | ||
33 | static void flush_smp_call_function_queue(bool warn_cpu_offline); | ||
34 | |||
33 | static int | 35 | static int |
34 | hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu) | 36 | hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu) |
35 | { | 37 | { |
@@ -52,12 +54,27 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu) | |||
52 | #ifdef CONFIG_HOTPLUG_CPU | 54 | #ifdef CONFIG_HOTPLUG_CPU |
53 | case CPU_UP_CANCELED: | 55 | case CPU_UP_CANCELED: |
54 | case CPU_UP_CANCELED_FROZEN: | 56 | case CPU_UP_CANCELED_FROZEN: |
57 | /* Fall-through to the CPU_DEAD[_FROZEN] case. */ | ||
55 | 58 | ||
56 | case CPU_DEAD: | 59 | case CPU_DEAD: |
57 | case CPU_DEAD_FROZEN: | 60 | case CPU_DEAD_FROZEN: |
58 | free_cpumask_var(cfd->cpumask); | 61 | free_cpumask_var(cfd->cpumask); |
59 | free_percpu(cfd->csd); | 62 | free_percpu(cfd->csd); |
60 | break; | 63 | break; |
64 | |||
65 | case CPU_DYING: | ||
66 | case CPU_DYING_FROZEN: | ||
67 | /* | ||
68 | * The IPIs for the smp-call-function callbacks queued by other | ||
69 | * CPUs might arrive late, either due to hardware latencies or | ||
70 | * because this CPU disabled interrupts (inside stop-machine) | ||
71 | * before the IPIs were sent. So flush out any pending callbacks | ||
72 | * explicitly (without waiting for the IPIs to arrive), to | ||
73 | * ensure that the outgoing CPU doesn't go offline with work | ||
74 | * still pending. | ||
75 | */ | ||
76 | flush_smp_call_function_queue(false); | ||
77 | break; | ||
61 | #endif | 78 | #endif |
62 | }; | 79 | }; |
63 | 80 | ||
@@ -178,23 +195,47 @@ static int generic_exec_single(int cpu, struct call_single_data *csd, | |||
178 | return 0; | 195 | return 0; |
179 | } | 196 | } |
180 | 197 | ||
181 | /* | 198 | /** |
182 | * Invoked by arch to handle an IPI for call function single. Must be | 199 | * generic_smp_call_function_single_interrupt - Execute SMP IPI callbacks |
183 | * called from the arch with interrupts disabled. | 200 | * |
201 | * Invoked by arch to handle an IPI for call function single. | ||
202 | * Must be called with interrupts disabled. | ||
184 | */ | 203 | */ |
185 | void generic_smp_call_function_single_interrupt(void) | 204 | void generic_smp_call_function_single_interrupt(void) |
186 | { | 205 | { |
206 | flush_smp_call_function_queue(true); | ||
207 | } | ||
208 | |||
209 | /** | ||
210 | * flush_smp_call_function_queue - Flush pending smp-call-function callbacks | ||
211 | * | ||
212 | * @warn_cpu_offline: If set to 'true', warn if callbacks were queued on an | ||
213 | * offline CPU. Skip this check if set to 'false'. | ||
214 | * | ||
215 | * Flush any pending smp-call-function callbacks queued on this CPU. This is | ||
216 | * invoked by the generic IPI handler, as well as by a CPU about to go offline, | ||
217 | * to ensure that all pending IPI callbacks are run before it goes completely | ||
218 | * offline. | ||
219 | * | ||
220 | * Loop through the call_single_queue and run all the queued callbacks. | ||
221 | * Must be called with interrupts disabled. | ||
222 | */ | ||
223 | static void flush_smp_call_function_queue(bool warn_cpu_offline) | ||
224 | { | ||
225 | struct llist_head *head; | ||
187 | struct llist_node *entry; | 226 | struct llist_node *entry; |
188 | struct call_single_data *csd, *csd_next; | 227 | struct call_single_data *csd, *csd_next; |
189 | static bool warned; | 228 | static bool warned; |
190 | 229 | ||
191 | entry = llist_del_all(&__get_cpu_var(call_single_queue)); | 230 | WARN_ON(!irqs_disabled()); |
231 | |||
232 | head = &__get_cpu_var(call_single_queue); | ||
233 | entry = llist_del_all(head); | ||
192 | entry = llist_reverse_order(entry); | 234 | entry = llist_reverse_order(entry); |
193 | 235 | ||
194 | /* | 236 | /* There shouldn't be any pending callbacks on an offline CPU. */ |
195 | * Shouldn't receive this interrupt on a cpu that is not yet online. | 237 | if (unlikely(warn_cpu_offline && !cpu_online(smp_processor_id()) && |
196 | */ | 238 | !warned && !llist_empty(head))) { |
197 | if (unlikely(!cpu_online(smp_processor_id()) && !warned)) { | ||
198 | warned = true; | 239 | warned = true; |
199 | WARN(1, "IPI on offline CPU %d\n", smp_processor_id()); | 240 | WARN(1, "IPI on offline CPU %d\n", smp_processor_id()); |
200 | 241 | ||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ba9ed453c4ed..75b22e22a72c 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -136,7 +136,6 @@ static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; | |||
136 | /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ | 136 | /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ |
137 | static int maxolduid = 65535; | 137 | static int maxolduid = 65535; |
138 | static int minolduid; | 138 | static int minolduid; |
139 | static int min_percpu_pagelist_fract = 8; | ||
140 | 139 | ||
141 | static int ngroups_max = NGROUPS_MAX; | 140 | static int ngroups_max = NGROUPS_MAX; |
142 | static const int cap_last_cap = CAP_LAST_CAP; | 141 | static const int cap_last_cap = CAP_LAST_CAP; |
@@ -152,10 +151,6 @@ static unsigned long hung_task_timeout_max = (LONG_MAX/HZ); | |||
152 | #ifdef CONFIG_SPARC | 151 | #ifdef CONFIG_SPARC |
153 | #endif | 152 | #endif |
154 | 153 | ||
155 | #ifdef CONFIG_SPARC64 | ||
156 | extern int sysctl_tsb_ratio; | ||
157 | #endif | ||
158 | |||
159 | #ifdef __hppa__ | 154 | #ifdef __hppa__ |
160 | extern int pwrsw_enabled; | 155 | extern int pwrsw_enabled; |
161 | #endif | 156 | #endif |
@@ -865,6 +860,17 @@ static struct ctl_table kern_table[] = { | |||
865 | .extra1 = &zero, | 860 | .extra1 = &zero, |
866 | .extra2 = &one, | 861 | .extra2 = &one, |
867 | }, | 862 | }, |
863 | #ifdef CONFIG_SMP | ||
864 | { | ||
865 | .procname = "softlockup_all_cpu_backtrace", | ||
866 | .data = &sysctl_softlockup_all_cpu_backtrace, | ||
867 | .maxlen = sizeof(int), | ||
868 | .mode = 0644, | ||
869 | .proc_handler = proc_dointvec_minmax, | ||
870 | .extra1 = &zero, | ||
871 | .extra2 = &one, | ||
872 | }, | ||
873 | #endif /* CONFIG_SMP */ | ||
868 | { | 874 | { |
869 | .procname = "nmi_watchdog", | 875 | .procname = "nmi_watchdog", |
870 | .data = &watchdog_user_enabled, | 876 | .data = &watchdog_user_enabled, |
@@ -1321,7 +1327,7 @@ static struct ctl_table vm_table[] = { | |||
1321 | .maxlen = sizeof(percpu_pagelist_fraction), | 1327 | .maxlen = sizeof(percpu_pagelist_fraction), |
1322 | .mode = 0644, | 1328 | .mode = 0644, |
1323 | .proc_handler = percpu_pagelist_fraction_sysctl_handler, | 1329 | .proc_handler = percpu_pagelist_fraction_sysctl_handler, |
1324 | .extra1 = &min_percpu_pagelist_fract, | 1330 | .extra1 = &zero, |
1325 | }, | 1331 | }, |
1326 | #ifdef CONFIG_MMU | 1332 | #ifdef CONFIG_MMU |
1327 | { | 1333 | { |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 384ede311717..f243444a3772 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1396,7 +1396,6 @@ void tracing_start(void) | |||
1396 | 1396 | ||
1397 | arch_spin_unlock(&global_trace.max_lock); | 1397 | arch_spin_unlock(&global_trace.max_lock); |
1398 | 1398 | ||
1399 | ftrace_start(); | ||
1400 | out: | 1399 | out: |
1401 | raw_spin_unlock_irqrestore(&global_trace.start_lock, flags); | 1400 | raw_spin_unlock_irqrestore(&global_trace.start_lock, flags); |
1402 | } | 1401 | } |
@@ -1443,7 +1442,6 @@ void tracing_stop(void) | |||
1443 | struct ring_buffer *buffer; | 1442 | struct ring_buffer *buffer; |
1444 | unsigned long flags; | 1443 | unsigned long flags; |
1445 | 1444 | ||
1446 | ftrace_stop(); | ||
1447 | raw_spin_lock_irqsave(&global_trace.start_lock, flags); | 1445 | raw_spin_lock_irqsave(&global_trace.start_lock, flags); |
1448 | if (global_trace.stop_count++) | 1446 | if (global_trace.stop_count++) |
1449 | goto out; | 1447 | goto out; |
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 04fdb5de823c..3c9b97e6b1f4 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c | |||
@@ -893,6 +893,9 @@ probe_event_enable(struct trace_uprobe *tu, struct ftrace_event_file *file, | |||
893 | int ret; | 893 | int ret; |
894 | 894 | ||
895 | if (file) { | 895 | if (file) { |
896 | if (tu->tp.flags & TP_FLAG_PROFILE) | ||
897 | return -EINTR; | ||
898 | |||
896 | link = kmalloc(sizeof(*link), GFP_KERNEL); | 899 | link = kmalloc(sizeof(*link), GFP_KERNEL); |
897 | if (!link) | 900 | if (!link) |
898 | return -ENOMEM; | 901 | return -ENOMEM; |
@@ -901,29 +904,40 @@ probe_event_enable(struct trace_uprobe *tu, struct ftrace_event_file *file, | |||
901 | list_add_tail_rcu(&link->list, &tu->tp.files); | 904 | list_add_tail_rcu(&link->list, &tu->tp.files); |
902 | 905 | ||
903 | tu->tp.flags |= TP_FLAG_TRACE; | 906 | tu->tp.flags |= TP_FLAG_TRACE; |
904 | } else | 907 | } else { |
905 | tu->tp.flags |= TP_FLAG_PROFILE; | 908 | if (tu->tp.flags & TP_FLAG_TRACE) |
909 | return -EINTR; | ||
906 | 910 | ||
907 | ret = uprobe_buffer_enable(); | 911 | tu->tp.flags |= TP_FLAG_PROFILE; |
908 | if (ret < 0) | 912 | } |
909 | return ret; | ||
910 | 913 | ||
911 | WARN_ON(!uprobe_filter_is_empty(&tu->filter)); | 914 | WARN_ON(!uprobe_filter_is_empty(&tu->filter)); |
912 | 915 | ||
913 | if (enabled) | 916 | if (enabled) |
914 | return 0; | 917 | return 0; |
915 | 918 | ||
919 | ret = uprobe_buffer_enable(); | ||
920 | if (ret) | ||
921 | goto err_flags; | ||
922 | |||
916 | tu->consumer.filter = filter; | 923 | tu->consumer.filter = filter; |
917 | ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); | 924 | ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); |
918 | if (ret) { | 925 | if (ret) |
919 | if (file) { | 926 | goto err_buffer; |
920 | list_del(&link->list); | ||
921 | kfree(link); | ||
922 | tu->tp.flags &= ~TP_FLAG_TRACE; | ||
923 | } else | ||
924 | tu->tp.flags &= ~TP_FLAG_PROFILE; | ||
925 | } | ||
926 | 927 | ||
928 | return 0; | ||
929 | |||
930 | err_buffer: | ||
931 | uprobe_buffer_disable(); | ||
932 | |||
933 | err_flags: | ||
934 | if (file) { | ||
935 | list_del(&link->list); | ||
936 | kfree(link); | ||
937 | tu->tp.flags &= ~TP_FLAG_TRACE; | ||
938 | } else { | ||
939 | tu->tp.flags &= ~TP_FLAG_PROFILE; | ||
940 | } | ||
927 | return ret; | 941 | return ret; |
928 | } | 942 | } |
929 | 943 | ||
@@ -1201,12 +1215,6 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) | |||
1201 | 1215 | ||
1202 | current->utask->vaddr = (unsigned long) &udd; | 1216 | current->utask->vaddr = (unsigned long) &udd; |
1203 | 1217 | ||
1204 | #ifdef CONFIG_PERF_EVENTS | ||
1205 | if ((tu->tp.flags & TP_FLAG_TRACE) == 0 && | ||
1206 | !uprobe_perf_filter(&tu->consumer, 0, current->mm)) | ||
1207 | return UPROBE_HANDLER_REMOVE; | ||
1208 | #endif | ||
1209 | |||
1210 | if (WARN_ON_ONCE(!uprobe_cpu_buffer)) | 1218 | if (WARN_ON_ONCE(!uprobe_cpu_buffer)) |
1211 | return 0; | 1219 | return 0; |
1212 | 1220 | ||
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index 33cbd8c203f8..3490407dc7b7 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c | |||
@@ -492,33 +492,29 @@ static int sys_tracepoint_refcount; | |||
492 | 492 | ||
493 | void syscall_regfunc(void) | 493 | void syscall_regfunc(void) |
494 | { | 494 | { |
495 | unsigned long flags; | 495 | struct task_struct *p, *t; |
496 | struct task_struct *g, *t; | ||
497 | 496 | ||
498 | if (!sys_tracepoint_refcount) { | 497 | if (!sys_tracepoint_refcount) { |
499 | read_lock_irqsave(&tasklist_lock, flags); | 498 | read_lock(&tasklist_lock); |
500 | do_each_thread(g, t) { | 499 | for_each_process_thread(p, t) { |
501 | /* Skip kernel threads. */ | 500 | set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); |
502 | if (t->mm) | 501 | } |
503 | set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); | 502 | read_unlock(&tasklist_lock); |
504 | } while_each_thread(g, t); | ||
505 | read_unlock_irqrestore(&tasklist_lock, flags); | ||
506 | } | 503 | } |
507 | sys_tracepoint_refcount++; | 504 | sys_tracepoint_refcount++; |
508 | } | 505 | } |
509 | 506 | ||
510 | void syscall_unregfunc(void) | 507 | void syscall_unregfunc(void) |
511 | { | 508 | { |
512 | unsigned long flags; | 509 | struct task_struct *p, *t; |
513 | struct task_struct *g, *t; | ||
514 | 510 | ||
515 | sys_tracepoint_refcount--; | 511 | sys_tracepoint_refcount--; |
516 | if (!sys_tracepoint_refcount) { | 512 | if (!sys_tracepoint_refcount) { |
517 | read_lock_irqsave(&tasklist_lock, flags); | 513 | read_lock(&tasklist_lock); |
518 | do_each_thread(g, t) { | 514 | for_each_process_thread(p, t) { |
519 | clear_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); | 515 | clear_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); |
520 | } while_each_thread(g, t); | 516 | } |
521 | read_unlock_irqrestore(&tasklist_lock, flags); | 517 | read_unlock(&tasklist_lock); |
522 | } | 518 | } |
523 | } | 519 | } |
524 | #endif | 520 | #endif |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 516203e665fc..c3319bd1b040 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -31,6 +31,12 @@ | |||
31 | 31 | ||
32 | int watchdog_user_enabled = 1; | 32 | int watchdog_user_enabled = 1; |
33 | int __read_mostly watchdog_thresh = 10; | 33 | int __read_mostly watchdog_thresh = 10; |
34 | #ifdef CONFIG_SMP | ||
35 | int __read_mostly sysctl_softlockup_all_cpu_backtrace; | ||
36 | #else | ||
37 | #define sysctl_softlockup_all_cpu_backtrace 0 | ||
38 | #endif | ||
39 | |||
34 | static int __read_mostly watchdog_running; | 40 | static int __read_mostly watchdog_running; |
35 | static u64 __read_mostly sample_period; | 41 | static u64 __read_mostly sample_period; |
36 | 42 | ||
@@ -47,6 +53,7 @@ static DEFINE_PER_CPU(bool, watchdog_nmi_touch); | |||
47 | static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); | 53 | static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); |
48 | static DEFINE_PER_CPU(struct perf_event *, watchdog_ev); | 54 | static DEFINE_PER_CPU(struct perf_event *, watchdog_ev); |
49 | #endif | 55 | #endif |
56 | static unsigned long soft_lockup_nmi_warn; | ||
50 | 57 | ||
51 | /* boot commands */ | 58 | /* boot commands */ |
52 | /* | 59 | /* |
@@ -95,6 +102,15 @@ static int __init nosoftlockup_setup(char *str) | |||
95 | } | 102 | } |
96 | __setup("nosoftlockup", nosoftlockup_setup); | 103 | __setup("nosoftlockup", nosoftlockup_setup); |
97 | /* */ | 104 | /* */ |
105 | #ifdef CONFIG_SMP | ||
106 | static int __init softlockup_all_cpu_backtrace_setup(char *str) | ||
107 | { | ||
108 | sysctl_softlockup_all_cpu_backtrace = | ||
109 | !!simple_strtol(str, NULL, 0); | ||
110 | return 1; | ||
111 | } | ||
112 | __setup("softlockup_all_cpu_backtrace=", softlockup_all_cpu_backtrace_setup); | ||
113 | #endif | ||
98 | 114 | ||
99 | /* | 115 | /* |
100 | * Hard-lockup warnings should be triggered after just a few seconds. Soft- | 116 | * Hard-lockup warnings should be triggered after just a few seconds. Soft- |
@@ -271,6 +287,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) | |||
271 | unsigned long touch_ts = __this_cpu_read(watchdog_touch_ts); | 287 | unsigned long touch_ts = __this_cpu_read(watchdog_touch_ts); |
272 | struct pt_regs *regs = get_irq_regs(); | 288 | struct pt_regs *regs = get_irq_regs(); |
273 | int duration; | 289 | int duration; |
290 | int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace; | ||
274 | 291 | ||
275 | /* kick the hardlockup detector */ | 292 | /* kick the hardlockup detector */ |
276 | watchdog_interrupt_count(); | 293 | watchdog_interrupt_count(); |
@@ -317,6 +334,17 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) | |||
317 | if (__this_cpu_read(soft_watchdog_warn) == true) | 334 | if (__this_cpu_read(soft_watchdog_warn) == true) |
318 | return HRTIMER_RESTART; | 335 | return HRTIMER_RESTART; |
319 | 336 | ||
337 | if (softlockup_all_cpu_backtrace) { | ||
338 | /* Prevent multiple soft-lockup reports if one cpu is already | ||
339 | * engaged in dumping cpu back traces | ||
340 | */ | ||
341 | if (test_and_set_bit(0, &soft_lockup_nmi_warn)) { | ||
342 | /* Someone else will report us. Let's give up */ | ||
343 | __this_cpu_write(soft_watchdog_warn, true); | ||
344 | return HRTIMER_RESTART; | ||
345 | } | ||
346 | } | ||
347 | |||
320 | printk(KERN_EMERG "BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n", | 348 | printk(KERN_EMERG "BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n", |
321 | smp_processor_id(), duration, | 349 | smp_processor_id(), duration, |
322 | current->comm, task_pid_nr(current)); | 350 | current->comm, task_pid_nr(current)); |
@@ -327,6 +355,17 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) | |||
327 | else | 355 | else |
328 | dump_stack(); | 356 | dump_stack(); |
329 | 357 | ||
358 | if (softlockup_all_cpu_backtrace) { | ||
359 | /* Avoid generating two back traces for current | ||
360 | * given that one is already made above | ||
361 | */ | ||
362 | trigger_allbutself_cpu_backtrace(); | ||
363 | |||
364 | clear_bit(0, &soft_lockup_nmi_warn); | ||
365 | /* Barrier to sync with other cpus */ | ||
366 | smp_mb__after_atomic(); | ||
367 | } | ||
368 | |||
330 | if (softlockup_panic) | 369 | if (softlockup_panic) |
331 | panic("softlockup: hung tasks"); | 370 | panic("softlockup: hung tasks"); |
332 | __this_cpu_write(soft_watchdog_warn, true); | 371 | __this_cpu_write(soft_watchdog_warn, true); |
@@ -527,10 +566,8 @@ static void update_timers_all_cpus(void) | |||
527 | int cpu; | 566 | int cpu; |
528 | 567 | ||
529 | get_online_cpus(); | 568 | get_online_cpus(); |
530 | preempt_disable(); | ||
531 | for_each_online_cpu(cpu) | 569 | for_each_online_cpu(cpu) |
532 | update_timers(cpu); | 570 | update_timers(cpu); |
533 | preempt_enable(); | ||
534 | put_online_cpus(); | 571 | put_online_cpus(); |
535 | } | 572 | } |
536 | 573 | ||
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 6203d2900877..35974ac69600 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -3284,6 +3284,7 @@ int workqueue_sysfs_register(struct workqueue_struct *wq) | |||
3284 | } | 3284 | } |
3285 | } | 3285 | } |
3286 | 3286 | ||
3287 | dev_set_uevent_suppress(&wq_dev->dev, false); | ||
3287 | kobject_uevent(&wq_dev->dev.kobj, KOBJ_ADD); | 3288 | kobject_uevent(&wq_dev->dev.kobj, KOBJ_ADD); |
3288 | return 0; | 3289 | return 0; |
3289 | } | 3290 | } |
@@ -4879,7 +4880,7 @@ static void __init wq_numa_init(void) | |||
4879 | BUG_ON(!tbl); | 4880 | BUG_ON(!tbl); |
4880 | 4881 | ||
4881 | for_each_node(node) | 4882 | for_each_node(node) |
4882 | BUG_ON(!alloc_cpumask_var_node(&tbl[node], GFP_KERNEL, | 4883 | BUG_ON(!zalloc_cpumask_var_node(&tbl[node], GFP_KERNEL, |
4883 | node_online(node) ? node : NUMA_NO_NODE)); | 4884 | node_online(node) ? node : NUMA_NO_NODE)); |
4884 | 4885 | ||
4885 | for_each_possible_cpu(cpu) { | 4886 | for_each_possible_cpu(cpu) { |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 7cfcc1b8e101..7a638aa3545b 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -930,7 +930,7 @@ config LOCKDEP | |||
930 | bool | 930 | bool |
931 | depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT | 931 | depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT |
932 | select STACKTRACE | 932 | select STACKTRACE |
933 | select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC | 933 | select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC && !SCORE |
934 | select KALLSYMS | 934 | select KALLSYMS |
935 | select KALLSYMS_ALL | 935 | select KALLSYMS_ALL |
936 | 936 | ||
@@ -1408,7 +1408,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER | |||
1408 | depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT | 1408 | depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT |
1409 | depends on !X86_64 | 1409 | depends on !X86_64 |
1410 | select STACKTRACE | 1410 | select STACKTRACE |
1411 | select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC | 1411 | select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !SCORE |
1412 | help | 1412 | help |
1413 | Provide stacktrace filter for fault-injection capabilities | 1413 | Provide stacktrace filter for fault-injection capabilities |
1414 | 1414 | ||
diff --git a/lib/iovec.c b/lib/iovec.c index 454baa88bf27..7a7c2da4cddf 100644 --- a/lib/iovec.c +++ b/lib/iovec.c | |||
@@ -51,3 +51,58 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) | |||
51 | return 0; | 51 | return 0; |
52 | } | 52 | } |
53 | EXPORT_SYMBOL(memcpy_toiovec); | 53 | EXPORT_SYMBOL(memcpy_toiovec); |
54 | |||
55 | /* | ||
56 | * Copy kernel to iovec. Returns -EFAULT on error. | ||
57 | */ | ||
58 | |||
59 | int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, | ||
60 | int offset, int len) | ||
61 | { | ||
62 | int copy; | ||
63 | for (; len > 0; ++iov) { | ||
64 | /* Skip over the finished iovecs */ | ||
65 | if (unlikely(offset >= iov->iov_len)) { | ||
66 | offset -= iov->iov_len; | ||
67 | continue; | ||
68 | } | ||
69 | copy = min_t(unsigned int, iov->iov_len - offset, len); | ||
70 | if (copy_to_user(iov->iov_base + offset, kdata, copy)) | ||
71 | return -EFAULT; | ||
72 | offset = 0; | ||
73 | kdata += copy; | ||
74 | len -= copy; | ||
75 | } | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | EXPORT_SYMBOL(memcpy_toiovecend); | ||
80 | |||
81 | /* | ||
82 | * Copy iovec to kernel. Returns -EFAULT on error. | ||
83 | */ | ||
84 | |||
85 | int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, | ||
86 | int offset, int len) | ||
87 | { | ||
88 | /* Skip over the finished iovecs */ | ||
89 | while (offset >= iov->iov_len) { | ||
90 | offset -= iov->iov_len; | ||
91 | iov++; | ||
92 | } | ||
93 | |||
94 | while (len > 0) { | ||
95 | u8 __user *base = iov->iov_base + offset; | ||
96 | int copy = min_t(unsigned int, len, iov->iov_len - offset); | ||
97 | |||
98 | offset = 0; | ||
99 | if (copy_from_user(kdata, base, copy)) | ||
100 | return -EFAULT; | ||
101 | len -= copy; | ||
102 | kdata += copy; | ||
103 | iov++; | ||
104 | } | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | EXPORT_SYMBOL(memcpy_fromiovecend); | ||
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index df6839e3ce08..7a85967060a5 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c | |||
@@ -72,6 +72,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
72 | len = *ip++; | 72 | len = *ip++; |
73 | for (; len == 255; length += 255) | 73 | for (; len == 255; length += 255) |
74 | len = *ip++; | 74 | len = *ip++; |
75 | if (unlikely(length > (size_t)(length + len))) | ||
76 | goto _output_error; | ||
75 | length += len; | 77 | length += len; |
76 | } | 78 | } |
77 | 79 | ||
@@ -106,6 +108,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
106 | if (length == ML_MASK) { | 108 | if (length == ML_MASK) { |
107 | for (; *ip == 255; length += 255) | 109 | for (; *ip == 255; length += 255) |
108 | ip++; | 110 | ip++; |
111 | if (unlikely(length > (size_t)(length + *ip))) | ||
112 | goto _output_error; | ||
109 | length += *ip++; | 113 | length += *ip++; |
110 | } | 114 | } |
111 | 115 | ||
@@ -155,7 +159,7 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
155 | 159 | ||
156 | /* write overflow error detected */ | 160 | /* write overflow error detected */ |
157 | _output_error: | 161 | _output_error: |
158 | return (int) (-(((char *)ip) - source)); | 162 | return -1; |
159 | } | 163 | } |
160 | 164 | ||
161 | static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | 165 | static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, |
@@ -188,6 +192,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
188 | int s = 255; | 192 | int s = 255; |
189 | while ((ip < iend) && (s == 255)) { | 193 | while ((ip < iend) && (s == 255)) { |
190 | s = *ip++; | 194 | s = *ip++; |
195 | if (unlikely(length > (size_t)(length + s))) | ||
196 | goto _output_error; | ||
191 | length += s; | 197 | length += s; |
192 | } | 198 | } |
193 | } | 199 | } |
@@ -228,6 +234,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
228 | if (length == ML_MASK) { | 234 | if (length == ML_MASK) { |
229 | while (ip < iend) { | 235 | while (ip < iend) { |
230 | int s = *ip++; | 236 | int s = *ip++; |
237 | if (unlikely(length > (size_t)(length + s))) | ||
238 | goto _output_error; | ||
231 | length += s; | 239 | length += s; |
232 | if (s == 255) | 240 | if (s == 255) |
233 | continue; | 241 | continue; |
@@ -280,7 +288,7 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
280 | 288 | ||
281 | /* write overflow error detected */ | 289 | /* write overflow error detected */ |
282 | _output_error: | 290 | _output_error: |
283 | return (int) (-(((char *) ip) - source)); | 291 | return -1; |
284 | } | 292 | } |
285 | 293 | ||
286 | int lz4_decompress(const unsigned char *src, size_t *src_len, | 294 | int lz4_decompress(const unsigned char *src, size_t *src_len, |
diff --git a/lib/lzo/lzo1x_decompress_safe.c b/lib/lzo/lzo1x_decompress_safe.c index 569985d522d5..8563081e8da3 100644 --- a/lib/lzo/lzo1x_decompress_safe.c +++ b/lib/lzo/lzo1x_decompress_safe.c | |||
@@ -19,11 +19,31 @@ | |||
19 | #include <linux/lzo.h> | 19 | #include <linux/lzo.h> |
20 | #include "lzodefs.h" | 20 | #include "lzodefs.h" |
21 | 21 | ||
22 | #define HAVE_IP(x) ((size_t)(ip_end - ip) >= (size_t)(x)) | 22 | #define HAVE_IP(t, x) \ |
23 | #define HAVE_OP(x) ((size_t)(op_end - op) >= (size_t)(x)) | 23 | (((size_t)(ip_end - ip) >= (size_t)(t + x)) && \ |
24 | #define NEED_IP(x) if (!HAVE_IP(x)) goto input_overrun | 24 | (((t + x) >= t) && ((t + x) >= x))) |
25 | #define NEED_OP(x) if (!HAVE_OP(x)) goto output_overrun | 25 | |
26 | #define TEST_LB(m_pos) if ((m_pos) < out) goto lookbehind_overrun | 26 | #define HAVE_OP(t, x) \ |
27 | (((size_t)(op_end - op) >= (size_t)(t + x)) && \ | ||
28 | (((t + x) >= t) && ((t + x) >= x))) | ||
29 | |||
30 | #define NEED_IP(t, x) \ | ||
31 | do { \ | ||
32 | if (!HAVE_IP(t, x)) \ | ||
33 | goto input_overrun; \ | ||
34 | } while (0) | ||
35 | |||
36 | #define NEED_OP(t, x) \ | ||
37 | do { \ | ||
38 | if (!HAVE_OP(t, x)) \ | ||
39 | goto output_overrun; \ | ||
40 | } while (0) | ||
41 | |||
42 | #define TEST_LB(m_pos) \ | ||
43 | do { \ | ||
44 | if ((m_pos) < out) \ | ||
45 | goto lookbehind_overrun; \ | ||
46 | } while (0) | ||
27 | 47 | ||
28 | int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, | 48 | int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, |
29 | unsigned char *out, size_t *out_len) | 49 | unsigned char *out, size_t *out_len) |
@@ -58,14 +78,14 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, | |||
58 | while (unlikely(*ip == 0)) { | 78 | while (unlikely(*ip == 0)) { |
59 | t += 255; | 79 | t += 255; |
60 | ip++; | 80 | ip++; |
61 | NEED_IP(1); | 81 | NEED_IP(1, 0); |
62 | } | 82 | } |
63 | t += 15 + *ip++; | 83 | t += 15 + *ip++; |
64 | } | 84 | } |
65 | t += 3; | 85 | t += 3; |
66 | copy_literal_run: | 86 | copy_literal_run: |
67 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 87 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) |
68 | if (likely(HAVE_IP(t + 15) && HAVE_OP(t + 15))) { | 88 | if (likely(HAVE_IP(t, 15) && HAVE_OP(t, 15))) { |
69 | const unsigned char *ie = ip + t; | 89 | const unsigned char *ie = ip + t; |
70 | unsigned char *oe = op + t; | 90 | unsigned char *oe = op + t; |
71 | do { | 91 | do { |
@@ -81,8 +101,8 @@ copy_literal_run: | |||
81 | } else | 101 | } else |
82 | #endif | 102 | #endif |
83 | { | 103 | { |
84 | NEED_OP(t); | 104 | NEED_OP(t, 0); |
85 | NEED_IP(t + 3); | 105 | NEED_IP(t, 3); |
86 | do { | 106 | do { |
87 | *op++ = *ip++; | 107 | *op++ = *ip++; |
88 | } while (--t > 0); | 108 | } while (--t > 0); |
@@ -95,7 +115,7 @@ copy_literal_run: | |||
95 | m_pos -= t >> 2; | 115 | m_pos -= t >> 2; |
96 | m_pos -= *ip++ << 2; | 116 | m_pos -= *ip++ << 2; |
97 | TEST_LB(m_pos); | 117 | TEST_LB(m_pos); |
98 | NEED_OP(2); | 118 | NEED_OP(2, 0); |
99 | op[0] = m_pos[0]; | 119 | op[0] = m_pos[0]; |
100 | op[1] = m_pos[1]; | 120 | op[1] = m_pos[1]; |
101 | op += 2; | 121 | op += 2; |
@@ -119,10 +139,10 @@ copy_literal_run: | |||
119 | while (unlikely(*ip == 0)) { | 139 | while (unlikely(*ip == 0)) { |
120 | t += 255; | 140 | t += 255; |
121 | ip++; | 141 | ip++; |
122 | NEED_IP(1); | 142 | NEED_IP(1, 0); |
123 | } | 143 | } |
124 | t += 31 + *ip++; | 144 | t += 31 + *ip++; |
125 | NEED_IP(2); | 145 | NEED_IP(2, 0); |
126 | } | 146 | } |
127 | m_pos = op - 1; | 147 | m_pos = op - 1; |
128 | next = get_unaligned_le16(ip); | 148 | next = get_unaligned_le16(ip); |
@@ -137,10 +157,10 @@ copy_literal_run: | |||
137 | while (unlikely(*ip == 0)) { | 157 | while (unlikely(*ip == 0)) { |
138 | t += 255; | 158 | t += 255; |
139 | ip++; | 159 | ip++; |
140 | NEED_IP(1); | 160 | NEED_IP(1, 0); |
141 | } | 161 | } |
142 | t += 7 + *ip++; | 162 | t += 7 + *ip++; |
143 | NEED_IP(2); | 163 | NEED_IP(2, 0); |
144 | } | 164 | } |
145 | next = get_unaligned_le16(ip); | 165 | next = get_unaligned_le16(ip); |
146 | ip += 2; | 166 | ip += 2; |
@@ -154,7 +174,7 @@ copy_literal_run: | |||
154 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 174 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) |
155 | if (op - m_pos >= 8) { | 175 | if (op - m_pos >= 8) { |
156 | unsigned char *oe = op + t; | 176 | unsigned char *oe = op + t; |
157 | if (likely(HAVE_OP(t + 15))) { | 177 | if (likely(HAVE_OP(t, 15))) { |
158 | do { | 178 | do { |
159 | COPY8(op, m_pos); | 179 | COPY8(op, m_pos); |
160 | op += 8; | 180 | op += 8; |
@@ -164,7 +184,7 @@ copy_literal_run: | |||
164 | m_pos += 8; | 184 | m_pos += 8; |
165 | } while (op < oe); | 185 | } while (op < oe); |
166 | op = oe; | 186 | op = oe; |
167 | if (HAVE_IP(6)) { | 187 | if (HAVE_IP(6, 0)) { |
168 | state = next; | 188 | state = next; |
169 | COPY4(op, ip); | 189 | COPY4(op, ip); |
170 | op += next; | 190 | op += next; |
@@ -172,7 +192,7 @@ copy_literal_run: | |||
172 | continue; | 192 | continue; |
173 | } | 193 | } |
174 | } else { | 194 | } else { |
175 | NEED_OP(t); | 195 | NEED_OP(t, 0); |
176 | do { | 196 | do { |
177 | *op++ = *m_pos++; | 197 | *op++ = *m_pos++; |
178 | } while (op < oe); | 198 | } while (op < oe); |
@@ -181,7 +201,7 @@ copy_literal_run: | |||
181 | #endif | 201 | #endif |
182 | { | 202 | { |
183 | unsigned char *oe = op + t; | 203 | unsigned char *oe = op + t; |
184 | NEED_OP(t); | 204 | NEED_OP(t, 0); |
185 | op[0] = m_pos[0]; | 205 | op[0] = m_pos[0]; |
186 | op[1] = m_pos[1]; | 206 | op[1] = m_pos[1]; |
187 | op += 2; | 207 | op += 2; |
@@ -194,15 +214,15 @@ match_next: | |||
194 | state = next; | 214 | state = next; |
195 | t = next; | 215 | t = next; |
196 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 216 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) |
197 | if (likely(HAVE_IP(6) && HAVE_OP(4))) { | 217 | if (likely(HAVE_IP(6, 0) && HAVE_OP(4, 0))) { |
198 | COPY4(op, ip); | 218 | COPY4(op, ip); |
199 | op += t; | 219 | op += t; |
200 | ip += t; | 220 | ip += t; |
201 | } else | 221 | } else |
202 | #endif | 222 | #endif |
203 | { | 223 | { |
204 | NEED_IP(t + 3); | 224 | NEED_IP(t, 3); |
205 | NEED_OP(t); | 225 | NEED_OP(t, 0); |
206 | while (t > 0) { | 226 | while (t > 0) { |
207 | *op++ = *ip++; | 227 | *op++ = *ip++; |
208 | t--; | 228 | t--; |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 649d097853a1..4abda074ea45 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -86,6 +86,7 @@ static unsigned int io_tlb_index; | |||
86 | * We need to save away the original address corresponding to a mapped entry | 86 | * We need to save away the original address corresponding to a mapped entry |
87 | * for the sync operations. | 87 | * for the sync operations. |
88 | */ | 88 | */ |
89 | #define INVALID_PHYS_ADDR (~(phys_addr_t)0) | ||
89 | static phys_addr_t *io_tlb_orig_addr; | 90 | static phys_addr_t *io_tlb_orig_addr; |
90 | 91 | ||
91 | /* | 92 | /* |
@@ -188,12 +189,14 @@ int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose) | |||
188 | io_tlb_list = memblock_virt_alloc( | 189 | io_tlb_list = memblock_virt_alloc( |
189 | PAGE_ALIGN(io_tlb_nslabs * sizeof(int)), | 190 | PAGE_ALIGN(io_tlb_nslabs * sizeof(int)), |
190 | PAGE_SIZE); | 191 | PAGE_SIZE); |
191 | for (i = 0; i < io_tlb_nslabs; i++) | ||
192 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
193 | io_tlb_index = 0; | ||
194 | io_tlb_orig_addr = memblock_virt_alloc( | 192 | io_tlb_orig_addr = memblock_virt_alloc( |
195 | PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t)), | 193 | PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t)), |
196 | PAGE_SIZE); | 194 | PAGE_SIZE); |
195 | for (i = 0; i < io_tlb_nslabs; i++) { | ||
196 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
197 | io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; | ||
198 | } | ||
199 | io_tlb_index = 0; | ||
197 | 200 | ||
198 | if (verbose) | 201 | if (verbose) |
199 | swiotlb_print_info(); | 202 | swiotlb_print_info(); |
@@ -313,10 +316,6 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) | |||
313 | if (!io_tlb_list) | 316 | if (!io_tlb_list) |
314 | goto cleanup3; | 317 | goto cleanup3; |
315 | 318 | ||
316 | for (i = 0; i < io_tlb_nslabs; i++) | ||
317 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
318 | io_tlb_index = 0; | ||
319 | |||
320 | io_tlb_orig_addr = (phys_addr_t *) | 319 | io_tlb_orig_addr = (phys_addr_t *) |
321 | __get_free_pages(GFP_KERNEL, | 320 | __get_free_pages(GFP_KERNEL, |
322 | get_order(io_tlb_nslabs * | 321 | get_order(io_tlb_nslabs * |
@@ -324,7 +323,11 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) | |||
324 | if (!io_tlb_orig_addr) | 323 | if (!io_tlb_orig_addr) |
325 | goto cleanup4; | 324 | goto cleanup4; |
326 | 325 | ||
327 | memset(io_tlb_orig_addr, 0, io_tlb_nslabs * sizeof(phys_addr_t)); | 326 | for (i = 0; i < io_tlb_nslabs; i++) { |
327 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
328 | io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; | ||
329 | } | ||
330 | io_tlb_index = 0; | ||
328 | 331 | ||
329 | swiotlb_print_info(); | 332 | swiotlb_print_info(); |
330 | 333 | ||
@@ -556,7 +559,8 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr, | |||
556 | /* | 559 | /* |
557 | * First, sync the memory before unmapping the entry | 560 | * First, sync the memory before unmapping the entry |
558 | */ | 561 | */ |
559 | if (orig_addr && ((dir == DMA_FROM_DEVICE) || (dir == DMA_BIDIRECTIONAL))) | 562 | if (orig_addr != INVALID_PHYS_ADDR && |
563 | ((dir == DMA_FROM_DEVICE) || (dir == DMA_BIDIRECTIONAL))) | ||
560 | swiotlb_bounce(orig_addr, tlb_addr, size, DMA_FROM_DEVICE); | 564 | swiotlb_bounce(orig_addr, tlb_addr, size, DMA_FROM_DEVICE); |
561 | 565 | ||
562 | /* | 566 | /* |
@@ -573,8 +577,10 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr, | |||
573 | * Step 1: return the slots to the free list, merging the | 577 | * Step 1: return the slots to the free list, merging the |
574 | * slots with superceeding slots | 578 | * slots with superceeding slots |
575 | */ | 579 | */ |
576 | for (i = index + nslots - 1; i >= index; i--) | 580 | for (i = index + nslots - 1; i >= index; i--) { |
577 | io_tlb_list[i] = ++count; | 581 | io_tlb_list[i] = ++count; |
582 | io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; | ||
583 | } | ||
578 | /* | 584 | /* |
579 | * Step 2: merge the returned slots with the preceding slots, | 585 | * Step 2: merge the returned slots with the preceding slots, |
580 | * if available (non zero) | 586 | * if available (non zero) |
@@ -593,6 +599,8 @@ void swiotlb_tbl_sync_single(struct device *hwdev, phys_addr_t tlb_addr, | |||
593 | int index = (tlb_addr - io_tlb_start) >> IO_TLB_SHIFT; | 599 | int index = (tlb_addr - io_tlb_start) >> IO_TLB_SHIFT; |
594 | phys_addr_t orig_addr = io_tlb_orig_addr[index]; | 600 | phys_addr_t orig_addr = io_tlb_orig_addr[index]; |
595 | 601 | ||
602 | if (orig_addr == INVALID_PHYS_ADDR) | ||
603 | return; | ||
596 | orig_addr += (unsigned long)tlb_addr & ((1 << IO_TLB_SHIFT) - 1); | 604 | orig_addr += (unsigned long)tlb_addr & ((1 << IO_TLB_SHIFT) - 1); |
597 | 605 | ||
598 | switch (target) { | 606 | switch (target) { |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index e60837dc785c..33514d88fef9 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -941,6 +941,37 @@ unlock: | |||
941 | spin_unlock(ptl); | 941 | spin_unlock(ptl); |
942 | } | 942 | } |
943 | 943 | ||
944 | /* | ||
945 | * Save CONFIG_DEBUG_PAGEALLOC from faulting falsely on tail pages | ||
946 | * during copy_user_huge_page()'s copy_page_rep(): in the case when | ||
947 | * the source page gets split and a tail freed before copy completes. | ||
948 | * Called under pmd_lock of checked pmd, so safe from splitting itself. | ||
949 | */ | ||
950 | static void get_user_huge_page(struct page *page) | ||
951 | { | ||
952 | if (IS_ENABLED(CONFIG_DEBUG_PAGEALLOC)) { | ||
953 | struct page *endpage = page + HPAGE_PMD_NR; | ||
954 | |||
955 | atomic_add(HPAGE_PMD_NR, &page->_count); | ||
956 | while (++page < endpage) | ||
957 | get_huge_page_tail(page); | ||
958 | } else { | ||
959 | get_page(page); | ||
960 | } | ||
961 | } | ||
962 | |||
963 | static void put_user_huge_page(struct page *page) | ||
964 | { | ||
965 | if (IS_ENABLED(CONFIG_DEBUG_PAGEALLOC)) { | ||
966 | struct page *endpage = page + HPAGE_PMD_NR; | ||
967 | |||
968 | while (page < endpage) | ||
969 | put_page(page++); | ||
970 | } else { | ||
971 | put_page(page); | ||
972 | } | ||
973 | } | ||
974 | |||
944 | static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm, | 975 | static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm, |
945 | struct vm_area_struct *vma, | 976 | struct vm_area_struct *vma, |
946 | unsigned long address, | 977 | unsigned long address, |
@@ -1074,7 +1105,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
1074 | ret |= VM_FAULT_WRITE; | 1105 | ret |= VM_FAULT_WRITE; |
1075 | goto out_unlock; | 1106 | goto out_unlock; |
1076 | } | 1107 | } |
1077 | get_page(page); | 1108 | get_user_huge_page(page); |
1078 | spin_unlock(ptl); | 1109 | spin_unlock(ptl); |
1079 | alloc: | 1110 | alloc: |
1080 | if (transparent_hugepage_enabled(vma) && | 1111 | if (transparent_hugepage_enabled(vma) && |
@@ -1095,7 +1126,7 @@ alloc: | |||
1095 | split_huge_page(page); | 1126 | split_huge_page(page); |
1096 | ret |= VM_FAULT_FALLBACK; | 1127 | ret |= VM_FAULT_FALLBACK; |
1097 | } | 1128 | } |
1098 | put_page(page); | 1129 | put_user_huge_page(page); |
1099 | } | 1130 | } |
1100 | count_vm_event(THP_FAULT_FALLBACK); | 1131 | count_vm_event(THP_FAULT_FALLBACK); |
1101 | goto out; | 1132 | goto out; |
@@ -1105,7 +1136,7 @@ alloc: | |||
1105 | put_page(new_page); | 1136 | put_page(new_page); |
1106 | if (page) { | 1137 | if (page) { |
1107 | split_huge_page(page); | 1138 | split_huge_page(page); |
1108 | put_page(page); | 1139 | put_user_huge_page(page); |
1109 | } else | 1140 | } else |
1110 | split_huge_page_pmd(vma, address, pmd); | 1141 | split_huge_page_pmd(vma, address, pmd); |
1111 | ret |= VM_FAULT_FALLBACK; | 1142 | ret |= VM_FAULT_FALLBACK; |
@@ -1127,7 +1158,7 @@ alloc: | |||
1127 | 1158 | ||
1128 | spin_lock(ptl); | 1159 | spin_lock(ptl); |
1129 | if (page) | 1160 | if (page) |
1130 | put_page(page); | 1161 | put_user_huge_page(page); |
1131 | if (unlikely(!pmd_same(*pmd, orig_pmd))) { | 1162 | if (unlikely(!pmd_same(*pmd, orig_pmd))) { |
1132 | spin_unlock(ptl); | 1163 | spin_unlock(ptl); |
1133 | mem_cgroup_uncharge_page(new_page); | 1164 | mem_cgroup_uncharge_page(new_page); |
@@ -2392,8 +2423,6 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
2392 | pmd = mm_find_pmd(mm, address); | 2423 | pmd = mm_find_pmd(mm, address); |
2393 | if (!pmd) | 2424 | if (!pmd) |
2394 | goto out; | 2425 | goto out; |
2395 | if (pmd_trans_huge(*pmd)) | ||
2396 | goto out; | ||
2397 | 2426 | ||
2398 | anon_vma_lock_write(vma->anon_vma); | 2427 | anon_vma_lock_write(vma->anon_vma); |
2399 | 2428 | ||
@@ -2492,8 +2521,6 @@ static int khugepaged_scan_pmd(struct mm_struct *mm, | |||
2492 | pmd = mm_find_pmd(mm, address); | 2521 | pmd = mm_find_pmd(mm, address); |
2493 | if (!pmd) | 2522 | if (!pmd) |
2494 | goto out; | 2523 | goto out; |
2495 | if (pmd_trans_huge(*pmd)) | ||
2496 | goto out; | ||
2497 | 2524 | ||
2498 | memset(khugepaged_node_load, 0, sizeof(khugepaged_node_load)); | 2525 | memset(khugepaged_node_load, 0, sizeof(khugepaged_node_load)); |
2499 | pte = pte_offset_map_lock(mm, pmd, address, &ptl); | 2526 | pte = pte_offset_map_lock(mm, pmd, address, &ptl); |
@@ -2846,12 +2873,22 @@ void split_huge_page_pmd_mm(struct mm_struct *mm, unsigned long address, | |||
2846 | static void split_huge_page_address(struct mm_struct *mm, | 2873 | static void split_huge_page_address(struct mm_struct *mm, |
2847 | unsigned long address) | 2874 | unsigned long address) |
2848 | { | 2875 | { |
2876 | pgd_t *pgd; | ||
2877 | pud_t *pud; | ||
2849 | pmd_t *pmd; | 2878 | pmd_t *pmd; |
2850 | 2879 | ||
2851 | VM_BUG_ON(!(address & ~HPAGE_PMD_MASK)); | 2880 | VM_BUG_ON(!(address & ~HPAGE_PMD_MASK)); |
2852 | 2881 | ||
2853 | pmd = mm_find_pmd(mm, address); | 2882 | pgd = pgd_offset(mm, address); |
2854 | if (!pmd) | 2883 | if (!pgd_present(*pgd)) |
2884 | return; | ||
2885 | |||
2886 | pud = pud_offset(pgd, address); | ||
2887 | if (!pud_present(*pud)) | ||
2888 | return; | ||
2889 | |||
2890 | pmd = pmd_offset(pud, address); | ||
2891 | if (!pmd_present(*pmd)) | ||
2855 | return; | 2892 | return; |
2856 | /* | 2893 | /* |
2857 | * Caller holds the mmap_sem write mode, so a huge pmd cannot | 2894 | * Caller holds the mmap_sem write mode, so a huge pmd cannot |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 226910cb7c9b..2024bbd573d2 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -2520,6 +2520,31 @@ static void set_huge_ptep_writable(struct vm_area_struct *vma, | |||
2520 | update_mmu_cache(vma, address, ptep); | 2520 | update_mmu_cache(vma, address, ptep); |
2521 | } | 2521 | } |
2522 | 2522 | ||
2523 | static int is_hugetlb_entry_migration(pte_t pte) | ||
2524 | { | ||
2525 | swp_entry_t swp; | ||
2526 | |||
2527 | if (huge_pte_none(pte) || pte_present(pte)) | ||
2528 | return 0; | ||
2529 | swp = pte_to_swp_entry(pte); | ||
2530 | if (non_swap_entry(swp) && is_migration_entry(swp)) | ||
2531 | return 1; | ||
2532 | else | ||
2533 | return 0; | ||
2534 | } | ||
2535 | |||
2536 | static int is_hugetlb_entry_hwpoisoned(pte_t pte) | ||
2537 | { | ||
2538 | swp_entry_t swp; | ||
2539 | |||
2540 | if (huge_pte_none(pte) || pte_present(pte)) | ||
2541 | return 0; | ||
2542 | swp = pte_to_swp_entry(pte); | ||
2543 | if (non_swap_entry(swp) && is_hwpoison_entry(swp)) | ||
2544 | return 1; | ||
2545 | else | ||
2546 | return 0; | ||
2547 | } | ||
2523 | 2548 | ||
2524 | int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, | 2549 | int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, |
2525 | struct vm_area_struct *vma) | 2550 | struct vm_area_struct *vma) |
@@ -2559,10 +2584,26 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, | |||
2559 | dst_ptl = huge_pte_lock(h, dst, dst_pte); | 2584 | dst_ptl = huge_pte_lock(h, dst, dst_pte); |
2560 | src_ptl = huge_pte_lockptr(h, src, src_pte); | 2585 | src_ptl = huge_pte_lockptr(h, src, src_pte); |
2561 | spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING); | 2586 | spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING); |
2562 | if (!huge_pte_none(huge_ptep_get(src_pte))) { | 2587 | entry = huge_ptep_get(src_pte); |
2588 | if (huge_pte_none(entry)) { /* skip none entry */ | ||
2589 | ; | ||
2590 | } else if (unlikely(is_hugetlb_entry_migration(entry) || | ||
2591 | is_hugetlb_entry_hwpoisoned(entry))) { | ||
2592 | swp_entry_t swp_entry = pte_to_swp_entry(entry); | ||
2593 | |||
2594 | if (is_write_migration_entry(swp_entry) && cow) { | ||
2595 | /* | ||
2596 | * COW mappings require pages in both | ||
2597 | * parent and child to be set to read. | ||
2598 | */ | ||
2599 | make_migration_entry_read(&swp_entry); | ||
2600 | entry = swp_entry_to_pte(swp_entry); | ||
2601 | set_huge_pte_at(src, addr, src_pte, entry); | ||
2602 | } | ||
2603 | set_huge_pte_at(dst, addr, dst_pte, entry); | ||
2604 | } else { | ||
2563 | if (cow) | 2605 | if (cow) |
2564 | huge_ptep_set_wrprotect(src, addr, src_pte); | 2606 | huge_ptep_set_wrprotect(src, addr, src_pte); |
2565 | entry = huge_ptep_get(src_pte); | ||
2566 | ptepage = pte_page(entry); | 2607 | ptepage = pte_page(entry); |
2567 | get_page(ptepage); | 2608 | get_page(ptepage); |
2568 | page_dup_rmap(ptepage); | 2609 | page_dup_rmap(ptepage); |
@@ -2578,32 +2619,6 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, | |||
2578 | return ret; | 2619 | return ret; |
2579 | } | 2620 | } |
2580 | 2621 | ||
2581 | static int is_hugetlb_entry_migration(pte_t pte) | ||
2582 | { | ||
2583 | swp_entry_t swp; | ||
2584 | |||
2585 | if (huge_pte_none(pte) || pte_present(pte)) | ||
2586 | return 0; | ||
2587 | swp = pte_to_swp_entry(pte); | ||
2588 | if (non_swap_entry(swp) && is_migration_entry(swp)) | ||
2589 | return 1; | ||
2590 | else | ||
2591 | return 0; | ||
2592 | } | ||
2593 | |||
2594 | static int is_hugetlb_entry_hwpoisoned(pte_t pte) | ||
2595 | { | ||
2596 | swp_entry_t swp; | ||
2597 | |||
2598 | if (huge_pte_none(pte) || pte_present(pte)) | ||
2599 | return 0; | ||
2600 | swp = pte_to_swp_entry(pte); | ||
2601 | if (non_swap_entry(swp) && is_hwpoison_entry(swp)) | ||
2602 | return 1; | ||
2603 | else | ||
2604 | return 0; | ||
2605 | } | ||
2606 | |||
2607 | void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, | 2622 | void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, |
2608 | unsigned long start, unsigned long end, | 2623 | unsigned long start, unsigned long end, |
2609 | struct page *ref_page) | 2624 | struct page *ref_page) |
@@ -945,7 +945,6 @@ static int replace_page(struct vm_area_struct *vma, struct page *page, | |||
945 | pmd = mm_find_pmd(mm, addr); | 945 | pmd = mm_find_pmd(mm, addr); |
946 | if (!pmd) | 946 | if (!pmd) |
947 | goto out; | 947 | goto out; |
948 | BUG_ON(pmd_trans_huge(*pmd)); | ||
949 | 948 | ||
950 | mmun_start = addr; | 949 | mmun_start = addr; |
951 | mmun_end = addr + PAGE_SIZE; | 950 | mmun_end = addr + PAGE_SIZE; |
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index cd8989c1027e..c6399e328931 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
@@ -895,7 +895,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, | |||
895 | struct page *hpage = *hpagep; | 895 | struct page *hpage = *hpagep; |
896 | struct page *ppage; | 896 | struct page *ppage; |
897 | 897 | ||
898 | if (PageReserved(p) || PageSlab(p)) | 898 | if (PageReserved(p) || PageSlab(p) || !PageLRU(p)) |
899 | return SWAP_SUCCESS; | 899 | return SWAP_SUCCESS; |
900 | 900 | ||
901 | /* | 901 | /* |
@@ -1159,9 +1159,6 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
1159 | action_result(pfn, "free buddy, 2nd try", DELAYED); | 1159 | action_result(pfn, "free buddy, 2nd try", DELAYED); |
1160 | return 0; | 1160 | return 0; |
1161 | } | 1161 | } |
1162 | action_result(pfn, "non LRU", IGNORED); | ||
1163 | put_page(p); | ||
1164 | return -EBUSY; | ||
1165 | } | 1162 | } |
1166 | } | 1163 | } |
1167 | 1164 | ||
@@ -1194,6 +1191,9 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
1194 | return 0; | 1191 | return 0; |
1195 | } | 1192 | } |
1196 | 1193 | ||
1194 | if (!PageHuge(p) && !PageTransTail(p) && !PageLRU(p)) | ||
1195 | goto identify_page_state; | ||
1196 | |||
1197 | /* | 1197 | /* |
1198 | * For error on the tail page, we should set PG_hwpoison | 1198 | * For error on the tail page, we should set PG_hwpoison |
1199 | * on the head page to show that the hugepage is hwpoisoned | 1199 | * on the head page to show that the hugepage is hwpoisoned |
@@ -1243,6 +1243,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
1243 | goto out; | 1243 | goto out; |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | identify_page_state: | ||
1246 | res = -EBUSY; | 1247 | res = -EBUSY; |
1247 | /* | 1248 | /* |
1248 | * The first check uses the current page flags which may not have any | 1249 | * The first check uses the current page flags which may not have any |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 284974230459..8f5330d74f47 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -656,19 +656,18 @@ static unsigned long change_prot_numa(struct vm_area_struct *vma, | |||
656 | * @nodes and @flags,) it's isolated and queued to the pagelist which is | 656 | * @nodes and @flags,) it's isolated and queued to the pagelist which is |
657 | * passed via @private.) | 657 | * passed via @private.) |
658 | */ | 658 | */ |
659 | static struct vm_area_struct * | 659 | static int |
660 | queue_pages_range(struct mm_struct *mm, unsigned long start, unsigned long end, | 660 | queue_pages_range(struct mm_struct *mm, unsigned long start, unsigned long end, |
661 | const nodemask_t *nodes, unsigned long flags, void *private) | 661 | const nodemask_t *nodes, unsigned long flags, void *private) |
662 | { | 662 | { |
663 | int err; | 663 | int err = 0; |
664 | struct vm_area_struct *first, *vma, *prev; | 664 | struct vm_area_struct *vma, *prev; |
665 | |||
666 | 665 | ||
667 | first = find_vma(mm, start); | 666 | vma = find_vma(mm, start); |
668 | if (!first) | 667 | if (!vma) |
669 | return ERR_PTR(-EFAULT); | 668 | return -EFAULT; |
670 | prev = NULL; | 669 | prev = NULL; |
671 | for (vma = first; vma && vma->vm_start < end; vma = vma->vm_next) { | 670 | for (; vma && vma->vm_start < end; vma = vma->vm_next) { |
672 | unsigned long endvma = vma->vm_end; | 671 | unsigned long endvma = vma->vm_end; |
673 | 672 | ||
674 | if (endvma > end) | 673 | if (endvma > end) |
@@ -678,9 +677,9 @@ queue_pages_range(struct mm_struct *mm, unsigned long start, unsigned long end, | |||
678 | 677 | ||
679 | if (!(flags & MPOL_MF_DISCONTIG_OK)) { | 678 | if (!(flags & MPOL_MF_DISCONTIG_OK)) { |
680 | if (!vma->vm_next && vma->vm_end < end) | 679 | if (!vma->vm_next && vma->vm_end < end) |
681 | return ERR_PTR(-EFAULT); | 680 | return -EFAULT; |
682 | if (prev && prev->vm_end < vma->vm_start) | 681 | if (prev && prev->vm_end < vma->vm_start) |
683 | return ERR_PTR(-EFAULT); | 682 | return -EFAULT; |
684 | } | 683 | } |
685 | 684 | ||
686 | if (flags & MPOL_MF_LAZY) { | 685 | if (flags & MPOL_MF_LAZY) { |
@@ -694,15 +693,13 @@ queue_pages_range(struct mm_struct *mm, unsigned long start, unsigned long end, | |||
694 | 693 | ||
695 | err = queue_pages_pgd_range(vma, start, endvma, nodes, | 694 | err = queue_pages_pgd_range(vma, start, endvma, nodes, |
696 | flags, private); | 695 | flags, private); |
697 | if (err) { | 696 | if (err) |
698 | first = ERR_PTR(err); | ||
699 | break; | 697 | break; |
700 | } | ||
701 | } | 698 | } |
702 | next: | 699 | next: |
703 | prev = vma; | 700 | prev = vma; |
704 | } | 701 | } |
705 | return first; | 702 | return err; |
706 | } | 703 | } |
707 | 704 | ||
708 | /* | 705 | /* |
@@ -1156,16 +1153,17 @@ out: | |||
1156 | 1153 | ||
1157 | /* | 1154 | /* |
1158 | * Allocate a new page for page migration based on vma policy. | 1155 | * Allocate a new page for page migration based on vma policy. |
1159 | * Start assuming that page is mapped by vma pointed to by @private. | 1156 | * Start by assuming the page is mapped by the same vma as contains @start. |
1160 | * Search forward from there, if not. N.B., this assumes that the | 1157 | * Search forward from there, if not. N.B., this assumes that the |
1161 | * list of pages handed to migrate_pages()--which is how we get here-- | 1158 | * list of pages handed to migrate_pages()--which is how we get here-- |
1162 | * is in virtual address order. | 1159 | * is in virtual address order. |
1163 | */ | 1160 | */ |
1164 | static struct page *new_vma_page(struct page *page, unsigned long private, int **x) | 1161 | static struct page *new_page(struct page *page, unsigned long start, int **x) |
1165 | { | 1162 | { |
1166 | struct vm_area_struct *vma = (struct vm_area_struct *)private; | 1163 | struct vm_area_struct *vma; |
1167 | unsigned long uninitialized_var(address); | 1164 | unsigned long uninitialized_var(address); |
1168 | 1165 | ||
1166 | vma = find_vma(current->mm, start); | ||
1169 | while (vma) { | 1167 | while (vma) { |
1170 | address = page_address_in_vma(page, vma); | 1168 | address = page_address_in_vma(page, vma); |
1171 | if (address != -EFAULT) | 1169 | if (address != -EFAULT) |
@@ -1195,7 +1193,7 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from, | |||
1195 | return -ENOSYS; | 1193 | return -ENOSYS; |
1196 | } | 1194 | } |
1197 | 1195 | ||
1198 | static struct page *new_vma_page(struct page *page, unsigned long private, int **x) | 1196 | static struct page *new_page(struct page *page, unsigned long start, int **x) |
1199 | { | 1197 | { |
1200 | return NULL; | 1198 | return NULL; |
1201 | } | 1199 | } |
@@ -1205,7 +1203,6 @@ static long do_mbind(unsigned long start, unsigned long len, | |||
1205 | unsigned short mode, unsigned short mode_flags, | 1203 | unsigned short mode, unsigned short mode_flags, |
1206 | nodemask_t *nmask, unsigned long flags) | 1204 | nodemask_t *nmask, unsigned long flags) |
1207 | { | 1205 | { |
1208 | struct vm_area_struct *vma; | ||
1209 | struct mm_struct *mm = current->mm; | 1206 | struct mm_struct *mm = current->mm; |
1210 | struct mempolicy *new; | 1207 | struct mempolicy *new; |
1211 | unsigned long end; | 1208 | unsigned long end; |
@@ -1271,11 +1268,9 @@ static long do_mbind(unsigned long start, unsigned long len, | |||
1271 | if (err) | 1268 | if (err) |
1272 | goto mpol_out; | 1269 | goto mpol_out; |
1273 | 1270 | ||
1274 | vma = queue_pages_range(mm, start, end, nmask, | 1271 | err = queue_pages_range(mm, start, end, nmask, |
1275 | flags | MPOL_MF_INVERT, &pagelist); | 1272 | flags | MPOL_MF_INVERT, &pagelist); |
1276 | 1273 | if (!err) | |
1277 | err = PTR_ERR(vma); /* maybe ... */ | ||
1278 | if (!IS_ERR(vma)) | ||
1279 | err = mbind_range(mm, start, end, new); | 1274 | err = mbind_range(mm, start, end, new); |
1280 | 1275 | ||
1281 | if (!err) { | 1276 | if (!err) { |
@@ -1283,9 +1278,8 @@ static long do_mbind(unsigned long start, unsigned long len, | |||
1283 | 1278 | ||
1284 | if (!list_empty(&pagelist)) { | 1279 | if (!list_empty(&pagelist)) { |
1285 | WARN_ON_ONCE(flags & MPOL_MF_LAZY); | 1280 | WARN_ON_ONCE(flags & MPOL_MF_LAZY); |
1286 | nr_failed = migrate_pages(&pagelist, new_vma_page, | 1281 | nr_failed = migrate_pages(&pagelist, new_page, NULL, |
1287 | NULL, (unsigned long)vma, | 1282 | start, MIGRATE_SYNC, MR_MEMPOLICY_MBIND); |
1288 | MIGRATE_SYNC, MR_MEMPOLICY_MBIND); | ||
1289 | if (nr_failed) | 1283 | if (nr_failed) |
1290 | putback_movable_pages(&pagelist); | 1284 | putback_movable_pages(&pagelist); |
1291 | } | 1285 | } |
@@ -2145,7 +2139,6 @@ struct mempolicy *__mpol_dup(struct mempolicy *old) | |||
2145 | } else | 2139 | } else |
2146 | *new = *old; | 2140 | *new = *old; |
2147 | 2141 | ||
2148 | rcu_read_lock(); | ||
2149 | if (current_cpuset_is_being_rebound()) { | 2142 | if (current_cpuset_is_being_rebound()) { |
2150 | nodemask_t mems = cpuset_mems_allowed(current); | 2143 | nodemask_t mems = cpuset_mems_allowed(current); |
2151 | if (new->flags & MPOL_F_REBINDING) | 2144 | if (new->flags & MPOL_F_REBINDING) |
@@ -2153,7 +2146,6 @@ struct mempolicy *__mpol_dup(struct mempolicy *old) | |||
2153 | else | 2146 | else |
2154 | mpol_rebind_policy(new, &mems, MPOL_REBIND_ONCE); | 2147 | mpol_rebind_policy(new, &mems, MPOL_REBIND_ONCE); |
2155 | } | 2148 | } |
2156 | rcu_read_unlock(); | ||
2157 | atomic_set(&new->refcnt, 1); | 2149 | atomic_set(&new->refcnt, 1); |
2158 | return new; | 2150 | return new; |
2159 | } | 2151 | } |
diff --git a/mm/migrate.c b/mm/migrate.c index 63f0cd559999..9e0beaa91845 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -120,8 +120,6 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma, | |||
120 | pmd = mm_find_pmd(mm, addr); | 120 | pmd = mm_find_pmd(mm, addr); |
121 | if (!pmd) | 121 | if (!pmd) |
122 | goto out; | 122 | goto out; |
123 | if (pmd_trans_huge(*pmd)) | ||
124 | goto out; | ||
125 | 123 | ||
126 | ptep = pte_offset_map(pmd, addr); | 124 | ptep = pte_offset_map(pmd, addr); |
127 | 125 | ||
diff --git a/mm/msync.c b/mm/msync.c index a5c673669ca6..992a1673d488 100644 --- a/mm/msync.c +++ b/mm/msync.c | |||
@@ -78,7 +78,8 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags) | |||
78 | goto out_unlock; | 78 | goto out_unlock; |
79 | } | 79 | } |
80 | file = vma->vm_file; | 80 | file = vma->vm_file; |
81 | fstart = start + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); | 81 | fstart = (start - vma->vm_start) + |
82 | ((loff_t)vma->vm_pgoff << PAGE_SHIFT); | ||
82 | fend = fstart + (min(end, vma->vm_end) - start) - 1; | 83 | fend = fstart + (min(end, vma->vm_end) - start) - 1; |
83 | start = vma->vm_end; | 84 | start = vma->vm_end; |
84 | if ((flags & MS_SYNC) && file && | 85 | if ((flags & MS_SYNC) && file && |
diff --git a/mm/nommu.c b/mm/nommu.c index b78e3a8f5ee7..4a852f6c5709 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -786,7 +786,7 @@ static void delete_vma_from_mm(struct vm_area_struct *vma) | |||
786 | for (i = 0; i < VMACACHE_SIZE; i++) { | 786 | for (i = 0; i < VMACACHE_SIZE; i++) { |
787 | /* if the vma is cached, invalidate the entire cache */ | 787 | /* if the vma is cached, invalidate the entire cache */ |
788 | if (curr->vmacache[i] == vma) { | 788 | if (curr->vmacache[i] == vma) { |
789 | vmacache_invalidate(curr->mm); | 789 | vmacache_invalidate(mm); |
790 | break; | 790 | break; |
791 | } | 791 | } |
792 | } | 792 | } |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4f59fa29eda8..0ea758b898fd 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -69,6 +69,7 @@ | |||
69 | 69 | ||
70 | /* prevent >1 _updater_ of zone percpu pageset ->high and ->batch fields */ | 70 | /* prevent >1 _updater_ of zone percpu pageset ->high and ->batch fields */ |
71 | static DEFINE_MUTEX(pcp_batch_high_lock); | 71 | static DEFINE_MUTEX(pcp_batch_high_lock); |
72 | #define MIN_PERCPU_PAGELIST_FRACTION (8) | ||
72 | 73 | ||
73 | #ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID | 74 | #ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID |
74 | DEFINE_PER_CPU(int, numa_node); | 75 | DEFINE_PER_CPU(int, numa_node); |
@@ -815,9 +816,21 @@ void __init init_cma_reserved_pageblock(struct page *page) | |||
815 | set_page_count(p, 0); | 816 | set_page_count(p, 0); |
816 | } while (++p, --i); | 817 | } while (++p, --i); |
817 | 818 | ||
818 | set_page_refcounted(page); | ||
819 | set_pageblock_migratetype(page, MIGRATE_CMA); | 819 | set_pageblock_migratetype(page, MIGRATE_CMA); |
820 | __free_pages(page, pageblock_order); | 820 | |
821 | if (pageblock_order >= MAX_ORDER) { | ||
822 | i = pageblock_nr_pages; | ||
823 | p = page; | ||
824 | do { | ||
825 | set_page_refcounted(p); | ||
826 | __free_pages(p, MAX_ORDER - 1); | ||
827 | p += MAX_ORDER_NR_PAGES; | ||
828 | } while (i -= MAX_ORDER_NR_PAGES); | ||
829 | } else { | ||
830 | set_page_refcounted(page); | ||
831 | __free_pages(page, pageblock_order); | ||
832 | } | ||
833 | |||
821 | adjust_managed_page_count(page, pageblock_nr_pages); | 834 | adjust_managed_page_count(page, pageblock_nr_pages); |
822 | } | 835 | } |
823 | #endif | 836 | #endif |
@@ -4145,7 +4158,7 @@ static void __meminit zone_init_free_lists(struct zone *zone) | |||
4145 | memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY) | 4158 | memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY) |
4146 | #endif | 4159 | #endif |
4147 | 4160 | ||
4148 | static int __meminit zone_batchsize(struct zone *zone) | 4161 | static int zone_batchsize(struct zone *zone) |
4149 | { | 4162 | { |
4150 | #ifdef CONFIG_MMU | 4163 | #ifdef CONFIG_MMU |
4151 | int batch; | 4164 | int batch; |
@@ -4261,8 +4274,8 @@ static void pageset_set_high(struct per_cpu_pageset *p, | |||
4261 | pageset_update(&p->pcp, high, batch); | 4274 | pageset_update(&p->pcp, high, batch); |
4262 | } | 4275 | } |
4263 | 4276 | ||
4264 | static void __meminit pageset_set_high_and_batch(struct zone *zone, | 4277 | static void pageset_set_high_and_batch(struct zone *zone, |
4265 | struct per_cpu_pageset *pcp) | 4278 | struct per_cpu_pageset *pcp) |
4266 | { | 4279 | { |
4267 | if (percpu_pagelist_fraction) | 4280 | if (percpu_pagelist_fraction) |
4268 | pageset_set_high(pcp, | 4281 | pageset_set_high(pcp, |
@@ -5881,23 +5894,38 @@ int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *table, int write, | |||
5881 | void __user *buffer, size_t *length, loff_t *ppos) | 5894 | void __user *buffer, size_t *length, loff_t *ppos) |
5882 | { | 5895 | { |
5883 | struct zone *zone; | 5896 | struct zone *zone; |
5884 | unsigned int cpu; | 5897 | int old_percpu_pagelist_fraction; |
5885 | int ret; | 5898 | int ret; |
5886 | 5899 | ||
5900 | mutex_lock(&pcp_batch_high_lock); | ||
5901 | old_percpu_pagelist_fraction = percpu_pagelist_fraction; | ||
5902 | |||
5887 | ret = proc_dointvec_minmax(table, write, buffer, length, ppos); | 5903 | ret = proc_dointvec_minmax(table, write, buffer, length, ppos); |
5888 | if (!write || (ret < 0)) | 5904 | if (!write || ret < 0) |
5889 | return ret; | 5905 | goto out; |
5906 | |||
5907 | /* Sanity checking to avoid pcp imbalance */ | ||
5908 | if (percpu_pagelist_fraction && | ||
5909 | percpu_pagelist_fraction < MIN_PERCPU_PAGELIST_FRACTION) { | ||
5910 | percpu_pagelist_fraction = old_percpu_pagelist_fraction; | ||
5911 | ret = -EINVAL; | ||
5912 | goto out; | ||
5913 | } | ||
5914 | |||
5915 | /* No change? */ | ||
5916 | if (percpu_pagelist_fraction == old_percpu_pagelist_fraction) | ||
5917 | goto out; | ||
5890 | 5918 | ||
5891 | mutex_lock(&pcp_batch_high_lock); | ||
5892 | for_each_populated_zone(zone) { | 5919 | for_each_populated_zone(zone) { |
5893 | unsigned long high; | 5920 | unsigned int cpu; |
5894 | high = zone->managed_pages / percpu_pagelist_fraction; | 5921 | |
5895 | for_each_possible_cpu(cpu) | 5922 | for_each_possible_cpu(cpu) |
5896 | pageset_set_high(per_cpu_ptr(zone->pageset, cpu), | 5923 | pageset_set_high_and_batch(zone, |
5897 | high); | 5924 | per_cpu_ptr(zone->pageset, cpu)); |
5898 | } | 5925 | } |
5926 | out: | ||
5899 | mutex_unlock(&pcp_batch_high_lock); | 5927 | mutex_unlock(&pcp_batch_high_lock); |
5900 | return 0; | 5928 | return ret; |
5901 | } | 5929 | } |
5902 | 5930 | ||
5903 | int hashdist = HASHDIST_DEFAULT; | 5931 | int hashdist = HASHDIST_DEFAULT; |
@@ -569,6 +569,7 @@ pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address) | |||
569 | pgd_t *pgd; | 569 | pgd_t *pgd; |
570 | pud_t *pud; | 570 | pud_t *pud; |
571 | pmd_t *pmd = NULL; | 571 | pmd_t *pmd = NULL; |
572 | pmd_t pmde; | ||
572 | 573 | ||
573 | pgd = pgd_offset(mm, address); | 574 | pgd = pgd_offset(mm, address); |
574 | if (!pgd_present(*pgd)) | 575 | if (!pgd_present(*pgd)) |
@@ -579,7 +580,13 @@ pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address) | |||
579 | goto out; | 580 | goto out; |
580 | 581 | ||
581 | pmd = pmd_offset(pud, address); | 582 | pmd = pmd_offset(pud, address); |
582 | if (!pmd_present(*pmd)) | 583 | /* |
584 | * Some THP functions use the sequence pmdp_clear_flush(), set_pmd_at() | ||
585 | * without holding anon_vma lock for write. So when looking for a | ||
586 | * genuine pmde (in which to find pte), test present and !THP together. | ||
587 | */ | ||
588 | pmde = ACCESS_ONCE(*pmd); | ||
589 | if (!pmd_present(pmde) || pmd_trans_huge(pmde)) | ||
583 | pmd = NULL; | 590 | pmd = NULL; |
584 | out: | 591 | out: |
585 | return pmd; | 592 | return pmd; |
@@ -615,9 +622,6 @@ pte_t *__page_check_address(struct page *page, struct mm_struct *mm, | |||
615 | if (!pmd) | 622 | if (!pmd) |
616 | return NULL; | 623 | return NULL; |
617 | 624 | ||
618 | if (pmd_trans_huge(*pmd)) | ||
619 | return NULL; | ||
620 | |||
621 | pte = pte_offset_map(pmd, address); | 625 | pte = pte_offset_map(pmd, address); |
622 | /* Make a quick check before getting the lock */ | 626 | /* Make a quick check before getting the lock */ |
623 | if (!sync && !pte_present(*pte)) { | 627 | if (!sync && !pte_present(*pte)) { |
diff --git a/mm/shmem.c b/mm/shmem.c index f484c276e994..1140f49b6ded 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -80,11 +80,12 @@ static struct vfsmount *shm_mnt; | |||
80 | #define SHORT_SYMLINK_LEN 128 | 80 | #define SHORT_SYMLINK_LEN 128 |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * shmem_fallocate and shmem_writepage communicate via inode->i_private | 83 | * shmem_fallocate communicates with shmem_fault or shmem_writepage via |
84 | * (with i_mutex making sure that it has only one user at a time): | 84 | * inode->i_private (with i_mutex making sure that it has only one user at |
85 | * we would prefer not to enlarge the shmem inode just for that. | 85 | * a time): we would prefer not to enlarge the shmem inode just for that. |
86 | */ | 86 | */ |
87 | struct shmem_falloc { | 87 | struct shmem_falloc { |
88 | int mode; /* FALLOC_FL mode currently operating */ | ||
88 | pgoff_t start; /* start of range currently being fallocated */ | 89 | pgoff_t start; /* start of range currently being fallocated */ |
89 | pgoff_t next; /* the next page offset to be fallocated */ | 90 | pgoff_t next; /* the next page offset to be fallocated */ |
90 | pgoff_t nr_falloced; /* how many new pages have been fallocated */ | 91 | pgoff_t nr_falloced; /* how many new pages have been fallocated */ |
@@ -759,6 +760,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc) | |||
759 | spin_lock(&inode->i_lock); | 760 | spin_lock(&inode->i_lock); |
760 | shmem_falloc = inode->i_private; | 761 | shmem_falloc = inode->i_private; |
761 | if (shmem_falloc && | 762 | if (shmem_falloc && |
763 | !shmem_falloc->mode && | ||
762 | index >= shmem_falloc->start && | 764 | index >= shmem_falloc->start && |
763 | index < shmem_falloc->next) | 765 | index < shmem_falloc->next) |
764 | shmem_falloc->nr_unswapped++; | 766 | shmem_falloc->nr_unswapped++; |
@@ -1027,6 +1029,9 @@ repeat: | |||
1027 | goto failed; | 1029 | goto failed; |
1028 | } | 1030 | } |
1029 | 1031 | ||
1032 | if (page && sgp == SGP_WRITE) | ||
1033 | mark_page_accessed(page); | ||
1034 | |||
1030 | /* fallocated page? */ | 1035 | /* fallocated page? */ |
1031 | if (page && !PageUptodate(page)) { | 1036 | if (page && !PageUptodate(page)) { |
1032 | if (sgp != SGP_READ) | 1037 | if (sgp != SGP_READ) |
@@ -1108,6 +1113,9 @@ repeat: | |||
1108 | shmem_recalc_inode(inode); | 1113 | shmem_recalc_inode(inode); |
1109 | spin_unlock(&info->lock); | 1114 | spin_unlock(&info->lock); |
1110 | 1115 | ||
1116 | if (sgp == SGP_WRITE) | ||
1117 | mark_page_accessed(page); | ||
1118 | |||
1111 | delete_from_swap_cache(page); | 1119 | delete_from_swap_cache(page); |
1112 | set_page_dirty(page); | 1120 | set_page_dirty(page); |
1113 | swap_free(swap); | 1121 | swap_free(swap); |
@@ -1134,6 +1142,9 @@ repeat: | |||
1134 | 1142 | ||
1135 | __SetPageSwapBacked(page); | 1143 | __SetPageSwapBacked(page); |
1136 | __set_page_locked(page); | 1144 | __set_page_locked(page); |
1145 | if (sgp == SGP_WRITE) | ||
1146 | init_page_accessed(page); | ||
1147 | |||
1137 | error = mem_cgroup_charge_file(page, current->mm, | 1148 | error = mem_cgroup_charge_file(page, current->mm, |
1138 | gfp & GFP_RECLAIM_MASK); | 1149 | gfp & GFP_RECLAIM_MASK); |
1139 | if (error) | 1150 | if (error) |
@@ -1233,6 +1244,44 @@ static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
1233 | int error; | 1244 | int error; |
1234 | int ret = VM_FAULT_LOCKED; | 1245 | int ret = VM_FAULT_LOCKED; |
1235 | 1246 | ||
1247 | /* | ||
1248 | * Trinity finds that probing a hole which tmpfs is punching can | ||
1249 | * prevent the hole-punch from ever completing: which in turn | ||
1250 | * locks writers out with its hold on i_mutex. So refrain from | ||
1251 | * faulting pages into the hole while it's being punched, and | ||
1252 | * wait on i_mutex to be released if vmf->flags permits. | ||
1253 | */ | ||
1254 | if (unlikely(inode->i_private)) { | ||
1255 | struct shmem_falloc *shmem_falloc; | ||
1256 | |||
1257 | spin_lock(&inode->i_lock); | ||
1258 | shmem_falloc = inode->i_private; | ||
1259 | if (!shmem_falloc || | ||
1260 | shmem_falloc->mode != FALLOC_FL_PUNCH_HOLE || | ||
1261 | vmf->pgoff < shmem_falloc->start || | ||
1262 | vmf->pgoff >= shmem_falloc->next) | ||
1263 | shmem_falloc = NULL; | ||
1264 | spin_unlock(&inode->i_lock); | ||
1265 | /* | ||
1266 | * i_lock has protected us from taking shmem_falloc seriously | ||
1267 | * once return from shmem_fallocate() went back up that stack. | ||
1268 | * i_lock does not serialize with i_mutex at all, but it does | ||
1269 | * not matter if sometimes we wait unnecessarily, or sometimes | ||
1270 | * miss out on waiting: we just need to make those cases rare. | ||
1271 | */ | ||
1272 | if (shmem_falloc) { | ||
1273 | if ((vmf->flags & FAULT_FLAG_ALLOW_RETRY) && | ||
1274 | !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) { | ||
1275 | up_read(&vma->vm_mm->mmap_sem); | ||
1276 | mutex_lock(&inode->i_mutex); | ||
1277 | mutex_unlock(&inode->i_mutex); | ||
1278 | return VM_FAULT_RETRY; | ||
1279 | } | ||
1280 | /* cond_resched? Leave that to GUP or return to user */ | ||
1281 | return VM_FAULT_NOPAGE; | ||
1282 | } | ||
1283 | } | ||
1284 | |||
1236 | error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE, &ret); | 1285 | error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE, &ret); |
1237 | if (error) | 1286 | if (error) |
1238 | return ((error == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS); | 1287 | return ((error == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS); |
@@ -1372,13 +1421,9 @@ shmem_write_begin(struct file *file, struct address_space *mapping, | |||
1372 | loff_t pos, unsigned len, unsigned flags, | 1421 | loff_t pos, unsigned len, unsigned flags, |
1373 | struct page **pagep, void **fsdata) | 1422 | struct page **pagep, void **fsdata) |
1374 | { | 1423 | { |
1375 | int ret; | ||
1376 | struct inode *inode = mapping->host; | 1424 | struct inode *inode = mapping->host; |
1377 | pgoff_t index = pos >> PAGE_CACHE_SHIFT; | 1425 | pgoff_t index = pos >> PAGE_CACHE_SHIFT; |
1378 | ret = shmem_getpage(inode, index, pagep, SGP_WRITE, NULL); | 1426 | return shmem_getpage(inode, index, pagep, SGP_WRITE, NULL); |
1379 | if (ret == 0 && *pagep) | ||
1380 | init_page_accessed(*pagep); | ||
1381 | return ret; | ||
1382 | } | 1427 | } |
1383 | 1428 | ||
1384 | static int | 1429 | static int |
@@ -1724,20 +1769,31 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset, | |||
1724 | pgoff_t start, index, end; | 1769 | pgoff_t start, index, end; |
1725 | int error; | 1770 | int error; |
1726 | 1771 | ||
1772 | if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) | ||
1773 | return -EOPNOTSUPP; | ||
1774 | |||
1727 | mutex_lock(&inode->i_mutex); | 1775 | mutex_lock(&inode->i_mutex); |
1728 | 1776 | ||
1777 | shmem_falloc.mode = mode & ~FALLOC_FL_KEEP_SIZE; | ||
1778 | |||
1729 | if (mode & FALLOC_FL_PUNCH_HOLE) { | 1779 | if (mode & FALLOC_FL_PUNCH_HOLE) { |
1730 | struct address_space *mapping = file->f_mapping; | 1780 | struct address_space *mapping = file->f_mapping; |
1731 | loff_t unmap_start = round_up(offset, PAGE_SIZE); | 1781 | loff_t unmap_start = round_up(offset, PAGE_SIZE); |
1732 | loff_t unmap_end = round_down(offset + len, PAGE_SIZE) - 1; | 1782 | loff_t unmap_end = round_down(offset + len, PAGE_SIZE) - 1; |
1733 | 1783 | ||
1784 | shmem_falloc.start = unmap_start >> PAGE_SHIFT; | ||
1785 | shmem_falloc.next = (unmap_end + 1) >> PAGE_SHIFT; | ||
1786 | spin_lock(&inode->i_lock); | ||
1787 | inode->i_private = &shmem_falloc; | ||
1788 | spin_unlock(&inode->i_lock); | ||
1789 | |||
1734 | if ((u64)unmap_end > (u64)unmap_start) | 1790 | if ((u64)unmap_end > (u64)unmap_start) |
1735 | unmap_mapping_range(mapping, unmap_start, | 1791 | unmap_mapping_range(mapping, unmap_start, |
1736 | 1 + unmap_end - unmap_start, 0); | 1792 | 1 + unmap_end - unmap_start, 0); |
1737 | shmem_truncate_range(inode, offset, offset + len - 1); | 1793 | shmem_truncate_range(inode, offset, offset + len - 1); |
1738 | /* No need to unmap again: hole-punching leaves COWed pages */ | 1794 | /* No need to unmap again: hole-punching leaves COWed pages */ |
1739 | error = 0; | 1795 | error = 0; |
1740 | goto out; | 1796 | goto undone; |
1741 | } | 1797 | } |
1742 | 1798 | ||
1743 | /* We need to check rlimit even when FALLOC_FL_KEEP_SIZE */ | 1799 | /* We need to check rlimit even when FALLOC_FL_KEEP_SIZE */ |
@@ -386,6 +386,39 @@ static void **dbg_userword(struct kmem_cache *cachep, void *objp) | |||
386 | 386 | ||
387 | #endif | 387 | #endif |
388 | 388 | ||
389 | #define OBJECT_FREE (0) | ||
390 | #define OBJECT_ACTIVE (1) | ||
391 | |||
392 | #ifdef CONFIG_DEBUG_SLAB_LEAK | ||
393 | |||
394 | static void set_obj_status(struct page *page, int idx, int val) | ||
395 | { | ||
396 | int freelist_size; | ||
397 | char *status; | ||
398 | struct kmem_cache *cachep = page->slab_cache; | ||
399 | |||
400 | freelist_size = cachep->num * sizeof(freelist_idx_t); | ||
401 | status = (char *)page->freelist + freelist_size; | ||
402 | status[idx] = val; | ||
403 | } | ||
404 | |||
405 | static inline unsigned int get_obj_status(struct page *page, int idx) | ||
406 | { | ||
407 | int freelist_size; | ||
408 | char *status; | ||
409 | struct kmem_cache *cachep = page->slab_cache; | ||
410 | |||
411 | freelist_size = cachep->num * sizeof(freelist_idx_t); | ||
412 | status = (char *)page->freelist + freelist_size; | ||
413 | |||
414 | return status[idx]; | ||
415 | } | ||
416 | |||
417 | #else | ||
418 | static inline void set_obj_status(struct page *page, int idx, int val) {} | ||
419 | |||
420 | #endif | ||
421 | |||
389 | /* | 422 | /* |
390 | * Do not go above this order unless 0 objects fit into the slab or | 423 | * Do not go above this order unless 0 objects fit into the slab or |
391 | * overridden on the command line. | 424 | * overridden on the command line. |
@@ -576,12 +609,30 @@ static inline struct array_cache *cpu_cache_get(struct kmem_cache *cachep) | |||
576 | return cachep->array[smp_processor_id()]; | 609 | return cachep->array[smp_processor_id()]; |
577 | } | 610 | } |
578 | 611 | ||
612 | static size_t calculate_freelist_size(int nr_objs, size_t align) | ||
613 | { | ||
614 | size_t freelist_size; | ||
615 | |||
616 | freelist_size = nr_objs * sizeof(freelist_idx_t); | ||
617 | if (IS_ENABLED(CONFIG_DEBUG_SLAB_LEAK)) | ||
618 | freelist_size += nr_objs * sizeof(char); | ||
619 | |||
620 | if (align) | ||
621 | freelist_size = ALIGN(freelist_size, align); | ||
622 | |||
623 | return freelist_size; | ||
624 | } | ||
625 | |||
579 | static int calculate_nr_objs(size_t slab_size, size_t buffer_size, | 626 | static int calculate_nr_objs(size_t slab_size, size_t buffer_size, |
580 | size_t idx_size, size_t align) | 627 | size_t idx_size, size_t align) |
581 | { | 628 | { |
582 | int nr_objs; | 629 | int nr_objs; |
630 | size_t remained_size; | ||
583 | size_t freelist_size; | 631 | size_t freelist_size; |
632 | int extra_space = 0; | ||
584 | 633 | ||
634 | if (IS_ENABLED(CONFIG_DEBUG_SLAB_LEAK)) | ||
635 | extra_space = sizeof(char); | ||
585 | /* | 636 | /* |
586 | * Ignore padding for the initial guess. The padding | 637 | * Ignore padding for the initial guess. The padding |
587 | * is at most @align-1 bytes, and @buffer_size is at | 638 | * is at most @align-1 bytes, and @buffer_size is at |
@@ -590,14 +641,15 @@ static int calculate_nr_objs(size_t slab_size, size_t buffer_size, | |||
590 | * into the memory allocation when taking the padding | 641 | * into the memory allocation when taking the padding |
591 | * into account. | 642 | * into account. |
592 | */ | 643 | */ |
593 | nr_objs = slab_size / (buffer_size + idx_size); | 644 | nr_objs = slab_size / (buffer_size + idx_size + extra_space); |
594 | 645 | ||
595 | /* | 646 | /* |
596 | * This calculated number will be either the right | 647 | * This calculated number will be either the right |
597 | * amount, or one greater than what we want. | 648 | * amount, or one greater than what we want. |
598 | */ | 649 | */ |
599 | freelist_size = slab_size - nr_objs * buffer_size; | 650 | remained_size = slab_size - nr_objs * buffer_size; |
600 | if (freelist_size < ALIGN(nr_objs * idx_size, align)) | 651 | freelist_size = calculate_freelist_size(nr_objs, align); |
652 | if (remained_size < freelist_size) | ||
601 | nr_objs--; | 653 | nr_objs--; |
602 | 654 | ||
603 | return nr_objs; | 655 | return nr_objs; |
@@ -635,7 +687,7 @@ static void cache_estimate(unsigned long gfporder, size_t buffer_size, | |||
635 | } else { | 687 | } else { |
636 | nr_objs = calculate_nr_objs(slab_size, buffer_size, | 688 | nr_objs = calculate_nr_objs(slab_size, buffer_size, |
637 | sizeof(freelist_idx_t), align); | 689 | sizeof(freelist_idx_t), align); |
638 | mgmt_size = ALIGN(nr_objs * sizeof(freelist_idx_t), align); | 690 | mgmt_size = calculate_freelist_size(nr_objs, align); |
639 | } | 691 | } |
640 | *num = nr_objs; | 692 | *num = nr_objs; |
641 | *left_over = slab_size - nr_objs*buffer_size - mgmt_size; | 693 | *left_over = slab_size - nr_objs*buffer_size - mgmt_size; |
@@ -2041,13 +2093,16 @@ static size_t calculate_slab_order(struct kmem_cache *cachep, | |||
2041 | break; | 2093 | break; |
2042 | 2094 | ||
2043 | if (flags & CFLGS_OFF_SLAB) { | 2095 | if (flags & CFLGS_OFF_SLAB) { |
2096 | size_t freelist_size_per_obj = sizeof(freelist_idx_t); | ||
2044 | /* | 2097 | /* |
2045 | * Max number of objs-per-slab for caches which | 2098 | * Max number of objs-per-slab for caches which |
2046 | * use off-slab slabs. Needed to avoid a possible | 2099 | * use off-slab slabs. Needed to avoid a possible |
2047 | * looping condition in cache_grow(). | 2100 | * looping condition in cache_grow(). |
2048 | */ | 2101 | */ |
2102 | if (IS_ENABLED(CONFIG_DEBUG_SLAB_LEAK)) | ||
2103 | freelist_size_per_obj += sizeof(char); | ||
2049 | offslab_limit = size; | 2104 | offslab_limit = size; |
2050 | offslab_limit /= sizeof(freelist_idx_t); | 2105 | offslab_limit /= freelist_size_per_obj; |
2051 | 2106 | ||
2052 | if (num > offslab_limit) | 2107 | if (num > offslab_limit) |
2053 | break; | 2108 | break; |
@@ -2294,8 +2349,7 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) | |||
2294 | if (!cachep->num) | 2349 | if (!cachep->num) |
2295 | return -E2BIG; | 2350 | return -E2BIG; |
2296 | 2351 | ||
2297 | freelist_size = | 2352 | freelist_size = calculate_freelist_size(cachep->num, cachep->align); |
2298 | ALIGN(cachep->num * sizeof(freelist_idx_t), cachep->align); | ||
2299 | 2353 | ||
2300 | /* | 2354 | /* |
2301 | * If the slab has been placed off-slab, and we have enough space then | 2355 | * If the slab has been placed off-slab, and we have enough space then |
@@ -2308,7 +2362,7 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) | |||
2308 | 2362 | ||
2309 | if (flags & CFLGS_OFF_SLAB) { | 2363 | if (flags & CFLGS_OFF_SLAB) { |
2310 | /* really off slab. No need for manual alignment */ | 2364 | /* really off slab. No need for manual alignment */ |
2311 | freelist_size = cachep->num * sizeof(freelist_idx_t); | 2365 | freelist_size = calculate_freelist_size(cachep->num, 0); |
2312 | 2366 | ||
2313 | #ifdef CONFIG_PAGE_POISONING | 2367 | #ifdef CONFIG_PAGE_POISONING |
2314 | /* If we're going to use the generic kernel_map_pages() | 2368 | /* If we're going to use the generic kernel_map_pages() |
@@ -2612,6 +2666,7 @@ static void cache_init_objs(struct kmem_cache *cachep, | |||
2612 | if (cachep->ctor) | 2666 | if (cachep->ctor) |
2613 | cachep->ctor(objp); | 2667 | cachep->ctor(objp); |
2614 | #endif | 2668 | #endif |
2669 | set_obj_status(page, i, OBJECT_FREE); | ||
2615 | set_free_obj(page, i, i); | 2670 | set_free_obj(page, i, i); |
2616 | } | 2671 | } |
2617 | } | 2672 | } |
@@ -2820,6 +2875,7 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp, | |||
2820 | BUG_ON(objnr >= cachep->num); | 2875 | BUG_ON(objnr >= cachep->num); |
2821 | BUG_ON(objp != index_to_obj(cachep, page, objnr)); | 2876 | BUG_ON(objp != index_to_obj(cachep, page, objnr)); |
2822 | 2877 | ||
2878 | set_obj_status(page, objnr, OBJECT_FREE); | ||
2823 | if (cachep->flags & SLAB_POISON) { | 2879 | if (cachep->flags & SLAB_POISON) { |
2824 | #ifdef CONFIG_DEBUG_PAGEALLOC | 2880 | #ifdef CONFIG_DEBUG_PAGEALLOC |
2825 | if ((cachep->size % PAGE_SIZE)==0 && OFF_SLAB(cachep)) { | 2881 | if ((cachep->size % PAGE_SIZE)==0 && OFF_SLAB(cachep)) { |
@@ -2953,6 +3009,8 @@ static inline void cache_alloc_debugcheck_before(struct kmem_cache *cachep, | |||
2953 | static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, | 3009 | static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, |
2954 | gfp_t flags, void *objp, unsigned long caller) | 3010 | gfp_t flags, void *objp, unsigned long caller) |
2955 | { | 3011 | { |
3012 | struct page *page; | ||
3013 | |||
2956 | if (!objp) | 3014 | if (!objp) |
2957 | return objp; | 3015 | return objp; |
2958 | if (cachep->flags & SLAB_POISON) { | 3016 | if (cachep->flags & SLAB_POISON) { |
@@ -2983,6 +3041,9 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, | |||
2983 | *dbg_redzone1(cachep, objp) = RED_ACTIVE; | 3041 | *dbg_redzone1(cachep, objp) = RED_ACTIVE; |
2984 | *dbg_redzone2(cachep, objp) = RED_ACTIVE; | 3042 | *dbg_redzone2(cachep, objp) = RED_ACTIVE; |
2985 | } | 3043 | } |
3044 | |||
3045 | page = virt_to_head_page(objp); | ||
3046 | set_obj_status(page, obj_to_index(cachep, page, objp), OBJECT_ACTIVE); | ||
2986 | objp += obj_offset(cachep); | 3047 | objp += obj_offset(cachep); |
2987 | if (cachep->ctor && cachep->flags & SLAB_POISON) | 3048 | if (cachep->ctor && cachep->flags & SLAB_POISON) |
2988 | cachep->ctor(objp); | 3049 | cachep->ctor(objp); |
@@ -4219,21 +4280,12 @@ static void handle_slab(unsigned long *n, struct kmem_cache *c, | |||
4219 | struct page *page) | 4280 | struct page *page) |
4220 | { | 4281 | { |
4221 | void *p; | 4282 | void *p; |
4222 | int i, j; | 4283 | int i; |
4223 | 4284 | ||
4224 | if (n[0] == n[1]) | 4285 | if (n[0] == n[1]) |
4225 | return; | 4286 | return; |
4226 | for (i = 0, p = page->s_mem; i < c->num; i++, p += c->size) { | 4287 | for (i = 0, p = page->s_mem; i < c->num; i++, p += c->size) { |
4227 | bool active = true; | 4288 | if (get_obj_status(page, i) != OBJECT_ACTIVE) |
4228 | |||
4229 | for (j = page->active; j < c->num; j++) { | ||
4230 | /* Skip freed item */ | ||
4231 | if (get_free_obj(page, j) == i) { | ||
4232 | active = false; | ||
4233 | break; | ||
4234 | } | ||
4235 | } | ||
4236 | if (!active) | ||
4237 | continue; | 4289 | continue; |
4238 | 4290 | ||
4239 | if (!add_caller(n, (unsigned long)*dbg_userword(c, p))) | 4291 | if (!add_caller(n, (unsigned long)*dbg_userword(c, p))) |
@@ -1881,7 +1881,7 @@ redo: | |||
1881 | 1881 | ||
1882 | new.frozen = 0; | 1882 | new.frozen = 0; |
1883 | 1883 | ||
1884 | if (!new.inuse && n->nr_partial > s->min_partial) | 1884 | if (!new.inuse && n->nr_partial >= s->min_partial) |
1885 | m = M_FREE; | 1885 | m = M_FREE; |
1886 | else if (new.freelist) { | 1886 | else if (new.freelist) { |
1887 | m = M_PARTIAL; | 1887 | m = M_PARTIAL; |
@@ -1992,7 +1992,7 @@ static void unfreeze_partials(struct kmem_cache *s, | |||
1992 | new.freelist, new.counters, | 1992 | new.freelist, new.counters, |
1993 | "unfreezing slab")); | 1993 | "unfreezing slab")); |
1994 | 1994 | ||
1995 | if (unlikely(!new.inuse && n->nr_partial > s->min_partial)) { | 1995 | if (unlikely(!new.inuse && n->nr_partial >= s->min_partial)) { |
1996 | page->next = discard_page; | 1996 | page->next = discard_page; |
1997 | discard_page = page; | 1997 | discard_page = page; |
1998 | } else { | 1998 | } else { |
@@ -2620,7 +2620,7 @@ static void __slab_free(struct kmem_cache *s, struct page *page, | |||
2620 | return; | 2620 | return; |
2621 | } | 2621 | } |
2622 | 2622 | ||
2623 | if (unlikely(!new.inuse && n->nr_partial > s->min_partial)) | 2623 | if (unlikely(!new.inuse && n->nr_partial >= s->min_partial)) |
2624 | goto slab_empty; | 2624 | goto slab_empty; |
2625 | 2625 | ||
2626 | /* | 2626 | /* |
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 9012b1c922b6..75d427763992 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
@@ -114,8 +114,11 @@ EXPORT_SYMBOL(vlan_dev_vlan_proto); | |||
114 | 114 | ||
115 | static struct sk_buff *vlan_reorder_header(struct sk_buff *skb) | 115 | static struct sk_buff *vlan_reorder_header(struct sk_buff *skb) |
116 | { | 116 | { |
117 | if (skb_cow(skb, skb_headroom(skb)) < 0) | 117 | if (skb_cow(skb, skb_headroom(skb)) < 0) { |
118 | kfree_skb(skb); | ||
118 | return NULL; | 119 | return NULL; |
120 | } | ||
121 | |||
119 | memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN); | 122 | memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN); |
120 | skb->mac_header += VLAN_HLEN; | 123 | skb->mac_header += VLAN_HLEN; |
121 | return skb; | 124 | return skb; |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 8671bc79a35b..ca01d1861854 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -610,11 +610,6 @@ static void hci_req_add_le_create_conn(struct hci_request *req, | |||
610 | if (hci_update_random_address(req, false, &own_addr_type)) | 610 | if (hci_update_random_address(req, false, &own_addr_type)) |
611 | return; | 611 | return; |
612 | 612 | ||
613 | /* Save the address type used for this connnection attempt so we able | ||
614 | * to retrieve this information if we need it. | ||
615 | */ | ||
616 | conn->src_type = own_addr_type; | ||
617 | |||
618 | cp.scan_interval = cpu_to_le16(hdev->le_scan_interval); | 613 | cp.scan_interval = cpu_to_le16(hdev->le_scan_interval); |
619 | cp.scan_window = cpu_to_le16(hdev->le_scan_window); | 614 | cp.scan_window = cpu_to_le16(hdev->le_scan_window); |
620 | bacpy(&cp.peer_addr, &conn->dst); | 615 | bacpy(&cp.peer_addr, &conn->dst); |
@@ -894,7 +889,7 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
894 | /* If we're already encrypted set the REAUTH_PEND flag, | 889 | /* If we're already encrypted set the REAUTH_PEND flag, |
895 | * otherwise set the ENCRYPT_PEND. | 890 | * otherwise set the ENCRYPT_PEND. |
896 | */ | 891 | */ |
897 | if (conn->key_type != 0xff) | 892 | if (conn->link_mode & HCI_LM_ENCRYPT) |
898 | set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); | 893 | set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); |
899 | else | 894 | else |
900 | set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); | 895 | set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 21e5913d12e0..640c54ec1bd2 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -48,6 +48,10 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb) | |||
48 | smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ | 48 | smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ |
49 | wake_up_bit(&hdev->flags, HCI_INQUIRY); | 49 | wake_up_bit(&hdev->flags, HCI_INQUIRY); |
50 | 50 | ||
51 | hci_dev_lock(hdev); | ||
52 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); | ||
53 | hci_dev_unlock(hdev); | ||
54 | |||
51 | hci_conn_check_pending(hdev); | 55 | hci_conn_check_pending(hdev); |
52 | } | 56 | } |
53 | 57 | ||
@@ -3537,7 +3541,11 @@ static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3537 | cp.authentication = conn->auth_type; | 3541 | cp.authentication = conn->auth_type; |
3538 | 3542 | ||
3539 | /* Request MITM protection if our IO caps allow it | 3543 | /* Request MITM protection if our IO caps allow it |
3540 | * except for the no-bonding case | 3544 | * except for the no-bonding case. |
3545 | * conn->auth_type is not updated here since | ||
3546 | * that might cause the user confirmation to be | ||
3547 | * rejected in case the remote doesn't have the | ||
3548 | * IO capabilities for MITM. | ||
3541 | */ | 3549 | */ |
3542 | if (conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && | 3550 | if (conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && |
3543 | cp.authentication != HCI_AT_NO_BONDING) | 3551 | cp.authentication != HCI_AT_NO_BONDING) |
@@ -3628,8 +3636,11 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
3628 | 3636 | ||
3629 | /* If we're not the initiators request authorization to | 3637 | /* If we're not the initiators request authorization to |
3630 | * proceed from user space (mgmt_user_confirm with | 3638 | * proceed from user space (mgmt_user_confirm with |
3631 | * confirm_hint set to 1). */ | 3639 | * confirm_hint set to 1). The exception is if neither |
3632 | if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { | 3640 | * side had MITM in which case we do auto-accept. |
3641 | */ | ||
3642 | if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) && | ||
3643 | (loc_mitm || rem_mitm)) { | ||
3633 | BT_DBG("Confirming auto-accept as acceptor"); | 3644 | BT_DBG("Confirming auto-accept as acceptor"); |
3634 | confirm_hint = 1; | 3645 | confirm_hint = 1; |
3635 | goto confirm; | 3646 | goto confirm; |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 6eabbe05fe54..323f23cd2c37 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -1663,7 +1663,13 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err) | |||
1663 | kfree_skb(conn->rx_skb); | 1663 | kfree_skb(conn->rx_skb); |
1664 | 1664 | ||
1665 | skb_queue_purge(&conn->pending_rx); | 1665 | skb_queue_purge(&conn->pending_rx); |
1666 | flush_work(&conn->pending_rx_work); | 1666 | |
1667 | /* We can not call flush_work(&conn->pending_rx_work) here since we | ||
1668 | * might block if we are running on a worker from the same workqueue | ||
1669 | * pending_rx_work is waiting on. | ||
1670 | */ | ||
1671 | if (work_pending(&conn->pending_rx_work)) | ||
1672 | cancel_work_sync(&conn->pending_rx_work); | ||
1667 | 1673 | ||
1668 | l2cap_unregister_all_users(conn); | 1674 | l2cap_unregister_all_users(conn); |
1669 | 1675 | ||
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index ade3fb4c23bc..e1378693cc90 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -787,11 +787,6 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, | |||
787 | 787 | ||
788 | /*change security for LE channels */ | 788 | /*change security for LE channels */ |
789 | if (chan->scid == L2CAP_CID_ATT) { | 789 | if (chan->scid == L2CAP_CID_ATT) { |
790 | if (!conn->hcon->out) { | ||
791 | err = -EINVAL; | ||
792 | break; | ||
793 | } | ||
794 | |||
795 | if (smp_conn_security(conn->hcon, sec.level)) | 790 | if (smp_conn_security(conn->hcon, sec.level)) |
796 | break; | 791 | break; |
797 | sk->sk_state = BT_CONFIG; | 792 | sk->sk_state = BT_CONFIG; |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 0fce54412ffd..af8e0a6243b7 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1047,6 +1047,43 @@ static void clean_up_hci_complete(struct hci_dev *hdev, u8 status) | |||
1047 | } | 1047 | } |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | static void hci_stop_discovery(struct hci_request *req) | ||
1051 | { | ||
1052 | struct hci_dev *hdev = req->hdev; | ||
1053 | struct hci_cp_remote_name_req_cancel cp; | ||
1054 | struct inquiry_entry *e; | ||
1055 | |||
1056 | switch (hdev->discovery.state) { | ||
1057 | case DISCOVERY_FINDING: | ||
1058 | if (test_bit(HCI_INQUIRY, &hdev->flags)) { | ||
1059 | hci_req_add(req, HCI_OP_INQUIRY_CANCEL, 0, NULL); | ||
1060 | } else { | ||
1061 | cancel_delayed_work(&hdev->le_scan_disable); | ||
1062 | hci_req_add_le_scan_disable(req); | ||
1063 | } | ||
1064 | |||
1065 | break; | ||
1066 | |||
1067 | case DISCOVERY_RESOLVING: | ||
1068 | e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, | ||
1069 | NAME_PENDING); | ||
1070 | if (!e) | ||
1071 | return; | ||
1072 | |||
1073 | bacpy(&cp.bdaddr, &e->data.bdaddr); | ||
1074 | hci_req_add(req, HCI_OP_REMOTE_NAME_REQ_CANCEL, sizeof(cp), | ||
1075 | &cp); | ||
1076 | |||
1077 | break; | ||
1078 | |||
1079 | default: | ||
1080 | /* Passive scanning */ | ||
1081 | if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) | ||
1082 | hci_req_add_le_scan_disable(req); | ||
1083 | break; | ||
1084 | } | ||
1085 | } | ||
1086 | |||
1050 | static int clean_up_hci_state(struct hci_dev *hdev) | 1087 | static int clean_up_hci_state(struct hci_dev *hdev) |
1051 | { | 1088 | { |
1052 | struct hci_request req; | 1089 | struct hci_request req; |
@@ -1063,9 +1100,7 @@ static int clean_up_hci_state(struct hci_dev *hdev) | |||
1063 | if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) | 1100 | if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) |
1064 | disable_advertising(&req); | 1101 | disable_advertising(&req); |
1065 | 1102 | ||
1066 | if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) { | 1103 | hci_stop_discovery(&req); |
1067 | hci_req_add_le_scan_disable(&req); | ||
1068 | } | ||
1069 | 1104 | ||
1070 | list_for_each_entry(conn, &hdev->conn_hash.list, list) { | 1105 | list_for_each_entry(conn, &hdev->conn_hash.list, list) { |
1071 | struct hci_cp_disconnect dc; | 1106 | struct hci_cp_disconnect dc; |
@@ -2996,8 +3031,13 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev, | |||
2996 | } | 3031 | } |
2997 | 3032 | ||
2998 | if (addr->type == BDADDR_LE_PUBLIC || addr->type == BDADDR_LE_RANDOM) { | 3033 | if (addr->type == BDADDR_LE_PUBLIC || addr->type == BDADDR_LE_RANDOM) { |
2999 | /* Continue with pairing via SMP */ | 3034 | /* Continue with pairing via SMP. The hdev lock must be |
3035 | * released as SMP may try to recquire it for crypto | ||
3036 | * purposes. | ||
3037 | */ | ||
3038 | hci_dev_unlock(hdev); | ||
3000 | err = smp_user_confirm_reply(conn, mgmt_op, passkey); | 3039 | err = smp_user_confirm_reply(conn, mgmt_op, passkey); |
3040 | hci_dev_lock(hdev); | ||
3001 | 3041 | ||
3002 | if (!err) | 3042 | if (!err) |
3003 | err = cmd_complete(sk, hdev->id, mgmt_op, | 3043 | err = cmd_complete(sk, hdev->id, mgmt_op, |
@@ -3574,8 +3614,6 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data, | |||
3574 | { | 3614 | { |
3575 | struct mgmt_cp_stop_discovery *mgmt_cp = data; | 3615 | struct mgmt_cp_stop_discovery *mgmt_cp = data; |
3576 | struct pending_cmd *cmd; | 3616 | struct pending_cmd *cmd; |
3577 | struct hci_cp_remote_name_req_cancel cp; | ||
3578 | struct inquiry_entry *e; | ||
3579 | struct hci_request req; | 3617 | struct hci_request req; |
3580 | int err; | 3618 | int err; |
3581 | 3619 | ||
@@ -3605,52 +3643,22 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data, | |||
3605 | 3643 | ||
3606 | hci_req_init(&req, hdev); | 3644 | hci_req_init(&req, hdev); |
3607 | 3645 | ||
3608 | switch (hdev->discovery.state) { | 3646 | hci_stop_discovery(&req); |
3609 | case DISCOVERY_FINDING: | ||
3610 | if (test_bit(HCI_INQUIRY, &hdev->flags)) { | ||
3611 | hci_req_add(&req, HCI_OP_INQUIRY_CANCEL, 0, NULL); | ||
3612 | } else { | ||
3613 | cancel_delayed_work(&hdev->le_scan_disable); | ||
3614 | |||
3615 | hci_req_add_le_scan_disable(&req); | ||
3616 | } | ||
3617 | |||
3618 | break; | ||
3619 | 3647 | ||
3620 | case DISCOVERY_RESOLVING: | 3648 | err = hci_req_run(&req, stop_discovery_complete); |
3621 | e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, | 3649 | if (!err) { |
3622 | NAME_PENDING); | 3650 | hci_discovery_set_state(hdev, DISCOVERY_STOPPING); |
3623 | if (!e) { | ||
3624 | mgmt_pending_remove(cmd); | ||
3625 | err = cmd_complete(sk, hdev->id, | ||
3626 | MGMT_OP_STOP_DISCOVERY, 0, | ||
3627 | &mgmt_cp->type, | ||
3628 | sizeof(mgmt_cp->type)); | ||
3629 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); | ||
3630 | goto unlock; | ||
3631 | } | ||
3632 | |||
3633 | bacpy(&cp.bdaddr, &e->data.bdaddr); | ||
3634 | hci_req_add(&req, HCI_OP_REMOTE_NAME_REQ_CANCEL, sizeof(cp), | ||
3635 | &cp); | ||
3636 | |||
3637 | break; | ||
3638 | |||
3639 | default: | ||
3640 | BT_DBG("unknown discovery state %u", hdev->discovery.state); | ||
3641 | |||
3642 | mgmt_pending_remove(cmd); | ||
3643 | err = cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY, | ||
3644 | MGMT_STATUS_FAILED, &mgmt_cp->type, | ||
3645 | sizeof(mgmt_cp->type)); | ||
3646 | goto unlock; | 3651 | goto unlock; |
3647 | } | 3652 | } |
3648 | 3653 | ||
3649 | err = hci_req_run(&req, stop_discovery_complete); | 3654 | mgmt_pending_remove(cmd); |
3650 | if (err < 0) | 3655 | |
3651 | mgmt_pending_remove(cmd); | 3656 | /* If no HCI commands were sent we're done */ |
3652 | else | 3657 | if (err == -ENODATA) { |
3653 | hci_discovery_set_state(hdev, DISCOVERY_STOPPING); | 3658 | err = cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY, 0, |
3659 | &mgmt_cp->type, sizeof(mgmt_cp->type)); | ||
3660 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); | ||
3661 | } | ||
3654 | 3662 | ||
3655 | unlock: | 3663 | unlock: |
3656 | hci_dev_unlock(hdev); | 3664 | hci_dev_unlock(hdev); |
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 3d1cc164557d..f2829a7932e2 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -544,7 +544,7 @@ static u8 smp_random(struct smp_chan *smp) | |||
544 | hci_le_start_enc(hcon, ediv, rand, stk); | 544 | hci_le_start_enc(hcon, ediv, rand, stk); |
545 | hcon->enc_key_size = smp->enc_key_size; | 545 | hcon->enc_key_size = smp->enc_key_size; |
546 | } else { | 546 | } else { |
547 | u8 stk[16]; | 547 | u8 stk[16], auth; |
548 | __le64 rand = 0; | 548 | __le64 rand = 0; |
549 | __le16 ediv = 0; | 549 | __le16 ediv = 0; |
550 | 550 | ||
@@ -556,8 +556,13 @@ static u8 smp_random(struct smp_chan *smp) | |||
556 | memset(stk + smp->enc_key_size, 0, | 556 | memset(stk + smp->enc_key_size, 0, |
557 | SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size); | 557 | SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size); |
558 | 558 | ||
559 | if (hcon->pending_sec_level == BT_SECURITY_HIGH) | ||
560 | auth = 1; | ||
561 | else | ||
562 | auth = 0; | ||
563 | |||
559 | hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, | 564 | hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, |
560 | HCI_SMP_STK_SLAVE, 0, stk, smp->enc_key_size, | 565 | HCI_SMP_STK_SLAVE, auth, stk, smp->enc_key_size, |
561 | ediv, rand); | 566 | ediv, rand); |
562 | } | 567 | } |
563 | 568 | ||
diff --git a/net/core/dst.c b/net/core/dst.c index 80d6286c8b62..a028409ee438 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -269,6 +269,15 @@ again: | |||
269 | } | 269 | } |
270 | EXPORT_SYMBOL(dst_destroy); | 270 | EXPORT_SYMBOL(dst_destroy); |
271 | 271 | ||
272 | static void dst_destroy_rcu(struct rcu_head *head) | ||
273 | { | ||
274 | struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head); | ||
275 | |||
276 | dst = dst_destroy(dst); | ||
277 | if (dst) | ||
278 | __dst_free(dst); | ||
279 | } | ||
280 | |||
272 | void dst_release(struct dst_entry *dst) | 281 | void dst_release(struct dst_entry *dst) |
273 | { | 282 | { |
274 | if (dst) { | 283 | if (dst) { |
@@ -276,11 +285,8 @@ void dst_release(struct dst_entry *dst) | |||
276 | 285 | ||
277 | newrefcnt = atomic_dec_return(&dst->__refcnt); | 286 | newrefcnt = atomic_dec_return(&dst->__refcnt); |
278 | WARN_ON(newrefcnt < 0); | 287 | WARN_ON(newrefcnt < 0); |
279 | if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) { | 288 | if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) |
280 | dst = dst_destroy(dst); | 289 | call_rcu(&dst->rcu_head, dst_destroy_rcu); |
281 | if (dst) | ||
282 | __dst_free(dst); | ||
283 | } | ||
284 | } | 290 | } |
285 | } | 291 | } |
286 | EXPORT_SYMBOL(dst_release); | 292 | EXPORT_SYMBOL(dst_release); |
diff --git a/net/core/filter.c b/net/core/filter.c index 735fad897496..1dbf6462f766 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -840,11 +840,11 @@ int sk_convert_filter(struct sock_filter *prog, int len, | |||
840 | BUILD_BUG_ON(BPF_MEMWORDS * sizeof(u32) > MAX_BPF_STACK); | 840 | BUILD_BUG_ON(BPF_MEMWORDS * sizeof(u32) > MAX_BPF_STACK); |
841 | BUILD_BUG_ON(BPF_REG_FP + 1 != MAX_BPF_REG); | 841 | BUILD_BUG_ON(BPF_REG_FP + 1 != MAX_BPF_REG); |
842 | 842 | ||
843 | if (len <= 0 || len >= BPF_MAXINSNS) | 843 | if (len <= 0 || len > BPF_MAXINSNS) |
844 | return -EINVAL; | 844 | return -EINVAL; |
845 | 845 | ||
846 | if (new_prog) { | 846 | if (new_prog) { |
847 | addrs = kzalloc(len * sizeof(*addrs), GFP_KERNEL); | 847 | addrs = kcalloc(len, sizeof(*addrs), GFP_KERNEL); |
848 | if (!addrs) | 848 | if (!addrs) |
849 | return -ENOMEM; | 849 | return -ENOMEM; |
850 | } | 850 | } |
@@ -1101,7 +1101,7 @@ static int check_load_and_stores(struct sock_filter *filter, int flen) | |||
1101 | 1101 | ||
1102 | BUILD_BUG_ON(BPF_MEMWORDS > 16); | 1102 | BUILD_BUG_ON(BPF_MEMWORDS > 16); |
1103 | 1103 | ||
1104 | masks = kmalloc(flen * sizeof(*masks), GFP_KERNEL); | 1104 | masks = kmalloc_array(flen, sizeof(*masks), GFP_KERNEL); |
1105 | if (!masks) | 1105 | if (!masks) |
1106 | return -ENOMEM; | 1106 | return -ENOMEM; |
1107 | 1107 | ||
@@ -1382,7 +1382,7 @@ static struct sk_filter *__sk_migrate_realloc(struct sk_filter *fp, | |||
1382 | fp_new = sock_kmalloc(sk, len, GFP_KERNEL); | 1382 | fp_new = sock_kmalloc(sk, len, GFP_KERNEL); |
1383 | if (fp_new) { | 1383 | if (fp_new) { |
1384 | *fp_new = *fp; | 1384 | *fp_new = *fp; |
1385 | /* As we're kepping orig_prog in fp_new along, | 1385 | /* As we're keeping orig_prog in fp_new along, |
1386 | * we need to make sure we're not evicting it | 1386 | * we need to make sure we're not evicting it |
1387 | * from the old fp. | 1387 | * from the old fp. |
1388 | */ | 1388 | */ |
@@ -1524,8 +1524,8 @@ static struct sk_filter *__sk_prepare_filter(struct sk_filter *fp, | |||
1524 | 1524 | ||
1525 | /** | 1525 | /** |
1526 | * sk_unattached_filter_create - create an unattached filter | 1526 | * sk_unattached_filter_create - create an unattached filter |
1527 | * @fprog: the filter program | ||
1528 | * @pfp: the unattached filter that is created | 1527 | * @pfp: the unattached filter that is created |
1528 | * @fprog: the filter program | ||
1529 | * | 1529 | * |
1530 | * Create a filter independent of any socket. We first run some | 1530 | * Create a filter independent of any socket. We first run some |
1531 | * sanity checks on it to make sure it does not explode on us later. | 1531 | * sanity checks on it to make sure it does not explode on us later. |
diff --git a/net/core/iovec.c b/net/core/iovec.c index b61869429f4c..827dd6beb49c 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c | |||
@@ -75,61 +75,6 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *a | |||
75 | } | 75 | } |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * Copy kernel to iovec. Returns -EFAULT on error. | ||
79 | */ | ||
80 | |||
81 | int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, | ||
82 | int offset, int len) | ||
83 | { | ||
84 | int copy; | ||
85 | for (; len > 0; ++iov) { | ||
86 | /* Skip over the finished iovecs */ | ||
87 | if (unlikely(offset >= iov->iov_len)) { | ||
88 | offset -= iov->iov_len; | ||
89 | continue; | ||
90 | } | ||
91 | copy = min_t(unsigned int, iov->iov_len - offset, len); | ||
92 | if (copy_to_user(iov->iov_base + offset, kdata, copy)) | ||
93 | return -EFAULT; | ||
94 | offset = 0; | ||
95 | kdata += copy; | ||
96 | len -= copy; | ||
97 | } | ||
98 | |||
99 | return 0; | ||
100 | } | ||
101 | EXPORT_SYMBOL(memcpy_toiovecend); | ||
102 | |||
103 | /* | ||
104 | * Copy iovec to kernel. Returns -EFAULT on error. | ||
105 | */ | ||
106 | |||
107 | int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, | ||
108 | int offset, int len) | ||
109 | { | ||
110 | /* Skip over the finished iovecs */ | ||
111 | while (offset >= iov->iov_len) { | ||
112 | offset -= iov->iov_len; | ||
113 | iov++; | ||
114 | } | ||
115 | |||
116 | while (len > 0) { | ||
117 | u8 __user *base = iov->iov_base + offset; | ||
118 | int copy = min_t(unsigned int, len, iov->iov_len - offset); | ||
119 | |||
120 | offset = 0; | ||
121 | if (copy_from_user(kdata, base, copy)) | ||
122 | return -EFAULT; | ||
123 | len -= copy; | ||
124 | kdata += copy; | ||
125 | iov++; | ||
126 | } | ||
127 | |||
128 | return 0; | ||
129 | } | ||
130 | EXPORT_SYMBOL(memcpy_fromiovecend); | ||
131 | |||
132 | /* | ||
133 | * And now for the all-in-one: copy and checksum from a user iovec | 78 | * And now for the all-in-one: copy and checksum from a user iovec |
134 | * directly to a datagram | 79 | * directly to a datagram |
135 | * Calls to csum_partial but the last must be in 32 bit chunks | 80 | * Calls to csum_partial but the last must be in 32 bit chunks |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 9cd5344fad73..c1a33033cbe2 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2993,7 +2993,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, | |||
2993 | skb_put(nskb, len), | 2993 | skb_put(nskb, len), |
2994 | len, 0); | 2994 | len, 0); |
2995 | SKB_GSO_CB(nskb)->csum_start = | 2995 | SKB_GSO_CB(nskb)->csum_start = |
2996 | skb_headroom(nskb) + offset; | 2996 | skb_headroom(nskb) + doffset; |
2997 | continue; | 2997 | continue; |
2998 | } | 2998 | } |
2999 | 2999 | ||
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 097b3e7c1e8f..54b6731dab55 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -73,12 +73,7 @@ static void __tunnel_dst_set(struct ip_tunnel_dst *idst, | |||
73 | { | 73 | { |
74 | struct dst_entry *old_dst; | 74 | struct dst_entry *old_dst; |
75 | 75 | ||
76 | if (dst) { | 76 | dst_clone(dst); |
77 | if (dst->flags & DST_NOCACHE) | ||
78 | dst = NULL; | ||
79 | else | ||
80 | dst_clone(dst); | ||
81 | } | ||
82 | old_dst = xchg((__force struct dst_entry **)&idst->dst, dst); | 77 | old_dst = xchg((__force struct dst_entry **)&idst->dst, dst); |
83 | dst_release(old_dst); | 78 | dst_release(old_dst); |
84 | } | 79 | } |
@@ -108,13 +103,14 @@ static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, u32 cookie) | |||
108 | 103 | ||
109 | rcu_read_lock(); | 104 | rcu_read_lock(); |
110 | dst = rcu_dereference(this_cpu_ptr(t->dst_cache)->dst); | 105 | dst = rcu_dereference(this_cpu_ptr(t->dst_cache)->dst); |
106 | if (dst && !atomic_inc_not_zero(&dst->__refcnt)) | ||
107 | dst = NULL; | ||
111 | if (dst) { | 108 | if (dst) { |
112 | if (dst->obsolete && dst->ops->check(dst, cookie) == NULL) { | 109 | if (dst->obsolete && dst->ops->check(dst, cookie) == NULL) { |
113 | rcu_read_unlock(); | ||
114 | tunnel_dst_reset(t); | 110 | tunnel_dst_reset(t); |
115 | return NULL; | 111 | dst_release(dst); |
112 | dst = NULL; | ||
116 | } | 113 | } |
117 | dst_hold(dst); | ||
118 | } | 114 | } |
119 | rcu_read_unlock(); | 115 | rcu_read_unlock(); |
120 | return (struct rtable *)dst; | 116 | return (struct rtable *)dst; |
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 62e48cf84e60..9771563ab564 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c | |||
@@ -131,7 +131,7 @@ static bool tcp_fastopen_create_child(struct sock *sk, | |||
131 | struct dst_entry *dst, | 131 | struct dst_entry *dst, |
132 | struct request_sock *req) | 132 | struct request_sock *req) |
133 | { | 133 | { |
134 | struct tcp_sock *tp = tcp_sk(sk); | 134 | struct tcp_sock *tp; |
135 | struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue; | 135 | struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue; |
136 | struct sock *child; | 136 | struct sock *child; |
137 | 137 | ||
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 40661fc1e233..b5c23756965a 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1162,7 +1162,7 @@ static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb, | |||
1162 | unsigned int new_len = (pkt_len / mss) * mss; | 1162 | unsigned int new_len = (pkt_len / mss) * mss; |
1163 | if (!in_sack && new_len < pkt_len) { | 1163 | if (!in_sack && new_len < pkt_len) { |
1164 | new_len += mss; | 1164 | new_len += mss; |
1165 | if (new_len > skb->len) | 1165 | if (new_len >= skb->len) |
1166 | return 0; | 1166 | return 0; |
1167 | } | 1167 | } |
1168 | pkt_len = new_len; | 1168 | pkt_len = new_len; |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index c42e83d2751c..581a6584ed0c 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -3778,6 +3778,7 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) | |||
3778 | cancel_delayed_work_sync(&ipvs->defense_work); | 3778 | cancel_delayed_work_sync(&ipvs->defense_work); |
3779 | cancel_work_sync(&ipvs->defense_work.work); | 3779 | cancel_work_sync(&ipvs->defense_work.work); |
3780 | unregister_net_sysctl_table(ipvs->sysctl_hdr); | 3780 | unregister_net_sysctl_table(ipvs->sysctl_hdr); |
3781 | ip_vs_stop_estimator(net, &ipvs->tot_stats); | ||
3781 | } | 3782 | } |
3782 | 3783 | ||
3783 | #else | 3784 | #else |
@@ -3840,7 +3841,6 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net) | |||
3840 | struct netns_ipvs *ipvs = net_ipvs(net); | 3841 | struct netns_ipvs *ipvs = net_ipvs(net); |
3841 | 3842 | ||
3842 | ip_vs_trash_cleanup(net); | 3843 | ip_vs_trash_cleanup(net); |
3843 | ip_vs_stop_estimator(net, &ipvs->tot_stats); | ||
3844 | ip_vs_control_net_cleanup_sysctl(net); | 3844 | ip_vs_control_net_cleanup_sysctl(net); |
3845 | remove_proc_entry("ip_vs_stats_percpu", net->proc_net); | 3845 | remove_proc_entry("ip_vs_stats_percpu", net->proc_net); |
3846 | remove_proc_entry("ip_vs_stats", net->proc_net); | 3846 | remove_proc_entry("ip_vs_stats", net->proc_net); |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 58579634427d..300ed1eec729 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -597,6 +597,9 @@ ctnetlink_nlmsg_size(const struct nf_conn *ct) | |||
597 | #ifdef CONFIG_NF_CONNTRACK_MARK | 597 | #ifdef CONFIG_NF_CONNTRACK_MARK |
598 | + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */ | 598 | + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */ |
599 | #endif | 599 | #endif |
600 | #ifdef CONFIG_NF_CONNTRACK_ZONES | ||
601 | + nla_total_size(sizeof(u_int16_t)) /* CTA_ZONE */ | ||
602 | #endif | ||
600 | + ctnetlink_proto_size(ct) | 603 | + ctnetlink_proto_size(ct) |
601 | + ctnetlink_label_size(ct) | 604 | + ctnetlink_label_size(ct) |
602 | ; | 605 | ; |
@@ -1150,7 +1153,7 @@ static int ctnetlink_done_list(struct netlink_callback *cb) | |||
1150 | static int | 1153 | static int |
1151 | ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying) | 1154 | ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying) |
1152 | { | 1155 | { |
1153 | struct nf_conn *ct, *last = NULL; | 1156 | struct nf_conn *ct, *last; |
1154 | struct nf_conntrack_tuple_hash *h; | 1157 | struct nf_conntrack_tuple_hash *h; |
1155 | struct hlist_nulls_node *n; | 1158 | struct hlist_nulls_node *n; |
1156 | struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); | 1159 | struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); |
@@ -1163,8 +1166,7 @@ ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying | |||
1163 | if (cb->args[2]) | 1166 | if (cb->args[2]) |
1164 | return 0; | 1167 | return 0; |
1165 | 1168 | ||
1166 | if (cb->args[0] == nr_cpu_ids) | 1169 | last = (struct nf_conn *)cb->args[1]; |
1167 | return 0; | ||
1168 | 1170 | ||
1169 | for (cpu = cb->args[0]; cpu < nr_cpu_ids; cpu++) { | 1171 | for (cpu = cb->args[0]; cpu < nr_cpu_ids; cpu++) { |
1170 | struct ct_pcpu *pcpu; | 1172 | struct ct_pcpu *pcpu; |
@@ -1174,7 +1176,6 @@ ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying | |||
1174 | 1176 | ||
1175 | pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); | 1177 | pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); |
1176 | spin_lock_bh(&pcpu->lock); | 1178 | spin_lock_bh(&pcpu->lock); |
1177 | last = (struct nf_conn *)cb->args[1]; | ||
1178 | list = dying ? &pcpu->dying : &pcpu->unconfirmed; | 1179 | list = dying ? &pcpu->dying : &pcpu->unconfirmed; |
1179 | restart: | 1180 | restart: |
1180 | hlist_nulls_for_each_entry(h, n, list, hnnode) { | 1181 | hlist_nulls_for_each_entry(h, n, list, hnnode) { |
@@ -1193,7 +1194,9 @@ restart: | |||
1193 | ct); | 1194 | ct); |
1194 | rcu_read_unlock(); | 1195 | rcu_read_unlock(); |
1195 | if (res < 0) { | 1196 | if (res < 0) { |
1196 | nf_conntrack_get(&ct->ct_general); | 1197 | if (!atomic_inc_not_zero(&ct->ct_general.use)) |
1198 | continue; | ||
1199 | cb->args[0] = cpu; | ||
1197 | cb->args[1] = (unsigned long)ct; | 1200 | cb->args[1] = (unsigned long)ct; |
1198 | spin_unlock_bh(&pcpu->lock); | 1201 | spin_unlock_bh(&pcpu->lock); |
1199 | goto out; | 1202 | goto out; |
@@ -1202,10 +1205,10 @@ restart: | |||
1202 | if (cb->args[1]) { | 1205 | if (cb->args[1]) { |
1203 | cb->args[1] = 0; | 1206 | cb->args[1] = 0; |
1204 | goto restart; | 1207 | goto restart; |
1205 | } else | 1208 | } |
1206 | cb->args[2] = 1; | ||
1207 | spin_unlock_bh(&pcpu->lock); | 1209 | spin_unlock_bh(&pcpu->lock); |
1208 | } | 1210 | } |
1211 | cb->args[2] = 1; | ||
1209 | out: | 1212 | out: |
1210 | if (last) | 1213 | if (last) |
1211 | nf_ct_put(last); | 1214 | nf_ct_put(last); |
@@ -2040,6 +2043,9 @@ ctnetlink_nfqueue_build_size(const struct nf_conn *ct) | |||
2040 | #ifdef CONFIG_NF_CONNTRACK_MARK | 2043 | #ifdef CONFIG_NF_CONNTRACK_MARK |
2041 | + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */ | 2044 | + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */ |
2042 | #endif | 2045 | #endif |
2046 | #ifdef CONFIG_NF_CONNTRACK_ZONES | ||
2047 | + nla_total_size(sizeof(u_int16_t)) /* CTA_ZONE */ | ||
2048 | #endif | ||
2043 | + ctnetlink_proto_size(ct) | 2049 | + ctnetlink_proto_size(ct) |
2044 | ; | 2050 | ; |
2045 | } | 2051 | } |
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c index 09096a670c45..a49907b1dabc 100644 --- a/net/netfilter/nf_nat_core.c +++ b/net/netfilter/nf_nat_core.c | |||
@@ -525,6 +525,39 @@ static int nf_nat_proto_remove(struct nf_conn *i, void *data) | |||
525 | return i->status & IPS_NAT_MASK ? 1 : 0; | 525 | return i->status & IPS_NAT_MASK ? 1 : 0; |
526 | } | 526 | } |
527 | 527 | ||
528 | static int nf_nat_proto_clean(struct nf_conn *ct, void *data) | ||
529 | { | ||
530 | struct nf_conn_nat *nat = nfct_nat(ct); | ||
531 | |||
532 | if (nf_nat_proto_remove(ct, data)) | ||
533 | return 1; | ||
534 | |||
535 | if (!nat || !nat->ct) | ||
536 | return 0; | ||
537 | |||
538 | /* This netns is being destroyed, and conntrack has nat null binding. | ||
539 | * Remove it from bysource hash, as the table will be freed soon. | ||
540 | * | ||
541 | * Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack() | ||
542 | * will delete entry from already-freed table. | ||
543 | */ | ||
544 | if (!del_timer(&ct->timeout)) | ||
545 | return 1; | ||
546 | |||
547 | spin_lock_bh(&nf_nat_lock); | ||
548 | hlist_del_rcu(&nat->bysource); | ||
549 | ct->status &= ~IPS_NAT_DONE_MASK; | ||
550 | nat->ct = NULL; | ||
551 | spin_unlock_bh(&nf_nat_lock); | ||
552 | |||
553 | add_timer(&ct->timeout); | ||
554 | |||
555 | /* don't delete conntrack. Although that would make things a lot | ||
556 | * simpler, we'd end up flushing all conntracks on nat rmmod. | ||
557 | */ | ||
558 | return 0; | ||
559 | } | ||
560 | |||
528 | static void nf_nat_l4proto_clean(u8 l3proto, u8 l4proto) | 561 | static void nf_nat_l4proto_clean(u8 l3proto, u8 l4proto) |
529 | { | 562 | { |
530 | struct nf_nat_proto_clean clean = { | 563 | struct nf_nat_proto_clean clean = { |
@@ -795,7 +828,7 @@ static void __net_exit nf_nat_net_exit(struct net *net) | |||
795 | { | 828 | { |
796 | struct nf_nat_proto_clean clean = {}; | 829 | struct nf_nat_proto_clean clean = {}; |
797 | 830 | ||
798 | nf_ct_iterate_cleanup(net, &nf_nat_proto_remove, &clean, 0, 0); | 831 | nf_ct_iterate_cleanup(net, nf_nat_proto_clean, &clean, 0, 0); |
799 | synchronize_rcu(); | 832 | synchronize_rcu(); |
800 | nf_ct_free_hashtable(net->ct.nat_bysource, net->ct.nat_htable_size); | 833 | nf_ct_free_hashtable(net->ct.nat_bysource, net->ct.nat_htable_size); |
801 | } | 834 | } |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 624e083125b9..ab4566cfcbe4 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -1730,6 +1730,9 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, | |||
1730 | if (!create || nlh->nlmsg_flags & NLM_F_REPLACE) | 1730 | if (!create || nlh->nlmsg_flags & NLM_F_REPLACE) |
1731 | return -EINVAL; | 1731 | return -EINVAL; |
1732 | handle = nf_tables_alloc_handle(table); | 1732 | handle = nf_tables_alloc_handle(table); |
1733 | |||
1734 | if (chain->use == UINT_MAX) | ||
1735 | return -EOVERFLOW; | ||
1733 | } | 1736 | } |
1734 | 1737 | ||
1735 | if (nla[NFTA_RULE_POSITION]) { | 1738 | if (nla[NFTA_RULE_POSITION]) { |
@@ -1789,14 +1792,15 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, | |||
1789 | 1792 | ||
1790 | if (nlh->nlmsg_flags & NLM_F_REPLACE) { | 1793 | if (nlh->nlmsg_flags & NLM_F_REPLACE) { |
1791 | if (nft_rule_is_active_next(net, old_rule)) { | 1794 | if (nft_rule_is_active_next(net, old_rule)) { |
1792 | trans = nft_trans_rule_add(&ctx, NFT_MSG_NEWRULE, | 1795 | trans = nft_trans_rule_add(&ctx, NFT_MSG_DELRULE, |
1793 | old_rule); | 1796 | old_rule); |
1794 | if (trans == NULL) { | 1797 | if (trans == NULL) { |
1795 | err = -ENOMEM; | 1798 | err = -ENOMEM; |
1796 | goto err2; | 1799 | goto err2; |
1797 | } | 1800 | } |
1798 | nft_rule_disactivate_next(net, old_rule); | 1801 | nft_rule_disactivate_next(net, old_rule); |
1799 | list_add_tail(&rule->list, &old_rule->list); | 1802 | chain->use--; |
1803 | list_add_tail_rcu(&rule->list, &old_rule->list); | ||
1800 | } else { | 1804 | } else { |
1801 | err = -ENOENT; | 1805 | err = -ENOENT; |
1802 | goto err2; | 1806 | goto err2; |
@@ -1826,6 +1830,7 @@ err3: | |||
1826 | list_del_rcu(&nft_trans_rule(trans)->list); | 1830 | list_del_rcu(&nft_trans_rule(trans)->list); |
1827 | nft_rule_clear(net, nft_trans_rule(trans)); | 1831 | nft_rule_clear(net, nft_trans_rule(trans)); |
1828 | nft_trans_destroy(trans); | 1832 | nft_trans_destroy(trans); |
1833 | chain->use++; | ||
1829 | } | 1834 | } |
1830 | err2: | 1835 | err2: |
1831 | nf_tables_rule_destroy(&ctx, rule); | 1836 | nf_tables_rule_destroy(&ctx, rule); |
@@ -2845,7 +2850,7 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) | |||
2845 | goto nla_put_failure; | 2850 | goto nla_put_failure; |
2846 | 2851 | ||
2847 | nfmsg = nlmsg_data(nlh); | 2852 | nfmsg = nlmsg_data(nlh); |
2848 | nfmsg->nfgen_family = NFPROTO_UNSPEC; | 2853 | nfmsg->nfgen_family = ctx.afi->family; |
2849 | nfmsg->version = NFNETLINK_V0; | 2854 | nfmsg->version = NFNETLINK_V0; |
2850 | nfmsg->res_id = 0; | 2855 | nfmsg->res_id = 0; |
2851 | 2856 | ||
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 8a779be832fb..1840989092ed 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
@@ -195,6 +195,15 @@ static void | |||
195 | nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) | 195 | nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) |
196 | { | 196 | { |
197 | struct xt_target *target = expr->ops->data; | 197 | struct xt_target *target = expr->ops->data; |
198 | void *info = nft_expr_priv(expr); | ||
199 | struct xt_tgdtor_param par; | ||
200 | |||
201 | par.net = ctx->net; | ||
202 | par.target = target; | ||
203 | par.targinfo = info; | ||
204 | par.family = ctx->afi->family; | ||
205 | if (par.target->destroy != NULL) | ||
206 | par.target->destroy(&par); | ||
198 | 207 | ||
199 | module_put(target->me); | 208 | module_put(target->me); |
200 | } | 209 | } |
@@ -382,6 +391,15 @@ static void | |||
382 | nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) | 391 | nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) |
383 | { | 392 | { |
384 | struct xt_match *match = expr->ops->data; | 393 | struct xt_match *match = expr->ops->data; |
394 | void *info = nft_expr_priv(expr); | ||
395 | struct xt_mtdtor_param par; | ||
396 | |||
397 | par.net = ctx->net; | ||
398 | par.match = match; | ||
399 | par.matchinfo = info; | ||
400 | par.family = ctx->afi->family; | ||
401 | if (par.match->destroy != NULL) | ||
402 | par.match->destroy(&par); | ||
385 | 403 | ||
386 | module_put(match->me); | 404 | module_put(match->me); |
387 | } | 405 | } |
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c index a0195d28bcfc..79ff58cd36dc 100644 --- a/net/netfilter/nft_nat.c +++ b/net/netfilter/nft_nat.c | |||
@@ -175,12 +175,14 @@ static int nft_nat_dump(struct sk_buff *skb, const struct nft_expr *expr) | |||
175 | if (nla_put_be32(skb, | 175 | if (nla_put_be32(skb, |
176 | NFTA_NAT_REG_ADDR_MAX, htonl(priv->sreg_addr_max))) | 176 | NFTA_NAT_REG_ADDR_MAX, htonl(priv->sreg_addr_max))) |
177 | goto nla_put_failure; | 177 | goto nla_put_failure; |
178 | if (nla_put_be32(skb, | 178 | if (priv->sreg_proto_min) { |
179 | NFTA_NAT_REG_PROTO_MIN, htonl(priv->sreg_proto_min))) | 179 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MIN, |
180 | goto nla_put_failure; | 180 | htonl(priv->sreg_proto_min))) |
181 | if (nla_put_be32(skb, | 181 | goto nla_put_failure; |
182 | NFTA_NAT_REG_PROTO_MAX, htonl(priv->sreg_proto_max))) | 182 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MAX, |
183 | goto nla_put_failure; | 183 | htonl(priv->sreg_proto_max))) |
184 | goto nla_put_failure; | ||
185 | } | ||
184 | return 0; | 186 | return 0; |
185 | 187 | ||
186 | nla_put_failure: | 188 | nla_put_failure: |
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index dcb19592761e..12c7e01c2677 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
@@ -321,41 +321,40 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write, | |||
321 | loff_t *ppos) | 321 | loff_t *ppos) |
322 | { | 322 | { |
323 | struct net *net = current->nsproxy->net_ns; | 323 | struct net *net = current->nsproxy->net_ns; |
324 | char tmp[8]; | ||
325 | struct ctl_table tbl; | 324 | struct ctl_table tbl; |
326 | int ret; | 325 | bool changed = false; |
327 | int changed = 0; | ||
328 | char *none = "none"; | 326 | char *none = "none"; |
327 | char tmp[8]; | ||
328 | int ret; | ||
329 | 329 | ||
330 | memset(&tbl, 0, sizeof(struct ctl_table)); | 330 | memset(&tbl, 0, sizeof(struct ctl_table)); |
331 | 331 | ||
332 | if (write) { | 332 | if (write) { |
333 | tbl.data = tmp; | 333 | tbl.data = tmp; |
334 | tbl.maxlen = 8; | 334 | tbl.maxlen = sizeof(tmp); |
335 | } else { | 335 | } else { |
336 | tbl.data = net->sctp.sctp_hmac_alg ? : none; | 336 | tbl.data = net->sctp.sctp_hmac_alg ? : none; |
337 | tbl.maxlen = strlen(tbl.data); | 337 | tbl.maxlen = strlen(tbl.data); |
338 | } | 338 | } |
339 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); | ||
340 | 339 | ||
341 | if (write) { | 340 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
341 | if (write && ret == 0) { | ||
342 | #ifdef CONFIG_CRYPTO_MD5 | 342 | #ifdef CONFIG_CRYPTO_MD5 |
343 | if (!strncmp(tmp, "md5", 3)) { | 343 | if (!strncmp(tmp, "md5", 3)) { |
344 | net->sctp.sctp_hmac_alg = "md5"; | 344 | net->sctp.sctp_hmac_alg = "md5"; |
345 | changed = 1; | 345 | changed = true; |
346 | } | 346 | } |
347 | #endif | 347 | #endif |
348 | #ifdef CONFIG_CRYPTO_SHA1 | 348 | #ifdef CONFIG_CRYPTO_SHA1 |
349 | if (!strncmp(tmp, "sha1", 4)) { | 349 | if (!strncmp(tmp, "sha1", 4)) { |
350 | net->sctp.sctp_hmac_alg = "sha1"; | 350 | net->sctp.sctp_hmac_alg = "sha1"; |
351 | changed = 1; | 351 | changed = true; |
352 | } | 352 | } |
353 | #endif | 353 | #endif |
354 | if (!strncmp(tmp, "none", 4)) { | 354 | if (!strncmp(tmp, "none", 4)) { |
355 | net->sctp.sctp_hmac_alg = NULL; | 355 | net->sctp.sctp_hmac_alg = NULL; |
356 | changed = 1; | 356 | changed = true; |
357 | } | 357 | } |
358 | |||
359 | if (!changed) | 358 | if (!changed) |
360 | ret = -EINVAL; | 359 | ret = -EINVAL; |
361 | } | 360 | } |
@@ -368,11 +367,10 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, | |||
368 | loff_t *ppos) | 367 | loff_t *ppos) |
369 | { | 368 | { |
370 | struct net *net = current->nsproxy->net_ns; | 369 | struct net *net = current->nsproxy->net_ns; |
371 | int new_value; | ||
372 | struct ctl_table tbl; | ||
373 | unsigned int min = *(unsigned int *) ctl->extra1; | 370 | unsigned int min = *(unsigned int *) ctl->extra1; |
374 | unsigned int max = *(unsigned int *) ctl->extra2; | 371 | unsigned int max = *(unsigned int *) ctl->extra2; |
375 | int ret; | 372 | struct ctl_table tbl; |
373 | int ret, new_value; | ||
376 | 374 | ||
377 | memset(&tbl, 0, sizeof(struct ctl_table)); | 375 | memset(&tbl, 0, sizeof(struct ctl_table)); |
378 | tbl.maxlen = sizeof(unsigned int); | 376 | tbl.maxlen = sizeof(unsigned int); |
@@ -381,12 +379,15 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, | |||
381 | tbl.data = &new_value; | 379 | tbl.data = &new_value; |
382 | else | 380 | else |
383 | tbl.data = &net->sctp.rto_min; | 381 | tbl.data = &net->sctp.rto_min; |
382 | |||
384 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); | 383 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); |
385 | if (write) { | 384 | if (write && ret == 0) { |
386 | if (ret || new_value > max || new_value < min) | 385 | if (new_value > max || new_value < min) |
387 | return -EINVAL; | 386 | return -EINVAL; |
387 | |||
388 | net->sctp.rto_min = new_value; | 388 | net->sctp.rto_min = new_value; |
389 | } | 389 | } |
390 | |||
390 | return ret; | 391 | return ret; |
391 | } | 392 | } |
392 | 393 | ||
@@ -395,11 +396,10 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, | |||
395 | loff_t *ppos) | 396 | loff_t *ppos) |
396 | { | 397 | { |
397 | struct net *net = current->nsproxy->net_ns; | 398 | struct net *net = current->nsproxy->net_ns; |
398 | int new_value; | ||
399 | struct ctl_table tbl; | ||
400 | unsigned int min = *(unsigned int *) ctl->extra1; | 399 | unsigned int min = *(unsigned int *) ctl->extra1; |
401 | unsigned int max = *(unsigned int *) ctl->extra2; | 400 | unsigned int max = *(unsigned int *) ctl->extra2; |
402 | int ret; | 401 | struct ctl_table tbl; |
402 | int ret, new_value; | ||
403 | 403 | ||
404 | memset(&tbl, 0, sizeof(struct ctl_table)); | 404 | memset(&tbl, 0, sizeof(struct ctl_table)); |
405 | tbl.maxlen = sizeof(unsigned int); | 405 | tbl.maxlen = sizeof(unsigned int); |
@@ -408,12 +408,15 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, | |||
408 | tbl.data = &new_value; | 408 | tbl.data = &new_value; |
409 | else | 409 | else |
410 | tbl.data = &net->sctp.rto_max; | 410 | tbl.data = &net->sctp.rto_max; |
411 | |||
411 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); | 412 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); |
412 | if (write) { | 413 | if (write && ret == 0) { |
413 | if (ret || new_value > max || new_value < min) | 414 | if (new_value > max || new_value < min) |
414 | return -EINVAL; | 415 | return -EINVAL; |
416 | |||
415 | net->sctp.rto_max = new_value; | 417 | net->sctp.rto_max = new_value; |
416 | } | 418 | } |
419 | |||
417 | return ret; | 420 | return ret; |
418 | } | 421 | } |
419 | 422 | ||
@@ -444,8 +447,7 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write, | |||
444 | tbl.data = &net->sctp.auth_enable; | 447 | tbl.data = &net->sctp.auth_enable; |
445 | 448 | ||
446 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); | 449 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); |
447 | 450 | if (write && ret == 0) { | |
448 | if (write) { | ||
449 | struct sock *sk = net->sctp.ctl_sock; | 451 | struct sock *sk = net->sctp.ctl_sock; |
450 | 452 | ||
451 | net->sctp.auth_enable = new_value; | 453 | net->sctp.auth_enable = new_value; |
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 247e973544bf..f77366717420 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -592,6 +592,7 @@ rpcauth_lookupcred(struct rpc_auth *auth, int flags) | |||
592 | put_group_info(acred.group_info); | 592 | put_group_info(acred.group_info); |
593 | return ret; | 593 | return ret; |
594 | } | 594 | } |
595 | EXPORT_SYMBOL_GPL(rpcauth_lookupcred); | ||
595 | 596 | ||
596 | void | 597 | void |
597 | rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred, | 598 | rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred, |
diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h index 6af373236d73..4b0113f73ee9 100644 --- a/samples/trace_events/trace-events-sample.h +++ b/samples/trace_events/trace-events-sample.h | |||
@@ -56,7 +56,8 @@ | |||
56 | * struct: This defines the way the data will be stored in the ring buffer. | 56 | * struct: This defines the way the data will be stored in the ring buffer. |
57 | * There are currently two types of elements. __field and __array. | 57 | * There are currently two types of elements. __field and __array. |
58 | * a __field is broken up into (type, name). Where type can be any | 58 | * a __field is broken up into (type, name). Where type can be any |
59 | * type but an array. | 59 | * primitive type (integer, long or pointer). __field_struct() can |
60 | * be any static complex data value (struct, union, but not an array). | ||
60 | * For an array. there are three fields. (type, name, size). The | 61 | * For an array. there are three fields. (type, name, size). The |
61 | * type of elements in the array, the name of the field and the size | 62 | * type of elements in the array, the name of the field and the size |
62 | * of the array. | 63 | * of the array. |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 010b18ef4ea0..182be0f12407 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -3476,12 +3476,17 @@ sub process { | |||
3476 | } | 3476 | } |
3477 | } | 3477 | } |
3478 | 3478 | ||
3479 | # unnecessary return in a void function? (a single leading tab, then return;) | 3479 | # unnecessary return in a void function |
3480 | if ($sline =~ /^\+\treturn\s*;\s*$/ && | 3480 | # at end-of-function, with the previous line a single leading tab, then return; |
3481 | $prevline =~ /^\+/) { | 3481 | # and the line before that not a goto label target like "out:" |
3482 | if ($sline =~ /^[ \+]}\s*$/ && | ||
3483 | $prevline =~ /^\+\treturn\s*;\s*$/ && | ||
3484 | $linenr >= 3 && | ||
3485 | $lines[$linenr - 3] =~ /^[ +]/ && | ||
3486 | $lines[$linenr - 3] !~ /^[ +]\s*$Ident\s*:/) { | ||
3482 | WARN("RETURN_VOID", | 3487 | WARN("RETURN_VOID", |
3483 | "void function return statements are not generally useful\n" . $herecurr); | 3488 | "void function return statements are not generally useful\n" . $hereprev); |
3484 | } | 3489 | } |
3485 | 3490 | ||
3486 | # if statements using unnecessary parentheses - ie: if ((foo == bar)) | 3491 | # if statements using unnecessary parentheses - ie: if ((foo == bar)) |
3487 | if ($^V && $^V ge 5.10.0 && | 3492 | if ($^V && $^V ge 5.10.0 && |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index da058da413e7..16a07cfa4d34 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -2073,6 +2073,7 @@ sub check_return_section { | |||
2073 | sub dump_function($$) { | 2073 | sub dump_function($$) { |
2074 | my $prototype = shift; | 2074 | my $prototype = shift; |
2075 | my $file = shift; | 2075 | my $file = shift; |
2076 | my $noret = 0; | ||
2076 | 2077 | ||
2077 | $prototype =~ s/^static +//; | 2078 | $prototype =~ s/^static +//; |
2078 | $prototype =~ s/^extern +//; | 2079 | $prototype =~ s/^extern +//; |
@@ -2086,7 +2087,7 @@ sub dump_function($$) { | |||
2086 | $prototype =~ s/__init_or_module +//; | 2087 | $prototype =~ s/__init_or_module +//; |
2087 | $prototype =~ s/__must_check +//; | 2088 | $prototype =~ s/__must_check +//; |
2088 | $prototype =~ s/__weak +//; | 2089 | $prototype =~ s/__weak +//; |
2089 | $prototype =~ s/^#\s*define\s+//; #ak added | 2090 | my $define = $prototype =~ s/^#\s*define\s+//; #ak added |
2090 | $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; | 2091 | $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; |
2091 | 2092 | ||
2092 | # Yes, this truly is vile. We are looking for: | 2093 | # Yes, this truly is vile. We are looking for: |
@@ -2105,7 +2106,15 @@ sub dump_function($$) { | |||
2105 | # - atomic_set (macro) | 2106 | # - atomic_set (macro) |
2106 | # - pci_match_device, __copy_to_user (long return type) | 2107 | # - pci_match_device, __copy_to_user (long return type) |
2107 | 2108 | ||
2108 | if ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || | 2109 | if ($define && $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s+/) { |
2110 | # This is an object-like macro, it has no return type and no parameter | ||
2111 | # list. | ||
2112 | # Function-like macros are not allowed to have spaces between | ||
2113 | # declaration_name and opening parenthesis (notice the \s+). | ||
2114 | $return_type = $1; | ||
2115 | $declaration_name = $2; | ||
2116 | $noret = 1; | ||
2117 | } elsif ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || | ||
2109 | $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || | 2118 | $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || |
2110 | $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || | 2119 | $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || |
2111 | $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || | 2120 | $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || |
@@ -2140,7 +2149,7 @@ sub dump_function($$) { | |||
2140 | # of warnings goes sufficiently down, the check is only performed in | 2149 | # of warnings goes sufficiently down, the check is only performed in |
2141 | # verbose mode. | 2150 | # verbose mode. |
2142 | # TODO: always perform the check. | 2151 | # TODO: always perform the check. |
2143 | if ($verbose) { | 2152 | if ($verbose && !$noret) { |
2144 | check_return_section($file, $declaration_name, $return_type); | 2153 | check_return_section($file, $declaration_name, $return_type); |
2145 | } | 2154 | } |
2146 | 2155 | ||
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index b5f08f727868..35d5a5877d04 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
@@ -289,14 +289,16 @@ EOF | |||
289 | 289 | ||
290 | fi | 290 | fi |
291 | 291 | ||
292 | # Build header package | 292 | # Build kernel header package |
293 | (cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles") | 293 | (cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles" |
294 | (cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles") | 294 | (cd $srctree; find arch/$SRCARCH/include include scripts -type f) >> "$objtree/debian/hdrsrcfiles" |
295 | (cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles") | 295 | (cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles" |
296 | (cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles" | ||
297 | (cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles" | ||
296 | destdir=$kernel_headers_dir/usr/src/linux-headers-$version | 298 | destdir=$kernel_headers_dir/usr/src/linux-headers-$version |
297 | mkdir -p "$destdir" | 299 | mkdir -p "$destdir" |
298 | (cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -) | 300 | (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -) |
299 | (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -) | 301 | (cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -) |
300 | (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be | 302 | (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be |
301 | ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" | 303 | ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" |
302 | rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" | 304 | rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" |
diff --git a/scripts/package/buildtar b/scripts/package/buildtar index 995c1eafaff6..e046bff33589 100644 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar | |||
@@ -125,12 +125,11 @@ esac | |||
125 | # Create the tarball | 125 | # Create the tarball |
126 | # | 126 | # |
127 | ( | 127 | ( |
128 | cd "${tmpdir}" | ||
129 | opts= | 128 | opts= |
130 | if tar --owner=root --group=root --help >/dev/null 2>&1; then | 129 | if tar --owner=root --group=root --help >/dev/null 2>&1; then |
131 | opts="--owner=root --group=root" | 130 | opts="--owner=root --group=root" |
132 | fi | 131 | fi |
133 | tar cf - boot/* lib/* $opts | ${compress} > "${tarball}${file_ext}" | 132 | tar cf - -C "$tmpdir" boot/ lib/ $opts | ${compress} > "${tarball}${file_ext}" |
134 | ) | 133 | ) |
135 | 134 | ||
136 | echo "Tarball successfully created in ${tarball}${file_ext}" | 135 | echo "Tarball successfully created in ${tarball}${file_ext}" |
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h index 9d1421e63ff8..49b582a225b0 100644 --- a/scripts/recordmcount.h +++ b/scripts/recordmcount.h | |||
@@ -163,11 +163,11 @@ static int mcount_adjust = 0; | |||
163 | 163 | ||
164 | static int MIPS_is_fake_mcount(Elf_Rel const *rp) | 164 | static int MIPS_is_fake_mcount(Elf_Rel const *rp) |
165 | { | 165 | { |
166 | static Elf_Addr old_r_offset; | 166 | static Elf_Addr old_r_offset = ~(Elf_Addr)0; |
167 | Elf_Addr current_r_offset = _w(rp->r_offset); | 167 | Elf_Addr current_r_offset = _w(rp->r_offset); |
168 | int is_fake; | 168 | int is_fake; |
169 | 169 | ||
170 | is_fake = old_r_offset && | 170 | is_fake = (old_r_offset != ~(Elf_Addr)0) && |
171 | (current_r_offset - old_r_offset == MIPS_FAKEMCOUNT_OFFSET); | 171 | (current_r_offset - old_r_offset == MIPS_FAKEMCOUNT_OFFSET); |
172 | old_r_offset = current_r_offset; | 172 | old_r_offset = current_r_offset; |
173 | 173 | ||
diff --git a/sound/core/control.c b/sound/core/control.c index f038f5afafe2..f0b0e14497a5 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -288,6 +288,10 @@ static bool snd_ctl_remove_numid_conflict(struct snd_card *card, | |||
288 | { | 288 | { |
289 | struct snd_kcontrol *kctl; | 289 | struct snd_kcontrol *kctl; |
290 | 290 | ||
291 | /* Make sure that the ids assigned to the control do not wrap around */ | ||
292 | if (card->last_numid >= UINT_MAX - count) | ||
293 | card->last_numid = 0; | ||
294 | |||
291 | list_for_each_entry(kctl, &card->controls, list) { | 295 | list_for_each_entry(kctl, &card->controls, list) { |
292 | if (kctl->id.numid < card->last_numid + 1 + count && | 296 | if (kctl->id.numid < card->last_numid + 1 + count && |
293 | kctl->id.numid + kctl->count > card->last_numid + 1) { | 297 | kctl->id.numid + kctl->count > card->last_numid + 1) { |
@@ -330,6 +334,7 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) | |||
330 | { | 334 | { |
331 | struct snd_ctl_elem_id id; | 335 | struct snd_ctl_elem_id id; |
332 | unsigned int idx; | 336 | unsigned int idx; |
337 | unsigned int count; | ||
333 | int err = -EINVAL; | 338 | int err = -EINVAL; |
334 | 339 | ||
335 | if (! kcontrol) | 340 | if (! kcontrol) |
@@ -337,6 +342,9 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) | |||
337 | if (snd_BUG_ON(!card || !kcontrol->info)) | 342 | if (snd_BUG_ON(!card || !kcontrol->info)) |
338 | goto error; | 343 | goto error; |
339 | id = kcontrol->id; | 344 | id = kcontrol->id; |
345 | if (id.index > UINT_MAX - kcontrol->count) | ||
346 | goto error; | ||
347 | |||
340 | down_write(&card->controls_rwsem); | 348 | down_write(&card->controls_rwsem); |
341 | if (snd_ctl_find_id(card, &id)) { | 349 | if (snd_ctl_find_id(card, &id)) { |
342 | up_write(&card->controls_rwsem); | 350 | up_write(&card->controls_rwsem); |
@@ -358,8 +366,9 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) | |||
358 | card->controls_count += kcontrol->count; | 366 | card->controls_count += kcontrol->count; |
359 | kcontrol->id.numid = card->last_numid + 1; | 367 | kcontrol->id.numid = card->last_numid + 1; |
360 | card->last_numid += kcontrol->count; | 368 | card->last_numid += kcontrol->count; |
369 | count = kcontrol->count; | ||
361 | up_write(&card->controls_rwsem); | 370 | up_write(&card->controls_rwsem); |
362 | for (idx = 0; idx < kcontrol->count; idx++, id.index++, id.numid++) | 371 | for (idx = 0; idx < count; idx++, id.index++, id.numid++) |
363 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id); | 372 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id); |
364 | return 0; | 373 | return 0; |
365 | 374 | ||
@@ -388,6 +397,7 @@ int snd_ctl_replace(struct snd_card *card, struct snd_kcontrol *kcontrol, | |||
388 | bool add_on_replace) | 397 | bool add_on_replace) |
389 | { | 398 | { |
390 | struct snd_ctl_elem_id id; | 399 | struct snd_ctl_elem_id id; |
400 | unsigned int count; | ||
391 | unsigned int idx; | 401 | unsigned int idx; |
392 | struct snd_kcontrol *old; | 402 | struct snd_kcontrol *old; |
393 | int ret; | 403 | int ret; |
@@ -423,8 +433,9 @@ add: | |||
423 | card->controls_count += kcontrol->count; | 433 | card->controls_count += kcontrol->count; |
424 | kcontrol->id.numid = card->last_numid + 1; | 434 | kcontrol->id.numid = card->last_numid + 1; |
425 | card->last_numid += kcontrol->count; | 435 | card->last_numid += kcontrol->count; |
436 | count = kcontrol->count; | ||
426 | up_write(&card->controls_rwsem); | 437 | up_write(&card->controls_rwsem); |
427 | for (idx = 0; idx < kcontrol->count; idx++, id.index++, id.numid++) | 438 | for (idx = 0; idx < count; idx++, id.index++, id.numid++) |
428 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id); | 439 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id); |
429 | return 0; | 440 | return 0; |
430 | 441 | ||
@@ -897,9 +908,9 @@ static int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, | |||
897 | result = kctl->put(kctl, control); | 908 | result = kctl->put(kctl, control); |
898 | } | 909 | } |
899 | if (result > 0) { | 910 | if (result > 0) { |
911 | struct snd_ctl_elem_id id = control->id; | ||
900 | up_read(&card->controls_rwsem); | 912 | up_read(&card->controls_rwsem); |
901 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, | 913 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &id); |
902 | &control->id); | ||
903 | return 0; | 914 | return 0; |
904 | } | 915 | } |
905 | } | 916 | } |
@@ -991,6 +1002,7 @@ static int snd_ctl_elem_unlock(struct snd_ctl_file *file, | |||
991 | 1002 | ||
992 | struct user_element { | 1003 | struct user_element { |
993 | struct snd_ctl_elem_info info; | 1004 | struct snd_ctl_elem_info info; |
1005 | struct snd_card *card; | ||
994 | void *elem_data; /* element data */ | 1006 | void *elem_data; /* element data */ |
995 | unsigned long elem_data_size; /* size of element data in bytes */ | 1007 | unsigned long elem_data_size; /* size of element data in bytes */ |
996 | void *tlv_data; /* TLV data */ | 1008 | void *tlv_data; /* TLV data */ |
@@ -1034,7 +1046,9 @@ static int snd_ctl_elem_user_get(struct snd_kcontrol *kcontrol, | |||
1034 | { | 1046 | { |
1035 | struct user_element *ue = kcontrol->private_data; | 1047 | struct user_element *ue = kcontrol->private_data; |
1036 | 1048 | ||
1049 | mutex_lock(&ue->card->user_ctl_lock); | ||
1037 | memcpy(&ucontrol->value, ue->elem_data, ue->elem_data_size); | 1050 | memcpy(&ucontrol->value, ue->elem_data, ue->elem_data_size); |
1051 | mutex_unlock(&ue->card->user_ctl_lock); | ||
1038 | return 0; | 1052 | return 0; |
1039 | } | 1053 | } |
1040 | 1054 | ||
@@ -1043,10 +1057,12 @@ static int snd_ctl_elem_user_put(struct snd_kcontrol *kcontrol, | |||
1043 | { | 1057 | { |
1044 | int change; | 1058 | int change; |
1045 | struct user_element *ue = kcontrol->private_data; | 1059 | struct user_element *ue = kcontrol->private_data; |
1046 | 1060 | ||
1061 | mutex_lock(&ue->card->user_ctl_lock); | ||
1047 | change = memcmp(&ucontrol->value, ue->elem_data, ue->elem_data_size) != 0; | 1062 | change = memcmp(&ucontrol->value, ue->elem_data, ue->elem_data_size) != 0; |
1048 | if (change) | 1063 | if (change) |
1049 | memcpy(ue->elem_data, &ucontrol->value, ue->elem_data_size); | 1064 | memcpy(ue->elem_data, &ucontrol->value, ue->elem_data_size); |
1065 | mutex_unlock(&ue->card->user_ctl_lock); | ||
1050 | return change; | 1066 | return change; |
1051 | } | 1067 | } |
1052 | 1068 | ||
@@ -1066,19 +1082,32 @@ static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kcontrol, | |||
1066 | new_data = memdup_user(tlv, size); | 1082 | new_data = memdup_user(tlv, size); |
1067 | if (IS_ERR(new_data)) | 1083 | if (IS_ERR(new_data)) |
1068 | return PTR_ERR(new_data); | 1084 | return PTR_ERR(new_data); |
1085 | mutex_lock(&ue->card->user_ctl_lock); | ||
1069 | change = ue->tlv_data_size != size; | 1086 | change = ue->tlv_data_size != size; |
1070 | if (!change) | 1087 | if (!change) |
1071 | change = memcmp(ue->tlv_data, new_data, size); | 1088 | change = memcmp(ue->tlv_data, new_data, size); |
1072 | kfree(ue->tlv_data); | 1089 | kfree(ue->tlv_data); |
1073 | ue->tlv_data = new_data; | 1090 | ue->tlv_data = new_data; |
1074 | ue->tlv_data_size = size; | 1091 | ue->tlv_data_size = size; |
1092 | mutex_unlock(&ue->card->user_ctl_lock); | ||
1075 | } else { | 1093 | } else { |
1076 | if (! ue->tlv_data_size || ! ue->tlv_data) | 1094 | int ret = 0; |
1077 | return -ENXIO; | 1095 | |
1078 | if (size < ue->tlv_data_size) | 1096 | mutex_lock(&ue->card->user_ctl_lock); |
1079 | return -ENOSPC; | 1097 | if (!ue->tlv_data_size || !ue->tlv_data) { |
1098 | ret = -ENXIO; | ||
1099 | goto err_unlock; | ||
1100 | } | ||
1101 | if (size < ue->tlv_data_size) { | ||
1102 | ret = -ENOSPC; | ||
1103 | goto err_unlock; | ||
1104 | } | ||
1080 | if (copy_to_user(tlv, ue->tlv_data, ue->tlv_data_size)) | 1105 | if (copy_to_user(tlv, ue->tlv_data, ue->tlv_data_size)) |
1081 | return -EFAULT; | 1106 | ret = -EFAULT; |
1107 | err_unlock: | ||
1108 | mutex_unlock(&ue->card->user_ctl_lock); | ||
1109 | if (ret) | ||
1110 | return ret; | ||
1082 | } | 1111 | } |
1083 | return change; | 1112 | return change; |
1084 | } | 1113 | } |
@@ -1136,8 +1165,6 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, | |||
1136 | struct user_element *ue; | 1165 | struct user_element *ue; |
1137 | int idx, err; | 1166 | int idx, err; |
1138 | 1167 | ||
1139 | if (!replace && card->user_ctl_count >= MAX_USER_CONTROLS) | ||
1140 | return -ENOMEM; | ||
1141 | if (info->count < 1) | 1168 | if (info->count < 1) |
1142 | return -EINVAL; | 1169 | return -EINVAL; |
1143 | access = info->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : | 1170 | access = info->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : |
@@ -1146,21 +1173,16 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, | |||
1146 | SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE)); | 1173 | SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE)); |
1147 | info->id.numid = 0; | 1174 | info->id.numid = 0; |
1148 | memset(&kctl, 0, sizeof(kctl)); | 1175 | memset(&kctl, 0, sizeof(kctl)); |
1149 | down_write(&card->controls_rwsem); | 1176 | |
1150 | _kctl = snd_ctl_find_id(card, &info->id); | 1177 | if (replace) { |
1151 | err = 0; | 1178 | err = snd_ctl_remove_user_ctl(file, &info->id); |
1152 | if (_kctl) { | 1179 | if (err) |
1153 | if (replace) | 1180 | return err; |
1154 | err = snd_ctl_remove(card, _kctl); | ||
1155 | else | ||
1156 | err = -EBUSY; | ||
1157 | } else { | ||
1158 | if (replace) | ||
1159 | err = -ENOENT; | ||
1160 | } | 1181 | } |
1161 | up_write(&card->controls_rwsem); | 1182 | |
1162 | if (err < 0) | 1183 | if (card->user_ctl_count >= MAX_USER_CONTROLS) |
1163 | return err; | 1184 | return -ENOMEM; |
1185 | |||
1164 | memcpy(&kctl.id, &info->id, sizeof(info->id)); | 1186 | memcpy(&kctl.id, &info->id, sizeof(info->id)); |
1165 | kctl.count = info->owner ? info->owner : 1; | 1187 | kctl.count = info->owner ? info->owner : 1; |
1166 | access |= SNDRV_CTL_ELEM_ACCESS_USER; | 1188 | access |= SNDRV_CTL_ELEM_ACCESS_USER; |
@@ -1210,6 +1232,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, | |||
1210 | ue = kzalloc(sizeof(struct user_element) + private_size, GFP_KERNEL); | 1232 | ue = kzalloc(sizeof(struct user_element) + private_size, GFP_KERNEL); |
1211 | if (ue == NULL) | 1233 | if (ue == NULL) |
1212 | return -ENOMEM; | 1234 | return -ENOMEM; |
1235 | ue->card = card; | ||
1213 | ue->info = *info; | 1236 | ue->info = *info; |
1214 | ue->info.access = 0; | 1237 | ue->info.access = 0; |
1215 | ue->elem_data = (char *)ue + sizeof(*ue); | 1238 | ue->elem_data = (char *)ue + sizeof(*ue); |
@@ -1321,8 +1344,9 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, | |||
1321 | } | 1344 | } |
1322 | err = kctl->tlv.c(kctl, op_flag, tlv.length, _tlv->tlv); | 1345 | err = kctl->tlv.c(kctl, op_flag, tlv.length, _tlv->tlv); |
1323 | if (err > 0) { | 1346 | if (err > 0) { |
1347 | struct snd_ctl_elem_id id = kctl->id; | ||
1324 | up_read(&card->controls_rwsem); | 1348 | up_read(&card->controls_rwsem); |
1325 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_TLV, &kctl->id); | 1349 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_TLV, &id); |
1326 | return 0; | 1350 | return 0; |
1327 | } | 1351 | } |
1328 | } else { | 1352 | } else { |
diff --git a/sound/core/init.c b/sound/core/init.c index 5ee83845c5de..7bdfd19e24a8 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -232,6 +232,7 @@ int snd_card_new(struct device *parent, int idx, const char *xid, | |||
232 | INIT_LIST_HEAD(&card->devices); | 232 | INIT_LIST_HEAD(&card->devices); |
233 | init_rwsem(&card->controls_rwsem); | 233 | init_rwsem(&card->controls_rwsem); |
234 | rwlock_init(&card->ctl_files_rwlock); | 234 | rwlock_init(&card->ctl_files_rwlock); |
235 | mutex_init(&card->user_ctl_lock); | ||
235 | INIT_LIST_HEAD(&card->controls); | 236 | INIT_LIST_HEAD(&card->controls); |
236 | INIT_LIST_HEAD(&card->ctl_files); | 237 | INIT_LIST_HEAD(&card->ctl_files); |
237 | spin_lock_init(&card->files_lock); | 238 | spin_lock_init(&card->files_lock); |
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index b684c6e4f301..dabe41975a9d 100644 --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c | |||
@@ -898,6 +898,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec, | |||
898 | if (!strcmp(codec->modelname, models->name)) { | 898 | if (!strcmp(codec->modelname, models->name)) { |
899 | codec->fixup_id = models->id; | 899 | codec->fixup_id = models->id; |
900 | codec->fixup_name = models->name; | 900 | codec->fixup_name = models->name; |
901 | codec->fixup_list = fixlist; | ||
901 | codec->fixup_forced = 1; | 902 | codec->fixup_forced = 1; |
902 | return; | 903 | return; |
903 | } | 904 | } |
diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c index 9d07e4edacdb..8b4940ba33d6 100644 --- a/sound/pci/hda/hda_i915.c +++ b/sound/pci/hda/hda_i915.c | |||
@@ -20,24 +20,71 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <sound/core.h> | 21 | #include <sound/core.h> |
22 | #include <drm/i915_powerwell.h> | 22 | #include <drm/i915_powerwell.h> |
23 | #include "hda_priv.h" | ||
23 | #include "hda_i915.h" | 24 | #include "hda_i915.h" |
24 | 25 | ||
25 | static void (*get_power)(void); | 26 | /* Intel HSW/BDW display HDA controller Extended Mode registers. |
26 | static void (*put_power)(void); | 27 | * EM4 (M value) and EM5 (N Value) are used to convert CDClk (Core Display |
28 | * Clock) to 24MHz BCLK: BCLK = CDCLK * M / N | ||
29 | * The values will be lost when the display power well is disabled. | ||
30 | */ | ||
31 | #define ICH6_REG_EM4 0x100c | ||
32 | #define ICH6_REG_EM5 0x1010 | ||
33 | |||
34 | static int (*get_power)(void); | ||
35 | static int (*put_power)(void); | ||
36 | static int (*get_cdclk)(void); | ||
27 | 37 | ||
28 | void hda_display_power(bool enable) | 38 | int hda_display_power(bool enable) |
29 | { | 39 | { |
30 | if (!get_power || !put_power) | 40 | if (!get_power || !put_power) |
31 | return; | 41 | return -ENODEV; |
32 | 42 | ||
33 | pr_debug("HDA display power %s \n", | 43 | pr_debug("HDA display power %s \n", |
34 | enable ? "Enable" : "Disable"); | 44 | enable ? "Enable" : "Disable"); |
35 | if (enable) | 45 | if (enable) |
36 | get_power(); | 46 | return get_power(); |
37 | else | 47 | else |
38 | put_power(); | 48 | return put_power(); |
49 | } | ||
50 | |||
51 | void haswell_set_bclk(struct azx *chip) | ||
52 | { | ||
53 | int cdclk_freq; | ||
54 | unsigned int bclk_m, bclk_n; | ||
55 | |||
56 | if (!get_cdclk) | ||
57 | return; | ||
58 | |||
59 | cdclk_freq = get_cdclk(); | ||
60 | switch (cdclk_freq) { | ||
61 | case 337500: | ||
62 | bclk_m = 16; | ||
63 | bclk_n = 225; | ||
64 | break; | ||
65 | |||
66 | case 450000: | ||
67 | default: /* default CDCLK 450MHz */ | ||
68 | bclk_m = 4; | ||
69 | bclk_n = 75; | ||
70 | break; | ||
71 | |||
72 | case 540000: | ||
73 | bclk_m = 4; | ||
74 | bclk_n = 90; | ||
75 | break; | ||
76 | |||
77 | case 675000: | ||
78 | bclk_m = 8; | ||
79 | bclk_n = 225; | ||
80 | break; | ||
81 | } | ||
82 | |||
83 | azx_writew(chip, EM4, bclk_m); | ||
84 | azx_writew(chip, EM5, bclk_n); | ||
39 | } | 85 | } |
40 | 86 | ||
87 | |||
41 | int hda_i915_init(void) | 88 | int hda_i915_init(void) |
42 | { | 89 | { |
43 | int err = 0; | 90 | int err = 0; |
@@ -55,6 +102,10 @@ int hda_i915_init(void) | |||
55 | return -ENODEV; | 102 | return -ENODEV; |
56 | } | 103 | } |
57 | 104 | ||
105 | get_cdclk = symbol_request(i915_get_cdclk_freq); | ||
106 | if (!get_cdclk) /* may have abnormal BCLK and audio playback rate */ | ||
107 | pr_warn("hda-i915: get_cdclk symbol get fail\n"); | ||
108 | |||
58 | pr_debug("HDA driver get symbol successfully from i915 module\n"); | 109 | pr_debug("HDA driver get symbol successfully from i915 module\n"); |
59 | 110 | ||
60 | return err; | 111 | return err; |
@@ -70,6 +121,10 @@ int hda_i915_exit(void) | |||
70 | symbol_put(i915_release_power_well); | 121 | symbol_put(i915_release_power_well); |
71 | put_power = NULL; | 122 | put_power = NULL; |
72 | } | 123 | } |
124 | if (get_cdclk) { | ||
125 | symbol_put(i915_get_cdclk_freq); | ||
126 | get_cdclk = NULL; | ||
127 | } | ||
73 | 128 | ||
74 | return 0; | 129 | return 0; |
75 | } | 130 | } |
diff --git a/sound/pci/hda/hda_i915.h b/sound/pci/hda/hda_i915.h index 5a63da2c53e5..e6072c627583 100644 --- a/sound/pci/hda/hda_i915.h +++ b/sound/pci/hda/hda_i915.h | |||
@@ -17,11 +17,13 @@ | |||
17 | #define __SOUND_HDA_I915_H | 17 | #define __SOUND_HDA_I915_H |
18 | 18 | ||
19 | #ifdef CONFIG_SND_HDA_I915 | 19 | #ifdef CONFIG_SND_HDA_I915 |
20 | void hda_display_power(bool enable); | 20 | int hda_display_power(bool enable); |
21 | void haswell_set_bclk(struct azx *chip); | ||
21 | int hda_i915_init(void); | 22 | int hda_i915_init(void); |
22 | int hda_i915_exit(void); | 23 | int hda_i915_exit(void); |
23 | #else | 24 | #else |
24 | static inline void hda_display_power(bool enable) {} | 25 | static inline int hda_display_power(bool enable) { return 0; } |
26 | static inline void haswell_set_bclk(struct azx *chip) { return; } | ||
25 | static inline int hda_i915_init(void) | 27 | static inline int hda_i915_init(void) |
26 | { | 28 | { |
27 | return -ENODEV; | 29 | return -ENODEV; |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index bb65a124e006..b6b4e71a0b0b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -62,9 +62,9 @@ | |||
62 | #include <linux/vga_switcheroo.h> | 62 | #include <linux/vga_switcheroo.h> |
63 | #include <linux/firmware.h> | 63 | #include <linux/firmware.h> |
64 | #include "hda_codec.h" | 64 | #include "hda_codec.h" |
65 | #include "hda_i915.h" | ||
66 | #include "hda_controller.h" | 65 | #include "hda_controller.h" |
67 | #include "hda_priv.h" | 66 | #include "hda_priv.h" |
67 | #include "hda_i915.h" | ||
68 | 68 | ||
69 | 69 | ||
70 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 70 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
@@ -288,6 +288,11 @@ static char *driver_short_names[] = { | |||
288 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", | 288 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", |
289 | }; | 289 | }; |
290 | 290 | ||
291 | struct hda_intel { | ||
292 | struct azx chip; | ||
293 | }; | ||
294 | |||
295 | |||
291 | #ifdef CONFIG_X86 | 296 | #ifdef CONFIG_X86 |
292 | static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) | 297 | static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) |
293 | { | 298 | { |
@@ -606,6 +611,7 @@ static int azx_suspend(struct device *dev) | |||
606 | free_irq(chip->irq, chip); | 611 | free_irq(chip->irq, chip); |
607 | chip->irq = -1; | 612 | chip->irq = -1; |
608 | } | 613 | } |
614 | |||
609 | if (chip->msi) | 615 | if (chip->msi) |
610 | pci_disable_msi(chip->pci); | 616 | pci_disable_msi(chip->pci); |
611 | pci_disable_device(pci); | 617 | pci_disable_device(pci); |
@@ -625,8 +631,10 @@ static int azx_resume(struct device *dev) | |||
625 | if (chip->disabled) | 631 | if (chip->disabled) |
626 | return 0; | 632 | return 0; |
627 | 633 | ||
628 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 634 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
629 | hda_display_power(true); | 635 | hda_display_power(true); |
636 | haswell_set_bclk(chip); | ||
637 | } | ||
630 | pci_set_power_state(pci, PCI_D0); | 638 | pci_set_power_state(pci, PCI_D0); |
631 | pci_restore_state(pci); | 639 | pci_restore_state(pci); |
632 | if (pci_enable_device(pci) < 0) { | 640 | if (pci_enable_device(pci) < 0) { |
@@ -672,6 +680,7 @@ static int azx_runtime_suspend(struct device *dev) | |||
672 | azx_clear_irq_pending(chip); | 680 | azx_clear_irq_pending(chip); |
673 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 681 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
674 | hda_display_power(false); | 682 | hda_display_power(false); |
683 | |||
675 | return 0; | 684 | return 0; |
676 | } | 685 | } |
677 | 686 | ||
@@ -689,8 +698,10 @@ static int azx_runtime_resume(struct device *dev) | |||
689 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) | 698 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) |
690 | return 0; | 699 | return 0; |
691 | 700 | ||
692 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 701 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
693 | hda_display_power(true); | 702 | hda_display_power(true); |
703 | haswell_set_bclk(chip); | ||
704 | } | ||
694 | 705 | ||
695 | /* Read STATESTS before controller reset */ | 706 | /* Read STATESTS before controller reset */ |
696 | status = azx_readw(chip, STATESTS); | 707 | status = azx_readw(chip, STATESTS); |
@@ -883,6 +894,8 @@ static int register_vga_switcheroo(struct azx *chip) | |||
883 | static int azx_free(struct azx *chip) | 894 | static int azx_free(struct azx *chip) |
884 | { | 895 | { |
885 | struct pci_dev *pci = chip->pci; | 896 | struct pci_dev *pci = chip->pci; |
897 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); | ||
898 | |||
886 | int i; | 899 | int i; |
887 | 900 | ||
888 | if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) | 901 | if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) |
@@ -930,7 +943,7 @@ static int azx_free(struct azx *chip) | |||
930 | hda_display_power(false); | 943 | hda_display_power(false); |
931 | hda_i915_exit(); | 944 | hda_i915_exit(); |
932 | } | 945 | } |
933 | kfree(chip); | 946 | kfree(hda); |
934 | 947 | ||
935 | return 0; | 948 | return 0; |
936 | } | 949 | } |
@@ -1174,6 +1187,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, | |||
1174 | static struct snd_device_ops ops = { | 1187 | static struct snd_device_ops ops = { |
1175 | .dev_free = azx_dev_free, | 1188 | .dev_free = azx_dev_free, |
1176 | }; | 1189 | }; |
1190 | struct hda_intel *hda; | ||
1177 | struct azx *chip; | 1191 | struct azx *chip; |
1178 | int err; | 1192 | int err; |
1179 | 1193 | ||
@@ -1183,13 +1197,14 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, | |||
1183 | if (err < 0) | 1197 | if (err < 0) |
1184 | return err; | 1198 | return err; |
1185 | 1199 | ||
1186 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1200 | hda = kzalloc(sizeof(*hda), GFP_KERNEL); |
1187 | if (!chip) { | 1201 | if (!hda) { |
1188 | dev_err(card->dev, "Cannot allocate chip\n"); | 1202 | dev_err(card->dev, "Cannot allocate hda\n"); |
1189 | pci_disable_device(pci); | 1203 | pci_disable_device(pci); |
1190 | return -ENOMEM; | 1204 | return -ENOMEM; |
1191 | } | 1205 | } |
1192 | 1206 | ||
1207 | chip = &hda->chip; | ||
1193 | spin_lock_init(&chip->reg_lock); | 1208 | spin_lock_init(&chip->reg_lock); |
1194 | mutex_init(&chip->open_mutex); | 1209 | mutex_init(&chip->open_mutex); |
1195 | chip->card = card; | 1210 | chip->card = card; |
@@ -1375,6 +1390,10 @@ static int azx_first_init(struct azx *chip) | |||
1375 | 1390 | ||
1376 | /* initialize chip */ | 1391 | /* initialize chip */ |
1377 | azx_init_pci(chip); | 1392 | azx_init_pci(chip); |
1393 | |||
1394 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | ||
1395 | haswell_set_bclk(chip); | ||
1396 | |||
1378 | azx_init_chip(chip, (probe_only[dev] & 2) == 0); | 1397 | azx_init_chip(chip, (probe_only[dev] & 2) == 0); |
1379 | 1398 | ||
1380 | /* codec detection */ | 1399 | /* codec detection */ |
@@ -1656,8 +1675,13 @@ static int azx_probe_continue(struct azx *chip) | |||
1656 | "Error request power-well from i915\n"); | 1675 | "Error request power-well from i915\n"); |
1657 | goto out_free; | 1676 | goto out_free; |
1658 | } | 1677 | } |
1678 | err = hda_display_power(true); | ||
1679 | if (err < 0) { | ||
1680 | dev_err(chip->card->dev, | ||
1681 | "Cannot turn on display power on i915\n"); | ||
1682 | goto out_free; | ||
1683 | } | ||
1659 | #endif | 1684 | #endif |
1660 | hda_display_power(true); | ||
1661 | } | 1685 | } |
1662 | 1686 | ||
1663 | err = azx_first_init(chip); | 1687 | err = azx_first_init(chip); |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index ebd1fa6f015c..4e2d4863daa1 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -417,6 +417,27 @@ struct snd_hda_pin_quirk { | |||
417 | int value; /* quirk value */ | 417 | int value; /* quirk value */ |
418 | }; | 418 | }; |
419 | 419 | ||
420 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
421 | |||
422 | #define SND_HDA_PIN_QUIRK(_codec, _subvendor, _name, _value, _pins...) \ | ||
423 | { .codec = _codec,\ | ||
424 | .subvendor = _subvendor,\ | ||
425 | .name = _name,\ | ||
426 | .value = _value,\ | ||
427 | .pins = (const struct hda_pintbl[]) { _pins } \ | ||
428 | } | ||
429 | #else | ||
430 | |||
431 | #define SND_HDA_PIN_QUIRK(_codec, _subvendor, _name, _value, _pins...) \ | ||
432 | { .codec = _codec,\ | ||
433 | .subvendor = _subvendor,\ | ||
434 | .value = _value,\ | ||
435 | .pins = (const struct hda_pintbl[]) { _pins } \ | ||
436 | } | ||
437 | |||
438 | #endif | ||
439 | |||
440 | |||
420 | /* fixup types */ | 441 | /* fixup types */ |
421 | enum { | 442 | enum { |
422 | HDA_FIXUP_INVALID, | 443 | HDA_FIXUP_INVALID, |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 3e4417b0ddbe..4fe876b65fda 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -2204,7 +2204,7 @@ static int generic_hdmi_resume(struct hda_codec *codec) | |||
2204 | struct hdmi_spec *spec = codec->spec; | 2204 | struct hdmi_spec *spec = codec->spec; |
2205 | int pin_idx; | 2205 | int pin_idx; |
2206 | 2206 | ||
2207 | generic_hdmi_init(codec); | 2207 | codec->patch_ops.init(codec); |
2208 | snd_hda_codec_resume_amp(codec); | 2208 | snd_hda_codec_resume_amp(codec); |
2209 | snd_hda_codec_resume_cache(codec); | 2209 | snd_hda_codec_resume_cache(codec); |
2210 | 2210 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index af76995fa966..b60824e90408 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4880,6 +4880,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4880 | SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), | 4880 | SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), |
4881 | SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK), | 4881 | SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK), |
4882 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), | 4882 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), |
4883 | SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), | ||
4883 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4884 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4884 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4885 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4885 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4886 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
@@ -4962,228 +4963,141 @@ static const struct hda_model_fixup alc269_fixup_models[] = { | |||
4962 | }; | 4963 | }; |
4963 | 4964 | ||
4964 | static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | 4965 | static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { |
4965 | { | 4966 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
4966 | .codec = 0x10ec0255, | 4967 | {0x12, 0x90a60140}, |
4967 | .subvendor = 0x1028, | 4968 | {0x14, 0x90170110}, |
4968 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 4969 | {0x17, 0x40000000}, |
4969 | .name = "Dell", | 4970 | {0x18, 0x411111f0}, |
4970 | #endif | 4971 | {0x19, 0x411111f0}, |
4971 | .pins = (const struct hda_pintbl[]) { | 4972 | {0x1a, 0x411111f0}, |
4972 | {0x12, 0x90a60140}, | 4973 | {0x1b, 0x411111f0}, |
4973 | {0x14, 0x90170110}, | 4974 | {0x1d, 0x40700001}, |
4974 | {0x17, 0x40000000}, | 4975 | {0x1e, 0x411111f0}, |
4975 | {0x18, 0x411111f0}, | 4976 | {0x21, 0x02211020}), |
4976 | {0x19, 0x411111f0}, | 4977 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
4977 | {0x1a, 0x411111f0}, | 4978 | {0x12, 0x90a60160}, |
4978 | {0x1b, 0x411111f0}, | 4979 | {0x14, 0x90170120}, |
4979 | {0x1d, 0x40700001}, | 4980 | {0x17, 0x40000000}, |
4980 | {0x1e, 0x411111f0}, | 4981 | {0x18, 0x411111f0}, |
4981 | {0x21, 0x02211020}, | 4982 | {0x19, 0x411111f0}, |
4982 | }, | 4983 | {0x1a, 0x411111f0}, |
4983 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 4984 | {0x1b, 0x411111f0}, |
4984 | }, | 4985 | {0x1d, 0x40700001}, |
4985 | { | 4986 | {0x1e, 0x411111f0}, |
4986 | .codec = 0x10ec0255, | 4987 | {0x21, 0x02211030}), |
4987 | .subvendor = 0x1028, | 4988 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
4988 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 4989 | {0x12, 0x90a60160}, |
4989 | .name = "Dell", | 4990 | {0x14, 0x90170120}, |
4990 | #endif | 4991 | {0x17, 0x90170140}, |
4991 | .pins = (const struct hda_pintbl[]) { | 4992 | {0x18, 0x40000000}, |
4992 | {0x12, 0x90a60160}, | 4993 | {0x19, 0x411111f0}, |
4993 | {0x14, 0x90170120}, | 4994 | {0x1a, 0x411111f0}, |
4994 | {0x17, 0x40000000}, | 4995 | {0x1b, 0x411111f0}, |
4995 | {0x18, 0x411111f0}, | 4996 | {0x1d, 0x41163b05}, |
4996 | {0x19, 0x411111f0}, | 4997 | {0x1e, 0x411111f0}, |
4997 | {0x1a, 0x411111f0}, | 4998 | {0x21, 0x0321102f}), |
4998 | {0x1b, 0x411111f0}, | 4999 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
4999 | {0x1d, 0x40700001}, | 5000 | {0x12, 0x90a60160}, |
5000 | {0x1e, 0x411111f0}, | 5001 | {0x14, 0x90170130}, |
5001 | {0x21, 0x02211030}, | 5002 | {0x17, 0x40000000}, |
5002 | }, | 5003 | {0x18, 0x411111f0}, |
5003 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5004 | {0x19, 0x411111f0}, |
5004 | }, | 5005 | {0x1a, 0x411111f0}, |
5005 | { | 5006 | {0x1b, 0x411111f0}, |
5006 | .codec = 0x10ec0255, | 5007 | {0x1d, 0x40700001}, |
5007 | .subvendor = 0x1028, | 5008 | {0x1e, 0x411111f0}, |
5008 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5009 | {0x21, 0x02211040}), |
5009 | .name = "Dell", | 5010 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
5010 | #endif | 5011 | {0x12, 0x90a60160}, |
5011 | .pins = (const struct hda_pintbl[]) { | 5012 | {0x14, 0x90170140}, |
5012 | {0x12, 0x90a60160}, | 5013 | {0x17, 0x40000000}, |
5013 | {0x14, 0x90170120}, | 5014 | {0x18, 0x411111f0}, |
5014 | {0x17, 0x90170140}, | 5015 | {0x19, 0x411111f0}, |
5015 | {0x18, 0x40000000}, | 5016 | {0x1a, 0x411111f0}, |
5016 | {0x19, 0x411111f0}, | 5017 | {0x1b, 0x411111f0}, |
5017 | {0x1a, 0x411111f0}, | 5018 | {0x1d, 0x40700001}, |
5018 | {0x1b, 0x411111f0}, | 5019 | {0x1e, 0x411111f0}, |
5019 | {0x1d, 0x41163b05}, | 5020 | {0x21, 0x02211050}), |
5020 | {0x1e, 0x411111f0}, | 5021 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
5021 | {0x21, 0x0321102f}, | 5022 | {0x12, 0x90a60170}, |
5022 | }, | 5023 | {0x14, 0x90170120}, |
5023 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5024 | {0x17, 0x40000000}, |
5024 | }, | 5025 | {0x18, 0x411111f0}, |
5025 | { | 5026 | {0x19, 0x411111f0}, |
5026 | .codec = 0x10ec0255, | 5027 | {0x1a, 0x411111f0}, |
5027 | .subvendor = 0x1028, | 5028 | {0x1b, 0x411111f0}, |
5028 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5029 | {0x1d, 0x40700001}, |
5029 | .name = "Dell", | 5030 | {0x1e, 0x411111f0}, |
5030 | #endif | 5031 | {0x21, 0x02211030}), |
5031 | .pins = (const struct hda_pintbl[]) { | 5032 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
5032 | {0x12, 0x90a60160}, | 5033 | {0x12, 0x90a60170}, |
5033 | {0x14, 0x90170130}, | 5034 | {0x14, 0x90170130}, |
5034 | {0x17, 0x40000000}, | 5035 | {0x17, 0x40000000}, |
5035 | {0x18, 0x411111f0}, | 5036 | {0x18, 0x411111f0}, |
5036 | {0x19, 0x411111f0}, | 5037 | {0x19, 0x411111f0}, |
5037 | {0x1a, 0x411111f0}, | 5038 | {0x1a, 0x411111f0}, |
5038 | {0x1b, 0x411111f0}, | 5039 | {0x1b, 0x411111f0}, |
5039 | {0x1d, 0x40700001}, | 5040 | {0x1d, 0x40700001}, |
5040 | {0x1e, 0x411111f0}, | 5041 | {0x1e, 0x411111f0}, |
5041 | {0x21, 0x02211040}, | 5042 | {0x21, 0x02211040}), |
5042 | }, | 5043 | SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
5043 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5044 | {0x12, 0x90a60130}, |
5044 | }, | 5045 | {0x14, 0x90170110}, |
5045 | { | 5046 | {0x17, 0x40020008}, |
5046 | .codec = 0x10ec0255, | 5047 | {0x18, 0x411111f0}, |
5047 | .subvendor = 0x1028, | 5048 | {0x19, 0x411111f0}, |
5048 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5049 | {0x1a, 0x411111f0}, |
5049 | .name = "Dell", | 5050 | {0x1b, 0x411111f0}, |
5050 | #endif | 5051 | {0x1d, 0x40e00001}, |
5051 | .pins = (const struct hda_pintbl[]) { | 5052 | {0x1e, 0x411111f0}, |
5052 | {0x12, 0x90a60160}, | 5053 | {0x21, 0x0321101f}), |
5053 | {0x14, 0x90170140}, | 5054 | SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
5054 | {0x17, 0x40000000}, | 5055 | {0x12, 0x90a60160}, |
5055 | {0x18, 0x411111f0}, | 5056 | {0x14, 0x90170120}, |
5056 | {0x19, 0x411111f0}, | 5057 | {0x17, 0x40000000}, |
5057 | {0x1a, 0x411111f0}, | 5058 | {0x18, 0x411111f0}, |
5058 | {0x1b, 0x411111f0}, | 5059 | {0x19, 0x411111f0}, |
5059 | {0x1d, 0x40700001}, | 5060 | {0x1a, 0x411111f0}, |
5060 | {0x1e, 0x411111f0}, | 5061 | {0x1b, 0x411111f0}, |
5061 | {0x21, 0x02211050}, | 5062 | {0x1d, 0x40700001}, |
5062 | }, | 5063 | {0x1e, 0x411111f0}, |
5063 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5064 | {0x21, 0x02211030}), |
5064 | }, | 5065 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, |
5065 | { | 5066 | {0x12, 0x90a60140}, |
5066 | .codec = 0x10ec0255, | 5067 | {0x13, 0x411111f0}, |
5067 | .subvendor = 0x1028, | 5068 | {0x14, 0x90170110}, |
5068 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5069 | {0x15, 0x0221401f}, |
5069 | .name = "Dell", | 5070 | {0x16, 0x411111f0}, |
5070 | #endif | 5071 | {0x18, 0x411111f0}, |
5071 | .pins = (const struct hda_pintbl[]) { | 5072 | {0x19, 0x411111f0}, |
5072 | {0x12, 0x90a60170}, | 5073 | {0x1a, 0x411111f0}, |
5073 | {0x14, 0x90170120}, | 5074 | {0x1b, 0x411111f0}, |
5074 | {0x17, 0x40000000}, | 5075 | {0x1d, 0x40700001}, |
5075 | {0x18, 0x411111f0}, | 5076 | {0x1e, 0x411111f0}), |
5076 | {0x19, 0x411111f0}, | 5077 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
5077 | {0x1a, 0x411111f0}, | 5078 | {0x12, 0x40000000}, |
5078 | {0x1b, 0x411111f0}, | 5079 | {0x13, 0x90a60140}, |
5079 | {0x1d, 0x40700001}, | 5080 | {0x14, 0x90170110}, |
5080 | {0x1e, 0x411111f0}, | 5081 | {0x15, 0x0221401f}, |
5081 | {0x21, 0x02211030}, | 5082 | {0x16, 0x21014020}, |
5082 | }, | 5083 | {0x18, 0x411111f0}, |
5083 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5084 | {0x19, 0x21a19030}, |
5084 | }, | 5085 | {0x1a, 0x411111f0}, |
5085 | { | 5086 | {0x1b, 0x411111f0}, |
5086 | .codec = 0x10ec0255, | 5087 | {0x1d, 0x40700001}, |
5087 | .subvendor = 0x1028, | 5088 | {0x1e, 0x411111f0}), |
5088 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5089 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
5089 | .name = "Dell", | 5090 | {0x12, 0x40000000}, |
5090 | #endif | 5091 | {0x13, 0x90a60140}, |
5091 | .pins = (const struct hda_pintbl[]) { | 5092 | {0x14, 0x90170110}, |
5092 | {0x12, 0x90a60170}, | 5093 | {0x15, 0x0221401f}, |
5093 | {0x14, 0x90170130}, | 5094 | {0x16, 0x411111f0}, |
5094 | {0x17, 0x40000000}, | 5095 | {0x18, 0x411111f0}, |
5095 | {0x18, 0x411111f0}, | 5096 | {0x19, 0x411111f0}, |
5096 | {0x19, 0x411111f0}, | 5097 | {0x1a, 0x411111f0}, |
5097 | {0x1a, 0x411111f0}, | 5098 | {0x1b, 0x411111f0}, |
5098 | {0x1b, 0x411111f0}, | 5099 | {0x1d, 0x40700001}, |
5099 | {0x1d, 0x40700001}, | 5100 | {0x1e, 0x411111f0}), |
5100 | {0x1e, 0x411111f0}, | ||
5101 | {0x21, 0x02211040}, | ||
5102 | }, | ||
5103 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
5104 | }, | ||
5105 | { | ||
5106 | .codec = 0x10ec0283, | ||
5107 | .subvendor = 0x1028, | ||
5108 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
5109 | .name = "Dell", | ||
5110 | #endif | ||
5111 | .pins = (const struct hda_pintbl[]) { | ||
5112 | {0x12, 0x90a60130}, | ||
5113 | {0x14, 0x90170110}, | ||
5114 | {0x17, 0x40020008}, | ||
5115 | {0x18, 0x411111f0}, | ||
5116 | {0x19, 0x411111f0}, | ||
5117 | {0x1a, 0x411111f0}, | ||
5118 | {0x1b, 0x411111f0}, | ||
5119 | {0x1d, 0x40e00001}, | ||
5120 | {0x1e, 0x411111f0}, | ||
5121 | {0x21, 0x0321101f}, | ||
5122 | }, | ||
5123 | .value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
5124 | }, | ||
5125 | { | ||
5126 | .codec = 0x10ec0283, | ||
5127 | .subvendor = 0x1028, | ||
5128 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
5129 | .name = "Dell", | ||
5130 | #endif | ||
5131 | .pins = (const struct hda_pintbl[]) { | ||
5132 | {0x12, 0x90a60160}, | ||
5133 | {0x14, 0x90170120}, | ||
5134 | {0x17, 0x40000000}, | ||
5135 | {0x18, 0x411111f0}, | ||
5136 | {0x19, 0x411111f0}, | ||
5137 | {0x1a, 0x411111f0}, | ||
5138 | {0x1b, 0x411111f0}, | ||
5139 | {0x1d, 0x40700001}, | ||
5140 | {0x1e, 0x411111f0}, | ||
5141 | {0x21, 0x02211030}, | ||
5142 | }, | ||
5143 | .value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
5144 | }, | ||
5145 | { | ||
5146 | .codec = 0x10ec0292, | ||
5147 | .subvendor = 0x1028, | ||
5148 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
5149 | .name = "Dell", | ||
5150 | #endif | ||
5151 | .pins = (const struct hda_pintbl[]) { | ||
5152 | {0x12, 0x90a60140}, | ||
5153 | {0x13, 0x411111f0}, | ||
5154 | {0x14, 0x90170110}, | ||
5155 | {0x15, 0x0221401f}, | ||
5156 | {0x16, 0x411111f0}, | ||
5157 | {0x18, 0x411111f0}, | ||
5158 | {0x19, 0x411111f0}, | ||
5159 | {0x1a, 0x411111f0}, | ||
5160 | {0x1b, 0x411111f0}, | ||
5161 | {0x1d, 0x40700001}, | ||
5162 | {0x1e, 0x411111f0}, | ||
5163 | }, | ||
5164 | .value = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, | ||
5165 | }, | ||
5166 | { | ||
5167 | .codec = 0x10ec0293, | ||
5168 | .subvendor = 0x1028, | ||
5169 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
5170 | .name = "Dell", | ||
5171 | #endif | ||
5172 | .pins = (const struct hda_pintbl[]) { | ||
5173 | {0x12, 0x40000000}, | ||
5174 | {0x13, 0x90a60140}, | ||
5175 | {0x14, 0x90170110}, | ||
5176 | {0x15, 0x0221401f}, | ||
5177 | {0x16, 0x21014020}, | ||
5178 | {0x18, 0x411111f0}, | ||
5179 | {0x19, 0x21a19030}, | ||
5180 | {0x1a, 0x411111f0}, | ||
5181 | {0x1b, 0x411111f0}, | ||
5182 | {0x1d, 0x40700001}, | ||
5183 | {0x1e, 0x411111f0}, | ||
5184 | }, | ||
5185 | .value = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
5186 | }, | ||
5187 | {} | 5101 | {} |
5188 | }; | 5102 | }; |
5189 | 5103 | ||
@@ -6039,90 +5953,66 @@ static const struct hda_model_fixup alc662_fixup_models[] = { | |||
6039 | }; | 5953 | }; |
6040 | 5954 | ||
6041 | static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { | 5955 | static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { |
6042 | { | 5956 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
6043 | .codec = 0x10ec0668, | 5957 | {0x12, 0x99a30130}, |
6044 | .subvendor = 0x1028, | 5958 | {0x14, 0x90170110}, |
6045 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5959 | {0x15, 0x0321101f}, |
6046 | .name = "Dell", | 5960 | {0x16, 0x03011020}, |
6047 | #endif | 5961 | {0x18, 0x40000008}, |
6048 | .pins = (const struct hda_pintbl[]) { | 5962 | {0x19, 0x411111f0}, |
6049 | {0x12, 0x99a30130}, | 5963 | {0x1a, 0x411111f0}, |
6050 | {0x14, 0x90170110}, | 5964 | {0x1b, 0x411111f0}, |
6051 | {0x15, 0x0321101f}, | 5965 | {0x1d, 0x41000001}, |
6052 | {0x16, 0x03011020}, | 5966 | {0x1e, 0x411111f0}, |
6053 | {0x18, 0x40000008}, | 5967 | {0x1f, 0x411111f0}), |
6054 | {0x19, 0x411111f0}, | 5968 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
6055 | {0x1a, 0x411111f0}, | 5969 | {0x12, 0x99a30140}, |
6056 | {0x1b, 0x411111f0}, | 5970 | {0x14, 0x90170110}, |
6057 | {0x1d, 0x41000001}, | 5971 | {0x15, 0x0321101f}, |
6058 | {0x1e, 0x411111f0}, | 5972 | {0x16, 0x03011020}, |
6059 | {0x1f, 0x411111f0}, | 5973 | {0x18, 0x40000008}, |
6060 | }, | 5974 | {0x19, 0x411111f0}, |
6061 | .value = ALC668_FIXUP_AUTO_MUTE, | 5975 | {0x1a, 0x411111f0}, |
6062 | }, | 5976 | {0x1b, 0x411111f0}, |
6063 | { | 5977 | {0x1d, 0x41000001}, |
6064 | .codec = 0x10ec0668, | 5978 | {0x1e, 0x411111f0}, |
6065 | .subvendor = 0x1028, | 5979 | {0x1f, 0x411111f0}), |
6066 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5980 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
6067 | .name = "Dell", | 5981 | {0x12, 0x99a30150}, |
6068 | #endif | 5982 | {0x14, 0x90170110}, |
6069 | .pins = (const struct hda_pintbl[]) { | 5983 | {0x15, 0x0321101f}, |
6070 | {0x12, 0x99a30140}, | 5984 | {0x16, 0x03011020}, |
6071 | {0x14, 0x90170110}, | 5985 | {0x18, 0x40000008}, |
6072 | {0x15, 0x0321101f}, | 5986 | {0x19, 0x411111f0}, |
6073 | {0x16, 0x03011020}, | 5987 | {0x1a, 0x411111f0}, |
6074 | {0x18, 0x40000008}, | 5988 | {0x1b, 0x411111f0}, |
6075 | {0x19, 0x411111f0}, | 5989 | {0x1d, 0x41000001}, |
6076 | {0x1a, 0x411111f0}, | 5990 | {0x1e, 0x411111f0}, |
6077 | {0x1b, 0x411111f0}, | 5991 | {0x1f, 0x411111f0}), |
6078 | {0x1d, 0x41000001}, | 5992 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
6079 | {0x1e, 0x411111f0}, | 5993 | {0x12, 0x411111f0}, |
6080 | {0x1f, 0x411111f0}, | 5994 | {0x14, 0x90170110}, |
6081 | }, | 5995 | {0x15, 0x0321101f}, |
6082 | .value = ALC668_FIXUP_AUTO_MUTE, | 5996 | {0x16, 0x03011020}, |
6083 | }, | 5997 | {0x18, 0x40000008}, |
6084 | { | 5998 | {0x19, 0x411111f0}, |
6085 | .codec = 0x10ec0668, | 5999 | {0x1a, 0x411111f0}, |
6086 | .subvendor = 0x1028, | 6000 | {0x1b, 0x411111f0}, |
6087 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 6001 | {0x1d, 0x41000001}, |
6088 | .name = "Dell", | 6002 | {0x1e, 0x411111f0}, |
6089 | #endif | 6003 | {0x1f, 0x411111f0}), |
6090 | .pins = (const struct hda_pintbl[]) { | 6004 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE, |
6091 | {0x12, 0x99a30150}, | 6005 | {0x12, 0x90a60130}, |
6092 | {0x14, 0x90170110}, | 6006 | {0x14, 0x90170110}, |
6093 | {0x15, 0x0321101f}, | 6007 | {0x15, 0x0321101f}, |
6094 | {0x16, 0x03011020}, | 6008 | {0x16, 0x40000000}, |
6095 | {0x18, 0x40000008}, | 6009 | {0x18, 0x411111f0}, |
6096 | {0x19, 0x411111f0}, | 6010 | {0x19, 0x411111f0}, |
6097 | {0x1a, 0x411111f0}, | 6011 | {0x1a, 0x411111f0}, |
6098 | {0x1b, 0x411111f0}, | 6012 | {0x1b, 0x411111f0}, |
6099 | {0x1d, 0x41000001}, | 6013 | {0x1d, 0x40d6832d}, |
6100 | {0x1e, 0x411111f0}, | 6014 | {0x1e, 0x411111f0}, |
6101 | {0x1f, 0x411111f0}, | 6015 | {0x1f, 0x411111f0}), |
6102 | }, | ||
6103 | .value = ALC668_FIXUP_AUTO_MUTE, | ||
6104 | }, | ||
6105 | { | ||
6106 | .codec = 0x10ec0668, | ||
6107 | .subvendor = 0x1028, | ||
6108 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
6109 | .name = "Dell", | ||
6110 | #endif | ||
6111 | .pins = (const struct hda_pintbl[]) { | ||
6112 | {0x12, 0x411111f0}, | ||
6113 | {0x14, 0x90170110}, | ||
6114 | {0x15, 0x0321101f}, | ||
6115 | {0x16, 0x03011020}, | ||
6116 | {0x18, 0x40000008}, | ||
6117 | {0x19, 0x411111f0}, | ||
6118 | {0x1a, 0x411111f0}, | ||
6119 | {0x1b, 0x411111f0}, | ||
6120 | {0x1d, 0x41000001}, | ||
6121 | {0x1e, 0x411111f0}, | ||
6122 | {0x1f, 0x411111f0}, | ||
6123 | }, | ||
6124 | .value = ALC668_FIXUP_AUTO_MUTE, | ||
6125 | }, | ||
6126 | {} | 6016 | {} |
6127 | }; | 6017 | }; |
6128 | 6018 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 7f40a150899c..3744ea4e843d 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -122,6 +122,12 @@ enum { | |||
122 | }; | 122 | }; |
123 | 123 | ||
124 | enum { | 124 | enum { |
125 | STAC_92HD95_HP_LED, | ||
126 | STAC_92HD95_HP_BASS, | ||
127 | STAC_92HD95_MODELS | ||
128 | }; | ||
129 | |||
130 | enum { | ||
125 | STAC_925x_REF, | 131 | STAC_925x_REF, |
126 | STAC_M1, | 132 | STAC_M1, |
127 | STAC_M1_2, | 133 | STAC_M1_2, |
@@ -4128,6 +4134,48 @@ static const struct snd_pci_quirk stac9205_fixup_tbl[] = { | |||
4128 | {} /* terminator */ | 4134 | {} /* terminator */ |
4129 | }; | 4135 | }; |
4130 | 4136 | ||
4137 | static void stac92hd95_fixup_hp_led(struct hda_codec *codec, | ||
4138 | const struct hda_fixup *fix, int action) | ||
4139 | { | ||
4140 | struct sigmatel_spec *spec = codec->spec; | ||
4141 | |||
4142 | if (action != HDA_FIXUP_ACT_PRE_PROBE) | ||
4143 | return; | ||
4144 | |||
4145 | if (find_mute_led_cfg(codec, spec->default_polarity)) | ||
4146 | codec_dbg(codec, "mute LED gpio %d polarity %d\n", | ||
4147 | spec->gpio_led, | ||
4148 | spec->gpio_led_polarity); | ||
4149 | } | ||
4150 | |||
4151 | static const struct hda_fixup stac92hd95_fixups[] = { | ||
4152 | [STAC_92HD95_HP_LED] = { | ||
4153 | .type = HDA_FIXUP_FUNC, | ||
4154 | .v.func = stac92hd95_fixup_hp_led, | ||
4155 | }, | ||
4156 | [STAC_92HD95_HP_BASS] = { | ||
4157 | .type = HDA_FIXUP_VERBS, | ||
4158 | .v.verbs = (const struct hda_verb[]) { | ||
4159 | {0x1a, 0x795, 0x00}, /* HPF to 100Hz */ | ||
4160 | {} | ||
4161 | }, | ||
4162 | .chained = true, | ||
4163 | .chain_id = STAC_92HD95_HP_LED, | ||
4164 | }, | ||
4165 | }; | ||
4166 | |||
4167 | static const struct snd_pci_quirk stac92hd95_fixup_tbl[] = { | ||
4168 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1911, "HP Spectre 13", STAC_92HD95_HP_BASS), | ||
4169 | {} /* terminator */ | ||
4170 | }; | ||
4171 | |||
4172 | static const struct hda_model_fixup stac92hd95_models[] = { | ||
4173 | { .id = STAC_92HD95_HP_LED, .name = "hp-led" }, | ||
4174 | { .id = STAC_92HD95_HP_BASS, .name = "hp-bass" }, | ||
4175 | {} | ||
4176 | }; | ||
4177 | |||
4178 | |||
4131 | static int stac_parse_auto_config(struct hda_codec *codec) | 4179 | static int stac_parse_auto_config(struct hda_codec *codec) |
4132 | { | 4180 | { |
4133 | struct sigmatel_spec *spec = codec->spec; | 4181 | struct sigmatel_spec *spec = codec->spec; |
@@ -4580,10 +4628,16 @@ static int patch_stac92hd95(struct hda_codec *codec) | |||
4580 | spec->gen.beep_nid = 0x19; /* digital beep */ | 4628 | spec->gen.beep_nid = 0x19; /* digital beep */ |
4581 | spec->pwr_nids = stac92hd95_pwr_nids; | 4629 | spec->pwr_nids = stac92hd95_pwr_nids; |
4582 | spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids); | 4630 | spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids); |
4583 | spec->default_polarity = -1; /* no default cfg */ | 4631 | spec->default_polarity = 0; |
4584 | 4632 | ||
4585 | codec->patch_ops = stac_patch_ops; | 4633 | codec->patch_ops = stac_patch_ops; |
4586 | 4634 | ||
4635 | snd_hda_pick_fixup(codec, stac92hd95_models, stac92hd95_fixup_tbl, | ||
4636 | stac92hd95_fixups); | ||
4637 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | ||
4638 | |||
4639 | stac_setup_gpio(codec); | ||
4640 | |||
4587 | err = stac_parse_auto_config(codec); | 4641 | err = stac_parse_auto_config(codec); |
4588 | if (err < 0) { | 4642 | if (err < 0) { |
4589 | stac_free(codec); | 4643 | stac_free(codec); |
@@ -4592,6 +4646,8 @@ static int patch_stac92hd95(struct hda_codec *codec) | |||
4592 | 4646 | ||
4593 | codec->proc_widget_hook = stac92hd_proc_hook; | 4647 | codec->proc_widget_hook = stac92hd_proc_hook; |
4594 | 4648 | ||
4649 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); | ||
4650 | |||
4595 | return 0; | 4651 | return 0; |
4596 | } | 4652 | } |
4597 | 4653 | ||
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index cbfa1e18f651..0b9571c858f8 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -225,11 +225,11 @@ config SND_SOC_ADAU1373 | |||
225 | config SND_SOC_ADAU1701 | 225 | config SND_SOC_ADAU1701 |
226 | tristate "Analog Devices ADAU1701 CODEC" | 226 | tristate "Analog Devices ADAU1701 CODEC" |
227 | depends on I2C | 227 | depends on I2C |
228 | select SND_SOC_SIGMADSP | 228 | select SND_SOC_SIGMADSP_I2C |
229 | 229 | ||
230 | config SND_SOC_ADAU17X1 | 230 | config SND_SOC_ADAU17X1 |
231 | tristate | 231 | tristate |
232 | select SND_SOC_SIGMADSP | 232 | select SND_SOC_SIGMADSP_REGMAP |
233 | 233 | ||
234 | config SND_SOC_ADAU1761 | 234 | config SND_SOC_ADAU1761 |
235 | tristate | 235 | tristate |
@@ -476,6 +476,14 @@ config SND_SOC_SIGMADSP | |||
476 | tristate | 476 | tristate |
477 | select CRC32 | 477 | select CRC32 |
478 | 478 | ||
479 | config SND_SOC_SIGMADSP_I2C | ||
480 | tristate | ||
481 | select SND_SOC_SIGMADSP | ||
482 | |||
483 | config SND_SOC_SIGMADSP_REGMAP | ||
484 | tristate | ||
485 | select SND_SOC_SIGMADSP | ||
486 | |||
479 | config SND_SOC_SIRF_AUDIO_CODEC | 487 | config SND_SOC_SIRF_AUDIO_CODEC |
480 | tristate "SiRF SoC internal audio codec" | 488 | tristate "SiRF SoC internal audio codec" |
481 | select REGMAP_MMIO | 489 | select REGMAP_MMIO |
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index be3377b8d73f..1bd6e1cf6f82 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile | |||
@@ -77,6 +77,8 @@ snd-soc-sgtl5000-objs := sgtl5000.o | |||
77 | snd-soc-alc5623-objs := alc5623.o | 77 | snd-soc-alc5623-objs := alc5623.o |
78 | snd-soc-alc5632-objs := alc5632.o | 78 | snd-soc-alc5632-objs := alc5632.o |
79 | snd-soc-sigmadsp-objs := sigmadsp.o | 79 | snd-soc-sigmadsp-objs := sigmadsp.o |
80 | snd-soc-sigmadsp-i2c-objs := sigmadsp-i2c.o | ||
81 | snd-soc-sigmadsp-regmap-objs := sigmadsp-regmap.o | ||
80 | snd-soc-si476x-objs := si476x.o | 82 | snd-soc-si476x-objs := si476x.o |
81 | snd-soc-sirf-audio-codec-objs := sirf-audio-codec.o | 83 | snd-soc-sirf-audio-codec-objs := sirf-audio-codec.o |
82 | snd-soc-sn95031-objs := sn95031.o | 84 | snd-soc-sn95031-objs := sn95031.o |
@@ -240,6 +242,8 @@ obj-$(CONFIG_SND_SOC_RT5651) += snd-soc-rt5651.o | |||
240 | obj-$(CONFIG_SND_SOC_RT5677) += snd-soc-rt5677.o | 242 | obj-$(CONFIG_SND_SOC_RT5677) += snd-soc-rt5677.o |
241 | obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o | 243 | obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o |
242 | obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o | 244 | obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o |
245 | obj-$(CONFIG_SND_SOC_SIGMADSP_I2C) += snd-soc-sigmadsp-i2c.o | ||
246 | obj-$(CONFIG_SND_SOC_SIGMADSP_REGMAP) += snd-soc-sigmadsp-regmap.o | ||
243 | obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o | 247 | obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o |
244 | obj-$(CONFIG_SND_SOC_SN95031) +=snd-soc-sn95031.o | 248 | obj-$(CONFIG_SND_SOC_SN95031) +=snd-soc-sn95031.o |
245 | obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif-rx.o snd-soc-spdif-tx.o | 249 | obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif-rx.o snd-soc-spdif-tx.o |
diff --git a/sound/soc/codecs/sigmadsp-i2c.c b/sound/soc/codecs/sigmadsp-i2c.c new file mode 100644 index 000000000000..246081aae8ca --- /dev/null +++ b/sound/soc/codecs/sigmadsp-i2c.c | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Load Analog Devices SigmaStudio firmware files | ||
3 | * | ||
4 | * Copyright 2009-2011 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | |||
9 | #include <linux/i2c.h> | ||
10 | #include <linux/export.h> | ||
11 | #include <linux/module.h> | ||
12 | |||
13 | #include "sigmadsp.h" | ||
14 | |||
15 | static int sigma_action_write_i2c(void *control_data, | ||
16 | const struct sigma_action *sa, size_t len) | ||
17 | { | ||
18 | return i2c_master_send(control_data, (const unsigned char *)&sa->addr, | ||
19 | len); | ||
20 | } | ||
21 | |||
22 | int process_sigma_firmware(struct i2c_client *client, const char *name) | ||
23 | { | ||
24 | struct sigma_firmware ssfw; | ||
25 | |||
26 | ssfw.control_data = client; | ||
27 | ssfw.write = sigma_action_write_i2c; | ||
28 | |||
29 | return _process_sigma_firmware(&client->dev, &ssfw, name); | ||
30 | } | ||
31 | EXPORT_SYMBOL(process_sigma_firmware); | ||
32 | |||
33 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | ||
34 | MODULE_DESCRIPTION("SigmaDSP I2C firmware loader"); | ||
35 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/codecs/sigmadsp-regmap.c b/sound/soc/codecs/sigmadsp-regmap.c new file mode 100644 index 000000000000..f78ed8d2cfb2 --- /dev/null +++ b/sound/soc/codecs/sigmadsp-regmap.c | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * Load Analog Devices SigmaStudio firmware files | ||
3 | * | ||
4 | * Copyright 2009-2011 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | |||
9 | #include <linux/regmap.h> | ||
10 | #include <linux/export.h> | ||
11 | #include <linux/module.h> | ||
12 | |||
13 | #include "sigmadsp.h" | ||
14 | |||
15 | static int sigma_action_write_regmap(void *control_data, | ||
16 | const struct sigma_action *sa, size_t len) | ||
17 | { | ||
18 | return regmap_raw_write(control_data, be16_to_cpu(sa->addr), | ||
19 | sa->payload, len - 2); | ||
20 | } | ||
21 | |||
22 | int process_sigma_firmware_regmap(struct device *dev, struct regmap *regmap, | ||
23 | const char *name) | ||
24 | { | ||
25 | struct sigma_firmware ssfw; | ||
26 | |||
27 | ssfw.control_data = regmap; | ||
28 | ssfw.write = sigma_action_write_regmap; | ||
29 | |||
30 | return _process_sigma_firmware(dev, &ssfw, name); | ||
31 | } | ||
32 | EXPORT_SYMBOL(process_sigma_firmware_regmap); | ||
33 | |||
34 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | ||
35 | MODULE_DESCRIPTION("SigmaDSP regmap firmware loader"); | ||
36 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c index 4068f2491232..f2de7e049bc6 100644 --- a/sound/soc/codecs/sigmadsp.c +++ b/sound/soc/codecs/sigmadsp.c | |||
@@ -34,23 +34,6 @@ enum { | |||
34 | SIGMA_ACTION_END, | 34 | SIGMA_ACTION_END, |
35 | }; | 35 | }; |
36 | 36 | ||
37 | struct sigma_action { | ||
38 | u8 instr; | ||
39 | u8 len_hi; | ||
40 | __le16 len; | ||
41 | __be16 addr; | ||
42 | unsigned char payload[]; | ||
43 | } __packed; | ||
44 | |||
45 | struct sigma_firmware { | ||
46 | const struct firmware *fw; | ||
47 | size_t pos; | ||
48 | |||
49 | void *control_data; | ||
50 | int (*write)(void *control_data, const struct sigma_action *sa, | ||
51 | size_t len); | ||
52 | }; | ||
53 | |||
54 | static inline u32 sigma_action_len(struct sigma_action *sa) | 37 | static inline u32 sigma_action_len(struct sigma_action *sa) |
55 | { | 38 | { |
56 | return (sa->len_hi << 16) | le16_to_cpu(sa->len); | 39 | return (sa->len_hi << 16) | le16_to_cpu(sa->len); |
@@ -138,7 +121,7 @@ process_sigma_actions(struct sigma_firmware *ssfw) | |||
138 | return 0; | 121 | return 0; |
139 | } | 122 | } |
140 | 123 | ||
141 | static int _process_sigma_firmware(struct device *dev, | 124 | int _process_sigma_firmware(struct device *dev, |
142 | struct sigma_firmware *ssfw, const char *name) | 125 | struct sigma_firmware *ssfw, const char *name) |
143 | { | 126 | { |
144 | int ret; | 127 | int ret; |
@@ -197,50 +180,6 @@ static int _process_sigma_firmware(struct device *dev, | |||
197 | 180 | ||
198 | return ret; | 181 | return ret; |
199 | } | 182 | } |
200 | 183 | EXPORT_SYMBOL_GPL(_process_sigma_firmware); | |
201 | #if IS_ENABLED(CONFIG_I2C) | ||
202 | |||
203 | static int sigma_action_write_i2c(void *control_data, | ||
204 | const struct sigma_action *sa, size_t len) | ||
205 | { | ||
206 | return i2c_master_send(control_data, (const unsigned char *)&sa->addr, | ||
207 | len); | ||
208 | } | ||
209 | |||
210 | int process_sigma_firmware(struct i2c_client *client, const char *name) | ||
211 | { | ||
212 | struct sigma_firmware ssfw; | ||
213 | |||
214 | ssfw.control_data = client; | ||
215 | ssfw.write = sigma_action_write_i2c; | ||
216 | |||
217 | return _process_sigma_firmware(&client->dev, &ssfw, name); | ||
218 | } | ||
219 | EXPORT_SYMBOL(process_sigma_firmware); | ||
220 | |||
221 | #endif | ||
222 | |||
223 | #if IS_ENABLED(CONFIG_REGMAP) | ||
224 | |||
225 | static int sigma_action_write_regmap(void *control_data, | ||
226 | const struct sigma_action *sa, size_t len) | ||
227 | { | ||
228 | return regmap_raw_write(control_data, be16_to_cpu(sa->addr), | ||
229 | sa->payload, len - 2); | ||
230 | } | ||
231 | |||
232 | int process_sigma_firmware_regmap(struct device *dev, struct regmap *regmap, | ||
233 | const char *name) | ||
234 | { | ||
235 | struct sigma_firmware ssfw; | ||
236 | |||
237 | ssfw.control_data = regmap; | ||
238 | ssfw.write = sigma_action_write_regmap; | ||
239 | |||
240 | return _process_sigma_firmware(dev, &ssfw, name); | ||
241 | } | ||
242 | EXPORT_SYMBOL(process_sigma_firmware_regmap); | ||
243 | |||
244 | #endif | ||
245 | 184 | ||
246 | MODULE_LICENSE("GPL"); | 185 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/codecs/sigmadsp.h b/sound/soc/codecs/sigmadsp.h index e439cbd7af7d..c47cd23e9827 100644 --- a/sound/soc/codecs/sigmadsp.h +++ b/sound/soc/codecs/sigmadsp.h | |||
@@ -12,6 +12,26 @@ | |||
12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
13 | #include <linux/regmap.h> | 13 | #include <linux/regmap.h> |
14 | 14 | ||
15 | struct sigma_action { | ||
16 | u8 instr; | ||
17 | u8 len_hi; | ||
18 | __le16 len; | ||
19 | __be16 addr; | ||
20 | unsigned char payload[]; | ||
21 | } __packed; | ||
22 | |||
23 | struct sigma_firmware { | ||
24 | const struct firmware *fw; | ||
25 | size_t pos; | ||
26 | |||
27 | void *control_data; | ||
28 | int (*write)(void *control_data, const struct sigma_action *sa, | ||
29 | size_t len); | ||
30 | }; | ||
31 | |||
32 | int _process_sigma_firmware(struct device *dev, | ||
33 | struct sigma_firmware *ssfw, const char *name); | ||
34 | |||
15 | struct i2c_client; | 35 | struct i2c_client; |
16 | 36 | ||
17 | extern int process_sigma_firmware(struct i2c_client *client, const char *name); | 37 | extern int process_sigma_firmware(struct i2c_client *client, const char *name); |
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c index 6bb0ea59284f..a609aafc994d 100644 --- a/sound/soc/fsl/fsl_dma.c +++ b/sound/soc/fsl/fsl_dma.c | |||
@@ -923,8 +923,8 @@ static int fsl_soc_dma_probe(struct platform_device *pdev) | |||
923 | dma->dai.pcm_free = fsl_dma_free_dma_buffers; | 923 | dma->dai.pcm_free = fsl_dma_free_dma_buffers; |
924 | 924 | ||
925 | /* Store the SSI-specific information that we need */ | 925 | /* Store the SSI-specific information that we need */ |
926 | dma->ssi_stx_phys = res.start + offsetof(struct ccsr_ssi, stx0); | 926 | dma->ssi_stx_phys = res.start + CCSR_SSI_STX0; |
927 | dma->ssi_srx_phys = res.start + offsetof(struct ccsr_ssi, srx0); | 927 | dma->ssi_srx_phys = res.start + CCSR_SSI_SRX0; |
928 | 928 | ||
929 | iprop = of_get_property(ssi_np, "fsl,fifo-depth", NULL); | 929 | iprop = of_get_property(ssi_np, "fsl,fifo-depth", NULL); |
930 | if (iprop) | 930 | if (iprop) |
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index b912d45a2a4c..d7a60614dd21 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c | |||
@@ -762,7 +762,7 @@ static int fsl_spdif_vbit_get(struct snd_kcontrol *kcontrol, | |||
762 | struct regmap *regmap = spdif_priv->regmap; | 762 | struct regmap *regmap = spdif_priv->regmap; |
763 | u32 val; | 763 | u32 val; |
764 | 764 | ||
765 | val = regmap_read(regmap, REG_SPDIF_SIS, &val); | 765 | regmap_read(regmap, REG_SPDIF_SIS, &val); |
766 | ucontrol->value.integer.value[0] = (val & INT_VAL_NOGOOD) != 0; | 766 | ucontrol->value.integer.value[0] = (val & INT_VAL_NOGOOD) != 0; |
767 | regmap_write(regmap, REG_SPDIF_SIC, INT_VAL_NOGOOD); | 767 | regmap_write(regmap, REG_SPDIF_SIC, INT_VAL_NOGOOD); |
768 | 768 | ||
@@ -1076,7 +1076,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv, | |||
1076 | goto out; | 1076 | goto out; |
1077 | } else if (arate / rate[index] == 1) { | 1077 | } else if (arate / rate[index] == 1) { |
1078 | /* A little bigger than expect */ | 1078 | /* A little bigger than expect */ |
1079 | sub = (arate - rate[index]) * 100000; | 1079 | sub = (u64)(arate - rate[index]) * 100000; |
1080 | do_div(sub, rate[index]); | 1080 | do_div(sub, rate[index]); |
1081 | if (sub >= savesub) | 1081 | if (sub >= savesub) |
1082 | continue; | 1082 | continue; |
@@ -1086,7 +1086,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv, | |||
1086 | spdif_priv->txrate[index] = arate; | 1086 | spdif_priv->txrate[index] = arate; |
1087 | } else if (rate[index] / arate == 1) { | 1087 | } else if (rate[index] / arate == 1) { |
1088 | /* A little smaller than expect */ | 1088 | /* A little smaller than expect */ |
1089 | sub = (rate[index] - arate) * 100000; | 1089 | sub = (u64)(rate[index] - arate) * 100000; |
1090 | do_div(sub, rate[index]); | 1090 | do_div(sub, rate[index]); |
1091 | if (sub >= savesub) | 1091 | if (sub >= savesub) |
1092 | continue; | 1092 | continue; |
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c index 0849b7b83f0a..0db94f492e97 100644 --- a/sound/soc/fsl/imx-pcm-dma.c +++ b/sound/soc/fsl/imx-pcm-dma.c | |||
@@ -59,7 +59,6 @@ int imx_pcm_dma_init(struct platform_device *pdev) | |||
59 | { | 59 | { |
60 | return devm_snd_dmaengine_pcm_register(&pdev->dev, | 60 | return devm_snd_dmaengine_pcm_register(&pdev->dev, |
61 | &imx_dmaengine_pcm_config, | 61 | &imx_dmaengine_pcm_config, |
62 | SND_DMAENGINE_PCM_FLAG_NO_RESIDUE | | ||
63 | SND_DMAENGINE_PCM_FLAG_COMPAT); | 62 | SND_DMAENGINE_PCM_FLAG_COMPAT); |
64 | } | 63 | } |
65 | EXPORT_SYMBOL_GPL(imx_pcm_dma_init); | 64 | EXPORT_SYMBOL_GPL(imx_pcm_dma_init); |
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index 6acb225ec6fd..2434b6d61675 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig | |||
@@ -11,6 +11,7 @@ config SND_PXA2XX_SOC | |||
11 | config SND_MMP_SOC | 11 | config SND_MMP_SOC |
12 | bool "Soc Audio for Marvell MMP chips" | 12 | bool "Soc Audio for Marvell MMP chips" |
13 | depends on ARCH_MMP | 13 | depends on ARCH_MMP |
14 | select MMP_SRAM | ||
14 | select SND_SOC_GENERIC_DMAENGINE_PCM | 15 | select SND_SOC_GENERIC_DMAENGINE_PCM |
15 | select SND_ARM | 16 | select SND_ARM |
16 | help | 17 | help |
@@ -40,7 +41,7 @@ config SND_MMP_SOC_SSPA | |||
40 | 41 | ||
41 | config SND_PXA2XX_SOC_CORGI | 42 | config SND_PXA2XX_SOC_CORGI |
42 | tristate "SoC Audio support for Sharp Zaurus SL-C7x0" | 43 | tristate "SoC Audio support for Sharp Zaurus SL-C7x0" |
43 | depends on SND_PXA2XX_SOC && PXA_SHARP_C7xx | 44 | depends on SND_PXA2XX_SOC && PXA_SHARP_C7xx && I2C |
44 | select SND_PXA2XX_SOC_I2S | 45 | select SND_PXA2XX_SOC_I2S |
45 | select SND_SOC_WM8731 | 46 | select SND_SOC_WM8731 |
46 | help | 47 | help |
@@ -49,7 +50,7 @@ config SND_PXA2XX_SOC_CORGI | |||
49 | 50 | ||
50 | config SND_PXA2XX_SOC_SPITZ | 51 | config SND_PXA2XX_SOC_SPITZ |
51 | tristate "SoC Audio support for Sharp Zaurus SL-Cxx00" | 52 | tristate "SoC Audio support for Sharp Zaurus SL-Cxx00" |
52 | depends on SND_PXA2XX_SOC && PXA_SHARP_Cxx00 | 53 | depends on SND_PXA2XX_SOC && PXA_SHARP_Cxx00 && I2C |
53 | select SND_PXA2XX_SOC_I2S | 54 | select SND_PXA2XX_SOC_I2S |
54 | select SND_SOC_WM8750 | 55 | select SND_SOC_WM8750 |
55 | help | 56 | help |
@@ -58,7 +59,7 @@ config SND_PXA2XX_SOC_SPITZ | |||
58 | 59 | ||
59 | config SND_PXA2XX_SOC_Z2 | 60 | config SND_PXA2XX_SOC_Z2 |
60 | tristate "SoC Audio support for Zipit Z2" | 61 | tristate "SoC Audio support for Zipit Z2" |
61 | depends on SND_PXA2XX_SOC && MACH_ZIPIT2 | 62 | depends on SND_PXA2XX_SOC && MACH_ZIPIT2 && I2C |
62 | select SND_PXA2XX_SOC_I2S | 63 | select SND_PXA2XX_SOC_I2S |
63 | select SND_SOC_WM8750 | 64 | select SND_SOC_WM8750 |
64 | help | 65 | help |
@@ -66,7 +67,7 @@ config SND_PXA2XX_SOC_Z2 | |||
66 | 67 | ||
67 | config SND_PXA2XX_SOC_POODLE | 68 | config SND_PXA2XX_SOC_POODLE |
68 | tristate "SoC Audio support for Poodle" | 69 | tristate "SoC Audio support for Poodle" |
69 | depends on SND_PXA2XX_SOC && MACH_POODLE | 70 | depends on SND_PXA2XX_SOC && MACH_POODLE && I2C |
70 | select SND_PXA2XX_SOC_I2S | 71 | select SND_PXA2XX_SOC_I2S |
71 | select SND_SOC_WM8731 | 72 | select SND_SOC_WM8731 |
72 | help | 73 | help |
@@ -181,7 +182,7 @@ config SND_PXA2XX_SOC_HX4700 | |||
181 | 182 | ||
182 | config SND_PXA2XX_SOC_MAGICIAN | 183 | config SND_PXA2XX_SOC_MAGICIAN |
183 | tristate "SoC Audio support for HTC Magician" | 184 | tristate "SoC Audio support for HTC Magician" |
184 | depends on SND_PXA2XX_SOC && MACH_MAGICIAN | 185 | depends on SND_PXA2XX_SOC && MACH_MAGICIAN && I2C |
185 | select SND_PXA2XX_SOC_I2S | 186 | select SND_PXA2XX_SOC_I2S |
186 | select SND_PXA_SOC_SSP | 187 | select SND_PXA_SOC_SSP |
187 | select SND_SOC_UDA1380 | 188 | select SND_SOC_UDA1380 |
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 91880156e1ae..4e86265f625c 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -315,7 +315,7 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma, | |||
315 | dst_mod = mod[index]; | 315 | dst_mod = mod[index]; |
316 | } else { | 316 | } else { |
317 | src_mod = mod[index]; | 317 | src_mod = mod[index]; |
318 | dst_mod = mod[index + 1]; | 318 | dst_mod = mod[index - 1]; |
319 | } | 319 | } |
320 | 320 | ||
321 | index = 0; | 321 | index = 0; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index a74b9bf23d9f..cdc837ed144d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -2755,7 +2755,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | |||
2755 | unsigned int mask = (1 << fls(max)) - 1; | 2755 | unsigned int mask = (1 << fls(max)) - 1; |
2756 | unsigned int invert = mc->invert; | 2756 | unsigned int invert = mc->invert; |
2757 | unsigned int val; | 2757 | unsigned int val; |
2758 | int connect, change; | 2758 | int connect, change, reg_change = 0; |
2759 | struct snd_soc_dapm_update update; | 2759 | struct snd_soc_dapm_update update; |
2760 | int ret = 0; | 2760 | int ret = 0; |
2761 | 2761 | ||
@@ -2773,20 +2773,23 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | |||
2773 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | 2773 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); |
2774 | 2774 | ||
2775 | change = dapm_kcontrol_set_value(kcontrol, val); | 2775 | change = dapm_kcontrol_set_value(kcontrol, val); |
2776 | if (change) { | ||
2777 | if (reg != SND_SOC_NOPM) { | ||
2778 | mask = mask << shift; | ||
2779 | val = val << shift; | ||
2780 | |||
2781 | if (snd_soc_test_bits(codec, reg, mask, val)) { | ||
2782 | update.kcontrol = kcontrol; | ||
2783 | update.reg = reg; | ||
2784 | update.mask = mask; | ||
2785 | update.val = val; | ||
2786 | card->update = &update; | ||
2787 | } | ||
2788 | 2776 | ||
2777 | if (reg != SND_SOC_NOPM) { | ||
2778 | mask = mask << shift; | ||
2779 | val = val << shift; | ||
2780 | |||
2781 | reg_change = snd_soc_test_bits(codec, reg, mask, val); | ||
2782 | } | ||
2783 | |||
2784 | if (change || reg_change) { | ||
2785 | if (reg_change) { | ||
2786 | update.kcontrol = kcontrol; | ||
2787 | update.reg = reg; | ||
2788 | update.mask = mask; | ||
2789 | update.val = val; | ||
2790 | card->update = &update; | ||
2789 | } | 2791 | } |
2792 | change |= reg_change; | ||
2790 | 2793 | ||
2791 | ret = soc_dapm_mixer_update_power(card, kcontrol, connect); | 2794 | ret = soc_dapm_mixer_update_power(card, kcontrol, connect); |
2792 | 2795 | ||
diff --git a/sound/usb/card.c b/sound/usb/card.c index c3b5b7dca1c3..a09e5f3519e3 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -307,6 +307,11 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) | |||
307 | 307 | ||
308 | static int snd_usb_audio_free(struct snd_usb_audio *chip) | 308 | static int snd_usb_audio_free(struct snd_usb_audio *chip) |
309 | { | 309 | { |
310 | struct list_head *p, *n; | ||
311 | |||
312 | list_for_each_safe(p, n, &chip->ep_list) | ||
313 | snd_usb_endpoint_free(p); | ||
314 | |||
310 | mutex_destroy(&chip->mutex); | 315 | mutex_destroy(&chip->mutex); |
311 | kfree(chip); | 316 | kfree(chip); |
312 | return 0; | 317 | return 0; |
@@ -585,7 +590,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
585 | struct snd_usb_audio *chip) | 590 | struct snd_usb_audio *chip) |
586 | { | 591 | { |
587 | struct snd_card *card; | 592 | struct snd_card *card; |
588 | struct list_head *p, *n; | 593 | struct list_head *p; |
589 | 594 | ||
590 | if (chip == (void *)-1L) | 595 | if (chip == (void *)-1L) |
591 | return; | 596 | return; |
@@ -598,14 +603,16 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
598 | mutex_lock(®ister_mutex); | 603 | mutex_lock(®ister_mutex); |
599 | chip->num_interfaces--; | 604 | chip->num_interfaces--; |
600 | if (chip->num_interfaces <= 0) { | 605 | if (chip->num_interfaces <= 0) { |
606 | struct snd_usb_endpoint *ep; | ||
607 | |||
601 | snd_card_disconnect(card); | 608 | snd_card_disconnect(card); |
602 | /* release the pcm resources */ | 609 | /* release the pcm resources */ |
603 | list_for_each(p, &chip->pcm_list) { | 610 | list_for_each(p, &chip->pcm_list) { |
604 | snd_usb_stream_disconnect(p); | 611 | snd_usb_stream_disconnect(p); |
605 | } | 612 | } |
606 | /* release the endpoint resources */ | 613 | /* release the endpoint resources */ |
607 | list_for_each_safe(p, n, &chip->ep_list) { | 614 | list_for_each_entry(ep, &chip->ep_list, list) { |
608 | snd_usb_endpoint_free(p); | 615 | snd_usb_endpoint_release(ep); |
609 | } | 616 | } |
610 | /* release the midi resources */ | 617 | /* release the midi resources */ |
611 | list_for_each(p, &chip->midi_list) { | 618 | list_for_each(p, &chip->midi_list) { |
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 289f582c9130..114e3e7ff511 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -987,19 +987,30 @@ void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep) | |||
987 | } | 987 | } |
988 | 988 | ||
989 | /** | 989 | /** |
990 | * snd_usb_endpoint_release: Tear down an snd_usb_endpoint | ||
991 | * | ||
992 | * @ep: the endpoint to release | ||
993 | * | ||
994 | * This function does not care for the endpoint's use count but will tear | ||
995 | * down all the streaming URBs immediately. | ||
996 | */ | ||
997 | void snd_usb_endpoint_release(struct snd_usb_endpoint *ep) | ||
998 | { | ||
999 | release_urbs(ep, 1); | ||
1000 | } | ||
1001 | |||
1002 | /** | ||
990 | * snd_usb_endpoint_free: Free the resources of an snd_usb_endpoint | 1003 | * snd_usb_endpoint_free: Free the resources of an snd_usb_endpoint |
991 | * | 1004 | * |
992 | * @ep: the list header of the endpoint to free | 1005 | * @ep: the list header of the endpoint to free |
993 | * | 1006 | * |
994 | * This function does not care for the endpoint's use count but will tear | 1007 | * This free all resources of the given ep. |
995 | * down all the streaming URBs immediately and free all resources. | ||
996 | */ | 1008 | */ |
997 | void snd_usb_endpoint_free(struct list_head *head) | 1009 | void snd_usb_endpoint_free(struct list_head *head) |
998 | { | 1010 | { |
999 | struct snd_usb_endpoint *ep; | 1011 | struct snd_usb_endpoint *ep; |
1000 | 1012 | ||
1001 | ep = list_entry(head, struct snd_usb_endpoint, list); | 1013 | ep = list_entry(head, struct snd_usb_endpoint, list); |
1002 | release_urbs(ep, 1); | ||
1003 | kfree(ep); | 1014 | kfree(ep); |
1004 | } | 1015 | } |
1005 | 1016 | ||
diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h index 1c7e8ee48abc..e61ee5c356a3 100644 --- a/sound/usb/endpoint.h +++ b/sound/usb/endpoint.h | |||
@@ -23,6 +23,7 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep); | |||
23 | void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); | 23 | void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); |
24 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); | 24 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); |
25 | void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); | 25 | void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); |
26 | void snd_usb_endpoint_release(struct snd_usb_endpoint *ep); | ||
26 | void snd_usb_endpoint_free(struct list_head *head); | 27 | void snd_usb_endpoint_free(struct list_head *head); |
27 | 28 | ||
28 | int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep); | 29 | int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep); |
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index b83184f2d484..93825a17dcce 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
@@ -765,6 +765,9 @@ static void free_arg(struct print_arg *arg) | |||
765 | case PRINT_BSTRING: | 765 | case PRINT_BSTRING: |
766 | free(arg->string.string); | 766 | free(arg->string.string); |
767 | break; | 767 | break; |
768 | case PRINT_BITMASK: | ||
769 | free(arg->bitmask.bitmask); | ||
770 | break; | ||
768 | case PRINT_DYNAMIC_ARRAY: | 771 | case PRINT_DYNAMIC_ARRAY: |
769 | free(arg->dynarray.index); | 772 | free(arg->dynarray.index); |
770 | break; | 773 | break; |
@@ -2268,6 +2271,7 @@ static int arg_num_eval(struct print_arg *arg, long long *val) | |||
2268 | case PRINT_FIELD ... PRINT_SYMBOL: | 2271 | case PRINT_FIELD ... PRINT_SYMBOL: |
2269 | case PRINT_STRING: | 2272 | case PRINT_STRING: |
2270 | case PRINT_BSTRING: | 2273 | case PRINT_BSTRING: |
2274 | case PRINT_BITMASK: | ||
2271 | default: | 2275 | default: |
2272 | do_warning("invalid eval type %d", arg->type); | 2276 | do_warning("invalid eval type %d", arg->type); |
2273 | ret = 0; | 2277 | ret = 0; |
@@ -2296,6 +2300,7 @@ static char *arg_eval (struct print_arg *arg) | |||
2296 | case PRINT_FIELD ... PRINT_SYMBOL: | 2300 | case PRINT_FIELD ... PRINT_SYMBOL: |
2297 | case PRINT_STRING: | 2301 | case PRINT_STRING: |
2298 | case PRINT_BSTRING: | 2302 | case PRINT_BSTRING: |
2303 | case PRINT_BITMASK: | ||
2299 | default: | 2304 | default: |
2300 | do_warning("invalid eval type %d", arg->type); | 2305 | do_warning("invalid eval type %d", arg->type); |
2301 | break; | 2306 | break; |
@@ -2683,6 +2688,35 @@ process_str(struct event_format *event __maybe_unused, struct print_arg *arg, | |||
2683 | return EVENT_ERROR; | 2688 | return EVENT_ERROR; |
2684 | } | 2689 | } |
2685 | 2690 | ||
2691 | static enum event_type | ||
2692 | process_bitmask(struct event_format *event __maybe_unused, struct print_arg *arg, | ||
2693 | char **tok) | ||
2694 | { | ||
2695 | enum event_type type; | ||
2696 | char *token; | ||
2697 | |||
2698 | if (read_expect_type(EVENT_ITEM, &token) < 0) | ||
2699 | goto out_free; | ||
2700 | |||
2701 | arg->type = PRINT_BITMASK; | ||
2702 | arg->bitmask.bitmask = token; | ||
2703 | arg->bitmask.offset = -1; | ||
2704 | |||
2705 | if (read_expected(EVENT_DELIM, ")") < 0) | ||
2706 | goto out_err; | ||
2707 | |||
2708 | type = read_token(&token); | ||
2709 | *tok = token; | ||
2710 | |||
2711 | return type; | ||
2712 | |||
2713 | out_free: | ||
2714 | free_token(token); | ||
2715 | out_err: | ||
2716 | *tok = NULL; | ||
2717 | return EVENT_ERROR; | ||
2718 | } | ||
2719 | |||
2686 | static struct pevent_function_handler * | 2720 | static struct pevent_function_handler * |
2687 | find_func_handler(struct pevent *pevent, char *func_name) | 2721 | find_func_handler(struct pevent *pevent, char *func_name) |
2688 | { | 2722 | { |
@@ -2797,6 +2831,10 @@ process_function(struct event_format *event, struct print_arg *arg, | |||
2797 | free_token(token); | 2831 | free_token(token); |
2798 | return process_str(event, arg, tok); | 2832 | return process_str(event, arg, tok); |
2799 | } | 2833 | } |
2834 | if (strcmp(token, "__get_bitmask") == 0) { | ||
2835 | free_token(token); | ||
2836 | return process_bitmask(event, arg, tok); | ||
2837 | } | ||
2800 | if (strcmp(token, "__get_dynamic_array") == 0) { | 2838 | if (strcmp(token, "__get_dynamic_array") == 0) { |
2801 | free_token(token); | 2839 | free_token(token); |
2802 | return process_dynamic_array(event, arg, tok); | 2840 | return process_dynamic_array(event, arg, tok); |
@@ -3324,6 +3362,7 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg | |||
3324 | return eval_type(val, arg, 0); | 3362 | return eval_type(val, arg, 0); |
3325 | case PRINT_STRING: | 3363 | case PRINT_STRING: |
3326 | case PRINT_BSTRING: | 3364 | case PRINT_BSTRING: |
3365 | case PRINT_BITMASK: | ||
3327 | return 0; | 3366 | return 0; |
3328 | case PRINT_FUNC: { | 3367 | case PRINT_FUNC: { |
3329 | struct trace_seq s; | 3368 | struct trace_seq s; |
@@ -3556,6 +3595,60 @@ static void print_str_to_seq(struct trace_seq *s, const char *format, | |||
3556 | trace_seq_printf(s, format, str); | 3595 | trace_seq_printf(s, format, str); |
3557 | } | 3596 | } |
3558 | 3597 | ||
3598 | static void print_bitmask_to_seq(struct pevent *pevent, | ||
3599 | struct trace_seq *s, const char *format, | ||
3600 | int len_arg, const void *data, int size) | ||
3601 | { | ||
3602 | int nr_bits = size * 8; | ||
3603 | int str_size = (nr_bits + 3) / 4; | ||
3604 | int len = 0; | ||
3605 | char buf[3]; | ||
3606 | char *str; | ||
3607 | int index; | ||
3608 | int i; | ||
3609 | |||
3610 | /* | ||
3611 | * The kernel likes to put in commas every 32 bits, we | ||
3612 | * can do the same. | ||
3613 | */ | ||
3614 | str_size += (nr_bits - 1) / 32; | ||
3615 | |||
3616 | str = malloc(str_size + 1); | ||
3617 | if (!str) { | ||
3618 | do_warning("%s: not enough memory!", __func__); | ||
3619 | return; | ||
3620 | } | ||
3621 | str[str_size] = 0; | ||
3622 | |||
3623 | /* Start out with -2 for the two chars per byte */ | ||
3624 | for (i = str_size - 2; i >= 0; i -= 2) { | ||
3625 | /* | ||
3626 | * data points to a bit mask of size bytes. | ||
3627 | * In the kernel, this is an array of long words, thus | ||
3628 | * endianess is very important. | ||
3629 | */ | ||
3630 | if (pevent->file_bigendian) | ||
3631 | index = size - (len + 1); | ||
3632 | else | ||
3633 | index = len; | ||
3634 | |||
3635 | snprintf(buf, 3, "%02x", *((unsigned char *)data + index)); | ||
3636 | memcpy(str + i, buf, 2); | ||
3637 | len++; | ||
3638 | if (!(len & 3) && i > 0) { | ||
3639 | i--; | ||
3640 | str[i] = ','; | ||
3641 | } | ||
3642 | } | ||
3643 | |||
3644 | if (len_arg >= 0) | ||
3645 | trace_seq_printf(s, format, len_arg, str); | ||
3646 | else | ||
3647 | trace_seq_printf(s, format, str); | ||
3648 | |||
3649 | free(str); | ||
3650 | } | ||
3651 | |||
3559 | static void print_str_arg(struct trace_seq *s, void *data, int size, | 3652 | static void print_str_arg(struct trace_seq *s, void *data, int size, |
3560 | struct event_format *event, const char *format, | 3653 | struct event_format *event, const char *format, |
3561 | int len_arg, struct print_arg *arg) | 3654 | int len_arg, struct print_arg *arg) |
@@ -3691,6 +3784,23 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
3691 | case PRINT_BSTRING: | 3784 | case PRINT_BSTRING: |
3692 | print_str_to_seq(s, format, len_arg, arg->string.string); | 3785 | print_str_to_seq(s, format, len_arg, arg->string.string); |
3693 | break; | 3786 | break; |
3787 | case PRINT_BITMASK: { | ||
3788 | int bitmask_offset; | ||
3789 | int bitmask_size; | ||
3790 | |||
3791 | if (arg->bitmask.offset == -1) { | ||
3792 | struct format_field *f; | ||
3793 | |||
3794 | f = pevent_find_any_field(event, arg->bitmask.bitmask); | ||
3795 | arg->bitmask.offset = f->offset; | ||
3796 | } | ||
3797 | bitmask_offset = data2host4(pevent, data + arg->bitmask.offset); | ||
3798 | bitmask_size = bitmask_offset >> 16; | ||
3799 | bitmask_offset &= 0xffff; | ||
3800 | print_bitmask_to_seq(pevent, s, format, len_arg, | ||
3801 | data + bitmask_offset, bitmask_size); | ||
3802 | break; | ||
3803 | } | ||
3694 | case PRINT_OP: | 3804 | case PRINT_OP: |
3695 | /* | 3805 | /* |
3696 | * The only op for string should be ? : | 3806 | * The only op for string should be ? : |
@@ -4822,6 +4932,9 @@ static void print_args(struct print_arg *args) | |||
4822 | case PRINT_BSTRING: | 4932 | case PRINT_BSTRING: |
4823 | printf("__get_str(%s)", args->string.string); | 4933 | printf("__get_str(%s)", args->string.string); |
4824 | break; | 4934 | break; |
4935 | case PRINT_BITMASK: | ||
4936 | printf("__get_bitmask(%s)", args->bitmask.bitmask); | ||
4937 | break; | ||
4825 | case PRINT_TYPE: | 4938 | case PRINT_TYPE: |
4826 | printf("(%s)", args->typecast.type); | 4939 | printf("(%s)", args->typecast.type); |
4827 | print_args(args->typecast.item); | 4940 | print_args(args->typecast.item); |
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index feab94281634..7a3873ff9a4f 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h | |||
@@ -107,8 +107,8 @@ typedef int (*pevent_event_handler_func)(struct trace_seq *s, | |||
107 | typedef int (*pevent_plugin_load_func)(struct pevent *pevent); | 107 | typedef int (*pevent_plugin_load_func)(struct pevent *pevent); |
108 | typedef int (*pevent_plugin_unload_func)(struct pevent *pevent); | 108 | typedef int (*pevent_plugin_unload_func)(struct pevent *pevent); |
109 | 109 | ||
110 | struct plugin_option { | 110 | struct pevent_plugin_option { |
111 | struct plugin_option *next; | 111 | struct pevent_plugin_option *next; |
112 | void *handle; | 112 | void *handle; |
113 | char *file; | 113 | char *file; |
114 | char *name; | 114 | char *name; |
@@ -135,7 +135,7 @@ struct plugin_option { | |||
135 | * PEVENT_PLUGIN_OPTIONS: (optional) | 135 | * PEVENT_PLUGIN_OPTIONS: (optional) |
136 | * Plugin options that can be set before loading | 136 | * Plugin options that can be set before loading |
137 | * | 137 | * |
138 | * struct plugin_option PEVENT_PLUGIN_OPTIONS[] = { | 138 | * struct pevent_plugin_option PEVENT_PLUGIN_OPTIONS[] = { |
139 | * { | 139 | * { |
140 | * .name = "option-name", | 140 | * .name = "option-name", |
141 | * .plugin_alias = "overide-file-name", (optional) | 141 | * .plugin_alias = "overide-file-name", (optional) |
@@ -208,6 +208,11 @@ struct print_arg_string { | |||
208 | int offset; | 208 | int offset; |
209 | }; | 209 | }; |
210 | 210 | ||
211 | struct print_arg_bitmask { | ||
212 | char *bitmask; | ||
213 | int offset; | ||
214 | }; | ||
215 | |||
211 | struct print_arg_field { | 216 | struct print_arg_field { |
212 | char *name; | 217 | char *name; |
213 | struct format_field *field; | 218 | struct format_field *field; |
@@ -274,6 +279,7 @@ enum print_arg_type { | |||
274 | PRINT_DYNAMIC_ARRAY, | 279 | PRINT_DYNAMIC_ARRAY, |
275 | PRINT_OP, | 280 | PRINT_OP, |
276 | PRINT_FUNC, | 281 | PRINT_FUNC, |
282 | PRINT_BITMASK, | ||
277 | }; | 283 | }; |
278 | 284 | ||
279 | struct print_arg { | 285 | struct print_arg { |
@@ -288,6 +294,7 @@ struct print_arg { | |||
288 | struct print_arg_hex hex; | 294 | struct print_arg_hex hex; |
289 | struct print_arg_func func; | 295 | struct print_arg_func func; |
290 | struct print_arg_string string; | 296 | struct print_arg_string string; |
297 | struct print_arg_bitmask bitmask; | ||
291 | struct print_arg_op op; | 298 | struct print_arg_op op; |
292 | struct print_arg_dynarray dynarray; | 299 | struct print_arg_dynarray dynarray; |
293 | }; | 300 | }; |
@@ -354,6 +361,8 @@ enum pevent_func_arg_type { | |||
354 | 361 | ||
355 | enum pevent_flag { | 362 | enum pevent_flag { |
356 | PEVENT_NSEC_OUTPUT = 1, /* output in NSECS */ | 363 | PEVENT_NSEC_OUTPUT = 1, /* output in NSECS */ |
364 | PEVENT_DISABLE_SYS_PLUGINS = 1 << 1, | ||
365 | PEVENT_DISABLE_PLUGINS = 1 << 2, | ||
357 | }; | 366 | }; |
358 | 367 | ||
359 | #define PEVENT_ERRORS \ | 368 | #define PEVENT_ERRORS \ |
@@ -410,9 +419,19 @@ enum pevent_errno { | |||
410 | 419 | ||
411 | struct plugin_list; | 420 | struct plugin_list; |
412 | 421 | ||
422 | #define INVALID_PLUGIN_LIST_OPTION ((char **)((unsigned long)-1)) | ||
423 | |||
413 | struct plugin_list *traceevent_load_plugins(struct pevent *pevent); | 424 | struct plugin_list *traceevent_load_plugins(struct pevent *pevent); |
414 | void traceevent_unload_plugins(struct plugin_list *plugin_list, | 425 | void traceevent_unload_plugins(struct plugin_list *plugin_list, |
415 | struct pevent *pevent); | 426 | struct pevent *pevent); |
427 | char **traceevent_plugin_list_options(void); | ||
428 | void traceevent_plugin_free_options_list(char **list); | ||
429 | int traceevent_plugin_add_options(const char *name, | ||
430 | struct pevent_plugin_option *options); | ||
431 | void traceevent_plugin_remove_options(struct pevent_plugin_option *options); | ||
432 | void traceevent_print_plugins(struct trace_seq *s, | ||
433 | const char *prefix, const char *suffix, | ||
434 | const struct plugin_list *list); | ||
416 | 435 | ||
417 | struct cmdline; | 436 | struct cmdline; |
418 | struct cmdline_list; | 437 | struct cmdline_list; |
diff --git a/tools/lib/traceevent/event-plugin.c b/tools/lib/traceevent/event-plugin.c index 0c8bf6780e4d..136162c03af1 100644 --- a/tools/lib/traceevent/event-plugin.c +++ b/tools/lib/traceevent/event-plugin.c | |||
@@ -18,6 +18,7 @@ | |||
18 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 18 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <stdio.h> | ||
21 | #include <string.h> | 22 | #include <string.h> |
22 | #include <dlfcn.h> | 23 | #include <dlfcn.h> |
23 | #include <stdlib.h> | 24 | #include <stdlib.h> |
@@ -30,12 +31,207 @@ | |||
30 | 31 | ||
31 | #define LOCAL_PLUGIN_DIR ".traceevent/plugins" | 32 | #define LOCAL_PLUGIN_DIR ".traceevent/plugins" |
32 | 33 | ||
34 | static struct registered_plugin_options { | ||
35 | struct registered_plugin_options *next; | ||
36 | struct pevent_plugin_option *options; | ||
37 | } *registered_options; | ||
38 | |||
39 | static struct trace_plugin_options { | ||
40 | struct trace_plugin_options *next; | ||
41 | char *plugin; | ||
42 | char *option; | ||
43 | char *value; | ||
44 | } *trace_plugin_options; | ||
45 | |||
33 | struct plugin_list { | 46 | struct plugin_list { |
34 | struct plugin_list *next; | 47 | struct plugin_list *next; |
35 | char *name; | 48 | char *name; |
36 | void *handle; | 49 | void *handle; |
37 | }; | 50 | }; |
38 | 51 | ||
52 | /** | ||
53 | * traceevent_plugin_list_options - get list of plugin options | ||
54 | * | ||
55 | * Returns an array of char strings that list the currently registered | ||
56 | * plugin options in the format of <plugin>:<option>. This list can be | ||
57 | * used by toggling the option. | ||
58 | * | ||
59 | * Returns NULL if there's no options registered. On error it returns | ||
60 | * INVALID_PLUGIN_LIST_OPTION | ||
61 | * | ||
62 | * Must be freed with traceevent_plugin_free_options_list(). | ||
63 | */ | ||
64 | char **traceevent_plugin_list_options(void) | ||
65 | { | ||
66 | struct registered_plugin_options *reg; | ||
67 | struct pevent_plugin_option *op; | ||
68 | char **list = NULL; | ||
69 | char *name; | ||
70 | int count = 0; | ||
71 | |||
72 | for (reg = registered_options; reg; reg = reg->next) { | ||
73 | for (op = reg->options; op->name; op++) { | ||
74 | char *alias = op->plugin_alias ? op->plugin_alias : op->file; | ||
75 | char **temp = list; | ||
76 | |||
77 | name = malloc(strlen(op->name) + strlen(alias) + 2); | ||
78 | if (!name) | ||
79 | goto err; | ||
80 | |||
81 | sprintf(name, "%s:%s", alias, op->name); | ||
82 | list = realloc(list, count + 2); | ||
83 | if (!list) { | ||
84 | list = temp; | ||
85 | free(name); | ||
86 | goto err; | ||
87 | } | ||
88 | list[count++] = name; | ||
89 | list[count] = NULL; | ||
90 | } | ||
91 | } | ||
92 | return list; | ||
93 | |||
94 | err: | ||
95 | while (--count >= 0) | ||
96 | free(list[count]); | ||
97 | free(list); | ||
98 | |||
99 | return INVALID_PLUGIN_LIST_OPTION; | ||
100 | } | ||
101 | |||
102 | void traceevent_plugin_free_options_list(char **list) | ||
103 | { | ||
104 | int i; | ||
105 | |||
106 | if (!list) | ||
107 | return; | ||
108 | |||
109 | if (list == INVALID_PLUGIN_LIST_OPTION) | ||
110 | return; | ||
111 | |||
112 | for (i = 0; list[i]; i++) | ||
113 | free(list[i]); | ||
114 | |||
115 | free(list); | ||
116 | } | ||
117 | |||
118 | static int | ||
119 | update_option(const char *file, struct pevent_plugin_option *option) | ||
120 | { | ||
121 | struct trace_plugin_options *op; | ||
122 | char *plugin; | ||
123 | |||
124 | if (option->plugin_alias) { | ||
125 | plugin = strdup(option->plugin_alias); | ||
126 | if (!plugin) | ||
127 | return -1; | ||
128 | } else { | ||
129 | char *p; | ||
130 | plugin = strdup(file); | ||
131 | if (!plugin) | ||
132 | return -1; | ||
133 | p = strstr(plugin, "."); | ||
134 | if (p) | ||
135 | *p = '\0'; | ||
136 | } | ||
137 | |||
138 | /* first look for named options */ | ||
139 | for (op = trace_plugin_options; op; op = op->next) { | ||
140 | if (!op->plugin) | ||
141 | continue; | ||
142 | if (strcmp(op->plugin, plugin) != 0) | ||
143 | continue; | ||
144 | if (strcmp(op->option, option->name) != 0) | ||
145 | continue; | ||
146 | |||
147 | option->value = op->value; | ||
148 | option->set ^= 1; | ||
149 | goto out; | ||
150 | } | ||
151 | |||
152 | /* first look for unnamed options */ | ||
153 | for (op = trace_plugin_options; op; op = op->next) { | ||
154 | if (op->plugin) | ||
155 | continue; | ||
156 | if (strcmp(op->option, option->name) != 0) | ||
157 | continue; | ||
158 | |||
159 | option->value = op->value; | ||
160 | option->set ^= 1; | ||
161 | break; | ||
162 | } | ||
163 | |||
164 | out: | ||
165 | free(plugin); | ||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | /** | ||
170 | * traceevent_plugin_add_options - Add a set of options by a plugin | ||
171 | * @name: The name of the plugin adding the options | ||
172 | * @options: The set of options being loaded | ||
173 | * | ||
174 | * Sets the options with the values that have been added by user. | ||
175 | */ | ||
176 | int traceevent_plugin_add_options(const char *name, | ||
177 | struct pevent_plugin_option *options) | ||
178 | { | ||
179 | struct registered_plugin_options *reg; | ||
180 | |||
181 | reg = malloc(sizeof(*reg)); | ||
182 | if (!reg) | ||
183 | return -1; | ||
184 | reg->next = registered_options; | ||
185 | reg->options = options; | ||
186 | registered_options = reg; | ||
187 | |||
188 | while (options->name) { | ||
189 | update_option(name, options); | ||
190 | options++; | ||
191 | } | ||
192 | return 0; | ||
193 | } | ||
194 | |||
195 | /** | ||
196 | * traceevent_plugin_remove_options - remove plugin options that were registered | ||
197 | * @options: Options to removed that were registered with traceevent_plugin_add_options | ||
198 | */ | ||
199 | void traceevent_plugin_remove_options(struct pevent_plugin_option *options) | ||
200 | { | ||
201 | struct registered_plugin_options **last; | ||
202 | struct registered_plugin_options *reg; | ||
203 | |||
204 | for (last = ®istered_options; *last; last = &(*last)->next) { | ||
205 | if ((*last)->options == options) { | ||
206 | reg = *last; | ||
207 | *last = reg->next; | ||
208 | free(reg); | ||
209 | return; | ||
210 | } | ||
211 | } | ||
212 | } | ||
213 | |||
214 | /** | ||
215 | * traceevent_print_plugins - print out the list of plugins loaded | ||
216 | * @s: the trace_seq descripter to write to | ||
217 | * @prefix: The prefix string to add before listing the option name | ||
218 | * @suffix: The suffix string ot append after the option name | ||
219 | * @list: The list of plugins (usually returned by traceevent_load_plugins() | ||
220 | * | ||
221 | * Writes to the trace_seq @s the list of plugins (files) that is | ||
222 | * returned by traceevent_load_plugins(). Use @prefix and @suffix for formating: | ||
223 | * @prefix = " ", @suffix = "\n". | ||
224 | */ | ||
225 | void traceevent_print_plugins(struct trace_seq *s, | ||
226 | const char *prefix, const char *suffix, | ||
227 | const struct plugin_list *list) | ||
228 | { | ||
229 | while (list) { | ||
230 | trace_seq_printf(s, "%s%s%s", prefix, list->name, suffix); | ||
231 | list = list->next; | ||
232 | } | ||
233 | } | ||
234 | |||
39 | static void | 235 | static void |
40 | load_plugin(struct pevent *pevent, const char *path, | 236 | load_plugin(struct pevent *pevent, const char *path, |
41 | const char *file, void *data) | 237 | const char *file, void *data) |
@@ -148,12 +344,17 @@ load_plugins(struct pevent *pevent, const char *suffix, | |||
148 | char *path; | 344 | char *path; |
149 | char *envdir; | 345 | char *envdir; |
150 | 346 | ||
347 | if (pevent->flags & PEVENT_DISABLE_PLUGINS) | ||
348 | return; | ||
349 | |||
151 | /* | 350 | /* |
152 | * If a system plugin directory was defined, | 351 | * If a system plugin directory was defined, |
153 | * check that first. | 352 | * check that first. |
154 | */ | 353 | */ |
155 | #ifdef PLUGIN_DIR | 354 | #ifdef PLUGIN_DIR |
156 | load_plugins_dir(pevent, suffix, PLUGIN_DIR, load_plugin, data); | 355 | if (!(pevent->flags & PEVENT_DISABLE_SYS_PLUGINS)) |
356 | load_plugins_dir(pevent, suffix, PLUGIN_DIR, | ||
357 | load_plugin, data); | ||
157 | #endif | 358 | #endif |
158 | 359 | ||
159 | /* | 360 | /* |
diff --git a/tools/lib/traceevent/plugin_function.c b/tools/lib/traceevent/plugin_function.c index 80ba4ff1fe84..a00ec190821a 100644 --- a/tools/lib/traceevent/plugin_function.c +++ b/tools/lib/traceevent/plugin_function.c | |||
@@ -33,6 +33,29 @@ static int cpus = -1; | |||
33 | 33 | ||
34 | #define STK_BLK 10 | 34 | #define STK_BLK 10 |
35 | 35 | ||
36 | struct pevent_plugin_option plugin_options[] = | ||
37 | { | ||
38 | { | ||
39 | .name = "parent", | ||
40 | .plugin_alias = "ftrace", | ||
41 | .description = | ||
42 | "Print parent of functions for function events", | ||
43 | }, | ||
44 | { | ||
45 | .name = "indent", | ||
46 | .plugin_alias = "ftrace", | ||
47 | .description = | ||
48 | "Try to show function call indents, based on parents", | ||
49 | .set = 1, | ||
50 | }, | ||
51 | { | ||
52 | .name = NULL, | ||
53 | } | ||
54 | }; | ||
55 | |||
56 | static struct pevent_plugin_option *ftrace_parent = &plugin_options[0]; | ||
57 | static struct pevent_plugin_option *ftrace_indent = &plugin_options[1]; | ||
58 | |||
36 | static void add_child(struct func_stack *stack, const char *child, int pos) | 59 | static void add_child(struct func_stack *stack, const char *child, int pos) |
37 | { | 60 | { |
38 | int i; | 61 | int i; |
@@ -119,7 +142,8 @@ static int function_handler(struct trace_seq *s, struct pevent_record *record, | |||
119 | 142 | ||
120 | parent = pevent_find_function(pevent, pfunction); | 143 | parent = pevent_find_function(pevent, pfunction); |
121 | 144 | ||
122 | index = add_and_get_index(parent, func, record->cpu); | 145 | if (parent && ftrace_indent->set) |
146 | index = add_and_get_index(parent, func, record->cpu); | ||
123 | 147 | ||
124 | trace_seq_printf(s, "%*s", index*3, ""); | 148 | trace_seq_printf(s, "%*s", index*3, ""); |
125 | 149 | ||
@@ -128,11 +152,13 @@ static int function_handler(struct trace_seq *s, struct pevent_record *record, | |||
128 | else | 152 | else |
129 | trace_seq_printf(s, "0x%llx", function); | 153 | trace_seq_printf(s, "0x%llx", function); |
130 | 154 | ||
131 | trace_seq_printf(s, " <-- "); | 155 | if (ftrace_parent->set) { |
132 | if (parent) | 156 | trace_seq_printf(s, " <-- "); |
133 | trace_seq_printf(s, "%s", parent); | 157 | if (parent) |
134 | else | 158 | trace_seq_printf(s, "%s", parent); |
135 | trace_seq_printf(s, "0x%llx", pfunction); | 159 | else |
160 | trace_seq_printf(s, "0x%llx", pfunction); | ||
161 | } | ||
136 | 162 | ||
137 | return 0; | 163 | return 0; |
138 | } | 164 | } |
@@ -141,6 +167,9 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | |||
141 | { | 167 | { |
142 | pevent_register_event_handler(pevent, -1, "ftrace", "function", | 168 | pevent_register_event_handler(pevent, -1, "ftrace", "function", |
143 | function_handler, NULL); | 169 | function_handler, NULL); |
170 | |||
171 | traceevent_plugin_add_options("ftrace", plugin_options); | ||
172 | |||
144 | return 0; | 173 | return 0; |
145 | } | 174 | } |
146 | 175 | ||
@@ -157,6 +186,8 @@ void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | |||
157 | free(fstack[i].stack); | 186 | free(fstack[i].stack); |
158 | } | 187 | } |
159 | 188 | ||
189 | traceevent_plugin_remove_options(plugin_options); | ||
190 | |||
160 | free(fstack); | 191 | free(fstack); |
161 | fstack = NULL; | 192 | fstack = NULL; |
162 | cpus = -1; | 193 | cpus = -1; |
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt index cefdf430d1b4..d2b59af62bc0 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt | |||
@@ -117,6 +117,22 @@ OPTIONS | |||
117 | By default, every sort keys not specified in -F will be appended | 117 | By default, every sort keys not specified in -F will be appended |
118 | automatically. | 118 | automatically. |
119 | 119 | ||
120 | If --mem-mode option is used, following sort keys are also available | ||
121 | (incompatible with --branch-stack): | ||
122 | symbol_daddr, dso_daddr, locked, tlb, mem, snoop, dcacheline. | ||
123 | |||
124 | - symbol_daddr: name of data symbol being executed on at the time of sample | ||
125 | - dso_daddr: name of library or module containing the data being executed | ||
126 | on at the time of sample | ||
127 | - locked: whether the bus was locked at the time of sample | ||
128 | - tlb: type of tlb access for the data at the time of sample | ||
129 | - mem: type of memory access for the data at the time of sample | ||
130 | - snoop: type of snoop (if any) for the data at the time of sample | ||
131 | - dcacheline: the cacheline the data address is on at the time of sample | ||
132 | |||
133 | And default sort keys are changed to local_weight, mem, sym, dso, | ||
134 | symbol_daddr, dso_daddr, snoop, tlb, locked, see '--mem-mode'. | ||
135 | |||
120 | -p:: | 136 | -p:: |
121 | --parent=<regex>:: | 137 | --parent=<regex>:: |
122 | A regex filter to identify parent. The parent is a caller of this | 138 | A regex filter to identify parent. The parent is a caller of this |
@@ -260,6 +276,13 @@ OPTIONS | |||
260 | Demangle symbol names to human readable form. It's enabled by default, | 276 | Demangle symbol names to human readable form. It's enabled by default, |
261 | disable with --no-demangle. | 277 | disable with --no-demangle. |
262 | 278 | ||
279 | --mem-mode:: | ||
280 | Use the data addresses of samples in addition to instruction addresses | ||
281 | to build the histograms. To generate meaningful output, the perf.data | ||
282 | file must have been obtained using perf record -d -W and using a | ||
283 | special event -e cpu/mem-loads/ or -e cpu/mem-stores/. See | ||
284 | 'perf mem' for simpler access. | ||
285 | |||
263 | --percent-limit:: | 286 | --percent-limit:: |
264 | Do not show entries which have an overhead under that percent. | 287 | Do not show entries which have an overhead under that percent. |
265 | (Default: 0). | 288 | (Default: 0). |
diff --git a/tools/perf/Documentation/perf-timechart.txt b/tools/perf/Documentation/perf-timechart.txt index bc5990c33dc0..5e0f986dff38 100644 --- a/tools/perf/Documentation/perf-timechart.txt +++ b/tools/perf/Documentation/perf-timechart.txt | |||
@@ -43,27 +43,6 @@ TIMECHART OPTIONS | |||
43 | 43 | ||
44 | --symfs=<directory>:: | 44 | --symfs=<directory>:: |
45 | Look for files with symbols relative to this directory. | 45 | Look for files with symbols relative to this directory. |
46 | |||
47 | EXAMPLES | ||
48 | -------- | ||
49 | |||
50 | $ perf timechart record git pull | ||
51 | |||
52 | [ perf record: Woken up 13 times to write data ] | ||
53 | [ perf record: Captured and wrote 4.253 MB perf.data (~185801 samples) ] | ||
54 | |||
55 | $ perf timechart | ||
56 | |||
57 | Written 10.2 seconds of trace to output.svg. | ||
58 | |||
59 | Record system-wide timechart: | ||
60 | |||
61 | $ perf timechart record | ||
62 | |||
63 | then generate timechart and highlight 'gcc' tasks: | ||
64 | |||
65 | $ perf timechart --highlight gcc | ||
66 | |||
67 | -n:: | 46 | -n:: |
68 | --proc-num:: | 47 | --proc-num:: |
69 | Print task info for at least given number of tasks. | 48 | Print task info for at least given number of tasks. |
@@ -88,6 +67,26 @@ RECORD OPTIONS | |||
88 | --callchain:: | 67 | --callchain:: |
89 | Do call-graph (stack chain/backtrace) recording | 68 | Do call-graph (stack chain/backtrace) recording |
90 | 69 | ||
70 | EXAMPLES | ||
71 | -------- | ||
72 | |||
73 | $ perf timechart record git pull | ||
74 | |||
75 | [ perf record: Woken up 13 times to write data ] | ||
76 | [ perf record: Captured and wrote 4.253 MB perf.data (~185801 samples) ] | ||
77 | |||
78 | $ perf timechart | ||
79 | |||
80 | Written 10.2 seconds of trace to output.svg. | ||
81 | |||
82 | Record system-wide timechart: | ||
83 | |||
84 | $ perf timechart record | ||
85 | |||
86 | then generate timechart and highlight 'gcc' tasks: | ||
87 | |||
88 | $ perf timechart --highlight gcc | ||
89 | |||
91 | SEE ALSO | 90 | SEE ALSO |
92 | -------- | 91 | -------- |
93 | linkperf:perf-record[1] | 92 | linkperf:perf-record[1] |
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index ae20edfcc3f7..9670a16fa577 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -819,15 +819,15 @@ TAG_FOLDERS= . ../lib/traceevent ../lib/api ../lib/symbol | |||
819 | TAG_FILES= ../../include/uapi/linux/perf_event.h | 819 | TAG_FILES= ../../include/uapi/linux/perf_event.h |
820 | 820 | ||
821 | TAGS: | 821 | TAGS: |
822 | $(RM) TAGS | 822 | $(QUIET_GEN)$(RM) TAGS; \ |
823 | $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs etags -a $(TAG_FILES) | 823 | $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs etags -a $(TAG_FILES) |
824 | 824 | ||
825 | tags: | 825 | tags: |
826 | $(RM) tags | 826 | $(QUIET_GEN)$(RM) tags; \ |
827 | $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs ctags -a $(TAG_FILES) | 827 | $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs ctags -a $(TAG_FILES) |
828 | 828 | ||
829 | cscope: | 829 | cscope: |
830 | $(RM) cscope* | 830 | $(QUIET_GEN)$(RM) cscope*; \ |
831 | $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs cscope -b $(TAG_FILES) | 831 | $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs cscope -b $(TAG_FILES) |
832 | 832 | ||
833 | ### Detect prefix changes | 833 | ### Detect prefix changes |
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 6a3af0013d68..16c7c11ad06e 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
@@ -72,7 +72,7 @@ static int perf_event__repipe_attr(struct perf_tool *tool, | |||
72 | if (ret) | 72 | if (ret) |
73 | return ret; | 73 | return ret; |
74 | 74 | ||
75 | if (&inject->output.is_pipe) | 75 | if (!inject->output.is_pipe) |
76 | return 0; | 76 | return 0; |
77 | 77 | ||
78 | return perf_event__repipe_synth(tool, event); | 78 | return perf_event__repipe_synth(tool, event); |
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index cdcd4eb3a57d..c63fa2925075 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
@@ -288,6 +288,13 @@ static void cleanup_params(void) | |||
288 | memset(¶ms, 0, sizeof(params)); | 288 | memset(¶ms, 0, sizeof(params)); |
289 | } | 289 | } |
290 | 290 | ||
291 | static void pr_err_with_code(const char *msg, int err) | ||
292 | { | ||
293 | pr_err("%s", msg); | ||
294 | pr_debug(" Reason: %s (Code: %d)", strerror(-err), err); | ||
295 | pr_err("\n"); | ||
296 | } | ||
297 | |||
291 | static int | 298 | static int |
292 | __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | 299 | __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) |
293 | { | 300 | { |
@@ -379,7 +386,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
379 | } | 386 | } |
380 | ret = parse_probe_event_argv(argc, argv); | 387 | ret = parse_probe_event_argv(argc, argv); |
381 | if (ret < 0) { | 388 | if (ret < 0) { |
382 | pr_err(" Error: Parse Error. (%d)\n", ret); | 389 | pr_err_with_code(" Error: Command Parse Error.", ret); |
383 | return ret; | 390 | return ret; |
384 | } | 391 | } |
385 | } | 392 | } |
@@ -419,8 +426,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
419 | } | 426 | } |
420 | ret = show_perf_probe_events(); | 427 | ret = show_perf_probe_events(); |
421 | if (ret < 0) | 428 | if (ret < 0) |
422 | pr_err(" Error: Failed to show event list. (%d)\n", | 429 | pr_err_with_code(" Error: Failed to show event list.", ret); |
423 | ret); | ||
424 | return ret; | 430 | return ret; |
425 | } | 431 | } |
426 | if (params.show_funcs) { | 432 | if (params.show_funcs) { |
@@ -445,8 +451,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
445 | strfilter__delete(params.filter); | 451 | strfilter__delete(params.filter); |
446 | params.filter = NULL; | 452 | params.filter = NULL; |
447 | if (ret < 0) | 453 | if (ret < 0) |
448 | pr_err(" Error: Failed to show functions." | 454 | pr_err_with_code(" Error: Failed to show functions.", ret); |
449 | " (%d)\n", ret); | ||
450 | return ret; | 455 | return ret; |
451 | } | 456 | } |
452 | 457 | ||
@@ -464,7 +469,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
464 | 469 | ||
465 | ret = show_line_range(¶ms.line_range, params.target); | 470 | ret = show_line_range(¶ms.line_range, params.target); |
466 | if (ret < 0) | 471 | if (ret < 0) |
467 | pr_err(" Error: Failed to show lines. (%d)\n", ret); | 472 | pr_err_with_code(" Error: Failed to show lines.", ret); |
468 | return ret; | 473 | return ret; |
469 | } | 474 | } |
470 | if (params.show_vars) { | 475 | if (params.show_vars) { |
@@ -485,7 +490,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
485 | strfilter__delete(params.filter); | 490 | strfilter__delete(params.filter); |
486 | params.filter = NULL; | 491 | params.filter = NULL; |
487 | if (ret < 0) | 492 | if (ret < 0) |
488 | pr_err(" Error: Failed to show vars. (%d)\n", ret); | 493 | pr_err_with_code(" Error: Failed to show vars.", ret); |
489 | return ret; | 494 | return ret; |
490 | } | 495 | } |
491 | #endif | 496 | #endif |
@@ -493,7 +498,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
493 | if (params.dellist) { | 498 | if (params.dellist) { |
494 | ret = del_perf_probe_events(params.dellist); | 499 | ret = del_perf_probe_events(params.dellist); |
495 | if (ret < 0) { | 500 | if (ret < 0) { |
496 | pr_err(" Error: Failed to delete events. (%d)\n", ret); | 501 | pr_err_with_code(" Error: Failed to delete events.", ret); |
497 | return ret; | 502 | return ret; |
498 | } | 503 | } |
499 | } | 504 | } |
@@ -504,7 +509,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
504 | params.target, | 509 | params.target, |
505 | params.force_add); | 510 | params.force_add); |
506 | if (ret < 0) { | 511 | if (ret < 0) { |
507 | pr_err(" Error: Failed to add events. (%d)\n", ret); | 512 | pr_err_with_code(" Error: Failed to add events.", ret); |
508 | return ret; | 513 | return ret; |
509 | } | 514 | } |
510 | } | 515 | } |
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 4f100b54ba8b..f30ac5e5d271 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -299,7 +299,11 @@ else | |||
299 | NO_LIBUNWIND := 1 | 299 | NO_LIBUNWIND := 1 |
300 | NO_LIBDW_DWARF_UNWIND := 1 | 300 | NO_LIBDW_DWARF_UNWIND := 1 |
301 | else | 301 | else |
302 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); | 302 | ifneq ($(filter s% -static%,$(LDFLAGS),),) |
303 | msg := $(error No static glibc found, please install glibc-static); | ||
304 | else | ||
305 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]); | ||
306 | endif | ||
303 | endif | 307 | endif |
304 | else | 308 | else |
305 | ifndef NO_LIBDW_DWARF_UNWIND | 309 | ifndef NO_LIBDW_DWARF_UNWIND |
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 78f7b920e548..95c58fc15284 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -458,6 +458,7 @@ int main(int argc, const char **argv) | |||
458 | 458 | ||
459 | /* The page_size is placed in util object. */ | 459 | /* The page_size is placed in util object. */ |
460 | page_size = sysconf(_SC_PAGE_SIZE); | 460 | page_size = sysconf(_SC_PAGE_SIZE); |
461 | cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE); | ||
461 | 462 | ||
462 | cmd = perf_extract_argv0_path(argv[0]); | 463 | cmd = perf_extract_argv0_path(argv[0]); |
463 | if (!cmd) | 464 | if (!cmd) |
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 802e3cd50f6f..6f8b01bc6033 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c | |||
@@ -3,6 +3,8 @@ | |||
3 | * | 3 | * |
4 | * Builtin regression testing command: ever growing number of sanity tests | 4 | * Builtin regression testing command: ever growing number of sanity tests |
5 | */ | 5 | */ |
6 | #include <unistd.h> | ||
7 | #include <string.h> | ||
6 | #include "builtin.h" | 8 | #include "builtin.h" |
7 | #include "intlist.h" | 9 | #include "intlist.h" |
8 | #include "tests.h" | 10 | #include "tests.h" |
@@ -50,10 +52,18 @@ static struct test { | |||
50 | .func = test__pmu, | 52 | .func = test__pmu, |
51 | }, | 53 | }, |
52 | { | 54 | { |
53 | .desc = "Test dso data interface", | 55 | .desc = "Test dso data read", |
54 | .func = test__dso_data, | 56 | .func = test__dso_data, |
55 | }, | 57 | }, |
56 | { | 58 | { |
59 | .desc = "Test dso data cache", | ||
60 | .func = test__dso_data_cache, | ||
61 | }, | ||
62 | { | ||
63 | .desc = "Test dso data reopen", | ||
64 | .func = test__dso_data_reopen, | ||
65 | }, | ||
66 | { | ||
57 | .desc = "roundtrip evsel->name check", | 67 | .desc = "roundtrip evsel->name check", |
58 | .func = test__perf_evsel__roundtrip_name_test, | 68 | .func = test__perf_evsel__roundtrip_name_test, |
59 | }, | 69 | }, |
@@ -172,6 +182,34 @@ static bool perf_test__matches(int curr, int argc, const char *argv[]) | |||
172 | return false; | 182 | return false; |
173 | } | 183 | } |
174 | 184 | ||
185 | static int run_test(struct test *test) | ||
186 | { | ||
187 | int status, err = -1, child = fork(); | ||
188 | |||
189 | if (child < 0) { | ||
190 | pr_err("failed to fork test: %s\n", strerror(errno)); | ||
191 | return -1; | ||
192 | } | ||
193 | |||
194 | if (!child) { | ||
195 | pr_debug("test child forked, pid %d\n", getpid()); | ||
196 | err = test->func(); | ||
197 | exit(err); | ||
198 | } | ||
199 | |||
200 | wait(&status); | ||
201 | |||
202 | if (WIFEXITED(status)) { | ||
203 | err = WEXITSTATUS(status); | ||
204 | pr_debug("test child finished with %d\n", err); | ||
205 | } else if (WIFSIGNALED(status)) { | ||
206 | err = -1; | ||
207 | pr_debug("test child interrupted\n"); | ||
208 | } | ||
209 | |||
210 | return err; | ||
211 | } | ||
212 | |||
175 | static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) | 213 | static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) |
176 | { | 214 | { |
177 | int i = 0; | 215 | int i = 0; |
@@ -200,7 +238,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) | |||
200 | } | 238 | } |
201 | 239 | ||
202 | pr_debug("\n--- start ---\n"); | 240 | pr_debug("\n--- start ---\n"); |
203 | err = tests[curr].func(); | 241 | err = run_test(&tests[curr]); |
204 | pr_debug("---- end ----\n%s:", tests[curr].desc); | 242 | pr_debug("---- end ----\n%s:", tests[curr].desc); |
205 | 243 | ||
206 | switch (err) { | 244 | switch (err) { |
diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c index 3e6cb171e3d3..630808cd7cc2 100644 --- a/tools/perf/tests/dso-data.c +++ b/tools/perf/tests/dso-data.c | |||
@@ -1,22 +1,27 @@ | |||
1 | #include "util.h" | ||
2 | |||
3 | #include <stdlib.h> | 1 | #include <stdlib.h> |
4 | #include <linux/types.h> | 2 | #include <linux/types.h> |
5 | #include <sys/stat.h> | 3 | #include <sys/stat.h> |
6 | #include <fcntl.h> | 4 | #include <fcntl.h> |
7 | #include <string.h> | 5 | #include <string.h> |
8 | 6 | #include <sys/time.h> | |
7 | #include <sys/resource.h> | ||
8 | #include <api/fs/fs.h> | ||
9 | #include "util.h" | ||
9 | #include "machine.h" | 10 | #include "machine.h" |
10 | #include "symbol.h" | 11 | #include "symbol.h" |
11 | #include "tests.h" | 12 | #include "tests.h" |
12 | 13 | ||
13 | static char *test_file(int size) | 14 | static char *test_file(int size) |
14 | { | 15 | { |
15 | static char buf_templ[] = "/tmp/test-XXXXXX"; | 16 | #define TEMPL "/tmp/perf-test-XXXXXX" |
17 | static char buf_templ[sizeof(TEMPL)]; | ||
16 | char *templ = buf_templ; | 18 | char *templ = buf_templ; |
17 | int fd, i; | 19 | int fd, i; |
18 | unsigned char *buf; | 20 | unsigned char *buf; |
19 | 21 | ||
22 | strcpy(buf_templ, TEMPL); | ||
23 | #undef TEMPL | ||
24 | |||
20 | fd = mkstemp(templ); | 25 | fd = mkstemp(templ); |
21 | if (fd < 0) { | 26 | if (fd < 0) { |
22 | perror("mkstemp failed"); | 27 | perror("mkstemp failed"); |
@@ -150,3 +155,204 @@ int test__dso_data(void) | |||
150 | unlink(file); | 155 | unlink(file); |
151 | return 0; | 156 | return 0; |
152 | } | 157 | } |
158 | |||
159 | static long open_files_cnt(void) | ||
160 | { | ||
161 | char path[PATH_MAX]; | ||
162 | struct dirent *dent; | ||
163 | DIR *dir; | ||
164 | long nr = 0; | ||
165 | |||
166 | scnprintf(path, PATH_MAX, "%s/self/fd", procfs__mountpoint()); | ||
167 | pr_debug("fd path: %s\n", path); | ||
168 | |||
169 | dir = opendir(path); | ||
170 | TEST_ASSERT_VAL("failed to open fd directory", dir); | ||
171 | |||
172 | while ((dent = readdir(dir)) != NULL) { | ||
173 | if (!strcmp(dent->d_name, ".") || | ||
174 | !strcmp(dent->d_name, "..")) | ||
175 | continue; | ||
176 | |||
177 | nr++; | ||
178 | } | ||
179 | |||
180 | closedir(dir); | ||
181 | return nr - 1; | ||
182 | } | ||
183 | |||
184 | static struct dso **dsos; | ||
185 | |||
186 | static int dsos__create(int cnt, int size) | ||
187 | { | ||
188 | int i; | ||
189 | |||
190 | dsos = malloc(sizeof(dsos) * cnt); | ||
191 | TEST_ASSERT_VAL("failed to alloc dsos array", dsos); | ||
192 | |||
193 | for (i = 0; i < cnt; i++) { | ||
194 | char *file; | ||
195 | |||
196 | file = test_file(size); | ||
197 | TEST_ASSERT_VAL("failed to get dso file", file); | ||
198 | |||
199 | dsos[i] = dso__new(file); | ||
200 | TEST_ASSERT_VAL("failed to get dso", dsos[i]); | ||
201 | } | ||
202 | |||
203 | return 0; | ||
204 | } | ||
205 | |||
206 | static void dsos__delete(int cnt) | ||
207 | { | ||
208 | int i; | ||
209 | |||
210 | for (i = 0; i < cnt; i++) { | ||
211 | struct dso *dso = dsos[i]; | ||
212 | |||
213 | unlink(dso->name); | ||
214 | dso__delete(dso); | ||
215 | } | ||
216 | |||
217 | free(dsos); | ||
218 | } | ||
219 | |||
220 | static int set_fd_limit(int n) | ||
221 | { | ||
222 | struct rlimit rlim; | ||
223 | |||
224 | if (getrlimit(RLIMIT_NOFILE, &rlim)) | ||
225 | return -1; | ||
226 | |||
227 | pr_debug("file limit %ld, new %d\n", (long) rlim.rlim_cur, n); | ||
228 | |||
229 | rlim.rlim_cur = n; | ||
230 | return setrlimit(RLIMIT_NOFILE, &rlim); | ||
231 | } | ||
232 | |||
233 | int test__dso_data_cache(void) | ||
234 | { | ||
235 | struct machine machine; | ||
236 | long nr_end, nr = open_files_cnt(); | ||
237 | int dso_cnt, limit, i, fd; | ||
238 | |||
239 | memset(&machine, 0, sizeof(machine)); | ||
240 | |||
241 | /* set as system limit */ | ||
242 | limit = nr * 4; | ||
243 | TEST_ASSERT_VAL("failed to set file limit", !set_fd_limit(limit)); | ||
244 | |||
245 | /* and this is now our dso open FDs limit + 1 extra */ | ||
246 | dso_cnt = limit / 2 + 1; | ||
247 | TEST_ASSERT_VAL("failed to create dsos\n", | ||
248 | !dsos__create(dso_cnt, TEST_FILE_SIZE)); | ||
249 | |||
250 | for (i = 0; i < (dso_cnt - 1); i++) { | ||
251 | struct dso *dso = dsos[i]; | ||
252 | |||
253 | /* | ||
254 | * Open dsos via dso__data_fd or dso__data_read_offset. | ||
255 | * Both opens the data file and keep it open. | ||
256 | */ | ||
257 | if (i % 2) { | ||
258 | fd = dso__data_fd(dso, &machine); | ||
259 | TEST_ASSERT_VAL("failed to get fd", fd > 0); | ||
260 | } else { | ||
261 | #define BUFSIZE 10 | ||
262 | u8 buf[BUFSIZE]; | ||
263 | ssize_t n; | ||
264 | |||
265 | n = dso__data_read_offset(dso, &machine, 0, buf, BUFSIZE); | ||
266 | TEST_ASSERT_VAL("failed to read dso", n == BUFSIZE); | ||
267 | } | ||
268 | } | ||
269 | |||
270 | /* open +1 dso over the allowed limit */ | ||
271 | fd = dso__data_fd(dsos[i], &machine); | ||
272 | TEST_ASSERT_VAL("failed to get fd", fd > 0); | ||
273 | |||
274 | /* should force the first one to be closed */ | ||
275 | TEST_ASSERT_VAL("failed to close dsos[0]", dsos[0]->data.fd == -1); | ||
276 | |||
277 | /* cleanup everything */ | ||
278 | dsos__delete(dso_cnt); | ||
279 | |||
280 | /* Make sure we did not leak any file descriptor. */ | ||
281 | nr_end = open_files_cnt(); | ||
282 | pr_debug("nr start %ld, nr stop %ld\n", nr, nr_end); | ||
283 | TEST_ASSERT_VAL("failed leadking files", nr == nr_end); | ||
284 | return 0; | ||
285 | } | ||
286 | |||
287 | int test__dso_data_reopen(void) | ||
288 | { | ||
289 | struct machine machine; | ||
290 | long nr_end, nr = open_files_cnt(); | ||
291 | int fd, fd_extra; | ||
292 | |||
293 | #define dso_0 (dsos[0]) | ||
294 | #define dso_1 (dsos[1]) | ||
295 | #define dso_2 (dsos[2]) | ||
296 | |||
297 | memset(&machine, 0, sizeof(machine)); | ||
298 | |||
299 | /* | ||
300 | * Test scenario: | ||
301 | * - create 3 dso objects | ||
302 | * - set process file descriptor limit to current | ||
303 | * files count + 3 | ||
304 | * - test that the first dso gets closed when we | ||
305 | * reach the files count limit | ||
306 | */ | ||
307 | |||
308 | /* Make sure we are able to open 3 fds anyway */ | ||
309 | TEST_ASSERT_VAL("failed to set file limit", | ||
310 | !set_fd_limit((nr + 3))); | ||
311 | |||
312 | TEST_ASSERT_VAL("failed to create dsos\n", !dsos__create(3, TEST_FILE_SIZE)); | ||
313 | |||
314 | /* open dso_0 */ | ||
315 | fd = dso__data_fd(dso_0, &machine); | ||
316 | TEST_ASSERT_VAL("failed to get fd", fd > 0); | ||
317 | |||
318 | /* open dso_1 */ | ||
319 | fd = dso__data_fd(dso_1, &machine); | ||
320 | TEST_ASSERT_VAL("failed to get fd", fd > 0); | ||
321 | |||
322 | /* | ||
323 | * open extra file descriptor and we just | ||
324 | * reached the files count limit | ||
325 | */ | ||
326 | fd_extra = open("/dev/null", O_RDONLY); | ||
327 | TEST_ASSERT_VAL("failed to open extra fd", fd_extra > 0); | ||
328 | |||
329 | /* open dso_2 */ | ||
330 | fd = dso__data_fd(dso_2, &machine); | ||
331 | TEST_ASSERT_VAL("failed to get fd", fd > 0); | ||
332 | |||
333 | /* | ||
334 | * dso_0 should get closed, because we reached | ||
335 | * the file descriptor limit | ||
336 | */ | ||
337 | TEST_ASSERT_VAL("failed to close dso_0", dso_0->data.fd == -1); | ||
338 | |||
339 | /* open dso_0 */ | ||
340 | fd = dso__data_fd(dso_0, &machine); | ||
341 | TEST_ASSERT_VAL("failed to get fd", fd > 0); | ||
342 | |||
343 | /* | ||
344 | * dso_1 should get closed, because we reached | ||
345 | * the file descriptor limit | ||
346 | */ | ||
347 | TEST_ASSERT_VAL("failed to close dso_1", dso_1->data.fd == -1); | ||
348 | |||
349 | /* cleanup everything */ | ||
350 | close(fd_extra); | ||
351 | dsos__delete(3); | ||
352 | |||
353 | /* Make sure we did not leak any file descriptor. */ | ||
354 | nr_end = open_files_cnt(); | ||
355 | pr_debug("nr start %ld, nr stop %ld\n", nr, nr_end); | ||
356 | TEST_ASSERT_VAL("failed leadking files", nr == nr_end); | ||
357 | return 0; | ||
358 | } | ||
diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c index 108f0cd49f4e..96adb730b744 100644 --- a/tools/perf/tests/dwarf-unwind.c +++ b/tools/perf/tests/dwarf-unwind.c | |||
@@ -15,7 +15,7 @@ static int mmap_handler(struct perf_tool *tool __maybe_unused, | |||
15 | struct perf_sample *sample __maybe_unused, | 15 | struct perf_sample *sample __maybe_unused, |
16 | struct machine *machine) | 16 | struct machine *machine) |
17 | { | 17 | { |
18 | return machine__process_mmap_event(machine, event, NULL); | 18 | return machine__process_mmap2_event(machine, event, NULL); |
19 | } | 19 | } |
20 | 20 | ||
21 | static int init_live_machine(struct machine *machine) | 21 | static int init_live_machine(struct machine *machine) |
diff --git a/tools/perf/tests/make b/tools/perf/tests/make index 2f92d6e7ee00..69a71ff84e01 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make | |||
@@ -205,8 +205,7 @@ $(run): | |||
205 | ( eval $$cmd ) >> $@ 2>&1; \ | 205 | ( eval $$cmd ) >> $@ 2>&1; \ |
206 | echo " test: $(call test,$@)" >> $@ 2>&1; \ | 206 | echo " test: $(call test,$@)" >> $@ 2>&1; \ |
207 | $(call test,$@) && \ | 207 | $(call test,$@) && \ |
208 | rm -f $@ \ | 208 | rm -rf $@ $$TMP_DEST || (cat $@ ; false) |
209 | rm -rf $$TMP_DEST | ||
210 | 209 | ||
211 | $(run_O): | 210 | $(run_O): |
212 | $(call clean) | 211 | $(call clean) |
@@ -217,9 +216,7 @@ $(run_O): | |||
217 | ( eval $$cmd ) >> $@ 2>&1 && \ | 216 | ( eval $$cmd ) >> $@ 2>&1 && \ |
218 | echo " test: $(call test_O,$@)" >> $@ 2>&1; \ | 217 | echo " test: $(call test_O,$@)" >> $@ 2>&1; \ |
219 | $(call test_O,$@) && \ | 218 | $(call test_O,$@) && \ |
220 | rm -f $@ && \ | 219 | rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false) |
221 | rm -rf $$TMP_O \ | ||
222 | rm -rf $$TMP_DEST | ||
223 | 220 | ||
224 | tarpkg: | 221 | tarpkg: |
225 | @cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \ | 222 | @cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \ |
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h index 022bb68fd9c7..ed64790a395f 100644 --- a/tools/perf/tests/tests.h +++ b/tools/perf/tests/tests.h | |||
@@ -28,6 +28,8 @@ int test__syscall_open_tp_fields(void); | |||
28 | int test__pmu(void); | 28 | int test__pmu(void); |
29 | int test__attr(void); | 29 | int test__attr(void); |
30 | int test__dso_data(void); | 30 | int test__dso_data(void); |
31 | int test__dso_data_cache(void); | ||
32 | int test__dso_data_reopen(void); | ||
31 | int test__parse_events(void); | 33 | int test__parse_events(void); |
32 | int test__hists_link(void); | 34 | int test__hists_link(void); |
33 | int test__python_use(void); | 35 | int test__python_use(void); |
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 64453d63b971..819f10414f08 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c | |||
@@ -1,3 +1,6 @@ | |||
1 | #include <asm/bug.h> | ||
2 | #include <sys/time.h> | ||
3 | #include <sys/resource.h> | ||
1 | #include "symbol.h" | 4 | #include "symbol.h" |
2 | #include "dso.h" | 5 | #include "dso.h" |
3 | #include "machine.h" | 6 | #include "machine.h" |
@@ -136,7 +139,48 @@ int dso__read_binary_type_filename(const struct dso *dso, | |||
136 | return ret; | 139 | return ret; |
137 | } | 140 | } |
138 | 141 | ||
139 | static int open_dso(struct dso *dso, struct machine *machine) | 142 | /* |
143 | * Global list of open DSOs and the counter. | ||
144 | */ | ||
145 | static LIST_HEAD(dso__data_open); | ||
146 | static long dso__data_open_cnt; | ||
147 | |||
148 | static void dso__list_add(struct dso *dso) | ||
149 | { | ||
150 | list_add_tail(&dso->data.open_entry, &dso__data_open); | ||
151 | dso__data_open_cnt++; | ||
152 | } | ||
153 | |||
154 | static void dso__list_del(struct dso *dso) | ||
155 | { | ||
156 | list_del(&dso->data.open_entry); | ||
157 | WARN_ONCE(dso__data_open_cnt <= 0, | ||
158 | "DSO data fd counter out of bounds."); | ||
159 | dso__data_open_cnt--; | ||
160 | } | ||
161 | |||
162 | static void close_first_dso(void); | ||
163 | |||
164 | static int do_open(char *name) | ||
165 | { | ||
166 | int fd; | ||
167 | |||
168 | do { | ||
169 | fd = open(name, O_RDONLY); | ||
170 | if (fd >= 0) | ||
171 | return fd; | ||
172 | |||
173 | pr_debug("dso open failed, mmap: %s\n", strerror(errno)); | ||
174 | if (!dso__data_open_cnt || errno != EMFILE) | ||
175 | break; | ||
176 | |||
177 | close_first_dso(); | ||
178 | } while (1); | ||
179 | |||
180 | return -1; | ||
181 | } | ||
182 | |||
183 | static int __open_dso(struct dso *dso, struct machine *machine) | ||
140 | { | 184 | { |
141 | int fd; | 185 | int fd; |
142 | char *root_dir = (char *)""; | 186 | char *root_dir = (char *)""; |
@@ -154,11 +198,130 @@ static int open_dso(struct dso *dso, struct machine *machine) | |||
154 | return -EINVAL; | 198 | return -EINVAL; |
155 | } | 199 | } |
156 | 200 | ||
157 | fd = open(name, O_RDONLY); | 201 | fd = do_open(name); |
158 | free(name); | 202 | free(name); |
159 | return fd; | 203 | return fd; |
160 | } | 204 | } |
161 | 205 | ||
206 | static void check_data_close(void); | ||
207 | |||
208 | /** | ||
209 | * dso_close - Open DSO data file | ||
210 | * @dso: dso object | ||
211 | * | ||
212 | * Open @dso's data file descriptor and updates | ||
213 | * list/count of open DSO objects. | ||
214 | */ | ||
215 | static int open_dso(struct dso *dso, struct machine *machine) | ||
216 | { | ||
217 | int fd = __open_dso(dso, machine); | ||
218 | |||
219 | if (fd > 0) { | ||
220 | dso__list_add(dso); | ||
221 | /* | ||
222 | * Check if we crossed the allowed number | ||
223 | * of opened DSOs and close one if needed. | ||
224 | */ | ||
225 | check_data_close(); | ||
226 | } | ||
227 | |||
228 | return fd; | ||
229 | } | ||
230 | |||
231 | static void close_data_fd(struct dso *dso) | ||
232 | { | ||
233 | if (dso->data.fd >= 0) { | ||
234 | close(dso->data.fd); | ||
235 | dso->data.fd = -1; | ||
236 | dso->data.file_size = 0; | ||
237 | dso__list_del(dso); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | /** | ||
242 | * dso_close - Close DSO data file | ||
243 | * @dso: dso object | ||
244 | * | ||
245 | * Close @dso's data file descriptor and updates | ||
246 | * list/count of open DSO objects. | ||
247 | */ | ||
248 | static void close_dso(struct dso *dso) | ||
249 | { | ||
250 | close_data_fd(dso); | ||
251 | } | ||
252 | |||
253 | static void close_first_dso(void) | ||
254 | { | ||
255 | struct dso *dso; | ||
256 | |||
257 | dso = list_first_entry(&dso__data_open, struct dso, data.open_entry); | ||
258 | close_dso(dso); | ||
259 | } | ||
260 | |||
261 | static rlim_t get_fd_limit(void) | ||
262 | { | ||
263 | struct rlimit l; | ||
264 | rlim_t limit = 0; | ||
265 | |||
266 | /* Allow half of the current open fd limit. */ | ||
267 | if (getrlimit(RLIMIT_NOFILE, &l) == 0) { | ||
268 | if (l.rlim_cur == RLIM_INFINITY) | ||
269 | limit = l.rlim_cur; | ||
270 | else | ||
271 | limit = l.rlim_cur / 2; | ||
272 | } else { | ||
273 | pr_err("failed to get fd limit\n"); | ||
274 | limit = 1; | ||
275 | } | ||
276 | |||
277 | return limit; | ||
278 | } | ||
279 | |||
280 | static bool may_cache_fd(void) | ||
281 | { | ||
282 | static rlim_t limit; | ||
283 | |||
284 | if (!limit) | ||
285 | limit = get_fd_limit(); | ||
286 | |||
287 | if (limit == RLIM_INFINITY) | ||
288 | return true; | ||
289 | |||
290 | return limit > (rlim_t) dso__data_open_cnt; | ||
291 | } | ||
292 | |||
293 | /* | ||
294 | * Check and close LRU dso if we crossed allowed limit | ||
295 | * for opened dso file descriptors. The limit is half | ||
296 | * of the RLIMIT_NOFILE files opened. | ||
297 | */ | ||
298 | static void check_data_close(void) | ||
299 | { | ||
300 | bool cache_fd = may_cache_fd(); | ||
301 | |||
302 | if (!cache_fd) | ||
303 | close_first_dso(); | ||
304 | } | ||
305 | |||
306 | /** | ||
307 | * dso__data_close - Close DSO data file | ||
308 | * @dso: dso object | ||
309 | * | ||
310 | * External interface to close @dso's data file descriptor. | ||
311 | */ | ||
312 | void dso__data_close(struct dso *dso) | ||
313 | { | ||
314 | close_dso(dso); | ||
315 | } | ||
316 | |||
317 | /** | ||
318 | * dso__data_fd - Get dso's data file descriptor | ||
319 | * @dso: dso object | ||
320 | * @machine: machine object | ||
321 | * | ||
322 | * External interface to find dso's file, open it and | ||
323 | * returns file descriptor. | ||
324 | */ | ||
162 | int dso__data_fd(struct dso *dso, struct machine *machine) | 325 | int dso__data_fd(struct dso *dso, struct machine *machine) |
163 | { | 326 | { |
164 | enum dso_binary_type binary_type_data[] = { | 327 | enum dso_binary_type binary_type_data[] = { |
@@ -168,8 +331,13 @@ int dso__data_fd(struct dso *dso, struct machine *machine) | |||
168 | }; | 331 | }; |
169 | int i = 0; | 332 | int i = 0; |
170 | 333 | ||
171 | if (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND) | 334 | if (dso->data.fd >= 0) |
172 | return open_dso(dso, machine); | 335 | return dso->data.fd; |
336 | |||
337 | if (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND) { | ||
338 | dso->data.fd = open_dso(dso, machine); | ||
339 | return dso->data.fd; | ||
340 | } | ||
173 | 341 | ||
174 | do { | 342 | do { |
175 | int fd; | 343 | int fd; |
@@ -178,7 +346,7 @@ int dso__data_fd(struct dso *dso, struct machine *machine) | |||
178 | 346 | ||
179 | fd = open_dso(dso, machine); | 347 | fd = open_dso(dso, machine); |
180 | if (fd >= 0) | 348 | if (fd >= 0) |
181 | return fd; | 349 | return dso->data.fd = fd; |
182 | 350 | ||
183 | } while (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND); | 351 | } while (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND); |
184 | 352 | ||
@@ -260,16 +428,10 @@ dso_cache__memcpy(struct dso_cache *cache, u64 offset, | |||
260 | } | 428 | } |
261 | 429 | ||
262 | static ssize_t | 430 | static ssize_t |
263 | dso_cache__read(struct dso *dso, struct machine *machine, | 431 | dso_cache__read(struct dso *dso, u64 offset, u8 *data, ssize_t size) |
264 | u64 offset, u8 *data, ssize_t size) | ||
265 | { | 432 | { |
266 | struct dso_cache *cache; | 433 | struct dso_cache *cache; |
267 | ssize_t ret; | 434 | ssize_t ret; |
268 | int fd; | ||
269 | |||
270 | fd = dso__data_fd(dso, machine); | ||
271 | if (fd < 0) | ||
272 | return -1; | ||
273 | 435 | ||
274 | do { | 436 | do { |
275 | u64 cache_offset; | 437 | u64 cache_offset; |
@@ -283,16 +445,16 @@ dso_cache__read(struct dso *dso, struct machine *machine, | |||
283 | cache_offset = offset & DSO__DATA_CACHE_MASK; | 445 | cache_offset = offset & DSO__DATA_CACHE_MASK; |
284 | ret = -EINVAL; | 446 | ret = -EINVAL; |
285 | 447 | ||
286 | if (-1 == lseek(fd, cache_offset, SEEK_SET)) | 448 | if (-1 == lseek(dso->data.fd, cache_offset, SEEK_SET)) |
287 | break; | 449 | break; |
288 | 450 | ||
289 | ret = read(fd, cache->data, DSO__DATA_CACHE_SIZE); | 451 | ret = read(dso->data.fd, cache->data, DSO__DATA_CACHE_SIZE); |
290 | if (ret <= 0) | 452 | if (ret <= 0) |
291 | break; | 453 | break; |
292 | 454 | ||
293 | cache->offset = cache_offset; | 455 | cache->offset = cache_offset; |
294 | cache->size = ret; | 456 | cache->size = ret; |
295 | dso_cache__insert(&dso->cache, cache); | 457 | dso_cache__insert(&dso->data.cache, cache); |
296 | 458 | ||
297 | ret = dso_cache__memcpy(cache, offset, data, size); | 459 | ret = dso_cache__memcpy(cache, offset, data, size); |
298 | 460 | ||
@@ -301,24 +463,27 @@ dso_cache__read(struct dso *dso, struct machine *machine, | |||
301 | if (ret <= 0) | 463 | if (ret <= 0) |
302 | free(cache); | 464 | free(cache); |
303 | 465 | ||
304 | close(fd); | ||
305 | return ret; | 466 | return ret; |
306 | } | 467 | } |
307 | 468 | ||
308 | static ssize_t dso_cache_read(struct dso *dso, struct machine *machine, | 469 | static ssize_t dso_cache_read(struct dso *dso, u64 offset, |
309 | u64 offset, u8 *data, ssize_t size) | 470 | u8 *data, ssize_t size) |
310 | { | 471 | { |
311 | struct dso_cache *cache; | 472 | struct dso_cache *cache; |
312 | 473 | ||
313 | cache = dso_cache__find(&dso->cache, offset); | 474 | cache = dso_cache__find(&dso->data.cache, offset); |
314 | if (cache) | 475 | if (cache) |
315 | return dso_cache__memcpy(cache, offset, data, size); | 476 | return dso_cache__memcpy(cache, offset, data, size); |
316 | else | 477 | else |
317 | return dso_cache__read(dso, machine, offset, data, size); | 478 | return dso_cache__read(dso, offset, data, size); |
318 | } | 479 | } |
319 | 480 | ||
320 | ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine, | 481 | /* |
321 | u64 offset, u8 *data, ssize_t size) | 482 | * Reads and caches dso data DSO__DATA_CACHE_SIZE size chunks |
483 | * in the rb_tree. Any read to already cached data is served | ||
484 | * by cached data. | ||
485 | */ | ||
486 | static ssize_t cached_read(struct dso *dso, u64 offset, u8 *data, ssize_t size) | ||
322 | { | 487 | { |
323 | ssize_t r = 0; | 488 | ssize_t r = 0; |
324 | u8 *p = data; | 489 | u8 *p = data; |
@@ -326,7 +491,7 @@ ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine, | |||
326 | do { | 491 | do { |
327 | ssize_t ret; | 492 | ssize_t ret; |
328 | 493 | ||
329 | ret = dso_cache_read(dso, machine, offset, p, size); | 494 | ret = dso_cache_read(dso, offset, p, size); |
330 | if (ret < 0) | 495 | if (ret < 0) |
331 | return ret; | 496 | return ret; |
332 | 497 | ||
@@ -346,6 +511,67 @@ ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine, | |||
346 | return r; | 511 | return r; |
347 | } | 512 | } |
348 | 513 | ||
514 | static int data_file_size(struct dso *dso) | ||
515 | { | ||
516 | struct stat st; | ||
517 | |||
518 | if (!dso->data.file_size) { | ||
519 | if (fstat(dso->data.fd, &st)) { | ||
520 | pr_err("dso mmap failed, fstat: %s\n", strerror(errno)); | ||
521 | return -1; | ||
522 | } | ||
523 | dso->data.file_size = st.st_size; | ||
524 | } | ||
525 | |||
526 | return 0; | ||
527 | } | ||
528 | |||
529 | static ssize_t data_read_offset(struct dso *dso, u64 offset, | ||
530 | u8 *data, ssize_t size) | ||
531 | { | ||
532 | if (data_file_size(dso)) | ||
533 | return -1; | ||
534 | |||
535 | /* Check the offset sanity. */ | ||
536 | if (offset > dso->data.file_size) | ||
537 | return -1; | ||
538 | |||
539 | if (offset + size < offset) | ||
540 | return -1; | ||
541 | |||
542 | return cached_read(dso, offset, data, size); | ||
543 | } | ||
544 | |||
545 | /** | ||
546 | * dso__data_read_offset - Read data from dso file offset | ||
547 | * @dso: dso object | ||
548 | * @machine: machine object | ||
549 | * @offset: file offset | ||
550 | * @data: buffer to store data | ||
551 | * @size: size of the @data buffer | ||
552 | * | ||
553 | * External interface to read data from dso file offset. Open | ||
554 | * dso data file and use cached_read to get the data. | ||
555 | */ | ||
556 | ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine, | ||
557 | u64 offset, u8 *data, ssize_t size) | ||
558 | { | ||
559 | if (dso__data_fd(dso, machine) < 0) | ||
560 | return -1; | ||
561 | |||
562 | return data_read_offset(dso, offset, data, size); | ||
563 | } | ||
564 | |||
565 | /** | ||
566 | * dso__data_read_addr - Read data from dso address | ||
567 | * @dso: dso object | ||
568 | * @machine: machine object | ||
569 | * @add: virtual memory address | ||
570 | * @data: buffer to store data | ||
571 | * @size: size of the @data buffer | ||
572 | * | ||
573 | * External interface to read data from dso address. | ||
574 | */ | ||
349 | ssize_t dso__data_read_addr(struct dso *dso, struct map *map, | 575 | ssize_t dso__data_read_addr(struct dso *dso, struct map *map, |
350 | struct machine *machine, u64 addr, | 576 | struct machine *machine, u64 addr, |
351 | u8 *data, ssize_t size) | 577 | u8 *data, ssize_t size) |
@@ -473,7 +699,8 @@ struct dso *dso__new(const char *name) | |||
473 | dso__set_short_name(dso, dso->name, false); | 699 | dso__set_short_name(dso, dso->name, false); |
474 | for (i = 0; i < MAP__NR_TYPES; ++i) | 700 | for (i = 0; i < MAP__NR_TYPES; ++i) |
475 | dso->symbols[i] = dso->symbol_names[i] = RB_ROOT; | 701 | dso->symbols[i] = dso->symbol_names[i] = RB_ROOT; |
476 | dso->cache = RB_ROOT; | 702 | dso->data.cache = RB_ROOT; |
703 | dso->data.fd = -1; | ||
477 | dso->symtab_type = DSO_BINARY_TYPE__NOT_FOUND; | 704 | dso->symtab_type = DSO_BINARY_TYPE__NOT_FOUND; |
478 | dso->binary_type = DSO_BINARY_TYPE__NOT_FOUND; | 705 | dso->binary_type = DSO_BINARY_TYPE__NOT_FOUND; |
479 | dso->loaded = 0; | 706 | dso->loaded = 0; |
@@ -485,6 +712,7 @@ struct dso *dso__new(const char *name) | |||
485 | dso->kernel = DSO_TYPE_USER; | 712 | dso->kernel = DSO_TYPE_USER; |
486 | dso->needs_swap = DSO_SWAP__UNSET; | 713 | dso->needs_swap = DSO_SWAP__UNSET; |
487 | INIT_LIST_HEAD(&dso->node); | 714 | INIT_LIST_HEAD(&dso->node); |
715 | INIT_LIST_HEAD(&dso->data.open_entry); | ||
488 | } | 716 | } |
489 | 717 | ||
490 | return dso; | 718 | return dso; |
@@ -506,7 +734,8 @@ void dso__delete(struct dso *dso) | |||
506 | dso->long_name_allocated = false; | 734 | dso->long_name_allocated = false; |
507 | } | 735 | } |
508 | 736 | ||
509 | dso_cache__free(&dso->cache); | 737 | dso__data_close(dso); |
738 | dso_cache__free(&dso->data.cache); | ||
510 | dso__free_a2l(dso); | 739 | dso__free_a2l(dso); |
511 | zfree(&dso->symsrc_filename); | 740 | zfree(&dso->symsrc_filename); |
512 | free(dso); | 741 | free(dso); |
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index 38efe95a7fdd..ad553ba257bf 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h | |||
@@ -76,7 +76,6 @@ struct dso { | |||
76 | struct list_head node; | 76 | struct list_head node; |
77 | struct rb_root symbols[MAP__NR_TYPES]; | 77 | struct rb_root symbols[MAP__NR_TYPES]; |
78 | struct rb_root symbol_names[MAP__NR_TYPES]; | 78 | struct rb_root symbol_names[MAP__NR_TYPES]; |
79 | struct rb_root cache; | ||
80 | void *a2l; | 79 | void *a2l; |
81 | char *symsrc_filename; | 80 | char *symsrc_filename; |
82 | unsigned int a2l_fails; | 81 | unsigned int a2l_fails; |
@@ -99,6 +98,15 @@ struct dso { | |||
99 | const char *long_name; | 98 | const char *long_name; |
100 | u16 long_name_len; | 99 | u16 long_name_len; |
101 | u16 short_name_len; | 100 | u16 short_name_len; |
101 | |||
102 | /* dso data file */ | ||
103 | struct { | ||
104 | struct rb_root cache; | ||
105 | int fd; | ||
106 | size_t file_size; | ||
107 | struct list_head open_entry; | ||
108 | } data; | ||
109 | |||
102 | char name[0]; | 110 | char name[0]; |
103 | }; | 111 | }; |
104 | 112 | ||
@@ -141,7 +149,47 @@ char dso__symtab_origin(const struct dso *dso); | |||
141 | int dso__read_binary_type_filename(const struct dso *dso, enum dso_binary_type type, | 149 | int dso__read_binary_type_filename(const struct dso *dso, enum dso_binary_type type, |
142 | char *root_dir, char *filename, size_t size); | 150 | char *root_dir, char *filename, size_t size); |
143 | 151 | ||
152 | /* | ||
153 | * The dso__data_* external interface provides following functions: | ||
154 | * dso__data_fd | ||
155 | * dso__data_close | ||
156 | * dso__data_read_offset | ||
157 | * dso__data_read_addr | ||
158 | * | ||
159 | * Please refer to the dso.c object code for each function and | ||
160 | * arguments documentation. Following text tries to explain the | ||
161 | * dso file descriptor caching. | ||
162 | * | ||
163 | * The dso__data* interface allows caching of opened file descriptors | ||
164 | * to speed up the dso data accesses. The idea is to leave the file | ||
165 | * descriptor opened ideally for the whole life of the dso object. | ||
166 | * | ||
167 | * The current usage of the dso__data_* interface is as follows: | ||
168 | * | ||
169 | * Get DSO's fd: | ||
170 | * int fd = dso__data_fd(dso, machine); | ||
171 | * USE 'fd' SOMEHOW | ||
172 | * | ||
173 | * Read DSO's data: | ||
174 | * n = dso__data_read_offset(dso_0, &machine, 0, buf, BUFSIZE); | ||
175 | * n = dso__data_read_addr(dso_0, &machine, 0, buf, BUFSIZE); | ||
176 | * | ||
177 | * Eventually close DSO's fd: | ||
178 | * dso__data_close(dso); | ||
179 | * | ||
180 | * It is not necessary to close the DSO object data file. Each time new | ||
181 | * DSO data file is opened, the limit (RLIMIT_NOFILE/2) is checked. Once | ||
182 | * it is crossed, the oldest opened DSO object is closed. | ||
183 | * | ||
184 | * The dso__delete function calls close_dso function to ensure the | ||
185 | * data file descriptor gets closed/unmapped before the dso object | ||
186 | * is freed. | ||
187 | * | ||
188 | * TODO | ||
189 | */ | ||
144 | int dso__data_fd(struct dso *dso, struct machine *machine); | 190 | int dso__data_fd(struct dso *dso, struct machine *machine); |
191 | void dso__data_close(struct dso *dso); | ||
192 | |||
145 | ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine, | 193 | ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine, |
146 | u64 offset, u8 *data, ssize_t size); | 194 | u64 offset, u8 *data, ssize_t size); |
147 | ssize_t dso__data_read_addr(struct dso *dso, struct map *map, | 195 | ssize_t dso__data_read_addr(struct dso *dso, struct map *map, |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 65795b835b39..d0281bdfa582 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include <linux/types.h> | 1 | #include <linux/types.h> |
2 | #include <sys/mman.h> | ||
2 | #include "event.h" | 3 | #include "event.h" |
3 | #include "debug.h" | 4 | #include "debug.h" |
4 | #include "hist.h" | 5 | #include "hist.h" |
@@ -178,13 +179,14 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
178 | return -1; | 179 | return -1; |
179 | } | 180 | } |
180 | 181 | ||
181 | event->header.type = PERF_RECORD_MMAP; | 182 | event->header.type = PERF_RECORD_MMAP2; |
182 | 183 | ||
183 | while (1) { | 184 | while (1) { |
184 | char bf[BUFSIZ]; | 185 | char bf[BUFSIZ]; |
185 | char prot[5]; | 186 | char prot[5]; |
186 | char execname[PATH_MAX]; | 187 | char execname[PATH_MAX]; |
187 | char anonstr[] = "//anon"; | 188 | char anonstr[] = "//anon"; |
189 | unsigned int ino; | ||
188 | size_t size; | 190 | size_t size; |
189 | ssize_t n; | 191 | ssize_t n; |
190 | 192 | ||
@@ -195,15 +197,20 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
195 | strcpy(execname, ""); | 197 | strcpy(execname, ""); |
196 | 198 | ||
197 | /* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */ | 199 | /* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */ |
198 | n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %*x:%*x %*u %s\n", | 200 | n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %x:%x %u %s\n", |
199 | &event->mmap.start, &event->mmap.len, prot, | 201 | &event->mmap2.start, &event->mmap2.len, prot, |
200 | &event->mmap.pgoff, | 202 | &event->mmap2.pgoff, &event->mmap2.maj, |
201 | execname); | 203 | &event->mmap2.min, |
204 | &ino, execname); | ||
205 | |||
202 | /* | 206 | /* |
203 | * Anon maps don't have the execname. | 207 | * Anon maps don't have the execname. |
204 | */ | 208 | */ |
205 | if (n < 4) | 209 | if (n < 7) |
206 | continue; | 210 | continue; |
211 | |||
212 | event->mmap2.ino = (u64)ino; | ||
213 | |||
207 | /* | 214 | /* |
208 | * Just like the kernel, see __perf_event_mmap in kernel/perf_event.c | 215 | * Just like the kernel, see __perf_event_mmap in kernel/perf_event.c |
209 | */ | 216 | */ |
@@ -212,6 +219,21 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
212 | else | 219 | else |
213 | event->header.misc = PERF_RECORD_MISC_GUEST_USER; | 220 | event->header.misc = PERF_RECORD_MISC_GUEST_USER; |
214 | 221 | ||
222 | /* map protection and flags bits */ | ||
223 | event->mmap2.prot = 0; | ||
224 | event->mmap2.flags = 0; | ||
225 | if (prot[0] == 'r') | ||
226 | event->mmap2.prot |= PROT_READ; | ||
227 | if (prot[1] == 'w') | ||
228 | event->mmap2.prot |= PROT_WRITE; | ||
229 | if (prot[2] == 'x') | ||
230 | event->mmap2.prot |= PROT_EXEC; | ||
231 | |||
232 | if (prot[3] == 's') | ||
233 | event->mmap2.flags |= MAP_SHARED; | ||
234 | else | ||
235 | event->mmap2.flags |= MAP_PRIVATE; | ||
236 | |||
215 | if (prot[2] != 'x') { | 237 | if (prot[2] != 'x') { |
216 | if (!mmap_data || prot[0] != 'r') | 238 | if (!mmap_data || prot[0] != 'r') |
217 | continue; | 239 | continue; |
@@ -223,15 +245,15 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
223 | strcpy(execname, anonstr); | 245 | strcpy(execname, anonstr); |
224 | 246 | ||
225 | size = strlen(execname) + 1; | 247 | size = strlen(execname) + 1; |
226 | memcpy(event->mmap.filename, execname, size); | 248 | memcpy(event->mmap2.filename, execname, size); |
227 | size = PERF_ALIGN(size, sizeof(u64)); | 249 | size = PERF_ALIGN(size, sizeof(u64)); |
228 | event->mmap.len -= event->mmap.start; | 250 | event->mmap2.len -= event->mmap.start; |
229 | event->mmap.header.size = (sizeof(event->mmap) - | 251 | event->mmap2.header.size = (sizeof(event->mmap2) - |
230 | (sizeof(event->mmap.filename) - size)); | 252 | (sizeof(event->mmap2.filename) - size)); |
231 | memset(event->mmap.filename + size, 0, machine->id_hdr_size); | 253 | memset(event->mmap2.filename + size, 0, machine->id_hdr_size); |
232 | event->mmap.header.size += machine->id_hdr_size; | 254 | event->mmap2.header.size += machine->id_hdr_size; |
233 | event->mmap.pid = tgid; | 255 | event->mmap2.pid = tgid; |
234 | event->mmap.tid = pid; | 256 | event->mmap2.tid = pid; |
235 | 257 | ||
236 | if (process(tool, event, &synth_sample, machine) != 0) { | 258 | if (process(tool, event, &synth_sample, machine) != 0) { |
237 | rc = -1; | 259 | rc = -1; |
@@ -612,12 +634,15 @@ size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp) | |||
612 | size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp) | 634 | size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp) |
613 | { | 635 | { |
614 | return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 | 636 | return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 |
615 | " %02x:%02x %"PRIu64" %"PRIu64"]: %c %s\n", | 637 | " %02x:%02x %"PRIu64" %"PRIu64"]: %c%c%c%c %s\n", |
616 | event->mmap2.pid, event->mmap2.tid, event->mmap2.start, | 638 | event->mmap2.pid, event->mmap2.tid, event->mmap2.start, |
617 | event->mmap2.len, event->mmap2.pgoff, event->mmap2.maj, | 639 | event->mmap2.len, event->mmap2.pgoff, event->mmap2.maj, |
618 | event->mmap2.min, event->mmap2.ino, | 640 | event->mmap2.min, event->mmap2.ino, |
619 | event->mmap2.ino_generation, | 641 | event->mmap2.ino_generation, |
620 | (event->header.misc & PERF_RECORD_MISC_MMAP_DATA) ? 'r' : 'x', | 642 | (event->mmap2.prot & PROT_READ) ? 'r' : '-', |
643 | (event->mmap2.prot & PROT_WRITE) ? 'w' : '-', | ||
644 | (event->mmap2.prot & PROT_EXEC) ? 'x' : '-', | ||
645 | (event->mmap2.flags & MAP_SHARED) ? 's' : 'p', | ||
621 | event->mmap2.filename); | 646 | event->mmap2.filename); |
622 | } | 647 | } |
623 | 648 | ||
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index d970232cb270..e5dd40addb30 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "../perf.h" | 7 | #include "../perf.h" |
8 | #include "map.h" | 8 | #include "map.h" |
9 | #include "build-id.h" | 9 | #include "build-id.h" |
10 | #include "perf_regs.h" | ||
10 | 11 | ||
11 | struct mmap_event { | 12 | struct mmap_event { |
12 | struct perf_event_header header; | 13 | struct perf_event_header header; |
@@ -27,6 +28,8 @@ struct mmap2_event { | |||
27 | u32 min; | 28 | u32 min; |
28 | u64 ino; | 29 | u64 ino; |
29 | u64 ino_generation; | 30 | u64 ino_generation; |
31 | u32 prot; | ||
32 | u32 flags; | ||
30 | char filename[PATH_MAX]; | 33 | char filename[PATH_MAX]; |
31 | }; | 34 | }; |
32 | 35 | ||
@@ -87,6 +90,10 @@ struct regs_dump { | |||
87 | u64 abi; | 90 | u64 abi; |
88 | u64 mask; | 91 | u64 mask; |
89 | u64 *regs; | 92 | u64 *regs; |
93 | |||
94 | /* Cached values/mask filled by first register access. */ | ||
95 | u64 cache_regs[PERF_REGS_MAX]; | ||
96 | u64 cache_mask; | ||
90 | }; | 97 | }; |
91 | 98 | ||
92 | struct stack_dump { | 99 | struct stack_dump { |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 5c28d82b76c4..8606175fe1e8 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -589,10 +589,10 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts) | |||
589 | } | 589 | } |
590 | 590 | ||
591 | /* | 591 | /* |
592 | * We default some events to a 1 default interval. But keep | 592 | * We default some events to have a default interval. But keep |
593 | * it a weak assumption overridable by the user. | 593 | * it a weak assumption overridable by the user. |
594 | */ | 594 | */ |
595 | if (!attr->sample_period || (opts->user_freq != UINT_MAX && | 595 | if (!attr->sample_period || (opts->user_freq != UINT_MAX || |
596 | opts->user_interval != ULLONG_MAX)) { | 596 | opts->user_interval != ULLONG_MAX)) { |
597 | if (opts->freq) { | 597 | if (opts->freq) { |
598 | perf_evsel__set_sample_bit(evsel, PERIOD); | 598 | perf_evsel__set_sample_bit(evsel, PERIOD); |
@@ -659,6 +659,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts) | |||
659 | perf_evsel__set_sample_bit(evsel, WEIGHT); | 659 | perf_evsel__set_sample_bit(evsel, WEIGHT); |
660 | 660 | ||
661 | attr->mmap = track; | 661 | attr->mmap = track; |
662 | attr->mmap2 = track && !perf_missing_features.mmap2; | ||
662 | attr->comm = track; | 663 | attr->comm = track; |
663 | 664 | ||
664 | if (opts->sample_transaction) | 665 | if (opts->sample_transaction) |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 5a0a4b2cadc4..30df6187ee02 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -128,6 +128,8 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) | |||
128 | + unresolved_col_width + 2; | 128 | + unresolved_col_width + 2; |
129 | hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, | 129 | hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, |
130 | symlen); | 130 | symlen); |
131 | hists__new_col_len(hists, HISTC_MEM_DCACHELINE, | ||
132 | symlen + 1); | ||
131 | } else { | 133 | } else { |
132 | symlen = unresolved_col_width + 4 + 2; | 134 | symlen = unresolved_col_width + 4 + 2; |
133 | hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, | 135 | hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, |
@@ -439,9 +441,10 @@ struct hist_entry *__hists__add_entry(struct hists *hists, | |||
439 | .map = al->map, | 441 | .map = al->map, |
440 | .sym = al->sym, | 442 | .sym = al->sym, |
441 | }, | 443 | }, |
442 | .cpu = al->cpu, | 444 | .cpu = al->cpu, |
443 | .ip = al->addr, | 445 | .cpumode = al->cpumode, |
444 | .level = al->level, | 446 | .ip = al->addr, |
447 | .level = al->level, | ||
445 | .stat = { | 448 | .stat = { |
446 | .nr_events = 1, | 449 | .nr_events = 1, |
447 | .period = period, | 450 | .period = period, |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index d2bf03575d5f..742f49a85725 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -72,6 +72,7 @@ enum hist_column { | |||
72 | HISTC_MEM_TLB, | 72 | HISTC_MEM_TLB, |
73 | HISTC_MEM_LVL, | 73 | HISTC_MEM_LVL, |
74 | HISTC_MEM_SNOOP, | 74 | HISTC_MEM_SNOOP, |
75 | HISTC_MEM_DCACHELINE, | ||
75 | HISTC_TRANSACTION, | 76 | HISTC_TRANSACTION, |
76 | HISTC_NR_COLS, /* Last entry */ | 77 | HISTC_NR_COLS, /* Last entry */ |
77 | }; | 78 | }; |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 7409ac8de51c..0e5fea95d596 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -1060,6 +1060,8 @@ int machine__process_mmap2_event(struct machine *machine, | |||
1060 | event->mmap2.pid, event->mmap2.maj, | 1060 | event->mmap2.pid, event->mmap2.maj, |
1061 | event->mmap2.min, event->mmap2.ino, | 1061 | event->mmap2.min, event->mmap2.ino, |
1062 | event->mmap2.ino_generation, | 1062 | event->mmap2.ino_generation, |
1063 | event->mmap2.prot, | ||
1064 | event->mmap2.flags, | ||
1063 | event->mmap2.filename, type); | 1065 | event->mmap2.filename, type); |
1064 | 1066 | ||
1065 | if (map == NULL) | 1067 | if (map == NULL) |
@@ -1105,7 +1107,7 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event | |||
1105 | 1107 | ||
1106 | map = map__new(&machine->user_dsos, event->mmap.start, | 1108 | map = map__new(&machine->user_dsos, event->mmap.start, |
1107 | event->mmap.len, event->mmap.pgoff, | 1109 | event->mmap.len, event->mmap.pgoff, |
1108 | event->mmap.pid, 0, 0, 0, 0, | 1110 | event->mmap.pid, 0, 0, 0, 0, 0, 0, |
1109 | event->mmap.filename, | 1111 | event->mmap.filename, |
1110 | type); | 1112 | type); |
1111 | 1113 | ||
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 8ccbb32eda25..25c571f4cba6 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -138,7 +138,7 @@ void map__init(struct map *map, enum map_type type, | |||
138 | 138 | ||
139 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, | 139 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, |
140 | u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino, | 140 | u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino, |
141 | u64 ino_gen, char *filename, | 141 | u64 ino_gen, u32 prot, u32 flags, char *filename, |
142 | enum map_type type) | 142 | enum map_type type) |
143 | { | 143 | { |
144 | struct map *map = malloc(sizeof(*map)); | 144 | struct map *map = malloc(sizeof(*map)); |
@@ -157,6 +157,8 @@ struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, | |||
157 | map->min = d_min; | 157 | map->min = d_min; |
158 | map->ino = ino; | 158 | map->ino = ino; |
159 | map->ino_generation = ino_gen; | 159 | map->ino_generation = ino_gen; |
160 | map->prot = prot; | ||
161 | map->flags = flags; | ||
160 | 162 | ||
161 | if ((anon || no_dso) && type == MAP__FUNCTION) { | 163 | if ((anon || no_dso) && type == MAP__FUNCTION) { |
162 | snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", pid); | 164 | snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", pid); |
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index ae2d45110588..7758c72522ef 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h | |||
@@ -35,6 +35,8 @@ struct map { | |||
35 | bool referenced; | 35 | bool referenced; |
36 | bool erange_warned; | 36 | bool erange_warned; |
37 | u32 priv; | 37 | u32 priv; |
38 | u32 prot; | ||
39 | u32 flags; | ||
38 | u64 pgoff; | 40 | u64 pgoff; |
39 | u64 reloc; | 41 | u64 reloc; |
40 | u32 maj, min; /* only valid for MMAP2 record */ | 42 | u32 maj, min; /* only valid for MMAP2 record */ |
@@ -118,7 +120,7 @@ void map__init(struct map *map, enum map_type type, | |||
118 | u64 start, u64 end, u64 pgoff, struct dso *dso); | 120 | u64 start, u64 end, u64 pgoff, struct dso *dso); |
119 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, | 121 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, |
120 | u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino, | 122 | u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino, |
121 | u64 ino_gen, | 123 | u64 ino_gen, u32 prot, u32 flags, |
122 | char *filename, enum map_type type); | 124 | char *filename, enum map_type type); |
123 | struct map *map__new2(u64 start, struct dso *dso, enum map_type type); | 125 | struct map *map__new2(u64 start, struct dso *dso, enum map_type type); |
124 | void map__delete(struct map *map); | 126 | void map__delete(struct map *map); |
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c index a3539ef30b15..43168fb0d9a2 100644 --- a/tools/perf/util/perf_regs.c +++ b/tools/perf/util/perf_regs.c | |||
@@ -1,11 +1,15 @@ | |||
1 | #include <errno.h> | 1 | #include <errno.h> |
2 | #include "perf_regs.h" | 2 | #include "perf_regs.h" |
3 | #include "event.h" | ||
3 | 4 | ||
4 | int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) | 5 | int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) |
5 | { | 6 | { |
6 | int i, idx = 0; | 7 | int i, idx = 0; |
7 | u64 mask = regs->mask; | 8 | u64 mask = regs->mask; |
8 | 9 | ||
10 | if (regs->cache_mask & (1 << id)) | ||
11 | goto out; | ||
12 | |||
9 | if (!(mask & (1 << id))) | 13 | if (!(mask & (1 << id))) |
10 | return -EINVAL; | 14 | return -EINVAL; |
11 | 15 | ||
@@ -14,6 +18,10 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) | |||
14 | idx++; | 18 | idx++; |
15 | } | 19 | } |
16 | 20 | ||
17 | *valp = regs->regs[idx]; | 21 | regs->cache_mask |= (1 << id); |
22 | regs->cache_regs[id] = regs->regs[idx]; | ||
23 | |||
24 | out: | ||
25 | *valp = regs->cache_regs[id]; | ||
18 | return 0; | 26 | return 0; |
19 | } | 27 | } |
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h index 79c78f74e0cf..980dbf76bc98 100644 --- a/tools/perf/util/perf_regs.h +++ b/tools/perf/util/perf_regs.h | |||
@@ -2,7 +2,8 @@ | |||
2 | #define __PERF_REGS_H | 2 | #define __PERF_REGS_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include "event.h" | 5 | |
6 | struct regs_dump; | ||
6 | 7 | ||
7 | #ifdef HAVE_PERF_REGS_SUPPORT | 8 | #ifdef HAVE_PERF_REGS_SUPPORT |
8 | #include <perf_regs.h> | 9 | #include <perf_regs.h> |
@@ -11,6 +12,7 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id); | |||
11 | 12 | ||
12 | #else | 13 | #else |
13 | #define PERF_REGS_MASK 0 | 14 | #define PERF_REGS_MASK 0 |
15 | #define PERF_REGS_MAX 0 | ||
14 | 16 | ||
15 | static inline const char *perf_reg_name(int id __maybe_unused) | 17 | static inline const char *perf_reg_name(int id __maybe_unused) |
16 | { | 18 | { |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 0d1542f33d87..9a0a1839a377 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -628,11 +628,11 @@ static int __show_line_range(struct line_range *lr, const char *module) | |||
628 | 628 | ||
629 | ret = debuginfo__find_line_range(dinfo, lr); | 629 | ret = debuginfo__find_line_range(dinfo, lr); |
630 | debuginfo__delete(dinfo); | 630 | debuginfo__delete(dinfo); |
631 | if (ret == 0) { | 631 | if (ret == 0 || ret == -ENOENT) { |
632 | pr_warning("Specified source line is not found.\n"); | 632 | pr_warning("Specified source line is not found.\n"); |
633 | return -ENOENT; | 633 | return -ENOENT; |
634 | } else if (ret < 0) { | 634 | } else if (ret < 0) { |
635 | pr_warning("Debuginfo analysis failed. (%d)\n", ret); | 635 | pr_warning("Debuginfo analysis failed.\n"); |
636 | return ret; | 636 | return ret; |
637 | } | 637 | } |
638 | 638 | ||
@@ -641,7 +641,7 @@ static int __show_line_range(struct line_range *lr, const char *module) | |||
641 | ret = get_real_path(tmp, lr->comp_dir, &lr->path); | 641 | ret = get_real_path(tmp, lr->comp_dir, &lr->path); |
642 | free(tmp); /* Free old path */ | 642 | free(tmp); /* Free old path */ |
643 | if (ret < 0) { | 643 | if (ret < 0) { |
644 | pr_warning("Failed to find source file. (%d)\n", ret); | 644 | pr_warning("Failed to find source file path.\n"); |
645 | return ret; | 645 | return ret; |
646 | } | 646 | } |
647 | 647 | ||
@@ -721,9 +721,14 @@ static int show_available_vars_at(struct debuginfo *dinfo, | |||
721 | ret = debuginfo__find_available_vars_at(dinfo, pev, &vls, | 721 | ret = debuginfo__find_available_vars_at(dinfo, pev, &vls, |
722 | max_vls, externs); | 722 | max_vls, externs); |
723 | if (ret <= 0) { | 723 | if (ret <= 0) { |
724 | pr_err("Failed to find variables at %s (%d)\n", buf, ret); | 724 | if (ret == 0 || ret == -ENOENT) { |
725 | pr_err("Failed to find the address of %s\n", buf); | ||
726 | ret = -ENOENT; | ||
727 | } else | ||
728 | pr_warning("Debuginfo analysis failed.\n"); | ||
725 | goto end; | 729 | goto end; |
726 | } | 730 | } |
731 | |||
727 | /* Some variables are found */ | 732 | /* Some variables are found */ |
728 | fprintf(stdout, "Available variables at %s\n", buf); | 733 | fprintf(stdout, "Available variables at %s\n", buf); |
729 | for (i = 0; i < ret; i++) { | 734 | for (i = 0; i < ret; i++) { |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 9d8eb26f0533..98e304766416 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -573,14 +573,13 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf) | |||
573 | if (!die_find_variable_at(sc_die, pf->pvar->var, pf->addr, &vr_die)) { | 573 | if (!die_find_variable_at(sc_die, pf->pvar->var, pf->addr, &vr_die)) { |
574 | /* Search again in global variables */ | 574 | /* Search again in global variables */ |
575 | if (!die_find_variable_at(&pf->cu_die, pf->pvar->var, 0, &vr_die)) | 575 | if (!die_find_variable_at(&pf->cu_die, pf->pvar->var, 0, &vr_die)) |
576 | pr_warning("Failed to find '%s' in this function.\n", | ||
577 | pf->pvar->var); | ||
576 | ret = -ENOENT; | 578 | ret = -ENOENT; |
577 | } | 579 | } |
578 | if (ret >= 0) | 580 | if (ret >= 0) |
579 | ret = convert_variable(&vr_die, pf); | 581 | ret = convert_variable(&vr_die, pf); |
580 | 582 | ||
581 | if (ret < 0) | ||
582 | pr_warning("Failed to find '%s' in this function.\n", | ||
583 | pf->pvar->var); | ||
584 | return ret; | 583 | return ret; |
585 | } | 584 | } |
586 | 585 | ||
@@ -1281,7 +1280,11 @@ out: | |||
1281 | return ret; | 1280 | return ret; |
1282 | } | 1281 | } |
1283 | 1282 | ||
1284 | /* Find available variables at given probe point */ | 1283 | /* |
1284 | * Find available variables at given probe point | ||
1285 | * Return the number of found probe points. Return 0 if there is no | ||
1286 | * matched probe point. Return <0 if an error occurs. | ||
1287 | */ | ||
1285 | int debuginfo__find_available_vars_at(struct debuginfo *dbg, | 1288 | int debuginfo__find_available_vars_at(struct debuginfo *dbg, |
1286 | struct perf_probe_event *pev, | 1289 | struct perf_probe_event *pev, |
1287 | struct variable_list **vls, | 1290 | struct variable_list **vls, |
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index e108207c5de0..af7da565a750 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
@@ -215,6 +215,7 @@ static void define_event_symbols(struct event_format *event, | |||
215 | case PRINT_BSTRING: | 215 | case PRINT_BSTRING: |
216 | case PRINT_DYNAMIC_ARRAY: | 216 | case PRINT_DYNAMIC_ARRAY: |
217 | case PRINT_STRING: | 217 | case PRINT_STRING: |
218 | case PRINT_BITMASK: | ||
218 | break; | 219 | break; |
219 | case PRINT_TYPE: | 220 | case PRINT_TYPE: |
220 | define_event_symbols(event, ev_name, args->typecast.item); | 221 | define_event_symbols(event, ev_name, args->typecast.item); |
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index cd9774df3750..1c419321f707 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -197,6 +197,7 @@ static void define_event_symbols(struct event_format *event, | |||
197 | case PRINT_BSTRING: | 197 | case PRINT_BSTRING: |
198 | case PRINT_DYNAMIC_ARRAY: | 198 | case PRINT_DYNAMIC_ARRAY: |
199 | case PRINT_FUNC: | 199 | case PRINT_FUNC: |
200 | case PRINT_BITMASK: | ||
200 | /* we should warn... */ | 201 | /* we should warn... */ |
201 | return; | 202 | return; |
202 | } | 203 | } |
@@ -622,6 +623,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile) | |||
622 | fprintf(ofp, "%s=", f->name); | 623 | fprintf(ofp, "%s=", f->name); |
623 | if (f->flags & FIELD_IS_STRING || | 624 | if (f->flags & FIELD_IS_STRING || |
624 | f->flags & FIELD_IS_FLAG || | 625 | f->flags & FIELD_IS_FLAG || |
626 | f->flags & FIELD_IS_ARRAY || | ||
625 | f->flags & FIELD_IS_SYMBOLIC) | 627 | f->flags & FIELD_IS_SYMBOLIC) |
626 | fprintf(ofp, "%%s"); | 628 | fprintf(ofp, "%%s"); |
627 | else if (f->flags & FIELD_IS_SIGNED) | 629 | else if (f->flags & FIELD_IS_SIGNED) |
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 45512baaab67..1ec57dd82284 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <sys/mman.h> | ||
1 | #include "sort.h" | 2 | #include "sort.h" |
2 | #include "hist.h" | 3 | #include "hist.h" |
3 | #include "comm.h" | 4 | #include "comm.h" |
@@ -784,6 +785,104 @@ static int hist_entry__snoop_snprintf(struct hist_entry *he, char *bf, | |||
784 | return repsep_snprintf(bf, size, "%-*s", width, out); | 785 | return repsep_snprintf(bf, size, "%-*s", width, out); |
785 | } | 786 | } |
786 | 787 | ||
788 | static inline u64 cl_address(u64 address) | ||
789 | { | ||
790 | /* return the cacheline of the address */ | ||
791 | return (address & ~(cacheline_size - 1)); | ||
792 | } | ||
793 | |||
794 | static int64_t | ||
795 | sort__dcacheline_cmp(struct hist_entry *left, struct hist_entry *right) | ||
796 | { | ||
797 | u64 l, r; | ||
798 | struct map *l_map, *r_map; | ||
799 | |||
800 | if (!left->mem_info) return -1; | ||
801 | if (!right->mem_info) return 1; | ||
802 | |||
803 | /* group event types together */ | ||
804 | if (left->cpumode > right->cpumode) return -1; | ||
805 | if (left->cpumode < right->cpumode) return 1; | ||
806 | |||
807 | l_map = left->mem_info->daddr.map; | ||
808 | r_map = right->mem_info->daddr.map; | ||
809 | |||
810 | /* if both are NULL, jump to sort on al_addr instead */ | ||
811 | if (!l_map && !r_map) | ||
812 | goto addr; | ||
813 | |||
814 | if (!l_map) return -1; | ||
815 | if (!r_map) return 1; | ||
816 | |||
817 | if (l_map->maj > r_map->maj) return -1; | ||
818 | if (l_map->maj < r_map->maj) return 1; | ||
819 | |||
820 | if (l_map->min > r_map->min) return -1; | ||
821 | if (l_map->min < r_map->min) return 1; | ||
822 | |||
823 | if (l_map->ino > r_map->ino) return -1; | ||
824 | if (l_map->ino < r_map->ino) return 1; | ||
825 | |||
826 | if (l_map->ino_generation > r_map->ino_generation) return -1; | ||
827 | if (l_map->ino_generation < r_map->ino_generation) return 1; | ||
828 | |||
829 | /* | ||
830 | * Addresses with no major/minor numbers are assumed to be | ||
831 | * anonymous in userspace. Sort those on pid then address. | ||
832 | * | ||
833 | * The kernel and non-zero major/minor mapped areas are | ||
834 | * assumed to be unity mapped. Sort those on address. | ||
835 | */ | ||
836 | |||
837 | if ((left->cpumode != PERF_RECORD_MISC_KERNEL) && | ||
838 | (!(l_map->flags & MAP_SHARED)) && | ||
839 | !l_map->maj && !l_map->min && !l_map->ino && | ||
840 | !l_map->ino_generation) { | ||
841 | /* userspace anonymous */ | ||
842 | |||
843 | if (left->thread->pid_ > right->thread->pid_) return -1; | ||
844 | if (left->thread->pid_ < right->thread->pid_) return 1; | ||
845 | } | ||
846 | |||
847 | addr: | ||
848 | /* al_addr does all the right addr - start + offset calculations */ | ||
849 | l = cl_address(left->mem_info->daddr.al_addr); | ||
850 | r = cl_address(right->mem_info->daddr.al_addr); | ||
851 | |||
852 | if (l > r) return -1; | ||
853 | if (l < r) return 1; | ||
854 | |||
855 | return 0; | ||
856 | } | ||
857 | |||
858 | static int hist_entry__dcacheline_snprintf(struct hist_entry *he, char *bf, | ||
859 | size_t size, unsigned int width) | ||
860 | { | ||
861 | |||
862 | uint64_t addr = 0; | ||
863 | struct map *map = NULL; | ||
864 | struct symbol *sym = NULL; | ||
865 | char level = he->level; | ||
866 | |||
867 | if (he->mem_info) { | ||
868 | addr = cl_address(he->mem_info->daddr.al_addr); | ||
869 | map = he->mem_info->daddr.map; | ||
870 | sym = he->mem_info->daddr.sym; | ||
871 | |||
872 | /* print [s] for shared data mmaps */ | ||
873 | if ((he->cpumode != PERF_RECORD_MISC_KERNEL) && | ||
874 | map && (map->type == MAP__VARIABLE) && | ||
875 | (map->flags & MAP_SHARED) && | ||
876 | (map->maj || map->min || map->ino || | ||
877 | map->ino_generation)) | ||
878 | level = 's'; | ||
879 | else if (!map) | ||
880 | level = 'X'; | ||
881 | } | ||
882 | return _hist_entry__sym_snprintf(map, sym, addr, level, bf, size, | ||
883 | width); | ||
884 | } | ||
885 | |||
787 | struct sort_entry sort_mispredict = { | 886 | struct sort_entry sort_mispredict = { |
788 | .se_header = "Branch Mispredicted", | 887 | .se_header = "Branch Mispredicted", |
789 | .se_cmp = sort__mispredict_cmp, | 888 | .se_cmp = sort__mispredict_cmp, |
@@ -876,6 +975,13 @@ struct sort_entry sort_mem_snoop = { | |||
876 | .se_width_idx = HISTC_MEM_SNOOP, | 975 | .se_width_idx = HISTC_MEM_SNOOP, |
877 | }; | 976 | }; |
878 | 977 | ||
978 | struct sort_entry sort_mem_dcacheline = { | ||
979 | .se_header = "Data Cacheline", | ||
980 | .se_cmp = sort__dcacheline_cmp, | ||
981 | .se_snprintf = hist_entry__dcacheline_snprintf, | ||
982 | .se_width_idx = HISTC_MEM_DCACHELINE, | ||
983 | }; | ||
984 | |||
879 | static int64_t | 985 | static int64_t |
880 | sort__abort_cmp(struct hist_entry *left, struct hist_entry *right) | 986 | sort__abort_cmp(struct hist_entry *left, struct hist_entry *right) |
881 | { | 987 | { |
@@ -1043,6 +1149,7 @@ static struct sort_dimension memory_sort_dimensions[] = { | |||
1043 | DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb), | 1149 | DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb), |
1044 | DIM(SORT_MEM_LVL, "mem", sort_mem_lvl), | 1150 | DIM(SORT_MEM_LVL, "mem", sort_mem_lvl), |
1045 | DIM(SORT_MEM_SNOOP, "snoop", sort_mem_snoop), | 1151 | DIM(SORT_MEM_SNOOP, "snoop", sort_mem_snoop), |
1152 | DIM(SORT_MEM_DCACHELINE, "dcacheline", sort_mem_dcacheline), | ||
1046 | }; | 1153 | }; |
1047 | 1154 | ||
1048 | #undef DIM | 1155 | #undef DIM |
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index 5bf0098d6b06..041f0c9cea2b 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h | |||
@@ -89,6 +89,7 @@ struct hist_entry { | |||
89 | u64 ip; | 89 | u64 ip; |
90 | u64 transaction; | 90 | u64 transaction; |
91 | s32 cpu; | 91 | s32 cpu; |
92 | u8 cpumode; | ||
92 | 93 | ||
93 | struct hist_entry_diff diff; | 94 | struct hist_entry_diff diff; |
94 | 95 | ||
@@ -185,6 +186,7 @@ enum sort_type { | |||
185 | SORT_MEM_TLB, | 186 | SORT_MEM_TLB, |
186 | SORT_MEM_LVL, | 187 | SORT_MEM_LVL, |
187 | SORT_MEM_SNOOP, | 188 | SORT_MEM_SNOOP, |
189 | SORT_MEM_DCACHELINE, | ||
188 | }; | 190 | }; |
189 | 191 | ||
190 | /* | 192 | /* |
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index bd5768d74f01..25578b98f5c5 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c | |||
@@ -250,7 +250,6 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, | |||
250 | 250 | ||
251 | /* Check the .eh_frame section for unwinding info */ | 251 | /* Check the .eh_frame section for unwinding info */ |
252 | offset = elf_section_offset(fd, ".eh_frame_hdr"); | 252 | offset = elf_section_offset(fd, ".eh_frame_hdr"); |
253 | close(fd); | ||
254 | 253 | ||
255 | if (offset) | 254 | if (offset) |
256 | ret = unwind_spec_ehframe(dso, machine, offset, | 255 | ret = unwind_spec_ehframe(dso, machine, offset, |
@@ -271,7 +270,6 @@ static int read_unwind_spec_debug_frame(struct dso *dso, | |||
271 | 270 | ||
272 | /* Check the .debug_frame section for unwinding info */ | 271 | /* Check the .debug_frame section for unwinding info */ |
273 | *offset = elf_section_offset(fd, ".debug_frame"); | 272 | *offset = elf_section_offset(fd, ".debug_frame"); |
274 | close(fd); | ||
275 | 273 | ||
276 | if (*offset) | 274 | if (*offset) |
277 | return 0; | 275 | return 0; |
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 7fff6be07f07..95aefa78bb07 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * XXX We need to find a better place for these things... | 17 | * XXX We need to find a better place for these things... |
18 | */ | 18 | */ |
19 | unsigned int page_size; | 19 | unsigned int page_size; |
20 | int cacheline_size; | ||
20 | 21 | ||
21 | bool test_attr__enabled; | 22 | bool test_attr__enabled; |
22 | 23 | ||
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index b03da44e94e4..66864364ccb4 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h | |||
@@ -304,6 +304,7 @@ char *rtrim(char *s); | |||
304 | void dump_stack(void); | 304 | void dump_stack(void); |
305 | 305 | ||
306 | extern unsigned int page_size; | 306 | extern unsigned int page_size; |
307 | extern int cacheline_size; | ||
307 | 308 | ||
308 | void get_term_dimensions(struct winsize *ws); | 309 | void get_term_dimensions(struct winsize *ws); |
309 | 310 | ||
diff --git a/tools/testing/selftests/cpu-hotplug/Makefile b/tools/testing/selftests/cpu-hotplug/Makefile index ae5faf9aade2..790c23a9db44 100644 --- a/tools/testing/selftests/cpu-hotplug/Makefile +++ b/tools/testing/selftests/cpu-hotplug/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | all: | 1 | all: |
2 | 2 | ||
3 | run_tests: | 3 | run_tests: |
4 | @/bin/sh ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" | 4 | @/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" |
5 | 5 | ||
6 | clean: | 6 | clean: |
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index aa290c0de6f5..552f0810bffb 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c | |||
@@ -193,6 +193,11 @@ int main(int argc, char **argv) | |||
193 | int msg, pid, err; | 193 | int msg, pid, err; |
194 | struct msgque_data msgque; | 194 | struct msgque_data msgque; |
195 | 195 | ||
196 | if (getuid() != 0) { | ||
197 | printf("Please run the test as root - Exiting.\n"); | ||
198 | exit(1); | ||
199 | } | ||
200 | |||
196 | msgque.key = ftok(argv[0], 822155650); | 201 | msgque.key = ftok(argv[0], 822155650); |
197 | if (msgque.key == -1) { | 202 | if (msgque.key == -1) { |
198 | printf("Can't make key\n"); | 203 | printf("Can't make key\n"); |
diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/testing/selftests/memory-hotplug/Makefile index 350bfeda3aa8..058c76f5d102 100644 --- a/tools/testing/selftests/memory-hotplug/Makefile +++ b/tools/testing/selftests/memory-hotplug/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | all: | 1 | all: |
2 | 2 | ||
3 | run_tests: | 3 | run_tests: |
4 | @/bin/sh ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" | 4 | @/bin/bash ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" |
5 | 5 | ||
6 | clean: | 6 | clean: |
diff --git a/tools/testing/selftests/powerpc/tm/Makefile b/tools/testing/selftests/powerpc/tm/Makefile index 51267f4184a6..2cede239a074 100644 --- a/tools/testing/selftests/powerpc/tm/Makefile +++ b/tools/testing/selftests/powerpc/tm/Makefile | |||
@@ -2,7 +2,7 @@ PROGS := tm-resched-dscr | |||
2 | 2 | ||
3 | all: $(PROGS) | 3 | all: $(PROGS) |
4 | 4 | ||
5 | $(PROGS): | 5 | $(PROGS): ../harness.c |
6 | 6 | ||
7 | run_tests: all | 7 | run_tests: all |
8 | @-for PROG in $(PROGS); do \ | 8 | @-for PROG in $(PROGS); do \ |
diff --git a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c index ee98e3886af2..42d4c8caad81 100644 --- a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c +++ b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <assert.h> | 28 | #include <assert.h> |
29 | #include <asm/tm.h> | 29 | #include <asm/tm.h> |
30 | 30 | ||
31 | #include "utils.h" | ||
32 | |||
31 | #define TBEGIN ".long 0x7C00051D ;" | 33 | #define TBEGIN ".long 0x7C00051D ;" |
32 | #define TEND ".long 0x7C00055D ;" | 34 | #define TEND ".long 0x7C00055D ;" |
33 | #define TCHECK ".long 0x7C00059C ;" | 35 | #define TCHECK ".long 0x7C00059C ;" |
@@ -36,7 +38,8 @@ | |||
36 | #define SPRN_TEXASR 0x82 | 38 | #define SPRN_TEXASR 0x82 |
37 | #define SPRN_DSCR 0x03 | 39 | #define SPRN_DSCR 0x03 |
38 | 40 | ||
39 | int main(void) { | 41 | int test_body(void) |
42 | { | ||
40 | uint64_t rv, dscr1 = 1, dscr2, texasr; | 43 | uint64_t rv, dscr1 = 1, dscr2, texasr; |
41 | 44 | ||
42 | printf("Check DSCR TM context switch: "); | 45 | printf("Check DSCR TM context switch: "); |
@@ -81,10 +84,15 @@ int main(void) { | |||
81 | } | 84 | } |
82 | if (dscr2 != dscr1) { | 85 | if (dscr2 != dscr1) { |
83 | printf(" FAIL\n"); | 86 | printf(" FAIL\n"); |
84 | exit(EXIT_FAILURE); | 87 | return 1; |
85 | } else { | 88 | } else { |
86 | printf(" OK\n"); | 89 | printf(" OK\n"); |
87 | exit(EXIT_SUCCESS); | 90 | return 0; |
88 | } | 91 | } |
89 | } | 92 | } |
90 | } | 93 | } |
94 | |||
95 | int main(void) | ||
96 | { | ||
97 | return test_harness(test_body, "tm_resched_dscr"); | ||
98 | } | ||
diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile index 447321104ec0..e775adcbd29f 100644 --- a/tools/thermal/tmon/Makefile +++ b/tools/thermal/tmon/Makefile | |||
@@ -21,7 +21,7 @@ OBJS = tmon.o tui.o sysfs.o pid.o | |||
21 | OBJS += | 21 | OBJS += |
22 | 22 | ||
23 | tmon: $(OBJS) Makefile tmon.h | 23 | tmon: $(OBJS) Makefile tmon.h |
24 | $(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -lpthread | 24 | $(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -ltinfo -lpthread |
25 | 25 | ||
26 | valgrind: tmon | 26 | valgrind: tmon |
27 | sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null | 27 | sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null |
diff --git a/tools/thermal/tmon/tmon.c b/tools/thermal/tmon/tmon.c index b30f531173e4..09b7c3218334 100644 --- a/tools/thermal/tmon/tmon.c +++ b/tools/thermal/tmon/tmon.c | |||
@@ -142,6 +142,7 @@ static void start_syslog(void) | |||
142 | static void prepare_logging(void) | 142 | static void prepare_logging(void) |
143 | { | 143 | { |
144 | int i; | 144 | int i; |
145 | struct stat logstat; | ||
145 | 146 | ||
146 | if (!logging) | 147 | if (!logging) |
147 | return; | 148 | return; |
@@ -152,6 +153,29 @@ static void prepare_logging(void) | |||
152 | return; | 153 | return; |
153 | } | 154 | } |
154 | 155 | ||
156 | if (lstat(TMON_LOG_FILE, &logstat) < 0) { | ||
157 | syslog(LOG_ERR, "Unable to stat log file %s\n", TMON_LOG_FILE); | ||
158 | fclose(tmon_log); | ||
159 | tmon_log = NULL; | ||
160 | return; | ||
161 | } | ||
162 | |||
163 | /* The log file must be a regular file owned by us */ | ||
164 | if (S_ISLNK(logstat.st_mode)) { | ||
165 | syslog(LOG_ERR, "Log file is a symlink. Will not log\n"); | ||
166 | fclose(tmon_log); | ||
167 | tmon_log = NULL; | ||
168 | return; | ||
169 | } | ||
170 | |||
171 | if (logstat.st_uid != getuid()) { | ||
172 | syslog(LOG_ERR, "We don't own the log file. Not logging\n"); | ||
173 | fclose(tmon_log); | ||
174 | tmon_log = NULL; | ||
175 | return; | ||
176 | } | ||
177 | |||
178 | |||
155 | fprintf(tmon_log, "#----------- THERMAL SYSTEM CONFIG -------------\n"); | 179 | fprintf(tmon_log, "#----------- THERMAL SYSTEM CONFIG -------------\n"); |
156 | for (i = 0; i < ptdata.nr_tz_sensor; i++) { | 180 | for (i = 0; i < ptdata.nr_tz_sensor; i++) { |
157 | char binding_str[33]; /* size of long + 1 */ | 181 | char binding_str[33]; /* size of long + 1 */ |
@@ -331,7 +355,7 @@ static void start_daemon_mode() | |||
331 | disable_tui(); | 355 | disable_tui(); |
332 | 356 | ||
333 | /* change the file mode mask */ | 357 | /* change the file mode mask */ |
334 | umask(0); | 358 | umask(S_IWGRP | S_IWOTH); |
335 | 359 | ||
336 | /* new SID for the daemon process */ | 360 | /* new SID for the daemon process */ |
337 | sid = setsid(); | 361 | sid = setsid(); |
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c index fe1e66b6ef40..a87e99f37c52 100644 --- a/tools/usb/ffs-test.c +++ b/tools/usb/ffs-test.c | |||
@@ -116,8 +116,8 @@ static const struct { | |||
116 | .header = { | 116 | .header = { |
117 | .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC), | 117 | .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC), |
118 | .length = cpu_to_le32(sizeof descriptors), | 118 | .length = cpu_to_le32(sizeof descriptors), |
119 | .fs_count = 3, | 119 | .fs_count = cpu_to_le32(3), |
120 | .hs_count = 3, | 120 | .hs_count = cpu_to_le32(3), |
121 | }, | 121 | }, |
122 | .fs_descs = { | 122 | .fs_descs = { |
123 | .intf = { | 123 | .intf = { |