diff options
215 files changed, 2739 insertions, 1178 deletions
diff --git a/Documentation/i2c/busses/i2c-diolan-u2c b/Documentation/i2c/busses/i2c-diolan-u2c index 30fe4bb9a069..0d6018c316c7 100644 --- a/Documentation/i2c/busses/i2c-diolan-u2c +++ b/Documentation/i2c/busses/i2c-diolan-u2c | |||
@@ -5,7 +5,7 @@ Supported adapters: | |||
5 | Documentation: | 5 | Documentation: |
6 | http://www.diolan.com/i2c/u2c12.html | 6 | http://www.diolan.com/i2c/u2c12.html |
7 | 7 | ||
8 | Author: Guenter Roeck <guenter.roeck@ericsson.com> | 8 | Author: Guenter Roeck <linux@roeck-us.net> |
9 | 9 | ||
10 | Description | 10 | Description |
11 | ----------- | 11 | ----------- |
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index ce6581c8ca26..4499bd948860 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -912,7 +912,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
912 | models depending on the codec chip. The list of available models | 912 | models depending on the codec chip. The list of available models |
913 | is found in HD-Audio-Models.txt | 913 | is found in HD-Audio-Models.txt |
914 | 914 | ||
915 | The model name "genric" is treated as a special case. When this | 915 | The model name "generic" is treated as a special case. When this |
916 | model is given, the driver uses the generic codec parser without | 916 | model is given, the driver uses the generic codec parser without |
917 | "codec-patch". It's sometimes good for testing and debugging. | 917 | "codec-patch". It's sometimes good for testing and debugging. |
918 | 918 | ||
diff --git a/Documentation/sound/alsa/seq_oss.html b/Documentation/sound/alsa/seq_oss.html index d9776cf60c07..9663b45f6fde 100644 --- a/Documentation/sound/alsa/seq_oss.html +++ b/Documentation/sound/alsa/seq_oss.html | |||
@@ -285,7 +285,7 @@ sample data. | |||
285 | <H4> | 285 | <H4> |
286 | 7.2.4 Close Callback</H4> | 286 | 7.2.4 Close Callback</H4> |
287 | The <TT>close</TT> callback is called when this device is closed by the | 287 | The <TT>close</TT> callback is called when this device is closed by the |
288 | applicaion. If any private data was allocated in open callback, it must | 288 | application. If any private data was allocated in open callback, it must |
289 | be released in the close callback. The deletion of ALSA port should be | 289 | be released in the close callback. The deletion of ALSA port should be |
290 | done here, too. This callback must not be NULL. | 290 | done here, too. This callback must not be NULL. |
291 | <H4> | 291 | <H4> |
diff --git a/MAINTAINERS b/MAINTAINERS index fb89be1281c6..72b08438d536 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1461,6 +1461,12 @@ F: drivers/dma/at_hdmac.c | |||
1461 | F: drivers/dma/at_hdmac_regs.h | 1461 | F: drivers/dma/at_hdmac_regs.h |
1462 | F: include/linux/platform_data/dma-atmel.h | 1462 | F: include/linux/platform_data/dma-atmel.h |
1463 | 1463 | ||
1464 | ATMEL I2C DRIVER | ||
1465 | M: Ludovic Desroches <ludovic.desroches@atmel.com> | ||
1466 | L: linux-i2c@vger.kernel.org | ||
1467 | S: Supported | ||
1468 | F: drivers/i2c/busses/i2c-at91.c | ||
1469 | |||
1464 | ATMEL ISI DRIVER | 1470 | ATMEL ISI DRIVER |
1465 | M: Josh Wu <josh.wu@atmel.com> | 1471 | M: Josh Wu <josh.wu@atmel.com> |
1466 | L: linux-media@vger.kernel.org | 1472 | L: linux-media@vger.kernel.org |
@@ -2623,7 +2629,7 @@ F: include/uapi/drm/ | |||
2623 | 2629 | ||
2624 | INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) | 2630 | INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) |
2625 | M: Daniel Vetter <daniel.vetter@ffwll.ch> | 2631 | M: Daniel Vetter <daniel.vetter@ffwll.ch> |
2626 | L: intel-gfx@lists.freedesktop.org (subscribers-only) | 2632 | L: intel-gfx@lists.freedesktop.org |
2627 | L: dri-devel@lists.freedesktop.org | 2633 | L: dri-devel@lists.freedesktop.org |
2628 | T: git git://people.freedesktop.org/~danvet/drm-intel | 2634 | T: git git://people.freedesktop.org/~danvet/drm-intel |
2629 | S: Supported | 2635 | S: Supported |
@@ -5641,6 +5647,14 @@ S: Maintained | |||
5641 | F: drivers/video/riva/ | 5647 | F: drivers/video/riva/ |
5642 | F: drivers/video/nvidia/ | 5648 | F: drivers/video/nvidia/ |
5643 | 5649 | ||
5650 | NVM EXPRESS DRIVER | ||
5651 | M: Matthew Wilcox <willy@linux.intel.com> | ||
5652 | L: linux-nvme@lists.infradead.org | ||
5653 | T: git git://git.infradead.org/users/willy/linux-nvme.git | ||
5654 | S: Supported | ||
5655 | F: drivers/block/nvme.c | ||
5656 | F: include/linux/nvme.h | ||
5657 | |||
5644 | OMAP SUPPORT | 5658 | OMAP SUPPORT |
5645 | M: Tony Lindgren <tony@atomide.com> | 5659 | M: Tony Lindgren <tony@atomide.com> |
5646 | L: linux-omap@vger.kernel.org | 5660 | L: linux-omap@vger.kernel.org |
@@ -5669,7 +5683,7 @@ S: Maintained | |||
5669 | F: arch/arm/*omap*/*clock* | 5683 | F: arch/arm/*omap*/*clock* |
5670 | 5684 | ||
5671 | OMAP POWER MANAGEMENT SUPPORT | 5685 | OMAP POWER MANAGEMENT SUPPORT |
5672 | M: Kevin Hilman <khilman@ti.com> | 5686 | M: Kevin Hilman <khilman@deeprootsystems.com> |
5673 | L: linux-omap@vger.kernel.org | 5687 | L: linux-omap@vger.kernel.org |
5674 | S: Maintained | 5688 | S: Maintained |
5675 | F: arch/arm/*omap*/*pm* | 5689 | F: arch/arm/*omap*/*pm* |
@@ -5763,7 +5777,7 @@ F: arch/arm/*omap*/usb* | |||
5763 | 5777 | ||
5764 | OMAP GPIO DRIVER | 5778 | OMAP GPIO DRIVER |
5765 | M: Santosh Shilimkar <santosh.shilimkar@ti.com> | 5779 | M: Santosh Shilimkar <santosh.shilimkar@ti.com> |
5766 | M: Kevin Hilman <khilman@ti.com> | 5780 | M: Kevin Hilman <khilman@deeprootsystems.com> |
5767 | L: linux-omap@vger.kernel.org | 5781 | L: linux-omap@vger.kernel.org |
5768 | S: Maintained | 5782 | S: Maintained |
5769 | F: drivers/gpio/gpio-omap.c | 5783 | F: drivers/gpio/gpio-omap.c |
@@ -7159,7 +7173,7 @@ F: arch/arm/mach-s3c2410/bast-irq.c | |||
7159 | 7173 | ||
7160 | TI DAVINCI MACHINE SUPPORT | 7174 | TI DAVINCI MACHINE SUPPORT |
7161 | M: Sekhar Nori <nsekhar@ti.com> | 7175 | M: Sekhar Nori <nsekhar@ti.com> |
7162 | M: Kevin Hilman <khilman@ti.com> | 7176 | M: Kevin Hilman <khilman@deeprootsystems.com> |
7163 | L: davinci-linux-open-source@linux.davincidsp.com (moderated for non-subscribers) | 7177 | L: davinci-linux-open-source@linux.davincidsp.com (moderated for non-subscribers) |
7164 | T: git git://gitorious.org/linux-davinci/linux-davinci.git | 7178 | T: git git://gitorious.org/linux-davinci/linux-davinci.git |
7165 | Q: http://patchwork.kernel.org/project/linux-davinci/list/ | 7179 | Q: http://patchwork.kernel.org/project/linux-davinci/list/ |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 9 | 2 | PATCHLEVEL = 9 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc3 | 4 | EXTRAVERSION = -rc4 |
5 | NAME = Unicycling Gorilla | 5 | NAME = Unicycling Gorilla |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index ecfcdba2d17c..9b31f4311ea2 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -495,6 +495,7 @@ config DEBUG_IMX_UART_PORT | |||
495 | DEBUG_IMX53_UART || \ | 495 | DEBUG_IMX53_UART || \ |
496 | DEBUG_IMX6Q_UART | 496 | DEBUG_IMX6Q_UART |
497 | default 1 | 497 | default 1 |
498 | depends on ARCH_MXC | ||
498 | help | 499 | help |
499 | Choose UART port on which kernel low-level debug messages | 500 | Choose UART port on which kernel low-level debug messages |
500 | should be output. | 501 | should be output. |
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi index 48d00a099ce3..3d3f64d2111a 100644 --- a/arch/arm/boot/dts/tegra20.dtsi +++ b/arch/arm/boot/dts/tegra20.dtsi | |||
@@ -385,7 +385,7 @@ | |||
385 | 385 | ||
386 | spi@7000d800 { | 386 | spi@7000d800 { |
387 | compatible = "nvidia,tegra20-slink"; | 387 | compatible = "nvidia,tegra20-slink"; |
388 | reg = <0x7000d480 0x200>; | 388 | reg = <0x7000d800 0x200>; |
389 | interrupts = <0 83 0x04>; | 389 | interrupts = <0 83 0x04>; |
390 | nvidia,dma-request-selector = <&apbdma 17>; | 390 | nvidia,dma-request-selector = <&apbdma 17>; |
391 | #address-cells = <1>; | 391 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi index 9d87a3ffe998..dbf46c272562 100644 --- a/arch/arm/boot/dts/tegra30.dtsi +++ b/arch/arm/boot/dts/tegra30.dtsi | |||
@@ -372,7 +372,7 @@ | |||
372 | 372 | ||
373 | spi@7000d800 { | 373 | spi@7000d800 { |
374 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; | 374 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; |
375 | reg = <0x7000d480 0x200>; | 375 | reg = <0x7000d800 0x200>; |
376 | interrupts = <0 83 0x04>; | 376 | interrupts = <0 83 0x04>; |
377 | nvidia,dma-request-selector = <&apbdma 17>; | 377 | nvidia,dma-request-selector = <&apbdma 17>; |
378 | #address-cells = <1>; | 378 | #address-cells = <1>; |
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index 3218f1f2c0e0..e7b781d3788f 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c | |||
@@ -41,8 +41,6 @@ static struct fb_videomode mx23evk_video_modes[] = { | |||
41 | .lower_margin = 4, | 41 | .lower_margin = 4, |
42 | .hsync_len = 1, | 42 | .hsync_len = 1, |
43 | .vsync_len = 1, | 43 | .vsync_len = 1, |
44 | .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT | | ||
45 | FB_SYNC_DOTCLK_FAILING_ACT, | ||
46 | }, | 44 | }, |
47 | }; | 45 | }; |
48 | 46 | ||
@@ -59,8 +57,6 @@ static struct fb_videomode mx28evk_video_modes[] = { | |||
59 | .lower_margin = 10, | 57 | .lower_margin = 10, |
60 | .hsync_len = 10, | 58 | .hsync_len = 10, |
61 | .vsync_len = 10, | 59 | .vsync_len = 10, |
62 | .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT | | ||
63 | FB_SYNC_DOTCLK_FAILING_ACT, | ||
64 | }, | 60 | }, |
65 | }; | 61 | }; |
66 | 62 | ||
@@ -77,7 +73,6 @@ static struct fb_videomode m28evk_video_modes[] = { | |||
77 | .lower_margin = 45, | 73 | .lower_margin = 45, |
78 | .hsync_len = 1, | 74 | .hsync_len = 1, |
79 | .vsync_len = 1, | 75 | .vsync_len = 1, |
80 | .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT, | ||
81 | }, | 76 | }, |
82 | }; | 77 | }; |
83 | 78 | ||
@@ -94,9 +89,7 @@ static struct fb_videomode apx4devkit_video_modes[] = { | |||
94 | .lower_margin = 13, | 89 | .lower_margin = 13, |
95 | .hsync_len = 48, | 90 | .hsync_len = 48, |
96 | .vsync_len = 3, | 91 | .vsync_len = 3, |
97 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT | | 92 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
98 | FB_SYNC_DATA_ENABLE_HIGH_ACT | | ||
99 | FB_SYNC_DOTCLK_FAILING_ACT, | ||
100 | }, | 93 | }, |
101 | }; | 94 | }; |
102 | 95 | ||
@@ -113,9 +106,7 @@ static struct fb_videomode apf28dev_video_modes[] = { | |||
113 | .lower_margin = 0x15, | 106 | .lower_margin = 0x15, |
114 | .hsync_len = 64, | 107 | .hsync_len = 64, |
115 | .vsync_len = 4, | 108 | .vsync_len = 4, |
116 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT | | 109 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
117 | FB_SYNC_DATA_ENABLE_HIGH_ACT | | ||
118 | FB_SYNC_DOTCLK_FAILING_ACT, | ||
119 | }, | 110 | }, |
120 | }; | 111 | }; |
121 | 112 | ||
@@ -132,7 +123,6 @@ static struct fb_videomode cfa10049_video_modes[] = { | |||
132 | .lower_margin = 2, | 123 | .lower_margin = 2, |
133 | .hsync_len = 15, | 124 | .hsync_len = 15, |
134 | .vsync_len = 15, | 125 | .vsync_len = 15, |
135 | .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT | ||
136 | }, | 126 | }, |
137 | }; | 127 | }; |
138 | 128 | ||
@@ -259,6 +249,8 @@ static void __init imx23_evk_init(void) | |||
259 | mxsfb_pdata.mode_count = ARRAY_SIZE(mx23evk_video_modes); | 249 | mxsfb_pdata.mode_count = ARRAY_SIZE(mx23evk_video_modes); |
260 | mxsfb_pdata.default_bpp = 32; | 250 | mxsfb_pdata.default_bpp = 32; |
261 | mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT; | 251 | mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT; |
252 | mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT | | ||
253 | MXSFB_SYNC_DOTCLK_FAILING_ACT; | ||
262 | } | 254 | } |
263 | 255 | ||
264 | static inline void enable_clk_enet_out(void) | 256 | static inline void enable_clk_enet_out(void) |
@@ -278,6 +270,8 @@ static void __init imx28_evk_init(void) | |||
278 | mxsfb_pdata.mode_count = ARRAY_SIZE(mx28evk_video_modes); | 270 | mxsfb_pdata.mode_count = ARRAY_SIZE(mx28evk_video_modes); |
279 | mxsfb_pdata.default_bpp = 32; | 271 | mxsfb_pdata.default_bpp = 32; |
280 | mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT; | 272 | mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT; |
273 | mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT | | ||
274 | MXSFB_SYNC_DOTCLK_FAILING_ACT; | ||
281 | 275 | ||
282 | mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0); | 276 | mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0); |
283 | } | 277 | } |
@@ -297,6 +291,7 @@ static void __init m28evk_init(void) | |||
297 | mxsfb_pdata.mode_count = ARRAY_SIZE(m28evk_video_modes); | 291 | mxsfb_pdata.mode_count = ARRAY_SIZE(m28evk_video_modes); |
298 | mxsfb_pdata.default_bpp = 16; | 292 | mxsfb_pdata.default_bpp = 16; |
299 | mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT; | 293 | mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT; |
294 | mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT; | ||
300 | } | 295 | } |
301 | 296 | ||
302 | static void __init sc_sps1_init(void) | 297 | static void __init sc_sps1_init(void) |
@@ -322,6 +317,8 @@ static void __init apx4devkit_init(void) | |||
322 | mxsfb_pdata.mode_count = ARRAY_SIZE(apx4devkit_video_modes); | 317 | mxsfb_pdata.mode_count = ARRAY_SIZE(apx4devkit_video_modes); |
323 | mxsfb_pdata.default_bpp = 32; | 318 | mxsfb_pdata.default_bpp = 32; |
324 | mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT; | 319 | mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT; |
320 | mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT | | ||
321 | MXSFB_SYNC_DOTCLK_FAILING_ACT; | ||
325 | } | 322 | } |
326 | 323 | ||
327 | #define ENET0_MDC__GPIO_4_0 MXS_GPIO_NR(4, 0) | 324 | #define ENET0_MDC__GPIO_4_0 MXS_GPIO_NR(4, 0) |
@@ -407,6 +404,7 @@ static void __init cfa10049_init(void) | |||
407 | mxsfb_pdata.mode_count = ARRAY_SIZE(cfa10049_video_modes); | 404 | mxsfb_pdata.mode_count = ARRAY_SIZE(cfa10049_video_modes); |
408 | mxsfb_pdata.default_bpp = 32; | 405 | mxsfb_pdata.default_bpp = 32; |
409 | mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT; | 406 | mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT; |
407 | mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT; | ||
410 | } | 408 | } |
411 | 409 | ||
412 | static void __init cfa10037_init(void) | 410 | static void __init cfa10037_init(void) |
@@ -423,6 +421,8 @@ static void __init apf28_init(void) | |||
423 | mxsfb_pdata.mode_count = ARRAY_SIZE(apf28dev_video_modes); | 421 | mxsfb_pdata.mode_count = ARRAY_SIZE(apf28dev_video_modes); |
424 | mxsfb_pdata.default_bpp = 16; | 422 | mxsfb_pdata.default_bpp = 16; |
425 | mxsfb_pdata.ld_intf_width = STMLCDIF_16BIT; | 423 | mxsfb_pdata.ld_intf_width = STMLCDIF_16BIT; |
424 | mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT | | ||
425 | MXSFB_SYNC_DOTCLK_FAILING_ACT; | ||
426 | } | 426 | } |
427 | 427 | ||
428 | static void __init mxs_machine_init(void) | 428 | static void __init mxs_machine_init(void) |
diff --git a/arch/powerpc/perf/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c index b554879bd31e..3c475d6267c7 100644 --- a/arch/powerpc/perf/power7-pmu.c +++ b/arch/powerpc/perf/power7-pmu.c | |||
@@ -420,7 +420,20 @@ static struct attribute_group power7_pmu_events_group = { | |||
420 | .attrs = power7_events_attr, | 420 | .attrs = power7_events_attr, |
421 | }; | 421 | }; |
422 | 422 | ||
423 | PMU_FORMAT_ATTR(event, "config:0-19"); | ||
424 | |||
425 | static struct attribute *power7_pmu_format_attr[] = { | ||
426 | &format_attr_event.attr, | ||
427 | NULL, | ||
428 | }; | ||
429 | |||
430 | struct attribute_group power7_pmu_format_group = { | ||
431 | .name = "format", | ||
432 | .attrs = power7_pmu_format_attr, | ||
433 | }; | ||
434 | |||
423 | static const struct attribute_group *power7_pmu_attr_groups[] = { | 435 | static const struct attribute_group *power7_pmu_attr_groups[] = { |
436 | &power7_pmu_format_group, | ||
424 | &power7_pmu_events_group, | 437 | &power7_pmu_events_group, |
425 | NULL, | 438 | NULL, |
426 | }; | 439 | }; |
diff --git a/arch/tile/configs/tilegx_defconfig b/arch/tile/configs/tilegx_defconfig index 8c5eff6d6df5..47684815e5c8 100644 --- a/arch/tile/configs/tilegx_defconfig +++ b/arch/tile/configs/tilegx_defconfig | |||
@@ -330,7 +330,6 @@ CONFIG_MD_RAID0=m | |||
330 | CONFIG_MD_RAID1=m | 330 | CONFIG_MD_RAID1=m |
331 | CONFIG_MD_RAID10=m | 331 | CONFIG_MD_RAID10=m |
332 | CONFIG_MD_RAID456=m | 332 | CONFIG_MD_RAID456=m |
333 | CONFIG_MULTICORE_RAID456=y | ||
334 | CONFIG_MD_FAULTY=m | 333 | CONFIG_MD_FAULTY=m |
335 | CONFIG_BLK_DEV_DM=m | 334 | CONFIG_BLK_DEV_DM=m |
336 | CONFIG_DM_DEBUG=y | 335 | CONFIG_DM_DEBUG=y |
diff --git a/arch/tile/configs/tilepro_defconfig b/arch/tile/configs/tilepro_defconfig index e7a3dfcbcda7..dd2b8f0c631f 100644 --- a/arch/tile/configs/tilepro_defconfig +++ b/arch/tile/configs/tilepro_defconfig | |||
@@ -324,7 +324,6 @@ CONFIG_MD_RAID0=m | |||
324 | CONFIG_MD_RAID1=m | 324 | CONFIG_MD_RAID1=m |
325 | CONFIG_MD_RAID10=m | 325 | CONFIG_MD_RAID10=m |
326 | CONFIG_MD_RAID456=m | 326 | CONFIG_MD_RAID456=m |
327 | CONFIG_MULTICORE_RAID456=y | ||
328 | CONFIG_MD_FAULTY=m | 327 | CONFIG_MD_FAULTY=m |
329 | CONFIG_BLK_DEV_DM=m | 328 | CONFIG_BLK_DEV_DM=m |
330 | CONFIG_DM_DEBUG=y | 329 | CONFIG_DM_DEBUG=y |
diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h index d3ddd17405d0..5a6d2873f80e 100644 --- a/arch/x86/include/asm/kprobes.h +++ b/arch/x86/include/asm/kprobes.h | |||
@@ -77,6 +77,7 @@ struct arch_specific_insn { | |||
77 | * a post_handler or break_handler). | 77 | * a post_handler or break_handler). |
78 | */ | 78 | */ |
79 | int boostable; | 79 | int boostable; |
80 | bool if_modifier; | ||
80 | }; | 81 | }; |
81 | 82 | ||
82 | struct arch_optimized_insn { | 83 | struct arch_optimized_insn { |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 635a74d22409..4979778cc7fb 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -414,8 +414,8 @@ struct kvm_vcpu_arch { | |||
414 | gpa_t time; | 414 | gpa_t time; |
415 | struct pvclock_vcpu_time_info hv_clock; | 415 | struct pvclock_vcpu_time_info hv_clock; |
416 | unsigned int hw_tsc_khz; | 416 | unsigned int hw_tsc_khz; |
417 | unsigned int time_offset; | 417 | struct gfn_to_hva_cache pv_time; |
418 | struct page *time_page; | 418 | bool pv_time_enabled; |
419 | /* set guest stopped flag in pvclock flags field */ | 419 | /* set guest stopped flag in pvclock flags field */ |
420 | bool pvclock_set_guest_stopped_request; | 420 | bool pvclock_set_guest_stopped_request; |
421 | 421 | ||
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 529c8931fc02..dab7580c47ae 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -101,6 +101,10 @@ static struct event_constraint intel_snb_event_constraints[] __read_mostly = | |||
101 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | 101 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ |
102 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | 102 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ |
103 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ | 103 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ |
104 | INTEL_UEVENT_CONSTRAINT(0x04a3, 0xf), /* CYCLE_ACTIVITY.CYCLES_NO_DISPATCH */ | ||
105 | INTEL_UEVENT_CONSTRAINT(0x05a3, 0xf), /* CYCLE_ACTIVITY.STALLS_L2_PENDING */ | ||
106 | INTEL_UEVENT_CONSTRAINT(0x02a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ | ||
107 | INTEL_UEVENT_CONSTRAINT(0x06a3, 0x4), /* CYCLE_ACTIVITY.STALLS_L1D_PENDING */ | ||
104 | INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.PENDING */ | 108 | INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.PENDING */ |
105 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ | 109 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ |
106 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ | 110 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ |
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 3f06e6149981..7bfe318d3d8a 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c | |||
@@ -375,6 +375,9 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p) | |||
375 | else | 375 | else |
376 | p->ainsn.boostable = -1; | 376 | p->ainsn.boostable = -1; |
377 | 377 | ||
378 | /* Check whether the instruction modifies Interrupt Flag or not */ | ||
379 | p->ainsn.if_modifier = is_IF_modifier(p->ainsn.insn); | ||
380 | |||
378 | /* Also, displacement change doesn't affect the first byte */ | 381 | /* Also, displacement change doesn't affect the first byte */ |
379 | p->opcode = p->ainsn.insn[0]; | 382 | p->opcode = p->ainsn.insn[0]; |
380 | } | 383 | } |
@@ -434,7 +437,7 @@ static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, | |||
434 | __this_cpu_write(current_kprobe, p); | 437 | __this_cpu_write(current_kprobe, p); |
435 | kcb->kprobe_saved_flags = kcb->kprobe_old_flags | 438 | kcb->kprobe_saved_flags = kcb->kprobe_old_flags |
436 | = (regs->flags & (X86_EFLAGS_TF | X86_EFLAGS_IF)); | 439 | = (regs->flags & (X86_EFLAGS_TF | X86_EFLAGS_IF)); |
437 | if (is_IF_modifier(p->ainsn.insn)) | 440 | if (p->ainsn.if_modifier) |
438 | kcb->kprobe_saved_flags &= ~X86_EFLAGS_IF; | 441 | kcb->kprobe_saved_flags &= ~X86_EFLAGS_IF; |
439 | } | 442 | } |
440 | 443 | ||
diff --git a/arch/x86/kernel/microcode_intel_early.c b/arch/x86/kernel/microcode_intel_early.c index 7890bc838952..d893e8ed8ac9 100644 --- a/arch/x86/kernel/microcode_intel_early.c +++ b/arch/x86/kernel/microcode_intel_early.c | |||
@@ -90,13 +90,13 @@ microcode_phys(struct microcode_intel **mc_saved_tmp, | |||
90 | struct microcode_intel ***mc_saved; | 90 | struct microcode_intel ***mc_saved; |
91 | 91 | ||
92 | mc_saved = (struct microcode_intel ***) | 92 | mc_saved = (struct microcode_intel ***) |
93 | __pa_symbol(&mc_saved_data->mc_saved); | 93 | __pa_nodebug(&mc_saved_data->mc_saved); |
94 | for (i = 0; i < mc_saved_data->mc_saved_count; i++) { | 94 | for (i = 0; i < mc_saved_data->mc_saved_count; i++) { |
95 | struct microcode_intel *p; | 95 | struct microcode_intel *p; |
96 | 96 | ||
97 | p = *(struct microcode_intel **) | 97 | p = *(struct microcode_intel **) |
98 | __pa(mc_saved_data->mc_saved + i); | 98 | __pa_nodebug(mc_saved_data->mc_saved + i); |
99 | mc_saved_tmp[i] = (struct microcode_intel *)__pa(p); | 99 | mc_saved_tmp[i] = (struct microcode_intel *)__pa_nodebug(p); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | #endif | 102 | #endif |
@@ -562,7 +562,7 @@ scan_microcode(unsigned long start, unsigned long end, | |||
562 | struct cpio_data cd; | 562 | struct cpio_data cd; |
563 | long offset = 0; | 563 | long offset = 0; |
564 | #ifdef CONFIG_X86_32 | 564 | #ifdef CONFIG_X86_32 |
565 | char *p = (char *)__pa_symbol(ucode_name); | 565 | char *p = (char *)__pa_nodebug(ucode_name); |
566 | #else | 566 | #else |
567 | char *p = ucode_name; | 567 | char *p = ucode_name; |
568 | #endif | 568 | #endif |
@@ -630,8 +630,8 @@ static void __cpuinit print_ucode(struct ucode_cpu_info *uci) | |||
630 | if (mc_intel == NULL) | 630 | if (mc_intel == NULL) |
631 | return; | 631 | return; |
632 | 632 | ||
633 | delay_ucode_info_p = (int *)__pa_symbol(&delay_ucode_info); | 633 | delay_ucode_info_p = (int *)__pa_nodebug(&delay_ucode_info); |
634 | current_mc_date_p = (int *)__pa_symbol(¤t_mc_date); | 634 | current_mc_date_p = (int *)__pa_nodebug(¤t_mc_date); |
635 | 635 | ||
636 | *delay_ucode_info_p = 1; | 636 | *delay_ucode_info_p = 1; |
637 | *current_mc_date_p = mc_intel->hdr.date; | 637 | *current_mc_date_p = mc_intel->hdr.date; |
@@ -659,8 +659,8 @@ static inline void __cpuinit print_ucode(struct ucode_cpu_info *uci) | |||
659 | } | 659 | } |
660 | #endif | 660 | #endif |
661 | 661 | ||
662 | static int apply_microcode_early(struct mc_saved_data *mc_saved_data, | 662 | static int __cpuinit apply_microcode_early(struct mc_saved_data *mc_saved_data, |
663 | struct ucode_cpu_info *uci) | 663 | struct ucode_cpu_info *uci) |
664 | { | 664 | { |
665 | struct microcode_intel *mc_intel; | 665 | struct microcode_intel *mc_intel; |
666 | unsigned int val[2]; | 666 | unsigned int val[2]; |
@@ -741,15 +741,15 @@ load_ucode_intel_bsp(void) | |||
741 | #ifdef CONFIG_X86_32 | 741 | #ifdef CONFIG_X86_32 |
742 | struct boot_params *boot_params_p; | 742 | struct boot_params *boot_params_p; |
743 | 743 | ||
744 | boot_params_p = (struct boot_params *)__pa_symbol(&boot_params); | 744 | boot_params_p = (struct boot_params *)__pa_nodebug(&boot_params); |
745 | ramdisk_image = boot_params_p->hdr.ramdisk_image; | 745 | ramdisk_image = boot_params_p->hdr.ramdisk_image; |
746 | ramdisk_size = boot_params_p->hdr.ramdisk_size; | 746 | ramdisk_size = boot_params_p->hdr.ramdisk_size; |
747 | initrd_start_early = ramdisk_image; | 747 | initrd_start_early = ramdisk_image; |
748 | initrd_end_early = initrd_start_early + ramdisk_size; | 748 | initrd_end_early = initrd_start_early + ramdisk_size; |
749 | 749 | ||
750 | _load_ucode_intel_bsp( | 750 | _load_ucode_intel_bsp( |
751 | (struct mc_saved_data *)__pa_symbol(&mc_saved_data), | 751 | (struct mc_saved_data *)__pa_nodebug(&mc_saved_data), |
752 | (unsigned long *)__pa_symbol(&mc_saved_in_initrd), | 752 | (unsigned long *)__pa_nodebug(&mc_saved_in_initrd), |
753 | initrd_start_early, initrd_end_early, &uci); | 753 | initrd_start_early, initrd_end_early, &uci); |
754 | #else | 754 | #else |
755 | ramdisk_image = boot_params.hdr.ramdisk_image; | 755 | ramdisk_image = boot_params.hdr.ramdisk_image; |
@@ -772,10 +772,10 @@ void __cpuinit load_ucode_intel_ap(void) | |||
772 | unsigned long *initrd_start_p; | 772 | unsigned long *initrd_start_p; |
773 | 773 | ||
774 | mc_saved_in_initrd_p = | 774 | mc_saved_in_initrd_p = |
775 | (unsigned long *)__pa_symbol(mc_saved_in_initrd); | 775 | (unsigned long *)__pa_nodebug(mc_saved_in_initrd); |
776 | mc_saved_data_p = (struct mc_saved_data *)__pa_symbol(&mc_saved_data); | 776 | mc_saved_data_p = (struct mc_saved_data *)__pa_nodebug(&mc_saved_data); |
777 | initrd_start_p = (unsigned long *)__pa_symbol(&initrd_start); | 777 | initrd_start_p = (unsigned long *)__pa_nodebug(&initrd_start); |
778 | initrd_start_addr = (unsigned long)__pa_symbol(*initrd_start_p); | 778 | initrd_start_addr = (unsigned long)__pa_nodebug(*initrd_start_p); |
779 | #else | 779 | #else |
780 | mc_saved_data_p = &mc_saved_data; | 780 | mc_saved_data_p = &mc_saved_data; |
781 | mc_saved_in_initrd_p = mc_saved_in_initrd; | 781 | mc_saved_in_initrd_p = mc_saved_in_initrd; |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f71500af1f81..f19ac0aca60d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1406,25 +1406,15 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1406 | unsigned long flags, this_tsc_khz; | 1406 | unsigned long flags, this_tsc_khz; |
1407 | struct kvm_vcpu_arch *vcpu = &v->arch; | 1407 | struct kvm_vcpu_arch *vcpu = &v->arch; |
1408 | struct kvm_arch *ka = &v->kvm->arch; | 1408 | struct kvm_arch *ka = &v->kvm->arch; |
1409 | void *shared_kaddr; | ||
1410 | s64 kernel_ns, max_kernel_ns; | 1409 | s64 kernel_ns, max_kernel_ns; |
1411 | u64 tsc_timestamp, host_tsc; | 1410 | u64 tsc_timestamp, host_tsc; |
1412 | struct pvclock_vcpu_time_info *guest_hv_clock; | 1411 | struct pvclock_vcpu_time_info guest_hv_clock; |
1413 | u8 pvclock_flags; | 1412 | u8 pvclock_flags; |
1414 | bool use_master_clock; | 1413 | bool use_master_clock; |
1415 | 1414 | ||
1416 | kernel_ns = 0; | 1415 | kernel_ns = 0; |
1417 | host_tsc = 0; | 1416 | host_tsc = 0; |
1418 | 1417 | ||
1419 | /* Keep irq disabled to prevent changes to the clock */ | ||
1420 | local_irq_save(flags); | ||
1421 | this_tsc_khz = __get_cpu_var(cpu_tsc_khz); | ||
1422 | if (unlikely(this_tsc_khz == 0)) { | ||
1423 | local_irq_restore(flags); | ||
1424 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, v); | ||
1425 | return 1; | ||
1426 | } | ||
1427 | |||
1428 | /* | 1418 | /* |
1429 | * If the host uses TSC clock, then passthrough TSC as stable | 1419 | * If the host uses TSC clock, then passthrough TSC as stable |
1430 | * to the guest. | 1420 | * to the guest. |
@@ -1436,6 +1426,15 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1436 | kernel_ns = ka->master_kernel_ns; | 1426 | kernel_ns = ka->master_kernel_ns; |
1437 | } | 1427 | } |
1438 | spin_unlock(&ka->pvclock_gtod_sync_lock); | 1428 | spin_unlock(&ka->pvclock_gtod_sync_lock); |
1429 | |||
1430 | /* Keep irq disabled to prevent changes to the clock */ | ||
1431 | local_irq_save(flags); | ||
1432 | this_tsc_khz = __get_cpu_var(cpu_tsc_khz); | ||
1433 | if (unlikely(this_tsc_khz == 0)) { | ||
1434 | local_irq_restore(flags); | ||
1435 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, v); | ||
1436 | return 1; | ||
1437 | } | ||
1439 | if (!use_master_clock) { | 1438 | if (!use_master_clock) { |
1440 | host_tsc = native_read_tsc(); | 1439 | host_tsc = native_read_tsc(); |
1441 | kernel_ns = get_kernel_ns(); | 1440 | kernel_ns = get_kernel_ns(); |
@@ -1463,7 +1462,7 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1463 | 1462 | ||
1464 | local_irq_restore(flags); | 1463 | local_irq_restore(flags); |
1465 | 1464 | ||
1466 | if (!vcpu->time_page) | 1465 | if (!vcpu->pv_time_enabled) |
1467 | return 0; | 1466 | return 0; |
1468 | 1467 | ||
1469 | /* | 1468 | /* |
@@ -1525,12 +1524,12 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1525 | */ | 1524 | */ |
1526 | vcpu->hv_clock.version += 2; | 1525 | vcpu->hv_clock.version += 2; |
1527 | 1526 | ||
1528 | shared_kaddr = kmap_atomic(vcpu->time_page); | 1527 | if (unlikely(kvm_read_guest_cached(v->kvm, &vcpu->pv_time, |
1529 | 1528 | &guest_hv_clock, sizeof(guest_hv_clock)))) | |
1530 | guest_hv_clock = shared_kaddr + vcpu->time_offset; | 1529 | return 0; |
1531 | 1530 | ||
1532 | /* retain PVCLOCK_GUEST_STOPPED if set in guest copy */ | 1531 | /* retain PVCLOCK_GUEST_STOPPED if set in guest copy */ |
1533 | pvclock_flags = (guest_hv_clock->flags & PVCLOCK_GUEST_STOPPED); | 1532 | pvclock_flags = (guest_hv_clock.flags & PVCLOCK_GUEST_STOPPED); |
1534 | 1533 | ||
1535 | if (vcpu->pvclock_set_guest_stopped_request) { | 1534 | if (vcpu->pvclock_set_guest_stopped_request) { |
1536 | pvclock_flags |= PVCLOCK_GUEST_STOPPED; | 1535 | pvclock_flags |= PVCLOCK_GUEST_STOPPED; |
@@ -1543,12 +1542,9 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1543 | 1542 | ||
1544 | vcpu->hv_clock.flags = pvclock_flags; | 1543 | vcpu->hv_clock.flags = pvclock_flags; |
1545 | 1544 | ||
1546 | memcpy(shared_kaddr + vcpu->time_offset, &vcpu->hv_clock, | 1545 | kvm_write_guest_cached(v->kvm, &vcpu->pv_time, |
1547 | sizeof(vcpu->hv_clock)); | 1546 | &vcpu->hv_clock, |
1548 | 1547 | sizeof(vcpu->hv_clock)); | |
1549 | kunmap_atomic(shared_kaddr); | ||
1550 | |||
1551 | mark_page_dirty(v->kvm, vcpu->time >> PAGE_SHIFT); | ||
1552 | return 0; | 1548 | return 0; |
1553 | } | 1549 | } |
1554 | 1550 | ||
@@ -1837,10 +1833,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) | |||
1837 | 1833 | ||
1838 | static void kvmclock_reset(struct kvm_vcpu *vcpu) | 1834 | static void kvmclock_reset(struct kvm_vcpu *vcpu) |
1839 | { | 1835 | { |
1840 | if (vcpu->arch.time_page) { | 1836 | vcpu->arch.pv_time_enabled = false; |
1841 | kvm_release_page_dirty(vcpu->arch.time_page); | ||
1842 | vcpu->arch.time_page = NULL; | ||
1843 | } | ||
1844 | } | 1837 | } |
1845 | 1838 | ||
1846 | static void accumulate_steal_time(struct kvm_vcpu *vcpu) | 1839 | static void accumulate_steal_time(struct kvm_vcpu *vcpu) |
@@ -1947,6 +1940,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
1947 | break; | 1940 | break; |
1948 | case MSR_KVM_SYSTEM_TIME_NEW: | 1941 | case MSR_KVM_SYSTEM_TIME_NEW: |
1949 | case MSR_KVM_SYSTEM_TIME: { | 1942 | case MSR_KVM_SYSTEM_TIME: { |
1943 | u64 gpa_offset; | ||
1950 | kvmclock_reset(vcpu); | 1944 | kvmclock_reset(vcpu); |
1951 | 1945 | ||
1952 | vcpu->arch.time = data; | 1946 | vcpu->arch.time = data; |
@@ -1956,14 +1950,17 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
1956 | if (!(data & 1)) | 1950 | if (!(data & 1)) |
1957 | break; | 1951 | break; |
1958 | 1952 | ||
1959 | /* ...but clean it before doing the actual write */ | 1953 | gpa_offset = data & ~(PAGE_MASK | 1); |
1960 | vcpu->arch.time_offset = data & ~(PAGE_MASK | 1); | ||
1961 | 1954 | ||
1962 | vcpu->arch.time_page = | 1955 | /* Check that the address is 32-byte aligned. */ |
1963 | gfn_to_page(vcpu->kvm, data >> PAGE_SHIFT); | 1956 | if (gpa_offset & (sizeof(struct pvclock_vcpu_time_info) - 1)) |
1957 | break; | ||
1964 | 1958 | ||
1965 | if (is_error_page(vcpu->arch.time_page)) | 1959 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, |
1966 | vcpu->arch.time_page = NULL; | 1960 | &vcpu->arch.pv_time, data & ~1ULL)) |
1961 | vcpu->arch.pv_time_enabled = false; | ||
1962 | else | ||
1963 | vcpu->arch.pv_time_enabled = true; | ||
1967 | 1964 | ||
1968 | break; | 1965 | break; |
1969 | } | 1966 | } |
@@ -2967,7 +2964,7 @@ static int kvm_vcpu_ioctl_x86_set_xcrs(struct kvm_vcpu *vcpu, | |||
2967 | */ | 2964 | */ |
2968 | static int kvm_set_guest_paused(struct kvm_vcpu *vcpu) | 2965 | static int kvm_set_guest_paused(struct kvm_vcpu *vcpu) |
2969 | { | 2966 | { |
2970 | if (!vcpu->arch.time_page) | 2967 | if (!vcpu->arch.pv_time_enabled) |
2971 | return -EINVAL; | 2968 | return -EINVAL; |
2972 | vcpu->arch.pvclock_set_guest_stopped_request = true; | 2969 | vcpu->arch.pvclock_set_guest_stopped_request = true; |
2973 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); | 2970 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); |
@@ -6718,6 +6715,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
6718 | goto fail_free_wbinvd_dirty_mask; | 6715 | goto fail_free_wbinvd_dirty_mask; |
6719 | 6716 | ||
6720 | vcpu->arch.ia32_tsc_adjust_msr = 0x0; | 6717 | vcpu->arch.ia32_tsc_adjust_msr = 0x0; |
6718 | vcpu->arch.pv_time_enabled = false; | ||
6721 | kvm_async_pf_hash_reset(vcpu); | 6719 | kvm_async_pf_hash_reset(vcpu); |
6722 | kvm_pmu_init(vcpu); | 6720 | kvm_pmu_init(vcpu); |
6723 | 6721 | ||
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c index 05928aae911e..906fea315791 100644 --- a/arch/x86/lib/usercopy_64.c +++ b/arch/x86/lib/usercopy_64.c | |||
@@ -74,10 +74,10 @@ copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest) | |||
74 | char c; | 74 | char c; |
75 | unsigned zero_len; | 75 | unsigned zero_len; |
76 | 76 | ||
77 | for (; len; --len) { | 77 | for (; len; --len, to++) { |
78 | if (__get_user_nocheck(c, from++, sizeof(char))) | 78 | if (__get_user_nocheck(c, from++, sizeof(char))) |
79 | break; | 79 | break; |
80 | if (__put_user_nocheck(c, to++, sizeof(char))) | 80 | if (__put_user_nocheck(c, to, sizeof(char))) |
81 | break; | 81 | break; |
82 | } | 82 | } |
83 | 83 | ||
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 3e751b74615e..a5a3ebcbdd2c 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -59,15 +59,16 @@ config ATA_ACPI | |||
59 | option libata.noacpi=1 | 59 | option libata.noacpi=1 |
60 | 60 | ||
61 | config SATA_ZPODD | 61 | config SATA_ZPODD |
62 | bool "SATA Zero Power ODD Support" | 62 | bool "SATA Zero Power Optical Disc Drive (ZPODD) support" |
63 | depends on ATA_ACPI | 63 | depends on ATA_ACPI |
64 | default n | 64 | default n |
65 | help | 65 | help |
66 | This option adds support for SATA ZPODD. It requires both | 66 | This option adds support for SATA Zero Power Optical Disc |
67 | ODD and the platform support, and if enabled, will automatically | 67 | Drive (ZPODD). It requires both the ODD and the platform |
68 | power on/off the ODD when certain condition is satisfied. This | 68 | support, and if enabled, will automatically power on/off the |
69 | does not impact user's experience of the ODD, only power is saved | 69 | ODD when certain condition is satisfied. This does not impact |
70 | when ODD is not in use(i.e. no disc inside). | 70 | end user's experience of the ODD, only power is saved when |
71 | the ODD is not in use (i.e. no disc inside). | ||
71 | 72 | ||
72 | If unsure, say N. | 73 | If unsure, say N. |
73 | 74 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index a99112cfd8b1..6a67b07de494 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -281,6 +281,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
281 | { PCI_VDEVICE(INTEL, 0x1f37), board_ahci }, /* Avoton RAID */ | 281 | { PCI_VDEVICE(INTEL, 0x1f37), board_ahci }, /* Avoton RAID */ |
282 | { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci }, /* Avoton RAID */ | 282 | { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci }, /* Avoton RAID */ |
283 | { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci }, /* Avoton RAID */ | 283 | { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci }, /* Avoton RAID */ |
284 | { PCI_VDEVICE(INTEL, 0x2823), board_ahci }, /* Wellsburg RAID */ | ||
285 | { PCI_VDEVICE(INTEL, 0x2827), board_ahci }, /* Wellsburg RAID */ | ||
284 | { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */ | 286 | { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */ |
285 | { PCI_VDEVICE(INTEL, 0x8d04), board_ahci }, /* Wellsburg RAID */ | 287 | { PCI_VDEVICE(INTEL, 0x8d04), board_ahci }, /* Wellsburg RAID */ |
286 | { PCI_VDEVICE(INTEL, 0x8d06), board_ahci }, /* Wellsburg RAID */ | 288 | { PCI_VDEVICE(INTEL, 0x8d06), board_ahci }, /* Wellsburg RAID */ |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index d2ba439cfe54..ffdd32d22602 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -1547,6 +1547,10 @@ static bool piix_broken_system_poweroff(struct pci_dev *pdev) | |||
1547 | 1547 | ||
1548 | static int prefer_ms_hyperv = 1; | 1548 | static int prefer_ms_hyperv = 1; |
1549 | module_param(prefer_ms_hyperv, int, 0); | 1549 | module_param(prefer_ms_hyperv, int, 0); |
1550 | MODULE_PARM_DESC(prefer_ms_hyperv, | ||
1551 | "Prefer Hyper-V paravirtualization drivers instead of ATA, " | ||
1552 | "0 - Use ATA drivers, " | ||
1553 | "1 (Default) - Use the paravirtualization drivers."); | ||
1550 | 1554 | ||
1551 | static void piix_ignore_devices_quirk(struct ata_host *host) | 1555 | static void piix_ignore_devices_quirk(struct ata_host *host) |
1552 | { | 1556 | { |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index beea3115577e..8a52dab412e2 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -1027,7 +1027,7 @@ static void ata_acpi_register_power_resource(struct ata_device *dev) | |||
1027 | 1027 | ||
1028 | handle = ata_dev_acpi_handle(dev); | 1028 | handle = ata_dev_acpi_handle(dev); |
1029 | if (handle) | 1029 | if (handle) |
1030 | acpi_dev_pm_remove_dependent(handle, &sdev->sdev_gendev); | 1030 | acpi_dev_pm_add_dependent(handle, &sdev->sdev_gendev); |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static void ata_acpi_unregister_power_resource(struct ata_device *dev) | 1033 | static void ata_acpi_unregister_power_resource(struct ata_device *dev) |
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c index 70b0e01372b3..6ef27e98c508 100644 --- a/drivers/ata/pata_samsung_cf.c +++ b/drivers/ata/pata_samsung_cf.c | |||
@@ -661,18 +661,7 @@ static struct platform_driver pata_s3c_driver = { | |||
661 | }, | 661 | }, |
662 | }; | 662 | }; |
663 | 663 | ||
664 | static int __init pata_s3c_init(void) | 664 | module_platform_driver_probe(pata_s3c_driver, pata_s3c_probe); |
665 | { | ||
666 | return platform_driver_probe(&pata_s3c_driver, pata_s3c_probe); | ||
667 | } | ||
668 | |||
669 | static void __exit pata_s3c_exit(void) | ||
670 | { | ||
671 | platform_driver_unregister(&pata_s3c_driver); | ||
672 | } | ||
673 | |||
674 | module_init(pata_s3c_init); | ||
675 | module_exit(pata_s3c_exit); | ||
676 | 665 | ||
677 | MODULE_AUTHOR("Abhilash Kesavan, <a.kesavan@samsung.com>"); | 666 | MODULE_AUTHOR("Abhilash Kesavan, <a.kesavan@samsung.com>"); |
678 | MODULE_DESCRIPTION("low-level driver for Samsung PATA controller"); | 667 | MODULE_DESCRIPTION("low-level driver for Samsung PATA controller"); |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 124b2c1d9c0b..608f82fed632 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -1511,8 +1511,7 @@ error_exit_with_cleanup: | |||
1511 | 1511 | ||
1512 | if (hcr_base) | 1512 | if (hcr_base) |
1513 | iounmap(hcr_base); | 1513 | iounmap(hcr_base); |
1514 | if (host_priv) | 1514 | kfree(host_priv); |
1515 | kfree(host_priv); | ||
1516 | 1515 | ||
1517 | return retval; | 1516 | return retval; |
1518 | } | 1517 | } |
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c index 07fb2dfaae13..9dcefe40380b 100644 --- a/drivers/block/nvme.c +++ b/drivers/block/nvme.c | |||
@@ -135,6 +135,7 @@ static inline void _nvme_check_size(void) | |||
135 | BUILD_BUG_ON(sizeof(struct nvme_id_ctrl) != 4096); | 135 | BUILD_BUG_ON(sizeof(struct nvme_id_ctrl) != 4096); |
136 | BUILD_BUG_ON(sizeof(struct nvme_id_ns) != 4096); | 136 | BUILD_BUG_ON(sizeof(struct nvme_id_ns) != 4096); |
137 | BUILD_BUG_ON(sizeof(struct nvme_lba_range_type) != 64); | 137 | BUILD_BUG_ON(sizeof(struct nvme_lba_range_type) != 64); |
138 | BUILD_BUG_ON(sizeof(struct nvme_smart_log) != 512); | ||
138 | } | 139 | } |
139 | 140 | ||
140 | typedef void (*nvme_completion_fn)(struct nvme_dev *, void *, | 141 | typedef void (*nvme_completion_fn)(struct nvme_dev *, void *, |
@@ -237,7 +238,8 @@ static void *free_cmdid(struct nvme_queue *nvmeq, int cmdid, | |||
237 | *fn = special_completion; | 238 | *fn = special_completion; |
238 | return CMD_CTX_INVALID; | 239 | return CMD_CTX_INVALID; |
239 | } | 240 | } |
240 | *fn = info[cmdid].fn; | 241 | if (fn) |
242 | *fn = info[cmdid].fn; | ||
241 | ctx = info[cmdid].ctx; | 243 | ctx = info[cmdid].ctx; |
242 | info[cmdid].fn = special_completion; | 244 | info[cmdid].fn = special_completion; |
243 | info[cmdid].ctx = CMD_CTX_COMPLETED; | 245 | info[cmdid].ctx = CMD_CTX_COMPLETED; |
@@ -335,6 +337,7 @@ nvme_alloc_iod(unsigned nseg, unsigned nbytes, gfp_t gfp) | |||
335 | iod->offset = offsetof(struct nvme_iod, sg[nseg]); | 337 | iod->offset = offsetof(struct nvme_iod, sg[nseg]); |
336 | iod->npages = -1; | 338 | iod->npages = -1; |
337 | iod->length = nbytes; | 339 | iod->length = nbytes; |
340 | iod->nents = 0; | ||
338 | } | 341 | } |
339 | 342 | ||
340 | return iod; | 343 | return iod; |
@@ -375,7 +378,8 @@ static void bio_completion(struct nvme_dev *dev, void *ctx, | |||
375 | struct bio *bio = iod->private; | 378 | struct bio *bio = iod->private; |
376 | u16 status = le16_to_cpup(&cqe->status) >> 1; | 379 | u16 status = le16_to_cpup(&cqe->status) >> 1; |
377 | 380 | ||
378 | dma_unmap_sg(&dev->pci_dev->dev, iod->sg, iod->nents, | 381 | if (iod->nents) |
382 | dma_unmap_sg(&dev->pci_dev->dev, iod->sg, iod->nents, | ||
379 | bio_data_dir(bio) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 383 | bio_data_dir(bio) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
380 | nvme_free_iod(dev, iod); | 384 | nvme_free_iod(dev, iod); |
381 | if (status) { | 385 | if (status) { |
@@ -589,7 +593,7 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns, | |||
589 | 593 | ||
590 | result = nvme_map_bio(nvmeq->q_dmadev, iod, bio, dma_dir, psegs); | 594 | result = nvme_map_bio(nvmeq->q_dmadev, iod, bio, dma_dir, psegs); |
591 | if (result < 0) | 595 | if (result < 0) |
592 | goto free_iod; | 596 | goto free_cmdid; |
593 | length = result; | 597 | length = result; |
594 | 598 | ||
595 | cmnd->rw.command_id = cmdid; | 599 | cmnd->rw.command_id = cmdid; |
@@ -609,6 +613,8 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns, | |||
609 | 613 | ||
610 | return 0; | 614 | return 0; |
611 | 615 | ||
616 | free_cmdid: | ||
617 | free_cmdid(nvmeq, cmdid, NULL); | ||
612 | free_iod: | 618 | free_iod: |
613 | nvme_free_iod(nvmeq->dev, iod); | 619 | nvme_free_iod(nvmeq->dev, iod); |
614 | nomem: | 620 | nomem: |
@@ -835,8 +841,8 @@ static int nvme_identify(struct nvme_dev *dev, unsigned nsid, unsigned cns, | |||
835 | return nvme_submit_admin_cmd(dev, &c, NULL); | 841 | return nvme_submit_admin_cmd(dev, &c, NULL); |
836 | } | 842 | } |
837 | 843 | ||
838 | static int nvme_get_features(struct nvme_dev *dev, unsigned fid, | 844 | static int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid, |
839 | unsigned nsid, dma_addr_t dma_addr) | 845 | dma_addr_t dma_addr, u32 *result) |
840 | { | 846 | { |
841 | struct nvme_command c; | 847 | struct nvme_command c; |
842 | 848 | ||
@@ -846,7 +852,7 @@ static int nvme_get_features(struct nvme_dev *dev, unsigned fid, | |||
846 | c.features.prp1 = cpu_to_le64(dma_addr); | 852 | c.features.prp1 = cpu_to_le64(dma_addr); |
847 | c.features.fid = cpu_to_le32(fid); | 853 | c.features.fid = cpu_to_le32(fid); |
848 | 854 | ||
849 | return nvme_submit_admin_cmd(dev, &c, NULL); | 855 | return nvme_submit_admin_cmd(dev, &c, result); |
850 | } | 856 | } |
851 | 857 | ||
852 | static int nvme_set_features(struct nvme_dev *dev, unsigned fid, | 858 | static int nvme_set_features(struct nvme_dev *dev, unsigned fid, |
@@ -906,6 +912,10 @@ static void nvme_free_queue(struct nvme_dev *dev, int qid) | |||
906 | 912 | ||
907 | spin_lock_irq(&nvmeq->q_lock); | 913 | spin_lock_irq(&nvmeq->q_lock); |
908 | nvme_cancel_ios(nvmeq, false); | 914 | nvme_cancel_ios(nvmeq, false); |
915 | while (bio_list_peek(&nvmeq->sq_cong)) { | ||
916 | struct bio *bio = bio_list_pop(&nvmeq->sq_cong); | ||
917 | bio_endio(bio, -EIO); | ||
918 | } | ||
909 | spin_unlock_irq(&nvmeq->q_lock); | 919 | spin_unlock_irq(&nvmeq->q_lock); |
910 | 920 | ||
911 | irq_set_affinity_hint(vector, NULL); | 921 | irq_set_affinity_hint(vector, NULL); |
@@ -1230,12 +1240,17 @@ static int nvme_user_admin_cmd(struct nvme_dev *dev, | |||
1230 | if (length != cmd.data_len) | 1240 | if (length != cmd.data_len) |
1231 | status = -ENOMEM; | 1241 | status = -ENOMEM; |
1232 | else | 1242 | else |
1233 | status = nvme_submit_admin_cmd(dev, &c, NULL); | 1243 | status = nvme_submit_admin_cmd(dev, &c, &cmd.result); |
1234 | 1244 | ||
1235 | if (cmd.data_len) { | 1245 | if (cmd.data_len) { |
1236 | nvme_unmap_user_pages(dev, cmd.opcode & 1, iod); | 1246 | nvme_unmap_user_pages(dev, cmd.opcode & 1, iod); |
1237 | nvme_free_iod(dev, iod); | 1247 | nvme_free_iod(dev, iod); |
1238 | } | 1248 | } |
1249 | |||
1250 | if (!status && copy_to_user(&ucmd->result, &cmd.result, | ||
1251 | sizeof(cmd.result))) | ||
1252 | status = -EFAULT; | ||
1253 | |||
1239 | return status; | 1254 | return status; |
1240 | } | 1255 | } |
1241 | 1256 | ||
@@ -1523,9 +1538,9 @@ static int nvme_dev_add(struct nvme_dev *dev) | |||
1523 | continue; | 1538 | continue; |
1524 | 1539 | ||
1525 | res = nvme_get_features(dev, NVME_FEAT_LBA_RANGE, i, | 1540 | res = nvme_get_features(dev, NVME_FEAT_LBA_RANGE, i, |
1526 | dma_addr + 4096); | 1541 | dma_addr + 4096, NULL); |
1527 | if (res) | 1542 | if (res) |
1528 | continue; | 1543 | memset(mem + 4096, 0, 4096); |
1529 | 1544 | ||
1530 | ns = nvme_alloc_ns(dev, i, mem, mem + 4096); | 1545 | ns = nvme_alloc_ns(dev, i, mem, mem + 4096); |
1531 | if (ns) | 1546 | if (ns) |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 910b0116c128..e1d13c463c90 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -2048,12 +2048,18 @@ static int init_csrows(struct mem_ctl_info *mci) | |||
2048 | edac_dbg(1, "MC node: %d, csrow: %d\n", | 2048 | edac_dbg(1, "MC node: %d, csrow: %d\n", |
2049 | pvt->mc_node_id, i); | 2049 | pvt->mc_node_id, i); |
2050 | 2050 | ||
2051 | if (row_dct0) | 2051 | if (row_dct0) { |
2052 | nr_pages = amd64_csrow_nr_pages(pvt, 0, i); | 2052 | nr_pages = amd64_csrow_nr_pages(pvt, 0, i); |
2053 | csrow->channels[0]->dimm->nr_pages = nr_pages; | ||
2054 | } | ||
2053 | 2055 | ||
2054 | /* K8 has only one DCT */ | 2056 | /* K8 has only one DCT */ |
2055 | if (boot_cpu_data.x86 != 0xf && row_dct1) | 2057 | if (boot_cpu_data.x86 != 0xf && row_dct1) { |
2056 | nr_pages += amd64_csrow_nr_pages(pvt, 1, i); | 2058 | int row_dct1_pages = amd64_csrow_nr_pages(pvt, 1, i); |
2059 | |||
2060 | csrow->channels[1]->dimm->nr_pages = row_dct1_pages; | ||
2061 | nr_pages += row_dct1_pages; | ||
2062 | } | ||
2057 | 2063 | ||
2058 | mtype = amd64_determine_memory_type(pvt, i); | 2064 | mtype = amd64_determine_memory_type(pvt, i); |
2059 | 2065 | ||
@@ -2072,9 +2078,7 @@ static int init_csrows(struct mem_ctl_info *mci) | |||
2072 | dimm = csrow->channels[j]->dimm; | 2078 | dimm = csrow->channels[j]->dimm; |
2073 | dimm->mtype = mtype; | 2079 | dimm->mtype = mtype; |
2074 | dimm->edac_mode = edac_mode; | 2080 | dimm->edac_mode = edac_mode; |
2075 | dimm->nr_pages = nr_pages; | ||
2076 | } | 2081 | } |
2077 | csrow->nr_pages = nr_pages; | ||
2078 | } | 2082 | } |
2079 | 2083 | ||
2080 | return empty; | 2084 | return empty; |
@@ -2419,7 +2423,6 @@ static int amd64_init_one_instance(struct pci_dev *F2) | |||
2419 | 2423 | ||
2420 | mci->pvt_info = pvt; | 2424 | mci->pvt_info = pvt; |
2421 | mci->pdev = &pvt->F2->dev; | 2425 | mci->pdev = &pvt->F2->dev; |
2422 | mci->csbased = 1; | ||
2423 | 2426 | ||
2424 | setup_mci_misc_attrs(mci, fam_type); | 2427 | setup_mci_misc_attrs(mci, fam_type); |
2425 | 2428 | ||
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index cdb81aa73ab7..27e86d938262 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c | |||
@@ -86,7 +86,7 @@ static void edac_mc_dump_dimm(struct dimm_info *dimm, int number) | |||
86 | edac_dimm_info_location(dimm, location, sizeof(location)); | 86 | edac_dimm_info_location(dimm, location, sizeof(location)); |
87 | 87 | ||
88 | edac_dbg(4, "%s%i: %smapped as virtual row %d, chan %d\n", | 88 | edac_dbg(4, "%s%i: %smapped as virtual row %d, chan %d\n", |
89 | dimm->mci->mem_is_per_rank ? "rank" : "dimm", | 89 | dimm->mci->csbased ? "rank" : "dimm", |
90 | number, location, dimm->csrow, dimm->cschannel); | 90 | number, location, dimm->csrow, dimm->cschannel); |
91 | edac_dbg(4, " dimm = %p\n", dimm); | 91 | edac_dbg(4, " dimm = %p\n", dimm); |
92 | edac_dbg(4, " dimm->label = '%s'\n", dimm->label); | 92 | edac_dbg(4, " dimm->label = '%s'\n", dimm->label); |
@@ -341,7 +341,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, | |||
341 | memcpy(mci->layers, layers, sizeof(*layer) * n_layers); | 341 | memcpy(mci->layers, layers, sizeof(*layer) * n_layers); |
342 | mci->nr_csrows = tot_csrows; | 342 | mci->nr_csrows = tot_csrows; |
343 | mci->num_cschannel = tot_channels; | 343 | mci->num_cschannel = tot_channels; |
344 | mci->mem_is_per_rank = per_rank; | 344 | mci->csbased = per_rank; |
345 | 345 | ||
346 | /* | 346 | /* |
347 | * Alocate and fill the csrow/channels structs | 347 | * Alocate and fill the csrow/channels structs |
@@ -1235,7 +1235,7 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, | |||
1235 | * incrementing the compat API counters | 1235 | * incrementing the compat API counters |
1236 | */ | 1236 | */ |
1237 | edac_dbg(4, "%s csrows map: (%d,%d)\n", | 1237 | edac_dbg(4, "%s csrows map: (%d,%d)\n", |
1238 | mci->mem_is_per_rank ? "rank" : "dimm", | 1238 | mci->csbased ? "rank" : "dimm", |
1239 | dimm->csrow, dimm->cschannel); | 1239 | dimm->csrow, dimm->cschannel); |
1240 | if (row == -1) | 1240 | if (row == -1) |
1241 | row = dimm->csrow; | 1241 | row = dimm->csrow; |
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index 4f4b6137d74e..5899a76eec3b 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c | |||
@@ -143,7 +143,7 @@ static const char *edac_caps[] = { | |||
143 | * and the per-dimm/per-rank one | 143 | * and the per-dimm/per-rank one |
144 | */ | 144 | */ |
145 | #define DEVICE_ATTR_LEGACY(_name, _mode, _show, _store) \ | 145 | #define DEVICE_ATTR_LEGACY(_name, _mode, _show, _store) \ |
146 | struct device_attribute dev_attr_legacy_##_name = __ATTR(_name, _mode, _show, _store) | 146 | static struct device_attribute dev_attr_legacy_##_name = __ATTR(_name, _mode, _show, _store) |
147 | 147 | ||
148 | struct dev_ch_attribute { | 148 | struct dev_ch_attribute { |
149 | struct device_attribute attr; | 149 | struct device_attribute attr; |
@@ -180,9 +180,6 @@ static ssize_t csrow_size_show(struct device *dev, | |||
180 | int i; | 180 | int i; |
181 | u32 nr_pages = 0; | 181 | u32 nr_pages = 0; |
182 | 182 | ||
183 | if (csrow->mci->csbased) | ||
184 | return sprintf(data, "%u\n", PAGES_TO_MiB(csrow->nr_pages)); | ||
185 | |||
186 | for (i = 0; i < csrow->nr_channels; i++) | 183 | for (i = 0; i < csrow->nr_channels; i++) |
187 | nr_pages += csrow->channels[i]->dimm->nr_pages; | 184 | nr_pages += csrow->channels[i]->dimm->nr_pages; |
188 | return sprintf(data, "%u\n", PAGES_TO_MiB(nr_pages)); | 185 | return sprintf(data, "%u\n", PAGES_TO_MiB(nr_pages)); |
@@ -612,7 +609,7 @@ static int edac_create_dimm_object(struct mem_ctl_info *mci, | |||
612 | device_initialize(&dimm->dev); | 609 | device_initialize(&dimm->dev); |
613 | 610 | ||
614 | dimm->dev.parent = &mci->dev; | 611 | dimm->dev.parent = &mci->dev; |
615 | if (mci->mem_is_per_rank) | 612 | if (mci->csbased) |
616 | dev_set_name(&dimm->dev, "rank%d", index); | 613 | dev_set_name(&dimm->dev, "rank%d", index); |
617 | else | 614 | else |
618 | dev_set_name(&dimm->dev, "dimm%d", index); | 615 | dev_set_name(&dimm->dev, "dimm%d", index); |
@@ -778,14 +775,10 @@ static ssize_t mci_size_mb_show(struct device *dev, | |||
778 | for (csrow_idx = 0; csrow_idx < mci->nr_csrows; csrow_idx++) { | 775 | for (csrow_idx = 0; csrow_idx < mci->nr_csrows; csrow_idx++) { |
779 | struct csrow_info *csrow = mci->csrows[csrow_idx]; | 776 | struct csrow_info *csrow = mci->csrows[csrow_idx]; |
780 | 777 | ||
781 | if (csrow->mci->csbased) { | 778 | for (j = 0; j < csrow->nr_channels; j++) { |
782 | total_pages += csrow->nr_pages; | 779 | struct dimm_info *dimm = csrow->channels[j]->dimm; |
783 | } else { | ||
784 | for (j = 0; j < csrow->nr_channels; j++) { | ||
785 | struct dimm_info *dimm = csrow->channels[j]->dimm; | ||
786 | 780 | ||
787 | total_pages += dimm->nr_pages; | 781 | total_pages += dimm->nr_pages; |
788 | } | ||
789 | } | 782 | } |
790 | } | 783 | } |
791 | 784 | ||
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 9b00072a020f..42c759a4d047 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig | |||
@@ -53,6 +53,24 @@ config EFI_VARS | |||
53 | Subsequent efibootmgr releases may be found at: | 53 | Subsequent efibootmgr releases may be found at: |
54 | <http://linux.dell.com/efibootmgr> | 54 | <http://linux.dell.com/efibootmgr> |
55 | 55 | ||
56 | config EFI_VARS_PSTORE | ||
57 | bool "Register efivars backend for pstore" | ||
58 | depends on EFI_VARS && PSTORE | ||
59 | default y | ||
60 | help | ||
61 | Say Y here to enable use efivars as a backend to pstore. This | ||
62 | will allow writing console messages, crash dumps, or anything | ||
63 | else supported by pstore to EFI variables. | ||
64 | |||
65 | config EFI_VARS_PSTORE_DEFAULT_DISABLE | ||
66 | bool "Disable using efivars as a pstore backend by default" | ||
67 | depends on EFI_VARS_PSTORE | ||
68 | default n | ||
69 | help | ||
70 | Saying Y here will disable the use of efivars as a storage | ||
71 | backend for pstore by default. This setting can be overridden | ||
72 | using the efivars module's pstore_disable parameter. | ||
73 | |||
56 | config EFI_PCDP | 74 | config EFI_PCDP |
57 | bool "Console device selection via EFI PCDP or HCDP table" | 75 | bool "Console device selection via EFI PCDP or HCDP table" |
58 | depends on ACPI && EFI && IA64 | 76 | depends on ACPI && EFI && IA64 |
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index fe62aa392239..7acafb80fd4c 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
@@ -103,6 +103,11 @@ MODULE_VERSION(EFIVARS_VERSION); | |||
103 | */ | 103 | */ |
104 | #define GUID_LEN 36 | 104 | #define GUID_LEN 36 |
105 | 105 | ||
106 | static bool efivars_pstore_disable = | ||
107 | IS_ENABLED(CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE); | ||
108 | |||
109 | module_param_named(pstore_disable, efivars_pstore_disable, bool, 0644); | ||
110 | |||
106 | /* | 111 | /* |
107 | * The maximum size of VariableName + Data = 1024 | 112 | * The maximum size of VariableName + Data = 1024 |
108 | * Therefore, it's reasonable to save that much | 113 | * Therefore, it's reasonable to save that much |
@@ -165,6 +170,7 @@ efivar_create_sysfs_entry(struct efivars *efivars, | |||
165 | 170 | ||
166 | static void efivar_update_sysfs_entries(struct work_struct *); | 171 | static void efivar_update_sysfs_entries(struct work_struct *); |
167 | static DECLARE_WORK(efivar_work, efivar_update_sysfs_entries); | 172 | static DECLARE_WORK(efivar_work, efivar_update_sysfs_entries); |
173 | static bool efivar_wq_enabled = true; | ||
168 | 174 | ||
169 | /* Return the number of unicode characters in data */ | 175 | /* Return the number of unicode characters in data */ |
170 | static unsigned long | 176 | static unsigned long |
@@ -1309,9 +1315,7 @@ static const struct inode_operations efivarfs_dir_inode_operations = { | |||
1309 | .create = efivarfs_create, | 1315 | .create = efivarfs_create, |
1310 | }; | 1316 | }; |
1311 | 1317 | ||
1312 | static struct pstore_info efi_pstore_info; | 1318 | #ifdef CONFIG_EFI_VARS_PSTORE |
1313 | |||
1314 | #ifdef CONFIG_PSTORE | ||
1315 | 1319 | ||
1316 | static int efi_pstore_open(struct pstore_info *psi) | 1320 | static int efi_pstore_open(struct pstore_info *psi) |
1317 | { | 1321 | { |
@@ -1441,7 +1445,7 @@ static int efi_pstore_write(enum pstore_type_id type, | |||
1441 | 1445 | ||
1442 | spin_unlock_irqrestore(&efivars->lock, flags); | 1446 | spin_unlock_irqrestore(&efivars->lock, flags); |
1443 | 1447 | ||
1444 | if (reason == KMSG_DUMP_OOPS) | 1448 | if (reason == KMSG_DUMP_OOPS && efivar_wq_enabled) |
1445 | schedule_work(&efivar_work); | 1449 | schedule_work(&efivar_work); |
1446 | 1450 | ||
1447 | *id = part; | 1451 | *id = part; |
@@ -1514,38 +1518,6 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | |||
1514 | 1518 | ||
1515 | return 0; | 1519 | return 0; |
1516 | } | 1520 | } |
1517 | #else | ||
1518 | static int efi_pstore_open(struct pstore_info *psi) | ||
1519 | { | ||
1520 | return 0; | ||
1521 | } | ||
1522 | |||
1523 | static int efi_pstore_close(struct pstore_info *psi) | ||
1524 | { | ||
1525 | return 0; | ||
1526 | } | ||
1527 | |||
1528 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, int *count, | ||
1529 | struct timespec *timespec, | ||
1530 | char **buf, struct pstore_info *psi) | ||
1531 | { | ||
1532 | return -1; | ||
1533 | } | ||
1534 | |||
1535 | static int efi_pstore_write(enum pstore_type_id type, | ||
1536 | enum kmsg_dump_reason reason, u64 *id, | ||
1537 | unsigned int part, int count, size_t size, | ||
1538 | struct pstore_info *psi) | ||
1539 | { | ||
1540 | return 0; | ||
1541 | } | ||
1542 | |||
1543 | static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | ||
1544 | struct timespec time, struct pstore_info *psi) | ||
1545 | { | ||
1546 | return 0; | ||
1547 | } | ||
1548 | #endif | ||
1549 | 1521 | ||
1550 | static struct pstore_info efi_pstore_info = { | 1522 | static struct pstore_info efi_pstore_info = { |
1551 | .owner = THIS_MODULE, | 1523 | .owner = THIS_MODULE, |
@@ -1557,6 +1529,24 @@ static struct pstore_info efi_pstore_info = { | |||
1557 | .erase = efi_pstore_erase, | 1529 | .erase = efi_pstore_erase, |
1558 | }; | 1530 | }; |
1559 | 1531 | ||
1532 | static void efivar_pstore_register(struct efivars *efivars) | ||
1533 | { | ||
1534 | efivars->efi_pstore_info = efi_pstore_info; | ||
1535 | efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL); | ||
1536 | if (efivars->efi_pstore_info.buf) { | ||
1537 | efivars->efi_pstore_info.bufsize = 1024; | ||
1538 | efivars->efi_pstore_info.data = efivars; | ||
1539 | spin_lock_init(&efivars->efi_pstore_info.buf_lock); | ||
1540 | pstore_register(&efivars->efi_pstore_info); | ||
1541 | } | ||
1542 | } | ||
1543 | #else | ||
1544 | static void efivar_pstore_register(struct efivars *efivars) | ||
1545 | { | ||
1546 | return; | ||
1547 | } | ||
1548 | #endif | ||
1549 | |||
1560 | static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | 1550 | static ssize_t efivar_create(struct file *filp, struct kobject *kobj, |
1561 | struct bin_attribute *bin_attr, | 1551 | struct bin_attribute *bin_attr, |
1562 | char *buf, loff_t pos, size_t count) | 1552 | char *buf, loff_t pos, size_t count) |
@@ -1716,6 +1706,31 @@ static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor) | |||
1716 | return found; | 1706 | return found; |
1717 | } | 1707 | } |
1718 | 1708 | ||
1709 | /* | ||
1710 | * Returns the size of variable_name, in bytes, including the | ||
1711 | * terminating NULL character, or variable_name_size if no NULL | ||
1712 | * character is found among the first variable_name_size bytes. | ||
1713 | */ | ||
1714 | static unsigned long var_name_strnsize(efi_char16_t *variable_name, | ||
1715 | unsigned long variable_name_size) | ||
1716 | { | ||
1717 | unsigned long len; | ||
1718 | efi_char16_t c; | ||
1719 | |||
1720 | /* | ||
1721 | * The variable name is, by definition, a NULL-terminated | ||
1722 | * string, so make absolutely sure that variable_name_size is | ||
1723 | * the value we expect it to be. If not, return the real size. | ||
1724 | */ | ||
1725 | for (len = 2; len <= variable_name_size; len += sizeof(c)) { | ||
1726 | c = variable_name[(len / sizeof(c)) - 1]; | ||
1727 | if (!c) | ||
1728 | break; | ||
1729 | } | ||
1730 | |||
1731 | return min(len, variable_name_size); | ||
1732 | } | ||
1733 | |||
1719 | static void efivar_update_sysfs_entries(struct work_struct *work) | 1734 | static void efivar_update_sysfs_entries(struct work_struct *work) |
1720 | { | 1735 | { |
1721 | struct efivars *efivars = &__efivars; | 1736 | struct efivars *efivars = &__efivars; |
@@ -1756,10 +1771,13 @@ static void efivar_update_sysfs_entries(struct work_struct *work) | |||
1756 | if (!found) { | 1771 | if (!found) { |
1757 | kfree(variable_name); | 1772 | kfree(variable_name); |
1758 | break; | 1773 | break; |
1759 | } else | 1774 | } else { |
1775 | variable_name_size = var_name_strnsize(variable_name, | ||
1776 | variable_name_size); | ||
1760 | efivar_create_sysfs_entry(efivars, | 1777 | efivar_create_sysfs_entry(efivars, |
1761 | variable_name_size, | 1778 | variable_name_size, |
1762 | variable_name, &vendor); | 1779 | variable_name, &vendor); |
1780 | } | ||
1763 | } | 1781 | } |
1764 | } | 1782 | } |
1765 | 1783 | ||
@@ -1958,6 +1976,35 @@ void unregister_efivars(struct efivars *efivars) | |||
1958 | } | 1976 | } |
1959 | EXPORT_SYMBOL_GPL(unregister_efivars); | 1977 | EXPORT_SYMBOL_GPL(unregister_efivars); |
1960 | 1978 | ||
1979 | /* | ||
1980 | * Print a warning when duplicate EFI variables are encountered and | ||
1981 | * disable the sysfs workqueue since the firmware is buggy. | ||
1982 | */ | ||
1983 | static void dup_variable_bug(efi_char16_t *s16, efi_guid_t *vendor_guid, | ||
1984 | unsigned long len16) | ||
1985 | { | ||
1986 | size_t i, len8 = len16 / sizeof(efi_char16_t); | ||
1987 | char *s8; | ||
1988 | |||
1989 | /* | ||
1990 | * Disable the workqueue since the algorithm it uses for | ||
1991 | * detecting new variables won't work with this buggy | ||
1992 | * implementation of GetNextVariableName(). | ||
1993 | */ | ||
1994 | efivar_wq_enabled = false; | ||
1995 | |||
1996 | s8 = kzalloc(len8, GFP_KERNEL); | ||
1997 | if (!s8) | ||
1998 | return; | ||
1999 | |||
2000 | for (i = 0; i < len8; i++) | ||
2001 | s8[i] = s16[i]; | ||
2002 | |||
2003 | printk(KERN_WARNING "efivars: duplicate variable: %s-%pUl\n", | ||
2004 | s8, vendor_guid); | ||
2005 | kfree(s8); | ||
2006 | } | ||
2007 | |||
1961 | int register_efivars(struct efivars *efivars, | 2008 | int register_efivars(struct efivars *efivars, |
1962 | const struct efivar_operations *ops, | 2009 | const struct efivar_operations *ops, |
1963 | struct kobject *parent_kobj) | 2010 | struct kobject *parent_kobj) |
@@ -2006,6 +2053,24 @@ int register_efivars(struct efivars *efivars, | |||
2006 | &vendor_guid); | 2053 | &vendor_guid); |
2007 | switch (status) { | 2054 | switch (status) { |
2008 | case EFI_SUCCESS: | 2055 | case EFI_SUCCESS: |
2056 | variable_name_size = var_name_strnsize(variable_name, | ||
2057 | variable_name_size); | ||
2058 | |||
2059 | /* | ||
2060 | * Some firmware implementations return the | ||
2061 | * same variable name on multiple calls to | ||
2062 | * get_next_variable(). Terminate the loop | ||
2063 | * immediately as there is no guarantee that | ||
2064 | * we'll ever see a different variable name, | ||
2065 | * and may end up looping here forever. | ||
2066 | */ | ||
2067 | if (variable_is_present(variable_name, &vendor_guid)) { | ||
2068 | dup_variable_bug(variable_name, &vendor_guid, | ||
2069 | variable_name_size); | ||
2070 | status = EFI_NOT_FOUND; | ||
2071 | break; | ||
2072 | } | ||
2073 | |||
2009 | efivar_create_sysfs_entry(efivars, | 2074 | efivar_create_sysfs_entry(efivars, |
2010 | variable_name_size, | 2075 | variable_name_size, |
2011 | variable_name, | 2076 | variable_name, |
@@ -2025,15 +2090,8 @@ int register_efivars(struct efivars *efivars, | |||
2025 | if (error) | 2090 | if (error) |
2026 | unregister_efivars(efivars); | 2091 | unregister_efivars(efivars); |
2027 | 2092 | ||
2028 | efivars->efi_pstore_info = efi_pstore_info; | 2093 | if (!efivars_pstore_disable) |
2029 | 2094 | efivar_pstore_register(efivars); | |
2030 | efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL); | ||
2031 | if (efivars->efi_pstore_info.buf) { | ||
2032 | efivars->efi_pstore_info.bufsize = 1024; | ||
2033 | efivars->efi_pstore_info.data = efivars; | ||
2034 | spin_lock_init(&efivars->efi_pstore_info.buf_lock); | ||
2035 | pstore_register(&efivars->efi_pstore_info); | ||
2036 | } | ||
2037 | 2095 | ||
2038 | register_filesystem(&efivarfs_type); | 2096 | register_filesystem(&efivarfs_type); |
2039 | 2097 | ||
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index a71a54a3e3f7..5150df6cba08 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
@@ -193,7 +193,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) | |||
193 | if (!np) | 193 | if (!np) |
194 | return; | 194 | return; |
195 | 195 | ||
196 | do { | 196 | for (;; index++) { |
197 | ret = of_parse_phandle_with_args(np, "gpio-ranges", | 197 | ret = of_parse_phandle_with_args(np, "gpio-ranges", |
198 | "#gpio-range-cells", index, &pinspec); | 198 | "#gpio-range-cells", index, &pinspec); |
199 | if (ret) | 199 | if (ret) |
@@ -222,8 +222,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) | |||
222 | 222 | ||
223 | if (ret) | 223 | if (ret) |
224 | break; | 224 | break; |
225 | 225 | } | |
226 | } while (index++); | ||
227 | } | 226 | } |
228 | 227 | ||
229 | #else | 228 | #else |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index c194f4e680ad..e2acfdbf7d3c 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -1634,7 +1634,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, | |||
1634 | unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo; | 1634 | unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo; |
1635 | unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo; | 1635 | unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo; |
1636 | unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse_width_lo; | 1636 | unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse_width_lo; |
1637 | unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) >> 2 | pt->vsync_offset_pulse_width_lo >> 4; | 1637 | unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) << 2 | pt->vsync_offset_pulse_width_lo >> 4; |
1638 | unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offset_pulse_width_lo & 0xf); | 1638 | unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offset_pulse_width_lo & 0xf); |
1639 | 1639 | ||
1640 | /* ignore tiny modes */ | 1640 | /* ignore tiny modes */ |
@@ -1715,6 +1715,7 @@ set_size: | |||
1715 | } | 1715 | } |
1716 | 1716 | ||
1717 | mode->type = DRM_MODE_TYPE_DRIVER; | 1717 | mode->type = DRM_MODE_TYPE_DRIVER; |
1718 | mode->vrefresh = drm_mode_vrefresh(mode); | ||
1718 | drm_mode_set_name(mode); | 1719 | drm_mode_set_name(mode); |
1719 | 1720 | ||
1720 | return mode; | 1721 | return mode; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 36493ce71f9a..98cc14725ba9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -38,11 +38,12 @@ | |||
38 | /* position control register for hardware window 0, 2 ~ 4.*/ | 38 | /* position control register for hardware window 0, 2 ~ 4.*/ |
39 | #define VIDOSD_A(win) (VIDOSD_BASE + 0x00 + (win) * 16) | 39 | #define VIDOSD_A(win) (VIDOSD_BASE + 0x00 + (win) * 16) |
40 | #define VIDOSD_B(win) (VIDOSD_BASE + 0x04 + (win) * 16) | 40 | #define VIDOSD_B(win) (VIDOSD_BASE + 0x04 + (win) * 16) |
41 | /* size control register for hardware window 0. */ | 41 | /* |
42 | #define VIDOSD_C_SIZE_W0 (VIDOSD_BASE + 0x08) | 42 | * size control register for hardware windows 0 and alpha control register |
43 | /* alpha control register for hardware window 1 ~ 4. */ | 43 | * for hardware windows 1 ~ 4 |
44 | #define VIDOSD_C(win) (VIDOSD_BASE + 0x18 + (win) * 16) | 44 | */ |
45 | /* size control register for hardware window 1 ~ 4. */ | 45 | #define VIDOSD_C(win) (VIDOSD_BASE + 0x08 + (win) * 16) |
46 | /* size control register for hardware windows 1 ~ 2. */ | ||
46 | #define VIDOSD_D(win) (VIDOSD_BASE + 0x0C + (win) * 16) | 47 | #define VIDOSD_D(win) (VIDOSD_BASE + 0x0C + (win) * 16) |
47 | 48 | ||
48 | #define VIDWx_BUF_START(win, buf) (VIDW_BUF_START(buf) + (win) * 8) | 49 | #define VIDWx_BUF_START(win, buf) (VIDW_BUF_START(buf) + (win) * 8) |
@@ -50,9 +51,9 @@ | |||
50 | #define VIDWx_BUF_SIZE(win, buf) (VIDW_BUF_SIZE(buf) + (win) * 4) | 51 | #define VIDWx_BUF_SIZE(win, buf) (VIDW_BUF_SIZE(buf) + (win) * 4) |
51 | 52 | ||
52 | /* color key control register for hardware window 1 ~ 4. */ | 53 | /* color key control register for hardware window 1 ~ 4. */ |
53 | #define WKEYCON0_BASE(x) ((WKEYCON0 + 0x140) + (x * 8)) | 54 | #define WKEYCON0_BASE(x) ((WKEYCON0 + 0x140) + ((x - 1) * 8)) |
54 | /* color key value register for hardware window 1 ~ 4. */ | 55 | /* color key value register for hardware window 1 ~ 4. */ |
55 | #define WKEYCON1_BASE(x) ((WKEYCON1 + 0x140) + (x * 8)) | 56 | #define WKEYCON1_BASE(x) ((WKEYCON1 + 0x140) + ((x - 1) * 8)) |
56 | 57 | ||
57 | /* FIMD has totally five hardware windows. */ | 58 | /* FIMD has totally five hardware windows. */ |
58 | #define WINDOWS_NR 5 | 59 | #define WINDOWS_NR 5 |
@@ -109,9 +110,9 @@ struct fimd_context { | |||
109 | 110 | ||
110 | #ifdef CONFIG_OF | 111 | #ifdef CONFIG_OF |
111 | static const struct of_device_id fimd_driver_dt_match[] = { | 112 | static const struct of_device_id fimd_driver_dt_match[] = { |
112 | { .compatible = "samsung,exynos4-fimd", | 113 | { .compatible = "samsung,exynos4210-fimd", |
113 | .data = &exynos4_fimd_driver_data }, | 114 | .data = &exynos4_fimd_driver_data }, |
114 | { .compatible = "samsung,exynos5-fimd", | 115 | { .compatible = "samsung,exynos5250-fimd", |
115 | .data = &exynos5_fimd_driver_data }, | 116 | .data = &exynos5_fimd_driver_data }, |
116 | {}, | 117 | {}, |
117 | }; | 118 | }; |
@@ -581,7 +582,7 @@ static void fimd_win_commit(struct device *dev, int zpos) | |||
581 | if (win != 3 && win != 4) { | 582 | if (win != 3 && win != 4) { |
582 | u32 offset = VIDOSD_D(win); | 583 | u32 offset = VIDOSD_D(win); |
583 | if (win == 0) | 584 | if (win == 0) |
584 | offset = VIDOSD_C_SIZE_W0; | 585 | offset = VIDOSD_C(win); |
585 | val = win_data->ovl_width * win_data->ovl_height; | 586 | val = win_data->ovl_width * win_data->ovl_height; |
586 | writel(val, ctx->regs + offset); | 587 | writel(val, ctx->regs + offset); |
587 | 588 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 3b0da0378acf..47a493c8a71f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
@@ -48,8 +48,14 @@ | |||
48 | 48 | ||
49 | /* registers for base address */ | 49 | /* registers for base address */ |
50 | #define G2D_SRC_BASE_ADDR 0x0304 | 50 | #define G2D_SRC_BASE_ADDR 0x0304 |
51 | #define G2D_SRC_COLOR_MODE 0x030C | ||
52 | #define G2D_SRC_LEFT_TOP 0x0310 | ||
53 | #define G2D_SRC_RIGHT_BOTTOM 0x0314 | ||
51 | #define G2D_SRC_PLANE2_BASE_ADDR 0x0318 | 54 | #define G2D_SRC_PLANE2_BASE_ADDR 0x0318 |
52 | #define G2D_DST_BASE_ADDR 0x0404 | 55 | #define G2D_DST_BASE_ADDR 0x0404 |
56 | #define G2D_DST_COLOR_MODE 0x040C | ||
57 | #define G2D_DST_LEFT_TOP 0x0410 | ||
58 | #define G2D_DST_RIGHT_BOTTOM 0x0414 | ||
53 | #define G2D_DST_PLANE2_BASE_ADDR 0x0418 | 59 | #define G2D_DST_PLANE2_BASE_ADDR 0x0418 |
54 | #define G2D_PAT_BASE_ADDR 0x0500 | 60 | #define G2D_PAT_BASE_ADDR 0x0500 |
55 | #define G2D_MSK_BASE_ADDR 0x0520 | 61 | #define G2D_MSK_BASE_ADDR 0x0520 |
@@ -82,7 +88,7 @@ | |||
82 | #define G2D_DMA_LIST_DONE_COUNT_OFFSET 17 | 88 | #define G2D_DMA_LIST_DONE_COUNT_OFFSET 17 |
83 | 89 | ||
84 | /* G2D_DMA_HOLD_CMD */ | 90 | /* G2D_DMA_HOLD_CMD */ |
85 | #define G2D_USET_HOLD (1 << 2) | 91 | #define G2D_USER_HOLD (1 << 2) |
86 | #define G2D_LIST_HOLD (1 << 1) | 92 | #define G2D_LIST_HOLD (1 << 1) |
87 | #define G2D_BITBLT_HOLD (1 << 0) | 93 | #define G2D_BITBLT_HOLD (1 << 0) |
88 | 94 | ||
@@ -91,13 +97,27 @@ | |||
91 | #define G2D_START_NHOLT (1 << 1) | 97 | #define G2D_START_NHOLT (1 << 1) |
92 | #define G2D_START_BITBLT (1 << 0) | 98 | #define G2D_START_BITBLT (1 << 0) |
93 | 99 | ||
100 | /* buffer color format */ | ||
101 | #define G2D_FMT_XRGB8888 0 | ||
102 | #define G2D_FMT_ARGB8888 1 | ||
103 | #define G2D_FMT_RGB565 2 | ||
104 | #define G2D_FMT_XRGB1555 3 | ||
105 | #define G2D_FMT_ARGB1555 4 | ||
106 | #define G2D_FMT_XRGB4444 5 | ||
107 | #define G2D_FMT_ARGB4444 6 | ||
108 | #define G2D_FMT_PACKED_RGB888 7 | ||
109 | #define G2D_FMT_A8 11 | ||
110 | #define G2D_FMT_L8 12 | ||
111 | |||
112 | /* buffer valid length */ | ||
113 | #define G2D_LEN_MIN 1 | ||
114 | #define G2D_LEN_MAX 8000 | ||
115 | |||
94 | #define G2D_CMDLIST_SIZE (PAGE_SIZE / 4) | 116 | #define G2D_CMDLIST_SIZE (PAGE_SIZE / 4) |
95 | #define G2D_CMDLIST_NUM 64 | 117 | #define G2D_CMDLIST_NUM 64 |
96 | #define G2D_CMDLIST_POOL_SIZE (G2D_CMDLIST_SIZE * G2D_CMDLIST_NUM) | 118 | #define G2D_CMDLIST_POOL_SIZE (G2D_CMDLIST_SIZE * G2D_CMDLIST_NUM) |
97 | #define G2D_CMDLIST_DATA_NUM (G2D_CMDLIST_SIZE / sizeof(u32) - 2) | 119 | #define G2D_CMDLIST_DATA_NUM (G2D_CMDLIST_SIZE / sizeof(u32) - 2) |
98 | 120 | ||
99 | #define MAX_BUF_ADDR_NR 6 | ||
100 | |||
101 | /* maximum buffer pool size of userptr is 64MB as default */ | 121 | /* maximum buffer pool size of userptr is 64MB as default */ |
102 | #define MAX_POOL (64 * 1024 * 1024) | 122 | #define MAX_POOL (64 * 1024 * 1024) |
103 | 123 | ||
@@ -106,6 +126,17 @@ enum { | |||
106 | BUF_TYPE_USERPTR, | 126 | BUF_TYPE_USERPTR, |
107 | }; | 127 | }; |
108 | 128 | ||
129 | enum g2d_reg_type { | ||
130 | REG_TYPE_NONE = -1, | ||
131 | REG_TYPE_SRC, | ||
132 | REG_TYPE_SRC_PLANE2, | ||
133 | REG_TYPE_DST, | ||
134 | REG_TYPE_DST_PLANE2, | ||
135 | REG_TYPE_PAT, | ||
136 | REG_TYPE_MSK, | ||
137 | MAX_REG_TYPE_NR | ||
138 | }; | ||
139 | |||
109 | /* cmdlist data structure */ | 140 | /* cmdlist data structure */ |
110 | struct g2d_cmdlist { | 141 | struct g2d_cmdlist { |
111 | u32 head; | 142 | u32 head; |
@@ -113,6 +144,42 @@ struct g2d_cmdlist { | |||
113 | u32 last; /* last data offset */ | 144 | u32 last; /* last data offset */ |
114 | }; | 145 | }; |
115 | 146 | ||
147 | /* | ||
148 | * A structure of buffer description | ||
149 | * | ||
150 | * @format: color format | ||
151 | * @left_x: the x coordinates of left top corner | ||
152 | * @top_y: the y coordinates of left top corner | ||
153 | * @right_x: the x coordinates of right bottom corner | ||
154 | * @bottom_y: the y coordinates of right bottom corner | ||
155 | * | ||
156 | */ | ||
157 | struct g2d_buf_desc { | ||
158 | unsigned int format; | ||
159 | unsigned int left_x; | ||
160 | unsigned int top_y; | ||
161 | unsigned int right_x; | ||
162 | unsigned int bottom_y; | ||
163 | }; | ||
164 | |||
165 | /* | ||
166 | * A structure of buffer information | ||
167 | * | ||
168 | * @map_nr: manages the number of mapped buffers | ||
169 | * @reg_types: stores regitster type in the order of requested command | ||
170 | * @handles: stores buffer handle in its reg_type position | ||
171 | * @types: stores buffer type in its reg_type position | ||
172 | * @descs: stores buffer description in its reg_type position | ||
173 | * | ||
174 | */ | ||
175 | struct g2d_buf_info { | ||
176 | unsigned int map_nr; | ||
177 | enum g2d_reg_type reg_types[MAX_REG_TYPE_NR]; | ||
178 | unsigned long handles[MAX_REG_TYPE_NR]; | ||
179 | unsigned int types[MAX_REG_TYPE_NR]; | ||
180 | struct g2d_buf_desc descs[MAX_REG_TYPE_NR]; | ||
181 | }; | ||
182 | |||
116 | struct drm_exynos_pending_g2d_event { | 183 | struct drm_exynos_pending_g2d_event { |
117 | struct drm_pending_event base; | 184 | struct drm_pending_event base; |
118 | struct drm_exynos_g2d_event event; | 185 | struct drm_exynos_g2d_event event; |
@@ -131,14 +198,11 @@ struct g2d_cmdlist_userptr { | |||
131 | bool in_pool; | 198 | bool in_pool; |
132 | bool out_of_list; | 199 | bool out_of_list; |
133 | }; | 200 | }; |
134 | |||
135 | struct g2d_cmdlist_node { | 201 | struct g2d_cmdlist_node { |
136 | struct list_head list; | 202 | struct list_head list; |
137 | struct g2d_cmdlist *cmdlist; | 203 | struct g2d_cmdlist *cmdlist; |
138 | unsigned int map_nr; | ||
139 | unsigned long handles[MAX_BUF_ADDR_NR]; | ||
140 | unsigned int obj_type[MAX_BUF_ADDR_NR]; | ||
141 | dma_addr_t dma_addr; | 204 | dma_addr_t dma_addr; |
205 | struct g2d_buf_info buf_info; | ||
142 | 206 | ||
143 | struct drm_exynos_pending_g2d_event *event; | 207 | struct drm_exynos_pending_g2d_event *event; |
144 | }; | 208 | }; |
@@ -188,6 +252,7 @@ static int g2d_init_cmdlist(struct g2d_data *g2d) | |||
188 | struct exynos_drm_subdrv *subdrv = &g2d->subdrv; | 252 | struct exynos_drm_subdrv *subdrv = &g2d->subdrv; |
189 | int nr; | 253 | int nr; |
190 | int ret; | 254 | int ret; |
255 | struct g2d_buf_info *buf_info; | ||
191 | 256 | ||
192 | init_dma_attrs(&g2d->cmdlist_dma_attrs); | 257 | init_dma_attrs(&g2d->cmdlist_dma_attrs); |
193 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &g2d->cmdlist_dma_attrs); | 258 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &g2d->cmdlist_dma_attrs); |
@@ -209,11 +274,17 @@ static int g2d_init_cmdlist(struct g2d_data *g2d) | |||
209 | } | 274 | } |
210 | 275 | ||
211 | for (nr = 0; nr < G2D_CMDLIST_NUM; nr++) { | 276 | for (nr = 0; nr < G2D_CMDLIST_NUM; nr++) { |
277 | unsigned int i; | ||
278 | |||
212 | node[nr].cmdlist = | 279 | node[nr].cmdlist = |
213 | g2d->cmdlist_pool_virt + nr * G2D_CMDLIST_SIZE; | 280 | g2d->cmdlist_pool_virt + nr * G2D_CMDLIST_SIZE; |
214 | node[nr].dma_addr = | 281 | node[nr].dma_addr = |
215 | g2d->cmdlist_pool + nr * G2D_CMDLIST_SIZE; | 282 | g2d->cmdlist_pool + nr * G2D_CMDLIST_SIZE; |
216 | 283 | ||
284 | buf_info = &node[nr].buf_info; | ||
285 | for (i = 0; i < MAX_REG_TYPE_NR; i++) | ||
286 | buf_info->reg_types[i] = REG_TYPE_NONE; | ||
287 | |||
217 | list_add_tail(&node[nr].list, &g2d->free_cmdlist); | 288 | list_add_tail(&node[nr].list, &g2d->free_cmdlist); |
218 | } | 289 | } |
219 | 290 | ||
@@ -450,7 +521,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, | |||
450 | DMA_BIDIRECTIONAL); | 521 | DMA_BIDIRECTIONAL); |
451 | if (ret < 0) { | 522 | if (ret < 0) { |
452 | DRM_ERROR("failed to map sgt with dma region.\n"); | 523 | DRM_ERROR("failed to map sgt with dma region.\n"); |
453 | goto err_free_sgt; | 524 | goto err_sg_free_table; |
454 | } | 525 | } |
455 | 526 | ||
456 | g2d_userptr->dma_addr = sgt->sgl[0].dma_address; | 527 | g2d_userptr->dma_addr = sgt->sgl[0].dma_address; |
@@ -467,8 +538,10 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, | |||
467 | 538 | ||
468 | return &g2d_userptr->dma_addr; | 539 | return &g2d_userptr->dma_addr; |
469 | 540 | ||
470 | err_free_sgt: | 541 | err_sg_free_table: |
471 | sg_free_table(sgt); | 542 | sg_free_table(sgt); |
543 | |||
544 | err_free_sgt: | ||
472 | kfree(sgt); | 545 | kfree(sgt); |
473 | sgt = NULL; | 546 | sgt = NULL; |
474 | 547 | ||
@@ -506,36 +579,172 @@ static void g2d_userptr_free_all(struct drm_device *drm_dev, | |||
506 | g2d->current_pool = 0; | 579 | g2d->current_pool = 0; |
507 | } | 580 | } |
508 | 581 | ||
582 | static enum g2d_reg_type g2d_get_reg_type(int reg_offset) | ||
583 | { | ||
584 | enum g2d_reg_type reg_type; | ||
585 | |||
586 | switch (reg_offset) { | ||
587 | case G2D_SRC_BASE_ADDR: | ||
588 | case G2D_SRC_COLOR_MODE: | ||
589 | case G2D_SRC_LEFT_TOP: | ||
590 | case G2D_SRC_RIGHT_BOTTOM: | ||
591 | reg_type = REG_TYPE_SRC; | ||
592 | break; | ||
593 | case G2D_SRC_PLANE2_BASE_ADDR: | ||
594 | reg_type = REG_TYPE_SRC_PLANE2; | ||
595 | break; | ||
596 | case G2D_DST_BASE_ADDR: | ||
597 | case G2D_DST_COLOR_MODE: | ||
598 | case G2D_DST_LEFT_TOP: | ||
599 | case G2D_DST_RIGHT_BOTTOM: | ||
600 | reg_type = REG_TYPE_DST; | ||
601 | break; | ||
602 | case G2D_DST_PLANE2_BASE_ADDR: | ||
603 | reg_type = REG_TYPE_DST_PLANE2; | ||
604 | break; | ||
605 | case G2D_PAT_BASE_ADDR: | ||
606 | reg_type = REG_TYPE_PAT; | ||
607 | break; | ||
608 | case G2D_MSK_BASE_ADDR: | ||
609 | reg_type = REG_TYPE_MSK; | ||
610 | break; | ||
611 | default: | ||
612 | reg_type = REG_TYPE_NONE; | ||
613 | DRM_ERROR("Unknown register offset![%d]\n", reg_offset); | ||
614 | break; | ||
615 | }; | ||
616 | |||
617 | return reg_type; | ||
618 | } | ||
619 | |||
620 | static unsigned long g2d_get_buf_bpp(unsigned int format) | ||
621 | { | ||
622 | unsigned long bpp; | ||
623 | |||
624 | switch (format) { | ||
625 | case G2D_FMT_XRGB8888: | ||
626 | case G2D_FMT_ARGB8888: | ||
627 | bpp = 4; | ||
628 | break; | ||
629 | case G2D_FMT_RGB565: | ||
630 | case G2D_FMT_XRGB1555: | ||
631 | case G2D_FMT_ARGB1555: | ||
632 | case G2D_FMT_XRGB4444: | ||
633 | case G2D_FMT_ARGB4444: | ||
634 | bpp = 2; | ||
635 | break; | ||
636 | case G2D_FMT_PACKED_RGB888: | ||
637 | bpp = 3; | ||
638 | break; | ||
639 | default: | ||
640 | bpp = 1; | ||
641 | break; | ||
642 | } | ||
643 | |||
644 | return bpp; | ||
645 | } | ||
646 | |||
647 | static bool g2d_check_buf_desc_is_valid(struct g2d_buf_desc *buf_desc, | ||
648 | enum g2d_reg_type reg_type, | ||
649 | unsigned long size) | ||
650 | { | ||
651 | unsigned int width, height; | ||
652 | unsigned long area; | ||
653 | |||
654 | /* | ||
655 | * check source and destination buffers only. | ||
656 | * so the others are always valid. | ||
657 | */ | ||
658 | if (reg_type != REG_TYPE_SRC && reg_type != REG_TYPE_DST) | ||
659 | return true; | ||
660 | |||
661 | width = buf_desc->right_x - buf_desc->left_x; | ||
662 | if (width < G2D_LEN_MIN || width > G2D_LEN_MAX) { | ||
663 | DRM_ERROR("width[%u] is out of range!\n", width); | ||
664 | return false; | ||
665 | } | ||
666 | |||
667 | height = buf_desc->bottom_y - buf_desc->top_y; | ||
668 | if (height < G2D_LEN_MIN || height > G2D_LEN_MAX) { | ||
669 | DRM_ERROR("height[%u] is out of range!\n", height); | ||
670 | return false; | ||
671 | } | ||
672 | |||
673 | area = (unsigned long)width * (unsigned long)height * | ||
674 | g2d_get_buf_bpp(buf_desc->format); | ||
675 | if (area > size) { | ||
676 | DRM_ERROR("area[%lu] is out of range[%lu]!\n", area, size); | ||
677 | return false; | ||
678 | } | ||
679 | |||
680 | return true; | ||
681 | } | ||
682 | |||
509 | static int g2d_map_cmdlist_gem(struct g2d_data *g2d, | 683 | static int g2d_map_cmdlist_gem(struct g2d_data *g2d, |
510 | struct g2d_cmdlist_node *node, | 684 | struct g2d_cmdlist_node *node, |
511 | struct drm_device *drm_dev, | 685 | struct drm_device *drm_dev, |
512 | struct drm_file *file) | 686 | struct drm_file *file) |
513 | { | 687 | { |
514 | struct g2d_cmdlist *cmdlist = node->cmdlist; | 688 | struct g2d_cmdlist *cmdlist = node->cmdlist; |
689 | struct g2d_buf_info *buf_info = &node->buf_info; | ||
515 | int offset; | 690 | int offset; |
691 | int ret; | ||
516 | int i; | 692 | int i; |
517 | 693 | ||
518 | for (i = 0; i < node->map_nr; i++) { | 694 | for (i = 0; i < buf_info->map_nr; i++) { |
695 | struct g2d_buf_desc *buf_desc; | ||
696 | enum g2d_reg_type reg_type; | ||
697 | int reg_pos; | ||
519 | unsigned long handle; | 698 | unsigned long handle; |
520 | dma_addr_t *addr; | 699 | dma_addr_t *addr; |
521 | 700 | ||
522 | offset = cmdlist->last - (i * 2 + 1); | 701 | reg_pos = cmdlist->last - 2 * (i + 1); |
523 | handle = cmdlist->data[offset]; | 702 | |
703 | offset = cmdlist->data[reg_pos]; | ||
704 | handle = cmdlist->data[reg_pos + 1]; | ||
705 | |||
706 | reg_type = g2d_get_reg_type(offset); | ||
707 | if (reg_type == REG_TYPE_NONE) { | ||
708 | ret = -EFAULT; | ||
709 | goto err; | ||
710 | } | ||
711 | |||
712 | buf_desc = &buf_info->descs[reg_type]; | ||
713 | |||
714 | if (buf_info->types[reg_type] == BUF_TYPE_GEM) { | ||
715 | unsigned long size; | ||
716 | |||
717 | size = exynos_drm_gem_get_size(drm_dev, handle, file); | ||
718 | if (!size) { | ||
719 | ret = -EFAULT; | ||
720 | goto err; | ||
721 | } | ||
722 | |||
723 | if (!g2d_check_buf_desc_is_valid(buf_desc, reg_type, | ||
724 | size)) { | ||
725 | ret = -EFAULT; | ||
726 | goto err; | ||
727 | } | ||
524 | 728 | ||
525 | if (node->obj_type[i] == BUF_TYPE_GEM) { | ||
526 | addr = exynos_drm_gem_get_dma_addr(drm_dev, handle, | 729 | addr = exynos_drm_gem_get_dma_addr(drm_dev, handle, |
527 | file); | 730 | file); |
528 | if (IS_ERR(addr)) { | 731 | if (IS_ERR(addr)) { |
529 | node->map_nr = i; | 732 | ret = -EFAULT; |
530 | return -EFAULT; | 733 | goto err; |
531 | } | 734 | } |
532 | } else { | 735 | } else { |
533 | struct drm_exynos_g2d_userptr g2d_userptr; | 736 | struct drm_exynos_g2d_userptr g2d_userptr; |
534 | 737 | ||
535 | if (copy_from_user(&g2d_userptr, (void __user *)handle, | 738 | if (copy_from_user(&g2d_userptr, (void __user *)handle, |
536 | sizeof(struct drm_exynos_g2d_userptr))) { | 739 | sizeof(struct drm_exynos_g2d_userptr))) { |
537 | node->map_nr = i; | 740 | ret = -EFAULT; |
538 | return -EFAULT; | 741 | goto err; |
742 | } | ||
743 | |||
744 | if (!g2d_check_buf_desc_is_valid(buf_desc, reg_type, | ||
745 | g2d_userptr.size)) { | ||
746 | ret = -EFAULT; | ||
747 | goto err; | ||
539 | } | 748 | } |
540 | 749 | ||
541 | addr = g2d_userptr_get_dma_addr(drm_dev, | 750 | addr = g2d_userptr_get_dma_addr(drm_dev, |
@@ -544,16 +753,21 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d, | |||
544 | file, | 753 | file, |
545 | &handle); | 754 | &handle); |
546 | if (IS_ERR(addr)) { | 755 | if (IS_ERR(addr)) { |
547 | node->map_nr = i; | 756 | ret = -EFAULT; |
548 | return -EFAULT; | 757 | goto err; |
549 | } | 758 | } |
550 | } | 759 | } |
551 | 760 | ||
552 | cmdlist->data[offset] = *addr; | 761 | cmdlist->data[reg_pos + 1] = *addr; |
553 | node->handles[i] = handle; | 762 | buf_info->reg_types[i] = reg_type; |
763 | buf_info->handles[reg_type] = handle; | ||
554 | } | 764 | } |
555 | 765 | ||
556 | return 0; | 766 | return 0; |
767 | |||
768 | err: | ||
769 | buf_info->map_nr = i; | ||
770 | return ret; | ||
557 | } | 771 | } |
558 | 772 | ||
559 | static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d, | 773 | static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d, |
@@ -561,22 +775,33 @@ static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d, | |||
561 | struct drm_file *filp) | 775 | struct drm_file *filp) |
562 | { | 776 | { |
563 | struct exynos_drm_subdrv *subdrv = &g2d->subdrv; | 777 | struct exynos_drm_subdrv *subdrv = &g2d->subdrv; |
778 | struct g2d_buf_info *buf_info = &node->buf_info; | ||
564 | int i; | 779 | int i; |
565 | 780 | ||
566 | for (i = 0; i < node->map_nr; i++) { | 781 | for (i = 0; i < buf_info->map_nr; i++) { |
567 | unsigned long handle = node->handles[i]; | 782 | struct g2d_buf_desc *buf_desc; |
783 | enum g2d_reg_type reg_type; | ||
784 | unsigned long handle; | ||
785 | |||
786 | reg_type = buf_info->reg_types[i]; | ||
787 | |||
788 | buf_desc = &buf_info->descs[reg_type]; | ||
789 | handle = buf_info->handles[reg_type]; | ||
568 | 790 | ||
569 | if (node->obj_type[i] == BUF_TYPE_GEM) | 791 | if (buf_info->types[reg_type] == BUF_TYPE_GEM) |
570 | exynos_drm_gem_put_dma_addr(subdrv->drm_dev, handle, | 792 | exynos_drm_gem_put_dma_addr(subdrv->drm_dev, handle, |
571 | filp); | 793 | filp); |
572 | else | 794 | else |
573 | g2d_userptr_put_dma_addr(subdrv->drm_dev, handle, | 795 | g2d_userptr_put_dma_addr(subdrv->drm_dev, handle, |
574 | false); | 796 | false); |
575 | 797 | ||
576 | node->handles[i] = 0; | 798 | buf_info->reg_types[i] = REG_TYPE_NONE; |
799 | buf_info->handles[reg_type] = 0; | ||
800 | buf_info->types[reg_type] = 0; | ||
801 | memset(buf_desc, 0x00, sizeof(*buf_desc)); | ||
577 | } | 802 | } |
578 | 803 | ||
579 | node->map_nr = 0; | 804 | buf_info->map_nr = 0; |
580 | } | 805 | } |
581 | 806 | ||
582 | static void g2d_dma_start(struct g2d_data *g2d, | 807 | static void g2d_dma_start(struct g2d_data *g2d, |
@@ -589,10 +814,6 @@ static void g2d_dma_start(struct g2d_data *g2d, | |||
589 | pm_runtime_get_sync(g2d->dev); | 814 | pm_runtime_get_sync(g2d->dev); |
590 | clk_enable(g2d->gate_clk); | 815 | clk_enable(g2d->gate_clk); |
591 | 816 | ||
592 | /* interrupt enable */ | ||
593 | writel_relaxed(G2D_INTEN_ACF | G2D_INTEN_UCF | G2D_INTEN_GCF, | ||
594 | g2d->regs + G2D_INTEN); | ||
595 | |||
596 | writel_relaxed(node->dma_addr, g2d->regs + G2D_DMA_SFR_BASE_ADDR); | 817 | writel_relaxed(node->dma_addr, g2d->regs + G2D_DMA_SFR_BASE_ADDR); |
597 | writel_relaxed(G2D_DMA_START, g2d->regs + G2D_DMA_COMMAND); | 818 | writel_relaxed(G2D_DMA_START, g2d->regs + G2D_DMA_COMMAND); |
598 | } | 819 | } |
@@ -643,7 +864,6 @@ static void g2d_runqueue_worker(struct work_struct *work) | |||
643 | struct g2d_data *g2d = container_of(work, struct g2d_data, | 864 | struct g2d_data *g2d = container_of(work, struct g2d_data, |
644 | runqueue_work); | 865 | runqueue_work); |
645 | 866 | ||
646 | |||
647 | mutex_lock(&g2d->runqueue_mutex); | 867 | mutex_lock(&g2d->runqueue_mutex); |
648 | clk_disable(g2d->gate_clk); | 868 | clk_disable(g2d->gate_clk); |
649 | pm_runtime_put_sync(g2d->dev); | 869 | pm_runtime_put_sync(g2d->dev); |
@@ -724,20 +944,14 @@ static int g2d_check_reg_offset(struct device *dev, | |||
724 | int i; | 944 | int i; |
725 | 945 | ||
726 | for (i = 0; i < nr; i++) { | 946 | for (i = 0; i < nr; i++) { |
727 | index = cmdlist->last - 2 * (i + 1); | 947 | struct g2d_buf_info *buf_info = &node->buf_info; |
948 | struct g2d_buf_desc *buf_desc; | ||
949 | enum g2d_reg_type reg_type; | ||
950 | unsigned long value; | ||
728 | 951 | ||
729 | if (for_addr) { | 952 | index = cmdlist->last - 2 * (i + 1); |
730 | /* check userptr buffer type. */ | ||
731 | reg_offset = (cmdlist->data[index] & | ||
732 | ~0x7fffffff) >> 31; | ||
733 | if (reg_offset) { | ||
734 | node->obj_type[i] = BUF_TYPE_USERPTR; | ||
735 | cmdlist->data[index] &= ~G2D_BUF_USERPTR; | ||
736 | } | ||
737 | } | ||
738 | 953 | ||
739 | reg_offset = cmdlist->data[index] & ~0xfffff000; | 954 | reg_offset = cmdlist->data[index] & ~0xfffff000; |
740 | |||
741 | if (reg_offset < G2D_VALID_START || reg_offset > G2D_VALID_END) | 955 | if (reg_offset < G2D_VALID_START || reg_offset > G2D_VALID_END) |
742 | goto err; | 956 | goto err; |
743 | if (reg_offset % 4) | 957 | if (reg_offset % 4) |
@@ -753,8 +967,60 @@ static int g2d_check_reg_offset(struct device *dev, | |||
753 | if (!for_addr) | 967 | if (!for_addr) |
754 | goto err; | 968 | goto err; |
755 | 969 | ||
756 | if (node->obj_type[i] != BUF_TYPE_USERPTR) | 970 | reg_type = g2d_get_reg_type(reg_offset); |
757 | node->obj_type[i] = BUF_TYPE_GEM; | 971 | if (reg_type == REG_TYPE_NONE) |
972 | goto err; | ||
973 | |||
974 | /* check userptr buffer type. */ | ||
975 | if ((cmdlist->data[index] & ~0x7fffffff) >> 31) { | ||
976 | buf_info->types[reg_type] = BUF_TYPE_USERPTR; | ||
977 | cmdlist->data[index] &= ~G2D_BUF_USERPTR; | ||
978 | } else | ||
979 | buf_info->types[reg_type] = BUF_TYPE_GEM; | ||
980 | break; | ||
981 | case G2D_SRC_COLOR_MODE: | ||
982 | case G2D_DST_COLOR_MODE: | ||
983 | if (for_addr) | ||
984 | goto err; | ||
985 | |||
986 | reg_type = g2d_get_reg_type(reg_offset); | ||
987 | if (reg_type == REG_TYPE_NONE) | ||
988 | goto err; | ||
989 | |||
990 | buf_desc = &buf_info->descs[reg_type]; | ||
991 | value = cmdlist->data[index + 1]; | ||
992 | |||
993 | buf_desc->format = value & 0xf; | ||
994 | break; | ||
995 | case G2D_SRC_LEFT_TOP: | ||
996 | case G2D_DST_LEFT_TOP: | ||
997 | if (for_addr) | ||
998 | goto err; | ||
999 | |||
1000 | reg_type = g2d_get_reg_type(reg_offset); | ||
1001 | if (reg_type == REG_TYPE_NONE) | ||
1002 | goto err; | ||
1003 | |||
1004 | buf_desc = &buf_info->descs[reg_type]; | ||
1005 | value = cmdlist->data[index + 1]; | ||
1006 | |||
1007 | buf_desc->left_x = value & 0x1fff; | ||
1008 | buf_desc->top_y = (value & 0x1fff0000) >> 16; | ||
1009 | break; | ||
1010 | case G2D_SRC_RIGHT_BOTTOM: | ||
1011 | case G2D_DST_RIGHT_BOTTOM: | ||
1012 | if (for_addr) | ||
1013 | goto err; | ||
1014 | |||
1015 | reg_type = g2d_get_reg_type(reg_offset); | ||
1016 | if (reg_type == REG_TYPE_NONE) | ||
1017 | goto err; | ||
1018 | |||
1019 | buf_desc = &buf_info->descs[reg_type]; | ||
1020 | value = cmdlist->data[index + 1]; | ||
1021 | |||
1022 | buf_desc->right_x = value & 0x1fff; | ||
1023 | buf_desc->bottom_y = (value & 0x1fff0000) >> 16; | ||
758 | break; | 1024 | break; |
759 | default: | 1025 | default: |
760 | if (for_addr) | 1026 | if (for_addr) |
@@ -860,9 +1126,23 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, | |||
860 | cmdlist->data[cmdlist->last++] = G2D_SRC_BASE_ADDR; | 1126 | cmdlist->data[cmdlist->last++] = G2D_SRC_BASE_ADDR; |
861 | cmdlist->data[cmdlist->last++] = 0; | 1127 | cmdlist->data[cmdlist->last++] = 0; |
862 | 1128 | ||
1129 | /* | ||
1130 | * 'LIST_HOLD' command should be set to the DMA_HOLD_CMD_REG | ||
1131 | * and GCF bit should be set to INTEN register if user wants | ||
1132 | * G2D interrupt event once current command list execution is | ||
1133 | * finished. | ||
1134 | * Otherwise only ACF bit should be set to INTEN register so | ||
1135 | * that one interrupt is occured after all command lists | ||
1136 | * have been completed. | ||
1137 | */ | ||
863 | if (node->event) { | 1138 | if (node->event) { |
1139 | cmdlist->data[cmdlist->last++] = G2D_INTEN; | ||
1140 | cmdlist->data[cmdlist->last++] = G2D_INTEN_ACF | G2D_INTEN_GCF; | ||
864 | cmdlist->data[cmdlist->last++] = G2D_DMA_HOLD_CMD; | 1141 | cmdlist->data[cmdlist->last++] = G2D_DMA_HOLD_CMD; |
865 | cmdlist->data[cmdlist->last++] = G2D_LIST_HOLD; | 1142 | cmdlist->data[cmdlist->last++] = G2D_LIST_HOLD; |
1143 | } else { | ||
1144 | cmdlist->data[cmdlist->last++] = G2D_INTEN; | ||
1145 | cmdlist->data[cmdlist->last++] = G2D_INTEN_ACF; | ||
866 | } | 1146 | } |
867 | 1147 | ||
868 | /* Check size of cmdlist: last 2 is about G2D_BITBLT_START */ | 1148 | /* Check size of cmdlist: last 2 is about G2D_BITBLT_START */ |
@@ -887,7 +1167,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, | |||
887 | if (ret < 0) | 1167 | if (ret < 0) |
888 | goto err_free_event; | 1168 | goto err_free_event; |
889 | 1169 | ||
890 | node->map_nr = req->cmd_buf_nr; | 1170 | node->buf_info.map_nr = req->cmd_buf_nr; |
891 | if (req->cmd_buf_nr) { | 1171 | if (req->cmd_buf_nr) { |
892 | struct drm_exynos_g2d_cmd *cmd_buf; | 1172 | struct drm_exynos_g2d_cmd *cmd_buf; |
893 | 1173 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 67e17ce112b6..0e6fe000578c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
@@ -164,6 +164,27 @@ out: | |||
164 | exynos_gem_obj = NULL; | 164 | exynos_gem_obj = NULL; |
165 | } | 165 | } |
166 | 166 | ||
167 | unsigned long exynos_drm_gem_get_size(struct drm_device *dev, | ||
168 | unsigned int gem_handle, | ||
169 | struct drm_file *file_priv) | ||
170 | { | ||
171 | struct exynos_drm_gem_obj *exynos_gem_obj; | ||
172 | struct drm_gem_object *obj; | ||
173 | |||
174 | obj = drm_gem_object_lookup(dev, file_priv, gem_handle); | ||
175 | if (!obj) { | ||
176 | DRM_ERROR("failed to lookup gem object.\n"); | ||
177 | return 0; | ||
178 | } | ||
179 | |||
180 | exynos_gem_obj = to_exynos_gem_obj(obj); | ||
181 | |||
182 | drm_gem_object_unreference_unlocked(obj); | ||
183 | |||
184 | return exynos_gem_obj->buffer->size; | ||
185 | } | ||
186 | |||
187 | |||
167 | struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev, | 188 | struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev, |
168 | unsigned long size) | 189 | unsigned long size) |
169 | { | 190 | { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index 35ebac47dc2b..468766bee450 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h | |||
@@ -130,6 +130,11 @@ int exynos_drm_gem_userptr_ioctl(struct drm_device *dev, void *data, | |||
130 | int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, | 130 | int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, |
131 | struct drm_file *file_priv); | 131 | struct drm_file *file_priv); |
132 | 132 | ||
133 | /* get buffer size to gem handle. */ | ||
134 | unsigned long exynos_drm_gem_get_size(struct drm_device *dev, | ||
135 | unsigned int gem_handle, | ||
136 | struct drm_file *file_priv); | ||
137 | |||
133 | /* initialize gem object. */ | 138 | /* initialize gem object. */ |
134 | int exynos_drm_gem_init_object(struct drm_gem_object *obj); | 139 | int exynos_drm_gem_init_object(struct drm_gem_object *obj); |
135 | 140 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 13ccbd4bcfaa..9504b0cd825a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -117,13 +117,12 @@ static struct edid *vidi_get_edid(struct device *dev, | |||
117 | } | 117 | } |
118 | 118 | ||
119 | edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH; | 119 | edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH; |
120 | edid = kzalloc(edid_len, GFP_KERNEL); | 120 | edid = kmemdup(ctx->raw_edid, edid_len, GFP_KERNEL); |
121 | if (!edid) { | 121 | if (!edid) { |
122 | DRM_DEBUG_KMS("failed to allocate edid\n"); | 122 | DRM_DEBUG_KMS("failed to allocate edid\n"); |
123 | return ERR_PTR(-ENOMEM); | 123 | return ERR_PTR(-ENOMEM); |
124 | } | 124 | } |
125 | 125 | ||
126 | memcpy(edid, ctx->raw_edid, edid_len); | ||
127 | return edid; | 126 | return edid; |
128 | } | 127 | } |
129 | 128 | ||
@@ -563,12 +562,11 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, | |||
563 | return -EINVAL; | 562 | return -EINVAL; |
564 | } | 563 | } |
565 | edid_len = (1 + raw_edid->extensions) * EDID_LENGTH; | 564 | edid_len = (1 + raw_edid->extensions) * EDID_LENGTH; |
566 | ctx->raw_edid = kzalloc(edid_len, GFP_KERNEL); | 565 | ctx->raw_edid = kmemdup(raw_edid, edid_len, GFP_KERNEL); |
567 | if (!ctx->raw_edid) { | 566 | if (!ctx->raw_edid) { |
568 | DRM_DEBUG_KMS("failed to allocate raw_edid.\n"); | 567 | DRM_DEBUG_KMS("failed to allocate raw_edid.\n"); |
569 | return -ENOMEM; | 568 | return -ENOMEM; |
570 | } | 569 | } |
571 | memcpy(ctx->raw_edid, raw_edid, edid_len); | ||
572 | } else { | 570 | } else { |
573 | /* | 571 | /* |
574 | * with connection = 0, free raw_edid | 572 | * with connection = 0, free raw_edid |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index e919aba29b3d..2f4f72f07047 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -818,7 +818,7 @@ static void mixer_win_disable(void *ctx, int win) | |||
818 | mixer_ctx->win_data[win].enabled = false; | 818 | mixer_ctx->win_data[win].enabled = false; |
819 | } | 819 | } |
820 | 820 | ||
821 | int mixer_check_timing(void *ctx, struct fb_videomode *timing) | 821 | static int mixer_check_timing(void *ctx, struct fb_videomode *timing) |
822 | { | 822 | { |
823 | struct mixer_context *mixer_ctx = ctx; | 823 | struct mixer_context *mixer_ctx = ctx; |
824 | u32 w, h; | 824 | u32 w, h; |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index aae31489c893..7299ea45dd03 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -103,7 +103,7 @@ static const char *cache_level_str(int type) | |||
103 | static void | 103 | static void |
104 | describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) | 104 | describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) |
105 | { | 105 | { |
106 | seq_printf(m, "%p: %s%s %8zdKiB %02x %02x %d %d %d%s%s%s", | 106 | seq_printf(m, "%pK: %s%s %8zdKiB %02x %02x %d %d %d%s%s%s", |
107 | &obj->base, | 107 | &obj->base, |
108 | get_pin_flag(obj), | 108 | get_pin_flag(obj), |
109 | get_tiling_flag(obj), | 109 | get_tiling_flag(obj), |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 0a8eceb75902..e9b57893db2b 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -125,6 +125,11 @@ MODULE_PARM_DESC(preliminary_hw_support, | |||
125 | "Enable Haswell and ValleyView Support. " | 125 | "Enable Haswell and ValleyView Support. " |
126 | "(default: false)"); | 126 | "(default: false)"); |
127 | 127 | ||
128 | int i915_disable_power_well __read_mostly = 0; | ||
129 | module_param_named(disable_power_well, i915_disable_power_well, int, 0600); | ||
130 | MODULE_PARM_DESC(disable_power_well, | ||
131 | "Disable the power well when possible (default: false)"); | ||
132 | |||
128 | static struct drm_driver driver; | 133 | static struct drm_driver driver; |
129 | extern int intel_agp_enabled; | 134 | extern int intel_agp_enabled; |
130 | 135 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index e95337c97459..01769e2a9953 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1398,6 +1398,7 @@ extern int i915_enable_fbc __read_mostly; | |||
1398 | extern bool i915_enable_hangcheck __read_mostly; | 1398 | extern bool i915_enable_hangcheck __read_mostly; |
1399 | extern int i915_enable_ppgtt __read_mostly; | 1399 | extern int i915_enable_ppgtt __read_mostly; |
1400 | extern unsigned int i915_preliminary_hw_support __read_mostly; | 1400 | extern unsigned int i915_preliminary_hw_support __read_mostly; |
1401 | extern int i915_disable_power_well __read_mostly; | ||
1401 | 1402 | ||
1402 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); | 1403 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); |
1403 | extern int i915_resume(struct drm_device *dev); | 1404 | extern int i915_resume(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 2f2daebd0eef..3b11ab0fbc96 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -732,6 +732,8 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, | |||
732 | int count) | 732 | int count) |
733 | { | 733 | { |
734 | int i; | 734 | int i; |
735 | int relocs_total = 0; | ||
736 | int relocs_max = INT_MAX / sizeof(struct drm_i915_gem_relocation_entry); | ||
735 | 737 | ||
736 | for (i = 0; i < count; i++) { | 738 | for (i = 0; i < count; i++) { |
737 | char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; | 739 | char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; |
@@ -740,10 +742,13 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, | |||
740 | if (exec[i].flags & __EXEC_OBJECT_UNKNOWN_FLAGS) | 742 | if (exec[i].flags & __EXEC_OBJECT_UNKNOWN_FLAGS) |
741 | return -EINVAL; | 743 | return -EINVAL; |
742 | 744 | ||
743 | /* First check for malicious input causing overflow */ | 745 | /* First check for malicious input causing overflow in |
744 | if (exec[i].relocation_count > | 746 | * the worst case where we need to allocate the entire |
745 | INT_MAX / sizeof(struct drm_i915_gem_relocation_entry)) | 747 | * relocation tree as a single array. |
748 | */ | ||
749 | if (exec[i].relocation_count > relocs_max - relocs_total) | ||
746 | return -EINVAL; | 750 | return -EINVAL; |
751 | relocs_total += exec[i].relocation_count; | ||
747 | 752 | ||
748 | length = exec[i].relocation_count * | 753 | length = exec[i].relocation_count * |
749 | sizeof(struct drm_i915_gem_relocation_entry); | 754 | sizeof(struct drm_i915_gem_relocation_entry); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 287b42c9d1a8..b20d50192fcc 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -5771,6 +5771,11 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc, | |||
5771 | num_connectors++; | 5771 | num_connectors++; |
5772 | } | 5772 | } |
5773 | 5773 | ||
5774 | if (is_cpu_edp) | ||
5775 | intel_crtc->cpu_transcoder = TRANSCODER_EDP; | ||
5776 | else | ||
5777 | intel_crtc->cpu_transcoder = pipe; | ||
5778 | |||
5774 | /* We are not sure yet this won't happen. */ | 5779 | /* We are not sure yet this won't happen. */ |
5775 | WARN(!HAS_PCH_LPT(dev), "Unexpected PCH type %d\n", | 5780 | WARN(!HAS_PCH_LPT(dev), "Unexpected PCH type %d\n", |
5776 | INTEL_PCH_TYPE(dev)); | 5781 | INTEL_PCH_TYPE(dev)); |
@@ -5837,11 +5842,6 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
5837 | int pipe = intel_crtc->pipe; | 5842 | int pipe = intel_crtc->pipe; |
5838 | int ret; | 5843 | int ret; |
5839 | 5844 | ||
5840 | if (IS_HASWELL(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) | ||
5841 | intel_crtc->cpu_transcoder = TRANSCODER_EDP; | ||
5842 | else | ||
5843 | intel_crtc->cpu_transcoder = pipe; | ||
5844 | |||
5845 | drm_vblank_pre_modeset(dev, pipe); | 5845 | drm_vblank_pre_modeset(dev, pipe); |
5846 | 5846 | ||
5847 | ret = dev_priv->display.crtc_mode_set(crtc, mode, adjusted_mode, | 5847 | ret = dev_priv->display.crtc_mode_set(crtc, mode, adjusted_mode, |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 6f728e5ee793..d7d4afe01341 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -820,6 +820,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
820 | struct intel_link_m_n m_n; | 820 | struct intel_link_m_n m_n; |
821 | int pipe = intel_crtc->pipe; | 821 | int pipe = intel_crtc->pipe; |
822 | enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; | 822 | enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; |
823 | int target_clock; | ||
823 | 824 | ||
824 | /* | 825 | /* |
825 | * Find the lane count in the intel_encoder private | 826 | * Find the lane count in the intel_encoder private |
@@ -835,13 +836,22 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
835 | } | 836 | } |
836 | } | 837 | } |
837 | 838 | ||
839 | target_clock = mode->clock; | ||
840 | for_each_encoder_on_crtc(dev, crtc, intel_encoder) { | ||
841 | if (intel_encoder->type == INTEL_OUTPUT_EDP) { | ||
842 | target_clock = intel_edp_target_clock(intel_encoder, | ||
843 | mode); | ||
844 | break; | ||
845 | } | ||
846 | } | ||
847 | |||
838 | /* | 848 | /* |
839 | * Compute the GMCH and Link ratios. The '3' here is | 849 | * Compute the GMCH and Link ratios. The '3' here is |
840 | * the number of bytes_per_pixel post-LUT, which we always | 850 | * the number of bytes_per_pixel post-LUT, which we always |
841 | * set up for 8-bits of R/G/B, or 3 bytes total. | 851 | * set up for 8-bits of R/G/B, or 3 bytes total. |
842 | */ | 852 | */ |
843 | intel_link_compute_m_n(intel_crtc->bpp, lane_count, | 853 | intel_link_compute_m_n(intel_crtc->bpp, lane_count, |
844 | mode->clock, adjusted_mode->clock, &m_n); | 854 | target_clock, adjusted_mode->clock, &m_n); |
845 | 855 | ||
846 | if (IS_HASWELL(dev)) { | 856 | if (IS_HASWELL(dev)) { |
847 | I915_WRITE(PIPE_DATA_M1(cpu_transcoder), | 857 | I915_WRITE(PIPE_DATA_M1(cpu_transcoder), |
@@ -1930,7 +1940,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1930 | for (i = 0; i < intel_dp->lane_count; i++) | 1940 | for (i = 0; i < intel_dp->lane_count; i++) |
1931 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) | 1941 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) |
1932 | break; | 1942 | break; |
1933 | if (i == intel_dp->lane_count && voltage_tries == 5) { | 1943 | if (i == intel_dp->lane_count) { |
1934 | ++loop_tries; | 1944 | ++loop_tries; |
1935 | if (loop_tries == 5) { | 1945 | if (loop_tries == 5) { |
1936 | DRM_DEBUG_KMS("too many full retries, give up\n"); | 1946 | DRM_DEBUG_KMS("too many full retries, give up\n"); |
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index acf8aec9ada7..ef4744e1bf0b 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
@@ -203,7 +203,13 @@ intel_gpio_setup(struct intel_gmbus *bus, u32 pin) | |||
203 | algo->data = bus; | 203 | algo->data = bus; |
204 | } | 204 | } |
205 | 205 | ||
206 | #define HAS_GMBUS_IRQ(dev) (INTEL_INFO(dev)->gen >= 4) | 206 | /* |
207 | * gmbus on gen4 seems to be able to generate legacy interrupts even when in MSI | ||
208 | * mode. This results in spurious interrupt warnings if the legacy irq no. is | ||
209 | * shared with another device. The kernel then disables that interrupt source | ||
210 | * and so prevents the other device from working properly. | ||
211 | */ | ||
212 | #define HAS_GMBUS_IRQ(dev) (INTEL_INFO(dev)->gen >= 5) | ||
207 | static int | 213 | static int |
208 | gmbus_wait_hw_status(struct drm_i915_private *dev_priv, | 214 | gmbus_wait_hw_status(struct drm_i915_private *dev_priv, |
209 | u32 gmbus2_status, | 215 | u32 gmbus2_status, |
@@ -214,6 +220,9 @@ gmbus_wait_hw_status(struct drm_i915_private *dev_priv, | |||
214 | u32 gmbus2 = 0; | 220 | u32 gmbus2 = 0; |
215 | DEFINE_WAIT(wait); | 221 | DEFINE_WAIT(wait); |
216 | 222 | ||
223 | if (!HAS_GMBUS_IRQ(dev_priv->dev)) | ||
224 | gmbus4_irq_en = 0; | ||
225 | |||
217 | /* Important: The hw handles only the first bit, so set only one! Since | 226 | /* Important: The hw handles only the first bit, so set only one! Since |
218 | * we also need to check for NAKs besides the hw ready/idle signal, we | 227 | * we also need to check for NAKs besides the hw ready/idle signal, we |
219 | * need to wake up periodically and check that ourselves. */ | 228 | * need to wake up periodically and check that ourselves. */ |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index a3730e0289e5..bee8cb6108a7 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -321,9 +321,6 @@ void intel_panel_enable_backlight(struct drm_device *dev, | |||
321 | if (dev_priv->backlight_level == 0) | 321 | if (dev_priv->backlight_level == 0) |
322 | dev_priv->backlight_level = intel_panel_get_max_backlight(dev); | 322 | dev_priv->backlight_level = intel_panel_get_max_backlight(dev); |
323 | 323 | ||
324 | dev_priv->backlight_enabled = true; | ||
325 | intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); | ||
326 | |||
327 | if (INTEL_INFO(dev)->gen >= 4) { | 324 | if (INTEL_INFO(dev)->gen >= 4) { |
328 | uint32_t reg, tmp; | 325 | uint32_t reg, tmp; |
329 | 326 | ||
@@ -359,12 +356,12 @@ void intel_panel_enable_backlight(struct drm_device *dev, | |||
359 | } | 356 | } |
360 | 357 | ||
361 | set_level: | 358 | set_level: |
362 | /* Check the current backlight level and try to set again if it's zero. | 359 | /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1. |
363 | * On some machines, BLC_PWM_CPU_CTL is cleared to zero automatically | 360 | * BLC_PWM_CPU_CTL may be cleared to zero automatically when these |
364 | * when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 are written. | 361 | * registers are set. |
365 | */ | 362 | */ |
366 | if (!intel_panel_get_backlight(dev)) | 363 | dev_priv->backlight_enabled = true; |
367 | intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); | 364 | intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); |
368 | } | 365 | } |
369 | 366 | ||
370 | static void intel_panel_init_backlight(struct drm_device *dev) | 367 | static void intel_panel_init_backlight(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index a1794c6df1bf..adca00783e61 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -4079,6 +4079,9 @@ void intel_set_power_well(struct drm_device *dev, bool enable) | |||
4079 | if (!IS_HASWELL(dev)) | 4079 | if (!IS_HASWELL(dev)) |
4080 | return; | 4080 | return; |
4081 | 4081 | ||
4082 | if (!i915_disable_power_well && !enable) | ||
4083 | return; | ||
4084 | |||
4082 | tmp = I915_READ(HSW_PWR_WELL_DRIVER); | 4085 | tmp = I915_READ(HSW_PWR_WELL_DRIVER); |
4083 | is_enabled = tmp & HSW_PWR_WELL_STATE; | 4086 | is_enabled = tmp & HSW_PWR_WELL_STATE; |
4084 | enable_requested = tmp & HSW_PWR_WELL_ENABLE; | 4087 | enable_requested = tmp & HSW_PWR_WELL_ENABLE; |
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index a274b9906ef8..fe22bb780e1d 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c | |||
@@ -382,19 +382,19 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) | |||
382 | m = n = p = 0; | 382 | m = n = p = 0; |
383 | vcomax = 800000; | 383 | vcomax = 800000; |
384 | vcomin = 400000; | 384 | vcomin = 400000; |
385 | pllreffreq = 3333; | 385 | pllreffreq = 33333; |
386 | 386 | ||
387 | delta = 0xffffffff; | 387 | delta = 0xffffffff; |
388 | permitteddelta = clock * 5 / 1000; | 388 | permitteddelta = clock * 5 / 1000; |
389 | 389 | ||
390 | for (testp = 16; testp > 0; testp--) { | 390 | for (testp = 16; testp > 0; testp >>= 1) { |
391 | if (clock * testp > vcomax) | 391 | if (clock * testp > vcomax) |
392 | continue; | 392 | continue; |
393 | if (clock * testp < vcomin) | 393 | if (clock * testp < vcomin) |
394 | continue; | 394 | continue; |
395 | 395 | ||
396 | for (testm = 1; testm < 33; testm++) { | 396 | for (testm = 1; testm < 33; testm++) { |
397 | for (testn = 1; testn < 257; testn++) { | 397 | for (testn = 17; testn < 257; testn++) { |
398 | computed = (pllreffreq * testn) / | 398 | computed = (pllreffreq * testn) / |
399 | (testm * testp); | 399 | (testm * testp); |
400 | if (computed > clock) | 400 | if (computed > clock) |
@@ -404,11 +404,11 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) | |||
404 | if (tmpdelta < delta) { | 404 | if (tmpdelta < delta) { |
405 | delta = tmpdelta; | 405 | delta = tmpdelta; |
406 | n = testn - 1; | 406 | n = testn - 1; |
407 | m = (testm - 1) | ((n >> 1) & 0x80); | 407 | m = (testm - 1); |
408 | p = testp - 1; | 408 | p = testp - 1; |
409 | } | 409 | } |
410 | if ((clock * testp) >= 600000) | 410 | if ((clock * testp) >= 600000) |
411 | p |= 80; | 411 | p |= 0x80; |
412 | } | 412 | } |
413 | } | 413 | } |
414 | } | 414 | } |
diff --git a/drivers/gpu/drm/nouveau/core/core/object.c b/drivers/gpu/drm/nouveau/core/core/object.c index 0daab62ea14c..3b2e7b6304d3 100644 --- a/drivers/gpu/drm/nouveau/core/core/object.c +++ b/drivers/gpu/drm/nouveau/core/core/object.c | |||
@@ -278,7 +278,6 @@ nouveau_object_del(struct nouveau_object *client, u32 _parent, u32 _handle) | |||
278 | struct nouveau_object *parent = NULL; | 278 | struct nouveau_object *parent = NULL; |
279 | struct nouveau_object *namedb = NULL; | 279 | struct nouveau_object *namedb = NULL; |
280 | struct nouveau_handle *handle = NULL; | 280 | struct nouveau_handle *handle = NULL; |
281 | int ret = -EINVAL; | ||
282 | 281 | ||
283 | parent = nouveau_handle_ref(client, _parent); | 282 | parent = nouveau_handle_ref(client, _parent); |
284 | if (!parent) | 283 | if (!parent) |
@@ -295,7 +294,7 @@ nouveau_object_del(struct nouveau_object *client, u32 _parent, u32 _handle) | |||
295 | } | 294 | } |
296 | 295 | ||
297 | nouveau_object_ref(NULL, &parent); | 296 | nouveau_object_ref(NULL, &parent); |
298 | return ret; | 297 | return handle ? 0 : -EINVAL; |
299 | } | 298 | } |
300 | 299 | ||
301 | int | 300 | int |
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/therm.h b/drivers/gpu/drm/nouveau/core/include/subdev/therm.h index 6b17b614629f..0b20fc0d19c1 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/therm.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/therm.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <core/device.h> | 4 | #include <core/device.h> |
5 | #include <core/subdev.h> | 5 | #include <core/subdev.h> |
6 | 6 | ||
7 | enum nouveau_therm_mode { | 7 | enum nouveau_therm_fan_mode { |
8 | NOUVEAU_THERM_CTRL_NONE = 0, | 8 | NOUVEAU_THERM_CTRL_NONE = 0, |
9 | NOUVEAU_THERM_CTRL_MANUAL = 1, | 9 | NOUVEAU_THERM_CTRL_MANUAL = 1, |
10 | NOUVEAU_THERM_CTRL_AUTO = 2, | 10 | NOUVEAU_THERM_CTRL_AUTO = 2, |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c index f794dc89a3b2..a00a5a76e2d6 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c | |||
@@ -134,7 +134,7 @@ nouveau_therm_alarm(struct nouveau_alarm *alarm) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | int | 136 | int |
137 | nouveau_therm_mode(struct nouveau_therm *therm, int mode) | 137 | nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode) |
138 | { | 138 | { |
139 | struct nouveau_therm_priv *priv = (void *)therm; | 139 | struct nouveau_therm_priv *priv = (void *)therm; |
140 | struct nouveau_device *device = nv_device(therm); | 140 | struct nouveau_device *device = nv_device(therm); |
@@ -149,10 +149,15 @@ nouveau_therm_mode(struct nouveau_therm *therm, int mode) | |||
149 | (mode != NOUVEAU_THERM_CTRL_NONE && device->card_type >= NV_C0)) | 149 | (mode != NOUVEAU_THERM_CTRL_NONE && device->card_type >= NV_C0)) |
150 | return -EINVAL; | 150 | return -EINVAL; |
151 | 151 | ||
152 | /* do not allow automatic fan management if the thermal sensor is | ||
153 | * not available */ | ||
154 | if (priv->mode == 2 && therm->temp_get(therm) < 0) | ||
155 | return -EINVAL; | ||
156 | |||
152 | if (priv->mode == mode) | 157 | if (priv->mode == mode) |
153 | return 0; | 158 | return 0; |
154 | 159 | ||
155 | nv_info(therm, "Thermal management: %s\n", name[mode]); | 160 | nv_info(therm, "fan management: %s\n", name[mode]); |
156 | nouveau_therm_update(therm, mode); | 161 | nouveau_therm_update(therm, mode); |
157 | return 0; | 162 | return 0; |
158 | } | 163 | } |
@@ -213,7 +218,7 @@ nouveau_therm_attr_set(struct nouveau_therm *therm, | |||
213 | priv->fan->bios.max_duty = value; | 218 | priv->fan->bios.max_duty = value; |
214 | return 0; | 219 | return 0; |
215 | case NOUVEAU_THERM_ATTR_FAN_MODE: | 220 | case NOUVEAU_THERM_ATTR_FAN_MODE: |
216 | return nouveau_therm_mode(therm, value); | 221 | return nouveau_therm_fan_mode(therm, value); |
217 | case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST: | 222 | case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST: |
218 | priv->bios_sensor.thrs_fan_boost.temp = value; | 223 | priv->bios_sensor.thrs_fan_boost.temp = value; |
219 | priv->sensor.program_alarms(therm); | 224 | priv->sensor.program_alarms(therm); |
@@ -263,7 +268,7 @@ _nouveau_therm_init(struct nouveau_object *object) | |||
263 | return ret; | 268 | return ret; |
264 | 269 | ||
265 | if (priv->suspend >= 0) | 270 | if (priv->suspend >= 0) |
266 | nouveau_therm_mode(therm, priv->mode); | 271 | nouveau_therm_fan_mode(therm, priv->mode); |
267 | priv->sensor.program_alarms(therm); | 272 | priv->sensor.program_alarms(therm); |
268 | return 0; | 273 | return 0; |
269 | } | 274 | } |
@@ -313,11 +318,12 @@ nouveau_therm_create_(struct nouveau_object *parent, | |||
313 | int | 318 | int |
314 | nouveau_therm_preinit(struct nouveau_therm *therm) | 319 | nouveau_therm_preinit(struct nouveau_therm *therm) |
315 | { | 320 | { |
316 | nouveau_therm_ic_ctor(therm); | ||
317 | nouveau_therm_sensor_ctor(therm); | 321 | nouveau_therm_sensor_ctor(therm); |
322 | nouveau_therm_ic_ctor(therm); | ||
318 | nouveau_therm_fan_ctor(therm); | 323 | nouveau_therm_fan_ctor(therm); |
319 | 324 | ||
320 | nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_NONE); | 325 | nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_NONE); |
326 | nouveau_therm_sensor_preinit(therm); | ||
321 | return 0; | 327 | return 0; |
322 | } | 328 | } |
323 | 329 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c b/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c index e24090bac195..8b3adec5fbb1 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c | |||
@@ -32,6 +32,7 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c, | |||
32 | struct i2c_board_info *info) | 32 | struct i2c_board_info *info) |
33 | { | 33 | { |
34 | struct nouveau_therm_priv *priv = (void *)nouveau_therm(i2c); | 34 | struct nouveau_therm_priv *priv = (void *)nouveau_therm(i2c); |
35 | struct nvbios_therm_sensor *sensor = &priv->bios_sensor; | ||
35 | struct i2c_client *client; | 36 | struct i2c_client *client; |
36 | 37 | ||
37 | request_module("%s%s", I2C_MODULE_PREFIX, info->type); | 38 | request_module("%s%s", I2C_MODULE_PREFIX, info->type); |
@@ -46,8 +47,9 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c, | |||
46 | } | 47 | } |
47 | 48 | ||
48 | nv_info(priv, | 49 | nv_info(priv, |
49 | "Found an %s at address 0x%x (controlled by lm_sensors)\n", | 50 | "Found an %s at address 0x%x (controlled by lm_sensors, " |
50 | info->type, info->addr); | 51 | "temp offset %+i C)\n", |
52 | info->type, info->addr, sensor->offset_constant); | ||
51 | priv->ic = client; | 53 | priv->ic = client; |
52 | 54 | ||
53 | return true; | 55 | return true; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c b/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c index 0f5363edb964..a70d1b7e397b 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c | |||
@@ -29,54 +29,83 @@ struct nv40_therm_priv { | |||
29 | struct nouveau_therm_priv base; | 29 | struct nouveau_therm_priv base; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | enum nv40_sensor_style { INVALID_STYLE = -1, OLD_STYLE = 0, NEW_STYLE = 1 }; | ||
33 | |||
34 | static enum nv40_sensor_style | ||
35 | nv40_sensor_style(struct nouveau_therm *therm) | ||
36 | { | ||
37 | struct nouveau_device *device = nv_device(therm); | ||
38 | |||
39 | switch (device->chipset) { | ||
40 | case 0x43: | ||
41 | case 0x44: | ||
42 | case 0x4a: | ||
43 | case 0x47: | ||
44 | return OLD_STYLE; | ||
45 | |||
46 | case 0x46: | ||
47 | case 0x49: | ||
48 | case 0x4b: | ||
49 | case 0x4e: | ||
50 | case 0x4c: | ||
51 | case 0x67: | ||
52 | case 0x68: | ||
53 | case 0x63: | ||
54 | return NEW_STYLE; | ||
55 | default: | ||
56 | return INVALID_STYLE; | ||
57 | } | ||
58 | } | ||
59 | |||
32 | static int | 60 | static int |
33 | nv40_sensor_setup(struct nouveau_therm *therm) | 61 | nv40_sensor_setup(struct nouveau_therm *therm) |
34 | { | 62 | { |
35 | struct nouveau_device *device = nv_device(therm); | 63 | enum nv40_sensor_style style = nv40_sensor_style(therm); |
36 | 64 | ||
37 | /* enable ADC readout and disable the ALARM threshold */ | 65 | /* enable ADC readout and disable the ALARM threshold */ |
38 | if (device->chipset >= 0x46) { | 66 | if (style == NEW_STYLE) { |
39 | nv_mask(therm, 0x15b8, 0x80000000, 0); | 67 | nv_mask(therm, 0x15b8, 0x80000000, 0); |
40 | nv_wr32(therm, 0x15b0, 0x80003fff); | 68 | nv_wr32(therm, 0x15b0, 0x80003fff); |
41 | mdelay(10); /* wait for the temperature to stabilize */ | 69 | mdelay(20); /* wait for the temperature to stabilize */ |
42 | return nv_rd32(therm, 0x15b4) & 0x3fff; | 70 | return nv_rd32(therm, 0x15b4) & 0x3fff; |
43 | } else { | 71 | } else if (style == OLD_STYLE) { |
44 | nv_wr32(therm, 0x15b0, 0xff); | 72 | nv_wr32(therm, 0x15b0, 0xff); |
73 | mdelay(20); /* wait for the temperature to stabilize */ | ||
45 | return nv_rd32(therm, 0x15b4) & 0xff; | 74 | return nv_rd32(therm, 0x15b4) & 0xff; |
46 | } | 75 | } else |
76 | return -ENODEV; | ||
47 | } | 77 | } |
48 | 78 | ||
49 | static int | 79 | static int |
50 | nv40_temp_get(struct nouveau_therm *therm) | 80 | nv40_temp_get(struct nouveau_therm *therm) |
51 | { | 81 | { |
52 | struct nouveau_therm_priv *priv = (void *)therm; | 82 | struct nouveau_therm_priv *priv = (void *)therm; |
53 | struct nouveau_device *device = nv_device(therm); | ||
54 | struct nvbios_therm_sensor *sensor = &priv->bios_sensor; | 83 | struct nvbios_therm_sensor *sensor = &priv->bios_sensor; |
84 | enum nv40_sensor_style style = nv40_sensor_style(therm); | ||
55 | int core_temp; | 85 | int core_temp; |
56 | 86 | ||
57 | if (device->chipset >= 0x46) { | 87 | if (style == NEW_STYLE) { |
58 | nv_wr32(therm, 0x15b0, 0x80003fff); | 88 | nv_wr32(therm, 0x15b0, 0x80003fff); |
59 | core_temp = nv_rd32(therm, 0x15b4) & 0x3fff; | 89 | core_temp = nv_rd32(therm, 0x15b4) & 0x3fff; |
60 | } else { | 90 | } else if (style == OLD_STYLE) { |
61 | nv_wr32(therm, 0x15b0, 0xff); | 91 | nv_wr32(therm, 0x15b0, 0xff); |
62 | core_temp = nv_rd32(therm, 0x15b4) & 0xff; | 92 | core_temp = nv_rd32(therm, 0x15b4) & 0xff; |
63 | } | 93 | } else |
64 | 94 | return -ENODEV; | |
65 | /* Setup the sensor if the temperature is 0 */ | ||
66 | if (core_temp == 0) | ||
67 | core_temp = nv40_sensor_setup(therm); | ||
68 | 95 | ||
69 | if (sensor->slope_div == 0) | 96 | /* if the slope or the offset is unset, do no use the sensor */ |
70 | sensor->slope_div = 1; | 97 | if (!sensor->slope_div || !sensor->slope_mult || |
71 | if (sensor->offset_den == 0) | 98 | !sensor->offset_num || !sensor->offset_den) |
72 | sensor->offset_den = 1; | 99 | return -ENODEV; |
73 | if (sensor->slope_mult < 1) | ||
74 | sensor->slope_mult = 1; | ||
75 | 100 | ||
76 | core_temp = core_temp * sensor->slope_mult / sensor->slope_div; | 101 | core_temp = core_temp * sensor->slope_mult / sensor->slope_div; |
77 | core_temp = core_temp + sensor->offset_num / sensor->offset_den; | 102 | core_temp = core_temp + sensor->offset_num / sensor->offset_den; |
78 | core_temp = core_temp + sensor->offset_constant - 8; | 103 | core_temp = core_temp + sensor->offset_constant - 8; |
79 | 104 | ||
105 | /* reserve negative temperatures for errors */ | ||
106 | if (core_temp < 0) | ||
107 | core_temp = 0; | ||
108 | |||
80 | return core_temp; | 109 | return core_temp; |
81 | } | 110 | } |
82 | 111 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h b/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h index 06b98706b3fc..438d9824b774 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h | |||
@@ -102,7 +102,7 @@ struct nouveau_therm_priv { | |||
102 | struct i2c_client *ic; | 102 | struct i2c_client *ic; |
103 | }; | 103 | }; |
104 | 104 | ||
105 | int nouveau_therm_mode(struct nouveau_therm *therm, int mode); | 105 | int nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode); |
106 | int nouveau_therm_attr_get(struct nouveau_therm *therm, | 106 | int nouveau_therm_attr_get(struct nouveau_therm *therm, |
107 | enum nouveau_therm_attr_type type); | 107 | enum nouveau_therm_attr_type type); |
108 | int nouveau_therm_attr_set(struct nouveau_therm *therm, | 108 | int nouveau_therm_attr_set(struct nouveau_therm *therm, |
@@ -122,6 +122,7 @@ int nouveau_therm_fan_sense(struct nouveau_therm *therm); | |||
122 | 122 | ||
123 | int nouveau_therm_preinit(struct nouveau_therm *); | 123 | int nouveau_therm_preinit(struct nouveau_therm *); |
124 | 124 | ||
125 | void nouveau_therm_sensor_preinit(struct nouveau_therm *); | ||
125 | void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm, | 126 | void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm, |
126 | enum nouveau_therm_thrs thrs, | 127 | enum nouveau_therm_thrs thrs, |
127 | enum nouveau_therm_thrs_state st); | 128 | enum nouveau_therm_thrs_state st); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c b/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c index b37624af8297..470f6a47b656 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c | |||
@@ -34,10 +34,6 @@ nouveau_therm_temp_set_defaults(struct nouveau_therm *therm) | |||
34 | { | 34 | { |
35 | struct nouveau_therm_priv *priv = (void *)therm; | 35 | struct nouveau_therm_priv *priv = (void *)therm; |
36 | 36 | ||
37 | priv->bios_sensor.slope_mult = 1; | ||
38 | priv->bios_sensor.slope_div = 1; | ||
39 | priv->bios_sensor.offset_num = 0; | ||
40 | priv->bios_sensor.offset_den = 1; | ||
41 | priv->bios_sensor.offset_constant = 0; | 37 | priv->bios_sensor.offset_constant = 0; |
42 | 38 | ||
43 | priv->bios_sensor.thrs_fan_boost.temp = 90; | 39 | priv->bios_sensor.thrs_fan_boost.temp = 90; |
@@ -60,11 +56,6 @@ nouveau_therm_temp_safety_checks(struct nouveau_therm *therm) | |||
60 | struct nouveau_therm_priv *priv = (void *)therm; | 56 | struct nouveau_therm_priv *priv = (void *)therm; |
61 | struct nvbios_therm_sensor *s = &priv->bios_sensor; | 57 | struct nvbios_therm_sensor *s = &priv->bios_sensor; |
62 | 58 | ||
63 | if (!priv->bios_sensor.slope_div) | ||
64 | priv->bios_sensor.slope_div = 1; | ||
65 | if (!priv->bios_sensor.offset_den) | ||
66 | priv->bios_sensor.offset_den = 1; | ||
67 | |||
68 | /* enforce a minimum hysteresis on thresholds */ | 59 | /* enforce a minimum hysteresis on thresholds */ |
69 | s->thrs_fan_boost.hysteresis = max_t(u8, s->thrs_fan_boost.hysteresis, 2); | 60 | s->thrs_fan_boost.hysteresis = max_t(u8, s->thrs_fan_boost.hysteresis, 2); |
70 | s->thrs_down_clock.hysteresis = max_t(u8, s->thrs_down_clock.hysteresis, 2); | 61 | s->thrs_down_clock.hysteresis = max_t(u8, s->thrs_down_clock.hysteresis, 2); |
@@ -106,16 +97,16 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm, | |||
106 | const char *thresolds[] = { | 97 | const char *thresolds[] = { |
107 | "fanboost", "downclock", "critical", "shutdown" | 98 | "fanboost", "downclock", "critical", "shutdown" |
108 | }; | 99 | }; |
109 | uint8_t temperature = therm->temp_get(therm); | 100 | int temperature = therm->temp_get(therm); |
110 | 101 | ||
111 | if (thrs < 0 || thrs > 3) | 102 | if (thrs < 0 || thrs > 3) |
112 | return; | 103 | return; |
113 | 104 | ||
114 | if (dir == NOUVEAU_THERM_THRS_FALLING) | 105 | if (dir == NOUVEAU_THERM_THRS_FALLING) |
115 | nv_info(therm, "temperature (%u C) went below the '%s' threshold\n", | 106 | nv_info(therm, "temperature (%i C) went below the '%s' threshold\n", |
116 | temperature, thresolds[thrs]); | 107 | temperature, thresolds[thrs]); |
117 | else | 108 | else |
118 | nv_info(therm, "temperature (%u C) hit the '%s' threshold\n", | 109 | nv_info(therm, "temperature (%i C) hit the '%s' threshold\n", |
119 | temperature, thresolds[thrs]); | 110 | temperature, thresolds[thrs]); |
120 | 111 | ||
121 | active = (dir == NOUVEAU_THERM_THRS_RISING); | 112 | active = (dir == NOUVEAU_THERM_THRS_RISING); |
@@ -123,7 +114,7 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm, | |||
123 | case NOUVEAU_THERM_THRS_FANBOOST: | 114 | case NOUVEAU_THERM_THRS_FANBOOST: |
124 | if (active) { | 115 | if (active) { |
125 | nouveau_therm_fan_set(therm, true, 100); | 116 | nouveau_therm_fan_set(therm, true, 100); |
126 | nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_AUTO); | 117 | nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_AUTO); |
127 | } | 118 | } |
128 | break; | 119 | break; |
129 | case NOUVEAU_THERM_THRS_DOWNCLOCK: | 120 | case NOUVEAU_THERM_THRS_DOWNCLOCK: |
@@ -202,7 +193,7 @@ alarm_timer_callback(struct nouveau_alarm *alarm) | |||
202 | NOUVEAU_THERM_THRS_SHUTDOWN); | 193 | NOUVEAU_THERM_THRS_SHUTDOWN); |
203 | 194 | ||
204 | /* schedule the next poll in one second */ | 195 | /* schedule the next poll in one second */ |
205 | if (list_empty(&alarm->head)) | 196 | if (therm->temp_get(therm) >= 0 && list_empty(&alarm->head)) |
206 | ptimer->alarm(ptimer, 1000 * 1000 * 1000, alarm); | 197 | ptimer->alarm(ptimer, 1000 * 1000 * 1000, alarm); |
207 | 198 | ||
208 | spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags); | 199 | spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags); |
@@ -225,6 +216,17 @@ nouveau_therm_program_alarms_polling(struct nouveau_therm *therm) | |||
225 | alarm_timer_callback(&priv->sensor.therm_poll_alarm); | 216 | alarm_timer_callback(&priv->sensor.therm_poll_alarm); |
226 | } | 217 | } |
227 | 218 | ||
219 | void | ||
220 | nouveau_therm_sensor_preinit(struct nouveau_therm *therm) | ||
221 | { | ||
222 | const char *sensor_avail = "yes"; | ||
223 | |||
224 | if (therm->temp_get(therm) < 0) | ||
225 | sensor_avail = "no"; | ||
226 | |||
227 | nv_info(therm, "internal sensor: %s\n", sensor_avail); | ||
228 | } | ||
229 | |||
228 | int | 230 | int |
229 | nouveau_therm_sensor_ctor(struct nouveau_therm *therm) | 231 | nouveau_therm_sensor_ctor(struct nouveau_therm *therm) |
230 | { | 232 | { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index bb54098c6d97..936b442a6ab7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -402,8 +402,12 @@ nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf) | |||
402 | struct drm_device *dev = dev_get_drvdata(d); | 402 | struct drm_device *dev = dev_get_drvdata(d); |
403 | struct nouveau_drm *drm = nouveau_drm(dev); | 403 | struct nouveau_drm *drm = nouveau_drm(dev); |
404 | struct nouveau_therm *therm = nouveau_therm(drm->device); | 404 | struct nouveau_therm *therm = nouveau_therm(drm->device); |
405 | int temp = therm->temp_get(therm); | ||
405 | 406 | ||
406 | return snprintf(buf, PAGE_SIZE, "%d\n", therm->temp_get(therm) * 1000); | 407 | if (temp < 0) |
408 | return temp; | ||
409 | |||
410 | return snprintf(buf, PAGE_SIZE, "%d\n", temp * 1000); | ||
407 | } | 411 | } |
408 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp, | 412 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp, |
409 | NULL, 0); | 413 | NULL, 0); |
@@ -871,7 +875,12 @@ static SENSOR_DEVICE_ATTR(pwm1_max, S_IRUGO | S_IWUSR, | |||
871 | nouveau_hwmon_get_pwm1_max, | 875 | nouveau_hwmon_get_pwm1_max, |
872 | nouveau_hwmon_set_pwm1_max, 0); | 876 | nouveau_hwmon_set_pwm1_max, 0); |
873 | 877 | ||
874 | static struct attribute *hwmon_attributes[] = { | 878 | static struct attribute *hwmon_default_attributes[] = { |
879 | &sensor_dev_attr_name.dev_attr.attr, | ||
880 | &sensor_dev_attr_update_rate.dev_attr.attr, | ||
881 | NULL | ||
882 | }; | ||
883 | static struct attribute *hwmon_temp_attributes[] = { | ||
875 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 884 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
876 | &sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr, | 885 | &sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr, |
877 | &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, | 886 | &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, |
@@ -882,8 +891,6 @@ static struct attribute *hwmon_attributes[] = { | |||
882 | &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, | 891 | &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, |
883 | &sensor_dev_attr_temp1_emergency.dev_attr.attr, | 892 | &sensor_dev_attr_temp1_emergency.dev_attr.attr, |
884 | &sensor_dev_attr_temp1_emergency_hyst.dev_attr.attr, | 893 | &sensor_dev_attr_temp1_emergency_hyst.dev_attr.attr, |
885 | &sensor_dev_attr_name.dev_attr.attr, | ||
886 | &sensor_dev_attr_update_rate.dev_attr.attr, | ||
887 | NULL | 894 | NULL |
888 | }; | 895 | }; |
889 | static struct attribute *hwmon_fan_rpm_attributes[] = { | 896 | static struct attribute *hwmon_fan_rpm_attributes[] = { |
@@ -898,8 +905,11 @@ static struct attribute *hwmon_pwm_fan_attributes[] = { | |||
898 | NULL | 905 | NULL |
899 | }; | 906 | }; |
900 | 907 | ||
901 | static const struct attribute_group hwmon_attrgroup = { | 908 | static const struct attribute_group hwmon_default_attrgroup = { |
902 | .attrs = hwmon_attributes, | 909 | .attrs = hwmon_default_attributes, |
910 | }; | ||
911 | static const struct attribute_group hwmon_temp_attrgroup = { | ||
912 | .attrs = hwmon_temp_attributes, | ||
903 | }; | 913 | }; |
904 | static const struct attribute_group hwmon_fan_rpm_attrgroup = { | 914 | static const struct attribute_group hwmon_fan_rpm_attrgroup = { |
905 | .attrs = hwmon_fan_rpm_attributes, | 915 | .attrs = hwmon_fan_rpm_attributes, |
@@ -931,13 +941,22 @@ nouveau_hwmon_init(struct drm_device *dev) | |||
931 | } | 941 | } |
932 | dev_set_drvdata(hwmon_dev, dev); | 942 | dev_set_drvdata(hwmon_dev, dev); |
933 | 943 | ||
934 | /* default sysfs entries */ | 944 | /* set the default attributes */ |
935 | ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_attrgroup); | 945 | ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_default_attrgroup); |
936 | if (ret) { | 946 | if (ret) { |
937 | if (ret) | 947 | if (ret) |
938 | goto error; | 948 | goto error; |
939 | } | 949 | } |
940 | 950 | ||
951 | /* if the card has a working thermal sensor */ | ||
952 | if (therm->temp_get(therm) >= 0) { | ||
953 | ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_temp_attrgroup); | ||
954 | if (ret) { | ||
955 | if (ret) | ||
956 | goto error; | ||
957 | } | ||
958 | } | ||
959 | |||
941 | /* if the card has a pwm fan */ | 960 | /* if the card has a pwm fan */ |
942 | /*XXX: incorrect, need better detection for this, some boards have | 961 | /*XXX: incorrect, need better detection for this, some boards have |
943 | * the gpio entries for pwm fan control even when there's no | 962 | * the gpio entries for pwm fan control even when there's no |
@@ -979,11 +998,10 @@ nouveau_hwmon_fini(struct drm_device *dev) | |||
979 | struct nouveau_pm *pm = nouveau_pm(dev); | 998 | struct nouveau_pm *pm = nouveau_pm(dev); |
980 | 999 | ||
981 | if (pm->hwmon) { | 1000 | if (pm->hwmon) { |
982 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup); | 1001 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_default_attrgroup); |
983 | sysfs_remove_group(&pm->hwmon->kobj, | 1002 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_temp_attrgroup); |
984 | &hwmon_pwm_fan_attrgroup); | 1003 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_pwm_fan_attrgroup); |
985 | sysfs_remove_group(&pm->hwmon->kobj, | 1004 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_fan_rpm_attrgroup); |
986 | &hwmon_fan_rpm_attrgroup); | ||
987 | 1005 | ||
988 | hwmon_device_unregister(pm->hwmon); | 1006 | hwmon_device_unregister(pm->hwmon); |
989 | } | 1007 | } |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 2db57990f65c..7f0e6c3f37d1 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -524,6 +524,8 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
524 | swap_interval <<= 4; | 524 | swap_interval <<= 4; |
525 | if (swap_interval == 0) | 525 | if (swap_interval == 0) |
526 | swap_interval |= 0x100; | 526 | swap_interval |= 0x100; |
527 | if (chan == NULL) | ||
528 | evo_sync(crtc->dev); | ||
527 | 529 | ||
528 | push = evo_wait(sync, 128); | 530 | push = evo_wait(sync, 128); |
529 | if (unlikely(push == NULL)) | 531 | if (unlikely(push == NULL)) |
@@ -586,8 +588,6 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
586 | sync->addr ^= 0x10; | 588 | sync->addr ^= 0x10; |
587 | sync->data++; | 589 | sync->data++; |
588 | FIRE_RING (chan); | 590 | FIRE_RING (chan); |
589 | } else { | ||
590 | evo_sync(crtc->dev); | ||
591 | } | 591 | } |
592 | 592 | ||
593 | /* queue the flip */ | 593 | /* queue the flip */ |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index d4c633e12863..27769e724b6d 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -468,13 +468,19 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
468 | (rdev->pdev->device == 0x9907) || | 468 | (rdev->pdev->device == 0x9907) || |
469 | (rdev->pdev->device == 0x9908) || | 469 | (rdev->pdev->device == 0x9908) || |
470 | (rdev->pdev->device == 0x9909) || | 470 | (rdev->pdev->device == 0x9909) || |
471 | (rdev->pdev->device == 0x990B) || | ||
472 | (rdev->pdev->device == 0x990C) || | ||
473 | (rdev->pdev->device == 0x990F) || | ||
471 | (rdev->pdev->device == 0x9910) || | 474 | (rdev->pdev->device == 0x9910) || |
472 | (rdev->pdev->device == 0x9917)) { | 475 | (rdev->pdev->device == 0x9917) || |
476 | (rdev->pdev->device == 0x9999)) { | ||
473 | rdev->config.cayman.max_simds_per_se = 6; | 477 | rdev->config.cayman.max_simds_per_se = 6; |
474 | rdev->config.cayman.max_backends_per_se = 2; | 478 | rdev->config.cayman.max_backends_per_se = 2; |
475 | } else if ((rdev->pdev->device == 0x9903) || | 479 | } else if ((rdev->pdev->device == 0x9903) || |
476 | (rdev->pdev->device == 0x9904) || | 480 | (rdev->pdev->device == 0x9904) || |
477 | (rdev->pdev->device == 0x990A) || | 481 | (rdev->pdev->device == 0x990A) || |
482 | (rdev->pdev->device == 0x990D) || | ||
483 | (rdev->pdev->device == 0x990E) || | ||
478 | (rdev->pdev->device == 0x9913) || | 484 | (rdev->pdev->device == 0x9913) || |
479 | (rdev->pdev->device == 0x9918)) { | 485 | (rdev->pdev->device == 0x9918)) { |
480 | rdev->config.cayman.max_simds_per_se = 4; | 486 | rdev->config.cayman.max_simds_per_se = 4; |
@@ -483,6 +489,9 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
483 | (rdev->pdev->device == 0x9990) || | 489 | (rdev->pdev->device == 0x9990) || |
484 | (rdev->pdev->device == 0x9991) || | 490 | (rdev->pdev->device == 0x9991) || |
485 | (rdev->pdev->device == 0x9994) || | 491 | (rdev->pdev->device == 0x9994) || |
492 | (rdev->pdev->device == 0x9995) || | ||
493 | (rdev->pdev->device == 0x9996) || | ||
494 | (rdev->pdev->device == 0x999A) || | ||
486 | (rdev->pdev->device == 0x99A0)) { | 495 | (rdev->pdev->device == 0x99A0)) { |
487 | rdev->config.cayman.max_simds_per_se = 3; | 496 | rdev->config.cayman.max_simds_per_se = 3; |
488 | rdev->config.cayman.max_backends_per_se = 1; | 497 | rdev->config.cayman.max_backends_per_se = 1; |
@@ -616,11 +625,22 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
616 | WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config); | 625 | WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config); |
617 | WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config); | 626 | WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config); |
618 | 627 | ||
619 | tmp = gb_addr_config & NUM_PIPES_MASK; | 628 | if ((rdev->config.cayman.max_backends_per_se == 1) && |
620 | tmp = r6xx_remap_render_backend(rdev, tmp, | 629 | (rdev->flags & RADEON_IS_IGP)) { |
621 | rdev->config.cayman.max_backends_per_se * | 630 | if ((disabled_rb_mask & 3) == 1) { |
622 | rdev->config.cayman.max_shader_engines, | 631 | /* RB0 disabled, RB1 enabled */ |
623 | CAYMAN_MAX_BACKENDS, disabled_rb_mask); | 632 | tmp = 0x11111111; |
633 | } else { | ||
634 | /* RB1 disabled, RB0 enabled */ | ||
635 | tmp = 0x00000000; | ||
636 | } | ||
637 | } else { | ||
638 | tmp = gb_addr_config & NUM_PIPES_MASK; | ||
639 | tmp = r6xx_remap_render_backend(rdev, tmp, | ||
640 | rdev->config.cayman.max_backends_per_se * | ||
641 | rdev->config.cayman.max_shader_engines, | ||
642 | CAYMAN_MAX_BACKENDS, disabled_rb_mask); | ||
643 | } | ||
624 | WREG32(GB_BACKEND_MAP, tmp); | 644 | WREG32(GB_BACKEND_MAP, tmp); |
625 | 645 | ||
626 | cgts_tcc_disable = 0xffff0000; | 646 | cgts_tcc_disable = 0xffff0000; |
@@ -1771,6 +1791,7 @@ int cayman_resume(struct radeon_device *rdev) | |||
1771 | int cayman_suspend(struct radeon_device *rdev) | 1791 | int cayman_suspend(struct radeon_device *rdev) |
1772 | { | 1792 | { |
1773 | r600_audio_fini(rdev); | 1793 | r600_audio_fini(rdev); |
1794 | radeon_vm_manager_fini(rdev); | ||
1774 | cayman_cp_enable(rdev, false); | 1795 | cayman_cp_enable(rdev, false); |
1775 | cayman_dma_stop(rdev); | 1796 | cayman_dma_stop(rdev); |
1776 | evergreen_irq_suspend(rdev); | 1797 | evergreen_irq_suspend(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c index bedda9caadd9..6e05a2e75a46 100644 --- a/drivers/gpu/drm/radeon/radeon_benchmark.c +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c | |||
@@ -122,10 +122,7 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size, | |||
122 | goto out_cleanup; | 122 | goto out_cleanup; |
123 | } | 123 | } |
124 | 124 | ||
125 | /* r100 doesn't have dma engine so skip the test */ | 125 | if (rdev->asic->copy.dma) { |
126 | /* also, VRAM-to-VRAM test doesn't make much sense for DMA */ | ||
127 | /* skip it as well if domains are the same */ | ||
128 | if ((rdev->asic->copy.dma) && (sdomain != ddomain)) { | ||
129 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, | 126 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, |
130 | RADEON_BENCHMARK_COPY_DMA, n); | 127 | RADEON_BENCHMARK_COPY_DMA, n); |
131 | if (time < 0) | 128 | if (time < 0) |
@@ -135,13 +132,15 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size, | |||
135 | sdomain, ddomain, "dma"); | 132 | sdomain, ddomain, "dma"); |
136 | } | 133 | } |
137 | 134 | ||
138 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, | 135 | if (rdev->asic->copy.blit) { |
139 | RADEON_BENCHMARK_COPY_BLIT, n); | 136 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, |
140 | if (time < 0) | 137 | RADEON_BENCHMARK_COPY_BLIT, n); |
141 | goto out_cleanup; | 138 | if (time < 0) |
142 | if (time > 0) | 139 | goto out_cleanup; |
143 | radeon_benchmark_log_results(n, size, time, | 140 | if (time > 0) |
144 | sdomain, ddomain, "blit"); | 141 | radeon_benchmark_log_results(n, size, time, |
142 | sdomain, ddomain, "blit"); | ||
143 | } | ||
145 | 144 | ||
146 | out_cleanup: | 145 | out_cleanup: |
147 | if (sobj) { | 146 | if (sobj) { |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 9128120da044..bafbe3216952 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -4469,6 +4469,7 @@ int si_resume(struct radeon_device *rdev) | |||
4469 | 4469 | ||
4470 | int si_suspend(struct radeon_device *rdev) | 4470 | int si_suspend(struct radeon_device *rdev) |
4471 | { | 4471 | { |
4472 | radeon_vm_manager_fini(rdev); | ||
4472 | si_cp_enable(rdev, false); | 4473 | si_cp_enable(rdev, false); |
4473 | cayman_dma_stop(rdev); | 4474 | cayman_dma_stop(rdev); |
4474 | si_irq_suspend(rdev); | 4475 | si_irq_suspend(rdev); |
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index e9205ee8cf94..130f02cc9d94 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c | |||
@@ -80,6 +80,7 @@ | |||
80 | /* PCI DIDs for the Intel SMBus Message Transport (SMT) Devices */ | 80 | /* PCI DIDs for the Intel SMBus Message Transport (SMT) Devices */ |
81 | #define PCI_DEVICE_ID_INTEL_S1200_SMT0 0x0c59 | 81 | #define PCI_DEVICE_ID_INTEL_S1200_SMT0 0x0c59 |
82 | #define PCI_DEVICE_ID_INTEL_S1200_SMT1 0x0c5a | 82 | #define PCI_DEVICE_ID_INTEL_S1200_SMT1 0x0c5a |
83 | #define PCI_DEVICE_ID_INTEL_AVOTON_SMT 0x1f15 | ||
83 | 84 | ||
84 | #define ISMT_DESC_ENTRIES 32 /* number of descriptor entries */ | 85 | #define ISMT_DESC_ENTRIES 32 /* number of descriptor entries */ |
85 | #define ISMT_MAX_RETRIES 3 /* number of SMBus retries to attempt */ | 86 | #define ISMT_MAX_RETRIES 3 /* number of SMBus retries to attempt */ |
@@ -185,6 +186,7 @@ struct ismt_priv { | |||
185 | static const DEFINE_PCI_DEVICE_TABLE(ismt_ids) = { | 186 | static const DEFINE_PCI_DEVICE_TABLE(ismt_ids) = { |
186 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT0) }, | 187 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT0) }, |
187 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT1) }, | 188 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT1) }, |
189 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_AVOTON_SMT) }, | ||
188 | { 0, } | 190 | { 0, } |
189 | }; | 191 | }; |
190 | 192 | ||
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 36704e3ab3fa..b714776b6ddd 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -411,7 +411,11 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | |||
411 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; | 411 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; |
412 | u32 clk_divisor; | 412 | u32 clk_divisor; |
413 | 413 | ||
414 | tegra_i2c_clock_enable(i2c_dev); | 414 | err = tegra_i2c_clock_enable(i2c_dev); |
415 | if (err < 0) { | ||
416 | dev_err(i2c_dev->dev, "Clock enable failed %d\n", err); | ||
417 | return err; | ||
418 | } | ||
415 | 419 | ||
416 | tegra_periph_reset_assert(i2c_dev->div_clk); | 420 | tegra_periph_reset_assert(i2c_dev->div_clk); |
417 | udelay(2); | 421 | udelay(2); |
@@ -628,7 +632,12 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], | |||
628 | if (i2c_dev->is_suspended) | 632 | if (i2c_dev->is_suspended) |
629 | return -EBUSY; | 633 | return -EBUSY; |
630 | 634 | ||
631 | tegra_i2c_clock_enable(i2c_dev); | 635 | ret = tegra_i2c_clock_enable(i2c_dev); |
636 | if (ret < 0) { | ||
637 | dev_err(i2c_dev->dev, "Clock enable failed %d\n", ret); | ||
638 | return ret; | ||
639 | } | ||
640 | |||
632 | for (i = 0; i < num; i++) { | 641 | for (i = 0; i < num; i++) { |
633 | enum msg_end_type end_type = MSG_END_STOP; | 642 | enum msg_end_type end_type = MSG_END_STOP; |
634 | if (i < (num - 1)) { | 643 | if (i < (num - 1)) { |
diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c index f3b8f9a6a89b..966a18a5d12d 100644 --- a/drivers/i2c/muxes/i2c-mux-pca9541.c +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2010 Ericsson AB. | 4 | * Copyright (c) 2010 Ericsson AB. |
5 | * | 5 | * |
6 | * Author: Guenter Roeck <guenter.roeck@ericsson.com> | 6 | * Author: Guenter Roeck <linux@roeck-us.net> |
7 | * | 7 | * |
8 | * Derived from: | 8 | * Derived from: |
9 | * pca954x.c | 9 | * pca954x.c |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 17ba4f8bc12d..70b1808a08f4 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -186,8 +186,10 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, | |||
186 | wq->rq.queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev), | 186 | wq->rq.queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev), |
187 | wq->rq.memsize, &(wq->rq.dma_addr), | 187 | wq->rq.memsize, &(wq->rq.dma_addr), |
188 | GFP_KERNEL); | 188 | GFP_KERNEL); |
189 | if (!wq->rq.queue) | 189 | if (!wq->rq.queue) { |
190 | ret = -ENOMEM; | ||
190 | goto free_sq; | 191 | goto free_sq; |
192 | } | ||
191 | PDBG("%s sq base va 0x%p pa 0x%llx rq base va 0x%p pa 0x%llx\n", | 193 | PDBG("%s sq base va 0x%p pa 0x%llx rq base va 0x%p pa 0x%llx\n", |
192 | __func__, wq->sq.queue, | 194 | __func__, wq->sq.queue, |
193 | (unsigned long long)virt_to_phys(wq->sq.queue), | 195 | (unsigned long long)virt_to_phys(wq->sq.queue), |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 439c35d4a669..ea93870266eb 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -620,7 +620,7 @@ void ipath_ib_rcv(struct ipath_ibdev *dev, void *rhdr, void *data, | |||
620 | goto bail; | 620 | goto bail; |
621 | } | 621 | } |
622 | 622 | ||
623 | opcode = be32_to_cpu(ohdr->bth[0]) >> 24; | 623 | opcode = (be32_to_cpu(ohdr->bth[0]) >> 24) & 0x7f; |
624 | dev->opstats[opcode].n_bytes += tlen; | 624 | dev->opstats[opcode].n_bytes += tlen; |
625 | dev->opstats[opcode].n_packets++; | 625 | dev->opstats[opcode].n_packets++; |
626 | 626 | ||
diff --git a/drivers/infiniband/hw/qib/Kconfig b/drivers/infiniband/hw/qib/Kconfig index 8349f9c5064c..1e603a375069 100644 --- a/drivers/infiniband/hw/qib/Kconfig +++ b/drivers/infiniband/hw/qib/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config INFINIBAND_QIB | 1 | config INFINIBAND_QIB |
2 | tristate "QLogic PCIe HCA support" | 2 | tristate "Intel PCIe HCA support" |
3 | depends on 64BIT | 3 | depends on 64BIT |
4 | ---help--- | 4 | ---help--- |
5 | This is a low-level driver for QLogic PCIe QLE InfiniBand host | 5 | This is a low-level driver for Intel PCIe QLE InfiniBand host |
6 | channel adapters. This driver does not support the QLogic | 6 | channel adapters. This driver does not support the Intel |
7 | HyperTransport card (model QHT7140). | 7 | HyperTransport card (model QHT7140). |
diff --git a/drivers/infiniband/hw/qib/qib_driver.c b/drivers/infiniband/hw/qib/qib_driver.c index 5423edcab51f..216092477dfc 100644 --- a/drivers/infiniband/hw/qib/qib_driver.c +++ b/drivers/infiniband/hw/qib/qib_driver.c | |||
@@ -1,4 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013 Intel Corporation. All rights reserved. | ||
2 | * Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved. | 3 | * Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved. |
3 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
4 | * | 5 | * |
@@ -63,8 +64,8 @@ MODULE_PARM_DESC(compat_ddr_negotiate, | |||
63 | "Attempt pre-IBTA 1.2 DDR speed negotiation"); | 64 | "Attempt pre-IBTA 1.2 DDR speed negotiation"); |
64 | 65 | ||
65 | MODULE_LICENSE("Dual BSD/GPL"); | 66 | MODULE_LICENSE("Dual BSD/GPL"); |
66 | MODULE_AUTHOR("QLogic <support@qlogic.com>"); | 67 | MODULE_AUTHOR("Intel <ibsupport@intel.com>"); |
67 | MODULE_DESCRIPTION("QLogic IB driver"); | 68 | MODULE_DESCRIPTION("Intel IB driver"); |
68 | MODULE_VERSION(QIB_DRIVER_VERSION); | 69 | MODULE_VERSION(QIB_DRIVER_VERSION); |
69 | 70 | ||
70 | /* | 71 | /* |
diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c index a099ac171e22..0232ae56b1fa 100644 --- a/drivers/infiniband/hw/qib/qib_iba6120.c +++ b/drivers/infiniband/hw/qib/qib_iba6120.c | |||
@@ -1,4 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2013 Intel Corporation. All rights reserved. | ||
2 | * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation. | 3 | * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation. |
3 | * All rights reserved. | 4 | * All rights reserved. |
4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 5 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
@@ -51,7 +52,7 @@ static u32 qib_6120_iblink_state(u64); | |||
51 | 52 | ||
52 | /* | 53 | /* |
53 | * This file contains all the chip-specific register information and | 54 | * This file contains all the chip-specific register information and |
54 | * access functions for the QLogic QLogic_IB PCI-Express chip. | 55 | * access functions for the Intel Intel_IB PCI-Express chip. |
55 | * | 56 | * |
56 | */ | 57 | */ |
57 | 58 | ||
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c index 50e33aa0b4e3..173f805790da 100644 --- a/drivers/infiniband/hw/qib/qib_init.c +++ b/drivers/infiniband/hw/qib/qib_init.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2012, 2013 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. | 3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. |
4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
5 | * | 5 | * |
@@ -1138,7 +1138,7 @@ void qib_disable_after_error(struct qib_devdata *dd) | |||
1138 | static void qib_remove_one(struct pci_dev *); | 1138 | static void qib_remove_one(struct pci_dev *); |
1139 | static int qib_init_one(struct pci_dev *, const struct pci_device_id *); | 1139 | static int qib_init_one(struct pci_dev *, const struct pci_device_id *); |
1140 | 1140 | ||
1141 | #define DRIVER_LOAD_MSG "QLogic " QIB_DRV_NAME " loaded: " | 1141 | #define DRIVER_LOAD_MSG "Intel " QIB_DRV_NAME " loaded: " |
1142 | #define PFX QIB_DRV_NAME ": " | 1142 | #define PFX QIB_DRV_NAME ": " |
1143 | 1143 | ||
1144 | static DEFINE_PCI_DEVICE_TABLE(qib_pci_tbl) = { | 1144 | static DEFINE_PCI_DEVICE_TABLE(qib_pci_tbl) = { |
@@ -1355,7 +1355,7 @@ static int qib_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1355 | dd = qib_init_iba6120_funcs(pdev, ent); | 1355 | dd = qib_init_iba6120_funcs(pdev, ent); |
1356 | #else | 1356 | #else |
1357 | qib_early_err(&pdev->dev, | 1357 | qib_early_err(&pdev->dev, |
1358 | "QLogic PCIE device 0x%x cannot work if CONFIG_PCI_MSI is not enabled\n", | 1358 | "Intel PCIE device 0x%x cannot work if CONFIG_PCI_MSI is not enabled\n", |
1359 | ent->device); | 1359 | ent->device); |
1360 | dd = ERR_PTR(-ENODEV); | 1360 | dd = ERR_PTR(-ENODEV); |
1361 | #endif | 1361 | #endif |
@@ -1371,7 +1371,7 @@ static int qib_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1371 | 1371 | ||
1372 | default: | 1372 | default: |
1373 | qib_early_err(&pdev->dev, | 1373 | qib_early_err(&pdev->dev, |
1374 | "Failing on unknown QLogic deviceid 0x%x\n", | 1374 | "Failing on unknown Intel deviceid 0x%x\n", |
1375 | ent->device); | 1375 | ent->device); |
1376 | ret = -ENODEV; | 1376 | ret = -ENODEV; |
1377 | } | 1377 | } |
diff --git a/drivers/infiniband/hw/qib/qib_sd7220.c b/drivers/infiniband/hw/qib/qib_sd7220.c index 50a8a0d4fe67..08a6c6d39e56 100644 --- a/drivers/infiniband/hw/qib/qib_sd7220.c +++ b/drivers/infiniband/hw/qib/qib_sd7220.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2013 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. | 3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. |
4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 4 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
5 | * | 5 | * |
@@ -44,7 +44,7 @@ | |||
44 | #include "qib.h" | 44 | #include "qib.h" |
45 | #include "qib_7220.h" | 45 | #include "qib_7220.h" |
46 | 46 | ||
47 | #define SD7220_FW_NAME "qlogic/sd7220.fw" | 47 | #define SD7220_FW_NAME "intel/sd7220.fw" |
48 | MODULE_FIRMWARE(SD7220_FW_NAME); | 48 | MODULE_FIRMWARE(SD7220_FW_NAME); |
49 | 49 | ||
50 | /* | 50 | /* |
diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c index ba51a4715a1d..7c0ab16a2fe2 100644 --- a/drivers/infiniband/hw/qib/qib_verbs.c +++ b/drivers/infiniband/hw/qib/qib_verbs.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2012, 2013 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. | 3 | * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved. |
4 | * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. | 4 | * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. |
5 | * | 5 | * |
@@ -2224,7 +2224,7 @@ int qib_register_ib_device(struct qib_devdata *dd) | |||
2224 | ibdev->dma_ops = &qib_dma_mapping_ops; | 2224 | ibdev->dma_ops = &qib_dma_mapping_ops; |
2225 | 2225 | ||
2226 | snprintf(ibdev->node_desc, sizeof(ibdev->node_desc), | 2226 | snprintf(ibdev->node_desc, sizeof(ibdev->node_desc), |
2227 | "QLogic Infiniband HCA %s", init_utsname()->nodename); | 2227 | "Intel Infiniband HCA %s", init_utsname()->nodename); |
2228 | 2228 | ||
2229 | ret = ib_register_device(ibdev, qib_create_port_files); | 2229 | ret = ib_register_device(ibdev, qib_create_port_files); |
2230 | if (ret) | 2230 | if (ret) |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 67b0c1d23678..1ef880de3a41 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -758,9 +758,13 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_ | |||
758 | if (++priv->tx_outstanding == ipoib_sendq_size) { | 758 | if (++priv->tx_outstanding == ipoib_sendq_size) { |
759 | ipoib_dbg(priv, "TX ring 0x%x full, stopping kernel net queue\n", | 759 | ipoib_dbg(priv, "TX ring 0x%x full, stopping kernel net queue\n", |
760 | tx->qp->qp_num); | 760 | tx->qp->qp_num); |
761 | if (ib_req_notify_cq(priv->send_cq, IB_CQ_NEXT_COMP)) | ||
762 | ipoib_warn(priv, "request notify on send CQ failed\n"); | ||
763 | netif_stop_queue(dev); | 761 | netif_stop_queue(dev); |
762 | rc = ib_req_notify_cq(priv->send_cq, | ||
763 | IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS); | ||
764 | if (rc < 0) | ||
765 | ipoib_warn(priv, "request notify on send CQ failed\n"); | ||
766 | else if (rc) | ||
767 | ipoib_send_comp_handler(priv->send_cq, dev); | ||
764 | } | 768 | } |
765 | } | 769 | } |
766 | } | 770 | } |
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 3c955e10a618..c6083132c4b8 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
@@ -1025,6 +1025,8 @@ void dm_bufio_prefetch(struct dm_bufio_client *c, | |||
1025 | { | 1025 | { |
1026 | struct blk_plug plug; | 1026 | struct blk_plug plug; |
1027 | 1027 | ||
1028 | BUG_ON(dm_bufio_in_request()); | ||
1029 | |||
1028 | blk_start_plug(&plug); | 1030 | blk_start_plug(&plug); |
1029 | dm_bufio_lock(c); | 1031 | dm_bufio_lock(c); |
1030 | 1032 | ||
diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c index fbd3625f2748..83e995fece88 100644 --- a/drivers/md/dm-cache-metadata.c +++ b/drivers/md/dm-cache-metadata.c | |||
@@ -83,6 +83,8 @@ struct cache_disk_superblock { | |||
83 | __le32 read_misses; | 83 | __le32 read_misses; |
84 | __le32 write_hits; | 84 | __le32 write_hits; |
85 | __le32 write_misses; | 85 | __le32 write_misses; |
86 | |||
87 | __le32 policy_version[CACHE_POLICY_VERSION_SIZE]; | ||
86 | } __packed; | 88 | } __packed; |
87 | 89 | ||
88 | struct dm_cache_metadata { | 90 | struct dm_cache_metadata { |
@@ -109,6 +111,7 @@ struct dm_cache_metadata { | |||
109 | bool clean_when_opened:1; | 111 | bool clean_when_opened:1; |
110 | 112 | ||
111 | char policy_name[CACHE_POLICY_NAME_SIZE]; | 113 | char policy_name[CACHE_POLICY_NAME_SIZE]; |
114 | unsigned policy_version[CACHE_POLICY_VERSION_SIZE]; | ||
112 | size_t policy_hint_size; | 115 | size_t policy_hint_size; |
113 | struct dm_cache_statistics stats; | 116 | struct dm_cache_statistics stats; |
114 | }; | 117 | }; |
@@ -268,7 +271,8 @@ static int __write_initial_superblock(struct dm_cache_metadata *cmd) | |||
268 | memset(disk_super->uuid, 0, sizeof(disk_super->uuid)); | 271 | memset(disk_super->uuid, 0, sizeof(disk_super->uuid)); |
269 | disk_super->magic = cpu_to_le64(CACHE_SUPERBLOCK_MAGIC); | 272 | disk_super->magic = cpu_to_le64(CACHE_SUPERBLOCK_MAGIC); |
270 | disk_super->version = cpu_to_le32(CACHE_VERSION); | 273 | disk_super->version = cpu_to_le32(CACHE_VERSION); |
271 | memset(disk_super->policy_name, 0, CACHE_POLICY_NAME_SIZE); | 274 | memset(disk_super->policy_name, 0, sizeof(disk_super->policy_name)); |
275 | memset(disk_super->policy_version, 0, sizeof(disk_super->policy_version)); | ||
272 | disk_super->policy_hint_size = 0; | 276 | disk_super->policy_hint_size = 0; |
273 | 277 | ||
274 | r = dm_sm_copy_root(cmd->metadata_sm, &disk_super->metadata_space_map_root, | 278 | r = dm_sm_copy_root(cmd->metadata_sm, &disk_super->metadata_space_map_root, |
@@ -284,7 +288,6 @@ static int __write_initial_superblock(struct dm_cache_metadata *cmd) | |||
284 | disk_super->metadata_block_size = cpu_to_le32(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); | 288 | disk_super->metadata_block_size = cpu_to_le32(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); |
285 | disk_super->data_block_size = cpu_to_le32(cmd->data_block_size); | 289 | disk_super->data_block_size = cpu_to_le32(cmd->data_block_size); |
286 | disk_super->cache_blocks = cpu_to_le32(0); | 290 | disk_super->cache_blocks = cpu_to_le32(0); |
287 | memset(disk_super->policy_name, 0, sizeof(disk_super->policy_name)); | ||
288 | 291 | ||
289 | disk_super->read_hits = cpu_to_le32(0); | 292 | disk_super->read_hits = cpu_to_le32(0); |
290 | disk_super->read_misses = cpu_to_le32(0); | 293 | disk_super->read_misses = cpu_to_le32(0); |
@@ -478,6 +481,9 @@ static void read_superblock_fields(struct dm_cache_metadata *cmd, | |||
478 | cmd->data_block_size = le32_to_cpu(disk_super->data_block_size); | 481 | cmd->data_block_size = le32_to_cpu(disk_super->data_block_size); |
479 | cmd->cache_blocks = to_cblock(le32_to_cpu(disk_super->cache_blocks)); | 482 | cmd->cache_blocks = to_cblock(le32_to_cpu(disk_super->cache_blocks)); |
480 | strncpy(cmd->policy_name, disk_super->policy_name, sizeof(cmd->policy_name)); | 483 | strncpy(cmd->policy_name, disk_super->policy_name, sizeof(cmd->policy_name)); |
484 | cmd->policy_version[0] = le32_to_cpu(disk_super->policy_version[0]); | ||
485 | cmd->policy_version[1] = le32_to_cpu(disk_super->policy_version[1]); | ||
486 | cmd->policy_version[2] = le32_to_cpu(disk_super->policy_version[2]); | ||
481 | cmd->policy_hint_size = le32_to_cpu(disk_super->policy_hint_size); | 487 | cmd->policy_hint_size = le32_to_cpu(disk_super->policy_hint_size); |
482 | 488 | ||
483 | cmd->stats.read_hits = le32_to_cpu(disk_super->read_hits); | 489 | cmd->stats.read_hits = le32_to_cpu(disk_super->read_hits); |
@@ -572,6 +578,9 @@ static int __commit_transaction(struct dm_cache_metadata *cmd, | |||
572 | disk_super->discard_nr_blocks = cpu_to_le64(from_dblock(cmd->discard_nr_blocks)); | 578 | disk_super->discard_nr_blocks = cpu_to_le64(from_dblock(cmd->discard_nr_blocks)); |
573 | disk_super->cache_blocks = cpu_to_le32(from_cblock(cmd->cache_blocks)); | 579 | disk_super->cache_blocks = cpu_to_le32(from_cblock(cmd->cache_blocks)); |
574 | strncpy(disk_super->policy_name, cmd->policy_name, sizeof(disk_super->policy_name)); | 580 | strncpy(disk_super->policy_name, cmd->policy_name, sizeof(disk_super->policy_name)); |
581 | disk_super->policy_version[0] = cpu_to_le32(cmd->policy_version[0]); | ||
582 | disk_super->policy_version[1] = cpu_to_le32(cmd->policy_version[1]); | ||
583 | disk_super->policy_version[2] = cpu_to_le32(cmd->policy_version[2]); | ||
575 | 584 | ||
576 | disk_super->read_hits = cpu_to_le32(cmd->stats.read_hits); | 585 | disk_super->read_hits = cpu_to_le32(cmd->stats.read_hits); |
577 | disk_super->read_misses = cpu_to_le32(cmd->stats.read_misses); | 586 | disk_super->read_misses = cpu_to_le32(cmd->stats.read_misses); |
@@ -854,18 +863,43 @@ struct thunk { | |||
854 | bool hints_valid; | 863 | bool hints_valid; |
855 | }; | 864 | }; |
856 | 865 | ||
866 | static bool policy_unchanged(struct dm_cache_metadata *cmd, | ||
867 | struct dm_cache_policy *policy) | ||
868 | { | ||
869 | const char *policy_name = dm_cache_policy_get_name(policy); | ||
870 | const unsigned *policy_version = dm_cache_policy_get_version(policy); | ||
871 | size_t policy_hint_size = dm_cache_policy_get_hint_size(policy); | ||
872 | |||
873 | /* | ||
874 | * Ensure policy names match. | ||
875 | */ | ||
876 | if (strncmp(cmd->policy_name, policy_name, sizeof(cmd->policy_name))) | ||
877 | return false; | ||
878 | |||
879 | /* | ||
880 | * Ensure policy major versions match. | ||
881 | */ | ||
882 | if (cmd->policy_version[0] != policy_version[0]) | ||
883 | return false; | ||
884 | |||
885 | /* | ||
886 | * Ensure policy hint sizes match. | ||
887 | */ | ||
888 | if (cmd->policy_hint_size != policy_hint_size) | ||
889 | return false; | ||
890 | |||
891 | return true; | ||
892 | } | ||
893 | |||
857 | static bool hints_array_initialized(struct dm_cache_metadata *cmd) | 894 | static bool hints_array_initialized(struct dm_cache_metadata *cmd) |
858 | { | 895 | { |
859 | return cmd->hint_root && cmd->policy_hint_size; | 896 | return cmd->hint_root && cmd->policy_hint_size; |
860 | } | 897 | } |
861 | 898 | ||
862 | static bool hints_array_available(struct dm_cache_metadata *cmd, | 899 | static bool hints_array_available(struct dm_cache_metadata *cmd, |
863 | const char *policy_name) | 900 | struct dm_cache_policy *policy) |
864 | { | 901 | { |
865 | bool policy_names_match = !strncmp(cmd->policy_name, policy_name, | 902 | return cmd->clean_when_opened && policy_unchanged(cmd, policy) && |
866 | sizeof(cmd->policy_name)); | ||
867 | |||
868 | return cmd->clean_when_opened && policy_names_match && | ||
869 | hints_array_initialized(cmd); | 903 | hints_array_initialized(cmd); |
870 | } | 904 | } |
871 | 905 | ||
@@ -899,7 +933,8 @@ static int __load_mapping(void *context, uint64_t cblock, void *leaf) | |||
899 | return r; | 933 | return r; |
900 | } | 934 | } |
901 | 935 | ||
902 | static int __load_mappings(struct dm_cache_metadata *cmd, const char *policy_name, | 936 | static int __load_mappings(struct dm_cache_metadata *cmd, |
937 | struct dm_cache_policy *policy, | ||
903 | load_mapping_fn fn, void *context) | 938 | load_mapping_fn fn, void *context) |
904 | { | 939 | { |
905 | struct thunk thunk; | 940 | struct thunk thunk; |
@@ -909,18 +944,19 @@ static int __load_mappings(struct dm_cache_metadata *cmd, const char *policy_nam | |||
909 | 944 | ||
910 | thunk.cmd = cmd; | 945 | thunk.cmd = cmd; |
911 | thunk.respect_dirty_flags = cmd->clean_when_opened; | 946 | thunk.respect_dirty_flags = cmd->clean_when_opened; |
912 | thunk.hints_valid = hints_array_available(cmd, policy_name); | 947 | thunk.hints_valid = hints_array_available(cmd, policy); |
913 | 948 | ||
914 | return dm_array_walk(&cmd->info, cmd->root, __load_mapping, &thunk); | 949 | return dm_array_walk(&cmd->info, cmd->root, __load_mapping, &thunk); |
915 | } | 950 | } |
916 | 951 | ||
917 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, const char *policy_name, | 952 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, |
953 | struct dm_cache_policy *policy, | ||
918 | load_mapping_fn fn, void *context) | 954 | load_mapping_fn fn, void *context) |
919 | { | 955 | { |
920 | int r; | 956 | int r; |
921 | 957 | ||
922 | down_read(&cmd->root_lock); | 958 | down_read(&cmd->root_lock); |
923 | r = __load_mappings(cmd, policy_name, fn, context); | 959 | r = __load_mappings(cmd, policy, fn, context); |
924 | up_read(&cmd->root_lock); | 960 | up_read(&cmd->root_lock); |
925 | 961 | ||
926 | return r; | 962 | return r; |
@@ -979,7 +1015,7 @@ static int __dirty(struct dm_cache_metadata *cmd, dm_cblock_t cblock, bool dirty | |||
979 | /* nothing to be done */ | 1015 | /* nothing to be done */ |
980 | return 0; | 1016 | return 0; |
981 | 1017 | ||
982 | value = pack_value(oblock, flags | (dirty ? M_DIRTY : 0)); | 1018 | value = pack_value(oblock, (flags & ~M_DIRTY) | (dirty ? M_DIRTY : 0)); |
983 | __dm_bless_for_disk(&value); | 1019 | __dm_bless_for_disk(&value); |
984 | 1020 | ||
985 | r = dm_array_set_value(&cmd->info, cmd->root, from_cblock(cblock), | 1021 | r = dm_array_set_value(&cmd->info, cmd->root, from_cblock(cblock), |
@@ -1070,13 +1106,15 @@ static int begin_hints(struct dm_cache_metadata *cmd, struct dm_cache_policy *po | |||
1070 | __le32 value; | 1106 | __le32 value; |
1071 | size_t hint_size; | 1107 | size_t hint_size; |
1072 | const char *policy_name = dm_cache_policy_get_name(policy); | 1108 | const char *policy_name = dm_cache_policy_get_name(policy); |
1109 | const unsigned *policy_version = dm_cache_policy_get_version(policy); | ||
1073 | 1110 | ||
1074 | if (!policy_name[0] || | 1111 | if (!policy_name[0] || |
1075 | (strlen(policy_name) > sizeof(cmd->policy_name) - 1)) | 1112 | (strlen(policy_name) > sizeof(cmd->policy_name) - 1)) |
1076 | return -EINVAL; | 1113 | return -EINVAL; |
1077 | 1114 | ||
1078 | if (strcmp(cmd->policy_name, policy_name)) { | 1115 | if (!policy_unchanged(cmd, policy)) { |
1079 | strncpy(cmd->policy_name, policy_name, sizeof(cmd->policy_name)); | 1116 | strncpy(cmd->policy_name, policy_name, sizeof(cmd->policy_name)); |
1117 | memcpy(cmd->policy_version, policy_version, sizeof(cmd->policy_version)); | ||
1080 | 1118 | ||
1081 | hint_size = dm_cache_policy_get_hint_size(policy); | 1119 | hint_size = dm_cache_policy_get_hint_size(policy); |
1082 | if (!hint_size) | 1120 | if (!hint_size) |
diff --git a/drivers/md/dm-cache-metadata.h b/drivers/md/dm-cache-metadata.h index 135864ea0eee..f45cef21f3d0 100644 --- a/drivers/md/dm-cache-metadata.h +++ b/drivers/md/dm-cache-metadata.h | |||
@@ -89,7 +89,7 @@ typedef int (*load_mapping_fn)(void *context, dm_oblock_t oblock, | |||
89 | dm_cblock_t cblock, bool dirty, | 89 | dm_cblock_t cblock, bool dirty, |
90 | uint32_t hint, bool hint_valid); | 90 | uint32_t hint, bool hint_valid); |
91 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, | 91 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, |
92 | const char *policy_name, | 92 | struct dm_cache_policy *policy, |
93 | load_mapping_fn fn, | 93 | load_mapping_fn fn, |
94 | void *context); | 94 | void *context); |
95 | 95 | ||
diff --git a/drivers/md/dm-cache-policy-cleaner.c b/drivers/md/dm-cache-policy-cleaner.c index cc05d70b3cb8..b04d1f904d07 100644 --- a/drivers/md/dm-cache-policy-cleaner.c +++ b/drivers/md/dm-cache-policy-cleaner.c | |||
@@ -17,7 +17,6 @@ | |||
17 | /*----------------------------------------------------------------*/ | 17 | /*----------------------------------------------------------------*/ |
18 | 18 | ||
19 | #define DM_MSG_PREFIX "cache cleaner" | 19 | #define DM_MSG_PREFIX "cache cleaner" |
20 | #define CLEANER_VERSION "1.0.0" | ||
21 | 20 | ||
22 | /* Cache entry struct. */ | 21 | /* Cache entry struct. */ |
23 | struct wb_cache_entry { | 22 | struct wb_cache_entry { |
@@ -434,6 +433,7 @@ static struct dm_cache_policy *wb_create(dm_cblock_t cache_size, | |||
434 | 433 | ||
435 | static struct dm_cache_policy_type wb_policy_type = { | 434 | static struct dm_cache_policy_type wb_policy_type = { |
436 | .name = "cleaner", | 435 | .name = "cleaner", |
436 | .version = {1, 0, 0}, | ||
437 | .hint_size = 0, | 437 | .hint_size = 0, |
438 | .owner = THIS_MODULE, | 438 | .owner = THIS_MODULE, |
439 | .create = wb_create | 439 | .create = wb_create |
@@ -446,7 +446,10 @@ static int __init wb_init(void) | |||
446 | if (r < 0) | 446 | if (r < 0) |
447 | DMERR("register failed %d", r); | 447 | DMERR("register failed %d", r); |
448 | else | 448 | else |
449 | DMINFO("version " CLEANER_VERSION " loaded"); | 449 | DMINFO("version %u.%u.%u loaded", |
450 | wb_policy_type.version[0], | ||
451 | wb_policy_type.version[1], | ||
452 | wb_policy_type.version[2]); | ||
450 | 453 | ||
451 | return r; | 454 | return r; |
452 | } | 455 | } |
diff --git a/drivers/md/dm-cache-policy-internal.h b/drivers/md/dm-cache-policy-internal.h index 52a75beeced5..0928abdc49f0 100644 --- a/drivers/md/dm-cache-policy-internal.h +++ b/drivers/md/dm-cache-policy-internal.h | |||
@@ -117,6 +117,8 @@ void dm_cache_policy_destroy(struct dm_cache_policy *p); | |||
117 | */ | 117 | */ |
118 | const char *dm_cache_policy_get_name(struct dm_cache_policy *p); | 118 | const char *dm_cache_policy_get_name(struct dm_cache_policy *p); |
119 | 119 | ||
120 | const unsigned *dm_cache_policy_get_version(struct dm_cache_policy *p); | ||
121 | |||
120 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p); | 122 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p); |
121 | 123 | ||
122 | /*----------------------------------------------------------------*/ | 124 | /*----------------------------------------------------------------*/ |
diff --git a/drivers/md/dm-cache-policy-mq.c b/drivers/md/dm-cache-policy-mq.c index 964153255076..dc112a7137fe 100644 --- a/drivers/md/dm-cache-policy-mq.c +++ b/drivers/md/dm-cache-policy-mq.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/vmalloc.h> | 14 | #include <linux/vmalloc.h> |
15 | 15 | ||
16 | #define DM_MSG_PREFIX "cache-policy-mq" | 16 | #define DM_MSG_PREFIX "cache-policy-mq" |
17 | #define MQ_VERSION "1.0.0" | ||
18 | 17 | ||
19 | static struct kmem_cache *mq_entry_cache; | 18 | static struct kmem_cache *mq_entry_cache; |
20 | 19 | ||
@@ -1133,6 +1132,7 @@ bad_cache_alloc: | |||
1133 | 1132 | ||
1134 | static struct dm_cache_policy_type mq_policy_type = { | 1133 | static struct dm_cache_policy_type mq_policy_type = { |
1135 | .name = "mq", | 1134 | .name = "mq", |
1135 | .version = {1, 0, 0}, | ||
1136 | .hint_size = 4, | 1136 | .hint_size = 4, |
1137 | .owner = THIS_MODULE, | 1137 | .owner = THIS_MODULE, |
1138 | .create = mq_create | 1138 | .create = mq_create |
@@ -1140,6 +1140,7 @@ static struct dm_cache_policy_type mq_policy_type = { | |||
1140 | 1140 | ||
1141 | static struct dm_cache_policy_type default_policy_type = { | 1141 | static struct dm_cache_policy_type default_policy_type = { |
1142 | .name = "default", | 1142 | .name = "default", |
1143 | .version = {1, 0, 0}, | ||
1143 | .hint_size = 4, | 1144 | .hint_size = 4, |
1144 | .owner = THIS_MODULE, | 1145 | .owner = THIS_MODULE, |
1145 | .create = mq_create | 1146 | .create = mq_create |
@@ -1164,7 +1165,10 @@ static int __init mq_init(void) | |||
1164 | 1165 | ||
1165 | r = dm_cache_policy_register(&default_policy_type); | 1166 | r = dm_cache_policy_register(&default_policy_type); |
1166 | if (!r) { | 1167 | if (!r) { |
1167 | DMINFO("version " MQ_VERSION " loaded"); | 1168 | DMINFO("version %u.%u.%u loaded", |
1169 | mq_policy_type.version[0], | ||
1170 | mq_policy_type.version[1], | ||
1171 | mq_policy_type.version[2]); | ||
1168 | return 0; | 1172 | return 0; |
1169 | } | 1173 | } |
1170 | 1174 | ||
diff --git a/drivers/md/dm-cache-policy.c b/drivers/md/dm-cache-policy.c index 2cbf5fdaac52..21c03c570c06 100644 --- a/drivers/md/dm-cache-policy.c +++ b/drivers/md/dm-cache-policy.c | |||
@@ -150,6 +150,14 @@ const char *dm_cache_policy_get_name(struct dm_cache_policy *p) | |||
150 | } | 150 | } |
151 | EXPORT_SYMBOL_GPL(dm_cache_policy_get_name); | 151 | EXPORT_SYMBOL_GPL(dm_cache_policy_get_name); |
152 | 152 | ||
153 | const unsigned *dm_cache_policy_get_version(struct dm_cache_policy *p) | ||
154 | { | ||
155 | struct dm_cache_policy_type *t = p->private; | ||
156 | |||
157 | return t->version; | ||
158 | } | ||
159 | EXPORT_SYMBOL_GPL(dm_cache_policy_get_version); | ||
160 | |||
153 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p) | 161 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p) |
154 | { | 162 | { |
155 | struct dm_cache_policy_type *t = p->private; | 163 | struct dm_cache_policy_type *t = p->private; |
diff --git a/drivers/md/dm-cache-policy.h b/drivers/md/dm-cache-policy.h index f0f51b260544..558bdfdabf5f 100644 --- a/drivers/md/dm-cache-policy.h +++ b/drivers/md/dm-cache-policy.h | |||
@@ -196,6 +196,7 @@ struct dm_cache_policy { | |||
196 | * We maintain a little register of the different policy types. | 196 | * We maintain a little register of the different policy types. |
197 | */ | 197 | */ |
198 | #define CACHE_POLICY_NAME_SIZE 16 | 198 | #define CACHE_POLICY_NAME_SIZE 16 |
199 | #define CACHE_POLICY_VERSION_SIZE 3 | ||
199 | 200 | ||
200 | struct dm_cache_policy_type { | 201 | struct dm_cache_policy_type { |
201 | /* For use by the register code only. */ | 202 | /* For use by the register code only. */ |
@@ -206,6 +207,7 @@ struct dm_cache_policy_type { | |||
206 | * what gets passed on the target line to select your policy. | 207 | * what gets passed on the target line to select your policy. |
207 | */ | 208 | */ |
208 | char name[CACHE_POLICY_NAME_SIZE]; | 209 | char name[CACHE_POLICY_NAME_SIZE]; |
210 | unsigned version[CACHE_POLICY_VERSION_SIZE]; | ||
209 | 211 | ||
210 | /* | 212 | /* |
211 | * Policies may store a hint for each each cache block. | 213 | * Policies may store a hint for each each cache block. |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 0f4e84b15c30..66120bd46d15 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -142,6 +142,7 @@ struct cache { | |||
142 | spinlock_t lock; | 142 | spinlock_t lock; |
143 | struct bio_list deferred_bios; | 143 | struct bio_list deferred_bios; |
144 | struct bio_list deferred_flush_bios; | 144 | struct bio_list deferred_flush_bios; |
145 | struct bio_list deferred_writethrough_bios; | ||
145 | struct list_head quiesced_migrations; | 146 | struct list_head quiesced_migrations; |
146 | struct list_head completed_migrations; | 147 | struct list_head completed_migrations; |
147 | struct list_head need_commit_migrations; | 148 | struct list_head need_commit_migrations; |
@@ -158,7 +159,7 @@ struct cache { | |||
158 | /* | 159 | /* |
159 | * origin_blocks entries, discarded if set. | 160 | * origin_blocks entries, discarded if set. |
160 | */ | 161 | */ |
161 | sector_t discard_block_size; /* a power of 2 times sectors per block */ | 162 | uint32_t discard_block_size; /* a power of 2 times sectors per block */ |
162 | dm_dblock_t discard_nr_blocks; | 163 | dm_dblock_t discard_nr_blocks; |
163 | unsigned long *discard_bitset; | 164 | unsigned long *discard_bitset; |
164 | 165 | ||
@@ -199,6 +200,11 @@ struct per_bio_data { | |||
199 | bool tick:1; | 200 | bool tick:1; |
200 | unsigned req_nr:2; | 201 | unsigned req_nr:2; |
201 | struct dm_deferred_entry *all_io_entry; | 202 | struct dm_deferred_entry *all_io_entry; |
203 | |||
204 | /* writethrough fields */ | ||
205 | struct cache *cache; | ||
206 | dm_cblock_t cblock; | ||
207 | bio_end_io_t *saved_bi_end_io; | ||
202 | }; | 208 | }; |
203 | 209 | ||
204 | struct dm_cache_migration { | 210 | struct dm_cache_migration { |
@@ -412,17 +418,24 @@ static bool block_size_is_power_of_two(struct cache *cache) | |||
412 | return cache->sectors_per_block_shift >= 0; | 418 | return cache->sectors_per_block_shift >= 0; |
413 | } | 419 | } |
414 | 420 | ||
421 | static dm_block_t block_div(dm_block_t b, uint32_t n) | ||
422 | { | ||
423 | do_div(b, n); | ||
424 | |||
425 | return b; | ||
426 | } | ||
427 | |||
415 | static dm_dblock_t oblock_to_dblock(struct cache *cache, dm_oblock_t oblock) | 428 | static dm_dblock_t oblock_to_dblock(struct cache *cache, dm_oblock_t oblock) |
416 | { | 429 | { |
417 | sector_t discard_blocks = cache->discard_block_size; | 430 | uint32_t discard_blocks = cache->discard_block_size; |
418 | dm_block_t b = from_oblock(oblock); | 431 | dm_block_t b = from_oblock(oblock); |
419 | 432 | ||
420 | if (!block_size_is_power_of_two(cache)) | 433 | if (!block_size_is_power_of_two(cache)) |
421 | (void) sector_div(discard_blocks, cache->sectors_per_block); | 434 | discard_blocks = discard_blocks / cache->sectors_per_block; |
422 | else | 435 | else |
423 | discard_blocks >>= cache->sectors_per_block_shift; | 436 | discard_blocks >>= cache->sectors_per_block_shift; |
424 | 437 | ||
425 | (void) sector_div(b, discard_blocks); | 438 | b = block_div(b, discard_blocks); |
426 | 439 | ||
427 | return to_dblock(b); | 440 | return to_dblock(b); |
428 | } | 441 | } |
@@ -609,6 +622,56 @@ static void issue(struct cache *cache, struct bio *bio) | |||
609 | spin_unlock_irqrestore(&cache->lock, flags); | 622 | spin_unlock_irqrestore(&cache->lock, flags); |
610 | } | 623 | } |
611 | 624 | ||
625 | static void defer_writethrough_bio(struct cache *cache, struct bio *bio) | ||
626 | { | ||
627 | unsigned long flags; | ||
628 | |||
629 | spin_lock_irqsave(&cache->lock, flags); | ||
630 | bio_list_add(&cache->deferred_writethrough_bios, bio); | ||
631 | spin_unlock_irqrestore(&cache->lock, flags); | ||
632 | |||
633 | wake_worker(cache); | ||
634 | } | ||
635 | |||
636 | static void writethrough_endio(struct bio *bio, int err) | ||
637 | { | ||
638 | struct per_bio_data *pb = get_per_bio_data(bio); | ||
639 | bio->bi_end_io = pb->saved_bi_end_io; | ||
640 | |||
641 | if (err) { | ||
642 | bio_endio(bio, err); | ||
643 | return; | ||
644 | } | ||
645 | |||
646 | remap_to_cache(pb->cache, bio, pb->cblock); | ||
647 | |||
648 | /* | ||
649 | * We can't issue this bio directly, since we're in interrupt | ||
650 | * context. So it get's put on a bio list for processing by the | ||
651 | * worker thread. | ||
652 | */ | ||
653 | defer_writethrough_bio(pb->cache, bio); | ||
654 | } | ||
655 | |||
656 | /* | ||
657 | * When running in writethrough mode we need to send writes to clean blocks | ||
658 | * to both the cache and origin devices. In future we'd like to clone the | ||
659 | * bio and send them in parallel, but for now we're doing them in | ||
660 | * series as this is easier. | ||
661 | */ | ||
662 | static void remap_to_origin_then_cache(struct cache *cache, struct bio *bio, | ||
663 | dm_oblock_t oblock, dm_cblock_t cblock) | ||
664 | { | ||
665 | struct per_bio_data *pb = get_per_bio_data(bio); | ||
666 | |||
667 | pb->cache = cache; | ||
668 | pb->cblock = cblock; | ||
669 | pb->saved_bi_end_io = bio->bi_end_io; | ||
670 | bio->bi_end_io = writethrough_endio; | ||
671 | |||
672 | remap_to_origin_clear_discard(pb->cache, bio, oblock); | ||
673 | } | ||
674 | |||
612 | /*---------------------------------------------------------------- | 675 | /*---------------------------------------------------------------- |
613 | * Migration processing | 676 | * Migration processing |
614 | * | 677 | * |
@@ -1002,7 +1065,7 @@ static void process_discard_bio(struct cache *cache, struct bio *bio) | |||
1002 | dm_block_t end_block = bio->bi_sector + bio_sectors(bio); | 1065 | dm_block_t end_block = bio->bi_sector + bio_sectors(bio); |
1003 | dm_block_t b; | 1066 | dm_block_t b; |
1004 | 1067 | ||
1005 | (void) sector_div(end_block, cache->discard_block_size); | 1068 | end_block = block_div(end_block, cache->discard_block_size); |
1006 | 1069 | ||
1007 | for (b = start_block; b < end_block; b++) | 1070 | for (b = start_block; b < end_block; b++) |
1008 | set_discard(cache, to_dblock(b)); | 1071 | set_discard(cache, to_dblock(b)); |
@@ -1070,14 +1133,9 @@ static void process_bio(struct cache *cache, struct prealloc *structs, | |||
1070 | inc_hit_counter(cache, bio); | 1133 | inc_hit_counter(cache, bio); |
1071 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); | 1134 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); |
1072 | 1135 | ||
1073 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) { | 1136 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) |
1074 | /* | 1137 | remap_to_origin_then_cache(cache, bio, block, lookup_result.cblock); |
1075 | * No need to mark anything dirty in write through mode. | 1138 | else |
1076 | */ | ||
1077 | pb->req_nr == 0 ? | ||
1078 | remap_to_cache(cache, bio, lookup_result.cblock) : | ||
1079 | remap_to_origin_clear_discard(cache, bio, block); | ||
1080 | } else | ||
1081 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); | 1139 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); |
1082 | 1140 | ||
1083 | issue(cache, bio); | 1141 | issue(cache, bio); |
@@ -1086,17 +1144,8 @@ static void process_bio(struct cache *cache, struct prealloc *structs, | |||
1086 | case POLICY_MISS: | 1144 | case POLICY_MISS: |
1087 | inc_miss_counter(cache, bio); | 1145 | inc_miss_counter(cache, bio); |
1088 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); | 1146 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); |
1089 | 1147 | remap_to_origin_clear_discard(cache, bio, block); | |
1090 | if (pb->req_nr != 0) { | 1148 | issue(cache, bio); |
1091 | /* | ||
1092 | * This is a duplicate writethrough io that is no | ||
1093 | * longer needed because the block has been demoted. | ||
1094 | */ | ||
1095 | bio_endio(bio, 0); | ||
1096 | } else { | ||
1097 | remap_to_origin_clear_discard(cache, bio, block); | ||
1098 | issue(cache, bio); | ||
1099 | } | ||
1100 | break; | 1149 | break; |
1101 | 1150 | ||
1102 | case POLICY_NEW: | 1151 | case POLICY_NEW: |
@@ -1217,6 +1266,23 @@ static void process_deferred_flush_bios(struct cache *cache, bool submit_bios) | |||
1217 | submit_bios ? generic_make_request(bio) : bio_io_error(bio); | 1266 | submit_bios ? generic_make_request(bio) : bio_io_error(bio); |
1218 | } | 1267 | } |
1219 | 1268 | ||
1269 | static void process_deferred_writethrough_bios(struct cache *cache) | ||
1270 | { | ||
1271 | unsigned long flags; | ||
1272 | struct bio_list bios; | ||
1273 | struct bio *bio; | ||
1274 | |||
1275 | bio_list_init(&bios); | ||
1276 | |||
1277 | spin_lock_irqsave(&cache->lock, flags); | ||
1278 | bio_list_merge(&bios, &cache->deferred_writethrough_bios); | ||
1279 | bio_list_init(&cache->deferred_writethrough_bios); | ||
1280 | spin_unlock_irqrestore(&cache->lock, flags); | ||
1281 | |||
1282 | while ((bio = bio_list_pop(&bios))) | ||
1283 | generic_make_request(bio); | ||
1284 | } | ||
1285 | |||
1220 | static void writeback_some_dirty_blocks(struct cache *cache) | 1286 | static void writeback_some_dirty_blocks(struct cache *cache) |
1221 | { | 1287 | { |
1222 | int r = 0; | 1288 | int r = 0; |
@@ -1313,6 +1379,7 @@ static int more_work(struct cache *cache) | |||
1313 | else | 1379 | else |
1314 | return !bio_list_empty(&cache->deferred_bios) || | 1380 | return !bio_list_empty(&cache->deferred_bios) || |
1315 | !bio_list_empty(&cache->deferred_flush_bios) || | 1381 | !bio_list_empty(&cache->deferred_flush_bios) || |
1382 | !bio_list_empty(&cache->deferred_writethrough_bios) || | ||
1316 | !list_empty(&cache->quiesced_migrations) || | 1383 | !list_empty(&cache->quiesced_migrations) || |
1317 | !list_empty(&cache->completed_migrations) || | 1384 | !list_empty(&cache->completed_migrations) || |
1318 | !list_empty(&cache->need_commit_migrations); | 1385 | !list_empty(&cache->need_commit_migrations); |
@@ -1331,6 +1398,8 @@ static void do_worker(struct work_struct *ws) | |||
1331 | 1398 | ||
1332 | writeback_some_dirty_blocks(cache); | 1399 | writeback_some_dirty_blocks(cache); |
1333 | 1400 | ||
1401 | process_deferred_writethrough_bios(cache); | ||
1402 | |||
1334 | if (commit_if_needed(cache)) { | 1403 | if (commit_if_needed(cache)) { |
1335 | process_deferred_flush_bios(cache, false); | 1404 | process_deferred_flush_bios(cache, false); |
1336 | 1405 | ||
@@ -1756,8 +1825,11 @@ static int create_cache_policy(struct cache *cache, struct cache_args *ca, | |||
1756 | } | 1825 | } |
1757 | 1826 | ||
1758 | r = set_config_values(cache->policy, ca->policy_argc, ca->policy_argv); | 1827 | r = set_config_values(cache->policy, ca->policy_argc, ca->policy_argv); |
1759 | if (r) | 1828 | if (r) { |
1829 | *error = "Error setting cache policy's config values"; | ||
1760 | dm_cache_policy_destroy(cache->policy); | 1830 | dm_cache_policy_destroy(cache->policy); |
1831 | cache->policy = NULL; | ||
1832 | } | ||
1761 | 1833 | ||
1762 | return r; | 1834 | return r; |
1763 | } | 1835 | } |
@@ -1793,8 +1865,6 @@ static sector_t calculate_discard_block_size(sector_t cache_block_size, | |||
1793 | 1865 | ||
1794 | #define DEFAULT_MIGRATION_THRESHOLD (2048 * 100) | 1866 | #define DEFAULT_MIGRATION_THRESHOLD (2048 * 100) |
1795 | 1867 | ||
1796 | static unsigned cache_num_write_bios(struct dm_target *ti, struct bio *bio); | ||
1797 | |||
1798 | static int cache_create(struct cache_args *ca, struct cache **result) | 1868 | static int cache_create(struct cache_args *ca, struct cache **result) |
1799 | { | 1869 | { |
1800 | int r = 0; | 1870 | int r = 0; |
@@ -1821,9 +1891,6 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1821 | 1891 | ||
1822 | memcpy(&cache->features, &ca->features, sizeof(cache->features)); | 1892 | memcpy(&cache->features, &ca->features, sizeof(cache->features)); |
1823 | 1893 | ||
1824 | if (cache->features.write_through) | ||
1825 | ti->num_write_bios = cache_num_write_bios; | ||
1826 | |||
1827 | cache->callbacks.congested_fn = cache_is_congested; | 1894 | cache->callbacks.congested_fn = cache_is_congested; |
1828 | dm_table_add_target_callbacks(ti->table, &cache->callbacks); | 1895 | dm_table_add_target_callbacks(ti->table, &cache->callbacks); |
1829 | 1896 | ||
@@ -1835,7 +1902,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1835 | 1902 | ||
1836 | /* FIXME: factor out this whole section */ | 1903 | /* FIXME: factor out this whole section */ |
1837 | origin_blocks = cache->origin_sectors = ca->origin_sectors; | 1904 | origin_blocks = cache->origin_sectors = ca->origin_sectors; |
1838 | (void) sector_div(origin_blocks, ca->block_size); | 1905 | origin_blocks = block_div(origin_blocks, ca->block_size); |
1839 | cache->origin_blocks = to_oblock(origin_blocks); | 1906 | cache->origin_blocks = to_oblock(origin_blocks); |
1840 | 1907 | ||
1841 | cache->sectors_per_block = ca->block_size; | 1908 | cache->sectors_per_block = ca->block_size; |
@@ -1848,7 +1915,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1848 | dm_block_t cache_size = ca->cache_sectors; | 1915 | dm_block_t cache_size = ca->cache_sectors; |
1849 | 1916 | ||
1850 | cache->sectors_per_block_shift = -1; | 1917 | cache->sectors_per_block_shift = -1; |
1851 | (void) sector_div(cache_size, ca->block_size); | 1918 | cache_size = block_div(cache_size, ca->block_size); |
1852 | cache->cache_size = to_cblock(cache_size); | 1919 | cache->cache_size = to_cblock(cache_size); |
1853 | } else { | 1920 | } else { |
1854 | cache->sectors_per_block_shift = __ffs(ca->block_size); | 1921 | cache->sectors_per_block_shift = __ffs(ca->block_size); |
@@ -1873,6 +1940,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1873 | spin_lock_init(&cache->lock); | 1940 | spin_lock_init(&cache->lock); |
1874 | bio_list_init(&cache->deferred_bios); | 1941 | bio_list_init(&cache->deferred_bios); |
1875 | bio_list_init(&cache->deferred_flush_bios); | 1942 | bio_list_init(&cache->deferred_flush_bios); |
1943 | bio_list_init(&cache->deferred_writethrough_bios); | ||
1876 | INIT_LIST_HEAD(&cache->quiesced_migrations); | 1944 | INIT_LIST_HEAD(&cache->quiesced_migrations); |
1877 | INIT_LIST_HEAD(&cache->completed_migrations); | 1945 | INIT_LIST_HEAD(&cache->completed_migrations); |
1878 | INIT_LIST_HEAD(&cache->need_commit_migrations); | 1946 | INIT_LIST_HEAD(&cache->need_commit_migrations); |
@@ -2002,6 +2070,8 @@ static int cache_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2002 | goto out; | 2070 | goto out; |
2003 | 2071 | ||
2004 | r = cache_create(ca, &cache); | 2072 | r = cache_create(ca, &cache); |
2073 | if (r) | ||
2074 | goto out; | ||
2005 | 2075 | ||
2006 | r = copy_ctr_args(cache, argc - 3, (const char **)argv + 3); | 2076 | r = copy_ctr_args(cache, argc - 3, (const char **)argv + 3); |
2007 | if (r) { | 2077 | if (r) { |
@@ -2016,20 +2086,6 @@ out: | |||
2016 | return r; | 2086 | return r; |
2017 | } | 2087 | } |
2018 | 2088 | ||
2019 | static unsigned cache_num_write_bios(struct dm_target *ti, struct bio *bio) | ||
2020 | { | ||
2021 | int r; | ||
2022 | struct cache *cache = ti->private; | ||
2023 | dm_oblock_t block = get_bio_block(cache, bio); | ||
2024 | dm_cblock_t cblock; | ||
2025 | |||
2026 | r = policy_lookup(cache->policy, block, &cblock); | ||
2027 | if (r < 0) | ||
2028 | return 2; /* assume the worst */ | ||
2029 | |||
2030 | return (!r && !is_dirty(cache, cblock)) ? 2 : 1; | ||
2031 | } | ||
2032 | |||
2033 | static int cache_map(struct dm_target *ti, struct bio *bio) | 2089 | static int cache_map(struct dm_target *ti, struct bio *bio) |
2034 | { | 2090 | { |
2035 | struct cache *cache = ti->private; | 2091 | struct cache *cache = ti->private; |
@@ -2097,18 +2153,12 @@ static int cache_map(struct dm_target *ti, struct bio *bio) | |||
2097 | inc_hit_counter(cache, bio); | 2153 | inc_hit_counter(cache, bio); |
2098 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); | 2154 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); |
2099 | 2155 | ||
2100 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) { | 2156 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) |
2101 | /* | 2157 | remap_to_origin_then_cache(cache, bio, block, lookup_result.cblock); |
2102 | * No need to mark anything dirty in write through mode. | 2158 | else |
2103 | */ | ||
2104 | pb->req_nr == 0 ? | ||
2105 | remap_to_cache(cache, bio, lookup_result.cblock) : | ||
2106 | remap_to_origin_clear_discard(cache, bio, block); | ||
2107 | cell_defer(cache, cell, false); | ||
2108 | } else { | ||
2109 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); | 2159 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); |
2110 | cell_defer(cache, cell, false); | 2160 | |
2111 | } | 2161 | cell_defer(cache, cell, false); |
2112 | break; | 2162 | break; |
2113 | 2163 | ||
2114 | case POLICY_MISS: | 2164 | case POLICY_MISS: |
@@ -2319,8 +2369,7 @@ static int cache_preresume(struct dm_target *ti) | |||
2319 | } | 2369 | } |
2320 | 2370 | ||
2321 | if (!cache->loaded_mappings) { | 2371 | if (!cache->loaded_mappings) { |
2322 | r = dm_cache_load_mappings(cache->cmd, | 2372 | r = dm_cache_load_mappings(cache->cmd, cache->policy, |
2323 | dm_cache_policy_get_name(cache->policy), | ||
2324 | load_mapping, cache); | 2373 | load_mapping, cache); |
2325 | if (r) { | 2374 | if (r) { |
2326 | DMERR("could not load cache mappings"); | 2375 | DMERR("could not load cache mappings"); |
@@ -2535,7 +2584,7 @@ static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits) | |||
2535 | 2584 | ||
2536 | static struct target_type cache_target = { | 2585 | static struct target_type cache_target = { |
2537 | .name = "cache", | 2586 | .name = "cache", |
2538 | .version = {1, 0, 0}, | 2587 | .version = {1, 1, 0}, |
2539 | .module = THIS_MODULE, | 2588 | .module = THIS_MODULE, |
2540 | .ctr = cache_ctr, | 2589 | .ctr = cache_ctr, |
2541 | .dtr = cache_dtr, | 2590 | .dtr = cache_dtr, |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 009339d62828..004ad1652b73 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -1577,6 +1577,11 @@ static bool data_dev_supports_discard(struct pool_c *pt) | |||
1577 | return q && blk_queue_discard(q); | 1577 | return q && blk_queue_discard(q); |
1578 | } | 1578 | } |
1579 | 1579 | ||
1580 | static bool is_factor(sector_t block_size, uint32_t n) | ||
1581 | { | ||
1582 | return !sector_div(block_size, n); | ||
1583 | } | ||
1584 | |||
1580 | /* | 1585 | /* |
1581 | * If discard_passdown was enabled verify that the data device | 1586 | * If discard_passdown was enabled verify that the data device |
1582 | * supports discards. Disable discard_passdown if not. | 1587 | * supports discards. Disable discard_passdown if not. |
@@ -1602,7 +1607,7 @@ static void disable_passdown_if_not_supported(struct pool_c *pt) | |||
1602 | else if (data_limits->discard_granularity > block_size) | 1607 | else if (data_limits->discard_granularity > block_size) |
1603 | reason = "discard granularity larger than a block"; | 1608 | reason = "discard granularity larger than a block"; |
1604 | 1609 | ||
1605 | else if (block_size & (data_limits->discard_granularity - 1)) | 1610 | else if (!is_factor(block_size, data_limits->discard_granularity)) |
1606 | reason = "discard granularity not a factor of block size"; | 1611 | reason = "discard granularity not a factor of block size"; |
1607 | 1612 | ||
1608 | if (reason) { | 1613 | if (reason) { |
@@ -2544,7 +2549,7 @@ static struct target_type pool_target = { | |||
2544 | .name = "thin-pool", | 2549 | .name = "thin-pool", |
2545 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | | 2550 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | |
2546 | DM_TARGET_IMMUTABLE, | 2551 | DM_TARGET_IMMUTABLE, |
2547 | .version = {1, 6, 1}, | 2552 | .version = {1, 7, 0}, |
2548 | .module = THIS_MODULE, | 2553 | .module = THIS_MODULE, |
2549 | .ctr = pool_ctr, | 2554 | .ctr = pool_ctr, |
2550 | .dtr = pool_dtr, | 2555 | .dtr = pool_dtr, |
@@ -2831,7 +2836,7 @@ static int thin_iterate_devices(struct dm_target *ti, | |||
2831 | 2836 | ||
2832 | static struct target_type thin_target = { | 2837 | static struct target_type thin_target = { |
2833 | .name = "thin", | 2838 | .name = "thin", |
2834 | .version = {1, 7, 1}, | 2839 | .version = {1, 8, 0}, |
2835 | .module = THIS_MODULE, | 2840 | .module = THIS_MODULE, |
2836 | .ctr = thin_ctr, | 2841 | .ctr = thin_ctr, |
2837 | .dtr = thin_dtr, | 2842 | .dtr = thin_dtr, |
diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c index 6ad538375c3c..a746f1d21c66 100644 --- a/drivers/md/dm-verity.c +++ b/drivers/md/dm-verity.c | |||
@@ -93,6 +93,13 @@ struct dm_verity_io { | |||
93 | */ | 93 | */ |
94 | }; | 94 | }; |
95 | 95 | ||
96 | struct dm_verity_prefetch_work { | ||
97 | struct work_struct work; | ||
98 | struct dm_verity *v; | ||
99 | sector_t block; | ||
100 | unsigned n_blocks; | ||
101 | }; | ||
102 | |||
96 | static struct shash_desc *io_hash_desc(struct dm_verity *v, struct dm_verity_io *io) | 103 | static struct shash_desc *io_hash_desc(struct dm_verity *v, struct dm_verity_io *io) |
97 | { | 104 | { |
98 | return (struct shash_desc *)(io + 1); | 105 | return (struct shash_desc *)(io + 1); |
@@ -424,15 +431,18 @@ static void verity_end_io(struct bio *bio, int error) | |||
424 | * The root buffer is not prefetched, it is assumed that it will be cached | 431 | * The root buffer is not prefetched, it is assumed that it will be cached |
425 | * all the time. | 432 | * all the time. |
426 | */ | 433 | */ |
427 | static void verity_prefetch_io(struct dm_verity *v, struct dm_verity_io *io) | 434 | static void verity_prefetch_io(struct work_struct *work) |
428 | { | 435 | { |
436 | struct dm_verity_prefetch_work *pw = | ||
437 | container_of(work, struct dm_verity_prefetch_work, work); | ||
438 | struct dm_verity *v = pw->v; | ||
429 | int i; | 439 | int i; |
430 | 440 | ||
431 | for (i = v->levels - 2; i >= 0; i--) { | 441 | for (i = v->levels - 2; i >= 0; i--) { |
432 | sector_t hash_block_start; | 442 | sector_t hash_block_start; |
433 | sector_t hash_block_end; | 443 | sector_t hash_block_end; |
434 | verity_hash_at_level(v, io->block, i, &hash_block_start, NULL); | 444 | verity_hash_at_level(v, pw->block, i, &hash_block_start, NULL); |
435 | verity_hash_at_level(v, io->block + io->n_blocks - 1, i, &hash_block_end, NULL); | 445 | verity_hash_at_level(v, pw->block + pw->n_blocks - 1, i, &hash_block_end, NULL); |
436 | if (!i) { | 446 | if (!i) { |
437 | unsigned cluster = ACCESS_ONCE(dm_verity_prefetch_cluster); | 447 | unsigned cluster = ACCESS_ONCE(dm_verity_prefetch_cluster); |
438 | 448 | ||
@@ -452,6 +462,25 @@ no_prefetch_cluster: | |||
452 | dm_bufio_prefetch(v->bufio, hash_block_start, | 462 | dm_bufio_prefetch(v->bufio, hash_block_start, |
453 | hash_block_end - hash_block_start + 1); | 463 | hash_block_end - hash_block_start + 1); |
454 | } | 464 | } |
465 | |||
466 | kfree(pw); | ||
467 | } | ||
468 | |||
469 | static void verity_submit_prefetch(struct dm_verity *v, struct dm_verity_io *io) | ||
470 | { | ||
471 | struct dm_verity_prefetch_work *pw; | ||
472 | |||
473 | pw = kmalloc(sizeof(struct dm_verity_prefetch_work), | ||
474 | GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN); | ||
475 | |||
476 | if (!pw) | ||
477 | return; | ||
478 | |||
479 | INIT_WORK(&pw->work, verity_prefetch_io); | ||
480 | pw->v = v; | ||
481 | pw->block = io->block; | ||
482 | pw->n_blocks = io->n_blocks; | ||
483 | queue_work(v->verify_wq, &pw->work); | ||
455 | } | 484 | } |
456 | 485 | ||
457 | /* | 486 | /* |
@@ -498,7 +527,7 @@ static int verity_map(struct dm_target *ti, struct bio *bio) | |||
498 | memcpy(io->io_vec, bio_iovec(bio), | 527 | memcpy(io->io_vec, bio_iovec(bio), |
499 | io->io_vec_size * sizeof(struct bio_vec)); | 528 | io->io_vec_size * sizeof(struct bio_vec)); |
500 | 529 | ||
501 | verity_prefetch_io(v, io); | 530 | verity_submit_prefetch(v, io); |
502 | 531 | ||
503 | generic_make_request(bio); | 532 | generic_make_request(bio); |
504 | 533 | ||
@@ -858,7 +887,7 @@ bad: | |||
858 | 887 | ||
859 | static struct target_type verity_target = { | 888 | static struct target_type verity_target = { |
860 | .name = "verity", | 889 | .name = "verity", |
861 | .version = {1, 1, 1}, | 890 | .version = {1, 2, 0}, |
862 | .module = THIS_MODULE, | 891 | .module = THIS_MODULE, |
863 | .ctr = verity_ctr, | 892 | .ctr = verity_ctr, |
864 | .dtr = verity_dtr, | 893 | .dtr = verity_dtr, |
diff --git a/drivers/md/md.c b/drivers/md/md.c index fcb878f88796..aeceedfc530b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7663,10 +7663,8 @@ static int remove_and_add_spares(struct mddev *mddev) | |||
7663 | removed++; | 7663 | removed++; |
7664 | } | 7664 | } |
7665 | } | 7665 | } |
7666 | if (removed) | 7666 | if (removed && mddev->kobj.sd) |
7667 | sysfs_notify(&mddev->kobj, NULL, | 7667 | sysfs_notify(&mddev->kobj, NULL, "degraded"); |
7668 | "degraded"); | ||
7669 | |||
7670 | 7668 | ||
7671 | rdev_for_each(rdev, mddev) { | 7669 | rdev_for_each(rdev, mddev) { |
7672 | if (rdev->raid_disk >= 0 && | 7670 | if (rdev->raid_disk >= 0 && |
diff --git a/drivers/md/md.h b/drivers/md/md.h index eca59c3074ef..d90fb1a879e1 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -506,7 +506,7 @@ static inline char * mdname (struct mddev * mddev) | |||
506 | static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) | 506 | static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) |
507 | { | 507 | { |
508 | char nm[20]; | 508 | char nm[20]; |
509 | if (!test_bit(Replacement, &rdev->flags)) { | 509 | if (!test_bit(Replacement, &rdev->flags) && mddev->kobj.sd) { |
510 | sprintf(nm, "rd%d", rdev->raid_disk); | 510 | sprintf(nm, "rd%d", rdev->raid_disk); |
511 | return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); | 511 | return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); |
512 | } else | 512 | } else |
@@ -516,7 +516,7 @@ static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) | |||
516 | static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) | 516 | static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) |
517 | { | 517 | { |
518 | char nm[20]; | 518 | char nm[20]; |
519 | if (!test_bit(Replacement, &rdev->flags)) { | 519 | if (!test_bit(Replacement, &rdev->flags) && mddev->kobj.sd) { |
520 | sprintf(nm, "rd%d", rdev->raid_disk); | 520 | sprintf(nm, "rd%d", rdev->raid_disk); |
521 | sysfs_remove_link(&mddev->kobj, nm); | 521 | sysfs_remove_link(&mddev->kobj, nm); |
522 | } | 522 | } |
diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c index c4f28133ef82..b88757cd0d1d 100644 --- a/drivers/md/persistent-data/dm-btree-remove.c +++ b/drivers/md/persistent-data/dm-btree-remove.c | |||
@@ -139,15 +139,8 @@ struct child { | |||
139 | struct btree_node *n; | 139 | struct btree_node *n; |
140 | }; | 140 | }; |
141 | 141 | ||
142 | static struct dm_btree_value_type le64_type = { | 142 | static int init_child(struct dm_btree_info *info, struct dm_btree_value_type *vt, |
143 | .context = NULL, | 143 | struct btree_node *parent, |
144 | .size = sizeof(__le64), | ||
145 | .inc = NULL, | ||
146 | .dec = NULL, | ||
147 | .equal = NULL | ||
148 | }; | ||
149 | |||
150 | static int init_child(struct dm_btree_info *info, struct btree_node *parent, | ||
151 | unsigned index, struct child *result) | 144 | unsigned index, struct child *result) |
152 | { | 145 | { |
153 | int r, inc; | 146 | int r, inc; |
@@ -164,7 +157,7 @@ static int init_child(struct dm_btree_info *info, struct btree_node *parent, | |||
164 | result->n = dm_block_data(result->block); | 157 | result->n = dm_block_data(result->block); |
165 | 158 | ||
166 | if (inc) | 159 | if (inc) |
167 | inc_children(info->tm, result->n, &le64_type); | 160 | inc_children(info->tm, result->n, vt); |
168 | 161 | ||
169 | *((__le64 *) value_ptr(parent, index)) = | 162 | *((__le64 *) value_ptr(parent, index)) = |
170 | cpu_to_le64(dm_block_location(result->block)); | 163 | cpu_to_le64(dm_block_location(result->block)); |
@@ -236,7 +229,7 @@ static void __rebalance2(struct dm_btree_info *info, struct btree_node *parent, | |||
236 | } | 229 | } |
237 | 230 | ||
238 | static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, | 231 | static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, |
239 | unsigned left_index) | 232 | struct dm_btree_value_type *vt, unsigned left_index) |
240 | { | 233 | { |
241 | int r; | 234 | int r; |
242 | struct btree_node *parent; | 235 | struct btree_node *parent; |
@@ -244,11 +237,11 @@ static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, | |||
244 | 237 | ||
245 | parent = dm_block_data(shadow_current(s)); | 238 | parent = dm_block_data(shadow_current(s)); |
246 | 239 | ||
247 | r = init_child(info, parent, left_index, &left); | 240 | r = init_child(info, vt, parent, left_index, &left); |
248 | if (r) | 241 | if (r) |
249 | return r; | 242 | return r; |
250 | 243 | ||
251 | r = init_child(info, parent, left_index + 1, &right); | 244 | r = init_child(info, vt, parent, left_index + 1, &right); |
252 | if (r) { | 245 | if (r) { |
253 | exit_child(info, &left); | 246 | exit_child(info, &left); |
254 | return r; | 247 | return r; |
@@ -368,7 +361,7 @@ static void __rebalance3(struct dm_btree_info *info, struct btree_node *parent, | |||
368 | } | 361 | } |
369 | 362 | ||
370 | static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, | 363 | static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, |
371 | unsigned left_index) | 364 | struct dm_btree_value_type *vt, unsigned left_index) |
372 | { | 365 | { |
373 | int r; | 366 | int r; |
374 | struct btree_node *parent = dm_block_data(shadow_current(s)); | 367 | struct btree_node *parent = dm_block_data(shadow_current(s)); |
@@ -377,17 +370,17 @@ static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, | |||
377 | /* | 370 | /* |
378 | * FIXME: fill out an array? | 371 | * FIXME: fill out an array? |
379 | */ | 372 | */ |
380 | r = init_child(info, parent, left_index, &left); | 373 | r = init_child(info, vt, parent, left_index, &left); |
381 | if (r) | 374 | if (r) |
382 | return r; | 375 | return r; |
383 | 376 | ||
384 | r = init_child(info, parent, left_index + 1, ¢er); | 377 | r = init_child(info, vt, parent, left_index + 1, ¢er); |
385 | if (r) { | 378 | if (r) { |
386 | exit_child(info, &left); | 379 | exit_child(info, &left); |
387 | return r; | 380 | return r; |
388 | } | 381 | } |
389 | 382 | ||
390 | r = init_child(info, parent, left_index + 2, &right); | 383 | r = init_child(info, vt, parent, left_index + 2, &right); |
391 | if (r) { | 384 | if (r) { |
392 | exit_child(info, &left); | 385 | exit_child(info, &left); |
393 | exit_child(info, ¢er); | 386 | exit_child(info, ¢er); |
@@ -434,7 +427,8 @@ static int get_nr_entries(struct dm_transaction_manager *tm, | |||
434 | } | 427 | } |
435 | 428 | ||
436 | static int rebalance_children(struct shadow_spine *s, | 429 | static int rebalance_children(struct shadow_spine *s, |
437 | struct dm_btree_info *info, uint64_t key) | 430 | struct dm_btree_info *info, |
431 | struct dm_btree_value_type *vt, uint64_t key) | ||
438 | { | 432 | { |
439 | int i, r, has_left_sibling, has_right_sibling; | 433 | int i, r, has_left_sibling, has_right_sibling; |
440 | uint32_t child_entries; | 434 | uint32_t child_entries; |
@@ -472,13 +466,13 @@ static int rebalance_children(struct shadow_spine *s, | |||
472 | has_right_sibling = i < (le32_to_cpu(n->header.nr_entries) - 1); | 466 | has_right_sibling = i < (le32_to_cpu(n->header.nr_entries) - 1); |
473 | 467 | ||
474 | if (!has_left_sibling) | 468 | if (!has_left_sibling) |
475 | r = rebalance2(s, info, i); | 469 | r = rebalance2(s, info, vt, i); |
476 | 470 | ||
477 | else if (!has_right_sibling) | 471 | else if (!has_right_sibling) |
478 | r = rebalance2(s, info, i - 1); | 472 | r = rebalance2(s, info, vt, i - 1); |
479 | 473 | ||
480 | else | 474 | else |
481 | r = rebalance3(s, info, i - 1); | 475 | r = rebalance3(s, info, vt, i - 1); |
482 | 476 | ||
483 | return r; | 477 | return r; |
484 | } | 478 | } |
@@ -529,7 +523,7 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, | |||
529 | if (le32_to_cpu(n->header.flags) & LEAF_NODE) | 523 | if (le32_to_cpu(n->header.flags) & LEAF_NODE) |
530 | return do_leaf(n, key, index); | 524 | return do_leaf(n, key, index); |
531 | 525 | ||
532 | r = rebalance_children(s, info, key); | 526 | r = rebalance_children(s, info, vt, key); |
533 | if (r) | 527 | if (r) |
534 | break; | 528 | break; |
535 | 529 | ||
@@ -550,6 +544,14 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, | |||
550 | return r; | 544 | return r; |
551 | } | 545 | } |
552 | 546 | ||
547 | static struct dm_btree_value_type le64_type = { | ||
548 | .context = NULL, | ||
549 | .size = sizeof(__le64), | ||
550 | .inc = NULL, | ||
551 | .dec = NULL, | ||
552 | .equal = NULL | ||
553 | }; | ||
554 | |||
553 | int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, | 555 | int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, |
554 | uint64_t *keys, dm_block_t *new_root) | 556 | uint64_t *keys, dm_block_t *new_root) |
555 | { | 557 | { |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 3ee2912889e7..24909eb13fec 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -671,9 +671,11 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
671 | bi->bi_next = NULL; | 671 | bi->bi_next = NULL; |
672 | if (rrdev) | 672 | if (rrdev) |
673 | set_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags); | 673 | set_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags); |
674 | trace_block_bio_remap(bdev_get_queue(bi->bi_bdev), | 674 | |
675 | bi, disk_devt(conf->mddev->gendisk), | 675 | if (conf->mddev->gendisk) |
676 | sh->dev[i].sector); | 676 | trace_block_bio_remap(bdev_get_queue(bi->bi_bdev), |
677 | bi, disk_devt(conf->mddev->gendisk), | ||
678 | sh->dev[i].sector); | ||
677 | generic_make_request(bi); | 679 | generic_make_request(bi); |
678 | } | 680 | } |
679 | if (rrdev) { | 681 | if (rrdev) { |
@@ -701,9 +703,10 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
701 | rbi->bi_io_vec[0].bv_offset = 0; | 703 | rbi->bi_io_vec[0].bv_offset = 0; |
702 | rbi->bi_size = STRIPE_SIZE; | 704 | rbi->bi_size = STRIPE_SIZE; |
703 | rbi->bi_next = NULL; | 705 | rbi->bi_next = NULL; |
704 | trace_block_bio_remap(bdev_get_queue(rbi->bi_bdev), | 706 | if (conf->mddev->gendisk) |
705 | rbi, disk_devt(conf->mddev->gendisk), | 707 | trace_block_bio_remap(bdev_get_queue(rbi->bi_bdev), |
706 | sh->dev[i].sector); | 708 | rbi, disk_devt(conf->mddev->gendisk), |
709 | sh->dev[i].sector); | ||
707 | generic_make_request(rbi); | 710 | generic_make_request(rbi); |
708 | } | 711 | } |
709 | if (!rdev && !rrdev) { | 712 | if (!rdev && !rrdev) { |
@@ -2280,17 +2283,6 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2280 | int level = conf->level; | 2283 | int level = conf->level; |
2281 | 2284 | ||
2282 | if (rcw) { | 2285 | if (rcw) { |
2283 | /* if we are not expanding this is a proper write request, and | ||
2284 | * there will be bios with new data to be drained into the | ||
2285 | * stripe cache | ||
2286 | */ | ||
2287 | if (!expand) { | ||
2288 | sh->reconstruct_state = reconstruct_state_drain_run; | ||
2289 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2290 | } else | ||
2291 | sh->reconstruct_state = reconstruct_state_run; | ||
2292 | |||
2293 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2294 | 2286 | ||
2295 | for (i = disks; i--; ) { | 2287 | for (i = disks; i--; ) { |
2296 | struct r5dev *dev = &sh->dev[i]; | 2288 | struct r5dev *dev = &sh->dev[i]; |
@@ -2303,6 +2295,21 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2303 | s->locked++; | 2295 | s->locked++; |
2304 | } | 2296 | } |
2305 | } | 2297 | } |
2298 | /* if we are not expanding this is a proper write request, and | ||
2299 | * there will be bios with new data to be drained into the | ||
2300 | * stripe cache | ||
2301 | */ | ||
2302 | if (!expand) { | ||
2303 | if (!s->locked) | ||
2304 | /* False alarm, nothing to do */ | ||
2305 | return; | ||
2306 | sh->reconstruct_state = reconstruct_state_drain_run; | ||
2307 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2308 | } else | ||
2309 | sh->reconstruct_state = reconstruct_state_run; | ||
2310 | |||
2311 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2312 | |||
2306 | if (s->locked + conf->max_degraded == disks) | 2313 | if (s->locked + conf->max_degraded == disks) |
2307 | if (!test_and_set_bit(STRIPE_FULL_WRITE, &sh->state)) | 2314 | if (!test_and_set_bit(STRIPE_FULL_WRITE, &sh->state)) |
2308 | atomic_inc(&conf->pending_full_writes); | 2315 | atomic_inc(&conf->pending_full_writes); |
@@ -2311,11 +2318,6 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2311 | BUG_ON(!(test_bit(R5_UPTODATE, &sh->dev[pd_idx].flags) || | 2318 | BUG_ON(!(test_bit(R5_UPTODATE, &sh->dev[pd_idx].flags) || |
2312 | test_bit(R5_Wantcompute, &sh->dev[pd_idx].flags))); | 2319 | test_bit(R5_Wantcompute, &sh->dev[pd_idx].flags))); |
2313 | 2320 | ||
2314 | sh->reconstruct_state = reconstruct_state_prexor_drain_run; | ||
2315 | set_bit(STRIPE_OP_PREXOR, &s->ops_request); | ||
2316 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2317 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2318 | |||
2319 | for (i = disks; i--; ) { | 2321 | for (i = disks; i--; ) { |
2320 | struct r5dev *dev = &sh->dev[i]; | 2322 | struct r5dev *dev = &sh->dev[i]; |
2321 | if (i == pd_idx) | 2323 | if (i == pd_idx) |
@@ -2330,6 +2332,13 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2330 | s->locked++; | 2332 | s->locked++; |
2331 | } | 2333 | } |
2332 | } | 2334 | } |
2335 | if (!s->locked) | ||
2336 | /* False alarm - nothing to do */ | ||
2337 | return; | ||
2338 | sh->reconstruct_state = reconstruct_state_prexor_drain_run; | ||
2339 | set_bit(STRIPE_OP_PREXOR, &s->ops_request); | ||
2340 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2341 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2333 | } | 2342 | } |
2334 | 2343 | ||
2335 | /* keep the parity disk(s) locked while asynchronous operations | 2344 | /* keep the parity disk(s) locked while asynchronous operations |
@@ -2564,6 +2573,8 @@ handle_failed_sync(struct r5conf *conf, struct stripe_head *sh, | |||
2564 | int i; | 2573 | int i; |
2565 | 2574 | ||
2566 | clear_bit(STRIPE_SYNCING, &sh->state); | 2575 | clear_bit(STRIPE_SYNCING, &sh->state); |
2576 | if (test_and_clear_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags)) | ||
2577 | wake_up(&conf->wait_for_overlap); | ||
2567 | s->syncing = 0; | 2578 | s->syncing = 0; |
2568 | s->replacing = 0; | 2579 | s->replacing = 0; |
2569 | /* There is nothing more to do for sync/check/repair. | 2580 | /* There is nothing more to do for sync/check/repair. |
@@ -2737,6 +2748,7 @@ static void handle_stripe_clean_event(struct r5conf *conf, | |||
2737 | { | 2748 | { |
2738 | int i; | 2749 | int i; |
2739 | struct r5dev *dev; | 2750 | struct r5dev *dev; |
2751 | int discard_pending = 0; | ||
2740 | 2752 | ||
2741 | for (i = disks; i--; ) | 2753 | for (i = disks; i--; ) |
2742 | if (sh->dev[i].written) { | 2754 | if (sh->dev[i].written) { |
@@ -2765,9 +2777,23 @@ static void handle_stripe_clean_event(struct r5conf *conf, | |||
2765 | STRIPE_SECTORS, | 2777 | STRIPE_SECTORS, |
2766 | !test_bit(STRIPE_DEGRADED, &sh->state), | 2778 | !test_bit(STRIPE_DEGRADED, &sh->state), |
2767 | 0); | 2779 | 0); |
2768 | } | 2780 | } else if (test_bit(R5_Discard, &dev->flags)) |
2769 | } else if (test_bit(R5_Discard, &sh->dev[i].flags)) | 2781 | discard_pending = 1; |
2770 | clear_bit(R5_Discard, &sh->dev[i].flags); | 2782 | } |
2783 | if (!discard_pending && | ||
2784 | test_bit(R5_Discard, &sh->dev[sh->pd_idx].flags)) { | ||
2785 | clear_bit(R5_Discard, &sh->dev[sh->pd_idx].flags); | ||
2786 | clear_bit(R5_UPTODATE, &sh->dev[sh->pd_idx].flags); | ||
2787 | if (sh->qd_idx >= 0) { | ||
2788 | clear_bit(R5_Discard, &sh->dev[sh->qd_idx].flags); | ||
2789 | clear_bit(R5_UPTODATE, &sh->dev[sh->qd_idx].flags); | ||
2790 | } | ||
2791 | /* now that discard is done we can proceed with any sync */ | ||
2792 | clear_bit(STRIPE_DISCARD, &sh->state); | ||
2793 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state)) | ||
2794 | set_bit(STRIPE_HANDLE, &sh->state); | ||
2795 | |||
2796 | } | ||
2771 | 2797 | ||
2772 | if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) | 2798 | if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) |
2773 | if (atomic_dec_and_test(&conf->pending_full_writes)) | 2799 | if (atomic_dec_and_test(&conf->pending_full_writes)) |
@@ -2826,8 +2852,10 @@ static void handle_stripe_dirtying(struct r5conf *conf, | |||
2826 | set_bit(STRIPE_HANDLE, &sh->state); | 2852 | set_bit(STRIPE_HANDLE, &sh->state); |
2827 | if (rmw < rcw && rmw > 0) { | 2853 | if (rmw < rcw && rmw > 0) { |
2828 | /* prefer read-modify-write, but need to get some data */ | 2854 | /* prefer read-modify-write, but need to get some data */ |
2829 | blk_add_trace_msg(conf->mddev->queue, "raid5 rmw %llu %d", | 2855 | if (conf->mddev->queue) |
2830 | (unsigned long long)sh->sector, rmw); | 2856 | blk_add_trace_msg(conf->mddev->queue, |
2857 | "raid5 rmw %llu %d", | ||
2858 | (unsigned long long)sh->sector, rmw); | ||
2831 | for (i = disks; i--; ) { | 2859 | for (i = disks; i--; ) { |
2832 | struct r5dev *dev = &sh->dev[i]; | 2860 | struct r5dev *dev = &sh->dev[i]; |
2833 | if ((dev->towrite || i == sh->pd_idx) && | 2861 | if ((dev->towrite || i == sh->pd_idx) && |
@@ -2877,7 +2905,7 @@ static void handle_stripe_dirtying(struct r5conf *conf, | |||
2877 | } | 2905 | } |
2878 | } | 2906 | } |
2879 | } | 2907 | } |
2880 | if (rcw) | 2908 | if (rcw && conf->mddev->queue) |
2881 | blk_add_trace_msg(conf->mddev->queue, "raid5 rcw %llu %d %d %d", | 2909 | blk_add_trace_msg(conf->mddev->queue, "raid5 rcw %llu %d %d %d", |
2882 | (unsigned long long)sh->sector, | 2910 | (unsigned long long)sh->sector, |
2883 | rcw, qread, test_bit(STRIPE_DELAYED, &sh->state)); | 2911 | rcw, qread, test_bit(STRIPE_DELAYED, &sh->state)); |
@@ -3417,9 +3445,15 @@ static void handle_stripe(struct stripe_head *sh) | |||
3417 | return; | 3445 | return; |
3418 | } | 3446 | } |
3419 | 3447 | ||
3420 | if (test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { | 3448 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { |
3421 | set_bit(STRIPE_SYNCING, &sh->state); | 3449 | spin_lock(&sh->stripe_lock); |
3422 | clear_bit(STRIPE_INSYNC, &sh->state); | 3450 | /* Cannot process 'sync' concurrently with 'discard' */ |
3451 | if (!test_bit(STRIPE_DISCARD, &sh->state) && | ||
3452 | test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { | ||
3453 | set_bit(STRIPE_SYNCING, &sh->state); | ||
3454 | clear_bit(STRIPE_INSYNC, &sh->state); | ||
3455 | } | ||
3456 | spin_unlock(&sh->stripe_lock); | ||
3423 | } | 3457 | } |
3424 | clear_bit(STRIPE_DELAYED, &sh->state); | 3458 | clear_bit(STRIPE_DELAYED, &sh->state); |
3425 | 3459 | ||
@@ -3579,6 +3613,8 @@ static void handle_stripe(struct stripe_head *sh) | |||
3579 | test_bit(STRIPE_INSYNC, &sh->state)) { | 3613 | test_bit(STRIPE_INSYNC, &sh->state)) { |
3580 | md_done_sync(conf->mddev, STRIPE_SECTORS, 1); | 3614 | md_done_sync(conf->mddev, STRIPE_SECTORS, 1); |
3581 | clear_bit(STRIPE_SYNCING, &sh->state); | 3615 | clear_bit(STRIPE_SYNCING, &sh->state); |
3616 | if (test_and_clear_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags)) | ||
3617 | wake_up(&conf->wait_for_overlap); | ||
3582 | } | 3618 | } |
3583 | 3619 | ||
3584 | /* If the failed drives are just a ReadError, then we might need | 3620 | /* If the failed drives are just a ReadError, then we might need |
@@ -3982,9 +4018,10 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) | |||
3982 | atomic_inc(&conf->active_aligned_reads); | 4018 | atomic_inc(&conf->active_aligned_reads); |
3983 | spin_unlock_irq(&conf->device_lock); | 4019 | spin_unlock_irq(&conf->device_lock); |
3984 | 4020 | ||
3985 | trace_block_bio_remap(bdev_get_queue(align_bi->bi_bdev), | 4021 | if (mddev->gendisk) |
3986 | align_bi, disk_devt(mddev->gendisk), | 4022 | trace_block_bio_remap(bdev_get_queue(align_bi->bi_bdev), |
3987 | raid_bio->bi_sector); | 4023 | align_bi, disk_devt(mddev->gendisk), |
4024 | raid_bio->bi_sector); | ||
3988 | generic_make_request(align_bi); | 4025 | generic_make_request(align_bi); |
3989 | return 1; | 4026 | return 1; |
3990 | } else { | 4027 | } else { |
@@ -4078,7 +4115,8 @@ static void raid5_unplug(struct blk_plug_cb *blk_cb, bool from_schedule) | |||
4078 | } | 4115 | } |
4079 | spin_unlock_irq(&conf->device_lock); | 4116 | spin_unlock_irq(&conf->device_lock); |
4080 | } | 4117 | } |
4081 | trace_block_unplug(mddev->queue, cnt, !from_schedule); | 4118 | if (mddev->queue) |
4119 | trace_block_unplug(mddev->queue, cnt, !from_schedule); | ||
4082 | kfree(cb); | 4120 | kfree(cb); |
4083 | } | 4121 | } |
4084 | 4122 | ||
@@ -4141,6 +4179,13 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) | |||
4141 | sh = get_active_stripe(conf, logical_sector, 0, 0, 0); | 4179 | sh = get_active_stripe(conf, logical_sector, 0, 0, 0); |
4142 | prepare_to_wait(&conf->wait_for_overlap, &w, | 4180 | prepare_to_wait(&conf->wait_for_overlap, &w, |
4143 | TASK_UNINTERRUPTIBLE); | 4181 | TASK_UNINTERRUPTIBLE); |
4182 | set_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags); | ||
4183 | if (test_bit(STRIPE_SYNCING, &sh->state)) { | ||
4184 | release_stripe(sh); | ||
4185 | schedule(); | ||
4186 | goto again; | ||
4187 | } | ||
4188 | clear_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags); | ||
4144 | spin_lock_irq(&sh->stripe_lock); | 4189 | spin_lock_irq(&sh->stripe_lock); |
4145 | for (d = 0; d < conf->raid_disks; d++) { | 4190 | for (d = 0; d < conf->raid_disks; d++) { |
4146 | if (d == sh->pd_idx || d == sh->qd_idx) | 4191 | if (d == sh->pd_idx || d == sh->qd_idx) |
@@ -4153,6 +4198,7 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) | |||
4153 | goto again; | 4198 | goto again; |
4154 | } | 4199 | } |
4155 | } | 4200 | } |
4201 | set_bit(STRIPE_DISCARD, &sh->state); | ||
4156 | finish_wait(&conf->wait_for_overlap, &w); | 4202 | finish_wait(&conf->wait_for_overlap, &w); |
4157 | for (d = 0; d < conf->raid_disks; d++) { | 4203 | for (d = 0; d < conf->raid_disks; d++) { |
4158 | if (d == sh->pd_idx || d == sh->qd_idx) | 4204 | if (d == sh->pd_idx || d == sh->qd_idx) |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 18b2c4a8a1fd..b0b663b119a8 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
@@ -221,10 +221,6 @@ struct stripe_head { | |||
221 | struct stripe_operations { | 221 | struct stripe_operations { |
222 | int target, target2; | 222 | int target, target2; |
223 | enum sum_check_flags zero_sum_result; | 223 | enum sum_check_flags zero_sum_result; |
224 | #ifdef CONFIG_MULTICORE_RAID456 | ||
225 | unsigned long request; | ||
226 | wait_queue_head_t wait_for_ops; | ||
227 | #endif | ||
228 | } ops; | 224 | } ops; |
229 | struct r5dev { | 225 | struct r5dev { |
230 | /* rreq and rvec are used for the replacement device when | 226 | /* rreq and rvec are used for the replacement device when |
@@ -323,6 +319,7 @@ enum { | |||
323 | STRIPE_COMPUTE_RUN, | 319 | STRIPE_COMPUTE_RUN, |
324 | STRIPE_OPS_REQ_PENDING, | 320 | STRIPE_OPS_REQ_PENDING, |
325 | STRIPE_ON_UNPLUG_LIST, | 321 | STRIPE_ON_UNPLUG_LIST, |
322 | STRIPE_DISCARD, | ||
326 | }; | 323 | }; |
327 | 324 | ||
328 | /* | 325 | /* |
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index c689c04a4f52..2d2f0a43d36b 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c | |||
@@ -620,7 +620,7 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) | |||
620 | 620 | ||
621 | /* special soc specific control */ | 621 | /* special soc specific control */ |
622 | if (ctrl->mpp_get || ctrl->mpp_set) { | 622 | if (ctrl->mpp_get || ctrl->mpp_set) { |
623 | if (!ctrl->name || !ctrl->mpp_set || !ctrl->mpp_set) { | 623 | if (!ctrl->name || !ctrl->mpp_get || !ctrl->mpp_set) { |
624 | dev_err(&pdev->dev, "wrong soc control info\n"); | 624 | dev_err(&pdev->dev, "wrong soc control info\n"); |
625 | return -EINVAL; | 625 | return -EINVAL; |
626 | } | 626 | } |
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c index ac8d382a79bb..d611ecfcbf70 100644 --- a/drivers/pinctrl/pinconf.c +++ b/drivers/pinctrl/pinconf.c | |||
@@ -622,7 +622,7 @@ static const struct file_operations pinconf_dbg_pinname_fops = { | |||
622 | static int pinconf_dbg_state_print(struct seq_file *s, void *d) | 622 | static int pinconf_dbg_state_print(struct seq_file *s, void *d) |
623 | { | 623 | { |
624 | if (strlen(dbg_state_name)) | 624 | if (strlen(dbg_state_name)) |
625 | seq_printf(s, "%s\n", dbg_pinname); | 625 | seq_printf(s, "%s\n", dbg_state_name); |
626 | else | 626 | else |
627 | seq_printf(s, "No pin state set\n"); | 627 | seq_printf(s, "No pin state set\n"); |
628 | return 0; | 628 | return 0; |
diff --git a/drivers/pinctrl/pinconf.h b/drivers/pinctrl/pinconf.h index e3ed8cb072a5..bfda73d64eed 100644 --- a/drivers/pinctrl/pinconf.h +++ b/drivers/pinctrl/pinconf.h | |||
@@ -90,7 +90,7 @@ static inline void pinconf_init_device_debugfs(struct dentry *devroot, | |||
90 | * pin config. | 90 | * pin config. |
91 | */ | 91 | */ |
92 | 92 | ||
93 | #ifdef CONFIG_GENERIC_PINCONF | 93 | #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS) |
94 | 94 | ||
95 | void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, | 95 | void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, |
96 | struct seq_file *s, unsigned pin); | 96 | struct seq_file *s, unsigned pin); |
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index caecdd373061..c542a97c82f3 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c | |||
@@ -422,7 +422,7 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, | |||
422 | } | 422 | } |
423 | 423 | ||
424 | /* check if pin use AlternateFunction register */ | 424 | /* check if pin use AlternateFunction register */ |
425 | if ((af.alt_bit1 == UNUSED) && (af.alt_bit1 == UNUSED)) | 425 | if ((af.alt_bit1 == UNUSED) && (af.alt_bit2 == UNUSED)) |
426 | return mode; | 426 | return mode; |
427 | /* | 427 | /* |
428 | * if pin GPIOSEL bit is set and pin supports alternate function, | 428 | * if pin GPIOSEL bit is set and pin supports alternate function, |
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index 1a00658b3ea0..bd83c8b01cd1 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c | |||
@@ -194,6 +194,11 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin, | |||
194 | } | 194 | } |
195 | 195 | ||
196 | if (!gpio_range) { | 196 | if (!gpio_range) { |
197 | /* | ||
198 | * A pin should not be freed more times than allocated. | ||
199 | */ | ||
200 | if (WARN_ON(!desc->mux_usecount)) | ||
201 | return NULL; | ||
197 | desc->mux_usecount--; | 202 | desc->mux_usecount--; |
198 | if (desc->mux_usecount) | 203 | if (desc->mux_usecount) |
199 | return NULL; | 204 | return NULL; |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index 434ebc3a99dc..0a9f27e094ea 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -44,6 +44,7 @@ static DECLARE_COMPLETION(at91_rtc_updated); | |||
44 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; | 44 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; |
45 | static void __iomem *at91_rtc_regs; | 45 | static void __iomem *at91_rtc_regs; |
46 | static int irq; | 46 | static int irq; |
47 | static u32 at91_rtc_imr; | ||
47 | 48 | ||
48 | /* | 49 | /* |
49 | * Decode time/date into rtc_time structure | 50 | * Decode time/date into rtc_time structure |
@@ -108,9 +109,11 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
108 | cr = at91_rtc_read(AT91_RTC_CR); | 109 | cr = at91_rtc_read(AT91_RTC_CR); |
109 | at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); | 110 | at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); |
110 | 111 | ||
112 | at91_rtc_imr |= AT91_RTC_ACKUPD; | ||
111 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); | 113 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); |
112 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ | 114 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ |
113 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); | 115 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); |
116 | at91_rtc_imr &= ~AT91_RTC_ACKUPD; | ||
114 | 117 | ||
115 | at91_rtc_write(AT91_RTC_TIMR, | 118 | at91_rtc_write(AT91_RTC_TIMR, |
116 | bin2bcd(tm->tm_sec) << 0 | 119 | bin2bcd(tm->tm_sec) << 0 |
@@ -142,7 +145,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
142 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); | 145 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); |
143 | tm->tm_year = at91_alarm_year - 1900; | 146 | tm->tm_year = at91_alarm_year - 1900; |
144 | 147 | ||
145 | alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM) | 148 | alrm->enabled = (at91_rtc_imr & AT91_RTC_ALARM) |
146 | ? 1 : 0; | 149 | ? 1 : 0; |
147 | 150 | ||
148 | dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, | 151 | dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
@@ -168,6 +171,7 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
168 | tm.tm_sec = alrm->time.tm_sec; | 171 | tm.tm_sec = alrm->time.tm_sec; |
169 | 172 | ||
170 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 173 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); |
174 | at91_rtc_imr &= ~AT91_RTC_ALARM; | ||
171 | at91_rtc_write(AT91_RTC_TIMALR, | 175 | at91_rtc_write(AT91_RTC_TIMALR, |
172 | bin2bcd(tm.tm_sec) << 0 | 176 | bin2bcd(tm.tm_sec) << 0 |
173 | | bin2bcd(tm.tm_min) << 8 | 177 | | bin2bcd(tm.tm_min) << 8 |
@@ -180,6 +184,7 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
180 | 184 | ||
181 | if (alrm->enabled) { | 185 | if (alrm->enabled) { |
182 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 186 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
187 | at91_rtc_imr |= AT91_RTC_ALARM; | ||
183 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); | 188 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); |
184 | } | 189 | } |
185 | 190 | ||
@@ -196,9 +201,12 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
196 | 201 | ||
197 | if (enabled) { | 202 | if (enabled) { |
198 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 203 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
204 | at91_rtc_imr |= AT91_RTC_ALARM; | ||
199 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); | 205 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); |
200 | } else | 206 | } else { |
201 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 207 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); |
208 | at91_rtc_imr &= ~AT91_RTC_ALARM; | ||
209 | } | ||
202 | 210 | ||
203 | return 0; | 211 | return 0; |
204 | } | 212 | } |
@@ -207,12 +215,10 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
207 | */ | 215 | */ |
208 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) | 216 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) |
209 | { | 217 | { |
210 | unsigned long imr = at91_rtc_read(AT91_RTC_IMR); | ||
211 | |||
212 | seq_printf(seq, "update_IRQ\t: %s\n", | 218 | seq_printf(seq, "update_IRQ\t: %s\n", |
213 | (imr & AT91_RTC_ACKUPD) ? "yes" : "no"); | 219 | (at91_rtc_imr & AT91_RTC_ACKUPD) ? "yes" : "no"); |
214 | seq_printf(seq, "periodic_IRQ\t: %s\n", | 220 | seq_printf(seq, "periodic_IRQ\t: %s\n", |
215 | (imr & AT91_RTC_SECEV) ? "yes" : "no"); | 221 | (at91_rtc_imr & AT91_RTC_SECEV) ? "yes" : "no"); |
216 | 222 | ||
217 | return 0; | 223 | return 0; |
218 | } | 224 | } |
@@ -227,7 +233,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
227 | unsigned int rtsr; | 233 | unsigned int rtsr; |
228 | unsigned long events = 0; | 234 | unsigned long events = 0; |
229 | 235 | ||
230 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR); | 236 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_imr; |
231 | if (rtsr) { /* this interrupt is shared! Is it ours? */ | 237 | if (rtsr) { /* this interrupt is shared! Is it ours? */ |
232 | if (rtsr & AT91_RTC_ALARM) | 238 | if (rtsr & AT91_RTC_ALARM) |
233 | events |= (RTC_AF | RTC_IRQF); | 239 | events |= (RTC_AF | RTC_IRQF); |
@@ -291,6 +297,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
291 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 297 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
292 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 298 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
293 | AT91_RTC_CALEV); | 299 | AT91_RTC_CALEV); |
300 | at91_rtc_imr = 0; | ||
294 | 301 | ||
295 | ret = request_irq(irq, at91_rtc_interrupt, | 302 | ret = request_irq(irq, at91_rtc_interrupt, |
296 | IRQF_SHARED, | 303 | IRQF_SHARED, |
@@ -329,6 +336,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) | |||
329 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 336 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
330 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 337 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
331 | AT91_RTC_CALEV); | 338 | AT91_RTC_CALEV); |
339 | at91_rtc_imr = 0; | ||
332 | free_irq(irq, pdev); | 340 | free_irq(irq, pdev); |
333 | 341 | ||
334 | rtc_device_unregister(rtc); | 342 | rtc_device_unregister(rtc); |
@@ -341,31 +349,35 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) | |||
341 | 349 | ||
342 | /* AT91RM9200 RTC Power management control */ | 350 | /* AT91RM9200 RTC Power management control */ |
343 | 351 | ||
344 | static u32 at91_rtc_imr; | 352 | static u32 at91_rtc_bkpimr; |
353 | |||
345 | 354 | ||
346 | static int at91_rtc_suspend(struct device *dev) | 355 | static int at91_rtc_suspend(struct device *dev) |
347 | { | 356 | { |
348 | /* this IRQ is shared with DBGU and other hardware which isn't | 357 | /* this IRQ is shared with DBGU and other hardware which isn't |
349 | * necessarily doing PM like we are... | 358 | * necessarily doing PM like we are... |
350 | */ | 359 | */ |
351 | at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR) | 360 | at91_rtc_bkpimr = at91_rtc_imr & (AT91_RTC_ALARM|AT91_RTC_SECEV); |
352 | & (AT91_RTC_ALARM|AT91_RTC_SECEV); | 361 | if (at91_rtc_bkpimr) { |
353 | if (at91_rtc_imr) { | 362 | if (device_may_wakeup(dev)) { |
354 | if (device_may_wakeup(dev)) | ||
355 | enable_irq_wake(irq); | 363 | enable_irq_wake(irq); |
356 | else | 364 | } else { |
357 | at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr); | 365 | at91_rtc_write(AT91_RTC_IDR, at91_rtc_bkpimr); |
358 | } | 366 | at91_rtc_imr &= ~at91_rtc_bkpimr; |
367 | } | ||
368 | } | ||
359 | return 0; | 369 | return 0; |
360 | } | 370 | } |
361 | 371 | ||
362 | static int at91_rtc_resume(struct device *dev) | 372 | static int at91_rtc_resume(struct device *dev) |
363 | { | 373 | { |
364 | if (at91_rtc_imr) { | 374 | if (at91_rtc_bkpimr) { |
365 | if (device_may_wakeup(dev)) | 375 | if (device_may_wakeup(dev)) { |
366 | disable_irq_wake(irq); | 376 | disable_irq_wake(irq); |
367 | else | 377 | } else { |
368 | at91_rtc_write(AT91_RTC_IER, at91_rtc_imr); | 378 | at91_rtc_imr |= at91_rtc_bkpimr; |
379 | at91_rtc_write(AT91_RTC_IER, at91_rtc_bkpimr); | ||
380 | } | ||
369 | } | 381 | } |
370 | return 0; | 382 | return 0; |
371 | } | 383 | } |
diff --git a/drivers/rtc/rtc-at91rm9200.h b/drivers/rtc/rtc-at91rm9200.h index da1945e5f714..5f940b6844cb 100644 --- a/drivers/rtc/rtc-at91rm9200.h +++ b/drivers/rtc/rtc-at91rm9200.h | |||
@@ -64,7 +64,6 @@ | |||
64 | #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ | 64 | #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ |
65 | #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ | 65 | #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ |
66 | #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ | 66 | #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ |
67 | #define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */ | ||
68 | 67 | ||
69 | #define AT91_RTC_VER 0x2c /* Valid Entry Register */ | 68 | #define AT91_RTC_VER 0x2c /* Valid Entry Register */ |
70 | #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ | 69 | #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ |
diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c index 0dde688ca09b..969abbad7fe3 100644 --- a/drivers/rtc/rtc-da9052.c +++ b/drivers/rtc/rtc-da9052.c | |||
@@ -239,11 +239,9 @@ static int da9052_rtc_probe(struct platform_device *pdev) | |||
239 | 239 | ||
240 | rtc->da9052 = dev_get_drvdata(pdev->dev.parent); | 240 | rtc->da9052 = dev_get_drvdata(pdev->dev.parent); |
241 | platform_set_drvdata(pdev, rtc); | 241 | platform_set_drvdata(pdev, rtc); |
242 | rtc->irq = platform_get_irq_byname(pdev, "ALM"); | 242 | rtc->irq = DA9052_IRQ_ALARM; |
243 | ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, | 243 | ret = da9052_request_irq(rtc->da9052, rtc->irq, "ALM", |
244 | da9052_rtc_irq, | 244 | da9052_rtc_irq, rtc); |
245 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, | ||
246 | "ALM", rtc); | ||
247 | if (ret != 0) { | 245 | if (ret != 0) { |
248 | rtc_err(rtc->da9052, "irq registration failed: %d\n", ret); | 246 | rtc_err(rtc->da9052, "irq registration failed: %d\n", ret); |
249 | return ret; | 247 | return ret; |
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index db0cf7c8adde..a0fc7b9eea65 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
@@ -166,6 +166,7 @@ static int chap_server_compute_md5( | |||
166 | { | 166 | { |
167 | char *endptr; | 167 | char *endptr; |
168 | unsigned long id; | 168 | unsigned long id; |
169 | unsigned char id_as_uchar; | ||
169 | unsigned char digest[MD5_SIGNATURE_SIZE]; | 170 | unsigned char digest[MD5_SIGNATURE_SIZE]; |
170 | unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; | 171 | unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; |
171 | unsigned char identifier[10], *challenge = NULL; | 172 | unsigned char identifier[10], *challenge = NULL; |
@@ -355,7 +356,9 @@ static int chap_server_compute_md5( | |||
355 | goto out; | 356 | goto out; |
356 | } | 357 | } |
357 | 358 | ||
358 | sg_init_one(&sg, &id, 1); | 359 | /* To handle both endiannesses */ |
360 | id_as_uchar = id; | ||
361 | sg_init_one(&sg, &id_as_uchar, 1); | ||
359 | ret = crypto_hash_update(&desc, &sg, 1); | 362 | ret = crypto_hash_update(&desc, &sg, 1); |
360 | if (ret < 0) { | 363 | if (ret < 0) { |
361 | pr_err("crypto_hash_update() failed for id\n"); | 364 | pr_err("crypto_hash_update() failed for id\n"); |
diff --git a/drivers/target/target_core_file.h b/drivers/target/target_core_file.h index bc02b018ae46..37ffc5bd2399 100644 --- a/drivers/target/target_core_file.h +++ b/drivers/target/target_core_file.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #define FD_DEVICE_QUEUE_DEPTH 32 | 7 | #define FD_DEVICE_QUEUE_DEPTH 32 |
8 | #define FD_MAX_DEVICE_QUEUE_DEPTH 128 | 8 | #define FD_MAX_DEVICE_QUEUE_DEPTH 128 |
9 | #define FD_BLOCKSIZE 512 | 9 | #define FD_BLOCKSIZE 512 |
10 | #define FD_MAX_SECTORS 1024 | 10 | #define FD_MAX_SECTORS 2048 |
11 | 11 | ||
12 | #define RRF_EMULATE_CDB 0x01 | 12 | #define RRF_EMULATE_CDB 0x01 |
13 | #define RRF_GOT_LBA 0x02 | 13 | #define RRF_GOT_LBA 0x02 |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 82e78d72fdb6..e992b27aa090 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -883,7 +883,14 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
883 | pr_debug("PSCSI: i: %d page: %p len: %d off: %d\n", i, | 883 | pr_debug("PSCSI: i: %d page: %p len: %d off: %d\n", i, |
884 | page, len, off); | 884 | page, len, off); |
885 | 885 | ||
886 | while (len > 0 && data_len > 0) { | 886 | /* |
887 | * We only have one page of data in each sg element, | ||
888 | * we can not cross a page boundary. | ||
889 | */ | ||
890 | if (off + len > PAGE_SIZE) | ||
891 | goto fail; | ||
892 | |||
893 | if (len > 0 && data_len > 0) { | ||
887 | bytes = min_t(unsigned int, len, PAGE_SIZE - off); | 894 | bytes = min_t(unsigned int, len, PAGE_SIZE - off); |
888 | bytes = min(bytes, data_len); | 895 | bytes = min(bytes, data_len); |
889 | 896 | ||
@@ -940,9 +947,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
940 | bio = NULL; | 947 | bio = NULL; |
941 | } | 948 | } |
942 | 949 | ||
943 | len -= bytes; | ||
944 | data_len -= bytes; | 950 | data_len -= bytes; |
945 | off = 0; | ||
946 | } | 951 | } |
947 | } | 952 | } |
948 | 953 | ||
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 290230de2c53..60d4b5185f32 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -464,8 +464,11 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) | |||
464 | break; | 464 | break; |
465 | case SYNCHRONIZE_CACHE: | 465 | case SYNCHRONIZE_CACHE: |
466 | case SYNCHRONIZE_CACHE_16: | 466 | case SYNCHRONIZE_CACHE_16: |
467 | if (!ops->execute_sync_cache) | 467 | if (!ops->execute_sync_cache) { |
468 | return TCM_UNSUPPORTED_SCSI_OPCODE; | 468 | size = 0; |
469 | cmd->execute_cmd = sbc_emulate_noop; | ||
470 | break; | ||
471 | } | ||
469 | 472 | ||
470 | /* | 473 | /* |
471 | * Extract LBA and range to be flushed for emulated SYNCHRONIZE_CACHE | 474 | * Extract LBA and range to be flushed for emulated SYNCHRONIZE_CACHE |
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 9169d6a5d7e4..aac9d2727e3c 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
@@ -711,7 +711,8 @@ int core_tpg_register( | |||
711 | 711 | ||
712 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) { | 712 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) { |
713 | if (core_tpg_setup_virtual_lun0(se_tpg) < 0) { | 713 | if (core_tpg_setup_virtual_lun0(se_tpg) < 0) { |
714 | kfree(se_tpg); | 714 | array_free(se_tpg->tpg_lun_list, |
715 | TRANSPORT_MAX_LUNS_PER_TPG); | ||
715 | return -ENOMEM; | 716 | return -ENOMEM; |
716 | } | 717 | } |
717 | } | 718 | } |
diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index 7b0bfa0e7a9c..3078c403b42d 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c | |||
@@ -143,22 +143,18 @@ static int dove_thermal_probe(struct platform_device *pdev) | |||
143 | if (!priv) | 143 | if (!priv) |
144 | return -ENOMEM; | 144 | return -ENOMEM; |
145 | 145 | ||
146 | priv->sensor = devm_request_and_ioremap(&pdev->dev, res); | 146 | priv->sensor = devm_ioremap_resource(&pdev->dev, res); |
147 | if (!priv->sensor) { | 147 | if (IS_ERR(priv->sensor)) |
148 | dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); | 148 | return PTR_ERR(priv->sensor); |
149 | return -EADDRNOTAVAIL; | ||
150 | } | ||
151 | 149 | ||
152 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 150 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
153 | if (!res) { | 151 | if (!res) { |
154 | dev_err(&pdev->dev, "Failed to get platform resource\n"); | 152 | dev_err(&pdev->dev, "Failed to get platform resource\n"); |
155 | return -ENODEV; | 153 | return -ENODEV; |
156 | } | 154 | } |
157 | priv->control = devm_request_and_ioremap(&pdev->dev, res); | 155 | priv->control = devm_ioremap_resource(&pdev->dev, res); |
158 | if (!priv->control) { | 156 | if (IS_ERR(priv->control)) |
159 | dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); | 157 | return PTR_ERR(priv->control); |
160 | return -EADDRNOTAVAIL; | ||
161 | } | ||
162 | 158 | ||
163 | ret = dove_init_sensor(priv); | 159 | ret = dove_init_sensor(priv); |
164 | if (ret) { | 160 | if (ret) { |
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c index e04ebd8671ac..46568c078dee 100644 --- a/drivers/thermal/exynos_thermal.c +++ b/drivers/thermal/exynos_thermal.c | |||
@@ -476,7 +476,7 @@ static int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) | |||
476 | 476 | ||
477 | if (IS_ERR(th_zone->therm_dev)) { | 477 | if (IS_ERR(th_zone->therm_dev)) { |
478 | pr_err("Failed to register thermal zone device\n"); | 478 | pr_err("Failed to register thermal zone device\n"); |
479 | ret = -EINVAL; | 479 | ret = PTR_ERR(th_zone->therm_dev); |
480 | goto err_unregister; | 480 | goto err_unregister; |
481 | } | 481 | } |
482 | th_zone->mode = THERMAL_DEVICE_ENABLED; | 482 | th_zone->mode = THERMAL_DEVICE_ENABLED; |
diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c index 65cb4f09e8f6..e5500edb5285 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c | |||
@@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev) | |||
85 | if (!priv) | 85 | if (!priv) |
86 | return -ENOMEM; | 86 | return -ENOMEM; |
87 | 87 | ||
88 | priv->sensor = devm_request_and_ioremap(&pdev->dev, res); | 88 | priv->sensor = devm_ioremap_resource(&pdev->dev, res); |
89 | if (!priv->sensor) { | 89 | if (IS_ERR(priv->sensor)) |
90 | dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); | 90 | return PTR_ERR(priv->sensor); |
91 | return -EADDRNOTAVAIL; | ||
92 | } | ||
93 | 91 | ||
94 | thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0, | 92 | thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0, |
95 | priv, &ops, NULL, 0, 0); | 93 | priv, &ops, NULL, 0, 0); |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 28f091994013..2cc5b6115e3e 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
@@ -145,6 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
145 | struct device *dev = rcar_priv_to_dev(priv); | 145 | struct device *dev = rcar_priv_to_dev(priv); |
146 | int i; | 146 | int i; |
147 | int ctemp, old, new; | 147 | int ctemp, old, new; |
148 | int ret = -EINVAL; | ||
148 | 149 | ||
149 | mutex_lock(&priv->lock); | 150 | mutex_lock(&priv->lock); |
150 | 151 | ||
@@ -174,7 +175,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
174 | 175 | ||
175 | if (!ctemp) { | 176 | if (!ctemp) { |
176 | dev_err(dev, "thermal sensor was broken\n"); | 177 | dev_err(dev, "thermal sensor was broken\n"); |
177 | return -EINVAL; | 178 | goto err_out_unlock; |
178 | } | 179 | } |
179 | 180 | ||
180 | /* | 181 | /* |
@@ -192,10 +193,10 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
192 | dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp); | 193 | dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp); |
193 | 194 | ||
194 | priv->ctemp = ctemp; | 195 | priv->ctemp = ctemp; |
195 | 196 | ret = 0; | |
197 | err_out_unlock: | ||
196 | mutex_unlock(&priv->lock); | 198 | mutex_unlock(&priv->lock); |
197 | 199 | return ret; | |
198 | return 0; | ||
199 | } | 200 | } |
200 | 201 | ||
201 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, | 202 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, |
@@ -363,6 +364,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
363 | struct resource *res, *irq; | 364 | struct resource *res, *irq; |
364 | int mres = 0; | 365 | int mres = 0; |
365 | int i; | 366 | int i; |
367 | int ret = -ENODEV; | ||
366 | int idle = IDLE_INTERVAL; | 368 | int idle = IDLE_INTERVAL; |
367 | 369 | ||
368 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); | 370 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); |
@@ -399,11 +401,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
399 | /* | 401 | /* |
400 | * rcar_has_irq_support() will be enabled | 402 | * rcar_has_irq_support() will be enabled |
401 | */ | 403 | */ |
402 | common->base = devm_request_and_ioremap(dev, res); | 404 | common->base = devm_ioremap_resource(dev, res); |
403 | if (!common->base) { | 405 | if (IS_ERR(common->base)) |
404 | dev_err(dev, "Unable to ioremap thermal register\n"); | 406 | return PTR_ERR(common->base); |
405 | return -ENOMEM; | ||
406 | } | ||
407 | 407 | ||
408 | /* enable temperature comparation */ | 408 | /* enable temperature comparation */ |
409 | rcar_thermal_common_write(common, ENR, 0x00030303); | 409 | rcar_thermal_common_write(common, ENR, 0x00030303); |
@@ -422,11 +422,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
422 | return -ENOMEM; | 422 | return -ENOMEM; |
423 | } | 423 | } |
424 | 424 | ||
425 | priv->base = devm_request_and_ioremap(dev, res); | 425 | priv->base = devm_ioremap_resource(dev, res); |
426 | if (!priv->base) { | 426 | if (IS_ERR(priv->base)) |
427 | dev_err(dev, "Unable to ioremap priv register\n"); | 427 | return PTR_ERR(priv->base); |
428 | return -ENOMEM; | ||
429 | } | ||
430 | 428 | ||
431 | priv->common = common; | 429 | priv->common = common; |
432 | priv->id = i; | 430 | priv->id = i; |
@@ -441,6 +439,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
441 | idle); | 439 | idle); |
442 | if (IS_ERR(priv->zone)) { | 440 | if (IS_ERR(priv->zone)) { |
443 | dev_err(dev, "can't register thermal zone\n"); | 441 | dev_err(dev, "can't register thermal zone\n"); |
442 | ret = PTR_ERR(priv->zone); | ||
444 | goto error_unregister; | 443 | goto error_unregister; |
445 | } | 444 | } |
446 | 445 | ||
@@ -460,7 +459,7 @@ error_unregister: | |||
460 | rcar_thermal_for_each_priv(priv, common) | 459 | rcar_thermal_for_each_priv(priv, common) |
461 | thermal_zone_device_unregister(priv->zone); | 460 | thermal_zone_device_unregister(priv->zone); |
462 | 461 | ||
463 | return -ENODEV; | 462 | return ret; |
464 | } | 463 | } |
465 | 464 | ||
466 | static int rcar_thermal_remove(struct platform_device *pdev) | 465 | static int rcar_thermal_remove(struct platform_device *pdev) |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 8ac25adf31b4..387dc6c8ad25 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -593,7 +593,6 @@ static void acm_port_destruct(struct tty_port *port) | |||
593 | 593 | ||
594 | dev_dbg(&acm->control->dev, "%s\n", __func__); | 594 | dev_dbg(&acm->control->dev, "%s\n", __func__); |
595 | 595 | ||
596 | tty_unregister_device(acm_tty_driver, acm->minor); | ||
597 | acm_release_minor(acm); | 596 | acm_release_minor(acm); |
598 | usb_put_intf(acm->control); | 597 | usb_put_intf(acm->control); |
599 | kfree(acm->country_codes); | 598 | kfree(acm->country_codes); |
@@ -977,6 +976,8 @@ static int acm_probe(struct usb_interface *intf, | |||
977 | int num_rx_buf; | 976 | int num_rx_buf; |
978 | int i; | 977 | int i; |
979 | int combined_interfaces = 0; | 978 | int combined_interfaces = 0; |
979 | struct device *tty_dev; | ||
980 | int rv = -ENOMEM; | ||
980 | 981 | ||
981 | /* normal quirks */ | 982 | /* normal quirks */ |
982 | quirks = (unsigned long)id->driver_info; | 983 | quirks = (unsigned long)id->driver_info; |
@@ -1339,11 +1340,24 @@ skip_countries: | |||
1339 | usb_set_intfdata(data_interface, acm); | 1340 | usb_set_intfdata(data_interface, acm); |
1340 | 1341 | ||
1341 | usb_get_intf(control_interface); | 1342 | usb_get_intf(control_interface); |
1342 | tty_port_register_device(&acm->port, acm_tty_driver, minor, | 1343 | tty_dev = tty_port_register_device(&acm->port, acm_tty_driver, minor, |
1343 | &control_interface->dev); | 1344 | &control_interface->dev); |
1345 | if (IS_ERR(tty_dev)) { | ||
1346 | rv = PTR_ERR(tty_dev); | ||
1347 | goto alloc_fail8; | ||
1348 | } | ||
1344 | 1349 | ||
1345 | return 0; | 1350 | return 0; |
1351 | alloc_fail8: | ||
1352 | if (acm->country_codes) { | ||
1353 | device_remove_file(&acm->control->dev, | ||
1354 | &dev_attr_wCountryCodes); | ||
1355 | device_remove_file(&acm->control->dev, | ||
1356 | &dev_attr_iCountryCodeRelDate); | ||
1357 | } | ||
1358 | device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); | ||
1346 | alloc_fail7: | 1359 | alloc_fail7: |
1360 | usb_set_intfdata(intf, NULL); | ||
1347 | for (i = 0; i < ACM_NW; i++) | 1361 | for (i = 0; i < ACM_NW; i++) |
1348 | usb_free_urb(acm->wb[i].urb); | 1362 | usb_free_urb(acm->wb[i].urb); |
1349 | alloc_fail6: | 1363 | alloc_fail6: |
@@ -1359,7 +1373,7 @@ alloc_fail2: | |||
1359 | acm_release_minor(acm); | 1373 | acm_release_minor(acm); |
1360 | kfree(acm); | 1374 | kfree(acm); |
1361 | alloc_fail: | 1375 | alloc_fail: |
1362 | return -ENOMEM; | 1376 | return rv; |
1363 | } | 1377 | } |
1364 | 1378 | ||
1365 | static void stop_data_traffic(struct acm *acm) | 1379 | static void stop_data_traffic(struct acm *acm) |
@@ -1411,6 +1425,8 @@ static void acm_disconnect(struct usb_interface *intf) | |||
1411 | 1425 | ||
1412 | stop_data_traffic(acm); | 1426 | stop_data_traffic(acm); |
1413 | 1427 | ||
1428 | tty_unregister_device(acm_tty_driver, acm->minor); | ||
1429 | |||
1414 | usb_free_urb(acm->ctrlurb); | 1430 | usb_free_urb(acm->ctrlurb); |
1415 | for (i = 0; i < ACM_NW; i++) | 1431 | for (i = 0; i < ACM_NW; i++) |
1416 | usb_free_urb(acm->wb[i].urb); | 1432 | usb_free_urb(acm->wb[i].urb); |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 622b4a48e732..2b487d4797bd 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -173,6 +173,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
173 | struct hc_driver *driver; | 173 | struct hc_driver *driver; |
174 | struct usb_hcd *hcd; | 174 | struct usb_hcd *hcd; |
175 | int retval; | 175 | int retval; |
176 | int hcd_irq = 0; | ||
176 | 177 | ||
177 | if (usb_disabled()) | 178 | if (usb_disabled()) |
178 | return -ENODEV; | 179 | return -ENODEV; |
@@ -187,15 +188,19 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
187 | return -ENODEV; | 188 | return -ENODEV; |
188 | dev->current_state = PCI_D0; | 189 | dev->current_state = PCI_D0; |
189 | 190 | ||
190 | /* The xHCI driver supports MSI and MSI-X, | 191 | /* |
191 | * so don't fail if the BIOS doesn't provide a legacy IRQ. | 192 | * The xHCI driver has its own irq management |
193 | * make sure irq setup is not touched for xhci in generic hcd code | ||
192 | */ | 194 | */ |
193 | if (!dev->irq && (driver->flags & HCD_MASK) != HCD_USB3) { | 195 | if ((driver->flags & HCD_MASK) != HCD_USB3) { |
194 | dev_err(&dev->dev, | 196 | if (!dev->irq) { |
195 | "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", | 197 | dev_err(&dev->dev, |
196 | pci_name(dev)); | 198 | "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", |
197 | retval = -ENODEV; | 199 | pci_name(dev)); |
198 | goto disable_pci; | 200 | retval = -ENODEV; |
201 | goto disable_pci; | ||
202 | } | ||
203 | hcd_irq = dev->irq; | ||
199 | } | 204 | } |
200 | 205 | ||
201 | hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); | 206 | hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); |
@@ -245,7 +250,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
245 | 250 | ||
246 | pci_set_master(dev); | 251 | pci_set_master(dev); |
247 | 252 | ||
248 | retval = usb_add_hcd(hcd, dev->irq, IRQF_SHARED); | 253 | retval = usb_add_hcd(hcd, hcd_irq, IRQF_SHARED); |
249 | if (retval != 0) | 254 | if (retval != 0) |
250 | goto unmap_registers; | 255 | goto unmap_registers; |
251 | set_hs_companion(dev, hcd); | 256 | set_hs_companion(dev, hcd); |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 71beeb833558..cc9c49c57c80 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
@@ -447,14 +447,13 @@ static void rndis_response_complete(struct usb_ep *ep, struct usb_request *req) | |||
447 | static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req) | 447 | static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req) |
448 | { | 448 | { |
449 | struct f_rndis *rndis = req->context; | 449 | struct f_rndis *rndis = req->context; |
450 | struct usb_composite_dev *cdev = rndis->port.func.config->cdev; | ||
451 | int status; | 450 | int status; |
452 | 451 | ||
453 | /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ | 452 | /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ |
454 | // spin_lock(&dev->lock); | 453 | // spin_lock(&dev->lock); |
455 | status = rndis_msg_parser(rndis->config, (u8 *) req->buf); | 454 | status = rndis_msg_parser(rndis->config, (u8 *) req->buf); |
456 | if (status < 0) | 455 | if (status < 0) |
457 | ERROR(cdev, "RNDIS command error %d, %d/%d\n", | 456 | pr_err("RNDIS command error %d, %d/%d\n", |
458 | status, req->actual, req->length); | 457 | status, req->actual, req->length); |
459 | // spin_unlock(&dev->lock); | 458 | // spin_unlock(&dev->lock); |
460 | } | 459 | } |
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 3953dd4d7186..3b343b23e4b0 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -357,7 +357,7 @@ static int gfs_bind(struct usb_composite_dev *cdev) | |||
357 | goto error; | 357 | goto error; |
358 | gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id; | 358 | gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id; |
359 | 359 | ||
360 | for (i = func_num; --i; ) { | 360 | for (i = func_num; i--; ) { |
361 | ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); | 361 | ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); |
362 | if (unlikely(ret < 0)) { | 362 | if (unlikely(ret < 0)) { |
363 | while (++i < func_num) | 363 | while (++i < func_num) |
@@ -413,7 +413,7 @@ static int gfs_unbind(struct usb_composite_dev *cdev) | |||
413 | gether_cleanup(); | 413 | gether_cleanup(); |
414 | gfs_ether_setup = false; | 414 | gfs_ether_setup = false; |
415 | 415 | ||
416 | for (i = func_num; --i; ) | 416 | for (i = func_num; i--; ) |
417 | if (ffs_tab[i].ffs_data) | 417 | if (ffs_tab[i].ffs_data) |
418 | functionfs_unbind(ffs_tab[i].ffs_data); | 418 | functionfs_unbind(ffs_tab[i].ffs_data); |
419 | 419 | ||
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c index d226058e3b88..32524b631959 100644 --- a/drivers/usb/gadget/net2272.c +++ b/drivers/usb/gadget/net2272.c | |||
@@ -59,7 +59,7 @@ static const char * const ep_name[] = { | |||
59 | }; | 59 | }; |
60 | 60 | ||
61 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) | 61 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) |
62 | #ifdef CONFIG_USB_GADGET_NET2272_DMA | 62 | #ifdef CONFIG_USB_NET2272_DMA |
63 | /* | 63 | /* |
64 | * use_dma: the NET2272 can use an external DMA controller. | 64 | * use_dma: the NET2272 can use an external DMA controller. |
65 | * Note that since there is no generic DMA api, some functions, | 65 | * Note that since there is no generic DMA api, some functions, |
@@ -1495,6 +1495,13 @@ stop_activity(struct net2272 *dev, struct usb_gadget_driver *driver) | |||
1495 | for (i = 0; i < 4; ++i) | 1495 | for (i = 0; i < 4; ++i) |
1496 | net2272_dequeue_all(&dev->ep[i]); | 1496 | net2272_dequeue_all(&dev->ep[i]); |
1497 | 1497 | ||
1498 | /* report disconnect; the driver is already quiesced */ | ||
1499 | if (driver) { | ||
1500 | spin_unlock(&dev->lock); | ||
1501 | driver->disconnect(&dev->gadget); | ||
1502 | spin_lock(&dev->lock); | ||
1503 | } | ||
1504 | |||
1498 | net2272_usb_reinit(dev); | 1505 | net2272_usb_reinit(dev); |
1499 | } | 1506 | } |
1500 | 1507 | ||
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index a1b650e11339..3bd0f992fb49 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -1924,7 +1924,6 @@ static int net2280_start(struct usb_gadget *_gadget, | |||
1924 | err_func: | 1924 | err_func: |
1925 | device_remove_file (&dev->pdev->dev, &dev_attr_function); | 1925 | device_remove_file (&dev->pdev->dev, &dev_attr_function); |
1926 | err_unbind: | 1926 | err_unbind: |
1927 | driver->unbind (&dev->gadget); | ||
1928 | dev->gadget.dev.driver = NULL; | 1927 | dev->gadget.dev.driver = NULL; |
1929 | dev->driver = NULL; | 1928 | dev->driver = NULL; |
1930 | return retval; | 1929 | return retval; |
@@ -1946,6 +1945,13 @@ stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver) | |||
1946 | for (i = 0; i < 7; i++) | 1945 | for (i = 0; i < 7; i++) |
1947 | nuke (&dev->ep [i]); | 1946 | nuke (&dev->ep [i]); |
1948 | 1947 | ||
1948 | /* report disconnect; the driver is already quiesced */ | ||
1949 | if (driver) { | ||
1950 | spin_unlock(&dev->lock); | ||
1951 | driver->disconnect(&dev->gadget); | ||
1952 | spin_lock(&dev->lock); | ||
1953 | } | ||
1954 | |||
1949 | usb_reinit (dev); | 1955 | usb_reinit (dev); |
1950 | } | 1956 | } |
1951 | 1957 | ||
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index c5034d9c946b..b369292d4b90 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c | |||
@@ -136,7 +136,7 @@ static struct portmaster { | |||
136 | pr_debug(fmt, ##arg) | 136 | pr_debug(fmt, ##arg) |
137 | #endif /* pr_vdebug */ | 137 | #endif /* pr_vdebug */ |
138 | #else | 138 | #else |
139 | #ifndef pr_vdebig | 139 | #ifndef pr_vdebug |
140 | #define pr_vdebug(fmt, arg...) \ | 140 | #define pr_vdebug(fmt, arg...) \ |
141 | ({ if (0) pr_debug(fmt, ##arg); }) | 141 | ({ if (0) pr_debug(fmt, ##arg); }) |
142 | #endif /* pr_vdebug */ | 142 | #endif /* pr_vdebug */ |
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 2a9cd369f71c..f8f62c3ed65e 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
@@ -216,7 +216,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) | |||
216 | usb_gadget_disconnect(udc->gadget); | 216 | usb_gadget_disconnect(udc->gadget); |
217 | udc->driver->disconnect(udc->gadget); | 217 | udc->driver->disconnect(udc->gadget); |
218 | udc->driver->unbind(udc->gadget); | 218 | udc->driver->unbind(udc->gadget); |
219 | usb_gadget_udc_stop(udc->gadget, udc->driver); | 219 | usb_gadget_udc_stop(udc->gadget, NULL); |
220 | 220 | ||
221 | udc->driver = NULL; | 221 | udc->driver = NULL; |
222 | udc->dev.driver = NULL; | 222 | udc->dev.driver = NULL; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 5726cb144abf..416a6dce5e11 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -302,6 +302,7 @@ static void ehci_quiesce (struct ehci_hcd *ehci) | |||
302 | 302 | ||
303 | static void end_unlink_async(struct ehci_hcd *ehci); | 303 | static void end_unlink_async(struct ehci_hcd *ehci); |
304 | static void unlink_empty_async(struct ehci_hcd *ehci); | 304 | static void unlink_empty_async(struct ehci_hcd *ehci); |
305 | static void unlink_empty_async_suspended(struct ehci_hcd *ehci); | ||
305 | static void ehci_work(struct ehci_hcd *ehci); | 306 | static void ehci_work(struct ehci_hcd *ehci); |
306 | static void start_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); | 307 | static void start_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); |
307 | static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); | 308 | static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 4d3b294f203e..7d06e77f6c4f 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -328,7 +328,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
328 | ehci->rh_state = EHCI_RH_SUSPENDED; | 328 | ehci->rh_state = EHCI_RH_SUSPENDED; |
329 | 329 | ||
330 | end_unlink_async(ehci); | 330 | end_unlink_async(ehci); |
331 | unlink_empty_async(ehci); | 331 | unlink_empty_async_suspended(ehci); |
332 | ehci_handle_intr_unlinks(ehci); | 332 | ehci_handle_intr_unlinks(ehci); |
333 | end_free_itds(ehci); | 333 | end_free_itds(ehci); |
334 | 334 | ||
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 5464665f0b6a..23d136904285 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -1316,6 +1316,19 @@ static void unlink_empty_async(struct ehci_hcd *ehci) | |||
1316 | } | 1316 | } |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | /* The root hub is suspended; unlink all the async QHs */ | ||
1320 | static void unlink_empty_async_suspended(struct ehci_hcd *ehci) | ||
1321 | { | ||
1322 | struct ehci_qh *qh; | ||
1323 | |||
1324 | while (ehci->async->qh_next.qh) { | ||
1325 | qh = ehci->async->qh_next.qh; | ||
1326 | WARN_ON(!list_empty(&qh->qtd_list)); | ||
1327 | single_unlink_async(ehci, qh); | ||
1328 | } | ||
1329 | start_iaa_cycle(ehci, false); | ||
1330 | } | ||
1331 | |||
1319 | /* makes sure the async qh will become idle */ | 1332 | /* makes sure the async qh will become idle */ |
1320 | /* caller must own ehci->lock */ | 1333 | /* caller must own ehci->lock */ |
1321 | 1334 | ||
diff --git a/drivers/usb/host/ehci-timer.c b/drivers/usb/host/ehci-timer.c index 20dbdcbe9b0f..c3fa1305f830 100644 --- a/drivers/usb/host/ehci-timer.c +++ b/drivers/usb/host/ehci-timer.c | |||
@@ -304,7 +304,7 @@ static void ehci_iaa_watchdog(struct ehci_hcd *ehci) | |||
304 | * (a) SMP races against real IAA firing and retriggering, and | 304 | * (a) SMP races against real IAA firing and retriggering, and |
305 | * (b) clean HC shutdown, when IAA watchdog was pending. | 305 | * (b) clean HC shutdown, when IAA watchdog was pending. |
306 | */ | 306 | */ |
307 | if (ehci->async_iaa) { | 307 | if (1) { |
308 | u32 cmd, status; | 308 | u32 cmd, status; |
309 | 309 | ||
310 | /* If we get here, IAA is *REALLY* late. It's barely | 310 | /* If we get here, IAA is *REALLY* late. It's barely |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index f1f01a834ba7..849470b18831 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -350,7 +350,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) | |||
350 | * generate interrupts. Don't even try to enable MSI. | 350 | * generate interrupts. Don't even try to enable MSI. |
351 | */ | 351 | */ |
352 | if (xhci->quirks & XHCI_BROKEN_MSI) | 352 | if (xhci->quirks & XHCI_BROKEN_MSI) |
353 | return 0; | 353 | goto legacy_irq; |
354 | 354 | ||
355 | /* unregister the legacy interrupt */ | 355 | /* unregister the legacy interrupt */ |
356 | if (hcd->irq) | 356 | if (hcd->irq) |
@@ -371,6 +371,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) | |||
371 | return -EINVAL; | 371 | return -EINVAL; |
372 | } | 372 | } |
373 | 373 | ||
374 | legacy_irq: | ||
374 | /* fall back to legacy interrupt*/ | 375 | /* fall back to legacy interrupt*/ |
375 | ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, | 376 | ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, |
376 | hcd->irq_descr, hcd); | 377 | hcd->irq_descr, hcd); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index f791bd0aee6c..2c510e4a7d4c 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -206,8 +206,8 @@ struct xhci_op_regs { | |||
206 | /* bits 12:31 are reserved (and should be preserved on writes). */ | 206 | /* bits 12:31 are reserved (and should be preserved on writes). */ |
207 | 207 | ||
208 | /* IMAN - Interrupt Management Register */ | 208 | /* IMAN - Interrupt Management Register */ |
209 | #define IMAN_IP (1 << 1) | 209 | #define IMAN_IE (1 << 1) |
210 | #define IMAN_IE (1 << 0) | 210 | #define IMAN_IP (1 << 0) |
211 | 211 | ||
212 | /* USBSTS - USB status - status bitmasks */ | 212 | /* USBSTS - USB status - status bitmasks */ |
213 | /* HC not running - set to 1 when run/stop bit is cleared. */ | 213 | /* HC not running - set to 1 when run/stop bit is cleared. */ |
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 7c71769d71ff..41613a2b35e8 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -327,7 +327,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) | |||
327 | u8 devctl = musb_readb(mregs, MUSB_DEVCTL); | 327 | u8 devctl = musb_readb(mregs, MUSB_DEVCTL); |
328 | int err; | 328 | int err; |
329 | 329 | ||
330 | err = musb->int_usb & USB_INTR_VBUSERROR; | 330 | err = musb->int_usb & MUSB_INTR_VBUSERROR; |
331 | if (err) { | 331 | if (err) { |
332 | /* | 332 | /* |
333 | * The Mentor core doesn't debounce VBUS as needed | 333 | * The Mentor core doesn't debounce VBUS as needed |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index be18537c5f14..83eddedcd9be 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -141,7 +141,9 @@ static inline void map_dma_buffer(struct musb_request *request, | |||
141 | static inline void unmap_dma_buffer(struct musb_request *request, | 141 | static inline void unmap_dma_buffer(struct musb_request *request, |
142 | struct musb *musb) | 142 | struct musb *musb) |
143 | { | 143 | { |
144 | if (!is_buffer_mapped(request)) | 144 | struct musb_ep *musb_ep = request->ep; |
145 | |||
146 | if (!is_buffer_mapped(request) || !musb_ep->dma) | ||
145 | return; | 147 | return; |
146 | 148 | ||
147 | if (request->request.dma == DMA_ADDR_INVALID) { | 149 | if (request->request.dma == DMA_ADDR_INVALID) { |
@@ -195,7 +197,10 @@ __acquires(ep->musb->lock) | |||
195 | 197 | ||
196 | ep->busy = 1; | 198 | ep->busy = 1; |
197 | spin_unlock(&musb->lock); | 199 | spin_unlock(&musb->lock); |
198 | unmap_dma_buffer(req, musb); | 200 | |
201 | if (!dma_mapping_error(&musb->g.dev, request->dma)) | ||
202 | unmap_dma_buffer(req, musb); | ||
203 | |||
199 | if (request->status == 0) | 204 | if (request->status == 0) |
200 | dev_dbg(musb->controller, "%s done request %p, %d/%d\n", | 205 | dev_dbg(musb->controller, "%s done request %p, %d/%d\n", |
201 | ep->end_point.name, request, | 206 | ep->end_point.name, request, |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index cbd904b8fba5..4775f8209e55 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -62,7 +62,6 @@ static int is_irda(struct usb_serial *serial) | |||
62 | } | 62 | } |
63 | 63 | ||
64 | struct ark3116_private { | 64 | struct ark3116_private { |
65 | wait_queue_head_t delta_msr_wait; | ||
66 | struct async_icount icount; | 65 | struct async_icount icount; |
67 | int irda; /* 1 for irda device */ | 66 | int irda; /* 1 for irda device */ |
68 | 67 | ||
@@ -146,7 +145,6 @@ static int ark3116_port_probe(struct usb_serial_port *port) | |||
146 | if (!priv) | 145 | if (!priv) |
147 | return -ENOMEM; | 146 | return -ENOMEM; |
148 | 147 | ||
149 | init_waitqueue_head(&priv->delta_msr_wait); | ||
150 | mutex_init(&priv->hw_lock); | 148 | mutex_init(&priv->hw_lock); |
151 | spin_lock_init(&priv->status_lock); | 149 | spin_lock_init(&priv->status_lock); |
152 | 150 | ||
@@ -456,10 +454,14 @@ static int ark3116_ioctl(struct tty_struct *tty, | |||
456 | case TIOCMIWAIT: | 454 | case TIOCMIWAIT: |
457 | for (;;) { | 455 | for (;;) { |
458 | struct async_icount prev = priv->icount; | 456 | struct async_icount prev = priv->icount; |
459 | interruptible_sleep_on(&priv->delta_msr_wait); | 457 | interruptible_sleep_on(&port->delta_msr_wait); |
460 | /* see if a signal did it */ | 458 | /* see if a signal did it */ |
461 | if (signal_pending(current)) | 459 | if (signal_pending(current)) |
462 | return -ERESTARTSYS; | 460 | return -ERESTARTSYS; |
461 | |||
462 | if (port->serial->disconnected) | ||
463 | return -EIO; | ||
464 | |||
463 | if ((prev.rng == priv->icount.rng) && | 465 | if ((prev.rng == priv->icount.rng) && |
464 | (prev.dsr == priv->icount.dsr) && | 466 | (prev.dsr == priv->icount.dsr) && |
465 | (prev.dcd == priv->icount.dcd) && | 467 | (prev.dcd == priv->icount.dcd) && |
@@ -580,7 +582,7 @@ static void ark3116_update_msr(struct usb_serial_port *port, __u8 msr) | |||
580 | priv->icount.dcd++; | 582 | priv->icount.dcd++; |
581 | if (msr & UART_MSR_TERI) | 583 | if (msr & UART_MSR_TERI) |
582 | priv->icount.rng++; | 584 | priv->icount.rng++; |
583 | wake_up_interruptible(&priv->delta_msr_wait); | 585 | wake_up_interruptible(&port->delta_msr_wait); |
584 | } | 586 | } |
585 | } | 587 | } |
586 | 588 | ||
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index d255f66e708e..07d4650a32ab 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -80,7 +80,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
80 | 80 | ||
81 | struct ch341_private { | 81 | struct ch341_private { |
82 | spinlock_t lock; /* access lock */ | 82 | spinlock_t lock; /* access lock */ |
83 | wait_queue_head_t delta_msr_wait; /* wait queue for modem status */ | ||
84 | unsigned baud_rate; /* set baud rate */ | 83 | unsigned baud_rate; /* set baud rate */ |
85 | u8 line_control; /* set line control value RTS/DTR */ | 84 | u8 line_control; /* set line control value RTS/DTR */ |
86 | u8 line_status; /* active status of modem control inputs */ | 85 | u8 line_status; /* active status of modem control inputs */ |
@@ -252,7 +251,6 @@ static int ch341_port_probe(struct usb_serial_port *port) | |||
252 | return -ENOMEM; | 251 | return -ENOMEM; |
253 | 252 | ||
254 | spin_lock_init(&priv->lock); | 253 | spin_lock_init(&priv->lock); |
255 | init_waitqueue_head(&priv->delta_msr_wait); | ||
256 | priv->baud_rate = DEFAULT_BAUD_RATE; | 254 | priv->baud_rate = DEFAULT_BAUD_RATE; |
257 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; | 255 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; |
258 | 256 | ||
@@ -298,7 +296,7 @@ static void ch341_dtr_rts(struct usb_serial_port *port, int on) | |||
298 | priv->line_control &= ~(CH341_BIT_RTS | CH341_BIT_DTR); | 296 | priv->line_control &= ~(CH341_BIT_RTS | CH341_BIT_DTR); |
299 | spin_unlock_irqrestore(&priv->lock, flags); | 297 | spin_unlock_irqrestore(&priv->lock, flags); |
300 | ch341_set_handshake(port->serial->dev, priv->line_control); | 298 | ch341_set_handshake(port->serial->dev, priv->line_control); |
301 | wake_up_interruptible(&priv->delta_msr_wait); | 299 | wake_up_interruptible(&port->delta_msr_wait); |
302 | } | 300 | } |
303 | 301 | ||
304 | static void ch341_close(struct usb_serial_port *port) | 302 | static void ch341_close(struct usb_serial_port *port) |
@@ -491,7 +489,7 @@ static void ch341_read_int_callback(struct urb *urb) | |||
491 | tty_kref_put(tty); | 489 | tty_kref_put(tty); |
492 | } | 490 | } |
493 | 491 | ||
494 | wake_up_interruptible(&priv->delta_msr_wait); | 492 | wake_up_interruptible(&port->delta_msr_wait); |
495 | } | 493 | } |
496 | 494 | ||
497 | exit: | 495 | exit: |
@@ -517,11 +515,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
517 | spin_unlock_irqrestore(&priv->lock, flags); | 515 | spin_unlock_irqrestore(&priv->lock, flags); |
518 | 516 | ||
519 | while (!multi_change) { | 517 | while (!multi_change) { |
520 | interruptible_sleep_on(&priv->delta_msr_wait); | 518 | interruptible_sleep_on(&port->delta_msr_wait); |
521 | /* see if a signal did it */ | 519 | /* see if a signal did it */ |
522 | if (signal_pending(current)) | 520 | if (signal_pending(current)) |
523 | return -ERESTARTSYS; | 521 | return -ERESTARTSYS; |
524 | 522 | ||
523 | if (port->serial->disconnected) | ||
524 | return -EIO; | ||
525 | |||
525 | spin_lock_irqsave(&priv->lock, flags); | 526 | spin_lock_irqsave(&priv->lock, flags); |
526 | status = priv->line_status; | 527 | status = priv->line_status; |
527 | multi_change = priv->multi_status_change; | 528 | multi_change = priv->multi_status_change; |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 8efa19d0e9fb..ba7352e4187e 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -111,7 +111,6 @@ struct cypress_private { | |||
111 | int baud_rate; /* stores current baud rate in | 111 | int baud_rate; /* stores current baud rate in |
112 | integer form */ | 112 | integer form */ |
113 | int isthrottled; /* if throttled, discard reads */ | 113 | int isthrottled; /* if throttled, discard reads */ |
114 | wait_queue_head_t delta_msr_wait; /* used for TIOCMIWAIT */ | ||
115 | char prev_status, diff_status; /* used for TIOCMIWAIT */ | 114 | char prev_status, diff_status; /* used for TIOCMIWAIT */ |
116 | /* we pass a pointer to this as the argument sent to | 115 | /* we pass a pointer to this as the argument sent to |
117 | cypress_set_termios old_termios */ | 116 | cypress_set_termios old_termios */ |
@@ -449,7 +448,6 @@ static int cypress_generic_port_probe(struct usb_serial_port *port) | |||
449 | kfree(priv); | 448 | kfree(priv); |
450 | return -ENOMEM; | 449 | return -ENOMEM; |
451 | } | 450 | } |
452 | init_waitqueue_head(&priv->delta_msr_wait); | ||
453 | 451 | ||
454 | usb_reset_configuration(serial->dev); | 452 | usb_reset_configuration(serial->dev); |
455 | 453 | ||
@@ -868,12 +866,16 @@ static int cypress_ioctl(struct tty_struct *tty, | |||
868 | switch (cmd) { | 866 | switch (cmd) { |
869 | /* This code comes from drivers/char/serial.c and ftdi_sio.c */ | 867 | /* This code comes from drivers/char/serial.c and ftdi_sio.c */ |
870 | case TIOCMIWAIT: | 868 | case TIOCMIWAIT: |
871 | while (priv != NULL) { | 869 | for (;;) { |
872 | interruptible_sleep_on(&priv->delta_msr_wait); | 870 | interruptible_sleep_on(&port->delta_msr_wait); |
873 | /* see if a signal did it */ | 871 | /* see if a signal did it */ |
874 | if (signal_pending(current)) | 872 | if (signal_pending(current)) |
875 | return -ERESTARTSYS; | 873 | return -ERESTARTSYS; |
876 | else { | 874 | |
875 | if (port->serial->disconnected) | ||
876 | return -EIO; | ||
877 | |||
878 | { | ||
877 | char diff = priv->diff_status; | 879 | char diff = priv->diff_status; |
878 | if (diff == 0) | 880 | if (diff == 0) |
879 | return -EIO; /* no change => error */ | 881 | return -EIO; /* no change => error */ |
@@ -1187,7 +1189,7 @@ static void cypress_read_int_callback(struct urb *urb) | |||
1187 | if (priv->current_status != priv->prev_status) { | 1189 | if (priv->current_status != priv->prev_status) { |
1188 | priv->diff_status |= priv->current_status ^ | 1190 | priv->diff_status |= priv->current_status ^ |
1189 | priv->prev_status; | 1191 | priv->prev_status; |
1190 | wake_up_interruptible(&priv->delta_msr_wait); | 1192 | wake_up_interruptible(&port->delta_msr_wait); |
1191 | priv->prev_status = priv->current_status; | 1193 | priv->prev_status = priv->current_status; |
1192 | } | 1194 | } |
1193 | spin_unlock_irqrestore(&priv->lock, flags); | 1195 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index b1b2dc64b50b..a172ad5c5ce8 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c | |||
@@ -47,7 +47,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
47 | 47 | ||
48 | struct f81232_private { | 48 | struct f81232_private { |
49 | spinlock_t lock; | 49 | spinlock_t lock; |
50 | wait_queue_head_t delta_msr_wait; | ||
51 | u8 line_control; | 50 | u8 line_control; |
52 | u8 line_status; | 51 | u8 line_status; |
53 | }; | 52 | }; |
@@ -111,7 +110,7 @@ static void f81232_process_read_urb(struct urb *urb) | |||
111 | line_status = priv->line_status; | 110 | line_status = priv->line_status; |
112 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 111 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
113 | spin_unlock_irqrestore(&priv->lock, flags); | 112 | spin_unlock_irqrestore(&priv->lock, flags); |
114 | wake_up_interruptible(&priv->delta_msr_wait); | 113 | wake_up_interruptible(&port->delta_msr_wait); |
115 | 114 | ||
116 | if (!urb->actual_length) | 115 | if (!urb->actual_length) |
117 | return; | 116 | return; |
@@ -256,11 +255,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
256 | spin_unlock_irqrestore(&priv->lock, flags); | 255 | spin_unlock_irqrestore(&priv->lock, flags); |
257 | 256 | ||
258 | while (1) { | 257 | while (1) { |
259 | interruptible_sleep_on(&priv->delta_msr_wait); | 258 | interruptible_sleep_on(&port->delta_msr_wait); |
260 | /* see if a signal did it */ | 259 | /* see if a signal did it */ |
261 | if (signal_pending(current)) | 260 | if (signal_pending(current)) |
262 | return -ERESTARTSYS; | 261 | return -ERESTARTSYS; |
263 | 262 | ||
263 | if (port->serial->disconnected) | ||
264 | return -EIO; | ||
265 | |||
264 | spin_lock_irqsave(&priv->lock, flags); | 266 | spin_lock_irqsave(&priv->lock, flags); |
265 | status = priv->line_status; | 267 | status = priv->line_status; |
266 | spin_unlock_irqrestore(&priv->lock, flags); | 268 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -322,7 +324,6 @@ static int f81232_port_probe(struct usb_serial_port *port) | |||
322 | return -ENOMEM; | 324 | return -ENOMEM; |
323 | 325 | ||
324 | spin_lock_init(&priv->lock); | 326 | spin_lock_init(&priv->lock); |
325 | init_waitqueue_head(&priv->delta_msr_wait); | ||
326 | 327 | ||
327 | usb_set_serial_port_data(port, priv); | 328 | usb_set_serial_port_data(port, priv); |
328 | 329 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index edd162df49ca..d4809d551473 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -69,9 +69,7 @@ struct ftdi_private { | |||
69 | int flags; /* some ASYNC_xxxx flags are supported */ | 69 | int flags; /* some ASYNC_xxxx flags are supported */ |
70 | unsigned long last_dtr_rts; /* saved modem control outputs */ | 70 | unsigned long last_dtr_rts; /* saved modem control outputs */ |
71 | struct async_icount icount; | 71 | struct async_icount icount; |
72 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
73 | char prev_status; /* Used for TIOCMIWAIT */ | 72 | char prev_status; /* Used for TIOCMIWAIT */ |
74 | bool dev_gone; /* Used to abort TIOCMIWAIT */ | ||
75 | char transmit_empty; /* If transmitter is empty or not */ | 73 | char transmit_empty; /* If transmitter is empty or not */ |
76 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface | 74 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface |
77 | (0 for FT232/245) */ | 75 | (0 for FT232/245) */ |
@@ -1691,10 +1689,8 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) | |||
1691 | 1689 | ||
1692 | kref_init(&priv->kref); | 1690 | kref_init(&priv->kref); |
1693 | mutex_init(&priv->cfg_lock); | 1691 | mutex_init(&priv->cfg_lock); |
1694 | init_waitqueue_head(&priv->delta_msr_wait); | ||
1695 | 1692 | ||
1696 | priv->flags = ASYNC_LOW_LATENCY; | 1693 | priv->flags = ASYNC_LOW_LATENCY; |
1697 | priv->dev_gone = false; | ||
1698 | 1694 | ||
1699 | if (quirk && quirk->port_probe) | 1695 | if (quirk && quirk->port_probe) |
1700 | quirk->port_probe(priv); | 1696 | quirk->port_probe(priv); |
@@ -1840,8 +1836,7 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port) | |||
1840 | { | 1836 | { |
1841 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1837 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1842 | 1838 | ||
1843 | priv->dev_gone = true; | 1839 | wake_up_interruptible(&port->delta_msr_wait); |
1844 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
1845 | 1840 | ||
1846 | remove_sysfs_attrs(port); | 1841 | remove_sysfs_attrs(port); |
1847 | 1842 | ||
@@ -1989,7 +1984,7 @@ static int ftdi_process_packet(struct usb_serial_port *port, | |||
1989 | if (diff_status & FTDI_RS0_RLSD) | 1984 | if (diff_status & FTDI_RS0_RLSD) |
1990 | priv->icount.dcd++; | 1985 | priv->icount.dcd++; |
1991 | 1986 | ||
1992 | wake_up_interruptible_all(&priv->delta_msr_wait); | 1987 | wake_up_interruptible(&port->delta_msr_wait); |
1993 | priv->prev_status = status; | 1988 | priv->prev_status = status; |
1994 | } | 1989 | } |
1995 | 1990 | ||
@@ -2440,11 +2435,15 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2440 | */ | 2435 | */ |
2441 | case TIOCMIWAIT: | 2436 | case TIOCMIWAIT: |
2442 | cprev = priv->icount; | 2437 | cprev = priv->icount; |
2443 | while (!priv->dev_gone) { | 2438 | for (;;) { |
2444 | interruptible_sleep_on(&priv->delta_msr_wait); | 2439 | interruptible_sleep_on(&port->delta_msr_wait); |
2445 | /* see if a signal did it */ | 2440 | /* see if a signal did it */ |
2446 | if (signal_pending(current)) | 2441 | if (signal_pending(current)) |
2447 | return -ERESTARTSYS; | 2442 | return -ERESTARTSYS; |
2443 | |||
2444 | if (port->serial->disconnected) | ||
2445 | return -EIO; | ||
2446 | |||
2448 | cnow = priv->icount; | 2447 | cnow = priv->icount; |
2449 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || | 2448 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
2450 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || | 2449 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
@@ -2454,8 +2453,6 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2454 | } | 2453 | } |
2455 | cprev = cnow; | 2454 | cprev = cnow; |
2456 | } | 2455 | } |
2457 | return -EIO; | ||
2458 | break; | ||
2459 | case TIOCSERGETLSR: | 2456 | case TIOCSERGETLSR: |
2460 | return get_lsr_info(port, (struct serial_struct __user *)arg); | 2457 | return get_lsr_info(port, (struct serial_struct __user *)arg); |
2461 | break; | 2458 | break; |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 1a07b12ef341..81caf5623ee2 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -956,10 +956,7 @@ static void garmin_close(struct usb_serial_port *port) | |||
956 | if (!serial) | 956 | if (!serial) |
957 | return; | 957 | return; |
958 | 958 | ||
959 | mutex_lock(&port->serial->disc_mutex); | 959 | garmin_clear(garmin_data_p); |
960 | |||
961 | if (!port->serial->disconnected) | ||
962 | garmin_clear(garmin_data_p); | ||
963 | 960 | ||
964 | /* shutdown our urbs */ | 961 | /* shutdown our urbs */ |
965 | usb_kill_urb(port->read_urb); | 962 | usb_kill_urb(port->read_urb); |
@@ -968,8 +965,6 @@ static void garmin_close(struct usb_serial_port *port) | |||
968 | /* keep reset state so we know that we must start a new session */ | 965 | /* keep reset state so we know that we must start a new session */ |
969 | if (garmin_data_p->state != STATE_RESET) | 966 | if (garmin_data_p->state != STATE_RESET) |
970 | garmin_data_p->state = STATE_DISCONNECTED; | 967 | garmin_data_p->state = STATE_DISCONNECTED; |
971 | |||
972 | mutex_unlock(&port->serial->disc_mutex); | ||
973 | } | 968 | } |
974 | 969 | ||
975 | 970 | ||
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index b00e5cbf741f..efd8b978128c 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -110,7 +110,6 @@ struct edgeport_port { | |||
110 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 110 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
111 | wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */ | 111 | wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */ |
112 | wait_queue_head_t wait_command; /* for handling sleeping while waiting for command to finish */ | 112 | wait_queue_head_t wait_command; /* for handling sleeping while waiting for command to finish */ |
113 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ | ||
114 | 113 | ||
115 | struct async_icount icount; | 114 | struct async_icount icount; |
116 | struct usb_serial_port *port; /* loop back to the owner of this object */ | 115 | struct usb_serial_port *port; /* loop back to the owner of this object */ |
@@ -884,7 +883,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
884 | /* initialize our wait queues */ | 883 | /* initialize our wait queues */ |
885 | init_waitqueue_head(&edge_port->wait_open); | 884 | init_waitqueue_head(&edge_port->wait_open); |
886 | init_waitqueue_head(&edge_port->wait_chase); | 885 | init_waitqueue_head(&edge_port->wait_chase); |
887 | init_waitqueue_head(&edge_port->delta_msr_wait); | ||
888 | init_waitqueue_head(&edge_port->wait_command); | 886 | init_waitqueue_head(&edge_port->wait_command); |
889 | 887 | ||
890 | /* initialize our icount structure */ | 888 | /* initialize our icount structure */ |
@@ -1669,13 +1667,17 @@ static int edge_ioctl(struct tty_struct *tty, | |||
1669 | dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__, port->number); | 1667 | dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__, port->number); |
1670 | cprev = edge_port->icount; | 1668 | cprev = edge_port->icount; |
1671 | while (1) { | 1669 | while (1) { |
1672 | prepare_to_wait(&edge_port->delta_msr_wait, | 1670 | prepare_to_wait(&port->delta_msr_wait, |
1673 | &wait, TASK_INTERRUPTIBLE); | 1671 | &wait, TASK_INTERRUPTIBLE); |
1674 | schedule(); | 1672 | schedule(); |
1675 | finish_wait(&edge_port->delta_msr_wait, &wait); | 1673 | finish_wait(&port->delta_msr_wait, &wait); |
1676 | /* see if a signal did it */ | 1674 | /* see if a signal did it */ |
1677 | if (signal_pending(current)) | 1675 | if (signal_pending(current)) |
1678 | return -ERESTARTSYS; | 1676 | return -ERESTARTSYS; |
1677 | |||
1678 | if (port->serial->disconnected) | ||
1679 | return -EIO; | ||
1680 | |||
1679 | cnow = edge_port->icount; | 1681 | cnow = edge_port->icount; |
1680 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 1682 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
1681 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 1683 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
@@ -2051,7 +2053,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr) | |||
2051 | icount->dcd++; | 2053 | icount->dcd++; |
2052 | if (newMsr & EDGEPORT_MSR_DELTA_RI) | 2054 | if (newMsr & EDGEPORT_MSR_DELTA_RI) |
2053 | icount->rng++; | 2055 | icount->rng++; |
2054 | wake_up_interruptible(&edge_port->delta_msr_wait); | 2056 | wake_up_interruptible(&edge_port->port->delta_msr_wait); |
2055 | } | 2057 | } |
2056 | 2058 | ||
2057 | /* Save the new modem status */ | 2059 | /* Save the new modem status */ |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index c23776679f70..7777172206de 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -87,9 +87,6 @@ struct edgeport_port { | |||
87 | int close_pending; | 87 | int close_pending; |
88 | int lsr_event; | 88 | int lsr_event; |
89 | struct async_icount icount; | 89 | struct async_icount icount; |
90 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while | ||
91 | waiting for msr change to | ||
92 | happen */ | ||
93 | struct edgeport_serial *edge_serial; | 90 | struct edgeport_serial *edge_serial; |
94 | struct usb_serial_port *port; | 91 | struct usb_serial_port *port; |
95 | __u8 bUartMode; /* Port type, 0: RS232, etc. */ | 92 | __u8 bUartMode; /* Port type, 0: RS232, etc. */ |
@@ -1459,7 +1456,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr) | |||
1459 | icount->dcd++; | 1456 | icount->dcd++; |
1460 | if (msr & EDGEPORT_MSR_DELTA_RI) | 1457 | if (msr & EDGEPORT_MSR_DELTA_RI) |
1461 | icount->rng++; | 1458 | icount->rng++; |
1462 | wake_up_interruptible(&edge_port->delta_msr_wait); | 1459 | wake_up_interruptible(&edge_port->port->delta_msr_wait); |
1463 | } | 1460 | } |
1464 | 1461 | ||
1465 | /* Save the new modem status */ | 1462 | /* Save the new modem status */ |
@@ -1754,7 +1751,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1754 | dev = port->serial->dev; | 1751 | dev = port->serial->dev; |
1755 | 1752 | ||
1756 | memset(&(edge_port->icount), 0x00, sizeof(edge_port->icount)); | 1753 | memset(&(edge_port->icount), 0x00, sizeof(edge_port->icount)); |
1757 | init_waitqueue_head(&edge_port->delta_msr_wait); | ||
1758 | 1754 | ||
1759 | /* turn off loopback */ | 1755 | /* turn off loopback */ |
1760 | status = ti_do_config(edge_port, UMPC_SET_CLR_LOOPBACK, 0); | 1756 | status = ti_do_config(edge_port, UMPC_SET_CLR_LOOPBACK, 0); |
@@ -2434,10 +2430,14 @@ static int edge_ioctl(struct tty_struct *tty, | |||
2434 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); | 2430 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); |
2435 | cprev = edge_port->icount; | 2431 | cprev = edge_port->icount; |
2436 | while (1) { | 2432 | while (1) { |
2437 | interruptible_sleep_on(&edge_port->delta_msr_wait); | 2433 | interruptible_sleep_on(&port->delta_msr_wait); |
2438 | /* see if a signal did it */ | 2434 | /* see if a signal did it */ |
2439 | if (signal_pending(current)) | 2435 | if (signal_pending(current)) |
2440 | return -ERESTARTSYS; | 2436 | return -ERESTARTSYS; |
2437 | |||
2438 | if (port->serial->disconnected) | ||
2439 | return -EIO; | ||
2440 | |||
2441 | cnow = edge_port->icount; | 2441 | cnow = edge_port->icount; |
2442 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 2442 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
2443 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 2443 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
@@ -2649,6 +2649,7 @@ static struct usb_serial_driver edgeport_2port_device = { | |||
2649 | .set_termios = edge_set_termios, | 2649 | .set_termios = edge_set_termios, |
2650 | .tiocmget = edge_tiocmget, | 2650 | .tiocmget = edge_tiocmget, |
2651 | .tiocmset = edge_tiocmset, | 2651 | .tiocmset = edge_tiocmset, |
2652 | .get_icount = edge_get_icount, | ||
2652 | .write = edge_write, | 2653 | .write = edge_write, |
2653 | .write_room = edge_write_room, | 2654 | .write_room = edge_write_room, |
2654 | .chars_in_buffer = edge_chars_in_buffer, | 2655 | .chars_in_buffer = edge_chars_in_buffer, |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index a64d420f687b..06d5a60be2c4 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -114,8 +114,6 @@ struct mct_u232_private { | |||
114 | unsigned char last_msr; /* Modem Status Register */ | 114 | unsigned char last_msr; /* Modem Status Register */ |
115 | unsigned int rx_flags; /* Throttling flags */ | 115 | unsigned int rx_flags; /* Throttling flags */ |
116 | struct async_icount icount; | 116 | struct async_icount icount; |
117 | wait_queue_head_t msr_wait; /* for handling sleeping while waiting | ||
118 | for msr change to happen */ | ||
119 | }; | 117 | }; |
120 | 118 | ||
121 | #define THROTTLED 0x01 | 119 | #define THROTTLED 0x01 |
@@ -409,7 +407,6 @@ static int mct_u232_port_probe(struct usb_serial_port *port) | |||
409 | return -ENOMEM; | 407 | return -ENOMEM; |
410 | 408 | ||
411 | spin_lock_init(&priv->lock); | 409 | spin_lock_init(&priv->lock); |
412 | init_waitqueue_head(&priv->msr_wait); | ||
413 | 410 | ||
414 | usb_set_serial_port_data(port, priv); | 411 | usb_set_serial_port_data(port, priv); |
415 | 412 | ||
@@ -601,7 +598,7 @@ static void mct_u232_read_int_callback(struct urb *urb) | |||
601 | tty_kref_put(tty); | 598 | tty_kref_put(tty); |
602 | } | 599 | } |
603 | #endif | 600 | #endif |
604 | wake_up_interruptible(&priv->msr_wait); | 601 | wake_up_interruptible(&port->delta_msr_wait); |
605 | spin_unlock_irqrestore(&priv->lock, flags); | 602 | spin_unlock_irqrestore(&priv->lock, flags); |
606 | exit: | 603 | exit: |
607 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 604 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -810,13 +807,17 @@ static int mct_u232_ioctl(struct tty_struct *tty, | |||
810 | cprev = mct_u232_port->icount; | 807 | cprev = mct_u232_port->icount; |
811 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); | 808 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); |
812 | for ( ; ; ) { | 809 | for ( ; ; ) { |
813 | prepare_to_wait(&mct_u232_port->msr_wait, | 810 | prepare_to_wait(&port->delta_msr_wait, |
814 | &wait, TASK_INTERRUPTIBLE); | 811 | &wait, TASK_INTERRUPTIBLE); |
815 | schedule(); | 812 | schedule(); |
816 | finish_wait(&mct_u232_port->msr_wait, &wait); | 813 | finish_wait(&port->delta_msr_wait, &wait); |
817 | /* see if a signal did it */ | 814 | /* see if a signal did it */ |
818 | if (signal_pending(current)) | 815 | if (signal_pending(current)) |
819 | return -ERESTARTSYS; | 816 | return -ERESTARTSYS; |
817 | |||
818 | if (port->serial->disconnected) | ||
819 | return -EIO; | ||
820 | |||
820 | spin_lock_irqsave(&mct_u232_port->lock, flags); | 821 | spin_lock_irqsave(&mct_u232_port->lock, flags); |
821 | cnow = mct_u232_port->icount; | 822 | cnow = mct_u232_port->icount; |
822 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); | 823 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 809fb329eca5..b8051fa61911 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -219,7 +219,6 @@ struct moschip_port { | |||
219 | char open; | 219 | char open; |
220 | char open_ports; | 220 | char open_ports; |
221 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 221 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
222 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ | ||
223 | int delta_msr_cond; | 222 | int delta_msr_cond; |
224 | struct async_icount icount; | 223 | struct async_icount icount; |
225 | struct usb_serial_port *port; /* loop back to the owner of this object */ | 224 | struct usb_serial_port *port; /* loop back to the owner of this object */ |
@@ -423,6 +422,9 @@ static void mos7840_handle_new_msr(struct moschip_port *port, __u8 new_msr) | |||
423 | icount->rng++; | 422 | icount->rng++; |
424 | smp_wmb(); | 423 | smp_wmb(); |
425 | } | 424 | } |
425 | |||
426 | mos7840_port->delta_msr_cond = 1; | ||
427 | wake_up_interruptible(&port->port->delta_msr_wait); | ||
426 | } | 428 | } |
427 | } | 429 | } |
428 | 430 | ||
@@ -1127,7 +1129,6 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1127 | 1129 | ||
1128 | /* initialize our wait queues */ | 1130 | /* initialize our wait queues */ |
1129 | init_waitqueue_head(&mos7840_port->wait_chase); | 1131 | init_waitqueue_head(&mos7840_port->wait_chase); |
1130 | init_waitqueue_head(&mos7840_port->delta_msr_wait); | ||
1131 | 1132 | ||
1132 | /* initialize our icount structure */ | 1133 | /* initialize our icount structure */ |
1133 | memset(&(mos7840_port->icount), 0x00, sizeof(mos7840_port->icount)); | 1134 | memset(&(mos7840_port->icount), 0x00, sizeof(mos7840_port->icount)); |
@@ -2017,8 +2018,6 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2017 | mos7840_port->read_urb_busy = false; | 2018 | mos7840_port->read_urb_busy = false; |
2018 | } | 2019 | } |
2019 | } | 2020 | } |
2020 | wake_up(&mos7840_port->delta_msr_wait); | ||
2021 | mos7840_port->delta_msr_cond = 1; | ||
2022 | dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is End %x\n", __func__, | 2021 | dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is End %x\n", __func__, |
2023 | mos7840_port->shadowLCR); | 2022 | mos7840_port->shadowLCR); |
2024 | } | 2023 | } |
@@ -2219,13 +2218,18 @@ static int mos7840_ioctl(struct tty_struct *tty, | |||
2219 | while (1) { | 2218 | while (1) { |
2220 | /* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */ | 2219 | /* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */ |
2221 | mos7840_port->delta_msr_cond = 0; | 2220 | mos7840_port->delta_msr_cond = 0; |
2222 | wait_event_interruptible(mos7840_port->delta_msr_wait, | 2221 | wait_event_interruptible(port->delta_msr_wait, |
2223 | (mos7840_port-> | 2222 | (port->serial->disconnected || |
2223 | mos7840_port-> | ||
2224 | delta_msr_cond == 1)); | 2224 | delta_msr_cond == 1)); |
2225 | 2225 | ||
2226 | /* see if a signal did it */ | 2226 | /* see if a signal did it */ |
2227 | if (signal_pending(current)) | 2227 | if (signal_pending(current)) |
2228 | return -ERESTARTSYS; | 2228 | return -ERESTARTSYS; |
2229 | |||
2230 | if (port->serial->disconnected) | ||
2231 | return -EIO; | ||
2232 | |||
2229 | cnow = mos7840_port->icount; | 2233 | cnow = mos7840_port->icount; |
2230 | smp_rmb(); | 2234 | smp_rmb(); |
2231 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 2235 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index a958fd41b5b3..87c71ccfee87 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -188,7 +188,6 @@ struct oti6858_private { | |||
188 | u8 setup_done; | 188 | u8 setup_done; |
189 | struct delayed_work delayed_setup_work; | 189 | struct delayed_work delayed_setup_work; |
190 | 190 | ||
191 | wait_queue_head_t intr_wait; | ||
192 | struct usb_serial_port *port; /* USB port with which associated */ | 191 | struct usb_serial_port *port; /* USB port with which associated */ |
193 | }; | 192 | }; |
194 | 193 | ||
@@ -339,7 +338,6 @@ static int oti6858_port_probe(struct usb_serial_port *port) | |||
339 | return -ENOMEM; | 338 | return -ENOMEM; |
340 | 339 | ||
341 | spin_lock_init(&priv->lock); | 340 | spin_lock_init(&priv->lock); |
342 | init_waitqueue_head(&priv->intr_wait); | ||
343 | priv->port = port; | 341 | priv->port = port; |
344 | INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line); | 342 | INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line); |
345 | INIT_DELAYED_WORK(&priv->delayed_write_work, send_data); | 343 | INIT_DELAYED_WORK(&priv->delayed_write_work, send_data); |
@@ -664,11 +662,15 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
664 | spin_unlock_irqrestore(&priv->lock, flags); | 662 | spin_unlock_irqrestore(&priv->lock, flags); |
665 | 663 | ||
666 | while (1) { | 664 | while (1) { |
667 | wait_event_interruptible(priv->intr_wait, | 665 | wait_event_interruptible(port->delta_msr_wait, |
666 | port->serial->disconnected || | ||
668 | priv->status.pin_state != prev); | 667 | priv->status.pin_state != prev); |
669 | if (signal_pending(current)) | 668 | if (signal_pending(current)) |
670 | return -ERESTARTSYS; | 669 | return -ERESTARTSYS; |
671 | 670 | ||
671 | if (port->serial->disconnected) | ||
672 | return -EIO; | ||
673 | |||
672 | spin_lock_irqsave(&priv->lock, flags); | 674 | spin_lock_irqsave(&priv->lock, flags); |
673 | status = priv->status.pin_state & PIN_MASK; | 675 | status = priv->status.pin_state & PIN_MASK; |
674 | spin_unlock_irqrestore(&priv->lock, flags); | 676 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -763,7 +765,7 @@ static void oti6858_read_int_callback(struct urb *urb) | |||
763 | 765 | ||
764 | if (!priv->transient) { | 766 | if (!priv->transient) { |
765 | if (xs->pin_state != priv->status.pin_state) | 767 | if (xs->pin_state != priv->status.pin_state) |
766 | wake_up_interruptible(&priv->intr_wait); | 768 | wake_up_interruptible(&port->delta_msr_wait); |
767 | memcpy(&priv->status, xs, OTI6858_CTRL_PKT_SIZE); | 769 | memcpy(&priv->status, xs, OTI6858_CTRL_PKT_SIZE); |
768 | } | 770 | } |
769 | 771 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 54adc9125e5c..3b10018d89a3 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -139,7 +139,6 @@ struct pl2303_serial_private { | |||
139 | 139 | ||
140 | struct pl2303_private { | 140 | struct pl2303_private { |
141 | spinlock_t lock; | 141 | spinlock_t lock; |
142 | wait_queue_head_t delta_msr_wait; | ||
143 | u8 line_control; | 142 | u8 line_control; |
144 | u8 line_status; | 143 | u8 line_status; |
145 | }; | 144 | }; |
@@ -233,7 +232,6 @@ static int pl2303_port_probe(struct usb_serial_port *port) | |||
233 | return -ENOMEM; | 232 | return -ENOMEM; |
234 | 233 | ||
235 | spin_lock_init(&priv->lock); | 234 | spin_lock_init(&priv->lock); |
236 | init_waitqueue_head(&priv->delta_msr_wait); | ||
237 | 235 | ||
238 | usb_set_serial_port_data(port, priv); | 236 | usb_set_serial_port_data(port, priv); |
239 | 237 | ||
@@ -607,11 +605,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
607 | spin_unlock_irqrestore(&priv->lock, flags); | 605 | spin_unlock_irqrestore(&priv->lock, flags); |
608 | 606 | ||
609 | while (1) { | 607 | while (1) { |
610 | interruptible_sleep_on(&priv->delta_msr_wait); | 608 | interruptible_sleep_on(&port->delta_msr_wait); |
611 | /* see if a signal did it */ | 609 | /* see if a signal did it */ |
612 | if (signal_pending(current)) | 610 | if (signal_pending(current)) |
613 | return -ERESTARTSYS; | 611 | return -ERESTARTSYS; |
614 | 612 | ||
613 | if (port->serial->disconnected) | ||
614 | return -EIO; | ||
615 | |||
615 | spin_lock_irqsave(&priv->lock, flags); | 616 | spin_lock_irqsave(&priv->lock, flags); |
616 | status = priv->line_status; | 617 | status = priv->line_status; |
617 | spin_unlock_irqrestore(&priv->lock, flags); | 618 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -719,7 +720,7 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
719 | spin_unlock_irqrestore(&priv->lock, flags); | 720 | spin_unlock_irqrestore(&priv->lock, flags); |
720 | if (priv->line_status & UART_BREAK_ERROR) | 721 | if (priv->line_status & UART_BREAK_ERROR) |
721 | usb_serial_handle_break(port); | 722 | usb_serial_handle_break(port); |
722 | wake_up_interruptible(&priv->delta_msr_wait); | 723 | wake_up_interruptible(&port->delta_msr_wait); |
723 | 724 | ||
724 | tty = tty_port_tty_get(&port->port); | 725 | tty = tty_port_tty_get(&port->port); |
725 | if (!tty) | 726 | if (!tty) |
@@ -783,7 +784,7 @@ static void pl2303_process_read_urb(struct urb *urb) | |||
783 | line_status = priv->line_status; | 784 | line_status = priv->line_status; |
784 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 785 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
785 | spin_unlock_irqrestore(&priv->lock, flags); | 786 | spin_unlock_irqrestore(&priv->lock, flags); |
786 | wake_up_interruptible(&priv->delta_msr_wait); | 787 | wake_up_interruptible(&port->delta_msr_wait); |
787 | 788 | ||
788 | if (!urb->actual_length) | 789 | if (!urb->actual_length) |
789 | return; | 790 | return; |
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index d643a4d4d770..75f125ddb0c9 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c | |||
@@ -128,7 +128,6 @@ struct qt2_port_private { | |||
128 | u8 shadowLSR; | 128 | u8 shadowLSR; |
129 | u8 shadowMSR; | 129 | u8 shadowMSR; |
130 | 130 | ||
131 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
132 | struct async_icount icount; | 131 | struct async_icount icount; |
133 | 132 | ||
134 | struct usb_serial_port *port; | 133 | struct usb_serial_port *port; |
@@ -506,8 +505,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
506 | spin_unlock_irqrestore(&priv->lock, flags); | 505 | spin_unlock_irqrestore(&priv->lock, flags); |
507 | 506 | ||
508 | while (1) { | 507 | while (1) { |
509 | wait_event_interruptible(priv->delta_msr_wait, | 508 | wait_event_interruptible(port->delta_msr_wait, |
510 | ((priv->icount.rng != prev.rng) || | 509 | (port->serial->disconnected || |
510 | (priv->icount.rng != prev.rng) || | ||
511 | (priv->icount.dsr != prev.dsr) || | 511 | (priv->icount.dsr != prev.dsr) || |
512 | (priv->icount.dcd != prev.dcd) || | 512 | (priv->icount.dcd != prev.dcd) || |
513 | (priv->icount.cts != prev.cts))); | 513 | (priv->icount.cts != prev.cts))); |
@@ -515,6 +515,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
515 | if (signal_pending(current)) | 515 | if (signal_pending(current)) |
516 | return -ERESTARTSYS; | 516 | return -ERESTARTSYS; |
517 | 517 | ||
518 | if (port->serial->disconnected) | ||
519 | return -EIO; | ||
520 | |||
518 | spin_lock_irqsave(&priv->lock, flags); | 521 | spin_lock_irqsave(&priv->lock, flags); |
519 | cur = priv->icount; | 522 | cur = priv->icount; |
520 | spin_unlock_irqrestore(&priv->lock, flags); | 523 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -827,7 +830,6 @@ static int qt2_port_probe(struct usb_serial_port *port) | |||
827 | 830 | ||
828 | spin_lock_init(&port_priv->lock); | 831 | spin_lock_init(&port_priv->lock); |
829 | spin_lock_init(&port_priv->urb_lock); | 832 | spin_lock_init(&port_priv->urb_lock); |
830 | init_waitqueue_head(&port_priv->delta_msr_wait); | ||
831 | port_priv->port = port; | 833 | port_priv->port = port; |
832 | 834 | ||
833 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); | 835 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); |
@@ -970,7 +972,7 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch) | |||
970 | if (newMSR & UART_MSR_TERI) | 972 | if (newMSR & UART_MSR_TERI) |
971 | port_priv->icount.rng++; | 973 | port_priv->icount.rng++; |
972 | 974 | ||
973 | wake_up_interruptible(&port_priv->delta_msr_wait); | 975 | wake_up_interruptible(&port->delta_msr_wait); |
974 | } | 976 | } |
975 | } | 977 | } |
976 | 978 | ||
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 91ff8e3bddbd..549ef68ff5fa 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -149,7 +149,6 @@ enum spcp8x5_type { | |||
149 | struct spcp8x5_private { | 149 | struct spcp8x5_private { |
150 | spinlock_t lock; | 150 | spinlock_t lock; |
151 | enum spcp8x5_type type; | 151 | enum spcp8x5_type type; |
152 | wait_queue_head_t delta_msr_wait; | ||
153 | u8 line_control; | 152 | u8 line_control; |
154 | u8 line_status; | 153 | u8 line_status; |
155 | }; | 154 | }; |
@@ -179,7 +178,6 @@ static int spcp8x5_port_probe(struct usb_serial_port *port) | |||
179 | return -ENOMEM; | 178 | return -ENOMEM; |
180 | 179 | ||
181 | spin_lock_init(&priv->lock); | 180 | spin_lock_init(&priv->lock); |
182 | init_waitqueue_head(&priv->delta_msr_wait); | ||
183 | priv->type = type; | 181 | priv->type = type; |
184 | 182 | ||
185 | usb_set_serial_port_data(port , priv); | 183 | usb_set_serial_port_data(port , priv); |
@@ -475,7 +473,7 @@ static void spcp8x5_process_read_urb(struct urb *urb) | |||
475 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 473 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
476 | spin_unlock_irqrestore(&priv->lock, flags); | 474 | spin_unlock_irqrestore(&priv->lock, flags); |
477 | /* wake up the wait for termios */ | 475 | /* wake up the wait for termios */ |
478 | wake_up_interruptible(&priv->delta_msr_wait); | 476 | wake_up_interruptible(&port->delta_msr_wait); |
479 | 477 | ||
480 | if (!urb->actual_length) | 478 | if (!urb->actual_length) |
481 | return; | 479 | return; |
@@ -526,12 +524,15 @@ static int spcp8x5_wait_modem_info(struct usb_serial_port *port, | |||
526 | 524 | ||
527 | while (1) { | 525 | while (1) { |
528 | /* wake up in bulk read */ | 526 | /* wake up in bulk read */ |
529 | interruptible_sleep_on(&priv->delta_msr_wait); | 527 | interruptible_sleep_on(&port->delta_msr_wait); |
530 | 528 | ||
531 | /* see if a signal did it */ | 529 | /* see if a signal did it */ |
532 | if (signal_pending(current)) | 530 | if (signal_pending(current)) |
533 | return -ERESTARTSYS; | 531 | return -ERESTARTSYS; |
534 | 532 | ||
533 | if (port->serial->disconnected) | ||
534 | return -EIO; | ||
535 | |||
535 | spin_lock_irqsave(&priv->lock, flags); | 536 | spin_lock_irqsave(&priv->lock, flags); |
536 | status = priv->line_status; | 537 | status = priv->line_status; |
537 | spin_unlock_irqrestore(&priv->lock, flags); | 538 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index b57cf841c5b6..4b2a19757b4d 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
@@ -61,7 +61,6 @@ struct ssu100_port_private { | |||
61 | spinlock_t status_lock; | 61 | spinlock_t status_lock; |
62 | u8 shadowLSR; | 62 | u8 shadowLSR; |
63 | u8 shadowMSR; | 63 | u8 shadowMSR; |
64 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
65 | struct async_icount icount; | 64 | struct async_icount icount; |
66 | }; | 65 | }; |
67 | 66 | ||
@@ -355,8 +354,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
355 | spin_unlock_irqrestore(&priv->status_lock, flags); | 354 | spin_unlock_irqrestore(&priv->status_lock, flags); |
356 | 355 | ||
357 | while (1) { | 356 | while (1) { |
358 | wait_event_interruptible(priv->delta_msr_wait, | 357 | wait_event_interruptible(port->delta_msr_wait, |
359 | ((priv->icount.rng != prev.rng) || | 358 | (port->serial->disconnected || |
359 | (priv->icount.rng != prev.rng) || | ||
360 | (priv->icount.dsr != prev.dsr) || | 360 | (priv->icount.dsr != prev.dsr) || |
361 | (priv->icount.dcd != prev.dcd) || | 361 | (priv->icount.dcd != prev.dcd) || |
362 | (priv->icount.cts != prev.cts))); | 362 | (priv->icount.cts != prev.cts))); |
@@ -364,6 +364,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
364 | if (signal_pending(current)) | 364 | if (signal_pending(current)) |
365 | return -ERESTARTSYS; | 365 | return -ERESTARTSYS; |
366 | 366 | ||
367 | if (port->serial->disconnected) | ||
368 | return -EIO; | ||
369 | |||
367 | spin_lock_irqsave(&priv->status_lock, flags); | 370 | spin_lock_irqsave(&priv->status_lock, flags); |
368 | cur = priv->icount; | 371 | cur = priv->icount; |
369 | spin_unlock_irqrestore(&priv->status_lock, flags); | 372 | spin_unlock_irqrestore(&priv->status_lock, flags); |
@@ -445,7 +448,6 @@ static int ssu100_port_probe(struct usb_serial_port *port) | |||
445 | return -ENOMEM; | 448 | return -ENOMEM; |
446 | 449 | ||
447 | spin_lock_init(&priv->status_lock); | 450 | spin_lock_init(&priv->status_lock); |
448 | init_waitqueue_head(&priv->delta_msr_wait); | ||
449 | 451 | ||
450 | usb_set_serial_port_data(port, priv); | 452 | usb_set_serial_port_data(port, priv); |
451 | 453 | ||
@@ -537,7 +539,7 @@ static void ssu100_update_msr(struct usb_serial_port *port, u8 msr) | |||
537 | priv->icount.dcd++; | 539 | priv->icount.dcd++; |
538 | if (msr & UART_MSR_TERI) | 540 | if (msr & UART_MSR_TERI) |
539 | priv->icount.rng++; | 541 | priv->icount.rng++; |
540 | wake_up_interruptible(&priv->delta_msr_wait); | 542 | wake_up_interruptible(&port->delta_msr_wait); |
541 | } | 543 | } |
542 | } | 544 | } |
543 | 545 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 39cb9b807c3c..73deb029fc05 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -74,7 +74,6 @@ struct ti_port { | |||
74 | int tp_flags; | 74 | int tp_flags; |
75 | int tp_closing_wait;/* in .01 secs */ | 75 | int tp_closing_wait;/* in .01 secs */ |
76 | struct async_icount tp_icount; | 76 | struct async_icount tp_icount; |
77 | wait_queue_head_t tp_msr_wait; /* wait for msr change */ | ||
78 | wait_queue_head_t tp_write_wait; | 77 | wait_queue_head_t tp_write_wait; |
79 | struct ti_device *tp_tdev; | 78 | struct ti_device *tp_tdev; |
80 | struct usb_serial_port *tp_port; | 79 | struct usb_serial_port *tp_port; |
@@ -432,7 +431,6 @@ static int ti_port_probe(struct usb_serial_port *port) | |||
432 | else | 431 | else |
433 | tport->tp_uart_base_addr = TI_UART2_BASE_ADDR; | 432 | tport->tp_uart_base_addr = TI_UART2_BASE_ADDR; |
434 | tport->tp_closing_wait = closing_wait; | 433 | tport->tp_closing_wait = closing_wait; |
435 | init_waitqueue_head(&tport->tp_msr_wait); | ||
436 | init_waitqueue_head(&tport->tp_write_wait); | 434 | init_waitqueue_head(&tport->tp_write_wait); |
437 | if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, GFP_KERNEL)) { | 435 | if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, GFP_KERNEL)) { |
438 | kfree(tport); | 436 | kfree(tport); |
@@ -784,9 +782,13 @@ static int ti_ioctl(struct tty_struct *tty, | |||
784 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); | 782 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); |
785 | cprev = tport->tp_icount; | 783 | cprev = tport->tp_icount; |
786 | while (1) { | 784 | while (1) { |
787 | interruptible_sleep_on(&tport->tp_msr_wait); | 785 | interruptible_sleep_on(&port->delta_msr_wait); |
788 | if (signal_pending(current)) | 786 | if (signal_pending(current)) |
789 | return -ERESTARTSYS; | 787 | return -ERESTARTSYS; |
788 | |||
789 | if (port->serial->disconnected) | ||
790 | return -EIO; | ||
791 | |||
790 | cnow = tport->tp_icount; | 792 | cnow = tport->tp_icount; |
791 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 793 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
792 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 794 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
@@ -1392,7 +1394,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr) | |||
1392 | icount->dcd++; | 1394 | icount->dcd++; |
1393 | if (msr & TI_MSR_DELTA_RI) | 1395 | if (msr & TI_MSR_DELTA_RI) |
1394 | icount->rng++; | 1396 | icount->rng++; |
1395 | wake_up_interruptible(&tport->tp_msr_wait); | 1397 | wake_up_interruptible(&tport->tp_port->delta_msr_wait); |
1396 | spin_unlock_irqrestore(&tport->tp_lock, flags); | 1398 | spin_unlock_irqrestore(&tport->tp_lock, flags); |
1397 | } | 1399 | } |
1398 | 1400 | ||
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a19ed74d770d..2e70efa08b77 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -151,6 +151,7 @@ static void destroy_serial(struct kref *kref) | |||
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | usb_put_intf(serial->interface); | ||
154 | usb_put_dev(serial->dev); | 155 | usb_put_dev(serial->dev); |
155 | kfree(serial); | 156 | kfree(serial); |
156 | } | 157 | } |
@@ -620,7 +621,7 @@ static struct usb_serial *create_serial(struct usb_device *dev, | |||
620 | } | 621 | } |
621 | serial->dev = usb_get_dev(dev); | 622 | serial->dev = usb_get_dev(dev); |
622 | serial->type = driver; | 623 | serial->type = driver; |
623 | serial->interface = interface; | 624 | serial->interface = usb_get_intf(interface); |
624 | kref_init(&serial->kref); | 625 | kref_init(&serial->kref); |
625 | mutex_init(&serial->disc_mutex); | 626 | mutex_init(&serial->disc_mutex); |
626 | serial->minor = SERIAL_TTY_NO_MINOR; | 627 | serial->minor = SERIAL_TTY_NO_MINOR; |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index da04a074e790..1799335288bd 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -496,6 +496,13 @@ UNUSUAL_DEV( 0x04e8, 0x5122, 0x0000, 0x9999, | |||
496 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 496 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
497 | US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), | 497 | US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), |
498 | 498 | ||
499 | /* Added by Dmitry Artamonow <mad_soft@inbox.ru> */ | ||
500 | UNUSUAL_DEV( 0x04e8, 0x5136, 0x0000, 0x9999, | ||
501 | "Samsung", | ||
502 | "YP-Z3", | ||
503 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
504 | US_FL_MAX_SECTORS_64), | ||
505 | |||
499 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. | 506 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. |
500 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and | 507 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and |
501 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. | 508 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. |
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index 964ff22bf281..aeb00fc2d3be 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
29 | #include <linux/vfio.h> | 29 | #include <linux/vfio.h> |
30 | #include <linux/slab.h> | ||
30 | 31 | ||
31 | #include "vfio_pci_private.h" | 32 | #include "vfio_pci_private.h" |
32 | 33 | ||
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 3639371fa697..a96509187deb 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/vfio.h> | 22 | #include <linux/vfio.h> |
23 | #include <linux/wait.h> | 23 | #include <linux/wait.h> |
24 | #include <linux/workqueue.h> | 24 | #include <linux/workqueue.h> |
25 | #include <linux/slab.h> | ||
25 | 26 | ||
26 | #include "vfio_pci_private.h" | 27 | #include "vfio_pci_private.h" |
27 | 28 | ||
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 9951297b2427..43fb11ee2e8d 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c | |||
@@ -850,7 +850,7 @@ static int vhost_scsi_clear_endpoint( | |||
850 | for (index = 0; index < vs->dev.nvqs; ++index) { | 850 | for (index = 0; index < vs->dev.nvqs; ++index) { |
851 | if (!vhost_vq_access_ok(&vs->vqs[index])) { | 851 | if (!vhost_vq_access_ok(&vs->vqs[index])) { |
852 | ret = -EFAULT; | 852 | ret = -EFAULT; |
853 | goto err; | 853 | goto err_dev; |
854 | } | 854 | } |
855 | } | 855 | } |
856 | for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) { | 856 | for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) { |
@@ -860,10 +860,11 @@ static int vhost_scsi_clear_endpoint( | |||
860 | if (!tv_tpg) | 860 | if (!tv_tpg) |
861 | continue; | 861 | continue; |
862 | 862 | ||
863 | mutex_lock(&tv_tpg->tv_tpg_mutex); | ||
863 | tv_tport = tv_tpg->tport; | 864 | tv_tport = tv_tpg->tport; |
864 | if (!tv_tport) { | 865 | if (!tv_tport) { |
865 | ret = -ENODEV; | 866 | ret = -ENODEV; |
866 | goto err; | 867 | goto err_tpg; |
867 | } | 868 | } |
868 | 869 | ||
869 | if (strcmp(tv_tport->tport_name, t->vhost_wwpn)) { | 870 | if (strcmp(tv_tport->tport_name, t->vhost_wwpn)) { |
@@ -872,16 +873,19 @@ static int vhost_scsi_clear_endpoint( | |||
872 | tv_tport->tport_name, tv_tpg->tport_tpgt, | 873 | tv_tport->tport_name, tv_tpg->tport_tpgt, |
873 | t->vhost_wwpn, t->vhost_tpgt); | 874 | t->vhost_wwpn, t->vhost_tpgt); |
874 | ret = -EINVAL; | 875 | ret = -EINVAL; |
875 | goto err; | 876 | goto err_tpg; |
876 | } | 877 | } |
877 | tv_tpg->tv_tpg_vhost_count--; | 878 | tv_tpg->tv_tpg_vhost_count--; |
878 | vs->vs_tpg[target] = NULL; | 879 | vs->vs_tpg[target] = NULL; |
879 | vs->vs_endpoint = false; | 880 | vs->vs_endpoint = false; |
881 | mutex_unlock(&tv_tpg->tv_tpg_mutex); | ||
880 | } | 882 | } |
881 | mutex_unlock(&vs->dev.mutex); | 883 | mutex_unlock(&vs->dev.mutex); |
882 | return 0; | 884 | return 0; |
883 | 885 | ||
884 | err: | 886 | err_tpg: |
887 | mutex_unlock(&tv_tpg->tv_tpg_mutex); | ||
888 | err_dev: | ||
885 | mutex_unlock(&vs->dev.mutex); | 889 | mutex_unlock(&vs->dev.mutex); |
886 | return ret; | 890 | return ret; |
887 | } | 891 | } |
@@ -937,6 +941,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs) | |||
937 | 941 | ||
938 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) | 942 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) |
939 | vhost_scsi_flush_vq(vs, i); | 943 | vhost_scsi_flush_vq(vs, i); |
944 | vhost_work_flush(&vs->dev, &vs->vs_completion_work); | ||
940 | } | 945 | } |
941 | 946 | ||
942 | static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | 947 | static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) |
diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c index 3f2519d30715..e06cd5d90c97 100644 --- a/drivers/video/ep93xx-fb.c +++ b/drivers/video/ep93xx-fb.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
25 | #include <linux/fb.h> | 25 | #include <linux/fb.h> |
26 | #include <linux/io.h> | ||
26 | 27 | ||
27 | #include <linux/platform_data/video-ep93xx.h> | 28 | #include <linux/platform_data/video-ep93xx.h> |
28 | 29 | ||
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 755556ca5b2d..45169cbaba6e 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c | |||
@@ -169,6 +169,7 @@ struct mxsfb_info { | |||
169 | unsigned dotclk_delay; | 169 | unsigned dotclk_delay; |
170 | const struct mxsfb_devdata *devdata; | 170 | const struct mxsfb_devdata *devdata; |
171 | int mapped; | 171 | int mapped; |
172 | u32 sync; | ||
172 | }; | 173 | }; |
173 | 174 | ||
174 | #define mxsfb_is_v3(host) (host->devdata->ipversion == 3) | 175 | #define mxsfb_is_v3(host) (host->devdata->ipversion == 3) |
@@ -456,9 +457,9 @@ static int mxsfb_set_par(struct fb_info *fb_info) | |||
456 | vdctrl0 |= VDCTRL0_HSYNC_ACT_HIGH; | 457 | vdctrl0 |= VDCTRL0_HSYNC_ACT_HIGH; |
457 | if (fb_info->var.sync & FB_SYNC_VERT_HIGH_ACT) | 458 | if (fb_info->var.sync & FB_SYNC_VERT_HIGH_ACT) |
458 | vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH; | 459 | vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH; |
459 | if (fb_info->var.sync & FB_SYNC_DATA_ENABLE_HIGH_ACT) | 460 | if (host->sync & MXSFB_SYNC_DATA_ENABLE_HIGH_ACT) |
460 | vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH; | 461 | vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH; |
461 | if (fb_info->var.sync & FB_SYNC_DOTCLK_FAILING_ACT) | 462 | if (host->sync & MXSFB_SYNC_DOTCLK_FAILING_ACT) |
462 | vdctrl0 |= VDCTRL0_DOTCLK_ACT_FAILING; | 463 | vdctrl0 |= VDCTRL0_DOTCLK_ACT_FAILING; |
463 | 464 | ||
464 | writel(vdctrl0, host->base + LCDC_VDCTRL0); | 465 | writel(vdctrl0, host->base + LCDC_VDCTRL0); |
@@ -861,6 +862,8 @@ static int mxsfb_probe(struct platform_device *pdev) | |||
861 | 862 | ||
862 | INIT_LIST_HEAD(&fb_info->modelist); | 863 | INIT_LIST_HEAD(&fb_info->modelist); |
863 | 864 | ||
865 | host->sync = pdata->sync; | ||
866 | |||
864 | ret = mxsfb_init_fbinfo(host); | 867 | ret = mxsfb_init_fbinfo(host); |
865 | if (ret != 0) | 868 | if (ret != 0) |
866 | goto error_init_fb; | 869 | goto error_init_fb; |
diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c index e3b8f757d2d3..0e9d8c479c35 100644 --- a/drivers/watchdog/sp5100_tco.c +++ b/drivers/watchdog/sp5100_tco.c | |||
@@ -40,13 +40,12 @@ | |||
40 | #include "sp5100_tco.h" | 40 | #include "sp5100_tco.h" |
41 | 41 | ||
42 | /* Module and version information */ | 42 | /* Module and version information */ |
43 | #define TCO_VERSION "0.03" | 43 | #define TCO_VERSION "0.05" |
44 | #define TCO_MODULE_NAME "SP5100 TCO timer" | 44 | #define TCO_MODULE_NAME "SP5100 TCO timer" |
45 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION | 45 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION |
46 | 46 | ||
47 | /* internal variables */ | 47 | /* internal variables */ |
48 | static u32 tcobase_phys; | 48 | static u32 tcobase_phys; |
49 | static u32 resbase_phys; | ||
50 | static u32 tco_wdt_fired; | 49 | static u32 tco_wdt_fired; |
51 | static void __iomem *tcobase; | 50 | static void __iomem *tcobase; |
52 | static unsigned int pm_iobase; | 51 | static unsigned int pm_iobase; |
@@ -54,10 +53,6 @@ static DEFINE_SPINLOCK(tco_lock); /* Guards the hardware */ | |||
54 | static unsigned long timer_alive; | 53 | static unsigned long timer_alive; |
55 | static char tco_expect_close; | 54 | static char tco_expect_close; |
56 | static struct pci_dev *sp5100_tco_pci; | 55 | static struct pci_dev *sp5100_tco_pci; |
57 | static struct resource wdt_res = { | ||
58 | .name = "Watchdog Timer", | ||
59 | .flags = IORESOURCE_MEM, | ||
60 | }; | ||
61 | 56 | ||
62 | /* the watchdog platform device */ | 57 | /* the watchdog platform device */ |
63 | static struct platform_device *sp5100_tco_platform_device; | 58 | static struct platform_device *sp5100_tco_platform_device; |
@@ -75,12 +70,6 @@ module_param(nowayout, bool, 0); | |||
75 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started." | 70 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started." |
76 | " (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 71 | " (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
77 | 72 | ||
78 | static unsigned int force_addr; | ||
79 | module_param(force_addr, uint, 0); | ||
80 | MODULE_PARM_DESC(force_addr, "Force the use of specified MMIO address." | ||
81 | " ONLY USE THIS PARAMETER IF YOU REALLY KNOW" | ||
82 | " WHAT YOU ARE DOING (default=none)"); | ||
83 | |||
84 | /* | 73 | /* |
85 | * Some TCO specific functions | 74 | * Some TCO specific functions |
86 | */ | 75 | */ |
@@ -176,39 +165,6 @@ static void tco_timer_enable(void) | |||
176 | } | 165 | } |
177 | } | 166 | } |
178 | 167 | ||
179 | static void tco_timer_disable(void) | ||
180 | { | ||
181 | int val; | ||
182 | |||
183 | if (sp5100_tco_pci->revision >= 0x40) { | ||
184 | /* For SB800 or later */ | ||
185 | /* Enable watchdog decode bit and Disable watchdog timer */ | ||
186 | outb(SB800_PM_WATCHDOG_CONTROL, SB800_IO_PM_INDEX_REG); | ||
187 | val = inb(SB800_IO_PM_DATA_REG); | ||
188 | val |= SB800_PCI_WATCHDOG_DECODE_EN; | ||
189 | val |= SB800_PM_WATCHDOG_DISABLE; | ||
190 | outb(val, SB800_IO_PM_DATA_REG); | ||
191 | } else { | ||
192 | /* For SP5100 or SB7x0 */ | ||
193 | /* Enable watchdog decode bit */ | ||
194 | pci_read_config_dword(sp5100_tco_pci, | ||
195 | SP5100_PCI_WATCHDOG_MISC_REG, | ||
196 | &val); | ||
197 | |||
198 | val |= SP5100_PCI_WATCHDOG_DECODE_EN; | ||
199 | |||
200 | pci_write_config_dword(sp5100_tco_pci, | ||
201 | SP5100_PCI_WATCHDOG_MISC_REG, | ||
202 | val); | ||
203 | |||
204 | /* Disable Watchdog timer */ | ||
205 | outb(SP5100_PM_WATCHDOG_CONTROL, SP5100_IO_PM_INDEX_REG); | ||
206 | val = inb(SP5100_IO_PM_DATA_REG); | ||
207 | val |= SP5100_PM_WATCHDOG_DISABLE; | ||
208 | outb(val, SP5100_IO_PM_DATA_REG); | ||
209 | } | ||
210 | } | ||
211 | |||
212 | /* | 168 | /* |
213 | * /dev/watchdog handling | 169 | * /dev/watchdog handling |
214 | */ | 170 | */ |
@@ -361,7 +317,7 @@ static unsigned char sp5100_tco_setupdevice(void) | |||
361 | { | 317 | { |
362 | struct pci_dev *dev = NULL; | 318 | struct pci_dev *dev = NULL; |
363 | const char *dev_name = NULL; | 319 | const char *dev_name = NULL; |
364 | u32 val, tmp_val; | 320 | u32 val; |
365 | u32 index_reg, data_reg, base_addr; | 321 | u32 index_reg, data_reg, base_addr; |
366 | 322 | ||
367 | /* Match the PCI device */ | 323 | /* Match the PCI device */ |
@@ -459,63 +415,8 @@ static unsigned char sp5100_tco_setupdevice(void) | |||
459 | } else | 415 | } else |
460 | pr_debug("SBResource_MMIO is disabled(0x%04x)\n", val); | 416 | pr_debug("SBResource_MMIO is disabled(0x%04x)\n", val); |
461 | 417 | ||
462 | /* | 418 | pr_notice("failed to find MMIO address, giving up.\n"); |
463 | * Lastly re-programming the watchdog timer MMIO address, | 419 | goto unreg_region; |
464 | * This method is a last resort... | ||
465 | * | ||
466 | * Before re-programming, to ensure that the watchdog timer | ||
467 | * is disabled, disable the watchdog timer. | ||
468 | */ | ||
469 | tco_timer_disable(); | ||
470 | |||
471 | if (force_addr) { | ||
472 | /* | ||
473 | * Force the use of watchdog timer MMIO address, and aligned to | ||
474 | * 8byte boundary. | ||
475 | */ | ||
476 | force_addr &= ~0x7; | ||
477 | val = force_addr; | ||
478 | |||
479 | pr_info("Force the use of 0x%04x as MMIO address\n", val); | ||
480 | } else { | ||
481 | /* | ||
482 | * Get empty slot into the resource tree for watchdog timer. | ||
483 | */ | ||
484 | if (allocate_resource(&iomem_resource, | ||
485 | &wdt_res, | ||
486 | SP5100_WDT_MEM_MAP_SIZE, | ||
487 | 0xf0000000, | ||
488 | 0xfffffff8, | ||
489 | 0x8, | ||
490 | NULL, | ||
491 | NULL)) { | ||
492 | pr_err("MMIO allocation failed\n"); | ||
493 | goto unreg_region; | ||
494 | } | ||
495 | |||
496 | val = resbase_phys = wdt_res.start; | ||
497 | pr_debug("Got 0x%04x from resource tree\n", val); | ||
498 | } | ||
499 | |||
500 | /* Restore to the low three bits */ | ||
501 | outb(base_addr+0, index_reg); | ||
502 | tmp_val = val | (inb(data_reg) & 0x7); | ||
503 | |||
504 | /* Re-programming the watchdog timer base address */ | ||
505 | outb(base_addr+0, index_reg); | ||
506 | outb((tmp_val >> 0) & 0xff, data_reg); | ||
507 | outb(base_addr+1, index_reg); | ||
508 | outb((tmp_val >> 8) & 0xff, data_reg); | ||
509 | outb(base_addr+2, index_reg); | ||
510 | outb((tmp_val >> 16) & 0xff, data_reg); | ||
511 | outb(base_addr+3, index_reg); | ||
512 | outb((tmp_val >> 24) & 0xff, data_reg); | ||
513 | |||
514 | if (!request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE, | ||
515 | dev_name)) { | ||
516 | pr_err("MMIO address 0x%04x already in use\n", val); | ||
517 | goto unreg_resource; | ||
518 | } | ||
519 | 420 | ||
520 | setup_wdt: | 421 | setup_wdt: |
521 | tcobase_phys = val; | 422 | tcobase_phys = val; |
@@ -555,9 +456,6 @@ setup_wdt: | |||
555 | 456 | ||
556 | unreg_mem_region: | 457 | unreg_mem_region: |
557 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); | 458 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); |
558 | unreg_resource: | ||
559 | if (resbase_phys) | ||
560 | release_resource(&wdt_res); | ||
561 | unreg_region: | 459 | unreg_region: |
562 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); | 460 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); |
563 | exit: | 461 | exit: |
@@ -567,7 +465,6 @@ exit: | |||
567 | static int sp5100_tco_init(struct platform_device *dev) | 465 | static int sp5100_tco_init(struct platform_device *dev) |
568 | { | 466 | { |
569 | int ret; | 467 | int ret; |
570 | char addr_str[16]; | ||
571 | 468 | ||
572 | /* | 469 | /* |
573 | * Check whether or not the hardware watchdog is there. If found, then | 470 | * Check whether or not the hardware watchdog is there. If found, then |
@@ -599,23 +496,14 @@ static int sp5100_tco_init(struct platform_device *dev) | |||
599 | clear_bit(0, &timer_alive); | 496 | clear_bit(0, &timer_alive); |
600 | 497 | ||
601 | /* Show module parameters */ | 498 | /* Show module parameters */ |
602 | if (force_addr == tcobase_phys) | 499 | pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n", |
603 | /* The force_addr is vaild */ | 500 | tcobase, heartbeat, nowayout); |
604 | sprintf(addr_str, "0x%04x", force_addr); | ||
605 | else | ||
606 | strcpy(addr_str, "none"); | ||
607 | |||
608 | pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d, " | ||
609 | "force_addr=%s)\n", | ||
610 | tcobase, heartbeat, nowayout, addr_str); | ||
611 | 501 | ||
612 | return 0; | 502 | return 0; |
613 | 503 | ||
614 | exit: | 504 | exit: |
615 | iounmap(tcobase); | 505 | iounmap(tcobase); |
616 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); | 506 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); |
617 | if (resbase_phys) | ||
618 | release_resource(&wdt_res); | ||
619 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); | 507 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); |
620 | return ret; | 508 | return ret; |
621 | } | 509 | } |
@@ -630,8 +518,6 @@ static void sp5100_tco_cleanup(void) | |||
630 | misc_deregister(&sp5100_tco_miscdev); | 518 | misc_deregister(&sp5100_tco_miscdev); |
631 | iounmap(tcobase); | 519 | iounmap(tcobase); |
632 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); | 520 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); |
633 | if (resbase_phys) | ||
634 | release_resource(&wdt_res); | ||
635 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); | 521 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); |
636 | } | 522 | } |
637 | 523 | ||
diff --git a/drivers/watchdog/sp5100_tco.h b/drivers/watchdog/sp5100_tco.h index 71594a0c14b7..2b28c00da0df 100644 --- a/drivers/watchdog/sp5100_tco.h +++ b/drivers/watchdog/sp5100_tco.h | |||
@@ -57,7 +57,7 @@ | |||
57 | #define SB800_PM_WATCHDOG_DISABLE (1 << 2) | 57 | #define SB800_PM_WATCHDOG_DISABLE (1 << 2) |
58 | #define SB800_PM_WATCHDOG_SECOND_RES (3 << 0) | 58 | #define SB800_PM_WATCHDOG_SECOND_RES (3 << 0) |
59 | #define SB800_ACPI_MMIO_DECODE_EN (1 << 0) | 59 | #define SB800_ACPI_MMIO_DECODE_EN (1 << 0) |
60 | #define SB800_ACPI_MMIO_SEL (1 << 2) | 60 | #define SB800_ACPI_MMIO_SEL (1 << 1) |
61 | 61 | ||
62 | 62 | ||
63 | #define SB800_PM_WDT_MMIO_OFFSET 0xB00 | 63 | #define SB800_PM_WDT_MMIO_OFFSET 0xB00 |
diff --git a/firmware/Makefile b/firmware/Makefile index cbb09ce9730a..5d8ee1319b5c 100644 --- a/firmware/Makefile +++ b/firmware/Makefile | |||
@@ -82,7 +82,7 @@ fw-shipped-$(CONFIG_SCSI_ADVANSYS) += advansys/mcode.bin advansys/38C1600.bin \ | |||
82 | fw-shipped-$(CONFIG_SCSI_QLOGIC_1280) += qlogic/1040.bin qlogic/1280.bin \ | 82 | fw-shipped-$(CONFIG_SCSI_QLOGIC_1280) += qlogic/1040.bin qlogic/1280.bin \ |
83 | qlogic/12160.bin | 83 | qlogic/12160.bin |
84 | fw-shipped-$(CONFIG_SCSI_QLOGICPTI) += qlogic/isp1000.bin | 84 | fw-shipped-$(CONFIG_SCSI_QLOGICPTI) += qlogic/isp1000.bin |
85 | fw-shipped-$(CONFIG_INFINIBAND_QIB) += qlogic/sd7220.fw | 85 | fw-shipped-$(CONFIG_INFINIBAND_QIB) += intel/sd7220.fw |
86 | fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp | 86 | fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp |
87 | fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \ | 87 | fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \ |
88 | ess/maestro3_assp_minisrc.fw | 88 | ess/maestro3_assp_minisrc.fw |
diff --git a/firmware/qlogic/sd7220.fw.ihex b/firmware/intel/sd7220.fw.ihex index a33636319112..a33636319112 100644 --- a/firmware/qlogic/sd7220.fw.ihex +++ b/firmware/intel/sd7220.fw.ihex | |||
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c index cfd1ce34e0bc..1d36db114772 100644 --- a/fs/cifs/asn1.c +++ b/fs/cifs/asn1.c | |||
@@ -614,53 +614,10 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
614 | } | 614 | } |
615 | } | 615 | } |
616 | 616 | ||
617 | /* mechlistMIC */ | 617 | /* |
618 | if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { | 618 | * We currently ignore anything at the end of the SPNEGO blob after |
619 | /* Check if we have reached the end of the blob, but with | 619 | * the mechTypes have been parsed, since none of that info is |
620 | no mechListMic (e.g. NTLMSSP instead of KRB5) */ | 620 | * used at the moment. |
621 | if (ctx.error == ASN1_ERR_DEC_EMPTY) | 621 | */ |
622 | goto decode_negtoken_exit; | ||
623 | cFYI(1, "Error decoding last part negTokenInit exit3"); | ||
624 | return 0; | ||
625 | } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { | ||
626 | /* tag = 3 indicating mechListMIC */ | ||
627 | cFYI(1, "Exit 4 cls = %d con = %d tag = %d end = %p (%d)", | ||
628 | cls, con, tag, end, *end); | ||
629 | return 0; | ||
630 | } | ||
631 | |||
632 | /* sequence */ | ||
633 | if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { | ||
634 | cFYI(1, "Error decoding last part negTokenInit exit5"); | ||
635 | return 0; | ||
636 | } else if ((cls != ASN1_UNI) || (con != ASN1_CON) | ||
637 | || (tag != ASN1_SEQ)) { | ||
638 | cFYI(1, "cls = %d con = %d tag = %d end = %p (%d)", | ||
639 | cls, con, tag, end, *end); | ||
640 | } | ||
641 | |||
642 | /* sequence of */ | ||
643 | if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { | ||
644 | cFYI(1, "Error decoding last part negTokenInit exit 7"); | ||
645 | return 0; | ||
646 | } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { | ||
647 | cFYI(1, "Exit 8 cls = %d con = %d tag = %d end = %p (%d)", | ||
648 | cls, con, tag, end, *end); | ||
649 | return 0; | ||
650 | } | ||
651 | |||
652 | /* general string */ | ||
653 | if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { | ||
654 | cFYI(1, "Error decoding last part negTokenInit exit9"); | ||
655 | return 0; | ||
656 | } else if ((cls != ASN1_UNI) || (con != ASN1_PRI) | ||
657 | || (tag != ASN1_GENSTR)) { | ||
658 | cFYI(1, "Exit10 cls = %d con = %d tag = %d end = %p (%d)", | ||
659 | cls, con, tag, end, *end); | ||
660 | return 0; | ||
661 | } | ||
662 | cFYI(1, "Need to call asn1_octets_decode() function for %s", | ||
663 | ctx.pointer); /* is this UTF-8 or ASCII? */ | ||
664 | decode_negtoken_exit: | ||
665 | return 1; | 622 | return 1; |
666 | } | 623 | } |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 3cf8a15af916..345fc89c4286 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -91,6 +91,30 @@ struct workqueue_struct *cifsiod_wq; | |||
91 | __u8 cifs_client_guid[SMB2_CLIENT_GUID_SIZE]; | 91 | __u8 cifs_client_guid[SMB2_CLIENT_GUID_SIZE]; |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | /* | ||
95 | * Bumps refcount for cifs super block. | ||
96 | * Note that it should be only called if a referece to VFS super block is | ||
97 | * already held, e.g. in open-type syscalls context. Otherwise it can race with | ||
98 | * atomic_dec_and_test in deactivate_locked_super. | ||
99 | */ | ||
100 | void | ||
101 | cifs_sb_active(struct super_block *sb) | ||
102 | { | ||
103 | struct cifs_sb_info *server = CIFS_SB(sb); | ||
104 | |||
105 | if (atomic_inc_return(&server->active) == 1) | ||
106 | atomic_inc(&sb->s_active); | ||
107 | } | ||
108 | |||
109 | void | ||
110 | cifs_sb_deactive(struct super_block *sb) | ||
111 | { | ||
112 | struct cifs_sb_info *server = CIFS_SB(sb); | ||
113 | |||
114 | if (atomic_dec_and_test(&server->active)) | ||
115 | deactivate_super(sb); | ||
116 | } | ||
117 | |||
94 | static int | 118 | static int |
95 | cifs_read_super(struct super_block *sb) | 119 | cifs_read_super(struct super_block *sb) |
96 | { | 120 | { |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 7163419cecd9..0e32c3446ce9 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -41,6 +41,10 @@ extern struct file_system_type cifs_fs_type; | |||
41 | extern const struct address_space_operations cifs_addr_ops; | 41 | extern const struct address_space_operations cifs_addr_ops; |
42 | extern const struct address_space_operations cifs_addr_ops_smallbuf; | 42 | extern const struct address_space_operations cifs_addr_ops_smallbuf; |
43 | 43 | ||
44 | /* Functions related to super block operations */ | ||
45 | extern void cifs_sb_active(struct super_block *sb); | ||
46 | extern void cifs_sb_deactive(struct super_block *sb); | ||
47 | |||
44 | /* Functions related to inodes */ | 48 | /* Functions related to inodes */ |
45 | extern const struct inode_operations cifs_dir_inode_ops; | 49 | extern const struct inode_operations cifs_dir_inode_ops; |
46 | extern struct inode *cifs_root_iget(struct super_block *); | 50 | extern struct inode *cifs_root_iget(struct super_block *); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 8c0d85577314..7a0dd99e4507 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -300,6 +300,8 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, | |||
300 | INIT_WORK(&cfile->oplock_break, cifs_oplock_break); | 300 | INIT_WORK(&cfile->oplock_break, cifs_oplock_break); |
301 | mutex_init(&cfile->fh_mutex); | 301 | mutex_init(&cfile->fh_mutex); |
302 | 302 | ||
303 | cifs_sb_active(inode->i_sb); | ||
304 | |||
303 | /* | 305 | /* |
304 | * If the server returned a read oplock and we have mandatory brlocks, | 306 | * If the server returned a read oplock and we have mandatory brlocks, |
305 | * set oplock level to None. | 307 | * set oplock level to None. |
@@ -349,7 +351,8 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) | |||
349 | struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); | 351 | struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); |
350 | struct TCP_Server_Info *server = tcon->ses->server; | 352 | struct TCP_Server_Info *server = tcon->ses->server; |
351 | struct cifsInodeInfo *cifsi = CIFS_I(inode); | 353 | struct cifsInodeInfo *cifsi = CIFS_I(inode); |
352 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 354 | struct super_block *sb = inode->i_sb; |
355 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | ||
353 | struct cifsLockInfo *li, *tmp; | 356 | struct cifsLockInfo *li, *tmp; |
354 | struct cifs_fid fid; | 357 | struct cifs_fid fid; |
355 | struct cifs_pending_open open; | 358 | struct cifs_pending_open open; |
@@ -414,6 +417,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) | |||
414 | 417 | ||
415 | cifs_put_tlink(cifs_file->tlink); | 418 | cifs_put_tlink(cifs_file->tlink); |
416 | dput(cifs_file->dentry); | 419 | dput(cifs_file->dentry); |
420 | cifs_sb_deactive(sb); | ||
417 | kfree(cifs_file); | 421 | kfree(cifs_file); |
418 | } | 422 | } |
419 | 423 | ||
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 0079696305c9..20887bf63121 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1043,7 +1043,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, | |||
1043 | cifs_sb->mnt_cifs_flags & | 1043 | cifs_sb->mnt_cifs_flags & |
1044 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1044 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1045 | if (rc != 0) { | 1045 | if (rc != 0) { |
1046 | rc = -ETXTBSY; | 1046 | rc = -EBUSY; |
1047 | goto undo_setattr; | 1047 | goto undo_setattr; |
1048 | } | 1048 | } |
1049 | 1049 | ||
@@ -1062,7 +1062,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, | |||
1062 | if (rc == -ENOENT) | 1062 | if (rc == -ENOENT) |
1063 | rc = 0; | 1063 | rc = 0; |
1064 | else if (rc != 0) { | 1064 | else if (rc != 0) { |
1065 | rc = -ETXTBSY; | 1065 | rc = -EBUSY; |
1066 | goto undo_rename; | 1066 | goto undo_rename; |
1067 | } | 1067 | } |
1068 | cifsInode->delete_pending = true; | 1068 | cifsInode->delete_pending = true; |
@@ -1169,15 +1169,13 @@ psx_del_no_retry: | |||
1169 | cifs_drop_nlink(inode); | 1169 | cifs_drop_nlink(inode); |
1170 | } else if (rc == -ENOENT) { | 1170 | } else if (rc == -ENOENT) { |
1171 | d_drop(dentry); | 1171 | d_drop(dentry); |
1172 | } else if (rc == -ETXTBSY) { | 1172 | } else if (rc == -EBUSY) { |
1173 | if (server->ops->rename_pending_delete) { | 1173 | if (server->ops->rename_pending_delete) { |
1174 | rc = server->ops->rename_pending_delete(full_path, | 1174 | rc = server->ops->rename_pending_delete(full_path, |
1175 | dentry, xid); | 1175 | dentry, xid); |
1176 | if (rc == 0) | 1176 | if (rc == 0) |
1177 | cifs_drop_nlink(inode); | 1177 | cifs_drop_nlink(inode); |
1178 | } | 1178 | } |
1179 | if (rc == -ETXTBSY) | ||
1180 | rc = -EBUSY; | ||
1181 | } else if ((rc == -EACCES) && (dosattr == 0) && inode) { | 1179 | } else if ((rc == -EACCES) && (dosattr == 0) && inode) { |
1182 | attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); | 1180 | attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); |
1183 | if (attrs == NULL) { | 1181 | if (attrs == NULL) { |
@@ -1518,7 +1516,7 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry, | |||
1518 | * source. Note that cross directory moves do not work with | 1516 | * source. Note that cross directory moves do not work with |
1519 | * rename by filehandle to various Windows servers. | 1517 | * rename by filehandle to various Windows servers. |
1520 | */ | 1518 | */ |
1521 | if (rc == 0 || rc != -ETXTBSY) | 1519 | if (rc == 0 || rc != -EBUSY) |
1522 | goto do_rename_exit; | 1520 | goto do_rename_exit; |
1523 | 1521 | ||
1524 | /* open-file renames don't work across directories */ | 1522 | /* open-file renames don't work across directories */ |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index a82bc51fdc82..c0b25b28be6c 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -62,7 +62,7 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = { | |||
62 | {ERRdiffdevice, -EXDEV}, | 62 | {ERRdiffdevice, -EXDEV}, |
63 | {ERRnofiles, -ENOENT}, | 63 | {ERRnofiles, -ENOENT}, |
64 | {ERRwriteprot, -EROFS}, | 64 | {ERRwriteprot, -EROFS}, |
65 | {ERRbadshare, -ETXTBSY}, | 65 | {ERRbadshare, -EBUSY}, |
66 | {ERRlock, -EACCES}, | 66 | {ERRlock, -EACCES}, |
67 | {ERRunsup, -EINVAL}, | 67 | {ERRunsup, -EINVAL}, |
68 | {ERRnosuchshare, -ENXIO}, | 68 | {ERRnosuchshare, -ENXIO}, |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 4a01ba315262..3b83cd604796 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -335,9 +335,9 @@ struct ext4_group_desc | |||
335 | */ | 335 | */ |
336 | 336 | ||
337 | struct flex_groups { | 337 | struct flex_groups { |
338 | atomic_t free_inodes; | 338 | atomic64_t free_clusters; |
339 | atomic_t free_clusters; | 339 | atomic_t free_inodes; |
340 | atomic_t used_dirs; | 340 | atomic_t used_dirs; |
341 | }; | 341 | }; |
342 | 342 | ||
343 | #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ | 343 | #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ |
@@ -2617,7 +2617,7 @@ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp, | |||
2617 | extern int __init ext4_init_pageio(void); | 2617 | extern int __init ext4_init_pageio(void); |
2618 | extern void ext4_add_complete_io(ext4_io_end_t *io_end); | 2618 | extern void ext4_add_complete_io(ext4_io_end_t *io_end); |
2619 | extern void ext4_exit_pageio(void); | 2619 | extern void ext4_exit_pageio(void); |
2620 | extern void ext4_ioend_wait(struct inode *); | 2620 | extern void ext4_ioend_shutdown(struct inode *); |
2621 | extern void ext4_free_io_end(ext4_io_end_t *io); | 2621 | extern void ext4_free_io_end(ext4_io_end_t *io); |
2622 | extern ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags); | 2622 | extern ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags); |
2623 | extern void ext4_end_io_work(struct work_struct *work); | 2623 | extern void ext4_end_io_work(struct work_struct *work); |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 28dd8eeea6a9..56efcaadf848 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -1584,10 +1584,12 @@ ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1, | |||
1584 | unsigned short ext1_ee_len, ext2_ee_len, max_len; | 1584 | unsigned short ext1_ee_len, ext2_ee_len, max_len; |
1585 | 1585 | ||
1586 | /* | 1586 | /* |
1587 | * Make sure that either both extents are uninitialized, or | 1587 | * Make sure that both extents are initialized. We don't merge |
1588 | * both are _not_. | 1588 | * uninitialized extents so that we can be sure that end_io code has |
1589 | * the extent that was written properly split out and conversion to | ||
1590 | * initialized is trivial. | ||
1589 | */ | 1591 | */ |
1590 | if (ext4_ext_is_uninitialized(ex1) ^ ext4_ext_is_uninitialized(ex2)) | 1592 | if (ext4_ext_is_uninitialized(ex1) || ext4_ext_is_uninitialized(ex2)) |
1591 | return 0; | 1593 | return 0; |
1592 | 1594 | ||
1593 | if (ext4_ext_is_uninitialized(ex1)) | 1595 | if (ext4_ext_is_uninitialized(ex1)) |
@@ -2923,7 +2925,7 @@ static int ext4_split_extent_at(handle_t *handle, | |||
2923 | { | 2925 | { |
2924 | ext4_fsblk_t newblock; | 2926 | ext4_fsblk_t newblock; |
2925 | ext4_lblk_t ee_block; | 2927 | ext4_lblk_t ee_block; |
2926 | struct ext4_extent *ex, newex, orig_ex; | 2928 | struct ext4_extent *ex, newex, orig_ex, zero_ex; |
2927 | struct ext4_extent *ex2 = NULL; | 2929 | struct ext4_extent *ex2 = NULL; |
2928 | unsigned int ee_len, depth; | 2930 | unsigned int ee_len, depth; |
2929 | int err = 0; | 2931 | int err = 0; |
@@ -2943,6 +2945,10 @@ static int ext4_split_extent_at(handle_t *handle, | |||
2943 | newblock = split - ee_block + ext4_ext_pblock(ex); | 2945 | newblock = split - ee_block + ext4_ext_pblock(ex); |
2944 | 2946 | ||
2945 | BUG_ON(split < ee_block || split >= (ee_block + ee_len)); | 2947 | BUG_ON(split < ee_block || split >= (ee_block + ee_len)); |
2948 | BUG_ON(!ext4_ext_is_uninitialized(ex) && | ||
2949 | split_flag & (EXT4_EXT_MAY_ZEROOUT | | ||
2950 | EXT4_EXT_MARK_UNINIT1 | | ||
2951 | EXT4_EXT_MARK_UNINIT2)); | ||
2946 | 2952 | ||
2947 | err = ext4_ext_get_access(handle, inode, path + depth); | 2953 | err = ext4_ext_get_access(handle, inode, path + depth); |
2948 | if (err) | 2954 | if (err) |
@@ -2990,12 +2996,26 @@ static int ext4_split_extent_at(handle_t *handle, | |||
2990 | err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); | 2996 | err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); |
2991 | if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) { | 2997 | if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) { |
2992 | if (split_flag & (EXT4_EXT_DATA_VALID1|EXT4_EXT_DATA_VALID2)) { | 2998 | if (split_flag & (EXT4_EXT_DATA_VALID1|EXT4_EXT_DATA_VALID2)) { |
2993 | if (split_flag & EXT4_EXT_DATA_VALID1) | 2999 | if (split_flag & EXT4_EXT_DATA_VALID1) { |
2994 | err = ext4_ext_zeroout(inode, ex2); | 3000 | err = ext4_ext_zeroout(inode, ex2); |
2995 | else | 3001 | zero_ex.ee_block = ex2->ee_block; |
3002 | zero_ex.ee_len = ext4_ext_get_actual_len(ex2); | ||
3003 | ext4_ext_store_pblock(&zero_ex, | ||
3004 | ext4_ext_pblock(ex2)); | ||
3005 | } else { | ||
2996 | err = ext4_ext_zeroout(inode, ex); | 3006 | err = ext4_ext_zeroout(inode, ex); |
2997 | } else | 3007 | zero_ex.ee_block = ex->ee_block; |
3008 | zero_ex.ee_len = ext4_ext_get_actual_len(ex); | ||
3009 | ext4_ext_store_pblock(&zero_ex, | ||
3010 | ext4_ext_pblock(ex)); | ||
3011 | } | ||
3012 | } else { | ||
2998 | err = ext4_ext_zeroout(inode, &orig_ex); | 3013 | err = ext4_ext_zeroout(inode, &orig_ex); |
3014 | zero_ex.ee_block = orig_ex.ee_block; | ||
3015 | zero_ex.ee_len = ext4_ext_get_actual_len(&orig_ex); | ||
3016 | ext4_ext_store_pblock(&zero_ex, | ||
3017 | ext4_ext_pblock(&orig_ex)); | ||
3018 | } | ||
2999 | 3019 | ||
3000 | if (err) | 3020 | if (err) |
3001 | goto fix_extent_len; | 3021 | goto fix_extent_len; |
@@ -3003,6 +3023,12 @@ static int ext4_split_extent_at(handle_t *handle, | |||
3003 | ex->ee_len = cpu_to_le16(ee_len); | 3023 | ex->ee_len = cpu_to_le16(ee_len); |
3004 | ext4_ext_try_to_merge(handle, inode, path, ex); | 3024 | ext4_ext_try_to_merge(handle, inode, path, ex); |
3005 | err = ext4_ext_dirty(handle, inode, path + path->p_depth); | 3025 | err = ext4_ext_dirty(handle, inode, path + path->p_depth); |
3026 | if (err) | ||
3027 | goto fix_extent_len; | ||
3028 | |||
3029 | /* update extent status tree */ | ||
3030 | err = ext4_es_zeroout(inode, &zero_ex); | ||
3031 | |||
3006 | goto out; | 3032 | goto out; |
3007 | } else if (err) | 3033 | } else if (err) |
3008 | goto fix_extent_len; | 3034 | goto fix_extent_len; |
@@ -3041,6 +3067,7 @@ static int ext4_split_extent(handle_t *handle, | |||
3041 | int err = 0; | 3067 | int err = 0; |
3042 | int uninitialized; | 3068 | int uninitialized; |
3043 | int split_flag1, flags1; | 3069 | int split_flag1, flags1; |
3070 | int allocated = map->m_len; | ||
3044 | 3071 | ||
3045 | depth = ext_depth(inode); | 3072 | depth = ext_depth(inode); |
3046 | ex = path[depth].p_ext; | 3073 | ex = path[depth].p_ext; |
@@ -3060,20 +3087,29 @@ static int ext4_split_extent(handle_t *handle, | |||
3060 | map->m_lblk + map->m_len, split_flag1, flags1); | 3087 | map->m_lblk + map->m_len, split_flag1, flags1); |
3061 | if (err) | 3088 | if (err) |
3062 | goto out; | 3089 | goto out; |
3090 | } else { | ||
3091 | allocated = ee_len - (map->m_lblk - ee_block); | ||
3063 | } | 3092 | } |
3064 | 3093 | /* | |
3094 | * Update path is required because previous ext4_split_extent_at() may | ||
3095 | * result in split of original leaf or extent zeroout. | ||
3096 | */ | ||
3065 | ext4_ext_drop_refs(path); | 3097 | ext4_ext_drop_refs(path); |
3066 | path = ext4_ext_find_extent(inode, map->m_lblk, path); | 3098 | path = ext4_ext_find_extent(inode, map->m_lblk, path); |
3067 | if (IS_ERR(path)) | 3099 | if (IS_ERR(path)) |
3068 | return PTR_ERR(path); | 3100 | return PTR_ERR(path); |
3101 | depth = ext_depth(inode); | ||
3102 | ex = path[depth].p_ext; | ||
3103 | uninitialized = ext4_ext_is_uninitialized(ex); | ||
3104 | split_flag1 = 0; | ||
3069 | 3105 | ||
3070 | if (map->m_lblk >= ee_block) { | 3106 | if (map->m_lblk >= ee_block) { |
3071 | split_flag1 = split_flag & (EXT4_EXT_MAY_ZEROOUT | | 3107 | split_flag1 = split_flag & EXT4_EXT_DATA_VALID2; |
3072 | EXT4_EXT_DATA_VALID2); | 3108 | if (uninitialized) { |
3073 | if (uninitialized) | ||
3074 | split_flag1 |= EXT4_EXT_MARK_UNINIT1; | 3109 | split_flag1 |= EXT4_EXT_MARK_UNINIT1; |
3075 | if (split_flag & EXT4_EXT_MARK_UNINIT2) | 3110 | split_flag1 |= split_flag & (EXT4_EXT_MAY_ZEROOUT | |
3076 | split_flag1 |= EXT4_EXT_MARK_UNINIT2; | 3111 | EXT4_EXT_MARK_UNINIT2); |
3112 | } | ||
3077 | err = ext4_split_extent_at(handle, inode, path, | 3113 | err = ext4_split_extent_at(handle, inode, path, |
3078 | map->m_lblk, split_flag1, flags); | 3114 | map->m_lblk, split_flag1, flags); |
3079 | if (err) | 3115 | if (err) |
@@ -3082,7 +3118,7 @@ static int ext4_split_extent(handle_t *handle, | |||
3082 | 3118 | ||
3083 | ext4_ext_show_leaf(inode, path); | 3119 | ext4_ext_show_leaf(inode, path); |
3084 | out: | 3120 | out: |
3085 | return err ? err : map->m_len; | 3121 | return err ? err : allocated; |
3086 | } | 3122 | } |
3087 | 3123 | ||
3088 | /* | 3124 | /* |
@@ -3137,6 +3173,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
3137 | ee_block = le32_to_cpu(ex->ee_block); | 3173 | ee_block = le32_to_cpu(ex->ee_block); |
3138 | ee_len = ext4_ext_get_actual_len(ex); | 3174 | ee_len = ext4_ext_get_actual_len(ex); |
3139 | allocated = ee_len - (map->m_lblk - ee_block); | 3175 | allocated = ee_len - (map->m_lblk - ee_block); |
3176 | zero_ex.ee_len = 0; | ||
3140 | 3177 | ||
3141 | trace_ext4_ext_convert_to_initialized_enter(inode, map, ex); | 3178 | trace_ext4_ext_convert_to_initialized_enter(inode, map, ex); |
3142 | 3179 | ||
@@ -3227,13 +3264,16 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
3227 | 3264 | ||
3228 | if (EXT4_EXT_MAY_ZEROOUT & split_flag) | 3265 | if (EXT4_EXT_MAY_ZEROOUT & split_flag) |
3229 | max_zeroout = sbi->s_extent_max_zeroout_kb >> | 3266 | max_zeroout = sbi->s_extent_max_zeroout_kb >> |
3230 | inode->i_sb->s_blocksize_bits; | 3267 | (inode->i_sb->s_blocksize_bits - 10); |
3231 | 3268 | ||
3232 | /* If extent is less than s_max_zeroout_kb, zeroout directly */ | 3269 | /* If extent is less than s_max_zeroout_kb, zeroout directly */ |
3233 | if (max_zeroout && (ee_len <= max_zeroout)) { | 3270 | if (max_zeroout && (ee_len <= max_zeroout)) { |
3234 | err = ext4_ext_zeroout(inode, ex); | 3271 | err = ext4_ext_zeroout(inode, ex); |
3235 | if (err) | 3272 | if (err) |
3236 | goto out; | 3273 | goto out; |
3274 | zero_ex.ee_block = ex->ee_block; | ||
3275 | zero_ex.ee_len = ext4_ext_get_actual_len(ex); | ||
3276 | ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex)); | ||
3237 | 3277 | ||
3238 | err = ext4_ext_get_access(handle, inode, path + depth); | 3278 | err = ext4_ext_get_access(handle, inode, path + depth); |
3239 | if (err) | 3279 | if (err) |
@@ -3292,6 +3332,9 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
3292 | err = allocated; | 3332 | err = allocated; |
3293 | 3333 | ||
3294 | out: | 3334 | out: |
3335 | /* If we have gotten a failure, don't zero out status tree */ | ||
3336 | if (!err) | ||
3337 | err = ext4_es_zeroout(inode, &zero_ex); | ||
3295 | return err ? err : allocated; | 3338 | return err ? err : allocated; |
3296 | } | 3339 | } |
3297 | 3340 | ||
@@ -3374,8 +3417,19 @@ static int ext4_convert_unwritten_extents_endio(handle_t *handle, | |||
3374 | "block %llu, max_blocks %u\n", inode->i_ino, | 3417 | "block %llu, max_blocks %u\n", inode->i_ino, |
3375 | (unsigned long long)ee_block, ee_len); | 3418 | (unsigned long long)ee_block, ee_len); |
3376 | 3419 | ||
3377 | /* If extent is larger than requested then split is required */ | 3420 | /* If extent is larger than requested it is a clear sign that we still |
3421 | * have some extent state machine issues left. So extent_split is still | ||
3422 | * required. | ||
3423 | * TODO: Once all related issues will be fixed this situation should be | ||
3424 | * illegal. | ||
3425 | */ | ||
3378 | if (ee_block != map->m_lblk || ee_len > map->m_len) { | 3426 | if (ee_block != map->m_lblk || ee_len > map->m_len) { |
3427 | #ifdef EXT4_DEBUG | ||
3428 | ext4_warning("Inode (%ld) finished: extent logical block %llu," | ||
3429 | " len %u; IO logical block %llu, len %u\n", | ||
3430 | inode->i_ino, (unsigned long long)ee_block, ee_len, | ||
3431 | (unsigned long long)map->m_lblk, map->m_len); | ||
3432 | #endif | ||
3379 | err = ext4_split_unwritten_extents(handle, inode, map, path, | 3433 | err = ext4_split_unwritten_extents(handle, inode, map, path, |
3380 | EXT4_GET_BLOCKS_CONVERT); | 3434 | EXT4_GET_BLOCKS_CONVERT); |
3381 | if (err < 0) | 3435 | if (err < 0) |
@@ -3626,6 +3680,10 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, | |||
3626 | path, map->m_len); | 3680 | path, map->m_len); |
3627 | } else | 3681 | } else |
3628 | err = ret; | 3682 | err = ret; |
3683 | map->m_flags |= EXT4_MAP_MAPPED; | ||
3684 | if (allocated > map->m_len) | ||
3685 | allocated = map->m_len; | ||
3686 | map->m_len = allocated; | ||
3629 | goto out2; | 3687 | goto out2; |
3630 | } | 3688 | } |
3631 | /* buffered IO case */ | 3689 | /* buffered IO case */ |
@@ -3675,6 +3733,7 @@ out: | |||
3675 | allocated - map->m_len); | 3733 | allocated - map->m_len); |
3676 | allocated = map->m_len; | 3734 | allocated = map->m_len; |
3677 | } | 3735 | } |
3736 | map->m_len = allocated; | ||
3678 | 3737 | ||
3679 | /* | 3738 | /* |
3680 | * If we have done fallocate with the offset that is already | 3739 | * If we have done fallocate with the offset that is already |
@@ -4106,9 +4165,6 @@ got_allocated_blocks: | |||
4106 | } | 4165 | } |
4107 | } else { | 4166 | } else { |
4108 | BUG_ON(allocated_clusters < reserved_clusters); | 4167 | BUG_ON(allocated_clusters < reserved_clusters); |
4109 | /* We will claim quota for all newly allocated blocks.*/ | ||
4110 | ext4_da_update_reserve_space(inode, allocated_clusters, | ||
4111 | 1); | ||
4112 | if (reserved_clusters < allocated_clusters) { | 4168 | if (reserved_clusters < allocated_clusters) { |
4113 | struct ext4_inode_info *ei = EXT4_I(inode); | 4169 | struct ext4_inode_info *ei = EXT4_I(inode); |
4114 | int reservation = allocated_clusters - | 4170 | int reservation = allocated_clusters - |
@@ -4159,6 +4215,15 @@ got_allocated_blocks: | |||
4159 | ei->i_reserved_data_blocks += reservation; | 4215 | ei->i_reserved_data_blocks += reservation; |
4160 | spin_unlock(&ei->i_block_reservation_lock); | 4216 | spin_unlock(&ei->i_block_reservation_lock); |
4161 | } | 4217 | } |
4218 | /* | ||
4219 | * We will claim quota for all newly allocated blocks. | ||
4220 | * We're updating the reserved space *after* the | ||
4221 | * correction above so we do not accidentally free | ||
4222 | * all the metadata reservation because we might | ||
4223 | * actually need it later on. | ||
4224 | */ | ||
4225 | ext4_da_update_reserve_space(inode, allocated_clusters, | ||
4226 | 1); | ||
4162 | } | 4227 | } |
4163 | } | 4228 | } |
4164 | 4229 | ||
@@ -4368,8 +4433,6 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
4368 | if (len <= EXT_UNINIT_MAX_LEN << blkbits) | 4433 | if (len <= EXT_UNINIT_MAX_LEN << blkbits) |
4369 | flags |= EXT4_GET_BLOCKS_NO_NORMALIZE; | 4434 | flags |= EXT4_GET_BLOCKS_NO_NORMALIZE; |
4370 | 4435 | ||
4371 | /* Prevent race condition between unwritten */ | ||
4372 | ext4_flush_unwritten_io(inode); | ||
4373 | retry: | 4436 | retry: |
4374 | while (ret >= 0 && ret < max_blocks) { | 4437 | while (ret >= 0 && ret < max_blocks) { |
4375 | map.m_lblk = map.m_lblk + ret; | 4438 | map.m_lblk = map.m_lblk + ret; |
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c index 95796a1b7522..fe3337a85ede 100644 --- a/fs/ext4/extents_status.c +++ b/fs/ext4/extents_status.c | |||
@@ -333,17 +333,27 @@ static void ext4_es_free_extent(struct inode *inode, struct extent_status *es) | |||
333 | static int ext4_es_can_be_merged(struct extent_status *es1, | 333 | static int ext4_es_can_be_merged(struct extent_status *es1, |
334 | struct extent_status *es2) | 334 | struct extent_status *es2) |
335 | { | 335 | { |
336 | if (es1->es_lblk + es1->es_len != es2->es_lblk) | 336 | if (ext4_es_status(es1) != ext4_es_status(es2)) |
337 | return 0; | 337 | return 0; |
338 | 338 | ||
339 | if (ext4_es_status(es1) != ext4_es_status(es2)) | 339 | if (((__u64) es1->es_len) + es2->es_len > 0xFFFFFFFFULL) |
340 | return 0; | 340 | return 0; |
341 | 341 | ||
342 | if ((ext4_es_is_written(es1) || ext4_es_is_unwritten(es1)) && | 342 | if (((__u64) es1->es_lblk) + es1->es_len != es2->es_lblk) |
343 | (ext4_es_pblock(es1) + es1->es_len != ext4_es_pblock(es2))) | ||
344 | return 0; | 343 | return 0; |
345 | 344 | ||
346 | return 1; | 345 | if ((ext4_es_is_written(es1) || ext4_es_is_unwritten(es1)) && |
346 | (ext4_es_pblock(es1) + es1->es_len == ext4_es_pblock(es2))) | ||
347 | return 1; | ||
348 | |||
349 | if (ext4_es_is_hole(es1)) | ||
350 | return 1; | ||
351 | |||
352 | /* we need to check delayed extent is without unwritten status */ | ||
353 | if (ext4_es_is_delayed(es1) && !ext4_es_is_unwritten(es1)) | ||
354 | return 1; | ||
355 | |||
356 | return 0; | ||
347 | } | 357 | } |
348 | 358 | ||
349 | static struct extent_status * | 359 | static struct extent_status * |
@@ -389,6 +399,179 @@ ext4_es_try_to_merge_right(struct inode *inode, struct extent_status *es) | |||
389 | return es; | 399 | return es; |
390 | } | 400 | } |
391 | 401 | ||
402 | #ifdef ES_AGGRESSIVE_TEST | ||
403 | static void ext4_es_insert_extent_ext_check(struct inode *inode, | ||
404 | struct extent_status *es) | ||
405 | { | ||
406 | struct ext4_ext_path *path = NULL; | ||
407 | struct ext4_extent *ex; | ||
408 | ext4_lblk_t ee_block; | ||
409 | ext4_fsblk_t ee_start; | ||
410 | unsigned short ee_len; | ||
411 | int depth, ee_status, es_status; | ||
412 | |||
413 | path = ext4_ext_find_extent(inode, es->es_lblk, NULL); | ||
414 | if (IS_ERR(path)) | ||
415 | return; | ||
416 | |||
417 | depth = ext_depth(inode); | ||
418 | ex = path[depth].p_ext; | ||
419 | |||
420 | if (ex) { | ||
421 | |||
422 | ee_block = le32_to_cpu(ex->ee_block); | ||
423 | ee_start = ext4_ext_pblock(ex); | ||
424 | ee_len = ext4_ext_get_actual_len(ex); | ||
425 | |||
426 | ee_status = ext4_ext_is_uninitialized(ex) ? 1 : 0; | ||
427 | es_status = ext4_es_is_unwritten(es) ? 1 : 0; | ||
428 | |||
429 | /* | ||
430 | * Make sure ex and es are not overlap when we try to insert | ||
431 | * a delayed/hole extent. | ||
432 | */ | ||
433 | if (!ext4_es_is_written(es) && !ext4_es_is_unwritten(es)) { | ||
434 | if (in_range(es->es_lblk, ee_block, ee_len)) { | ||
435 | pr_warn("ES insert assertation failed for " | ||
436 | "inode: %lu we can find an extent " | ||
437 | "at block [%d/%d/%llu/%c], but we " | ||
438 | "want to add an delayed/hole extent " | ||
439 | "[%d/%d/%llu/%llx]\n", | ||
440 | inode->i_ino, ee_block, ee_len, | ||
441 | ee_start, ee_status ? 'u' : 'w', | ||
442 | es->es_lblk, es->es_len, | ||
443 | ext4_es_pblock(es), ext4_es_status(es)); | ||
444 | } | ||
445 | goto out; | ||
446 | } | ||
447 | |||
448 | /* | ||
449 | * We don't check ee_block == es->es_lblk, etc. because es | ||
450 | * might be a part of whole extent, vice versa. | ||
451 | */ | ||
452 | if (es->es_lblk < ee_block || | ||
453 | ext4_es_pblock(es) != ee_start + es->es_lblk - ee_block) { | ||
454 | pr_warn("ES insert assertation failed for inode: %lu " | ||
455 | "ex_status [%d/%d/%llu/%c] != " | ||
456 | "es_status [%d/%d/%llu/%c]\n", inode->i_ino, | ||
457 | ee_block, ee_len, ee_start, | ||
458 | ee_status ? 'u' : 'w', es->es_lblk, es->es_len, | ||
459 | ext4_es_pblock(es), es_status ? 'u' : 'w'); | ||
460 | goto out; | ||
461 | } | ||
462 | |||
463 | if (ee_status ^ es_status) { | ||
464 | pr_warn("ES insert assertation failed for inode: %lu " | ||
465 | "ex_status [%d/%d/%llu/%c] != " | ||
466 | "es_status [%d/%d/%llu/%c]\n", inode->i_ino, | ||
467 | ee_block, ee_len, ee_start, | ||
468 | ee_status ? 'u' : 'w', es->es_lblk, es->es_len, | ||
469 | ext4_es_pblock(es), es_status ? 'u' : 'w'); | ||
470 | } | ||
471 | } else { | ||
472 | /* | ||
473 | * We can't find an extent on disk. So we need to make sure | ||
474 | * that we don't want to add an written/unwritten extent. | ||
475 | */ | ||
476 | if (!ext4_es_is_delayed(es) && !ext4_es_is_hole(es)) { | ||
477 | pr_warn("ES insert assertation failed for inode: %lu " | ||
478 | "can't find an extent at block %d but we want " | ||
479 | "to add an written/unwritten extent " | ||
480 | "[%d/%d/%llu/%llx]\n", inode->i_ino, | ||
481 | es->es_lblk, es->es_lblk, es->es_len, | ||
482 | ext4_es_pblock(es), ext4_es_status(es)); | ||
483 | } | ||
484 | } | ||
485 | out: | ||
486 | if (path) { | ||
487 | ext4_ext_drop_refs(path); | ||
488 | kfree(path); | ||
489 | } | ||
490 | } | ||
491 | |||
492 | static void ext4_es_insert_extent_ind_check(struct inode *inode, | ||
493 | struct extent_status *es) | ||
494 | { | ||
495 | struct ext4_map_blocks map; | ||
496 | int retval; | ||
497 | |||
498 | /* | ||
499 | * Here we call ext4_ind_map_blocks to lookup a block mapping because | ||
500 | * 'Indirect' structure is defined in indirect.c. So we couldn't | ||
501 | * access direct/indirect tree from outside. It is too dirty to define | ||
502 | * this function in indirect.c file. | ||
503 | */ | ||
504 | |||
505 | map.m_lblk = es->es_lblk; | ||
506 | map.m_len = es->es_len; | ||
507 | |||
508 | retval = ext4_ind_map_blocks(NULL, inode, &map, 0); | ||
509 | if (retval > 0) { | ||
510 | if (ext4_es_is_delayed(es) || ext4_es_is_hole(es)) { | ||
511 | /* | ||
512 | * We want to add a delayed/hole extent but this | ||
513 | * block has been allocated. | ||
514 | */ | ||
515 | pr_warn("ES insert assertation failed for inode: %lu " | ||
516 | "We can find blocks but we want to add a " | ||
517 | "delayed/hole extent [%d/%d/%llu/%llx]\n", | ||
518 | inode->i_ino, es->es_lblk, es->es_len, | ||
519 | ext4_es_pblock(es), ext4_es_status(es)); | ||
520 | return; | ||
521 | } else if (ext4_es_is_written(es)) { | ||
522 | if (retval != es->es_len) { | ||
523 | pr_warn("ES insert assertation failed for " | ||
524 | "inode: %lu retval %d != es_len %d\n", | ||
525 | inode->i_ino, retval, es->es_len); | ||
526 | return; | ||
527 | } | ||
528 | if (map.m_pblk != ext4_es_pblock(es)) { | ||
529 | pr_warn("ES insert assertation failed for " | ||
530 | "inode: %lu m_pblk %llu != " | ||
531 | "es_pblk %llu\n", | ||
532 | inode->i_ino, map.m_pblk, | ||
533 | ext4_es_pblock(es)); | ||
534 | return; | ||
535 | } | ||
536 | } else { | ||
537 | /* | ||
538 | * We don't need to check unwritten extent because | ||
539 | * indirect-based file doesn't have it. | ||
540 | */ | ||
541 | BUG_ON(1); | ||
542 | } | ||
543 | } else if (retval == 0) { | ||
544 | if (ext4_es_is_written(es)) { | ||
545 | pr_warn("ES insert assertation failed for inode: %lu " | ||
546 | "We can't find the block but we want to add " | ||
547 | "an written extent [%d/%d/%llu/%llx]\n", | ||
548 | inode->i_ino, es->es_lblk, es->es_len, | ||
549 | ext4_es_pblock(es), ext4_es_status(es)); | ||
550 | return; | ||
551 | } | ||
552 | } | ||
553 | } | ||
554 | |||
555 | static inline void ext4_es_insert_extent_check(struct inode *inode, | ||
556 | struct extent_status *es) | ||
557 | { | ||
558 | /* | ||
559 | * We don't need to worry about the race condition because | ||
560 | * caller takes i_data_sem locking. | ||
561 | */ | ||
562 | BUG_ON(!rwsem_is_locked(&EXT4_I(inode)->i_data_sem)); | ||
563 | if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) | ||
564 | ext4_es_insert_extent_ext_check(inode, es); | ||
565 | else | ||
566 | ext4_es_insert_extent_ind_check(inode, es); | ||
567 | } | ||
568 | #else | ||
569 | static inline void ext4_es_insert_extent_check(struct inode *inode, | ||
570 | struct extent_status *es) | ||
571 | { | ||
572 | } | ||
573 | #endif | ||
574 | |||
392 | static int __es_insert_extent(struct inode *inode, struct extent_status *newes) | 575 | static int __es_insert_extent(struct inode *inode, struct extent_status *newes) |
393 | { | 576 | { |
394 | struct ext4_es_tree *tree = &EXT4_I(inode)->i_es_tree; | 577 | struct ext4_es_tree *tree = &EXT4_I(inode)->i_es_tree; |
@@ -471,6 +654,8 @@ int ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk, | |||
471 | ext4_es_store_status(&newes, status); | 654 | ext4_es_store_status(&newes, status); |
472 | trace_ext4_es_insert_extent(inode, &newes); | 655 | trace_ext4_es_insert_extent(inode, &newes); |
473 | 656 | ||
657 | ext4_es_insert_extent_check(inode, &newes); | ||
658 | |||
474 | write_lock(&EXT4_I(inode)->i_es_lock); | 659 | write_lock(&EXT4_I(inode)->i_es_lock); |
475 | err = __es_remove_extent(inode, lblk, end); | 660 | err = __es_remove_extent(inode, lblk, end); |
476 | if (err != 0) | 661 | if (err != 0) |
@@ -669,6 +854,23 @@ int ext4_es_remove_extent(struct inode *inode, ext4_lblk_t lblk, | |||
669 | return err; | 854 | return err; |
670 | } | 855 | } |
671 | 856 | ||
857 | int ext4_es_zeroout(struct inode *inode, struct ext4_extent *ex) | ||
858 | { | ||
859 | ext4_lblk_t ee_block; | ||
860 | ext4_fsblk_t ee_pblock; | ||
861 | unsigned int ee_len; | ||
862 | |||
863 | ee_block = le32_to_cpu(ex->ee_block); | ||
864 | ee_len = ext4_ext_get_actual_len(ex); | ||
865 | ee_pblock = ext4_ext_pblock(ex); | ||
866 | |||
867 | if (ee_len == 0) | ||
868 | return 0; | ||
869 | |||
870 | return ext4_es_insert_extent(inode, ee_block, ee_len, ee_pblock, | ||
871 | EXTENT_STATUS_WRITTEN); | ||
872 | } | ||
873 | |||
672 | static int ext4_es_shrink(struct shrinker *shrink, struct shrink_control *sc) | 874 | static int ext4_es_shrink(struct shrinker *shrink, struct shrink_control *sc) |
673 | { | 875 | { |
674 | struct ext4_sb_info *sbi = container_of(shrink, | 876 | struct ext4_sb_info *sbi = container_of(shrink, |
diff --git a/fs/ext4/extents_status.h b/fs/ext4/extents_status.h index f190dfe969da..d8e2d4dc311e 100644 --- a/fs/ext4/extents_status.h +++ b/fs/ext4/extents_status.h | |||
@@ -21,6 +21,12 @@ | |||
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * With ES_AGGRESSIVE_TEST defined, the result of es caching will be | ||
25 | * checked with old map_block's result. | ||
26 | */ | ||
27 | #define ES_AGGRESSIVE_TEST__ | ||
28 | |||
29 | /* | ||
24 | * These flags live in the high bits of extent_status.es_pblk | 30 | * These flags live in the high bits of extent_status.es_pblk |
25 | */ | 31 | */ |
26 | #define EXTENT_STATUS_WRITTEN (1ULL << 63) | 32 | #define EXTENT_STATUS_WRITTEN (1ULL << 63) |
@@ -33,6 +39,8 @@ | |||
33 | EXTENT_STATUS_DELAYED | \ | 39 | EXTENT_STATUS_DELAYED | \ |
34 | EXTENT_STATUS_HOLE) | 40 | EXTENT_STATUS_HOLE) |
35 | 41 | ||
42 | struct ext4_extent; | ||
43 | |||
36 | struct extent_status { | 44 | struct extent_status { |
37 | struct rb_node rb_node; | 45 | struct rb_node rb_node; |
38 | ext4_lblk_t es_lblk; /* first logical block extent covers */ | 46 | ext4_lblk_t es_lblk; /* first logical block extent covers */ |
@@ -58,6 +66,7 @@ extern void ext4_es_find_delayed_extent(struct inode *inode, ext4_lblk_t lblk, | |||
58 | struct extent_status *es); | 66 | struct extent_status *es); |
59 | extern int ext4_es_lookup_extent(struct inode *inode, ext4_lblk_t lblk, | 67 | extern int ext4_es_lookup_extent(struct inode *inode, ext4_lblk_t lblk, |
60 | struct extent_status *es); | 68 | struct extent_status *es); |
69 | extern int ext4_es_zeroout(struct inode *inode, struct ext4_extent *ex); | ||
61 | 70 | ||
62 | static inline int ext4_es_is_written(struct extent_status *es) | 71 | static inline int ext4_es_is_written(struct extent_status *es) |
63 | { | 72 | { |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 32fd2b9075dd..6c5bb8d993fe 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -324,8 +324,8 @@ error_return: | |||
324 | } | 324 | } |
325 | 325 | ||
326 | struct orlov_stats { | 326 | struct orlov_stats { |
327 | __u64 free_clusters; | ||
327 | __u32 free_inodes; | 328 | __u32 free_inodes; |
328 | __u32 free_clusters; | ||
329 | __u32 used_dirs; | 329 | __u32 used_dirs; |
330 | }; | 330 | }; |
331 | 331 | ||
@@ -342,7 +342,7 @@ static void get_orlov_stats(struct super_block *sb, ext4_group_t g, | |||
342 | 342 | ||
343 | if (flex_size > 1) { | 343 | if (flex_size > 1) { |
344 | stats->free_inodes = atomic_read(&flex_group[g].free_inodes); | 344 | stats->free_inodes = atomic_read(&flex_group[g].free_inodes); |
345 | stats->free_clusters = atomic_read(&flex_group[g].free_clusters); | 345 | stats->free_clusters = atomic64_read(&flex_group[g].free_clusters); |
346 | stats->used_dirs = atomic_read(&flex_group[g].used_dirs); | 346 | stats->used_dirs = atomic_read(&flex_group[g].used_dirs); |
347 | return; | 347 | return; |
348 | } | 348 | } |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 9ea0cde3fa9e..b3a5213bc73e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -185,8 +185,6 @@ void ext4_evict_inode(struct inode *inode) | |||
185 | 185 | ||
186 | trace_ext4_evict_inode(inode); | 186 | trace_ext4_evict_inode(inode); |
187 | 187 | ||
188 | ext4_ioend_wait(inode); | ||
189 | |||
190 | if (inode->i_nlink) { | 188 | if (inode->i_nlink) { |
191 | /* | 189 | /* |
192 | * When journalling data dirty buffers are tracked only in the | 190 | * When journalling data dirty buffers are tracked only in the |
@@ -207,7 +205,8 @@ void ext4_evict_inode(struct inode *inode) | |||
207 | * don't use page cache. | 205 | * don't use page cache. |
208 | */ | 206 | */ |
209 | if (ext4_should_journal_data(inode) && | 207 | if (ext4_should_journal_data(inode) && |
210 | (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) { | 208 | (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) && |
209 | inode->i_ino != EXT4_JOURNAL_INO) { | ||
211 | journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; | 210 | journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; |
212 | tid_t commit_tid = EXT4_I(inode)->i_datasync_tid; | 211 | tid_t commit_tid = EXT4_I(inode)->i_datasync_tid; |
213 | 212 | ||
@@ -216,6 +215,7 @@ void ext4_evict_inode(struct inode *inode) | |||
216 | filemap_write_and_wait(&inode->i_data); | 215 | filemap_write_and_wait(&inode->i_data); |
217 | } | 216 | } |
218 | truncate_inode_pages(&inode->i_data, 0); | 217 | truncate_inode_pages(&inode->i_data, 0); |
218 | ext4_ioend_shutdown(inode); | ||
219 | goto no_delete; | 219 | goto no_delete; |
220 | } | 220 | } |
221 | 221 | ||
@@ -225,6 +225,7 @@ void ext4_evict_inode(struct inode *inode) | |||
225 | if (ext4_should_order_data(inode)) | 225 | if (ext4_should_order_data(inode)) |
226 | ext4_begin_ordered_truncate(inode, 0); | 226 | ext4_begin_ordered_truncate(inode, 0); |
227 | truncate_inode_pages(&inode->i_data, 0); | 227 | truncate_inode_pages(&inode->i_data, 0); |
228 | ext4_ioend_shutdown(inode); | ||
228 | 229 | ||
229 | if (is_bad_inode(inode)) | 230 | if (is_bad_inode(inode)) |
230 | goto no_delete; | 231 | goto no_delete; |
@@ -482,6 +483,58 @@ static pgoff_t ext4_num_dirty_pages(struct inode *inode, pgoff_t idx, | |||
482 | return num; | 483 | return num; |
483 | } | 484 | } |
484 | 485 | ||
486 | #ifdef ES_AGGRESSIVE_TEST | ||
487 | static void ext4_map_blocks_es_recheck(handle_t *handle, | ||
488 | struct inode *inode, | ||
489 | struct ext4_map_blocks *es_map, | ||
490 | struct ext4_map_blocks *map, | ||
491 | int flags) | ||
492 | { | ||
493 | int retval; | ||
494 | |||
495 | map->m_flags = 0; | ||
496 | /* | ||
497 | * There is a race window that the result is not the same. | ||
498 | * e.g. xfstests #223 when dioread_nolock enables. The reason | ||
499 | * is that we lookup a block mapping in extent status tree with | ||
500 | * out taking i_data_sem. So at the time the unwritten extent | ||
501 | * could be converted. | ||
502 | */ | ||
503 | if (!(flags & EXT4_GET_BLOCKS_NO_LOCK)) | ||
504 | down_read((&EXT4_I(inode)->i_data_sem)); | ||
505 | if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { | ||
506 | retval = ext4_ext_map_blocks(handle, inode, map, flags & | ||
507 | EXT4_GET_BLOCKS_KEEP_SIZE); | ||
508 | } else { | ||
509 | retval = ext4_ind_map_blocks(handle, inode, map, flags & | ||
510 | EXT4_GET_BLOCKS_KEEP_SIZE); | ||
511 | } | ||
512 | if (!(flags & EXT4_GET_BLOCKS_NO_LOCK)) | ||
513 | up_read((&EXT4_I(inode)->i_data_sem)); | ||
514 | /* | ||
515 | * Clear EXT4_MAP_FROM_CLUSTER and EXT4_MAP_BOUNDARY flag | ||
516 | * because it shouldn't be marked in es_map->m_flags. | ||
517 | */ | ||
518 | map->m_flags &= ~(EXT4_MAP_FROM_CLUSTER | EXT4_MAP_BOUNDARY); | ||
519 | |||
520 | /* | ||
521 | * We don't check m_len because extent will be collpased in status | ||
522 | * tree. So the m_len might not equal. | ||
523 | */ | ||
524 | if (es_map->m_lblk != map->m_lblk || | ||
525 | es_map->m_flags != map->m_flags || | ||
526 | es_map->m_pblk != map->m_pblk) { | ||
527 | printk("ES cache assertation failed for inode: %lu " | ||
528 | "es_cached ex [%d/%d/%llu/%x] != " | ||
529 | "found ex [%d/%d/%llu/%x] retval %d flags %x\n", | ||
530 | inode->i_ino, es_map->m_lblk, es_map->m_len, | ||
531 | es_map->m_pblk, es_map->m_flags, map->m_lblk, | ||
532 | map->m_len, map->m_pblk, map->m_flags, | ||
533 | retval, flags); | ||
534 | } | ||
535 | } | ||
536 | #endif /* ES_AGGRESSIVE_TEST */ | ||
537 | |||
485 | /* | 538 | /* |
486 | * The ext4_map_blocks() function tries to look up the requested blocks, | 539 | * The ext4_map_blocks() function tries to look up the requested blocks, |
487 | * and returns if the blocks are already mapped. | 540 | * and returns if the blocks are already mapped. |
@@ -509,6 +562,11 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
509 | { | 562 | { |
510 | struct extent_status es; | 563 | struct extent_status es; |
511 | int retval; | 564 | int retval; |
565 | #ifdef ES_AGGRESSIVE_TEST | ||
566 | struct ext4_map_blocks orig_map; | ||
567 | |||
568 | memcpy(&orig_map, map, sizeof(*map)); | ||
569 | #endif | ||
512 | 570 | ||
513 | map->m_flags = 0; | 571 | map->m_flags = 0; |
514 | ext_debug("ext4_map_blocks(): inode %lu, flag %d, max_blocks %u," | 572 | ext_debug("ext4_map_blocks(): inode %lu, flag %d, max_blocks %u," |
@@ -531,6 +589,10 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
531 | } else { | 589 | } else { |
532 | BUG_ON(1); | 590 | BUG_ON(1); |
533 | } | 591 | } |
592 | #ifdef ES_AGGRESSIVE_TEST | ||
593 | ext4_map_blocks_es_recheck(handle, inode, map, | ||
594 | &orig_map, flags); | ||
595 | #endif | ||
534 | goto found; | 596 | goto found; |
535 | } | 597 | } |
536 | 598 | ||
@@ -551,6 +613,15 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
551 | int ret; | 613 | int ret; |
552 | unsigned long long status; | 614 | unsigned long long status; |
553 | 615 | ||
616 | #ifdef ES_AGGRESSIVE_TEST | ||
617 | if (retval != map->m_len) { | ||
618 | printk("ES len assertation failed for inode: %lu " | ||
619 | "retval %d != map->m_len %d " | ||
620 | "in %s (lookup)\n", inode->i_ino, retval, | ||
621 | map->m_len, __func__); | ||
622 | } | ||
623 | #endif | ||
624 | |||
554 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? | 625 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? |
555 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; | 626 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; |
556 | if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && | 627 | if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && |
@@ -643,6 +714,24 @@ found: | |||
643 | int ret; | 714 | int ret; |
644 | unsigned long long status; | 715 | unsigned long long status; |
645 | 716 | ||
717 | #ifdef ES_AGGRESSIVE_TEST | ||
718 | if (retval != map->m_len) { | ||
719 | printk("ES len assertation failed for inode: %lu " | ||
720 | "retval %d != map->m_len %d " | ||
721 | "in %s (allocation)\n", inode->i_ino, retval, | ||
722 | map->m_len, __func__); | ||
723 | } | ||
724 | #endif | ||
725 | |||
726 | /* | ||
727 | * If the extent has been zeroed out, we don't need to update | ||
728 | * extent status tree. | ||
729 | */ | ||
730 | if ((flags & EXT4_GET_BLOCKS_PRE_IO) && | ||
731 | ext4_es_lookup_extent(inode, map->m_lblk, &es)) { | ||
732 | if (ext4_es_is_written(&es)) | ||
733 | goto has_zeroout; | ||
734 | } | ||
646 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? | 735 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? |
647 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; | 736 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; |
648 | if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && | 737 | if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && |
@@ -655,6 +744,7 @@ found: | |||
655 | retval = ret; | 744 | retval = ret; |
656 | } | 745 | } |
657 | 746 | ||
747 | has_zeroout: | ||
658 | up_write((&EXT4_I(inode)->i_data_sem)); | 748 | up_write((&EXT4_I(inode)->i_data_sem)); |
659 | if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { | 749 | if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { |
660 | int ret = check_block_validity(inode, map); | 750 | int ret = check_block_validity(inode, map); |
@@ -1216,6 +1306,55 @@ static int ext4_journalled_write_end(struct file *file, | |||
1216 | } | 1306 | } |
1217 | 1307 | ||
1218 | /* | 1308 | /* |
1309 | * Reserve a metadata for a single block located at lblock | ||
1310 | */ | ||
1311 | static int ext4_da_reserve_metadata(struct inode *inode, ext4_lblk_t lblock) | ||
1312 | { | ||
1313 | int retries = 0; | ||
1314 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); | ||
1315 | struct ext4_inode_info *ei = EXT4_I(inode); | ||
1316 | unsigned int md_needed; | ||
1317 | ext4_lblk_t save_last_lblock; | ||
1318 | int save_len; | ||
1319 | |||
1320 | /* | ||
1321 | * recalculate the amount of metadata blocks to reserve | ||
1322 | * in order to allocate nrblocks | ||
1323 | * worse case is one extent per block | ||
1324 | */ | ||
1325 | repeat: | ||
1326 | spin_lock(&ei->i_block_reservation_lock); | ||
1327 | /* | ||
1328 | * ext4_calc_metadata_amount() has side effects, which we have | ||
1329 | * to be prepared undo if we fail to claim space. | ||
1330 | */ | ||
1331 | save_len = ei->i_da_metadata_calc_len; | ||
1332 | save_last_lblock = ei->i_da_metadata_calc_last_lblock; | ||
1333 | md_needed = EXT4_NUM_B2C(sbi, | ||
1334 | ext4_calc_metadata_amount(inode, lblock)); | ||
1335 | trace_ext4_da_reserve_space(inode, md_needed); | ||
1336 | |||
1337 | /* | ||
1338 | * We do still charge estimated metadata to the sb though; | ||
1339 | * we cannot afford to run out of free blocks. | ||
1340 | */ | ||
1341 | if (ext4_claim_free_clusters(sbi, md_needed, 0)) { | ||
1342 | ei->i_da_metadata_calc_len = save_len; | ||
1343 | ei->i_da_metadata_calc_last_lblock = save_last_lblock; | ||
1344 | spin_unlock(&ei->i_block_reservation_lock); | ||
1345 | if (ext4_should_retry_alloc(inode->i_sb, &retries)) { | ||
1346 | cond_resched(); | ||
1347 | goto repeat; | ||
1348 | } | ||
1349 | return -ENOSPC; | ||
1350 | } | ||
1351 | ei->i_reserved_meta_blocks += md_needed; | ||
1352 | spin_unlock(&ei->i_block_reservation_lock); | ||
1353 | |||
1354 | return 0; /* success */ | ||
1355 | } | ||
1356 | |||
1357 | /* | ||
1219 | * Reserve a single cluster located at lblock | 1358 | * Reserve a single cluster located at lblock |
1220 | */ | 1359 | */ |
1221 | static int ext4_da_reserve_space(struct inode *inode, ext4_lblk_t lblock) | 1360 | static int ext4_da_reserve_space(struct inode *inode, ext4_lblk_t lblock) |
@@ -1263,7 +1402,7 @@ repeat: | |||
1263 | ei->i_da_metadata_calc_last_lblock = save_last_lblock; | 1402 | ei->i_da_metadata_calc_last_lblock = save_last_lblock; |
1264 | spin_unlock(&ei->i_block_reservation_lock); | 1403 | spin_unlock(&ei->i_block_reservation_lock); |
1265 | if (ext4_should_retry_alloc(inode->i_sb, &retries)) { | 1404 | if (ext4_should_retry_alloc(inode->i_sb, &retries)) { |
1266 | yield(); | 1405 | cond_resched(); |
1267 | goto repeat; | 1406 | goto repeat; |
1268 | } | 1407 | } |
1269 | dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1)); | 1408 | dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1)); |
@@ -1768,6 +1907,11 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, | |||
1768 | struct extent_status es; | 1907 | struct extent_status es; |
1769 | int retval; | 1908 | int retval; |
1770 | sector_t invalid_block = ~((sector_t) 0xffff); | 1909 | sector_t invalid_block = ~((sector_t) 0xffff); |
1910 | #ifdef ES_AGGRESSIVE_TEST | ||
1911 | struct ext4_map_blocks orig_map; | ||
1912 | |||
1913 | memcpy(&orig_map, map, sizeof(*map)); | ||
1914 | #endif | ||
1771 | 1915 | ||
1772 | if (invalid_block < ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es)) | 1916 | if (invalid_block < ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es)) |
1773 | invalid_block = ~0; | 1917 | invalid_block = ~0; |
@@ -1809,6 +1953,9 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, | |||
1809 | else | 1953 | else |
1810 | BUG_ON(1); | 1954 | BUG_ON(1); |
1811 | 1955 | ||
1956 | #ifdef ES_AGGRESSIVE_TEST | ||
1957 | ext4_map_blocks_es_recheck(NULL, inode, map, &orig_map, 0); | ||
1958 | #endif | ||
1812 | return retval; | 1959 | return retval; |
1813 | } | 1960 | } |
1814 | 1961 | ||
@@ -1843,8 +1990,11 @@ add_delayed: | |||
1843 | * XXX: __block_prepare_write() unmaps passed block, | 1990 | * XXX: __block_prepare_write() unmaps passed block, |
1844 | * is it OK? | 1991 | * is it OK? |
1845 | */ | 1992 | */ |
1846 | /* If the block was allocated from previously allocated cluster, | 1993 | /* |
1847 | * then we dont need to reserve it again. */ | 1994 | * If the block was allocated from previously allocated cluster, |
1995 | * then we don't need to reserve it again. However we still need | ||
1996 | * to reserve metadata for every block we're going to write. | ||
1997 | */ | ||
1848 | if (!(map->m_flags & EXT4_MAP_FROM_CLUSTER)) { | 1998 | if (!(map->m_flags & EXT4_MAP_FROM_CLUSTER)) { |
1849 | ret = ext4_da_reserve_space(inode, iblock); | 1999 | ret = ext4_da_reserve_space(inode, iblock); |
1850 | if (ret) { | 2000 | if (ret) { |
@@ -1852,6 +2002,13 @@ add_delayed: | |||
1852 | retval = ret; | 2002 | retval = ret; |
1853 | goto out_unlock; | 2003 | goto out_unlock; |
1854 | } | 2004 | } |
2005 | } else { | ||
2006 | ret = ext4_da_reserve_metadata(inode, iblock); | ||
2007 | if (ret) { | ||
2008 | /* not enough space to reserve */ | ||
2009 | retval = ret; | ||
2010 | goto out_unlock; | ||
2011 | } | ||
1855 | } | 2012 | } |
1856 | 2013 | ||
1857 | ret = ext4_es_insert_extent(inode, map->m_lblk, map->m_len, | 2014 | ret = ext4_es_insert_extent(inode, map->m_lblk, map->m_len, |
@@ -1873,6 +2030,15 @@ add_delayed: | |||
1873 | int ret; | 2030 | int ret; |
1874 | unsigned long long status; | 2031 | unsigned long long status; |
1875 | 2032 | ||
2033 | #ifdef ES_AGGRESSIVE_TEST | ||
2034 | if (retval != map->m_len) { | ||
2035 | printk("ES len assertation failed for inode: %lu " | ||
2036 | "retval %d != map->m_len %d " | ||
2037 | "in %s (lookup)\n", inode->i_ino, retval, | ||
2038 | map->m_len, __func__); | ||
2039 | } | ||
2040 | #endif | ||
2041 | |||
1876 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? | 2042 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? |
1877 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; | 2043 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; |
1878 | ret = ext4_es_insert_extent(inode, map->m_lblk, map->m_len, | 2044 | ret = ext4_es_insert_extent(inode, map->m_lblk, map->m_len, |
@@ -2908,8 +3074,8 @@ static int ext4_releasepage(struct page *page, gfp_t wait) | |||
2908 | 3074 | ||
2909 | trace_ext4_releasepage(page); | 3075 | trace_ext4_releasepage(page); |
2910 | 3076 | ||
2911 | WARN_ON(PageChecked(page)); | 3077 | /* Page has dirty journalled data -> cannot release */ |
2912 | if (!page_has_buffers(page)) | 3078 | if (PageChecked(page)) |
2913 | return 0; | 3079 | return 0; |
2914 | if (journal) | 3080 | if (journal) |
2915 | return jbd2_journal_try_to_free_buffers(journal, page, wait); | 3081 | return jbd2_journal_try_to_free_buffers(journal, page, wait); |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 7bb713a46fe4..ee6614bdb639 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2804,8 +2804,8 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
2804 | if (sbi->s_log_groups_per_flex) { | 2804 | if (sbi->s_log_groups_per_flex) { |
2805 | ext4_group_t flex_group = ext4_flex_group(sbi, | 2805 | ext4_group_t flex_group = ext4_flex_group(sbi, |
2806 | ac->ac_b_ex.fe_group); | 2806 | ac->ac_b_ex.fe_group); |
2807 | atomic_sub(ac->ac_b_ex.fe_len, | 2807 | atomic64_sub(ac->ac_b_ex.fe_len, |
2808 | &sbi->s_flex_groups[flex_group].free_clusters); | 2808 | &sbi->s_flex_groups[flex_group].free_clusters); |
2809 | } | 2809 | } |
2810 | 2810 | ||
2811 | err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); | 2811 | err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); |
@@ -3692,11 +3692,7 @@ repeat: | |||
3692 | if (free < needed && busy) { | 3692 | if (free < needed && busy) { |
3693 | busy = 0; | 3693 | busy = 0; |
3694 | ext4_unlock_group(sb, group); | 3694 | ext4_unlock_group(sb, group); |
3695 | /* | 3695 | cond_resched(); |
3696 | * Yield the CPU here so that we don't get soft lockup | ||
3697 | * in non preempt case. | ||
3698 | */ | ||
3699 | yield(); | ||
3700 | goto repeat; | 3696 | goto repeat; |
3701 | } | 3697 | } |
3702 | 3698 | ||
@@ -4246,7 +4242,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, | |||
4246 | ext4_claim_free_clusters(sbi, ar->len, ar->flags)) { | 4242 | ext4_claim_free_clusters(sbi, ar->len, ar->flags)) { |
4247 | 4243 | ||
4248 | /* let others to free the space */ | 4244 | /* let others to free the space */ |
4249 | yield(); | 4245 | cond_resched(); |
4250 | ar->len = ar->len >> 1; | 4246 | ar->len = ar->len >> 1; |
4251 | } | 4247 | } |
4252 | if (!ar->len) { | 4248 | if (!ar->len) { |
@@ -4464,7 +4460,6 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, | |||
4464 | struct buffer_head *bitmap_bh = NULL; | 4460 | struct buffer_head *bitmap_bh = NULL; |
4465 | struct super_block *sb = inode->i_sb; | 4461 | struct super_block *sb = inode->i_sb; |
4466 | struct ext4_group_desc *gdp; | 4462 | struct ext4_group_desc *gdp; |
4467 | unsigned long freed = 0; | ||
4468 | unsigned int overflow; | 4463 | unsigned int overflow; |
4469 | ext4_grpblk_t bit; | 4464 | ext4_grpblk_t bit; |
4470 | struct buffer_head *gd_bh; | 4465 | struct buffer_head *gd_bh; |
@@ -4666,14 +4661,12 @@ do_more: | |||
4666 | 4661 | ||
4667 | if (sbi->s_log_groups_per_flex) { | 4662 | if (sbi->s_log_groups_per_flex) { |
4668 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); | 4663 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); |
4669 | atomic_add(count_clusters, | 4664 | atomic64_add(count_clusters, |
4670 | &sbi->s_flex_groups[flex_group].free_clusters); | 4665 | &sbi->s_flex_groups[flex_group].free_clusters); |
4671 | } | 4666 | } |
4672 | 4667 | ||
4673 | ext4_mb_unload_buddy(&e4b); | 4668 | ext4_mb_unload_buddy(&e4b); |
4674 | 4669 | ||
4675 | freed += count; | ||
4676 | |||
4677 | if (!(flags & EXT4_FREE_BLOCKS_NO_QUOT_UPDATE)) | 4670 | if (!(flags & EXT4_FREE_BLOCKS_NO_QUOT_UPDATE)) |
4678 | dquot_free_block(inode, EXT4_C2B(sbi, count_clusters)); | 4671 | dquot_free_block(inode, EXT4_C2B(sbi, count_clusters)); |
4679 | 4672 | ||
@@ -4811,8 +4804,8 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, | |||
4811 | 4804 | ||
4812 | if (sbi->s_log_groups_per_flex) { | 4805 | if (sbi->s_log_groups_per_flex) { |
4813 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); | 4806 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); |
4814 | atomic_add(EXT4_NUM_B2C(sbi, blocks_freed), | 4807 | atomic64_add(EXT4_NUM_B2C(sbi, blocks_freed), |
4815 | &sbi->s_flex_groups[flex_group].free_clusters); | 4808 | &sbi->s_flex_groups[flex_group].free_clusters); |
4816 | } | 4809 | } |
4817 | 4810 | ||
4818 | ext4_mb_unload_buddy(&e4b); | 4811 | ext4_mb_unload_buddy(&e4b); |
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 4e81d47aa8cb..33e1c086858b 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
@@ -32,16 +32,18 @@ | |||
32 | */ | 32 | */ |
33 | static inline int | 33 | static inline int |
34 | get_ext_path(struct inode *inode, ext4_lblk_t lblock, | 34 | get_ext_path(struct inode *inode, ext4_lblk_t lblock, |
35 | struct ext4_ext_path **path) | 35 | struct ext4_ext_path **orig_path) |
36 | { | 36 | { |
37 | int ret = 0; | 37 | int ret = 0; |
38 | struct ext4_ext_path *path; | ||
38 | 39 | ||
39 | *path = ext4_ext_find_extent(inode, lblock, *path); | 40 | path = ext4_ext_find_extent(inode, lblock, *orig_path); |
40 | if (IS_ERR(*path)) { | 41 | if (IS_ERR(path)) |
41 | ret = PTR_ERR(*path); | 42 | ret = PTR_ERR(path); |
42 | *path = NULL; | 43 | else if (path[ext_depth(inode)].p_ext == NULL) |
43 | } else if ((*path)[ext_depth(inode)].p_ext == NULL) | ||
44 | ret = -ENODATA; | 44 | ret = -ENODATA; |
45 | else | ||
46 | *orig_path = path; | ||
45 | 47 | ||
46 | return ret; | 48 | return ret; |
47 | } | 49 | } |
@@ -611,24 +613,25 @@ mext_check_coverage(struct inode *inode, ext4_lblk_t from, ext4_lblk_t count, | |||
611 | { | 613 | { |
612 | struct ext4_ext_path *path = NULL; | 614 | struct ext4_ext_path *path = NULL; |
613 | struct ext4_extent *ext; | 615 | struct ext4_extent *ext; |
616 | int ret = 0; | ||
614 | ext4_lblk_t last = from + count; | 617 | ext4_lblk_t last = from + count; |
615 | while (from < last) { | 618 | while (from < last) { |
616 | *err = get_ext_path(inode, from, &path); | 619 | *err = get_ext_path(inode, from, &path); |
617 | if (*err) | 620 | if (*err) |
618 | return 0; | 621 | goto out; |
619 | ext = path[ext_depth(inode)].p_ext; | 622 | ext = path[ext_depth(inode)].p_ext; |
620 | if (!ext) { | 623 | if (uninit != ext4_ext_is_uninitialized(ext)) |
621 | ext4_ext_drop_refs(path); | 624 | goto out; |
622 | return 0; | ||
623 | } | ||
624 | if (uninit != ext4_ext_is_uninitialized(ext)) { | ||
625 | ext4_ext_drop_refs(path); | ||
626 | return 0; | ||
627 | } | ||
628 | from += ext4_ext_get_actual_len(ext); | 625 | from += ext4_ext_get_actual_len(ext); |
629 | ext4_ext_drop_refs(path); | 626 | ext4_ext_drop_refs(path); |
630 | } | 627 | } |
631 | return 1; | 628 | ret = 1; |
629 | out: | ||
630 | if (path) { | ||
631 | ext4_ext_drop_refs(path); | ||
632 | kfree(path); | ||
633 | } | ||
634 | return ret; | ||
632 | } | 635 | } |
633 | 636 | ||
634 | /** | 637 | /** |
@@ -666,6 +669,14 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode, | |||
666 | int replaced_count = 0; | 669 | int replaced_count = 0; |
667 | int dext_alen; | 670 | int dext_alen; |
668 | 671 | ||
672 | *err = ext4_es_remove_extent(orig_inode, from, count); | ||
673 | if (*err) | ||
674 | goto out; | ||
675 | |||
676 | *err = ext4_es_remove_extent(donor_inode, from, count); | ||
677 | if (*err) | ||
678 | goto out; | ||
679 | |||
669 | /* Get the original extent for the block "orig_off" */ | 680 | /* Get the original extent for the block "orig_off" */ |
670 | *err = get_ext_path(orig_inode, orig_off, &orig_path); | 681 | *err = get_ext_path(orig_inode, orig_off, &orig_path); |
671 | if (*err) | 682 | if (*err) |
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 809b31003ecc..047a6de04a0a 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
@@ -50,11 +50,21 @@ void ext4_exit_pageio(void) | |||
50 | kmem_cache_destroy(io_page_cachep); | 50 | kmem_cache_destroy(io_page_cachep); |
51 | } | 51 | } |
52 | 52 | ||
53 | void ext4_ioend_wait(struct inode *inode) | 53 | /* |
54 | * This function is called by ext4_evict_inode() to make sure there is | ||
55 | * no more pending I/O completion work left to do. | ||
56 | */ | ||
57 | void ext4_ioend_shutdown(struct inode *inode) | ||
54 | { | 58 | { |
55 | wait_queue_head_t *wq = ext4_ioend_wq(inode); | 59 | wait_queue_head_t *wq = ext4_ioend_wq(inode); |
56 | 60 | ||
57 | wait_event(*wq, (atomic_read(&EXT4_I(inode)->i_ioend_count) == 0)); | 61 | wait_event(*wq, (atomic_read(&EXT4_I(inode)->i_ioend_count) == 0)); |
62 | /* | ||
63 | * We need to make sure the work structure is finished being | ||
64 | * used before we let the inode get destroyed. | ||
65 | */ | ||
66 | if (work_pending(&EXT4_I(inode)->i_unwritten_work)) | ||
67 | cancel_work_sync(&EXT4_I(inode)->i_unwritten_work); | ||
58 | } | 68 | } |
59 | 69 | ||
60 | static void put_io_page(struct ext4_io_page *io_page) | 70 | static void put_io_page(struct ext4_io_page *io_page) |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index b2c8ee56eb98..c169477a62c9 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -1360,8 +1360,8 @@ static void ext4_update_super(struct super_block *sb, | |||
1360 | sbi->s_log_groups_per_flex) { | 1360 | sbi->s_log_groups_per_flex) { |
1361 | ext4_group_t flex_group; | 1361 | ext4_group_t flex_group; |
1362 | flex_group = ext4_flex_group(sbi, group_data[0].group); | 1362 | flex_group = ext4_flex_group(sbi, group_data[0].group); |
1363 | atomic_add(EXT4_NUM_B2C(sbi, free_blocks), | 1363 | atomic64_add(EXT4_NUM_B2C(sbi, free_blocks), |
1364 | &sbi->s_flex_groups[flex_group].free_clusters); | 1364 | &sbi->s_flex_groups[flex_group].free_clusters); |
1365 | atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count, | 1365 | atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count, |
1366 | &sbi->s_flex_groups[flex_group].free_inodes); | 1366 | &sbi->s_flex_groups[flex_group].free_inodes); |
1367 | } | 1367 | } |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index b3818b48f418..5d6d53578124 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1927,8 +1927,8 @@ static int ext4_fill_flex_info(struct super_block *sb) | |||
1927 | flex_group = ext4_flex_group(sbi, i); | 1927 | flex_group = ext4_flex_group(sbi, i); |
1928 | atomic_add(ext4_free_inodes_count(sb, gdp), | 1928 | atomic_add(ext4_free_inodes_count(sb, gdp), |
1929 | &sbi->s_flex_groups[flex_group].free_inodes); | 1929 | &sbi->s_flex_groups[flex_group].free_inodes); |
1930 | atomic_add(ext4_free_group_clusters(sb, gdp), | 1930 | atomic64_add(ext4_free_group_clusters(sb, gdp), |
1931 | &sbi->s_flex_groups[flex_group].free_clusters); | 1931 | &sbi->s_flex_groups[flex_group].free_clusters); |
1932 | atomic_add(ext4_used_dirs_count(sb, gdp), | 1932 | atomic_add(ext4_used_dirs_count(sb, gdp), |
1933 | &sbi->s_flex_groups[flex_group].used_dirs); | 1933 | &sbi->s_flex_groups[flex_group].used_dirs); |
1934 | } | 1934 | } |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index d6ee5aed56b1..325bc019ed88 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -1065,9 +1065,12 @@ out: | |||
1065 | void jbd2_journal_set_triggers(struct buffer_head *bh, | 1065 | void jbd2_journal_set_triggers(struct buffer_head *bh, |
1066 | struct jbd2_buffer_trigger_type *type) | 1066 | struct jbd2_buffer_trigger_type *type) |
1067 | { | 1067 | { |
1068 | struct journal_head *jh = bh2jh(bh); | 1068 | struct journal_head *jh = jbd2_journal_grab_journal_head(bh); |
1069 | 1069 | ||
1070 | if (WARN_ON(!jh)) | ||
1071 | return; | ||
1070 | jh->b_triggers = type; | 1072 | jh->b_triggers = type; |
1073 | jbd2_journal_put_journal_head(jh); | ||
1071 | } | 1074 | } |
1072 | 1075 | ||
1073 | void jbd2_buffer_frozen_trigger(struct journal_head *jh, void *mapped_data, | 1076 | void jbd2_buffer_frozen_trigger(struct journal_head *jh, void *mapped_data, |
@@ -1119,17 +1122,18 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) | |||
1119 | { | 1122 | { |
1120 | transaction_t *transaction = handle->h_transaction; | 1123 | transaction_t *transaction = handle->h_transaction; |
1121 | journal_t *journal = transaction->t_journal; | 1124 | journal_t *journal = transaction->t_journal; |
1122 | struct journal_head *jh = bh2jh(bh); | 1125 | struct journal_head *jh; |
1123 | int ret = 0; | 1126 | int ret = 0; |
1124 | 1127 | ||
1125 | jbd_debug(5, "journal_head %p\n", jh); | ||
1126 | JBUFFER_TRACE(jh, "entry"); | ||
1127 | if (is_handle_aborted(handle)) | 1128 | if (is_handle_aborted(handle)) |
1128 | goto out; | 1129 | goto out; |
1129 | if (!buffer_jbd(bh)) { | 1130 | jh = jbd2_journal_grab_journal_head(bh); |
1131 | if (!jh) { | ||
1130 | ret = -EUCLEAN; | 1132 | ret = -EUCLEAN; |
1131 | goto out; | 1133 | goto out; |
1132 | } | 1134 | } |
1135 | jbd_debug(5, "journal_head %p\n", jh); | ||
1136 | JBUFFER_TRACE(jh, "entry"); | ||
1133 | 1137 | ||
1134 | jbd_lock_bh_state(bh); | 1138 | jbd_lock_bh_state(bh); |
1135 | 1139 | ||
@@ -1220,6 +1224,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) | |||
1220 | spin_unlock(&journal->j_list_lock); | 1224 | spin_unlock(&journal->j_list_lock); |
1221 | out_unlock_bh: | 1225 | out_unlock_bh: |
1222 | jbd_unlock_bh_state(bh); | 1226 | jbd_unlock_bh_state(bh); |
1227 | jbd2_journal_put_journal_head(jh); | ||
1223 | out: | 1228 | out: |
1224 | JBUFFER_TRACE(jh, "exit"); | 1229 | JBUFFER_TRACE(jh, "exit"); |
1225 | WARN_ON(ret); /* All errors are bugs, so dump the stack */ | 1230 | WARN_ON(ret); /* All errors are bugs, so dump the stack */ |
diff --git a/fs/nfs/blocklayout/blocklayoutdm.c b/fs/nfs/blocklayout/blocklayoutdm.c index 737d839bc17b..6fc7b5cae92b 100644 --- a/fs/nfs/blocklayout/blocklayoutdm.c +++ b/fs/nfs/blocklayout/blocklayoutdm.c | |||
@@ -55,7 +55,8 @@ static void dev_remove(struct net *net, dev_t dev) | |||
55 | 55 | ||
56 | bl_pipe_msg.bl_wq = &nn->bl_wq; | 56 | bl_pipe_msg.bl_wq = &nn->bl_wq; |
57 | memset(msg, 0, sizeof(*msg)); | 57 | memset(msg, 0, sizeof(*msg)); |
58 | msg->data = kzalloc(1 + sizeof(bl_umount_request), GFP_NOFS); | 58 | msg->len = sizeof(bl_msg) + bl_msg.totallen; |
59 | msg->data = kzalloc(msg->len, GFP_NOFS); | ||
59 | if (!msg->data) | 60 | if (!msg->data) |
60 | goto out; | 61 | goto out; |
61 | 62 | ||
@@ -66,7 +67,6 @@ static void dev_remove(struct net *net, dev_t dev) | |||
66 | memcpy(msg->data, &bl_msg, sizeof(bl_msg)); | 67 | memcpy(msg->data, &bl_msg, sizeof(bl_msg)); |
67 | dataptr = (uint8_t *) msg->data; | 68 | dataptr = (uint8_t *) msg->data; |
68 | memcpy(&dataptr[sizeof(bl_msg)], &bl_umount_request, sizeof(bl_umount_request)); | 69 | memcpy(&dataptr[sizeof(bl_msg)], &bl_umount_request, sizeof(bl_umount_request)); |
69 | msg->len = sizeof(bl_msg) + bl_msg.totallen; | ||
70 | 70 | ||
71 | add_wait_queue(&nn->bl_wq, &wq); | 71 | add_wait_queue(&nn->bl_wq, &wq); |
72 | if (rpc_queue_upcall(nn->bl_device_pipe, msg) < 0) { | 72 | if (rpc_queue_upcall(nn->bl_device_pipe, msg) < 0) { |
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index dc0f98dfa717..c516da5873fd 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
@@ -726,9 +726,9 @@ out1: | |||
726 | return ret; | 726 | return ret; |
727 | } | 727 | } |
728 | 728 | ||
729 | static int nfs_idmap_instantiate(struct key *key, struct key *authkey, char *data) | 729 | static int nfs_idmap_instantiate(struct key *key, struct key *authkey, char *data, size_t datalen) |
730 | { | 730 | { |
731 | return key_instantiate_and_link(key, data, strlen(data) + 1, | 731 | return key_instantiate_and_link(key, data, datalen, |
732 | id_resolver_cache->thread_keyring, | 732 | id_resolver_cache->thread_keyring, |
733 | authkey); | 733 | authkey); |
734 | } | 734 | } |
@@ -738,6 +738,7 @@ static int nfs_idmap_read_and_verify_message(struct idmap_msg *im, | |||
738 | struct key *key, struct key *authkey) | 738 | struct key *key, struct key *authkey) |
739 | { | 739 | { |
740 | char id_str[NFS_UINT_MAXLEN]; | 740 | char id_str[NFS_UINT_MAXLEN]; |
741 | size_t len; | ||
741 | int ret = -ENOKEY; | 742 | int ret = -ENOKEY; |
742 | 743 | ||
743 | /* ret = -ENOKEY */ | 744 | /* ret = -ENOKEY */ |
@@ -747,13 +748,15 @@ static int nfs_idmap_read_and_verify_message(struct idmap_msg *im, | |||
747 | case IDMAP_CONV_NAMETOID: | 748 | case IDMAP_CONV_NAMETOID: |
748 | if (strcmp(upcall->im_name, im->im_name) != 0) | 749 | if (strcmp(upcall->im_name, im->im_name) != 0) |
749 | break; | 750 | break; |
750 | sprintf(id_str, "%d", im->im_id); | 751 | /* Note: here we store the NUL terminator too */ |
751 | ret = nfs_idmap_instantiate(key, authkey, id_str); | 752 | len = sprintf(id_str, "%d", im->im_id) + 1; |
753 | ret = nfs_idmap_instantiate(key, authkey, id_str, len); | ||
752 | break; | 754 | break; |
753 | case IDMAP_CONV_IDTONAME: | 755 | case IDMAP_CONV_IDTONAME: |
754 | if (upcall->im_id != im->im_id) | 756 | if (upcall->im_id != im->im_id) |
755 | break; | 757 | break; |
756 | ret = nfs_idmap_instantiate(key, authkey, im->im_name); | 758 | len = strlen(im->im_name); |
759 | ret = nfs_idmap_instantiate(key, authkey, im->im_name, len); | ||
757 | break; | 760 | break; |
758 | default: | 761 | default: |
759 | ret = -EINVAL; | 762 | ret = -EINVAL; |
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index 49eeb044c109..4fb234d3aefb 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -129,7 +129,6 @@ static void filelayout_fenceme(struct inode *inode, struct pnfs_layout_hdr *lo) | |||
129 | { | 129 | { |
130 | if (!test_and_clear_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) | 130 | if (!test_and_clear_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) |
131 | return; | 131 | return; |
132 | clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(inode)->flags); | ||
133 | pnfs_return_layout(inode); | 132 | pnfs_return_layout(inode); |
134 | } | 133 | } |
135 | 134 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b2671cb0f901..26431cf62ddb 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2632,7 +2632,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
2632 | int status; | 2632 | int status; |
2633 | 2633 | ||
2634 | if (pnfs_ld_layoutret_on_setattr(inode)) | 2634 | if (pnfs_ld_layoutret_on_setattr(inode)) |
2635 | pnfs_return_layout(inode); | 2635 | pnfs_commit_and_return_layout(inode); |
2636 | 2636 | ||
2637 | nfs_fattr_init(fattr); | 2637 | nfs_fattr_init(fattr); |
2638 | 2638 | ||
@@ -6416,22 +6416,8 @@ nfs4_layoutcommit_done(struct rpc_task *task, void *calldata) | |||
6416 | static void nfs4_layoutcommit_release(void *calldata) | 6416 | static void nfs4_layoutcommit_release(void *calldata) |
6417 | { | 6417 | { |
6418 | struct nfs4_layoutcommit_data *data = calldata; | 6418 | struct nfs4_layoutcommit_data *data = calldata; |
6419 | struct pnfs_layout_segment *lseg, *tmp; | ||
6420 | unsigned long *bitlock = &NFS_I(data->args.inode)->flags; | ||
6421 | 6419 | ||
6422 | pnfs_cleanup_layoutcommit(data); | 6420 | pnfs_cleanup_layoutcommit(data); |
6423 | /* Matched by references in pnfs_set_layoutcommit */ | ||
6424 | list_for_each_entry_safe(lseg, tmp, &data->lseg_list, pls_lc_list) { | ||
6425 | list_del_init(&lseg->pls_lc_list); | ||
6426 | if (test_and_clear_bit(NFS_LSEG_LAYOUTCOMMIT, | ||
6427 | &lseg->pls_flags)) | ||
6428 | pnfs_put_lseg(lseg); | ||
6429 | } | ||
6430 | |||
6431 | clear_bit_unlock(NFS_INO_LAYOUTCOMMITTING, bitlock); | ||
6432 | smp_mb__after_clear_bit(); | ||
6433 | wake_up_bit(bitlock, NFS_INO_LAYOUTCOMMITTING); | ||
6434 | |||
6435 | put_rpccred(data->cred); | 6421 | put_rpccred(data->cred); |
6436 | kfree(data); | 6422 | kfree(data); |
6437 | } | 6423 | } |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 48ac5aad6258..4bdffe0ba025 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -417,6 +417,16 @@ should_free_lseg(struct pnfs_layout_range *lseg_range, | |||
417 | lo_seg_intersecting(lseg_range, recall_range); | 417 | lo_seg_intersecting(lseg_range, recall_range); |
418 | } | 418 | } |
419 | 419 | ||
420 | static bool pnfs_lseg_dec_and_remove_zero(struct pnfs_layout_segment *lseg, | ||
421 | struct list_head *tmp_list) | ||
422 | { | ||
423 | if (!atomic_dec_and_test(&lseg->pls_refcount)) | ||
424 | return false; | ||
425 | pnfs_layout_remove_lseg(lseg->pls_layout, lseg); | ||
426 | list_add(&lseg->pls_list, tmp_list); | ||
427 | return true; | ||
428 | } | ||
429 | |||
420 | /* Returns 1 if lseg is removed from list, 0 otherwise */ | 430 | /* Returns 1 if lseg is removed from list, 0 otherwise */ |
421 | static int mark_lseg_invalid(struct pnfs_layout_segment *lseg, | 431 | static int mark_lseg_invalid(struct pnfs_layout_segment *lseg, |
422 | struct list_head *tmp_list) | 432 | struct list_head *tmp_list) |
@@ -430,11 +440,8 @@ static int mark_lseg_invalid(struct pnfs_layout_segment *lseg, | |||
430 | */ | 440 | */ |
431 | dprintk("%s: lseg %p ref %d\n", __func__, lseg, | 441 | dprintk("%s: lseg %p ref %d\n", __func__, lseg, |
432 | atomic_read(&lseg->pls_refcount)); | 442 | atomic_read(&lseg->pls_refcount)); |
433 | if (atomic_dec_and_test(&lseg->pls_refcount)) { | 443 | if (pnfs_lseg_dec_and_remove_zero(lseg, tmp_list)) |
434 | pnfs_layout_remove_lseg(lseg->pls_layout, lseg); | ||
435 | list_add(&lseg->pls_list, tmp_list); | ||
436 | rv = 1; | 444 | rv = 1; |
437 | } | ||
438 | } | 445 | } |
439 | return rv; | 446 | return rv; |
440 | } | 447 | } |
@@ -777,6 +784,21 @@ send_layoutget(struct pnfs_layout_hdr *lo, | |||
777 | return lseg; | 784 | return lseg; |
778 | } | 785 | } |
779 | 786 | ||
787 | static void pnfs_clear_layoutcommit(struct inode *inode, | ||
788 | struct list_head *head) | ||
789 | { | ||
790 | struct nfs_inode *nfsi = NFS_I(inode); | ||
791 | struct pnfs_layout_segment *lseg, *tmp; | ||
792 | |||
793 | if (!test_and_clear_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)) | ||
794 | return; | ||
795 | list_for_each_entry_safe(lseg, tmp, &nfsi->layout->plh_segs, pls_list) { | ||
796 | if (!test_and_clear_bit(NFS_LSEG_LAYOUTCOMMIT, &lseg->pls_flags)) | ||
797 | continue; | ||
798 | pnfs_lseg_dec_and_remove_zero(lseg, head); | ||
799 | } | ||
800 | } | ||
801 | |||
780 | /* | 802 | /* |
781 | * Initiates a LAYOUTRETURN(FILE), and removes the pnfs_layout_hdr | 803 | * Initiates a LAYOUTRETURN(FILE), and removes the pnfs_layout_hdr |
782 | * when the layout segment list is empty. | 804 | * when the layout segment list is empty. |
@@ -808,6 +830,7 @@ _pnfs_return_layout(struct inode *ino) | |||
808 | /* Reference matched in nfs4_layoutreturn_release */ | 830 | /* Reference matched in nfs4_layoutreturn_release */ |
809 | pnfs_get_layout_hdr(lo); | 831 | pnfs_get_layout_hdr(lo); |
810 | empty = list_empty(&lo->plh_segs); | 832 | empty = list_empty(&lo->plh_segs); |
833 | pnfs_clear_layoutcommit(ino, &tmp_list); | ||
811 | pnfs_mark_matching_lsegs_invalid(lo, &tmp_list, NULL); | 834 | pnfs_mark_matching_lsegs_invalid(lo, &tmp_list, NULL); |
812 | /* Don't send a LAYOUTRETURN if list was initially empty */ | 835 | /* Don't send a LAYOUTRETURN if list was initially empty */ |
813 | if (empty) { | 836 | if (empty) { |
@@ -820,8 +843,6 @@ _pnfs_return_layout(struct inode *ino) | |||
820 | spin_unlock(&ino->i_lock); | 843 | spin_unlock(&ino->i_lock); |
821 | pnfs_free_lseg_list(&tmp_list); | 844 | pnfs_free_lseg_list(&tmp_list); |
822 | 845 | ||
823 | WARN_ON(test_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)); | ||
824 | |||
825 | lrp = kzalloc(sizeof(*lrp), GFP_KERNEL); | 846 | lrp = kzalloc(sizeof(*lrp), GFP_KERNEL); |
826 | if (unlikely(lrp == NULL)) { | 847 | if (unlikely(lrp == NULL)) { |
827 | status = -ENOMEM; | 848 | status = -ENOMEM; |
@@ -845,6 +866,33 @@ out: | |||
845 | } | 866 | } |
846 | EXPORT_SYMBOL_GPL(_pnfs_return_layout); | 867 | EXPORT_SYMBOL_GPL(_pnfs_return_layout); |
847 | 868 | ||
869 | int | ||
870 | pnfs_commit_and_return_layout(struct inode *inode) | ||
871 | { | ||
872 | struct pnfs_layout_hdr *lo; | ||
873 | int ret; | ||
874 | |||
875 | spin_lock(&inode->i_lock); | ||
876 | lo = NFS_I(inode)->layout; | ||
877 | if (lo == NULL) { | ||
878 | spin_unlock(&inode->i_lock); | ||
879 | return 0; | ||
880 | } | ||
881 | pnfs_get_layout_hdr(lo); | ||
882 | /* Block new layoutgets and read/write to ds */ | ||
883 | lo->plh_block_lgets++; | ||
884 | spin_unlock(&inode->i_lock); | ||
885 | filemap_fdatawait(inode->i_mapping); | ||
886 | ret = pnfs_layoutcommit_inode(inode, true); | ||
887 | if (ret == 0) | ||
888 | ret = _pnfs_return_layout(inode); | ||
889 | spin_lock(&inode->i_lock); | ||
890 | lo->plh_block_lgets--; | ||
891 | spin_unlock(&inode->i_lock); | ||
892 | pnfs_put_layout_hdr(lo); | ||
893 | return ret; | ||
894 | } | ||
895 | |||
848 | bool pnfs_roc(struct inode *ino) | 896 | bool pnfs_roc(struct inode *ino) |
849 | { | 897 | { |
850 | struct pnfs_layout_hdr *lo; | 898 | struct pnfs_layout_hdr *lo; |
@@ -1458,7 +1506,6 @@ static void pnfs_ld_handle_write_error(struct nfs_write_data *data) | |||
1458 | dprintk("pnfs write error = %d\n", hdr->pnfs_error); | 1506 | dprintk("pnfs write error = %d\n", hdr->pnfs_error); |
1459 | if (NFS_SERVER(hdr->inode)->pnfs_curr_ld->flags & | 1507 | if (NFS_SERVER(hdr->inode)->pnfs_curr_ld->flags & |
1460 | PNFS_LAYOUTRET_ON_ERROR) { | 1508 | PNFS_LAYOUTRET_ON_ERROR) { |
1461 | clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(hdr->inode)->flags); | ||
1462 | pnfs_return_layout(hdr->inode); | 1509 | pnfs_return_layout(hdr->inode); |
1463 | } | 1510 | } |
1464 | if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) | 1511 | if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) |
@@ -1613,7 +1660,6 @@ static void pnfs_ld_handle_read_error(struct nfs_read_data *data) | |||
1613 | dprintk("pnfs read error = %d\n", hdr->pnfs_error); | 1660 | dprintk("pnfs read error = %d\n", hdr->pnfs_error); |
1614 | if (NFS_SERVER(hdr->inode)->pnfs_curr_ld->flags & | 1661 | if (NFS_SERVER(hdr->inode)->pnfs_curr_ld->flags & |
1615 | PNFS_LAYOUTRET_ON_ERROR) { | 1662 | PNFS_LAYOUTRET_ON_ERROR) { |
1616 | clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(hdr->inode)->flags); | ||
1617 | pnfs_return_layout(hdr->inode); | 1663 | pnfs_return_layout(hdr->inode); |
1618 | } | 1664 | } |
1619 | if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) | 1665 | if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) |
@@ -1746,11 +1792,27 @@ static void pnfs_list_write_lseg(struct inode *inode, struct list_head *listp) | |||
1746 | 1792 | ||
1747 | list_for_each_entry(lseg, &NFS_I(inode)->layout->plh_segs, pls_list) { | 1793 | list_for_each_entry(lseg, &NFS_I(inode)->layout->plh_segs, pls_list) { |
1748 | if (lseg->pls_range.iomode == IOMODE_RW && | 1794 | if (lseg->pls_range.iomode == IOMODE_RW && |
1749 | test_bit(NFS_LSEG_LAYOUTCOMMIT, &lseg->pls_flags)) | 1795 | test_and_clear_bit(NFS_LSEG_LAYOUTCOMMIT, &lseg->pls_flags)) |
1750 | list_add(&lseg->pls_lc_list, listp); | 1796 | list_add(&lseg->pls_lc_list, listp); |
1751 | } | 1797 | } |
1752 | } | 1798 | } |
1753 | 1799 | ||
1800 | static void pnfs_list_write_lseg_done(struct inode *inode, struct list_head *listp) | ||
1801 | { | ||
1802 | struct pnfs_layout_segment *lseg, *tmp; | ||
1803 | unsigned long *bitlock = &NFS_I(inode)->flags; | ||
1804 | |||
1805 | /* Matched by references in pnfs_set_layoutcommit */ | ||
1806 | list_for_each_entry_safe(lseg, tmp, listp, pls_lc_list) { | ||
1807 | list_del_init(&lseg->pls_lc_list); | ||
1808 | pnfs_put_lseg(lseg); | ||
1809 | } | ||
1810 | |||
1811 | clear_bit_unlock(NFS_INO_LAYOUTCOMMITTING, bitlock); | ||
1812 | smp_mb__after_clear_bit(); | ||
1813 | wake_up_bit(bitlock, NFS_INO_LAYOUTCOMMITTING); | ||
1814 | } | ||
1815 | |||
1754 | void pnfs_set_lo_fail(struct pnfs_layout_segment *lseg) | 1816 | void pnfs_set_lo_fail(struct pnfs_layout_segment *lseg) |
1755 | { | 1817 | { |
1756 | pnfs_layout_io_set_failed(lseg->pls_layout, lseg->pls_range.iomode); | 1818 | pnfs_layout_io_set_failed(lseg->pls_layout, lseg->pls_range.iomode); |
@@ -1795,6 +1857,7 @@ void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data) | |||
1795 | 1857 | ||
1796 | if (nfss->pnfs_curr_ld->cleanup_layoutcommit) | 1858 | if (nfss->pnfs_curr_ld->cleanup_layoutcommit) |
1797 | nfss->pnfs_curr_ld->cleanup_layoutcommit(data); | 1859 | nfss->pnfs_curr_ld->cleanup_layoutcommit(data); |
1860 | pnfs_list_write_lseg_done(data->args.inode, &data->lseg_list); | ||
1798 | } | 1861 | } |
1799 | 1862 | ||
1800 | /* | 1863 | /* |
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 94ba80417748..f5f8a470a647 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -219,6 +219,7 @@ void pnfs_set_layoutcommit(struct nfs_write_data *wdata); | |||
219 | void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data); | 219 | void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data); |
220 | int pnfs_layoutcommit_inode(struct inode *inode, bool sync); | 220 | int pnfs_layoutcommit_inode(struct inode *inode, bool sync); |
221 | int _pnfs_return_layout(struct inode *); | 221 | int _pnfs_return_layout(struct inode *); |
222 | int pnfs_commit_and_return_layout(struct inode *); | ||
222 | void pnfs_ld_write_done(struct nfs_write_data *); | 223 | void pnfs_ld_write_done(struct nfs_write_data *); |
223 | void pnfs_ld_read_done(struct nfs_read_data *); | 224 | void pnfs_ld_read_done(struct nfs_read_data *); |
224 | struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino, | 225 | struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino, |
@@ -407,6 +408,11 @@ static inline int pnfs_return_layout(struct inode *ino) | |||
407 | return 0; | 408 | return 0; |
408 | } | 409 | } |
409 | 410 | ||
411 | static inline int pnfs_commit_and_return_layout(struct inode *inode) | ||
412 | { | ||
413 | return 0; | ||
414 | } | ||
415 | |||
410 | static inline bool | 416 | static inline bool |
411 | pnfs_ld_layoutret_on_setattr(struct inode *inode) | 417 | pnfs_ld_layoutret_on_setattr(struct inode *inode) |
412 | { | 418 | { |
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index 62c1ee128aeb..ca05f6dc3544 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c | |||
@@ -102,7 +102,8 @@ nfsd_reply_cache_free_locked(struct svc_cacherep *rp) | |||
102 | { | 102 | { |
103 | if (rp->c_type == RC_REPLBUFF) | 103 | if (rp->c_type == RC_REPLBUFF) |
104 | kfree(rp->c_replvec.iov_base); | 104 | kfree(rp->c_replvec.iov_base); |
105 | hlist_del(&rp->c_hash); | 105 | if (!hlist_unhashed(&rp->c_hash)) |
106 | hlist_del(&rp->c_hash); | ||
106 | list_del(&rp->c_lru); | 107 | list_del(&rp->c_lru); |
107 | --num_drc_entries; | 108 | --num_drc_entries; |
108 | kmem_cache_free(drc_slab, rp); | 109 | kmem_cache_free(drc_slab, rp); |
@@ -118,6 +119,10 @@ nfsd_reply_cache_free(struct svc_cacherep *rp) | |||
118 | 119 | ||
119 | int nfsd_reply_cache_init(void) | 120 | int nfsd_reply_cache_init(void) |
120 | { | 121 | { |
122 | INIT_LIST_HEAD(&lru_head); | ||
123 | max_drc_entries = nfsd_cache_size_limit(); | ||
124 | num_drc_entries = 0; | ||
125 | |||
121 | register_shrinker(&nfsd_reply_cache_shrinker); | 126 | register_shrinker(&nfsd_reply_cache_shrinker); |
122 | drc_slab = kmem_cache_create("nfsd_drc", sizeof(struct svc_cacherep), | 127 | drc_slab = kmem_cache_create("nfsd_drc", sizeof(struct svc_cacherep), |
123 | 0, 0, NULL); | 128 | 0, 0, NULL); |
@@ -128,10 +133,6 @@ int nfsd_reply_cache_init(void) | |||
128 | if (!cache_hash) | 133 | if (!cache_hash) |
129 | goto out_nomem; | 134 | goto out_nomem; |
130 | 135 | ||
131 | INIT_LIST_HEAD(&lru_head); | ||
132 | max_drc_entries = nfsd_cache_size_limit(); | ||
133 | num_drc_entries = 0; | ||
134 | |||
135 | return 0; | 136 | return 0; |
136 | out_nomem: | 137 | out_nomem: |
137 | printk(KERN_ERR "nfsd: failed to allocate reply cache\n"); | 138 | printk(KERN_ERR "nfsd: failed to allocate reply cache\n"); |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 2a7eb536de0b..2b2e2396a869 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1013,6 +1013,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
1013 | int host_err; | 1013 | int host_err; |
1014 | int stable = *stablep; | 1014 | int stable = *stablep; |
1015 | int use_wgather; | 1015 | int use_wgather; |
1016 | loff_t pos = offset; | ||
1016 | 1017 | ||
1017 | dentry = file->f_path.dentry; | 1018 | dentry = file->f_path.dentry; |
1018 | inode = dentry->d_inode; | 1019 | inode = dentry->d_inode; |
@@ -1025,7 +1026,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
1025 | 1026 | ||
1026 | /* Write the data. */ | 1027 | /* Write the data. */ |
1027 | oldfs = get_fs(); set_fs(KERNEL_DS); | 1028 | oldfs = get_fs(); set_fs(KERNEL_DS); |
1028 | host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset); | 1029 | host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &pos); |
1029 | set_fs(oldfs); | 1030 | set_fs(oldfs); |
1030 | if (host_err < 0) | 1031 | if (host_err < 0) |
1031 | goto out_nfserr; | 1032 | goto out_nfserr; |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index a86aebc9ba7c..869116c2afbe 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -446,9 +446,10 @@ static const struct file_operations proc_reg_file_ops_no_compat = { | |||
446 | 446 | ||
447 | struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) | 447 | struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) |
448 | { | 448 | { |
449 | struct inode *inode = iget_locked(sb, de->low_ino); | 449 | struct inode *inode = new_inode_pseudo(sb); |
450 | 450 | ||
451 | if (inode && (inode->i_state & I_NEW)) { | 451 | if (inode) { |
452 | inode->i_ino = de->low_ino; | ||
452 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 453 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
453 | PROC_I(inode)->pde = de; | 454 | PROC_I(inode)->pde = de; |
454 | 455 | ||
@@ -476,7 +477,6 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) | |||
476 | inode->i_fop = de->proc_fops; | 477 | inode->i_fop = de->proc_fops; |
477 | } | 478 | } |
478 | } | 479 | } |
479 | unlock_new_inode(inode); | ||
480 | } else | 480 | } else |
481 | pde_put(de); | 481 | pde_put(de); |
482 | return inode; | 482 | return inode; |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index a386b0b654cc..918e8fe2f5e9 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -581,7 +581,11 @@ | |||
581 | {0x1002, 0x9908, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 581 | {0x1002, 0x9908, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
582 | {0x1002, 0x9909, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 582 | {0x1002, 0x9909, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
583 | {0x1002, 0x990A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 583 | {0x1002, 0x990A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
584 | {0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 584 | {0x1002, 0x990B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
585 | {0x1002, 0x990C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
586 | {0x1002, 0x990D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
587 | {0x1002, 0x990E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
588 | {0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
585 | {0x1002, 0x9910, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 589 | {0x1002, 0x9910, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
586 | {0x1002, 0x9913, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 590 | {0x1002, 0x9913, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
587 | {0x1002, 0x9917, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 591 | {0x1002, 0x9917, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
@@ -592,6 +596,13 @@ | |||
592 | {0x1002, 0x9992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 596 | {0x1002, 0x9992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
593 | {0x1002, 0x9993, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 597 | {0x1002, 0x9993, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
594 | {0x1002, 0x9994, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 598 | {0x1002, 0x9994, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
599 | {0x1002, 0x9995, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
600 | {0x1002, 0x9996, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
601 | {0x1002, 0x9997, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
602 | {0x1002, 0x9998, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
603 | {0x1002, 0x9999, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
604 | {0x1002, 0x999A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
605 | {0x1002, 0x999B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
595 | {0x1002, 0x99A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 606 | {0x1002, 0x99A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
596 | {0x1002, 0x99A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 607 | {0x1002, 0x99A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
597 | {0x1002, 0x99A4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 608 | {0x1002, 0x99A4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
diff --git a/include/linux/edac.h b/include/linux/edac.h index 4fd4999ccb5b..0b763276f619 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h | |||
@@ -561,7 +561,6 @@ struct csrow_info { | |||
561 | 561 | ||
562 | u32 ue_count; /* Uncorrectable Errors for this csrow */ | 562 | u32 ue_count; /* Uncorrectable Errors for this csrow */ |
563 | u32 ce_count; /* Correctable Errors for this csrow */ | 563 | u32 ce_count; /* Correctable Errors for this csrow */ |
564 | u32 nr_pages; /* combined pages count of all channels */ | ||
565 | 564 | ||
566 | struct mem_ctl_info *mci; /* the parent */ | 565 | struct mem_ctl_info *mci; /* the parent */ |
567 | 566 | ||
@@ -676,11 +675,11 @@ struct mem_ctl_info { | |||
676 | * sees memory sticks ("dimms"), and the ones that sees memory ranks. | 675 | * sees memory sticks ("dimms"), and the ones that sees memory ranks. |
677 | * All old memory controllers enumerate memories per rank, but most | 676 | * All old memory controllers enumerate memories per rank, but most |
678 | * of the recent drivers enumerate memories per DIMM, instead. | 677 | * of the recent drivers enumerate memories per DIMM, instead. |
679 | * When the memory controller is per rank, mem_is_per_rank is true. | 678 | * When the memory controller is per rank, csbased is true. |
680 | */ | 679 | */ |
681 | unsigned n_layers; | 680 | unsigned n_layers; |
682 | struct edac_mc_layer *layers; | 681 | struct edac_mc_layer *layers; |
683 | bool mem_is_per_rank; | 682 | bool csbased; |
684 | 683 | ||
685 | /* | 684 | /* |
686 | * DIMM info. Will eventually remove the entire csrows_info some day | 685 | * DIMM info. Will eventually remove the entire csrows_info some day |
@@ -741,8 +740,6 @@ struct mem_ctl_info { | |||
741 | u32 fake_inject_ue; | 740 | u32 fake_inject_ue; |
742 | u16 fake_inject_count; | 741 | u16 fake_inject_count; |
743 | #endif | 742 | #endif |
744 | __u8 csbased : 1, /* csrow-based memory controller */ | ||
745 | __resv : 7; | ||
746 | }; | 743 | }; |
747 | 744 | ||
748 | #endif | 745 | #endif |
diff --git a/include/linux/hash.h b/include/linux/hash.h index 61c97ae22e01..f09a0ae4d858 100644 --- a/include/linux/hash.h +++ b/include/linux/hash.h | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <asm/types.h> | 17 | #include <asm/types.h> |
18 | #include <linux/compiler.h> | ||
18 | 19 | ||
19 | /* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ | 20 | /* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ |
20 | #define GOLDEN_RATIO_PRIME_32 0x9e370001UL | 21 | #define GOLDEN_RATIO_PRIME_32 0x9e370001UL |
@@ -31,7 +32,7 @@ | |||
31 | #error Wordsize not 32 or 64 | 32 | #error Wordsize not 32 or 64 |
32 | #endif | 33 | #endif |
33 | 34 | ||
34 | static inline u64 hash_64(u64 val, unsigned int bits) | 35 | static __always_inline u64 hash_64(u64 val, unsigned int bits) |
35 | { | 36 | { |
36 | u64 hash = val; | 37 | u64 hash = val; |
37 | 38 | ||
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h index f5dbce50466e..66017028dcb3 100644 --- a/include/linux/irq_work.h +++ b/include/linux/irq_work.h | |||
@@ -37,7 +37,7 @@ void irq_work_sync(struct irq_work *work); | |||
37 | #ifdef CONFIG_IRQ_WORK | 37 | #ifdef CONFIG_IRQ_WORK |
38 | bool irq_work_needs_cpu(void); | 38 | bool irq_work_needs_cpu(void); |
39 | #else | 39 | #else |
40 | static bool irq_work_needs_cpu(void) { return false; } | 40 | static inline bool irq_work_needs_cpu(void) { return false; } |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #endif /* _LINUX_IRQ_WORK_H */ | 43 | #endif /* _LINUX_IRQ_WORK_H */ |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 80d36874689b..79fdd80a42d4 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -390,7 +390,6 @@ extern struct pid *session_of_pgrp(struct pid *pgrp); | |||
390 | unsigned long int_sqrt(unsigned long); | 390 | unsigned long int_sqrt(unsigned long); |
391 | 391 | ||
392 | extern void bust_spinlocks(int yes); | 392 | extern void bust_spinlocks(int yes); |
393 | extern void wake_up_klogd(void); | ||
394 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ | 393 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ |
395 | extern int panic_timeout; | 394 | extern int panic_timeout; |
396 | extern int panic_on_oops; | 395 | extern int panic_on_oops; |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index ede274957e05..c74092eebf5c 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -527,7 +527,7 @@ static inline int zone_is_oom_locked(const struct zone *zone) | |||
527 | return test_bit(ZONE_OOM_LOCKED, &zone->flags); | 527 | return test_bit(ZONE_OOM_LOCKED, &zone->flags); |
528 | } | 528 | } |
529 | 529 | ||
530 | static inline unsigned zone_end_pfn(const struct zone *zone) | 530 | static inline unsigned long zone_end_pfn(const struct zone *zone) |
531 | { | 531 | { |
532 | return zone->zone_start_pfn + zone->spanned_pages; | 532 | return zone->zone_start_pfn + zone->spanned_pages; |
533 | } | 533 | } |
diff --git a/include/linux/mxsfb.h b/include/linux/mxsfb.h index f14943d55315..f80af8674342 100644 --- a/include/linux/mxsfb.h +++ b/include/linux/mxsfb.h | |||
@@ -24,8 +24,8 @@ | |||
24 | #define STMLCDIF_18BIT 2 /** pixel data bus to the display is of 18 bit width */ | 24 | #define STMLCDIF_18BIT 2 /** pixel data bus to the display is of 18 bit width */ |
25 | #define STMLCDIF_24BIT 3 /** pixel data bus to the display is of 24 bit width */ | 25 | #define STMLCDIF_24BIT 3 /** pixel data bus to the display is of 24 bit width */ |
26 | 26 | ||
27 | #define FB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6) | 27 | #define MXSFB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6) |
28 | #define FB_SYNC_DOTCLK_FAILING_ACT (1 << 7) /* failing/negtive edge sampling */ | 28 | #define MXSFB_SYNC_DOTCLK_FAILING_ACT (1 << 7) /* failing/negtive edge sampling */ |
29 | 29 | ||
30 | struct mxsfb_platform_data { | 30 | struct mxsfb_platform_data { |
31 | struct fb_videomode *mode_list; | 31 | struct fb_videomode *mode_list; |
@@ -44,6 +44,9 @@ struct mxsfb_platform_data { | |||
44 | * allocated. If specified,fb_size must also be specified. | 44 | * allocated. If specified,fb_size must also be specified. |
45 | * fb_phys must be unused by Linux. | 45 | * fb_phys must be unused by Linux. |
46 | */ | 46 | */ |
47 | u32 sync; /* sync mask, contains MXSFB specifics not | ||
48 | * carried in fb_info->var.sync | ||
49 | */ | ||
47 | }; | 50 | }; |
48 | 51 | ||
49 | #endif /* __LINUX_MXSFB_H */ | 52 | #endif /* __LINUX_MXSFB_H */ |
diff --git a/include/linux/nvme.h b/include/linux/nvme.h index c25cccaa555a..4fa3b0b9b071 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h | |||
@@ -137,6 +137,34 @@ enum { | |||
137 | NVME_LBAF_RP_DEGRADED = 3, | 137 | NVME_LBAF_RP_DEGRADED = 3, |
138 | }; | 138 | }; |
139 | 139 | ||
140 | struct nvme_smart_log { | ||
141 | __u8 critical_warning; | ||
142 | __u8 temperature[2]; | ||
143 | __u8 avail_spare; | ||
144 | __u8 spare_thresh; | ||
145 | __u8 percent_used; | ||
146 | __u8 rsvd6[26]; | ||
147 | __u8 data_units_read[16]; | ||
148 | __u8 data_units_written[16]; | ||
149 | __u8 host_reads[16]; | ||
150 | __u8 host_writes[16]; | ||
151 | __u8 ctrl_busy_time[16]; | ||
152 | __u8 power_cycles[16]; | ||
153 | __u8 power_on_hours[16]; | ||
154 | __u8 unsafe_shutdowns[16]; | ||
155 | __u8 media_errors[16]; | ||
156 | __u8 num_err_log_entries[16]; | ||
157 | __u8 rsvd192[320]; | ||
158 | }; | ||
159 | |||
160 | enum { | ||
161 | NVME_SMART_CRIT_SPARE = 1 << 0, | ||
162 | NVME_SMART_CRIT_TEMPERATURE = 1 << 1, | ||
163 | NVME_SMART_CRIT_RELIABILITY = 1 << 2, | ||
164 | NVME_SMART_CRIT_MEDIA = 1 << 3, | ||
165 | NVME_SMART_CRIT_VOLATILE_MEMORY = 1 << 4, | ||
166 | }; | ||
167 | |||
140 | struct nvme_lba_range_type { | 168 | struct nvme_lba_range_type { |
141 | __u8 type; | 169 | __u8 type; |
142 | __u8 attributes; | 170 | __u8 attributes; |
diff --git a/include/linux/printk.h b/include/linux/printk.h index 1249a54d17e0..822171fcb1c8 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
@@ -134,6 +134,8 @@ extern int printk_delay_msec; | |||
134 | extern int dmesg_restrict; | 134 | extern int dmesg_restrict; |
135 | extern int kptr_restrict; | 135 | extern int kptr_restrict; |
136 | 136 | ||
137 | extern void wake_up_klogd(void); | ||
138 | |||
137 | void log_buf_kexec_setup(void); | 139 | void log_buf_kexec_setup(void); |
138 | void __init setup_log_buf(int early); | 140 | void __init setup_log_buf(int early); |
139 | #else | 141 | #else |
@@ -162,6 +164,10 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, | |||
162 | return false; | 164 | return false; |
163 | } | 165 | } |
164 | 166 | ||
167 | static inline void wake_up_klogd(void) | ||
168 | { | ||
169 | } | ||
170 | |||
165 | static inline void log_buf_kexec_setup(void) | 171 | static inline void log_buf_kexec_setup(void) |
166 | { | 172 | { |
167 | } | 173 | } |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index ef9be7e1e190..1819b59aab2a 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -66,6 +66,7 @@ | |||
66 | * port. | 66 | * port. |
67 | * @flags: usb serial port flags | 67 | * @flags: usb serial port flags |
68 | * @write_wait: a wait_queue_head_t used by the port. | 68 | * @write_wait: a wait_queue_head_t used by the port. |
69 | * @delta_msr_wait: modem-status-change wait queue | ||
69 | * @work: work queue entry for the line discipline waking up. | 70 | * @work: work queue entry for the line discipline waking up. |
70 | * @throttled: nonzero if the read urb is inactive to throttle the device | 71 | * @throttled: nonzero if the read urb is inactive to throttle the device |
71 | * @throttle_req: nonzero if the tty wants to throttle us | 72 | * @throttle_req: nonzero if the tty wants to throttle us |
@@ -112,6 +113,7 @@ struct usb_serial_port { | |||
112 | 113 | ||
113 | unsigned long flags; | 114 | unsigned long flags; |
114 | wait_queue_head_t write_wait; | 115 | wait_queue_head_t write_wait; |
116 | wait_queue_head_t delta_msr_wait; | ||
115 | struct work_struct work; | 117 | struct work_struct work; |
116 | char throttled; | 118 | char throttled; |
117 | char throttle_req; | 119 | char throttle_req; |
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h index 6f033a415ecb..5c295c26ad37 100644 --- a/include/linux/usb/ulpi.h +++ b/include/linux/usb/ulpi.h | |||
@@ -181,8 +181,16 @@ | |||
181 | 181 | ||
182 | /*-------------------------------------------------------------------------*/ | 182 | /*-------------------------------------------------------------------------*/ |
183 | 183 | ||
184 | #if IS_ENABLED(CONFIG_USB_ULPI) | ||
184 | struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, | 185 | struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, |
185 | unsigned int flags); | 186 | unsigned int flags); |
187 | #else | ||
188 | static inline struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, | ||
189 | unsigned int flags) | ||
190 | { | ||
191 | return NULL; | ||
192 | } | ||
193 | #endif | ||
186 | 194 | ||
187 | #ifdef CONFIG_USB_ULPI_VIEWPORT | 195 | #ifdef CONFIG_USB_ULPI_VIEWPORT |
188 | /* access ops for controllers with a viewport register */ | 196 | /* access ops for controllers with a viewport register */ |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index e5c4f609f22c..3953fda2e8bd 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -840,7 +840,8 @@ out_putfd: | |||
840 | fd = error; | 840 | fd = error; |
841 | } | 841 | } |
842 | mutex_unlock(&root->d_inode->i_mutex); | 842 | mutex_unlock(&root->d_inode->i_mutex); |
843 | mnt_drop_write(mnt); | 843 | if (!ro) |
844 | mnt_drop_write(mnt); | ||
844 | out_putname: | 845 | out_putname: |
845 | putname(name); | 846 | putname(name); |
846 | return fd; | 847 | return fd; |
diff --git a/kernel/events/core.c b/kernel/events/core.c index b0cd86501c30..59412d037eed 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -4434,12 +4434,15 @@ static void perf_event_task_event(struct perf_task_event *task_event) | |||
4434 | if (ctxn < 0) | 4434 | if (ctxn < 0) |
4435 | goto next; | 4435 | goto next; |
4436 | ctx = rcu_dereference(current->perf_event_ctxp[ctxn]); | 4436 | ctx = rcu_dereference(current->perf_event_ctxp[ctxn]); |
4437 | if (ctx) | ||
4438 | perf_event_task_ctx(ctx, task_event); | ||
4437 | } | 4439 | } |
4438 | if (ctx) | ||
4439 | perf_event_task_ctx(ctx, task_event); | ||
4440 | next: | 4440 | next: |
4441 | put_cpu_ptr(pmu->pmu_cpu_context); | 4441 | put_cpu_ptr(pmu->pmu_cpu_context); |
4442 | } | 4442 | } |
4443 | if (task_event->task_ctx) | ||
4444 | perf_event_task_ctx(task_event->task_ctx, task_event); | ||
4445 | |||
4443 | rcu_read_unlock(); | 4446 | rcu_read_unlock(); |
4444 | } | 4447 | } |
4445 | 4448 | ||
@@ -5647,6 +5650,7 @@ static void perf_swevent_init_hrtimer(struct perf_event *event) | |||
5647 | event->attr.sample_period = NSEC_PER_SEC / freq; | 5650 | event->attr.sample_period = NSEC_PER_SEC / freq; |
5648 | hwc->sample_period = event->attr.sample_period; | 5651 | hwc->sample_period = event->attr.sample_period; |
5649 | local64_set(&hwc->period_left, hwc->sample_period); | 5652 | local64_set(&hwc->period_left, hwc->sample_period); |
5653 | hwc->last_period = hwc->sample_period; | ||
5650 | event->attr.freq = 0; | 5654 | event->attr.freq = 0; |
5651 | } | 5655 | } |
5652 | } | 5656 | } |
diff --git a/kernel/printk.c b/kernel/printk.c index 0b31715f335a..abbdd9e2ac82 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -63,8 +63,6 @@ void asmlinkage __attribute__((weak)) early_printk(const char *fmt, ...) | |||
63 | #define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */ | 63 | #define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */ |
64 | #define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */ | 64 | #define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */ |
65 | 65 | ||
66 | DECLARE_WAIT_QUEUE_HEAD(log_wait); | ||
67 | |||
68 | int console_printk[4] = { | 66 | int console_printk[4] = { |
69 | DEFAULT_CONSOLE_LOGLEVEL, /* console_loglevel */ | 67 | DEFAULT_CONSOLE_LOGLEVEL, /* console_loglevel */ |
70 | DEFAULT_MESSAGE_LOGLEVEL, /* default_message_loglevel */ | 68 | DEFAULT_MESSAGE_LOGLEVEL, /* default_message_loglevel */ |
@@ -224,6 +222,7 @@ struct log { | |||
224 | static DEFINE_RAW_SPINLOCK(logbuf_lock); | 222 | static DEFINE_RAW_SPINLOCK(logbuf_lock); |
225 | 223 | ||
226 | #ifdef CONFIG_PRINTK | 224 | #ifdef CONFIG_PRINTK |
225 | DECLARE_WAIT_QUEUE_HEAD(log_wait); | ||
227 | /* the next printk record to read by syslog(READ) or /proc/kmsg */ | 226 | /* the next printk record to read by syslog(READ) or /proc/kmsg */ |
228 | static u64 syslog_seq; | 227 | static u64 syslog_seq; |
229 | static u32 syslog_idx; | 228 | static u32 syslog_idx; |
@@ -1957,45 +1956,6 @@ int is_console_locked(void) | |||
1957 | return console_locked; | 1956 | return console_locked; |
1958 | } | 1957 | } |
1959 | 1958 | ||
1960 | /* | ||
1961 | * Delayed printk version, for scheduler-internal messages: | ||
1962 | */ | ||
1963 | #define PRINTK_BUF_SIZE 512 | ||
1964 | |||
1965 | #define PRINTK_PENDING_WAKEUP 0x01 | ||
1966 | #define PRINTK_PENDING_SCHED 0x02 | ||
1967 | |||
1968 | static DEFINE_PER_CPU(int, printk_pending); | ||
1969 | static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf); | ||
1970 | |||
1971 | static void wake_up_klogd_work_func(struct irq_work *irq_work) | ||
1972 | { | ||
1973 | int pending = __this_cpu_xchg(printk_pending, 0); | ||
1974 | |||
1975 | if (pending & PRINTK_PENDING_SCHED) { | ||
1976 | char *buf = __get_cpu_var(printk_sched_buf); | ||
1977 | printk(KERN_WARNING "[sched_delayed] %s", buf); | ||
1978 | } | ||
1979 | |||
1980 | if (pending & PRINTK_PENDING_WAKEUP) | ||
1981 | wake_up_interruptible(&log_wait); | ||
1982 | } | ||
1983 | |||
1984 | static DEFINE_PER_CPU(struct irq_work, wake_up_klogd_work) = { | ||
1985 | .func = wake_up_klogd_work_func, | ||
1986 | .flags = IRQ_WORK_LAZY, | ||
1987 | }; | ||
1988 | |||
1989 | void wake_up_klogd(void) | ||
1990 | { | ||
1991 | preempt_disable(); | ||
1992 | if (waitqueue_active(&log_wait)) { | ||
1993 | this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); | ||
1994 | irq_work_queue(&__get_cpu_var(wake_up_klogd_work)); | ||
1995 | } | ||
1996 | preempt_enable(); | ||
1997 | } | ||
1998 | |||
1999 | static void console_cont_flush(char *text, size_t size) | 1959 | static void console_cont_flush(char *text, size_t size) |
2000 | { | 1960 | { |
2001 | unsigned long flags; | 1961 | unsigned long flags; |
@@ -2458,6 +2418,44 @@ static int __init printk_late_init(void) | |||
2458 | late_initcall(printk_late_init); | 2418 | late_initcall(printk_late_init); |
2459 | 2419 | ||
2460 | #if defined CONFIG_PRINTK | 2420 | #if defined CONFIG_PRINTK |
2421 | /* | ||
2422 | * Delayed printk version, for scheduler-internal messages: | ||
2423 | */ | ||
2424 | #define PRINTK_BUF_SIZE 512 | ||
2425 | |||
2426 | #define PRINTK_PENDING_WAKEUP 0x01 | ||
2427 | #define PRINTK_PENDING_SCHED 0x02 | ||
2428 | |||
2429 | static DEFINE_PER_CPU(int, printk_pending); | ||
2430 | static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf); | ||
2431 | |||
2432 | static void wake_up_klogd_work_func(struct irq_work *irq_work) | ||
2433 | { | ||
2434 | int pending = __this_cpu_xchg(printk_pending, 0); | ||
2435 | |||
2436 | if (pending & PRINTK_PENDING_SCHED) { | ||
2437 | char *buf = __get_cpu_var(printk_sched_buf); | ||
2438 | printk(KERN_WARNING "[sched_delayed] %s", buf); | ||
2439 | } | ||
2440 | |||
2441 | if (pending & PRINTK_PENDING_WAKEUP) | ||
2442 | wake_up_interruptible(&log_wait); | ||
2443 | } | ||
2444 | |||
2445 | static DEFINE_PER_CPU(struct irq_work, wake_up_klogd_work) = { | ||
2446 | .func = wake_up_klogd_work_func, | ||
2447 | .flags = IRQ_WORK_LAZY, | ||
2448 | }; | ||
2449 | |||
2450 | void wake_up_klogd(void) | ||
2451 | { | ||
2452 | preempt_disable(); | ||
2453 | if (waitqueue_active(&log_wait)) { | ||
2454 | this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); | ||
2455 | irq_work_queue(&__get_cpu_var(wake_up_klogd_work)); | ||
2456 | } | ||
2457 | preempt_enable(); | ||
2458 | } | ||
2461 | 2459 | ||
2462 | int printk_sched(const char *fmt, ...) | 2460 | int printk_sched(const char *fmt, ...) |
2463 | { | 2461 | { |
diff --git a/kernel/sys.c b/kernel/sys.c index 81f56445fba9..39c9c4a2949f 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -2185,9 +2185,8 @@ SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep, | |||
2185 | 2185 | ||
2186 | char poweroff_cmd[POWEROFF_CMD_PATH_LEN] = "/sbin/poweroff"; | 2186 | char poweroff_cmd[POWEROFF_CMD_PATH_LEN] = "/sbin/poweroff"; |
2187 | 2187 | ||
2188 | static int __orderly_poweroff(void) | 2188 | static int __orderly_poweroff(bool force) |
2189 | { | 2189 | { |
2190 | int argc; | ||
2191 | char **argv; | 2190 | char **argv; |
2192 | static char *envp[] = { | 2191 | static char *envp[] = { |
2193 | "HOME=/", | 2192 | "HOME=/", |
@@ -2196,20 +2195,40 @@ static int __orderly_poweroff(void) | |||
2196 | }; | 2195 | }; |
2197 | int ret; | 2196 | int ret; |
2198 | 2197 | ||
2199 | argv = argv_split(GFP_ATOMIC, poweroff_cmd, &argc); | 2198 | argv = argv_split(GFP_KERNEL, poweroff_cmd, NULL); |
2200 | if (argv == NULL) { | 2199 | if (argv) { |
2200 | ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); | ||
2201 | argv_free(argv); | ||
2202 | } else { | ||
2201 | printk(KERN_WARNING "%s failed to allocate memory for \"%s\"\n", | 2203 | printk(KERN_WARNING "%s failed to allocate memory for \"%s\"\n", |
2202 | __func__, poweroff_cmd); | 2204 | __func__, poweroff_cmd); |
2203 | return -ENOMEM; | 2205 | ret = -ENOMEM; |
2204 | } | 2206 | } |
2205 | 2207 | ||
2206 | ret = call_usermodehelper_fns(argv[0], argv, envp, UMH_WAIT_EXEC, | 2208 | if (ret && force) { |
2207 | NULL, NULL, NULL); | 2209 | printk(KERN_WARNING "Failed to start orderly shutdown: " |
2208 | argv_free(argv); | 2210 | "forcing the issue\n"); |
2211 | /* | ||
2212 | * I guess this should try to kick off some daemon to sync and | ||
2213 | * poweroff asap. Or not even bother syncing if we're doing an | ||
2214 | * emergency shutdown? | ||
2215 | */ | ||
2216 | emergency_sync(); | ||
2217 | kernel_power_off(); | ||
2218 | } | ||
2209 | 2219 | ||
2210 | return ret; | 2220 | return ret; |
2211 | } | 2221 | } |
2212 | 2222 | ||
2223 | static bool poweroff_force; | ||
2224 | |||
2225 | static void poweroff_work_func(struct work_struct *work) | ||
2226 | { | ||
2227 | __orderly_poweroff(poweroff_force); | ||
2228 | } | ||
2229 | |||
2230 | static DECLARE_WORK(poweroff_work, poweroff_work_func); | ||
2231 | |||
2213 | /** | 2232 | /** |
2214 | * orderly_poweroff - Trigger an orderly system poweroff | 2233 | * orderly_poweroff - Trigger an orderly system poweroff |
2215 | * @force: force poweroff if command execution fails | 2234 | * @force: force poweroff if command execution fails |
@@ -2219,21 +2238,9 @@ static int __orderly_poweroff(void) | |||
2219 | */ | 2238 | */ |
2220 | int orderly_poweroff(bool force) | 2239 | int orderly_poweroff(bool force) |
2221 | { | 2240 | { |
2222 | int ret = __orderly_poweroff(); | 2241 | if (force) /* do not override the pending "true" */ |
2223 | 2242 | poweroff_force = true; | |
2224 | if (ret && force) { | 2243 | schedule_work(&poweroff_work); |
2225 | printk(KERN_WARNING "Failed to start orderly shutdown: " | 2244 | return 0; |
2226 | "forcing the issue\n"); | ||
2227 | |||
2228 | /* | ||
2229 | * I guess this should try to kick off some daemon to sync and | ||
2230 | * poweroff asap. Or not even bother syncing if we're doing an | ||
2231 | * emergency shutdown? | ||
2232 | */ | ||
2233 | emergency_sync(); | ||
2234 | kernel_power_off(); | ||
2235 | } | ||
2236 | |||
2237 | return ret; | ||
2238 | } | 2245 | } |
2239 | EXPORT_SYMBOL_GPL(orderly_poweroff); | 2246 | EXPORT_SYMBOL_GPL(orderly_poweroff); |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 2fb8cb88df8d..7f32fe0e52cd 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -67,7 +67,8 @@ static void tick_broadcast_start_periodic(struct clock_event_device *bc) | |||
67 | */ | 67 | */ |
68 | int tick_check_broadcast_device(struct clock_event_device *dev) | 68 | int tick_check_broadcast_device(struct clock_event_device *dev) |
69 | { | 69 | { |
70 | if ((tick_broadcast_device.evtdev && | 70 | if ((dev->features & CLOCK_EVT_FEAT_DUMMY) || |
71 | (tick_broadcast_device.evtdev && | ||
71 | tick_broadcast_device.evtdev->rating >= dev->rating) || | 72 | tick_broadcast_device.evtdev->rating >= dev->rating) || |
72 | (dev->features & CLOCK_EVT_FEAT_C3STOP)) | 73 | (dev->features & CLOCK_EVT_FEAT_C3STOP)) |
73 | return 0; | 74 | return 0; |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index ab25b88aae56..6893d5a2bf08 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -3104,8 +3104,8 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |||
3104 | continue; | 3104 | continue; |
3105 | } | 3105 | } |
3106 | 3106 | ||
3107 | hlist_del(&entry->node); | 3107 | hlist_del_rcu(&entry->node); |
3108 | call_rcu(&entry->rcu, ftrace_free_entry_rcu); | 3108 | call_rcu_sched(&entry->rcu, ftrace_free_entry_rcu); |
3109 | } | 3109 | } |
3110 | } | 3110 | } |
3111 | __disable_ftrace_function_probe(); | 3111 | __disable_ftrace_function_probe(); |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 1f835a83cb2c..4f1dade56981 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -704,7 +704,7 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) | |||
704 | void | 704 | void |
705 | update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) | 705 | update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) |
706 | { | 706 | { |
707 | struct ring_buffer *buf = tr->buffer; | 707 | struct ring_buffer *buf; |
708 | 708 | ||
709 | if (trace_stop_count) | 709 | if (trace_stop_count) |
710 | return; | 710 | return; |
@@ -719,6 +719,7 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) | |||
719 | 719 | ||
720 | arch_spin_lock(&ftrace_max_lock); | 720 | arch_spin_lock(&ftrace_max_lock); |
721 | 721 | ||
722 | buf = tr->buffer; | ||
722 | tr->buffer = max_tr.buffer; | 723 | tr->buffer = max_tr.buffer; |
723 | max_tr.buffer = buf; | 724 | max_tr.buffer = buf; |
724 | 725 | ||
@@ -2880,11 +2881,25 @@ static int set_tracer_option(struct tracer *trace, char *cmp, int neg) | |||
2880 | return -EINVAL; | 2881 | return -EINVAL; |
2881 | } | 2882 | } |
2882 | 2883 | ||
2883 | static void set_tracer_flags(unsigned int mask, int enabled) | 2884 | /* Some tracers require overwrite to stay enabled */ |
2885 | int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set) | ||
2886 | { | ||
2887 | if (tracer->enabled && (mask & TRACE_ITER_OVERWRITE) && !set) | ||
2888 | return -1; | ||
2889 | |||
2890 | return 0; | ||
2891 | } | ||
2892 | |||
2893 | int set_tracer_flag(unsigned int mask, int enabled) | ||
2884 | { | 2894 | { |
2885 | /* do nothing if flag is already set */ | 2895 | /* do nothing if flag is already set */ |
2886 | if (!!(trace_flags & mask) == !!enabled) | 2896 | if (!!(trace_flags & mask) == !!enabled) |
2887 | return; | 2897 | return 0; |
2898 | |||
2899 | /* Give the tracer a chance to approve the change */ | ||
2900 | if (current_trace->flag_changed) | ||
2901 | if (current_trace->flag_changed(current_trace, mask, !!enabled)) | ||
2902 | return -EINVAL; | ||
2888 | 2903 | ||
2889 | if (enabled) | 2904 | if (enabled) |
2890 | trace_flags |= mask; | 2905 | trace_flags |= mask; |
@@ -2894,18 +2909,24 @@ static void set_tracer_flags(unsigned int mask, int enabled) | |||
2894 | if (mask == TRACE_ITER_RECORD_CMD) | 2909 | if (mask == TRACE_ITER_RECORD_CMD) |
2895 | trace_event_enable_cmd_record(enabled); | 2910 | trace_event_enable_cmd_record(enabled); |
2896 | 2911 | ||
2897 | if (mask == TRACE_ITER_OVERWRITE) | 2912 | if (mask == TRACE_ITER_OVERWRITE) { |
2898 | ring_buffer_change_overwrite(global_trace.buffer, enabled); | 2913 | ring_buffer_change_overwrite(global_trace.buffer, enabled); |
2914 | #ifdef CONFIG_TRACER_MAX_TRACE | ||
2915 | ring_buffer_change_overwrite(max_tr.buffer, enabled); | ||
2916 | #endif | ||
2917 | } | ||
2899 | 2918 | ||
2900 | if (mask == TRACE_ITER_PRINTK) | 2919 | if (mask == TRACE_ITER_PRINTK) |
2901 | trace_printk_start_stop_comm(enabled); | 2920 | trace_printk_start_stop_comm(enabled); |
2921 | |||
2922 | return 0; | ||
2902 | } | 2923 | } |
2903 | 2924 | ||
2904 | static int trace_set_options(char *option) | 2925 | static int trace_set_options(char *option) |
2905 | { | 2926 | { |
2906 | char *cmp; | 2927 | char *cmp; |
2907 | int neg = 0; | 2928 | int neg = 0; |
2908 | int ret = 0; | 2929 | int ret = -ENODEV; |
2909 | int i; | 2930 | int i; |
2910 | 2931 | ||
2911 | cmp = strstrip(option); | 2932 | cmp = strstrip(option); |
@@ -2915,19 +2936,20 @@ static int trace_set_options(char *option) | |||
2915 | cmp += 2; | 2936 | cmp += 2; |
2916 | } | 2937 | } |
2917 | 2938 | ||
2939 | mutex_lock(&trace_types_lock); | ||
2940 | |||
2918 | for (i = 0; trace_options[i]; i++) { | 2941 | for (i = 0; trace_options[i]; i++) { |
2919 | if (strcmp(cmp, trace_options[i]) == 0) { | 2942 | if (strcmp(cmp, trace_options[i]) == 0) { |
2920 | set_tracer_flags(1 << i, !neg); | 2943 | ret = set_tracer_flag(1 << i, !neg); |
2921 | break; | 2944 | break; |
2922 | } | 2945 | } |
2923 | } | 2946 | } |
2924 | 2947 | ||
2925 | /* If no option could be set, test the specific tracer options */ | 2948 | /* If no option could be set, test the specific tracer options */ |
2926 | if (!trace_options[i]) { | 2949 | if (!trace_options[i]) |
2927 | mutex_lock(&trace_types_lock); | ||
2928 | ret = set_tracer_option(current_trace, cmp, neg); | 2950 | ret = set_tracer_option(current_trace, cmp, neg); |
2929 | mutex_unlock(&trace_types_lock); | 2951 | |
2930 | } | 2952 | mutex_unlock(&trace_types_lock); |
2931 | 2953 | ||
2932 | return ret; | 2954 | return ret; |
2933 | } | 2955 | } |
@@ -2937,6 +2959,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf, | |||
2937 | size_t cnt, loff_t *ppos) | 2959 | size_t cnt, loff_t *ppos) |
2938 | { | 2960 | { |
2939 | char buf[64]; | 2961 | char buf[64]; |
2962 | int ret; | ||
2940 | 2963 | ||
2941 | if (cnt >= sizeof(buf)) | 2964 | if (cnt >= sizeof(buf)) |
2942 | return -EINVAL; | 2965 | return -EINVAL; |
@@ -2946,7 +2969,9 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf, | |||
2946 | 2969 | ||
2947 | buf[cnt] = 0; | 2970 | buf[cnt] = 0; |
2948 | 2971 | ||
2949 | trace_set_options(buf); | 2972 | ret = trace_set_options(buf); |
2973 | if (ret < 0) | ||
2974 | return ret; | ||
2950 | 2975 | ||
2951 | *ppos += cnt; | 2976 | *ppos += cnt; |
2952 | 2977 | ||
@@ -3250,6 +3275,9 @@ static int tracing_set_tracer(const char *buf) | |||
3250 | goto out; | 3275 | goto out; |
3251 | 3276 | ||
3252 | trace_branch_disable(); | 3277 | trace_branch_disable(); |
3278 | |||
3279 | current_trace->enabled = false; | ||
3280 | |||
3253 | if (current_trace->reset) | 3281 | if (current_trace->reset) |
3254 | current_trace->reset(tr); | 3282 | current_trace->reset(tr); |
3255 | 3283 | ||
@@ -3294,6 +3322,7 @@ static int tracing_set_tracer(const char *buf) | |||
3294 | } | 3322 | } |
3295 | 3323 | ||
3296 | current_trace = t; | 3324 | current_trace = t; |
3325 | current_trace->enabled = true; | ||
3297 | trace_branch_enable(tr); | 3326 | trace_branch_enable(tr); |
3298 | out: | 3327 | out: |
3299 | mutex_unlock(&trace_types_lock); | 3328 | mutex_unlock(&trace_types_lock); |
@@ -4780,7 +4809,13 @@ trace_options_core_write(struct file *filp, const char __user *ubuf, size_t cnt, | |||
4780 | 4809 | ||
4781 | if (val != 0 && val != 1) | 4810 | if (val != 0 && val != 1) |
4782 | return -EINVAL; | 4811 | return -EINVAL; |
4783 | set_tracer_flags(1 << index, val); | 4812 | |
4813 | mutex_lock(&trace_types_lock); | ||
4814 | ret = set_tracer_flag(1 << index, val); | ||
4815 | mutex_unlock(&trace_types_lock); | ||
4816 | |||
4817 | if (ret < 0) | ||
4818 | return ret; | ||
4784 | 4819 | ||
4785 | *ppos += cnt; | 4820 | *ppos += cnt; |
4786 | 4821 | ||
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 57d7e5397d56..2081971367ea 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -283,11 +283,15 @@ struct tracer { | |||
283 | enum print_line_t (*print_line)(struct trace_iterator *iter); | 283 | enum print_line_t (*print_line)(struct trace_iterator *iter); |
284 | /* If you handled the flag setting, return 0 */ | 284 | /* If you handled the flag setting, return 0 */ |
285 | int (*set_flag)(u32 old_flags, u32 bit, int set); | 285 | int (*set_flag)(u32 old_flags, u32 bit, int set); |
286 | /* Return 0 if OK with change, else return non-zero */ | ||
287 | int (*flag_changed)(struct tracer *tracer, | ||
288 | u32 mask, int set); | ||
286 | struct tracer *next; | 289 | struct tracer *next; |
287 | struct tracer_flags *flags; | 290 | struct tracer_flags *flags; |
288 | bool print_max; | 291 | bool print_max; |
289 | bool use_max_tr; | 292 | bool use_max_tr; |
290 | bool allocated_snapshot; | 293 | bool allocated_snapshot; |
294 | bool enabled; | ||
291 | }; | 295 | }; |
292 | 296 | ||
293 | 297 | ||
@@ -943,6 +947,8 @@ extern const char *__stop___trace_bprintk_fmt[]; | |||
943 | 947 | ||
944 | void trace_printk_init_buffers(void); | 948 | void trace_printk_init_buffers(void); |
945 | void trace_printk_start_comm(void); | 949 | void trace_printk_start_comm(void); |
950 | int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set); | ||
951 | int set_tracer_flag(unsigned int mask, int enabled); | ||
946 | 952 | ||
947 | #undef FTRACE_ENTRY | 953 | #undef FTRACE_ENTRY |
948 | #define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \ | 954 | #define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \ |
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index 713a2cac4881..443b25b43b4f 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c | |||
@@ -32,7 +32,7 @@ enum { | |||
32 | 32 | ||
33 | static int trace_type __read_mostly; | 33 | static int trace_type __read_mostly; |
34 | 34 | ||
35 | static int save_lat_flag; | 35 | static int save_flags; |
36 | 36 | ||
37 | static void stop_irqsoff_tracer(struct trace_array *tr, int graph); | 37 | static void stop_irqsoff_tracer(struct trace_array *tr, int graph); |
38 | static int start_irqsoff_tracer(struct trace_array *tr, int graph); | 38 | static int start_irqsoff_tracer(struct trace_array *tr, int graph); |
@@ -558,8 +558,11 @@ static void stop_irqsoff_tracer(struct trace_array *tr, int graph) | |||
558 | 558 | ||
559 | static void __irqsoff_tracer_init(struct trace_array *tr) | 559 | static void __irqsoff_tracer_init(struct trace_array *tr) |
560 | { | 560 | { |
561 | save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT; | 561 | save_flags = trace_flags; |
562 | trace_flags |= TRACE_ITER_LATENCY_FMT; | 562 | |
563 | /* non overwrite screws up the latency tracers */ | ||
564 | set_tracer_flag(TRACE_ITER_OVERWRITE, 1); | ||
565 | set_tracer_flag(TRACE_ITER_LATENCY_FMT, 1); | ||
563 | 566 | ||
564 | tracing_max_latency = 0; | 567 | tracing_max_latency = 0; |
565 | irqsoff_trace = tr; | 568 | irqsoff_trace = tr; |
@@ -573,10 +576,13 @@ static void __irqsoff_tracer_init(struct trace_array *tr) | |||
573 | 576 | ||
574 | static void irqsoff_tracer_reset(struct trace_array *tr) | 577 | static void irqsoff_tracer_reset(struct trace_array *tr) |
575 | { | 578 | { |
579 | int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT; | ||
580 | int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE; | ||
581 | |||
576 | stop_irqsoff_tracer(tr, is_graph()); | 582 | stop_irqsoff_tracer(tr, is_graph()); |
577 | 583 | ||
578 | if (!save_lat_flag) | 584 | set_tracer_flag(TRACE_ITER_LATENCY_FMT, lat_flag); |
579 | trace_flags &= ~TRACE_ITER_LATENCY_FMT; | 585 | set_tracer_flag(TRACE_ITER_OVERWRITE, overwrite_flag); |
580 | } | 586 | } |
581 | 587 | ||
582 | static void irqsoff_tracer_start(struct trace_array *tr) | 588 | static void irqsoff_tracer_start(struct trace_array *tr) |
@@ -609,6 +615,7 @@ static struct tracer irqsoff_tracer __read_mostly = | |||
609 | .print_line = irqsoff_print_line, | 615 | .print_line = irqsoff_print_line, |
610 | .flags = &tracer_flags, | 616 | .flags = &tracer_flags, |
611 | .set_flag = irqsoff_set_flag, | 617 | .set_flag = irqsoff_set_flag, |
618 | .flag_changed = trace_keep_overwrite, | ||
612 | #ifdef CONFIG_FTRACE_SELFTEST | 619 | #ifdef CONFIG_FTRACE_SELFTEST |
613 | .selftest = trace_selftest_startup_irqsoff, | 620 | .selftest = trace_selftest_startup_irqsoff, |
614 | #endif | 621 | #endif |
@@ -642,6 +649,7 @@ static struct tracer preemptoff_tracer __read_mostly = | |||
642 | .print_line = irqsoff_print_line, | 649 | .print_line = irqsoff_print_line, |
643 | .flags = &tracer_flags, | 650 | .flags = &tracer_flags, |
644 | .set_flag = irqsoff_set_flag, | 651 | .set_flag = irqsoff_set_flag, |
652 | .flag_changed = trace_keep_overwrite, | ||
645 | #ifdef CONFIG_FTRACE_SELFTEST | 653 | #ifdef CONFIG_FTRACE_SELFTEST |
646 | .selftest = trace_selftest_startup_preemptoff, | 654 | .selftest = trace_selftest_startup_preemptoff, |
647 | #endif | 655 | #endif |
@@ -677,6 +685,7 @@ static struct tracer preemptirqsoff_tracer __read_mostly = | |||
677 | .print_line = irqsoff_print_line, | 685 | .print_line = irqsoff_print_line, |
678 | .flags = &tracer_flags, | 686 | .flags = &tracer_flags, |
679 | .set_flag = irqsoff_set_flag, | 687 | .set_flag = irqsoff_set_flag, |
688 | .flag_changed = trace_keep_overwrite, | ||
680 | #ifdef CONFIG_FTRACE_SELFTEST | 689 | #ifdef CONFIG_FTRACE_SELFTEST |
681 | .selftest = trace_selftest_startup_preemptirqsoff, | 690 | .selftest = trace_selftest_startup_preemptirqsoff, |
682 | #endif | 691 | #endif |
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index 75aa97fbe1a1..fde652c9a511 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c | |||
@@ -36,7 +36,7 @@ static void __wakeup_reset(struct trace_array *tr); | |||
36 | static int wakeup_graph_entry(struct ftrace_graph_ent *trace); | 36 | static int wakeup_graph_entry(struct ftrace_graph_ent *trace); |
37 | static void wakeup_graph_return(struct ftrace_graph_ret *trace); | 37 | static void wakeup_graph_return(struct ftrace_graph_ret *trace); |
38 | 38 | ||
39 | static int save_lat_flag; | 39 | static int save_flags; |
40 | 40 | ||
41 | #define TRACE_DISPLAY_GRAPH 1 | 41 | #define TRACE_DISPLAY_GRAPH 1 |
42 | 42 | ||
@@ -540,8 +540,11 @@ static void stop_wakeup_tracer(struct trace_array *tr) | |||
540 | 540 | ||
541 | static int __wakeup_tracer_init(struct trace_array *tr) | 541 | static int __wakeup_tracer_init(struct trace_array *tr) |
542 | { | 542 | { |
543 | save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT; | 543 | save_flags = trace_flags; |
544 | trace_flags |= TRACE_ITER_LATENCY_FMT; | 544 | |
545 | /* non overwrite screws up the latency tracers */ | ||
546 | set_tracer_flag(TRACE_ITER_OVERWRITE, 1); | ||
547 | set_tracer_flag(TRACE_ITER_LATENCY_FMT, 1); | ||
545 | 548 | ||
546 | tracing_max_latency = 0; | 549 | tracing_max_latency = 0; |
547 | wakeup_trace = tr; | 550 | wakeup_trace = tr; |
@@ -563,12 +566,15 @@ static int wakeup_rt_tracer_init(struct trace_array *tr) | |||
563 | 566 | ||
564 | static void wakeup_tracer_reset(struct trace_array *tr) | 567 | static void wakeup_tracer_reset(struct trace_array *tr) |
565 | { | 568 | { |
569 | int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT; | ||
570 | int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE; | ||
571 | |||
566 | stop_wakeup_tracer(tr); | 572 | stop_wakeup_tracer(tr); |
567 | /* make sure we put back any tasks we are tracing */ | 573 | /* make sure we put back any tasks we are tracing */ |
568 | wakeup_reset(tr); | 574 | wakeup_reset(tr); |
569 | 575 | ||
570 | if (!save_lat_flag) | 576 | set_tracer_flag(TRACE_ITER_LATENCY_FMT, lat_flag); |
571 | trace_flags &= ~TRACE_ITER_LATENCY_FMT; | 577 | set_tracer_flag(TRACE_ITER_OVERWRITE, overwrite_flag); |
572 | } | 578 | } |
573 | 579 | ||
574 | static void wakeup_tracer_start(struct trace_array *tr) | 580 | static void wakeup_tracer_start(struct trace_array *tr) |
@@ -594,6 +600,7 @@ static struct tracer wakeup_tracer __read_mostly = | |||
594 | .print_line = wakeup_print_line, | 600 | .print_line = wakeup_print_line, |
595 | .flags = &tracer_flags, | 601 | .flags = &tracer_flags, |
596 | .set_flag = wakeup_set_flag, | 602 | .set_flag = wakeup_set_flag, |
603 | .flag_changed = trace_keep_overwrite, | ||
597 | #ifdef CONFIG_FTRACE_SELFTEST | 604 | #ifdef CONFIG_FTRACE_SELFTEST |
598 | .selftest = trace_selftest_startup_wakeup, | 605 | .selftest = trace_selftest_startup_wakeup, |
599 | #endif | 606 | #endif |
@@ -615,6 +622,7 @@ static struct tracer wakeup_rt_tracer __read_mostly = | |||
615 | .print_line = wakeup_print_line, | 622 | .print_line = wakeup_print_line, |
616 | .flags = &tracer_flags, | 623 | .flags = &tracer_flags, |
617 | .set_flag = wakeup_set_flag, | 624 | .set_flag = wakeup_set_flag, |
625 | .flag_changed = trace_keep_overwrite, | ||
618 | #ifdef CONFIG_FTRACE_SELFTEST | 626 | #ifdef CONFIG_FTRACE_SELFTEST |
619 | .selftest = trace_selftest_startup_wakeup, | 627 | .selftest = trace_selftest_startup_wakeup, |
620 | #endif | 628 | #endif |
diff --git a/lib/bust_spinlocks.c b/lib/bust_spinlocks.c index 9681d54b95d1..f8e0e5367398 100644 --- a/lib/bust_spinlocks.c +++ b/lib/bust_spinlocks.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/printk.h> | ||
11 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
12 | #include <linux/tty.h> | 13 | #include <linux/tty.h> |
13 | #include <linux/wait.h> | 14 | #include <linux/wait.h> |
@@ -28,5 +29,3 @@ void __attribute__((weak)) bust_spinlocks(int yes) | |||
28 | wake_up_klogd(); | 29 | wake_up_klogd(); |
29 | } | 30 | } |
30 | } | 31 | } |
31 | |||
32 | |||
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 5e396accd3d0..d87a17a819d0 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -862,17 +862,21 @@ static void check_unmap(struct dma_debug_entry *ref) | |||
862 | entry = bucket_find_exact(bucket, ref); | 862 | entry = bucket_find_exact(bucket, ref); |
863 | 863 | ||
864 | if (!entry) { | 864 | if (!entry) { |
865 | /* must drop lock before calling dma_mapping_error */ | ||
866 | put_hash_bucket(bucket, &flags); | ||
867 | |||
865 | if (dma_mapping_error(ref->dev, ref->dev_addr)) { | 868 | if (dma_mapping_error(ref->dev, ref->dev_addr)) { |
866 | err_printk(ref->dev, NULL, | 869 | err_printk(ref->dev, NULL, |
867 | "DMA-API: device driver tries " | 870 | "DMA-API: device driver tries to free an " |
868 | "to free an invalid DMA memory address\n"); | 871 | "invalid DMA memory address\n"); |
869 | return; | 872 | } else { |
873 | err_printk(ref->dev, NULL, | ||
874 | "DMA-API: device driver tries to free DMA " | ||
875 | "memory it has not allocated [device " | ||
876 | "address=0x%016llx] [size=%llu bytes]\n", | ||
877 | ref->dev_addr, ref->size); | ||
870 | } | 878 | } |
871 | err_printk(ref->dev, NULL, "DMA-API: device driver tries " | 879 | return; |
872 | "to free DMA memory it has not allocated " | ||
873 | "[device address=0x%016llx] [size=%llu bytes]\n", | ||
874 | ref->dev_addr, ref->size); | ||
875 | goto out; | ||
876 | } | 880 | } |
877 | 881 | ||
878 | if (ref->size != entry->size) { | 882 | if (ref->size != entry->size) { |
@@ -936,7 +940,6 @@ static void check_unmap(struct dma_debug_entry *ref) | |||
936 | hash_bucket_del(entry); | 940 | hash_bucket_del(entry); |
937 | dma_entry_free(entry); | 941 | dma_entry_free(entry); |
938 | 942 | ||
939 | out: | ||
940 | put_hash_bucket(bucket, &flags); | 943 | put_hash_bucket(bucket, &flags); |
941 | } | 944 | } |
942 | 945 | ||
@@ -1082,13 +1085,27 @@ void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
1082 | ref.dev = dev; | 1085 | ref.dev = dev; |
1083 | ref.dev_addr = dma_addr; | 1086 | ref.dev_addr = dma_addr; |
1084 | bucket = get_hash_bucket(&ref, &flags); | 1087 | bucket = get_hash_bucket(&ref, &flags); |
1085 | entry = bucket_find_exact(bucket, &ref); | ||
1086 | 1088 | ||
1087 | if (!entry) | 1089 | list_for_each_entry(entry, &bucket->list, list) { |
1088 | goto out; | 1090 | if (!exact_match(&ref, entry)) |
1091 | continue; | ||
1092 | |||
1093 | /* | ||
1094 | * The same physical address can be mapped multiple | ||
1095 | * times. Without a hardware IOMMU this results in the | ||
1096 | * same device addresses being put into the dma-debug | ||
1097 | * hash multiple times too. This can result in false | ||
1098 | * positives being reported. Therefore we implement a | ||
1099 | * best-fit algorithm here which updates the first entry | ||
1100 | * from the hash which fits the reference value and is | ||
1101 | * not currently listed as being checked. | ||
1102 | */ | ||
1103 | if (entry->map_err_type == MAP_ERR_NOT_CHECKED) { | ||
1104 | entry->map_err_type = MAP_ERR_CHECKED; | ||
1105 | break; | ||
1106 | } | ||
1107 | } | ||
1089 | 1108 | ||
1090 | entry->map_err_type = MAP_ERR_CHECKED; | ||
1091 | out: | ||
1092 | put_hash_bucket(bucket, &flags); | 1109 | put_hash_bucket(bucket, &flags); |
1093 | } | 1110 | } |
1094 | EXPORT_SYMBOL(debug_dma_mapping_error); | 1111 | EXPORT_SYMBOL(debug_dma_mapping_error); |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 0a0be33bb199..ca9a7c6d7e97 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -2124,8 +2124,12 @@ int hugetlb_report_node_meminfo(int nid, char *buf) | |||
2124 | /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ | 2124 | /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ |
2125 | unsigned long hugetlb_total_pages(void) | 2125 | unsigned long hugetlb_total_pages(void) |
2126 | { | 2126 | { |
2127 | struct hstate *h = &default_hstate; | 2127 | struct hstate *h; |
2128 | return h->nr_huge_pages * pages_per_huge_page(h); | 2128 | unsigned long nr_total_pages = 0; |
2129 | |||
2130 | for_each_hstate(h) | ||
2131 | nr_total_pages += h->nr_huge_pages * pages_per_huge_page(h); | ||
2132 | return nr_total_pages; | ||
2129 | } | 2133 | } |
2130 | 2134 | ||
2131 | static int hugetlb_acct_memory(struct hstate *h, long delta) | 2135 | static int hugetlb_acct_memory(struct hstate *h, long delta) |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 9597eec8239d..ee3765760818 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -1779,7 +1779,11 @@ void try_offline_node(int nid) | |||
1779 | for (i = 0; i < MAX_NR_ZONES; i++) { | 1779 | for (i = 0; i < MAX_NR_ZONES; i++) { |
1780 | struct zone *zone = pgdat->node_zones + i; | 1780 | struct zone *zone = pgdat->node_zones + i; |
1781 | 1781 | ||
1782 | if (zone->wait_table) | 1782 | /* |
1783 | * wait_table may be allocated from boot memory, | ||
1784 | * here only free if it's allocated by vmalloc. | ||
1785 | */ | ||
1786 | if (is_vmalloc_addr(zone->wait_table)) | ||
1783 | vfree(zone->wait_table); | 1787 | vfree(zone->wait_table); |
1784 | } | 1788 | } |
1785 | 1789 | ||
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index fb20f25ddec9..f8529fc8e542 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -180,6 +180,8 @@ static void __rpc_add_wait_queue(struct rpc_wait_queue *queue, | |||
180 | list_add_tail(&task->u.tk_wait.list, &queue->tasks[0]); | 180 | list_add_tail(&task->u.tk_wait.list, &queue->tasks[0]); |
181 | task->tk_waitqueue = queue; | 181 | task->tk_waitqueue = queue; |
182 | queue->qlen++; | 182 | queue->qlen++; |
183 | /* barrier matches the read in rpc_wake_up_task_queue_locked() */ | ||
184 | smp_wmb(); | ||
183 | rpc_set_queued(task); | 185 | rpc_set_queued(task); |
184 | 186 | ||
185 | dprintk("RPC: %5u added to queue %p \"%s\"\n", | 187 | dprintk("RPC: %5u added to queue %p \"%s\"\n", |
@@ -430,8 +432,11 @@ static void __rpc_do_wake_up_task(struct rpc_wait_queue *queue, struct rpc_task | |||
430 | */ | 432 | */ |
431 | static void rpc_wake_up_task_queue_locked(struct rpc_wait_queue *queue, struct rpc_task *task) | 433 | static void rpc_wake_up_task_queue_locked(struct rpc_wait_queue *queue, struct rpc_task *task) |
432 | { | 434 | { |
433 | if (RPC_IS_QUEUED(task) && task->tk_waitqueue == queue) | 435 | if (RPC_IS_QUEUED(task)) { |
434 | __rpc_do_wake_up_task(queue, task); | 436 | smp_rmb(); |
437 | if (task->tk_waitqueue == queue) | ||
438 | __rpc_do_wake_up_task(queue, task); | ||
439 | } | ||
435 | } | 440 | } |
436 | 441 | ||
437 | /* | 442 | /* |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index a9ebcf9e3710..ecdf30eb5879 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -3144,7 +3144,7 @@ static unsigned int convert_to_spdif_status(unsigned short val) | |||
3144 | if (val & AC_DIG1_PROFESSIONAL) | 3144 | if (val & AC_DIG1_PROFESSIONAL) |
3145 | sbits |= IEC958_AES0_PROFESSIONAL; | 3145 | sbits |= IEC958_AES0_PROFESSIONAL; |
3146 | if (sbits & IEC958_AES0_PROFESSIONAL) { | 3146 | if (sbits & IEC958_AES0_PROFESSIONAL) { |
3147 | if (sbits & AC_DIG1_EMPHASIS) | 3147 | if (val & AC_DIG1_EMPHASIS) |
3148 | sbits |= IEC958_AES0_PRO_EMPHASIS_5015; | 3148 | sbits |= IEC958_AES0_PRO_EMPHASIS_5015; |
3149 | } else { | 3149 | } else { |
3150 | if (val & AC_DIG1_EMPHASIS) | 3150 | if (val & AC_DIG1_EMPHASIS) |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 78897d05d80f..43c2ea539561 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -995,6 +995,8 @@ enum { | |||
995 | BAD_NO_EXTRA_SURR_DAC = 0x101, | 995 | BAD_NO_EXTRA_SURR_DAC = 0x101, |
996 | /* Primary DAC shared with main surrounds */ | 996 | /* Primary DAC shared with main surrounds */ |
997 | BAD_SHARED_SURROUND = 0x100, | 997 | BAD_SHARED_SURROUND = 0x100, |
998 | /* No independent HP possible */ | ||
999 | BAD_NO_INDEP_HP = 0x40, | ||
998 | /* Primary DAC shared with main CLFE */ | 1000 | /* Primary DAC shared with main CLFE */ |
999 | BAD_SHARED_CLFE = 0x10, | 1001 | BAD_SHARED_CLFE = 0x10, |
1000 | /* Primary DAC shared with extra surrounds */ | 1002 | /* Primary DAC shared with extra surrounds */ |
@@ -1392,6 +1394,43 @@ static int check_aamix_out_path(struct hda_codec *codec, int path_idx) | |||
1392 | return snd_hda_get_path_idx(codec, path); | 1394 | return snd_hda_get_path_idx(codec, path); |
1393 | } | 1395 | } |
1394 | 1396 | ||
1397 | /* check whether the independent HP is available with the current config */ | ||
1398 | static bool indep_hp_possible(struct hda_codec *codec) | ||
1399 | { | ||
1400 | struct hda_gen_spec *spec = codec->spec; | ||
1401 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
1402 | struct nid_path *path; | ||
1403 | int i, idx; | ||
1404 | |||
1405 | if (cfg->line_out_type == AUTO_PIN_HP_OUT) | ||
1406 | idx = spec->out_paths[0]; | ||
1407 | else | ||
1408 | idx = spec->hp_paths[0]; | ||
1409 | path = snd_hda_get_path_from_idx(codec, idx); | ||
1410 | if (!path) | ||
1411 | return false; | ||
1412 | |||
1413 | /* assume no path conflicts unless aamix is involved */ | ||
1414 | if (!spec->mixer_nid || !is_nid_contained(path, spec->mixer_nid)) | ||
1415 | return true; | ||
1416 | |||
1417 | /* check whether output paths contain aamix */ | ||
1418 | for (i = 0; i < cfg->line_outs; i++) { | ||
1419 | if (spec->out_paths[i] == idx) | ||
1420 | break; | ||
1421 | path = snd_hda_get_path_from_idx(codec, spec->out_paths[i]); | ||
1422 | if (path && is_nid_contained(path, spec->mixer_nid)) | ||
1423 | return false; | ||
1424 | } | ||
1425 | for (i = 0; i < cfg->speaker_outs; i++) { | ||
1426 | path = snd_hda_get_path_from_idx(codec, spec->speaker_paths[i]); | ||
1427 | if (path && is_nid_contained(path, spec->mixer_nid)) | ||
1428 | return false; | ||
1429 | } | ||
1430 | |||
1431 | return true; | ||
1432 | } | ||
1433 | |||
1395 | /* fill the empty entries in the dac array for speaker/hp with the | 1434 | /* fill the empty entries in the dac array for speaker/hp with the |
1396 | * shared dac pointed by the paths | 1435 | * shared dac pointed by the paths |
1397 | */ | 1436 | */ |
@@ -1545,6 +1584,9 @@ static int fill_and_eval_dacs(struct hda_codec *codec, | |||
1545 | badness += BAD_MULTI_IO; | 1584 | badness += BAD_MULTI_IO; |
1546 | } | 1585 | } |
1547 | 1586 | ||
1587 | if (spec->indep_hp && !indep_hp_possible(codec)) | ||
1588 | badness += BAD_NO_INDEP_HP; | ||
1589 | |||
1548 | /* re-fill the shared DAC for speaker / headphone */ | 1590 | /* re-fill the shared DAC for speaker / headphone */ |
1549 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | 1591 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
1550 | refill_shared_dacs(codec, cfg->hp_outs, | 1592 | refill_shared_dacs(codec, cfg->hp_outs, |
@@ -1758,6 +1800,10 @@ static int parse_output_paths(struct hda_codec *codec) | |||
1758 | cfg->speaker_pins, val); | 1800 | cfg->speaker_pins, val); |
1759 | } | 1801 | } |
1760 | 1802 | ||
1803 | /* clear indep_hp flag if not available */ | ||
1804 | if (spec->indep_hp && !indep_hp_possible(codec)) | ||
1805 | spec->indep_hp = 0; | ||
1806 | |||
1761 | kfree(best_cfg); | 1807 | kfree(best_cfg); |
1762 | return 0; | 1808 | return 0; |
1763 | } | 1809 | } |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 4cea6bb6fade..418bfc0eb0a3 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -415,6 +415,8 @@ struct azx_dev { | |||
415 | unsigned int opened :1; | 415 | unsigned int opened :1; |
416 | unsigned int running :1; | 416 | unsigned int running :1; |
417 | unsigned int irq_pending :1; | 417 | unsigned int irq_pending :1; |
418 | unsigned int prepared:1; | ||
419 | unsigned int locked:1; | ||
418 | /* | 420 | /* |
419 | * For VIA: | 421 | * For VIA: |
420 | * A flag to ensure DMA position is 0 | 422 | * A flag to ensure DMA position is 0 |
@@ -426,8 +428,25 @@ struct azx_dev { | |||
426 | 428 | ||
427 | struct timecounter azx_tc; | 429 | struct timecounter azx_tc; |
428 | struct cyclecounter azx_cc; | 430 | struct cyclecounter azx_cc; |
431 | |||
432 | #ifdef CONFIG_SND_HDA_DSP_LOADER | ||
433 | struct mutex dsp_mutex; | ||
434 | #endif | ||
429 | }; | 435 | }; |
430 | 436 | ||
437 | /* DSP lock helpers */ | ||
438 | #ifdef CONFIG_SND_HDA_DSP_LOADER | ||
439 | #define dsp_lock_init(dev) mutex_init(&(dev)->dsp_mutex) | ||
440 | #define dsp_lock(dev) mutex_lock(&(dev)->dsp_mutex) | ||
441 | #define dsp_unlock(dev) mutex_unlock(&(dev)->dsp_mutex) | ||
442 | #define dsp_is_locked(dev) ((dev)->locked) | ||
443 | #else | ||
444 | #define dsp_lock_init(dev) do {} while (0) | ||
445 | #define dsp_lock(dev) do {} while (0) | ||
446 | #define dsp_unlock(dev) do {} while (0) | ||
447 | #define dsp_is_locked(dev) 0 | ||
448 | #endif | ||
449 | |||
431 | /* CORB/RIRB */ | 450 | /* CORB/RIRB */ |
432 | struct azx_rb { | 451 | struct azx_rb { |
433 | u32 *buf; /* CORB/RIRB buffer | 452 | u32 *buf; /* CORB/RIRB buffer |
@@ -527,6 +546,10 @@ struct azx { | |||
527 | 546 | ||
528 | /* card list (for power_save trigger) */ | 547 | /* card list (for power_save trigger) */ |
529 | struct list_head list; | 548 | struct list_head list; |
549 | |||
550 | #ifdef CONFIG_SND_HDA_DSP_LOADER | ||
551 | struct azx_dev saved_azx_dev; | ||
552 | #endif | ||
530 | }; | 553 | }; |
531 | 554 | ||
532 | #define CREATE_TRACE_POINTS | 555 | #define CREATE_TRACE_POINTS |
@@ -1793,15 +1816,25 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream) | |||
1793 | dev = chip->capture_index_offset; | 1816 | dev = chip->capture_index_offset; |
1794 | nums = chip->capture_streams; | 1817 | nums = chip->capture_streams; |
1795 | } | 1818 | } |
1796 | for (i = 0; i < nums; i++, dev++) | 1819 | for (i = 0; i < nums; i++, dev++) { |
1797 | if (!chip->azx_dev[dev].opened) { | 1820 | struct azx_dev *azx_dev = &chip->azx_dev[dev]; |
1798 | res = &chip->azx_dev[dev]; | 1821 | dsp_lock(azx_dev); |
1799 | if (res->assigned_key == key) | 1822 | if (!azx_dev->opened && !dsp_is_locked(azx_dev)) { |
1800 | break; | 1823 | res = azx_dev; |
1824 | if (res->assigned_key == key) { | ||
1825 | res->opened = 1; | ||
1826 | res->assigned_key = key; | ||
1827 | dsp_unlock(azx_dev); | ||
1828 | return azx_dev; | ||
1829 | } | ||
1801 | } | 1830 | } |
1831 | dsp_unlock(azx_dev); | ||
1832 | } | ||
1802 | if (res) { | 1833 | if (res) { |
1834 | dsp_lock(res); | ||
1803 | res->opened = 1; | 1835 | res->opened = 1; |
1804 | res->assigned_key = key; | 1836 | res->assigned_key = key; |
1837 | dsp_unlock(res); | ||
1805 | } | 1838 | } |
1806 | return res; | 1839 | return res; |
1807 | } | 1840 | } |
@@ -2009,6 +2042,12 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
2009 | struct azx_dev *azx_dev = get_azx_dev(substream); | 2042 | struct azx_dev *azx_dev = get_azx_dev(substream); |
2010 | int ret; | 2043 | int ret; |
2011 | 2044 | ||
2045 | dsp_lock(azx_dev); | ||
2046 | if (dsp_is_locked(azx_dev)) { | ||
2047 | ret = -EBUSY; | ||
2048 | goto unlock; | ||
2049 | } | ||
2050 | |||
2012 | mark_runtime_wc(chip, azx_dev, substream, false); | 2051 | mark_runtime_wc(chip, azx_dev, substream, false); |
2013 | azx_dev->bufsize = 0; | 2052 | azx_dev->bufsize = 0; |
2014 | azx_dev->period_bytes = 0; | 2053 | azx_dev->period_bytes = 0; |
@@ -2016,8 +2055,10 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
2016 | ret = snd_pcm_lib_malloc_pages(substream, | 2055 | ret = snd_pcm_lib_malloc_pages(substream, |
2017 | params_buffer_bytes(hw_params)); | 2056 | params_buffer_bytes(hw_params)); |
2018 | if (ret < 0) | 2057 | if (ret < 0) |
2019 | return ret; | 2058 | goto unlock; |
2020 | mark_runtime_wc(chip, azx_dev, substream, true); | 2059 | mark_runtime_wc(chip, azx_dev, substream, true); |
2060 | unlock: | ||
2061 | dsp_unlock(azx_dev); | ||
2021 | return ret; | 2062 | return ret; |
2022 | } | 2063 | } |
2023 | 2064 | ||
@@ -2029,16 +2070,21 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
2029 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; | 2070 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; |
2030 | 2071 | ||
2031 | /* reset BDL address */ | 2072 | /* reset BDL address */ |
2032 | azx_sd_writel(azx_dev, SD_BDLPL, 0); | 2073 | dsp_lock(azx_dev); |
2033 | azx_sd_writel(azx_dev, SD_BDLPU, 0); | 2074 | if (!dsp_is_locked(azx_dev)) { |
2034 | azx_sd_writel(azx_dev, SD_CTL, 0); | 2075 | azx_sd_writel(azx_dev, SD_BDLPL, 0); |
2035 | azx_dev->bufsize = 0; | 2076 | azx_sd_writel(azx_dev, SD_BDLPU, 0); |
2036 | azx_dev->period_bytes = 0; | 2077 | azx_sd_writel(azx_dev, SD_CTL, 0); |
2037 | azx_dev->format_val = 0; | 2078 | azx_dev->bufsize = 0; |
2079 | azx_dev->period_bytes = 0; | ||
2080 | azx_dev->format_val = 0; | ||
2081 | } | ||
2038 | 2082 | ||
2039 | snd_hda_codec_cleanup(apcm->codec, hinfo, substream); | 2083 | snd_hda_codec_cleanup(apcm->codec, hinfo, substream); |
2040 | 2084 | ||
2041 | mark_runtime_wc(chip, azx_dev, substream, false); | 2085 | mark_runtime_wc(chip, azx_dev, substream, false); |
2086 | azx_dev->prepared = 0; | ||
2087 | dsp_unlock(azx_dev); | ||
2042 | return snd_pcm_lib_free_pages(substream); | 2088 | return snd_pcm_lib_free_pages(substream); |
2043 | } | 2089 | } |
2044 | 2090 | ||
@@ -2055,6 +2101,12 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
2055 | snd_hda_spdif_out_of_nid(apcm->codec, hinfo->nid); | 2101 | snd_hda_spdif_out_of_nid(apcm->codec, hinfo->nid); |
2056 | unsigned short ctls = spdif ? spdif->ctls : 0; | 2102 | unsigned short ctls = spdif ? spdif->ctls : 0; |
2057 | 2103 | ||
2104 | dsp_lock(azx_dev); | ||
2105 | if (dsp_is_locked(azx_dev)) { | ||
2106 | err = -EBUSY; | ||
2107 | goto unlock; | ||
2108 | } | ||
2109 | |||
2058 | azx_stream_reset(chip, azx_dev); | 2110 | azx_stream_reset(chip, azx_dev); |
2059 | format_val = snd_hda_calc_stream_format(runtime->rate, | 2111 | format_val = snd_hda_calc_stream_format(runtime->rate, |
2060 | runtime->channels, | 2112 | runtime->channels, |
@@ -2065,7 +2117,8 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
2065 | snd_printk(KERN_ERR SFX | 2117 | snd_printk(KERN_ERR SFX |
2066 | "%s: invalid format_val, rate=%d, ch=%d, format=%d\n", | 2118 | "%s: invalid format_val, rate=%d, ch=%d, format=%d\n", |
2067 | pci_name(chip->pci), runtime->rate, runtime->channels, runtime->format); | 2119 | pci_name(chip->pci), runtime->rate, runtime->channels, runtime->format); |
2068 | return -EINVAL; | 2120 | err = -EINVAL; |
2121 | goto unlock; | ||
2069 | } | 2122 | } |
2070 | 2123 | ||
2071 | bufsize = snd_pcm_lib_buffer_bytes(substream); | 2124 | bufsize = snd_pcm_lib_buffer_bytes(substream); |
@@ -2084,7 +2137,7 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
2084 | azx_dev->no_period_wakeup = runtime->no_period_wakeup; | 2137 | azx_dev->no_period_wakeup = runtime->no_period_wakeup; |
2085 | err = azx_setup_periods(chip, substream, azx_dev); | 2138 | err = azx_setup_periods(chip, substream, azx_dev); |
2086 | if (err < 0) | 2139 | if (err < 0) |
2087 | return err; | 2140 | goto unlock; |
2088 | } | 2141 | } |
2089 | 2142 | ||
2090 | /* wallclk has 24Mhz clock source */ | 2143 | /* wallclk has 24Mhz clock source */ |
@@ -2101,8 +2154,14 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
2101 | if ((chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) && | 2154 | if ((chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) && |
2102 | stream_tag > chip->capture_streams) | 2155 | stream_tag > chip->capture_streams) |
2103 | stream_tag -= chip->capture_streams; | 2156 | stream_tag -= chip->capture_streams; |
2104 | return snd_hda_codec_prepare(apcm->codec, hinfo, stream_tag, | 2157 | err = snd_hda_codec_prepare(apcm->codec, hinfo, stream_tag, |
2105 | azx_dev->format_val, substream); | 2158 | azx_dev->format_val, substream); |
2159 | |||
2160 | unlock: | ||
2161 | if (!err) | ||
2162 | azx_dev->prepared = 1; | ||
2163 | dsp_unlock(azx_dev); | ||
2164 | return err; | ||
2106 | } | 2165 | } |
2107 | 2166 | ||
2108 | static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | 2167 | static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
@@ -2117,6 +2176,9 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
2117 | azx_dev = get_azx_dev(substream); | 2176 | azx_dev = get_azx_dev(substream); |
2118 | trace_azx_pcm_trigger(chip, azx_dev, cmd); | 2177 | trace_azx_pcm_trigger(chip, azx_dev, cmd); |
2119 | 2178 | ||
2179 | if (dsp_is_locked(azx_dev) || !azx_dev->prepared) | ||
2180 | return -EPIPE; | ||
2181 | |||
2120 | switch (cmd) { | 2182 | switch (cmd) { |
2121 | case SNDRV_PCM_TRIGGER_START: | 2183 | case SNDRV_PCM_TRIGGER_START: |
2122 | rstart = 1; | 2184 | rstart = 1; |
@@ -2621,17 +2683,27 @@ static int azx_load_dsp_prepare(struct hda_bus *bus, unsigned int format, | |||
2621 | struct azx_dev *azx_dev; | 2683 | struct azx_dev *azx_dev; |
2622 | int err; | 2684 | int err; |
2623 | 2685 | ||
2624 | if (snd_hda_lock_devices(bus)) | 2686 | azx_dev = azx_get_dsp_loader_dev(chip); |
2625 | return -EBUSY; | 2687 | |
2688 | dsp_lock(azx_dev); | ||
2689 | spin_lock_irq(&chip->reg_lock); | ||
2690 | if (azx_dev->running || azx_dev->locked) { | ||
2691 | spin_unlock_irq(&chip->reg_lock); | ||
2692 | err = -EBUSY; | ||
2693 | goto unlock; | ||
2694 | } | ||
2695 | azx_dev->prepared = 0; | ||
2696 | chip->saved_azx_dev = *azx_dev; | ||
2697 | azx_dev->locked = 1; | ||
2698 | spin_unlock_irq(&chip->reg_lock); | ||
2626 | 2699 | ||
2627 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, | 2700 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, |
2628 | snd_dma_pci_data(chip->pci), | 2701 | snd_dma_pci_data(chip->pci), |
2629 | byte_size, bufp); | 2702 | byte_size, bufp); |
2630 | if (err < 0) | 2703 | if (err < 0) |
2631 | goto unlock; | 2704 | goto err_alloc; |
2632 | 2705 | ||
2633 | mark_pages_wc(chip, bufp, true); | 2706 | mark_pages_wc(chip, bufp, true); |
2634 | azx_dev = azx_get_dsp_loader_dev(chip); | ||
2635 | azx_dev->bufsize = byte_size; | 2707 | azx_dev->bufsize = byte_size; |
2636 | azx_dev->period_bytes = byte_size; | 2708 | azx_dev->period_bytes = byte_size; |
2637 | azx_dev->format_val = format; | 2709 | azx_dev->format_val = format; |
@@ -2649,13 +2721,20 @@ static int azx_load_dsp_prepare(struct hda_bus *bus, unsigned int format, | |||
2649 | goto error; | 2721 | goto error; |
2650 | 2722 | ||
2651 | azx_setup_controller(chip, azx_dev); | 2723 | azx_setup_controller(chip, azx_dev); |
2724 | dsp_unlock(azx_dev); | ||
2652 | return azx_dev->stream_tag; | 2725 | return azx_dev->stream_tag; |
2653 | 2726 | ||
2654 | error: | 2727 | error: |
2655 | mark_pages_wc(chip, bufp, false); | 2728 | mark_pages_wc(chip, bufp, false); |
2656 | snd_dma_free_pages(bufp); | 2729 | snd_dma_free_pages(bufp); |
2657 | unlock: | 2730 | err_alloc: |
2658 | snd_hda_unlock_devices(bus); | 2731 | spin_lock_irq(&chip->reg_lock); |
2732 | if (azx_dev->opened) | ||
2733 | *azx_dev = chip->saved_azx_dev; | ||
2734 | azx_dev->locked = 0; | ||
2735 | spin_unlock_irq(&chip->reg_lock); | ||
2736 | unlock: | ||
2737 | dsp_unlock(azx_dev); | ||
2659 | return err; | 2738 | return err; |
2660 | } | 2739 | } |
2661 | 2740 | ||
@@ -2677,9 +2756,10 @@ static void azx_load_dsp_cleanup(struct hda_bus *bus, | |||
2677 | struct azx *chip = bus->private_data; | 2756 | struct azx *chip = bus->private_data; |
2678 | struct azx_dev *azx_dev = azx_get_dsp_loader_dev(chip); | 2757 | struct azx_dev *azx_dev = azx_get_dsp_loader_dev(chip); |
2679 | 2758 | ||
2680 | if (!dmab->area) | 2759 | if (!dmab->area || !azx_dev->locked) |
2681 | return; | 2760 | return; |
2682 | 2761 | ||
2762 | dsp_lock(azx_dev); | ||
2683 | /* reset BDL address */ | 2763 | /* reset BDL address */ |
2684 | azx_sd_writel(azx_dev, SD_BDLPL, 0); | 2764 | azx_sd_writel(azx_dev, SD_BDLPL, 0); |
2685 | azx_sd_writel(azx_dev, SD_BDLPU, 0); | 2765 | azx_sd_writel(azx_dev, SD_BDLPU, 0); |
@@ -2692,7 +2772,12 @@ static void azx_load_dsp_cleanup(struct hda_bus *bus, | |||
2692 | snd_dma_free_pages(dmab); | 2772 | snd_dma_free_pages(dmab); |
2693 | dmab->area = NULL; | 2773 | dmab->area = NULL; |
2694 | 2774 | ||
2695 | snd_hda_unlock_devices(bus); | 2775 | spin_lock_irq(&chip->reg_lock); |
2776 | if (azx_dev->opened) | ||
2777 | *azx_dev = chip->saved_azx_dev; | ||
2778 | azx_dev->locked = 0; | ||
2779 | spin_unlock_irq(&chip->reg_lock); | ||
2780 | dsp_unlock(azx_dev); | ||
2696 | } | 2781 | } |
2697 | #endif /* CONFIG_SND_HDA_DSP_LOADER */ | 2782 | #endif /* CONFIG_SND_HDA_DSP_LOADER */ |
2698 | 2783 | ||
@@ -3481,6 +3566,7 @@ static int azx_first_init(struct azx *chip) | |||
3481 | } | 3566 | } |
3482 | 3567 | ||
3483 | for (i = 0; i < chip->num_streams; i++) { | 3568 | for (i = 0; i < chip->num_streams; i++) { |
3569 | dsp_lock_init(&chip->azx_dev[i]); | ||
3484 | /* allocate memory for the BDL for each stream */ | 3570 | /* allocate memory for the BDL for each stream */ |
3485 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, | 3571 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
3486 | snd_dma_pci_data(chip->pci), | 3572 | snd_dma_pci_data(chip->pci), |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 60d08f669f0c..0d9c58f13560 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -168,10 +168,10 @@ static void cs_automute(struct hda_codec *codec) | |||
168 | snd_hda_gen_update_outputs(codec); | 168 | snd_hda_gen_update_outputs(codec); |
169 | 169 | ||
170 | if (spec->gpio_eapd_hp) { | 170 | if (spec->gpio_eapd_hp) { |
171 | unsigned int gpio = spec->gen.hp_jack_present ? | 171 | spec->gpio_data = spec->gen.hp_jack_present ? |
172 | spec->gpio_eapd_hp : spec->gpio_eapd_speaker; | 172 | spec->gpio_eapd_hp : spec->gpio_eapd_speaker; |
173 | snd_hda_codec_write(codec, 0x01, 0, | 173 | snd_hda_codec_write(codec, 0x01, 0, |
174 | AC_VERB_SET_GPIO_DATA, gpio); | 174 | AC_VERB_SET_GPIO_DATA, spec->gpio_data); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 941bf6c766ec..2a89d1eefeb6 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -1142,7 +1142,7 @@ static int patch_cxt5045(struct hda_codec *codec) | |||
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | if (spec->beep_amp) | 1144 | if (spec->beep_amp) |
1145 | snd_hda_attach_beep_device(codec, spec->beep_amp); | 1145 | snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
1146 | 1146 | ||
1147 | return 0; | 1147 | return 0; |
1148 | } | 1148 | } |
@@ -1921,7 +1921,7 @@ static int patch_cxt5051(struct hda_codec *codec) | |||
1921 | } | 1921 | } |
1922 | 1922 | ||
1923 | if (spec->beep_amp) | 1923 | if (spec->beep_amp) |
1924 | snd_hda_attach_beep_device(codec, spec->beep_amp); | 1924 | snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
1925 | 1925 | ||
1926 | return 0; | 1926 | return 0; |
1927 | } | 1927 | } |
@@ -3099,7 +3099,7 @@ static int patch_cxt5066(struct hda_codec *codec) | |||
3099 | } | 3099 | } |
3100 | 3100 | ||
3101 | if (spec->beep_amp) | 3101 | if (spec->beep_amp) |
3102 | snd_hda_attach_beep_device(codec, spec->beep_amp); | 3102 | snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
3103 | 3103 | ||
3104 | return 0; | 3104 | return 0; |
3105 | } | 3105 | } |
@@ -3191,11 +3191,17 @@ static int cx_auto_build_controls(struct hda_codec *codec) | |||
3191 | return 0; | 3191 | return 0; |
3192 | } | 3192 | } |
3193 | 3193 | ||
3194 | static void cx_auto_free(struct hda_codec *codec) | ||
3195 | { | ||
3196 | snd_hda_detach_beep_device(codec); | ||
3197 | snd_hda_gen_free(codec); | ||
3198 | } | ||
3199 | |||
3194 | static const struct hda_codec_ops cx_auto_patch_ops = { | 3200 | static const struct hda_codec_ops cx_auto_patch_ops = { |
3195 | .build_controls = cx_auto_build_controls, | 3201 | .build_controls = cx_auto_build_controls, |
3196 | .build_pcms = snd_hda_gen_build_pcms, | 3202 | .build_pcms = snd_hda_gen_build_pcms, |
3197 | .init = snd_hda_gen_init, | 3203 | .init = snd_hda_gen_init, |
3198 | .free = snd_hda_gen_free, | 3204 | .free = cx_auto_free, |
3199 | .unsol_event = snd_hda_jack_unsol_event, | 3205 | .unsol_event = snd_hda_jack_unsol_event, |
3200 | #ifdef CONFIG_PM | 3206 | #ifdef CONFIG_PM |
3201 | .check_power_status = snd_hda_gen_check_power_status, | 3207 | .check_power_status = snd_hda_gen_check_power_status, |
@@ -3391,7 +3397,7 @@ static int patch_conexant_auto(struct hda_codec *codec) | |||
3391 | 3397 | ||
3392 | codec->patch_ops = cx_auto_patch_ops; | 3398 | codec->patch_ops = cx_auto_patch_ops; |
3393 | if (spec->beep_amp) | 3399 | if (spec->beep_amp) |
3394 | snd_hda_attach_beep_device(codec, spec->beep_amp); | 3400 | snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
3395 | 3401 | ||
3396 | /* Some laptops with Conexant chips show stalls in S3 resume, | 3402 | /* Some laptops with Conexant chips show stalls in S3 resume, |
3397 | * which falls into the single-cmd mode. | 3403 | * which falls into the single-cmd mode. |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 638e7f738018..ca4739c3f650 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -715,8 +715,9 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ | |||
715 | case UAC2_CLOCK_SELECTOR: { | 715 | case UAC2_CLOCK_SELECTOR: { |
716 | struct uac_selector_unit_descriptor *d = p1; | 716 | struct uac_selector_unit_descriptor *d = p1; |
717 | /* call recursively to retrieve the channel info */ | 717 | /* call recursively to retrieve the channel info */ |
718 | if (check_input_term(state, d->baSourceID[0], term) < 0) | 718 | err = check_input_term(state, d->baSourceID[0], term); |
719 | return -ENODEV; | 719 | if (err < 0) |
720 | return err; | ||
720 | term->type = d->bDescriptorSubtype << 16; /* virtual type */ | 721 | term->type = d->bDescriptorSubtype << 16; /* virtual type */ |
721 | term->id = id; | 722 | term->id = id; |
722 | term->name = uac_selector_unit_iSelector(d); | 723 | term->name = uac_selector_unit_iSelector(d); |
@@ -725,7 +726,8 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ | |||
725 | case UAC1_PROCESSING_UNIT: | 726 | case UAC1_PROCESSING_UNIT: |
726 | case UAC1_EXTENSION_UNIT: | 727 | case UAC1_EXTENSION_UNIT: |
727 | /* UAC2_PROCESSING_UNIT_V2 */ | 728 | /* UAC2_PROCESSING_UNIT_V2 */ |
728 | /* UAC2_EFFECT_UNIT */ { | 729 | /* UAC2_EFFECT_UNIT */ |
730 | case UAC2_EXTENSION_UNIT_V2: { | ||
729 | struct uac_processing_unit_descriptor *d = p1; | 731 | struct uac_processing_unit_descriptor *d = p1; |
730 | 732 | ||
731 | if (state->mixer->protocol == UAC_VERSION_2 && | 733 | if (state->mixer->protocol == UAC_VERSION_2 && |
@@ -1356,8 +1358,9 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void | |||
1356 | return err; | 1358 | return err; |
1357 | 1359 | ||
1358 | /* determine the input source type and name */ | 1360 | /* determine the input source type and name */ |
1359 | if (check_input_term(state, hdr->bSourceID, &iterm) < 0) | 1361 | err = check_input_term(state, hdr->bSourceID, &iterm); |
1360 | return -EINVAL; | 1362 | if (err < 0) |
1363 | return err; | ||
1361 | 1364 | ||
1362 | master_bits = snd_usb_combine_bytes(bmaControls, csize); | 1365 | master_bits = snd_usb_combine_bytes(bmaControls, csize); |
1363 | /* master configuration quirks */ | 1366 | /* master configuration quirks */ |
@@ -2052,6 +2055,8 @@ static int parse_audio_unit(struct mixer_build *state, int unitid) | |||
2052 | return parse_audio_extension_unit(state, unitid, p1); | 2055 | return parse_audio_extension_unit(state, unitid, p1); |
2053 | else /* UAC_VERSION_2 */ | 2056 | else /* UAC_VERSION_2 */ |
2054 | return parse_audio_processing_unit(state, unitid, p1); | 2057 | return parse_audio_processing_unit(state, unitid, p1); |
2058 | case UAC2_EXTENSION_UNIT_V2: | ||
2059 | return parse_audio_extension_unit(state, unitid, p1); | ||
2055 | default: | 2060 | default: |
2056 | snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]); | 2061 | snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]); |
2057 | return -EINVAL; | 2062 | return -EINVAL; |
@@ -2118,7 +2123,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | |||
2118 | state.oterm.type = le16_to_cpu(desc->wTerminalType); | 2123 | state.oterm.type = le16_to_cpu(desc->wTerminalType); |
2119 | state.oterm.name = desc->iTerminal; | 2124 | state.oterm.name = desc->iTerminal; |
2120 | err = parse_audio_unit(&state, desc->bSourceID); | 2125 | err = parse_audio_unit(&state, desc->bSourceID); |
2121 | if (err < 0) | 2126 | if (err < 0 && err != -EINVAL) |
2122 | return err; | 2127 | return err; |
2123 | } else { /* UAC_VERSION_2 */ | 2128 | } else { /* UAC_VERSION_2 */ |
2124 | struct uac2_output_terminal_descriptor *desc = p; | 2129 | struct uac2_output_terminal_descriptor *desc = p; |
@@ -2130,12 +2135,12 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | |||
2130 | state.oterm.type = le16_to_cpu(desc->wTerminalType); | 2135 | state.oterm.type = le16_to_cpu(desc->wTerminalType); |
2131 | state.oterm.name = desc->iTerminal; | 2136 | state.oterm.name = desc->iTerminal; |
2132 | err = parse_audio_unit(&state, desc->bSourceID); | 2137 | err = parse_audio_unit(&state, desc->bSourceID); |
2133 | if (err < 0) | 2138 | if (err < 0 && err != -EINVAL) |
2134 | return err; | 2139 | return err; |
2135 | 2140 | ||
2136 | /* for UAC2, use the same approach to also add the clock selectors */ | 2141 | /* for UAC2, use the same approach to also add the clock selectors */ |
2137 | err = parse_audio_unit(&state, desc->bCSourceID); | 2142 | err = parse_audio_unit(&state, desc->bCSourceID); |
2138 | if (err < 0) | 2143 | if (err < 0 && err != -EINVAL) |
2139 | return err; | 2144 | return err; |
2140 | } | 2145 | } |
2141 | } | 2146 | } |
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile index a20e32033431..0b0a90787db6 100644 --- a/tools/lib/traceevent/Makefile +++ b/tools/lib/traceevent/Makefile | |||
@@ -122,7 +122,7 @@ export Q VERBOSE | |||
122 | 122 | ||
123 | EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION) | 123 | EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION) |
124 | 124 | ||
125 | INCLUDES = -I. -I/usr/local/include $(CONFIG_INCLUDES) | 125 | INCLUDES = -I. $(CONFIG_INCLUDES) |
126 | 126 | ||
127 | # Set compile option CFLAGS if not set elsewhere | 127 | # Set compile option CFLAGS if not set elsewhere |
128 | CFLAGS ?= -g -Wall | 128 | CFLAGS ?= -g -Wall |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index a2108ca1cc17..bb74c79cd16e 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -95,7 +95,7 @@ ifeq ("$(origin DEBUG)", "command line") | |||
95 | PERF_DEBUG = $(DEBUG) | 95 | PERF_DEBUG = $(DEBUG) |
96 | endif | 96 | endif |
97 | ifndef PERF_DEBUG | 97 | ifndef PERF_DEBUG |
98 | CFLAGS_OPTIMIZE = -O6 -D_FORTIFY_SOURCE=2 | 98 | CFLAGS_OPTIMIZE = -O6 |
99 | endif | 99 | endif |
100 | 100 | ||
101 | ifdef PARSER_DEBUG | 101 | ifdef PARSER_DEBUG |
@@ -180,6 +180,12 @@ ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-W | |||
180 | CFLAGS := $(CFLAGS) -Wvolatile-register-var | 180 | CFLAGS := $(CFLAGS) -Wvolatile-register-var |
181 | endif | 181 | endif |
182 | 182 | ||
183 | ifndef PERF_DEBUG | ||
184 | ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y) | ||
185 | CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2 | ||
186 | endif | ||
187 | endif | ||
188 | |||
183 | ### --- END CONFIGURATION SECTION --- | 189 | ### --- END CONFIGURATION SECTION --- |
184 | 190 | ||
185 | ifeq ($(srctree),) | 191 | ifeq ($(srctree),) |
diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h index a5223e6a7b43..0fdc85269c4d 100644 --- a/tools/perf/bench/bench.h +++ b/tools/perf/bench/bench.h | |||
@@ -1,6 +1,30 @@ | |||
1 | #ifndef BENCH_H | 1 | #ifndef BENCH_H |
2 | #define BENCH_H | 2 | #define BENCH_H |
3 | 3 | ||
4 | /* | ||
5 | * The madvise transparent hugepage constants were added in glibc | ||
6 | * 2.13. For compatibility with older versions of glibc, define these | ||
7 | * tokens if they are not already defined. | ||
8 | * | ||
9 | * PA-RISC uses different madvise values from other architectures and | ||
10 | * needs to be special-cased. | ||
11 | */ | ||
12 | #ifdef __hppa__ | ||
13 | # ifndef MADV_HUGEPAGE | ||
14 | # define MADV_HUGEPAGE 67 | ||
15 | # endif | ||
16 | # ifndef MADV_NOHUGEPAGE | ||
17 | # define MADV_NOHUGEPAGE 68 | ||
18 | # endif | ||
19 | #else | ||
20 | # ifndef MADV_HUGEPAGE | ||
21 | # define MADV_HUGEPAGE 14 | ||
22 | # endif | ||
23 | # ifndef MADV_NOHUGEPAGE | ||
24 | # define MADV_NOHUGEPAGE 15 | ||
25 | # endif | ||
26 | #endif | ||
27 | |||
4 | extern int bench_numa(int argc, const char **argv, const char *prefix); | 28 | extern int bench_numa(int argc, const char **argv, const char *prefix); |
5 | extern int bench_sched_messaging(int argc, const char **argv, const char *prefix); | 29 | extern int bench_sched_messaging(int argc, const char **argv, const char *prefix); |
6 | extern int bench_sched_pipe(int argc, const char **argv, const char *prefix); | 30 | extern int bench_sched_pipe(int argc, const char **argv, const char *prefix); |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 774c90713a53..f1a939ebc19c 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -573,13 +573,15 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) | |||
573 | perf_event__synthesize_guest_os, tool); | 573 | perf_event__synthesize_guest_os, tool); |
574 | } | 574 | } |
575 | 575 | ||
576 | if (!opts->target.system_wide) | 576 | if (perf_target__has_task(&opts->target)) |
577 | err = perf_event__synthesize_thread_map(tool, evsel_list->threads, | 577 | err = perf_event__synthesize_thread_map(tool, evsel_list->threads, |
578 | process_synthesized_event, | 578 | process_synthesized_event, |
579 | machine); | 579 | machine); |
580 | else | 580 | else if (perf_target__has_cpu(&opts->target)) |
581 | err = perf_event__synthesize_threads(tool, process_synthesized_event, | 581 | err = perf_event__synthesize_threads(tool, process_synthesized_event, |
582 | machine); | 582 | machine); |
583 | else /* command specified */ | ||
584 | err = 0; | ||
583 | 585 | ||
584 | if (err != 0) | 586 | if (err != 0) |
585 | goto out_delete_session; | 587 | goto out_delete_session; |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 38624686ee9a..226a4ae2f936 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -208,8 +208,9 @@ static inline int script_browse(const char *script_opt __maybe_unused) | |||
208 | return 0; | 208 | return 0; |
209 | } | 209 | } |
210 | 210 | ||
211 | #define K_LEFT -1 | 211 | #define K_LEFT -1000 |
212 | #define K_RIGHT -2 | 212 | #define K_RIGHT -2000 |
213 | #define K_SWITCH_INPUT_DATA -3000 | ||
213 | #endif | 214 | #endif |
214 | 215 | ||
215 | #ifdef GTK2_SUPPORT | 216 | #ifdef GTK2_SUPPORT |
diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c index 55433aa42c8f..eabdce0a2daa 100644 --- a/tools/perf/util/strlist.c +++ b/tools/perf/util/strlist.c | |||
@@ -143,7 +143,7 @@ struct strlist *strlist__new(bool dupstr, const char *list) | |||
143 | slist->rblist.node_delete = strlist__node_delete; | 143 | slist->rblist.node_delete = strlist__node_delete; |
144 | 144 | ||
145 | slist->dupstr = dupstr; | 145 | slist->dupstr = dupstr; |
146 | if (slist && strlist__parse_list(slist, list) != 0) | 146 | if (list && strlist__parse_list(slist, list) != 0) |
147 | goto out_error; | 147 | goto out_error; |
148 | } | 148 | } |
149 | 149 | ||
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index ce82b9401958..5ba005c00e2f 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
@@ -74,9 +74,12 @@ static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic, | |||
74 | u32 redir_index = (ioapic->ioregsel - 0x10) >> 1; | 74 | u32 redir_index = (ioapic->ioregsel - 0x10) >> 1; |
75 | u64 redir_content; | 75 | u64 redir_content; |
76 | 76 | ||
77 | ASSERT(redir_index < IOAPIC_NUM_PINS); | 77 | if (redir_index < IOAPIC_NUM_PINS) |
78 | redir_content = | ||
79 | ioapic->redirtbl[redir_index].bits; | ||
80 | else | ||
81 | redir_content = ~0ULL; | ||
78 | 82 | ||
79 | redir_content = ioapic->redirtbl[redir_index].bits; | ||
80 | result = (ioapic->ioregsel & 0x1) ? | 83 | result = (ioapic->ioregsel & 0x1) ? |
81 | (redir_content >> 32) & 0xffffffff : | 84 | (redir_content >> 32) & 0xffffffff : |
82 | redir_content & 0xffffffff; | 85 | redir_content & 0xffffffff; |