diff options
| author | Chris Metcalf <cmetcalf@tilera.com> | 2010-06-25 14:38:16 -0400 |
|---|---|---|
| committer | Chris Metcalf <cmetcalf@tilera.com> | 2010-06-25 14:38:16 -0400 |
| commit | 9c78965ca18594fe0a34a1a1b13781b10f85e4bc (patch) | |
| tree | 60c9e83d3c2b56e3c7f5169b63577a72bf7ddb57 | |
| parent | 139ef32b0e6b88b00b5e3e74d052d938f178dc9b (diff) | |
| parent | 7e27d6e778cd87b6f2415515d7127eba53fe5d02 (diff) | |
Merge branch 'master' into for-linus
216 files changed, 2656 insertions, 1890 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci index 428676cfa61e..25be3250f7d6 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci +++ b/Documentation/ABI/testing/sysfs-bus-pci | |||
| @@ -133,46 +133,6 @@ Description: | |||
| 133 | The symbolic link points to the PCI device sysfs entry of the | 133 | The symbolic link points to the PCI device sysfs entry of the |
| 134 | Physical Function this device associates with. | 134 | Physical Function this device associates with. |
| 135 | 135 | ||
| 136 | |||
| 137 | What: /sys/bus/pci/slots/... | ||
| 138 | Date: April 2005 (possibly older) | ||
| 139 | KernelVersion: 2.6.12 (possibly older) | ||
| 140 | Contact: linux-pci@vger.kernel.org | ||
| 141 | Description: | ||
| 142 | When the appropriate driver is loaded, it will create a | ||
| 143 | directory per claimed physical PCI slot in | ||
| 144 | /sys/bus/pci/slots/. The names of these directories are | ||
| 145 | specific to the driver, which in turn, are specific to the | ||
| 146 | platform, but in general, should match the label on the | ||
| 147 | machine's physical chassis. | ||
| 148 | |||
| 149 | The drivers that can create slot directories include the | ||
| 150 | PCI hotplug drivers, and as of 2.6.27, the pci_slot driver. | ||
| 151 | |||
| 152 | The slot directories contain, at a minimum, a file named | ||
| 153 | 'address' which contains the PCI bus:device:function tuple. | ||
| 154 | Other files may appear as well, but are specific to the | ||
| 155 | driver. | ||
| 156 | |||
| 157 | What: /sys/bus/pci/slots/.../function[0-7] | ||
| 158 | Date: March 2010 | ||
| 159 | KernelVersion: 2.6.35 | ||
| 160 | Contact: linux-pci@vger.kernel.org | ||
| 161 | Description: | ||
| 162 | If PCI slot directories (as described above) are created, | ||
| 163 | and the physical slot is actually populated with a device, | ||
| 164 | symbolic links in the slot directory pointing to the | ||
| 165 | device's PCI functions are created as well. | ||
| 166 | |||
| 167 | What: /sys/bus/pci/devices/.../slot | ||
| 168 | Date: March 2010 | ||
| 169 | KernelVersion: 2.6.35 | ||
| 170 | Contact: linux-pci@vger.kernel.org | ||
| 171 | Description: | ||
| 172 | If PCI slot directories (as described above) are created, | ||
| 173 | a symbolic link pointing to the slot directory will be | ||
| 174 | created as well. | ||
| 175 | |||
| 176 | What: /sys/bus/pci/slots/.../module | 136 | What: /sys/bus/pci/slots/.../module |
| 177 | Date: June 2009 | 137 | Date: June 2009 |
| 178 | Contact: linux-pci@vger.kernel.org | 138 | Contact: linux-pci@vger.kernel.org |
diff --git a/Documentation/filesystems/xfs-delayed-logging-design.txt b/Documentation/filesystems/xfs-delayed-logging-design.txt index d8119e9d2d60..96d0df28bed3 100644 --- a/Documentation/filesystems/xfs-delayed-logging-design.txt +++ b/Documentation/filesystems/xfs-delayed-logging-design.txt | |||
| @@ -794,11 +794,6 @@ designed. | |||
| 794 | 794 | ||
| 795 | Roadmap: | 795 | Roadmap: |
| 796 | 796 | ||
| 797 | 2.6.35 Inclusion in mainline as an experimental mount option | ||
| 798 | => approximately 2-3 months to merge window | ||
| 799 | => needs to be in xfs-dev tree in 4-6 weeks | ||
| 800 | => code is nearing readiness for review | ||
| 801 | |||
| 802 | 2.6.37 Remove experimental tag from mount option | 797 | 2.6.37 Remove experimental tag from mount option |
| 803 | => should be roughly 6 months after initial merge | 798 | => should be roughly 6 months after initial merge |
| 804 | => enough time to: | 799 | => enough time to: |
diff --git a/MAINTAINERS b/MAINTAINERS index 969b84bb8462..c92dd6663f8a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -2978,7 +2978,6 @@ F: drivers/net/ixgb/ | |||
| 2978 | F: drivers/net/ixgbe/ | 2978 | F: drivers/net/ixgbe/ |
| 2979 | 2979 | ||
| 2980 | INTEL PRO/WIRELESS 2100 NETWORK CONNECTION SUPPORT | 2980 | INTEL PRO/WIRELESS 2100 NETWORK CONNECTION SUPPORT |
| 2981 | M: Zhu Yi <yi.zhu@intel.com> | ||
| 2982 | M: Reinette Chatre <reinette.chatre@intel.com> | 2981 | M: Reinette Chatre <reinette.chatre@intel.com> |
| 2983 | M: Intel Linux Wireless <ilw@linux.intel.com> | 2982 | M: Intel Linux Wireless <ilw@linux.intel.com> |
| 2984 | L: linux-wireless@vger.kernel.org | 2983 | L: linux-wireless@vger.kernel.org |
| @@ -2988,7 +2987,6 @@ F: Documentation/networking/README.ipw2100 | |||
| 2988 | F: drivers/net/wireless/ipw2x00/ipw2100.* | 2987 | F: drivers/net/wireless/ipw2x00/ipw2100.* |
| 2989 | 2988 | ||
| 2990 | INTEL PRO/WIRELESS 2915ABG NETWORK CONNECTION SUPPORT | 2989 | INTEL PRO/WIRELESS 2915ABG NETWORK CONNECTION SUPPORT |
| 2991 | M: Zhu Yi <yi.zhu@intel.com> | ||
| 2992 | M: Reinette Chatre <reinette.chatre@intel.com> | 2990 | M: Reinette Chatre <reinette.chatre@intel.com> |
| 2993 | M: Intel Linux Wireless <ilw@linux.intel.com> | 2991 | M: Intel Linux Wireless <ilw@linux.intel.com> |
| 2994 | L: linux-wireless@vger.kernel.org | 2992 | L: linux-wireless@vger.kernel.org |
| @@ -3019,8 +3017,8 @@ F: drivers/net/wimax/i2400m/ | |||
| 3019 | F: include/linux/wimax/i2400m.h | 3017 | F: include/linux/wimax/i2400m.h |
| 3020 | 3018 | ||
| 3021 | INTEL WIRELESS WIFI LINK (iwlwifi) | 3019 | INTEL WIRELESS WIFI LINK (iwlwifi) |
| 3022 | M: Zhu Yi <yi.zhu@intel.com> | ||
| 3023 | M: Reinette Chatre <reinette.chatre@intel.com> | 3020 | M: Reinette Chatre <reinette.chatre@intel.com> |
| 3021 | M: Wey-Yi Guy <wey-yi.w.guy@intel.com> | ||
| 3024 | M: Intel Linux Wireless <ilw@linux.intel.com> | 3022 | M: Intel Linux Wireless <ilw@linux.intel.com> |
| 3025 | L: linux-wireless@vger.kernel.org | 3023 | L: linux-wireless@vger.kernel.org |
| 3026 | W: http://intellinuxwireless.org | 3024 | W: http://intellinuxwireless.org |
| @@ -3030,7 +3028,6 @@ F: drivers/net/wireless/iwlwifi/ | |||
| 3030 | 3028 | ||
| 3031 | INTEL WIRELESS MULTICOMM 3200 WIFI (iwmc3200wifi) | 3029 | INTEL WIRELESS MULTICOMM 3200 WIFI (iwmc3200wifi) |
| 3032 | M: Samuel Ortiz <samuel.ortiz@intel.com> | 3030 | M: Samuel Ortiz <samuel.ortiz@intel.com> |
| 3033 | M: Zhu Yi <yi.zhu@intel.com> | ||
| 3034 | M: Intel Linux Wireless <ilw@linux.intel.com> | 3031 | M: Intel Linux Wireless <ilw@linux.intel.com> |
| 3035 | L: linux-wireless@vger.kernel.org | 3032 | L: linux-wireless@vger.kernel.org |
| 3036 | S: Supported | 3033 | S: Supported |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 2 | 1 | VERSION = 2 |
| 2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
| 3 | SUBLEVEL = 35 | 3 | SUBLEVEL = 35 |
| 4 | EXTRAVERSION = -rc1 | 4 | EXTRAVERSION = -rc3 |
| 5 | NAME = Sheep on Meth | 5 | NAME = Sheep on Meth |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
| @@ -1095,7 +1095,7 @@ all: modules | |||
| 1095 | # using awk while concatenating to the final file. | 1095 | # using awk while concatenating to the final file. |
| 1096 | 1096 | ||
| 1097 | PHONY += modules | 1097 | PHONY += modules |
| 1098 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) | 1098 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin |
| 1099 | $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order | 1099 | $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order |
| 1100 | @$(kecho) ' Building modules, stage 2.'; | 1100 | @$(kecho) ' Building modules, stage 2.'; |
| 1101 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost | 1101 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
| @@ -1117,7 +1117,7 @@ PHONY += modules_install | |||
| 1117 | modules_install: _modinst_ _modinst_post | 1117 | modules_install: _modinst_ _modinst_post |
| 1118 | 1118 | ||
| 1119 | PHONY += _modinst_ | 1119 | PHONY += _modinst_ |
| 1120 | _modinst_: modules.builtin | 1120 | _modinst_: |
| 1121 | @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \ | 1121 | @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \ |
| 1122 | echo "Warning: you may need to install module-init-tools"; \ | 1122 | echo "Warning: you may need to install module-init-tools"; \ |
| 1123 | echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\ | 1123 | echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\ |
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index a52a27c1d9be..6f80665f477e 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c | |||
| @@ -951,8 +951,6 @@ static int sa1111_resume(struct platform_device *dev) | |||
| 951 | if (!save) | 951 | if (!save) |
| 952 | return 0; | 952 | return 0; |
| 953 | 953 | ||
| 954 | spin_lock_irqsave(&sachip->lock, flags); | ||
| 955 | |||
| 956 | /* | 954 | /* |
| 957 | * Ensure that the SA1111 is still here. | 955 | * Ensure that the SA1111 is still here. |
| 958 | * FIXME: shouldn't do this here. | 956 | * FIXME: shouldn't do this here. |
| @@ -969,6 +967,13 @@ static int sa1111_resume(struct platform_device *dev) | |||
| 969 | * First of all, wake up the chip. | 967 | * First of all, wake up the chip. |
| 970 | */ | 968 | */ |
| 971 | sa1111_wake(sachip); | 969 | sa1111_wake(sachip); |
| 970 | |||
| 971 | /* | ||
| 972 | * Only lock for write ops. Also, sa1111_wake must be called with | ||
| 973 | * released spinlock! | ||
| 974 | */ | ||
| 975 | spin_lock_irqsave(&sachip->lock, flags); | ||
| 976 | |||
| 972 | sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN0); | 977 | sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN0); |
| 973 | sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN1); | 978 | sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN1); |
| 974 | 979 | ||
diff --git a/arch/arm/mach-msm/dma.c b/arch/arm/mach-msm/dma.c index d029d1f5f9e2..02cae5e2951c 100644 --- a/arch/arm/mach-msm/dma.c +++ b/arch/arm/mach-msm/dma.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
| 18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
| 19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
| 20 | #include <linux/completion.h> | ||
| 20 | #include <mach/dma.h> | 21 | #include <mach/dma.h> |
| 21 | 22 | ||
| 22 | #define MSM_DMOV_CHANNEL_COUNT 16 | 23 | #define MSM_DMOV_CHANNEL_COUNT 16 |
diff --git a/arch/arm/mach-nomadik/clock.c b/arch/arm/mach-nomadik/clock.c index 2c471fc451d7..f035f4185274 100644 --- a/arch/arm/mach-nomadik/clock.c +++ b/arch/arm/mach-nomadik/clock.c | |||
| @@ -32,7 +32,10 @@ void clk_disable(struct clk *clk) | |||
| 32 | } | 32 | } |
| 33 | EXPORT_SYMBOL(clk_disable); | 33 | EXPORT_SYMBOL(clk_disable); |
| 34 | 34 | ||
| 35 | /* We have a fixed clock alone, for now */ | 35 | static struct clk clk_24 = { |
| 36 | .rate = 2400000, | ||
| 37 | }; | ||
| 38 | |||
| 36 | static struct clk clk_48 = { | 39 | static struct clk clk_48 = { |
| 37 | .rate = 48 * 1000 * 1000, | 40 | .rate = 48 * 1000 * 1000, |
| 38 | }; | 41 | }; |
| @@ -50,6 +53,8 @@ static struct clk clk_default; | |||
| 50 | } | 53 | } |
| 51 | 54 | ||
| 52 | static struct clk_lookup lookups[] = { | 55 | static struct clk_lookup lookups[] = { |
| 56 | CLK(&clk_24, "mtu0"), | ||
| 57 | CLK(&clk_24, "mtu1"), | ||
| 53 | CLK(&clk_48, "uart0"), | 58 | CLK(&clk_48, "uart0"), |
| 54 | CLK(&clk_48, "uart1"), | 59 | CLK(&clk_48, "uart1"), |
| 55 | CLK(&clk_default, "gpio.0"), | 60 | CLK(&clk_default, "gpio.0"), |
| @@ -59,10 +64,8 @@ static struct clk_lookup lookups[] = { | |||
| 59 | CLK(&clk_default, "rng"), | 64 | CLK(&clk_default, "rng"), |
| 60 | }; | 65 | }; |
| 61 | 66 | ||
| 62 | static int __init clk_init(void) | 67 | int __init clk_init(void) |
| 63 | { | 68 | { |
| 64 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | 69 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |
| 65 | return 0; | 70 | return 0; |
| 66 | } | 71 | } |
| 67 | |||
| 68 | arch_initcall(clk_init); | ||
diff --git a/arch/arm/mach-nomadik/clock.h b/arch/arm/mach-nomadik/clock.h index 5563985a2cc7..78da2e7c3985 100644 --- a/arch/arm/mach-nomadik/clock.h +++ b/arch/arm/mach-nomadik/clock.h | |||
| @@ -11,3 +11,5 @@ | |||
| 11 | struct clk { | 11 | struct clk { |
| 12 | unsigned long rate; | 12 | unsigned long rate; |
| 13 | }; | 13 | }; |
| 14 | |||
| 15 | int __init clk_init(void); | ||
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c index 91c3c901b469..ac58e3b03b1a 100644 --- a/arch/arm/mach-nomadik/cpu-8815.c +++ b/arch/arm/mach-nomadik/cpu-8815.c | |||
| @@ -31,6 +31,8 @@ | |||
| 31 | #include <asm/cacheflush.h> | 31 | #include <asm/cacheflush.h> |
| 32 | #include <asm/hardware/cache-l2x0.h> | 32 | #include <asm/hardware/cache-l2x0.h> |
| 33 | 33 | ||
| 34 | #include "clock.h" | ||
| 35 | |||
| 34 | #define __MEM_4K_RESOURCE(x) \ | 36 | #define __MEM_4K_RESOURCE(x) \ |
| 35 | .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM} | 37 | .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM} |
| 36 | 38 | ||
| @@ -143,6 +145,12 @@ void __init cpu8815_init_irq(void) | |||
| 143 | /* This modified VIC cell has two register blocks, at 0 and 0x20 */ | 145 | /* This modified VIC cell has two register blocks, at 0 and 0x20 */ |
| 144 | vic_init(io_p2v(NOMADIK_IC_BASE + 0x00), IRQ_VIC_START + 0, ~0, 0); | 146 | vic_init(io_p2v(NOMADIK_IC_BASE + 0x00), IRQ_VIC_START + 0, ~0, 0); |
| 145 | vic_init(io_p2v(NOMADIK_IC_BASE + 0x20), IRQ_VIC_START + 32, ~0, 0); | 147 | vic_init(io_p2v(NOMADIK_IC_BASE + 0x20), IRQ_VIC_START + 32, ~0, 0); |
| 148 | |||
| 149 | /* | ||
| 150 | * Init clocks here so that they are available for system timer | ||
| 151 | * initialization. | ||
| 152 | */ | ||
| 153 | clk_init(); | ||
| 146 | } | 154 | } |
| 147 | 155 | ||
| 148 | /* | 156 | /* |
diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c index 033b567e50bb..ce1104d1bc17 100644 --- a/arch/arm/mach-pxa/palmtc.c +++ b/arch/arm/mach-pxa/palmtc.c | |||
| @@ -263,11 +263,11 @@ const struct matrix_keymap_data palmtc_keymap_data = { | |||
| 263 | .keymap_size = ARRAY_SIZE(palmtc_matrix_keys), | 263 | .keymap_size = ARRAY_SIZE(palmtc_matrix_keys), |
| 264 | }; | 264 | }; |
| 265 | 265 | ||
| 266 | const static unsigned int palmtc_keypad_row_gpios[] = { | 266 | static const unsigned int palmtc_keypad_row_gpios[] = { |
| 267 | 0, 9, 10, 11 | 267 | 0, 9, 10, 11 |
| 268 | }; | 268 | }; |
| 269 | 269 | ||
| 270 | const static unsigned int palmtc_keypad_col_gpios[] = { | 270 | static const unsigned int palmtc_keypad_col_gpios[] = { |
| 271 | 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 79, 80 | 271 | 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 79, 80 |
| 272 | }; | 272 | }; |
| 273 | 273 | ||
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 4d2413ed0ffa..c1048a35f187 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
| @@ -818,6 +818,9 @@ static struct i2c_board_info akita_i2c_board_info[] = { | |||
| 818 | .type = "max7310", | 818 | .type = "max7310", |
| 819 | .addr = 0x18, | 819 | .addr = 0x18, |
| 820 | .platform_data = &akita_ioexp, | 820 | .platform_data = &akita_ioexp, |
| 821 | }, { | ||
| 822 | .type = "wm8750", | ||
| 823 | .addr = 0x1b, | ||
| 821 | }, | 824 | }, |
| 822 | }; | 825 | }; |
| 823 | 826 | ||
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index c7bc4199e3a8..4556aea9c3c5 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile | |||
| @@ -7,4 +7,5 @@ obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o devices-db5500.o | |||
| 7 | obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o | 7 | obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o |
| 8 | obj-$(CONFIG_MACH_U8500_MOP) += board-mop500.o | 8 | obj-$(CONFIG_MACH_U8500_MOP) += board-mop500.o |
| 9 | obj-$(CONFIG_MACH_U5500) += board-u5500.o | 9 | obj-$(CONFIG_MACH_U5500) += board-u5500.o |
| 10 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o localtimer.o | 10 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o |
| 11 | obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o | ||
diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c index 6544855af2f1..fe84b9021c7a 100644 --- a/arch/arm/mach-ux500/clock.c +++ b/arch/arm/mach-ux500/clock.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include <asm/clkdev.h> | 17 | #include <asm/clkdev.h> |
| 18 | 18 | ||
| 19 | #include <plat/mtu.h> | ||
| 19 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
| 20 | #include "clock.h" | 21 | #include "clock.h" |
| 21 | 22 | ||
| @@ -59,6 +60,9 @@ | |||
| 59 | #define PRCM_DMACLK_MGT 0x074 | 60 | #define PRCM_DMACLK_MGT 0x074 |
| 60 | #define PRCM_B2R2CLK_MGT 0x078 | 61 | #define PRCM_B2R2CLK_MGT 0x078 |
| 61 | #define PRCM_TVCLK_MGT 0x07C | 62 | #define PRCM_TVCLK_MGT 0x07C |
| 63 | #define PRCM_TCR 0x1C8 | ||
| 64 | #define PRCM_TCR_STOPPED (1 << 16) | ||
| 65 | #define PRCM_TCR_DOZE_MODE (1 << 17) | ||
| 62 | #define PRCM_UNIPROCLK_MGT 0x278 | 66 | #define PRCM_UNIPROCLK_MGT 0x278 |
| 63 | #define PRCM_SSPCLK_MGT 0x280 | 67 | #define PRCM_SSPCLK_MGT 0x280 |
| 64 | #define PRCM_RNGCLK_MGT 0x284 | 68 | #define PRCM_RNGCLK_MGT 0x284 |
| @@ -120,10 +124,95 @@ void clk_disable(struct clk *clk) | |||
| 120 | } | 124 | } |
| 121 | EXPORT_SYMBOL(clk_disable); | 125 | EXPORT_SYMBOL(clk_disable); |
| 122 | 126 | ||
| 127 | /* | ||
| 128 | * The MTU has a separate, rather complex muxing setup | ||
| 129 | * with alternative parents (peripheral cluster or | ||
| 130 | * ULP or fixed 32768 Hz) depending on settings | ||
| 131 | */ | ||
| 132 | static unsigned long clk_mtu_get_rate(struct clk *clk) | ||
| 133 | { | ||
| 134 | void __iomem *addr = __io_address(U8500_PRCMU_BASE) | ||
| 135 | + PRCM_TCR; | ||
| 136 | u32 tcr = readl(addr); | ||
| 137 | int mtu = (int) clk->data; | ||
| 138 | /* | ||
| 139 | * One of these is selected eventually | ||
| 140 | * TODO: Replace the constant with a reference | ||
| 141 | * to the ULP source once this is modeled. | ||
| 142 | */ | ||
| 143 | unsigned long clk32k = 32768; | ||
| 144 | unsigned long mturate; | ||
| 145 | unsigned long retclk; | ||
| 146 | |||
| 147 | /* Get the rate from the parent as a default */ | ||
| 148 | if (clk->parent_periph) | ||
| 149 | mturate = clk_get_rate(clk->parent_periph); | ||
| 150 | else if (clk->parent_cluster) | ||
| 151 | mturate = clk_get_rate(clk->parent_cluster); | ||
| 152 | else | ||
| 153 | /* We need to be connected SOMEWHERE */ | ||
| 154 | BUG(); | ||
| 155 | |||
| 156 | /* | ||
| 157 | * Are we in doze mode? | ||
| 158 | * In this mode the parent peripheral or the fixed 32768 Hz | ||
| 159 | * clock is fed into the block. | ||
| 160 | */ | ||
| 161 | if (!(tcr & PRCM_TCR_DOZE_MODE)) { | ||
| 162 | /* | ||
| 163 | * Here we're using the clock input from the APE ULP | ||
| 164 | * clock domain. But first: are the timers stopped? | ||
| 165 | */ | ||
| 166 | if (tcr & PRCM_TCR_STOPPED) { | ||
| 167 | clk32k = 0; | ||
| 168 | mturate = 0; | ||
| 169 | } else { | ||
| 170 | /* Else default mode: 0 and 2.4 MHz */ | ||
| 171 | clk32k = 0; | ||
| 172 | if (cpu_is_u5500()) | ||
| 173 | /* DB5500 divides by 8 */ | ||
| 174 | mturate /= 8; | ||
| 175 | else if (cpu_is_u8500ed()) { | ||
| 176 | /* | ||
| 177 | * This clocking setting must not be used | ||
| 178 | * in the ED chip, it is simply not | ||
| 179 | * connected anywhere! | ||
| 180 | */ | ||
| 181 | mturate = 0; | ||
| 182 | BUG(); | ||
| 183 | } else | ||
| 184 | /* | ||
| 185 | * In this mode the ulp38m4 clock is divided | ||
| 186 | * by a factor 16, on the DB8500 typically | ||
| 187 | * 38400000 / 16 ~ 2.4 MHz. | ||
| 188 | * TODO: Replace the constant with a reference | ||
| 189 | * to the ULP source once this is modeled. | ||
| 190 | */ | ||
| 191 | mturate = 38400000 / 16; | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | /* Return the clock selected for this MTU */ | ||
| 196 | if (tcr & (1 << mtu)) | ||
| 197 | retclk = clk32k; | ||
| 198 | else | ||
| 199 | retclk = mturate; | ||
| 200 | |||
| 201 | pr_info("MTU%d clock rate: %lu Hz\n", mtu, retclk); | ||
| 202 | return retclk; | ||
| 203 | } | ||
| 204 | |||
| 123 | unsigned long clk_get_rate(struct clk *clk) | 205 | unsigned long clk_get_rate(struct clk *clk) |
| 124 | { | 206 | { |
| 125 | unsigned long rate; | 207 | unsigned long rate; |
| 126 | 208 | ||
| 209 | /* | ||
| 210 | * If there is a custom getrate callback for this clock, | ||
| 211 | * it will take precedence. | ||
| 212 | */ | ||
| 213 | if (clk->get_rate) | ||
| 214 | return clk->get_rate(clk); | ||
| 215 | |||
| 127 | if (clk->ops && clk->ops->get_rate) | 216 | if (clk->ops && clk->ops->get_rate) |
| 128 | return clk->ops->get_rate(clk); | 217 | return clk->ops->get_rate(clk); |
| 129 | 218 | ||
| @@ -341,8 +430,9 @@ static DEFINE_PRCC_CLK(5, usb_v1, 0, 0, NULL); | |||
| 341 | 430 | ||
| 342 | /* Peripheral Cluster #6 */ | 431 | /* Peripheral Cluster #6 */ |
| 343 | 432 | ||
| 344 | static DEFINE_PRCC_CLK(6, mtu1_v1, 8, -1, NULL); | 433 | /* MTU ID in data */ |
| 345 | static DEFINE_PRCC_CLK(6, mtu0_v1, 7, -1, NULL); | 434 | static DEFINE_PRCC_CLK_CUSTOM(6, mtu1_v1, 8, -1, NULL, clk_mtu_get_rate, 1); |
| 435 | static DEFINE_PRCC_CLK_CUSTOM(6, mtu0_v1, 7, -1, NULL, clk_mtu_get_rate, 0); | ||
| 346 | static DEFINE_PRCC_CLK(6, cfgreg_v1, 6, 6, NULL); | 436 | static DEFINE_PRCC_CLK(6, cfgreg_v1, 6, 6, NULL); |
| 347 | static DEFINE_PRCC_CLK(6, dmc_ed, 6, 6, NULL); | 437 | static DEFINE_PRCC_CLK(6, dmc_ed, 6, 6, NULL); |
| 348 | static DEFINE_PRCC_CLK(6, hash1, 5, -1, NULL); | 438 | static DEFINE_PRCC_CLK(6, hash1, 5, -1, NULL); |
| @@ -357,8 +447,9 @@ static DEFINE_PRCC_CLK(6, rng_v1, 0, 0, &clk_rngclk); | |||
| 357 | /* Peripheral Cluster #7 */ | 447 | /* Peripheral Cluster #7 */ |
| 358 | 448 | ||
| 359 | static DEFINE_PRCC_CLK(7, tzpc0_ed, 4, -1, NULL); | 449 | static DEFINE_PRCC_CLK(7, tzpc0_ed, 4, -1, NULL); |
| 360 | static DEFINE_PRCC_CLK(7, mtu1_ed, 3, -1, NULL); | 450 | /* MTU ID in data */ |
| 361 | static DEFINE_PRCC_CLK(7, mtu0_ed, 2, -1, NULL); | 451 | static DEFINE_PRCC_CLK_CUSTOM(7, mtu1_ed, 3, -1, NULL, clk_mtu_get_rate, 1); |
| 452 | static DEFINE_PRCC_CLK_CUSTOM(7, mtu0_ed, 2, -1, NULL, clk_mtu_get_rate, 0); | ||
| 362 | static DEFINE_PRCC_CLK(7, wdg_ed, 1, -1, NULL); | 453 | static DEFINE_PRCC_CLK(7, wdg_ed, 1, -1, NULL); |
| 363 | static DEFINE_PRCC_CLK(7, cfgreg_ed, 0, -1, NULL); | 454 | static DEFINE_PRCC_CLK(7, cfgreg_ed, 0, -1, NULL); |
| 364 | 455 | ||
| @@ -503,15 +594,17 @@ static struct clk_lookup u8500_v1_clks[] = { | |||
| 503 | CLK(uiccclk, "uicc", NULL), | 594 | CLK(uiccclk, "uicc", NULL), |
| 504 | }; | 595 | }; |
| 505 | 596 | ||
| 506 | static int __init clk_init(void) | 597 | int __init clk_init(void) |
| 507 | { | 598 | { |
| 508 | if (cpu_is_u8500ed()) { | 599 | if (cpu_is_u8500ed()) { |
| 509 | clk_prcmu_ops.enable = clk_prcmu_ed_enable; | 600 | clk_prcmu_ops.enable = clk_prcmu_ed_enable; |
| 510 | clk_prcmu_ops.disable = clk_prcmu_ed_disable; | 601 | clk_prcmu_ops.disable = clk_prcmu_ed_disable; |
| 602 | clk_per6clk.rate = 100000000; | ||
| 511 | } else if (cpu_is_u5500()) { | 603 | } else if (cpu_is_u5500()) { |
| 512 | /* Clock tree for U5500 not implemented yet */ | 604 | /* Clock tree for U5500 not implemented yet */ |
| 513 | clk_prcc_ops.enable = clk_prcc_ops.disable = NULL; | 605 | clk_prcc_ops.enable = clk_prcc_ops.disable = NULL; |
| 514 | clk_prcmu_ops.enable = clk_prcmu_ops.disable = NULL; | 606 | clk_prcmu_ops.enable = clk_prcmu_ops.disable = NULL; |
| 607 | clk_per6clk.rate = 26000000; | ||
| 515 | } | 608 | } |
| 516 | 609 | ||
| 517 | clkdev_add_table(u8500_common_clks, ARRAY_SIZE(u8500_common_clks)); | 610 | clkdev_add_table(u8500_common_clks, ARRAY_SIZE(u8500_common_clks)); |
| @@ -522,4 +615,3 @@ static int __init clk_init(void) | |||
| 522 | 615 | ||
| 523 | return 0; | 616 | return 0; |
| 524 | } | 617 | } |
| 525 | arch_initcall(clk_init); | ||
diff --git a/arch/arm/mach-ux500/clock.h b/arch/arm/mach-ux500/clock.h index e4f99b65026f..a05802501527 100644 --- a/arch/arm/mach-ux500/clock.h +++ b/arch/arm/mach-ux500/clock.h | |||
| @@ -28,6 +28,9 @@ struct clkops { | |||
| 28 | * @ops: pointer to clkops struct used to control this clock | 28 | * @ops: pointer to clkops struct used to control this clock |
| 29 | * @name: name, for debugging | 29 | * @name: name, for debugging |
| 30 | * @enabled: refcount. positive if enabled, zero if disabled | 30 | * @enabled: refcount. positive if enabled, zero if disabled |
| 31 | * @get_rate: custom callback for getting the clock rate | ||
| 32 | * @data: custom per-clock data for example for the get_rate | ||
| 33 | * callback | ||
| 31 | * @rate: fixed rate for clocks which don't implement | 34 | * @rate: fixed rate for clocks which don't implement |
| 32 | * ops->getrate | 35 | * ops->getrate |
| 33 | * @prcmu_cg_off: address offset of the combined enable/disable register | 36 | * @prcmu_cg_off: address offset of the combined enable/disable register |
| @@ -67,6 +70,8 @@ struct clk { | |||
| 67 | const struct clkops *ops; | 70 | const struct clkops *ops; |
| 68 | const char *name; | 71 | const char *name; |
| 69 | unsigned int enabled; | 72 | unsigned int enabled; |
| 73 | unsigned long (*get_rate)(struct clk *); | ||
| 74 | void *data; | ||
| 70 | 75 | ||
| 71 | unsigned long rate; | 76 | unsigned long rate; |
| 72 | struct list_head list; | 77 | struct list_head list; |
| @@ -117,9 +122,26 @@ struct clk clk_##_name = { \ | |||
| 117 | .parent_periph = _kernclk \ | 122 | .parent_periph = _kernclk \ |
| 118 | } | 123 | } |
| 119 | 124 | ||
| 125 | #define DEFINE_PRCC_CLK_CUSTOM(_pclust, _name, _bus_en, _kernel_en, _kernclk, _callback, _data) \ | ||
| 126 | struct clk clk_##_name = { \ | ||
| 127 | .name = #_name, \ | ||
| 128 | .ops = &clk_prcc_ops, \ | ||
| 129 | .cluster = _pclust, \ | ||
| 130 | .prcc_bus = _bus_en, \ | ||
| 131 | .prcc_kernel = _kernel_en, \ | ||
| 132 | .parent_cluster = &clk_per##_pclust##clk, \ | ||
| 133 | .parent_periph = _kernclk, \ | ||
| 134 | .get_rate = _callback, \ | ||
| 135 | .data = (void *) _data \ | ||
| 136 | } | ||
| 137 | |||
| 138 | |||
| 120 | #define CLK(_clk, _devname, _conname) \ | 139 | #define CLK(_clk, _devname, _conname) \ |
| 121 | { \ | 140 | { \ |
| 122 | .clk = &clk_##_clk, \ | 141 | .clk = &clk_##_clk, \ |
| 123 | .dev_id = _devname, \ | 142 | .dev_id = _devname, \ |
| 124 | .con_id = _conname, \ | 143 | .con_id = _conname, \ |
| 125 | } | 144 | } |
| 145 | |||
| 146 | int __init clk_db8500_ed_fixup(void); | ||
| 147 | int __init clk_init(void); | ||
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index d81ad023963c..e0fd747e447a 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c | |||
| @@ -62,6 +62,12 @@ void __init ux500_init_irq(void) | |||
| 62 | { | 62 | { |
| 63 | gic_dist_init(0, __io_address(UX500_GIC_DIST_BASE), 29); | 63 | gic_dist_init(0, __io_address(UX500_GIC_DIST_BASE), 29); |
| 64 | gic_cpu_init(0, __io_address(UX500_GIC_CPU_BASE)); | 64 | gic_cpu_init(0, __io_address(UX500_GIC_CPU_BASE)); |
| 65 | |||
| 66 | /* | ||
| 67 | * Init clocks here so that they are available for system timer | ||
| 68 | * initialization. | ||
| 69 | */ | ||
| 70 | clk_init(); | ||
| 65 | } | 71 | } |
| 66 | 72 | ||
| 67 | #ifdef CONFIG_CACHE_L2X0 | 73 | #ifdef CONFIG_CACHE_L2X0 |
diff --git a/arch/arm/mm/copypage-feroceon.c b/arch/arm/mm/copypage-feroceon.c index 5eb4fd93893d..ac163de7dc01 100644 --- a/arch/arm/mm/copypage-feroceon.c +++ b/arch/arm/mm/copypage-feroceon.c | |||
| @@ -18,7 +18,7 @@ feroceon_copy_user_page(void *kto, const void *kfrom) | |||
| 18 | { | 18 | { |
| 19 | asm("\ | 19 | asm("\ |
| 20 | stmfd sp!, {r4-r9, lr} \n\ | 20 | stmfd sp!, {r4-r9, lr} \n\ |
| 21 | mov ip, %0 \n\ | 21 | mov ip, %2 \n\ |
| 22 | 1: mov lr, r1 \n\ | 22 | 1: mov lr, r1 \n\ |
| 23 | ldmia r1!, {r2 - r9} \n\ | 23 | ldmia r1!, {r2 - r9} \n\ |
| 24 | pld [lr, #32] \n\ | 24 | pld [lr, #32] \n\ |
| @@ -64,7 +64,7 @@ feroceon_copy_user_page(void *kto, const void *kfrom) | |||
| 64 | mcr p15, 0, ip, c7, c10, 4 @ drain WB\n\ | 64 | mcr p15, 0, ip, c7, c10, 4 @ drain WB\n\ |
| 65 | ldmfd sp!, {r4-r9, pc}" | 65 | ldmfd sp!, {r4-r9, pc}" |
| 66 | : | 66 | : |
| 67 | : "I" (PAGE_SIZE)); | 67 | : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE)); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | void feroceon_copy_user_highpage(struct page *to, struct page *from, | 70 | void feroceon_copy_user_highpage(struct page *to, struct page *from, |
diff --git a/arch/arm/mm/copypage-v4wb.c b/arch/arm/mm/copypage-v4wb.c index 7c2eb55cd4a9..cb589cbb2b6c 100644 --- a/arch/arm/mm/copypage-v4wb.c +++ b/arch/arm/mm/copypage-v4wb.c | |||
| @@ -27,7 +27,7 @@ v4wb_copy_user_page(void *kto, const void *kfrom) | |||
| 27 | { | 27 | { |
| 28 | asm("\ | 28 | asm("\ |
| 29 | stmfd sp!, {r4, lr} @ 2\n\ | 29 | stmfd sp!, {r4, lr} @ 2\n\ |
| 30 | mov r2, %0 @ 1\n\ | 30 | mov r2, %2 @ 1\n\ |
| 31 | ldmia r1!, {r3, r4, ip, lr} @ 4\n\ | 31 | ldmia r1!, {r3, r4, ip, lr} @ 4\n\ |
| 32 | 1: mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line\n\ | 32 | 1: mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line\n\ |
| 33 | stmia r0!, {r3, r4, ip, lr} @ 4\n\ | 33 | stmia r0!, {r3, r4, ip, lr} @ 4\n\ |
| @@ -44,7 +44,7 @@ v4wb_copy_user_page(void *kto, const void *kfrom) | |||
| 44 | mcr p15, 0, r1, c7, c10, 4 @ 1 drain WB\n\ | 44 | mcr p15, 0, r1, c7, c10, 4 @ 1 drain WB\n\ |
| 45 | ldmfd sp!, {r4, pc} @ 3" | 45 | ldmfd sp!, {r4, pc} @ 3" |
| 46 | : | 46 | : |
| 47 | : "I" (PAGE_SIZE / 64)); | 47 | : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 64)); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | void v4wb_copy_user_highpage(struct page *to, struct page *from, | 50 | void v4wb_copy_user_highpage(struct page *to, struct page *from, |
diff --git a/arch/arm/mm/copypage-v4wt.c b/arch/arm/mm/copypage-v4wt.c index 172e6a55458e..30c7d048a324 100644 --- a/arch/arm/mm/copypage-v4wt.c +++ b/arch/arm/mm/copypage-v4wt.c | |||
| @@ -25,7 +25,7 @@ v4wt_copy_user_page(void *kto, const void *kfrom) | |||
| 25 | { | 25 | { |
| 26 | asm("\ | 26 | asm("\ |
| 27 | stmfd sp!, {r4, lr} @ 2\n\ | 27 | stmfd sp!, {r4, lr} @ 2\n\ |
| 28 | mov r2, %0 @ 1\n\ | 28 | mov r2, %2 @ 1\n\ |
| 29 | ldmia r1!, {r3, r4, ip, lr} @ 4\n\ | 29 | ldmia r1!, {r3, r4, ip, lr} @ 4\n\ |
| 30 | 1: stmia r0!, {r3, r4, ip, lr} @ 4\n\ | 30 | 1: stmia r0!, {r3, r4, ip, lr} @ 4\n\ |
| 31 | ldmia r1!, {r3, r4, ip, lr} @ 4+1\n\ | 31 | ldmia r1!, {r3, r4, ip, lr} @ 4+1\n\ |
| @@ -40,7 +40,7 @@ v4wt_copy_user_page(void *kto, const void *kfrom) | |||
| 40 | mcr p15, 0, r2, c7, c7, 0 @ flush ID cache\n\ | 40 | mcr p15, 0, r2, c7, c7, 0 @ flush ID cache\n\ |
| 41 | ldmfd sp!, {r4, pc} @ 3" | 41 | ldmfd sp!, {r4, pc} @ 3" |
| 42 | : | 42 | : |
| 43 | : "I" (PAGE_SIZE / 64)); | 43 | : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 64)); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | void v4wt_copy_user_highpage(struct page *to, struct page *from, | 46 | void v4wt_copy_user_highpage(struct page *to, struct page *from, |
diff --git a/arch/arm/mm/copypage-xsc3.c b/arch/arm/mm/copypage-xsc3.c index 747ad4140fc7..f9cde0702f1e 100644 --- a/arch/arm/mm/copypage-xsc3.c +++ b/arch/arm/mm/copypage-xsc3.c | |||
| @@ -34,7 +34,7 @@ xsc3_mc_copy_user_page(void *kto, const void *kfrom) | |||
| 34 | { | 34 | { |
| 35 | asm("\ | 35 | asm("\ |
| 36 | stmfd sp!, {r4, r5, lr} \n\ | 36 | stmfd sp!, {r4, r5, lr} \n\ |
| 37 | mov lr, %0 \n\ | 37 | mov lr, %2 \n\ |
| 38 | \n\ | 38 | \n\ |
| 39 | pld [r1, #0] \n\ | 39 | pld [r1, #0] \n\ |
| 40 | pld [r1, #32] \n\ | 40 | pld [r1, #32] \n\ |
| @@ -67,7 +67,7 @@ xsc3_mc_copy_user_page(void *kto, const void *kfrom) | |||
| 67 | \n\ | 67 | \n\ |
| 68 | ldmfd sp!, {r4, r5, pc}" | 68 | ldmfd sp!, {r4, r5, pc}" |
| 69 | : | 69 | : |
| 70 | : "I" (PAGE_SIZE / 64 - 1)); | 70 | : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 64 - 1)); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | void xsc3_mc_copy_user_highpage(struct page *to, struct page *from, | 73 | void xsc3_mc_copy_user_highpage(struct page *to, struct page *from, |
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 92f5801f99c1..cbfb2edcf7d1 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
| @@ -393,6 +393,9 @@ do_translation_fault(unsigned long addr, unsigned int fsr, | |||
| 393 | if (addr < TASK_SIZE) | 393 | if (addr < TASK_SIZE) |
| 394 | return do_page_fault(addr, fsr, regs); | 394 | return do_page_fault(addr, fsr, regs); |
| 395 | 395 | ||
| 396 | if (user_mode(regs)) | ||
| 397 | goto bad_area; | ||
| 398 | |||
| 396 | index = pgd_index(addr); | 399 | index = pgd_index(addr); |
| 397 | 400 | ||
| 398 | /* | 401 | /* |
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c index 77b030f5ec09..086816b205b8 100644 --- a/arch/arm/mm/highmem.c +++ b/arch/arm/mm/highmem.c | |||
| @@ -48,7 +48,16 @@ void *kmap_atomic(struct page *page, enum km_type type) | |||
| 48 | 48 | ||
| 49 | debug_kmap_atomic(type); | 49 | debug_kmap_atomic(type); |
| 50 | 50 | ||
| 51 | kmap = kmap_high_get(page); | 51 | #ifdef CONFIG_DEBUG_HIGHMEM |
| 52 | /* | ||
| 53 | * There is no cache coherency issue when non VIVT, so force the | ||
| 54 | * dedicated kmap usage for better debugging purposes in that case. | ||
| 55 | */ | ||
| 56 | if (!cache_is_vivt()) | ||
| 57 | kmap = NULL; | ||
| 58 | else | ||
| 59 | #endif | ||
| 60 | kmap = kmap_high_get(page); | ||
| 52 | if (kmap) | 61 | if (kmap) |
| 53 | return kmap; | 62 | return kmap; |
| 54 | 63 | ||
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 1ba6cf5a2c02..f6a999465323 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
| @@ -678,10 +678,10 @@ void __init mem_init(void) | |||
| 678 | void free_initmem(void) | 678 | void free_initmem(void) |
| 679 | { | 679 | { |
| 680 | #ifdef CONFIG_HAVE_TCM | 680 | #ifdef CONFIG_HAVE_TCM |
| 681 | extern char *__tcm_start, *__tcm_end; | 681 | extern char __tcm_start, __tcm_end; |
| 682 | 682 | ||
| 683 | totalram_pages += free_area(__phys_to_pfn(__pa(__tcm_start)), | 683 | totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)), |
| 684 | __phys_to_pfn(__pa(__tcm_end)), | 684 | __phys_to_pfn(__pa(&__tcm_end)), |
| 685 | "TCM link"); | 685 | "TCM link"); |
| 686 | #endif | 686 | #endif |
| 687 | 687 | ||
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c index 0ff3798769ab..08aaa4a7f65f 100644 --- a/arch/arm/plat-nomadik/timer.c +++ b/arch/arm/plat-nomadik/timer.c | |||
| @@ -13,7 +13,9 @@ | |||
| 13 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
| 14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
| 15 | #include <linux/clockchips.h> | 15 | #include <linux/clockchips.h> |
| 16 | #include <linux/clk.h> | ||
| 16 | #include <linux/jiffies.h> | 17 | #include <linux/jiffies.h> |
| 18 | #include <linux/err.h> | ||
| 17 | #include <asm/mach/time.h> | 19 | #include <asm/mach/time.h> |
| 18 | 20 | ||
| 19 | #include <plat/mtu.h> | 21 | #include <plat/mtu.h> |
| @@ -124,13 +126,25 @@ static struct irqaction nmdk_timer_irq = { | |||
| 124 | void __init nmdk_timer_init(void) | 126 | void __init nmdk_timer_init(void) |
| 125 | { | 127 | { |
| 126 | unsigned long rate; | 128 | unsigned long rate; |
| 127 | u32 cr = MTU_CRn_32BITS;; | 129 | struct clk *clk0; |
| 130 | struct clk *clk1; | ||
| 131 | u32 cr; | ||
| 132 | |||
| 133 | clk0 = clk_get_sys("mtu0", NULL); | ||
| 134 | BUG_ON(IS_ERR(clk0)); | ||
| 135 | |||
| 136 | clk1 = clk_get_sys("mtu1", NULL); | ||
| 137 | BUG_ON(IS_ERR(clk1)); | ||
| 138 | |||
| 139 | clk_enable(clk0); | ||
| 140 | clk_enable(clk1); | ||
| 128 | 141 | ||
| 129 | /* | 142 | /* |
| 130 | * Tick rate is 2.4MHz for Nomadik and 110MHz for ux500: | 143 | * Tick rate is 2.4MHz for Nomadik and 110MHz for ux500: |
| 131 | * use a divide-by-16 counter if it's more than 16MHz | 144 | * use a divide-by-16 counter if it's more than 16MHz |
| 132 | */ | 145 | */ |
| 133 | rate = CLOCK_TICK_RATE; | 146 | cr = MTU_CRn_32BITS;; |
| 147 | rate = clk_get_rate(clk0); | ||
| 134 | if (rate > 16 << 20) { | 148 | if (rate > 16 << 20) { |
| 135 | rate /= 16; | 149 | rate /= 16; |
| 136 | cr |= MTU_CRn_PRESCALE_16; | 150 | cr |= MTU_CRn_PRESCALE_16; |
| @@ -153,6 +167,14 @@ void __init nmdk_timer_init(void) | |||
| 153 | nmdk_clksrc.name); | 167 | nmdk_clksrc.name); |
| 154 | 168 | ||
| 155 | /* Timer 1 is used for events, fix according to rate */ | 169 | /* Timer 1 is used for events, fix according to rate */ |
| 170 | cr = MTU_CRn_32BITS; | ||
| 171 | rate = clk_get_rate(clk1); | ||
| 172 | if (rate > 16 << 20) { | ||
| 173 | rate /= 16; | ||
| 174 | cr |= MTU_CRn_PRESCALE_16; | ||
| 175 | } else { | ||
| 176 | cr |= MTU_CRn_PRESCALE_1; | ||
| 177 | } | ||
| 156 | writel(cr | MTU_CRn_ONESHOT, mtu_base + MTU_CR(1)); /* off, currently */ | 178 | writel(cr | MTU_CRn_ONESHOT, mtu_base + MTU_CR(1)); /* off, currently */ |
| 157 | nmdk_clkevt.mult = div_sc(rate, NSEC_PER_SEC, nmdk_clkevt.shift); | 179 | nmdk_clkevt.mult = div_sc(rate, NSEC_PER_SEC, nmdk_clkevt.shift); |
| 158 | nmdk_clkevt.max_delta_ns = | 180 | nmdk_clkevt.max_delta_ns = |
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S index 66dc2d03b7fc..d66cead97d28 100644 --- a/arch/arm/vfp/vfphw.S +++ b/arch/arm/vfp/vfphw.S | |||
| @@ -277,7 +277,7 @@ ENTRY(vfp_put_double) | |||
| 277 | #ifdef CONFIG_VFPv3 | 277 | #ifdef CONFIG_VFPv3 |
| 278 | @ d16 - d31 registers | 278 | @ d16 - d31 registers |
| 279 | .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 | 279 | .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 |
| 280 | 1: mcrr p11, 3, r1, r2, c\dr @ fmdrr r1, r2, d\dr | 280 | 1: mcrr p11, 3, r0, r1, c\dr @ fmdrr r0, r1, d\dr |
| 281 | mov pc, lr | 281 | mov pc, lr |
| 282 | .org 1b + 8 | 282 | .org 1b + 8 |
| 283 | .endr | 283 | .endr |
diff --git a/arch/frv/kernel/gdb-stub.c b/arch/frv/kernel/gdb-stub.c index 84d103c33c9c..a4dba6b20bd0 100644 --- a/arch/frv/kernel/gdb-stub.c +++ b/arch/frv/kernel/gdb-stub.c | |||
| @@ -1789,6 +1789,12 @@ void gdbstub(int sigval) | |||
| 1789 | flush_cache = 1; | 1789 | flush_cache = 1; |
| 1790 | break; | 1790 | break; |
| 1791 | 1791 | ||
| 1792 | /* pNN: Read value of reg N and return it */ | ||
| 1793 | case 'p': | ||
| 1794 | /* return no value, indicating that we don't support | ||
| 1795 | * this command and that gdb should use 'g' instead */ | ||
| 1796 | break; | ||
| 1797 | |||
| 1792 | /* PNN,=RRRRRRRR: Write value R to reg N return OK */ | 1798 | /* PNN,=RRRRRRRR: Write value R to reg N return OK */ |
| 1793 | case 'P': | 1799 | case 'P': |
| 1794 | ptr = &input_buffer[1]; | 1800 | ptr = &input_buffer[1]; |
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index d5f4e9161201..21b701374f72 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
| @@ -144,6 +144,7 @@ int kvm_arch_hardware_enable(void *garbage) | |||
| 144 | VP_INIT_ENV : VP_INIT_ENV_INITALIZE, | 144 | VP_INIT_ENV : VP_INIT_ENV_INITALIZE, |
| 145 | __pa(kvm_vm_buffer), KVM_VM_BUFFER_BASE, &tmp_base); | 145 | __pa(kvm_vm_buffer), KVM_VM_BUFFER_BASE, &tmp_base); |
| 146 | if (status != 0) { | 146 | if (status != 0) { |
| 147 | spin_unlock(&vp_lock); | ||
| 147 | printk(KERN_WARNING"kvm: Failed to Enable VT Support!!!!\n"); | 148 | printk(KERN_WARNING"kvm: Failed to Enable VT Support!!!!\n"); |
| 148 | return -EINVAL; | 149 | return -EINVAL; |
| 149 | } | 150 | } |
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h index de493f86d28f..464ff32bee3d 100644 --- a/arch/microblaze/include/asm/page.h +++ b/arch/microblaze/include/asm/page.h | |||
| @@ -34,6 +34,8 @@ | |||
| 34 | /* MS be sure that SLAB allocates aligned objects */ | 34 | /* MS be sure that SLAB allocates aligned objects */ |
| 35 | #define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES | 35 | #define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES |
| 36 | 36 | ||
| 37 | #define ARCH_SLAB_MINALIGN L1_CACHE_BYTES | ||
| 38 | |||
| 37 | #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1))) | 39 | #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1))) |
| 38 | #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1))) | 40 | #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1))) |
| 39 | 41 | ||
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c index 9dcd90b5df55..79c74659f204 100644 --- a/arch/microblaze/kernel/dma.c +++ b/arch/microblaze/kernel/dma.c | |||
| @@ -90,7 +90,6 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, | |||
| 90 | /* FIXME this part of code is untested */ | 90 | /* FIXME this part of code is untested */ |
| 91 | for_each_sg(sgl, sg, nents, i) { | 91 | for_each_sg(sgl, sg, nents, i) { |
| 92 | sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev); | 92 | sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev); |
| 93 | sg->dma_length = sg->length; | ||
| 94 | __dma_sync_page(page_to_phys(sg_page(sg)), sg->offset, | 93 | __dma_sync_page(page_to_phys(sg_page(sg)), sg->offset, |
| 95 | sg->length, direction); | 94 | sg->length, direction); |
| 96 | } | 95 | } |
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index 9cb782b8e036..23be25fec4d6 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
| @@ -1277,6 +1277,7 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus) | |||
| 1277 | printk(KERN_WARNING "PCI: Cannot allocate resource region " | 1277 | printk(KERN_WARNING "PCI: Cannot allocate resource region " |
| 1278 | "%d of PCI bridge %d, will remap\n", i, bus->number); | 1278 | "%d of PCI bridge %d, will remap\n", i, bus->number); |
| 1279 | clear_resource: | 1279 | clear_resource: |
| 1280 | res->start = res->end = 0; | ||
| 1280 | res->flags = 0; | 1281 | res->flags = 0; |
| 1281 | } | 1282 | } |
| 1282 | 1283 | ||
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c index d6119b879a98..45b40ac6c464 100644 --- a/arch/mn10300/unit-asb2305/pci-asb2305.c +++ b/arch/mn10300/unit-asb2305/pci-asb2305.c | |||
| @@ -117,6 +117,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) | |||
| 117 | * Invalidate the resource to prevent | 117 | * Invalidate the resource to prevent |
| 118 | * child resource allocations in this | 118 | * child resource allocations in this |
| 119 | * range. */ | 119 | * range. */ |
| 120 | r->start = r->end = 0; | ||
| 120 | r->flags = 0; | 121 | r->flags = 0; |
| 121 | } | 122 | } |
| 122 | } | 123 | } |
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 6646005dffb1..5b38f6ae2b29 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
| @@ -1309,6 +1309,7 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus) | |||
| 1309 | printk(KERN_WARNING "PCI: Cannot allocate resource region " | 1309 | printk(KERN_WARNING "PCI: Cannot allocate resource region " |
| 1310 | "%d of PCI bridge %d, will remap\n", i, bus->number); | 1310 | "%d of PCI bridge %d, will remap\n", i, bus->number); |
| 1311 | clear_resource: | 1311 | clear_resource: |
| 1312 | res->start = res->end = 0; | ||
| 1312 | res->flags = 0; | 1313 | res->flags = 0; |
| 1313 | } | 1314 | } |
| 1314 | 1315 | ||
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c index bc2b4004eb26..e8a00b0c4449 100644 --- a/arch/powerpc/kvm/e500.c +++ b/arch/powerpc/kvm/e500.c | |||
| @@ -164,7 +164,7 @@ static int __init kvmppc_e500_init(void) | |||
| 164 | return kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE); | 164 | return kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE); |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | static void __init kvmppc_e500_exit(void) | 167 | static void __exit kvmppc_e500_exit(void) |
| 168 | { | 168 | { |
| 169 | kvmppc_booke_exit(); | 169 | kvmppc_booke_exit(); |
| 170 | } | 170 | } |
diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c index 2c9e52267292..7fd90d02d8c6 100644 --- a/arch/powerpc/oprofile/op_model_cell.c +++ b/arch/powerpc/oprofile/op_model_cell.c | |||
| @@ -1077,7 +1077,7 @@ static int calculate_lfsr(int n) | |||
| 1077 | index = ENTRIES-1; | 1077 | index = ENTRIES-1; |
| 1078 | 1078 | ||
| 1079 | /* make sure index is valid */ | 1079 | /* make sure index is valid */ |
| 1080 | if ((index > ENTRIES) || (index < 0)) | 1080 | if ((index >= ENTRIES) || (index < 0)) |
| 1081 | index = ENTRIES-1; | 1081 | index = ENTRIES-1; |
| 1082 | 1082 | ||
| 1083 | return initial_lfsr[index]; | 1083 | return initial_lfsr[index]; |
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c index 55c80ffd42b9..92f1cb745d69 100644 --- a/arch/s390/appldata/appldata_os.c +++ b/arch/s390/appldata/appldata_os.c | |||
| @@ -181,7 +181,7 @@ static int __init appldata_os_init(void) | |||
| 181 | goto out; | 181 | goto out; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | appldata_os_data = kzalloc(max_size, GFP_DMA); | 184 | appldata_os_data = kzalloc(max_size, GFP_KERNEL | GFP_DMA); |
| 185 | if (appldata_os_data == NULL) { | 185 | if (appldata_os_data == NULL) { |
| 186 | rc = -ENOMEM; | 186 | rc = -ENOMEM; |
| 187 | goto out; | 187 | goto out; |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index bcd6884985ad..253f158db668 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Linux kernel version: 2.6.34-rc3 | 3 | # Linux kernel version: 2.6.35-rc1 |
| 4 | # Fri Apr 9 09:57:10 2010 | 4 | # Fri Jun 4 11:32:40 2010 |
| 5 | # | 5 | # |
| 6 | CONFIG_SCHED_MC=y | 6 | CONFIG_SCHED_MC=y |
| 7 | CONFIG_MMU=y | 7 | CONFIG_MMU=y |
| @@ -35,11 +35,13 @@ CONFIG_CONSTRUCTORS=y | |||
| 35 | CONFIG_EXPERIMENTAL=y | 35 | CONFIG_EXPERIMENTAL=y |
| 36 | CONFIG_LOCK_KERNEL=y | 36 | CONFIG_LOCK_KERNEL=y |
| 37 | CONFIG_INIT_ENV_ARG_LIMIT=32 | 37 | CONFIG_INIT_ENV_ARG_LIMIT=32 |
| 38 | CONFIG_CROSS_COMPILE="" | ||
| 38 | CONFIG_LOCALVERSION="" | 39 | CONFIG_LOCALVERSION="" |
| 39 | CONFIG_LOCALVERSION_AUTO=y | 40 | CONFIG_LOCALVERSION_AUTO=y |
| 40 | CONFIG_HAVE_KERNEL_GZIP=y | 41 | CONFIG_HAVE_KERNEL_GZIP=y |
| 41 | CONFIG_HAVE_KERNEL_BZIP2=y | 42 | CONFIG_HAVE_KERNEL_BZIP2=y |
| 42 | CONFIG_HAVE_KERNEL_LZMA=y | 43 | CONFIG_HAVE_KERNEL_LZMA=y |
| 44 | CONFIG_HAVE_KERNEL_LZO=y | ||
| 43 | CONFIG_KERNEL_GZIP=y | 45 | CONFIG_KERNEL_GZIP=y |
| 44 | # CONFIG_KERNEL_BZIP2 is not set | 46 | # CONFIG_KERNEL_BZIP2 is not set |
| 45 | # CONFIG_KERNEL_LZMA is not set | 47 | # CONFIG_KERNEL_LZMA is not set |
| @@ -77,6 +79,7 @@ CONFIG_CGROUP_NS=y | |||
| 77 | # CONFIG_CGROUP_CPUACCT is not set | 79 | # CONFIG_CGROUP_CPUACCT is not set |
| 78 | # CONFIG_RESOURCE_COUNTERS is not set | 80 | # CONFIG_RESOURCE_COUNTERS is not set |
| 79 | # CONFIG_CGROUP_SCHED is not set | 81 | # CONFIG_CGROUP_SCHED is not set |
| 82 | # CONFIG_BLK_CGROUP is not set | ||
| 80 | CONFIG_SYSFS_DEPRECATED=y | 83 | CONFIG_SYSFS_DEPRECATED=y |
| 81 | CONFIG_SYSFS_DEPRECATED_V2=y | 84 | CONFIG_SYSFS_DEPRECATED_V2=y |
| 82 | # CONFIG_RELAY is not set | 85 | # CONFIG_RELAY is not set |
| @@ -157,7 +160,6 @@ CONFIG_STOP_MACHINE=y | |||
| 157 | CONFIG_BLOCK=y | 160 | CONFIG_BLOCK=y |
| 158 | CONFIG_BLK_DEV_BSG=y | 161 | CONFIG_BLK_DEV_BSG=y |
| 159 | # CONFIG_BLK_DEV_INTEGRITY is not set | 162 | # CONFIG_BLK_DEV_INTEGRITY is not set |
| 160 | # CONFIG_BLK_CGROUP is not set | ||
| 161 | CONFIG_BLOCK_COMPAT=y | 163 | CONFIG_BLOCK_COMPAT=y |
| 162 | 164 | ||
| 163 | # | 165 | # |
| @@ -166,7 +168,6 @@ CONFIG_BLOCK_COMPAT=y | |||
| 166 | CONFIG_IOSCHED_NOOP=y | 168 | CONFIG_IOSCHED_NOOP=y |
| 167 | CONFIG_IOSCHED_DEADLINE=y | 169 | CONFIG_IOSCHED_DEADLINE=y |
| 168 | CONFIG_IOSCHED_CFQ=y | 170 | CONFIG_IOSCHED_CFQ=y |
| 169 | # CONFIG_CFQ_GROUP_IOSCHED is not set | ||
| 170 | CONFIG_DEFAULT_DEADLINE=y | 171 | CONFIG_DEFAULT_DEADLINE=y |
| 171 | # CONFIG_DEFAULT_CFQ is not set | 172 | # CONFIG_DEFAULT_CFQ is not set |
| 172 | # CONFIG_DEFAULT_NOOP is not set | 173 | # CONFIG_DEFAULT_NOOP is not set |
| @@ -247,7 +248,6 @@ CONFIG_64BIT=y | |||
| 247 | CONFIG_SMP=y | 248 | CONFIG_SMP=y |
| 248 | CONFIG_NR_CPUS=32 | 249 | CONFIG_NR_CPUS=32 |
| 249 | CONFIG_HOTPLUG_CPU=y | 250 | CONFIG_HOTPLUG_CPU=y |
| 250 | # CONFIG_SCHED_BOOK is not set | ||
| 251 | CONFIG_COMPAT=y | 251 | CONFIG_COMPAT=y |
| 252 | CONFIG_SYSVIPC_COMPAT=y | 252 | CONFIG_SYSVIPC_COMPAT=y |
| 253 | CONFIG_AUDIT_ARCH=y | 253 | CONFIG_AUDIT_ARCH=y |
| @@ -320,7 +320,6 @@ CONFIG_COMPAT_BINFMT_ELF=y | |||
| 320 | # CONFIG_HAVE_AOUT is not set | 320 | # CONFIG_HAVE_AOUT is not set |
| 321 | CONFIG_BINFMT_MISC=m | 321 | CONFIG_BINFMT_MISC=m |
| 322 | CONFIG_FORCE_MAX_ZONEORDER=9 | 322 | CONFIG_FORCE_MAX_ZONEORDER=9 |
| 323 | # CONFIG_PROCESS_DEBUG is not set | ||
| 324 | CONFIG_PFAULT=y | 323 | CONFIG_PFAULT=y |
| 325 | # CONFIG_SHARED_KERNEL is not set | 324 | # CONFIG_SHARED_KERNEL is not set |
| 326 | # CONFIG_CMM is not set | 325 | # CONFIG_CMM is not set |
| @@ -457,6 +456,7 @@ CONFIG_NF_CONNTRACK=m | |||
| 457 | # CONFIG_IP6_NF_IPTABLES is not set | 456 | # CONFIG_IP6_NF_IPTABLES is not set |
| 458 | # CONFIG_IP_DCCP is not set | 457 | # CONFIG_IP_DCCP is not set |
| 459 | CONFIG_IP_SCTP=m | 458 | CONFIG_IP_SCTP=m |
| 459 | # CONFIG_NET_SCTPPROBE is not set | ||
| 460 | # CONFIG_SCTP_DBG_MSG is not set | 460 | # CONFIG_SCTP_DBG_MSG is not set |
| 461 | # CONFIG_SCTP_DBG_OBJCNT is not set | 461 | # CONFIG_SCTP_DBG_OBJCNT is not set |
| 462 | # CONFIG_SCTP_HMAC_NONE is not set | 462 | # CONFIG_SCTP_HMAC_NONE is not set |
| @@ -465,6 +465,7 @@ CONFIG_SCTP_HMAC_MD5=y | |||
| 465 | # CONFIG_RDS is not set | 465 | # CONFIG_RDS is not set |
| 466 | # CONFIG_TIPC is not set | 466 | # CONFIG_TIPC is not set |
| 467 | # CONFIG_ATM is not set | 467 | # CONFIG_ATM is not set |
| 468 | # CONFIG_L2TP is not set | ||
| 468 | # CONFIG_BRIDGE is not set | 469 | # CONFIG_BRIDGE is not set |
| 469 | # CONFIG_VLAN_8021Q is not set | 470 | # CONFIG_VLAN_8021Q is not set |
| 470 | # CONFIG_DECNET is not set | 471 | # CONFIG_DECNET is not set |
| @@ -525,6 +526,7 @@ CONFIG_NET_ACT_NAT=m | |||
| 525 | # CONFIG_NET_CLS_IND is not set | 526 | # CONFIG_NET_CLS_IND is not set |
| 526 | CONFIG_NET_SCH_FIFO=y | 527 | CONFIG_NET_SCH_FIFO=y |
| 527 | # CONFIG_DCB is not set | 528 | # CONFIG_DCB is not set |
| 529 | CONFIG_RPS=y | ||
| 528 | 530 | ||
| 529 | # | 531 | # |
| 530 | # Network testing | 532 | # Network testing |
| @@ -546,6 +548,7 @@ CONFIG_CAN_VCAN=m | |||
| 546 | # CONFIG_WIMAX is not set | 548 | # CONFIG_WIMAX is not set |
| 547 | # CONFIG_RFKILL is not set | 549 | # CONFIG_RFKILL is not set |
| 548 | # CONFIG_NET_9P is not set | 550 | # CONFIG_NET_9P is not set |
| 551 | # CONFIG_CAIF is not set | ||
| 549 | # CONFIG_PCMCIA is not set | 552 | # CONFIG_PCMCIA is not set |
| 550 | CONFIG_CCW=y | 553 | CONFIG_CCW=y |
| 551 | 554 | ||
| @@ -728,6 +731,7 @@ CONFIG_VIRTIO_NET=m | |||
| 728 | # Character devices | 731 | # Character devices |
| 729 | # | 732 | # |
| 730 | CONFIG_DEVKMEM=y | 733 | CONFIG_DEVKMEM=y |
| 734 | # CONFIG_N_GSM is not set | ||
| 731 | CONFIG_UNIX98_PTYS=y | 735 | CONFIG_UNIX98_PTYS=y |
| 732 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set | 736 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set |
| 733 | CONFIG_LEGACY_PTYS=y | 737 | CONFIG_LEGACY_PTYS=y |
| @@ -775,6 +779,7 @@ CONFIG_S390_TAPE_34XX=m | |||
| 775 | # CONFIG_MONREADER is not set | 779 | # CONFIG_MONREADER is not set |
| 776 | CONFIG_MONWRITER=m | 780 | CONFIG_MONWRITER=m |
| 777 | CONFIG_S390_VMUR=m | 781 | CONFIG_S390_VMUR=m |
| 782 | # CONFIG_RAMOOPS is not set | ||
| 778 | 783 | ||
| 779 | # | 784 | # |
| 780 | # PPS support | 785 | # PPS support |
| @@ -788,10 +793,6 @@ CONFIG_S390_VMUR=m | |||
| 788 | # CONFIG_NEW_LEDS is not set | 793 | # CONFIG_NEW_LEDS is not set |
| 789 | CONFIG_ACCESSIBILITY=y | 794 | CONFIG_ACCESSIBILITY=y |
| 790 | # CONFIG_AUXDISPLAY is not set | 795 | # CONFIG_AUXDISPLAY is not set |
| 791 | |||
| 792 | # | ||
| 793 | # TI VLYNQ | ||
| 794 | # | ||
| 795 | # CONFIG_STAGING is not set | 796 | # CONFIG_STAGING is not set |
| 796 | 797 | ||
| 797 | # | 798 | # |
| @@ -976,6 +977,7 @@ CONFIG_DEBUG_MEMORY_INIT=y | |||
| 976 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set | 977 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set |
| 977 | CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y | 978 | CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y |
| 978 | # CONFIG_LKDTM is not set | 979 | # CONFIG_LKDTM is not set |
| 980 | # CONFIG_CPU_NOTIFIER_ERROR_INJECT is not set | ||
| 979 | # CONFIG_FAULT_INJECTION is not set | 981 | # CONFIG_FAULT_INJECTION is not set |
| 980 | # CONFIG_LATENCYTOP is not set | 982 | # CONFIG_LATENCYTOP is not set |
| 981 | CONFIG_SYSCTL_SYSCALL_CHECK=y | 983 | CONFIG_SYSCTL_SYSCALL_CHECK=y |
| @@ -1010,6 +1012,7 @@ CONFIG_BRANCH_PROFILE_NONE=y | |||
| 1010 | CONFIG_KPROBE_EVENT=y | 1012 | CONFIG_KPROBE_EVENT=y |
| 1011 | # CONFIG_RING_BUFFER_BENCHMARK is not set | 1013 | # CONFIG_RING_BUFFER_BENCHMARK is not set |
| 1012 | # CONFIG_DYNAMIC_DEBUG is not set | 1014 | # CONFIG_DYNAMIC_DEBUG is not set |
| 1015 | # CONFIG_ATOMIC64_SELFTEST is not set | ||
| 1013 | CONFIG_SAMPLES=y | 1016 | CONFIG_SAMPLES=y |
| 1014 | # CONFIG_SAMPLE_TRACEPOINTS is not set | 1017 | # CONFIG_SAMPLE_TRACEPOINTS is not set |
| 1015 | # CONFIG_SAMPLE_TRACE_EVENTS is not set | 1018 | # CONFIG_SAMPLE_TRACE_EVENTS is not set |
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c index 639380a0c45c..22cfd634c355 100644 --- a/arch/s390/kernel/module.c +++ b/arch/s390/kernel/module.c | |||
| @@ -55,8 +55,10 @@ void *module_alloc(unsigned long size) | |||
| 55 | /* Free memory returned from module_alloc */ | 55 | /* Free memory returned from module_alloc */ |
| 56 | void module_free(struct module *mod, void *module_region) | 56 | void module_free(struct module *mod, void *module_region) |
| 57 | { | 57 | { |
| 58 | vfree(mod->arch.syminfo); | 58 | if (mod) { |
| 59 | mod->arch.syminfo = NULL; | 59 | vfree(mod->arch.syminfo); |
| 60 | mod->arch.syminfo = NULL; | ||
| 61 | } | ||
| 60 | vfree(module_region); | 62 | vfree(module_region); |
| 61 | } | 63 | } |
| 62 | 64 | ||
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 8093e6f47f49..ae3705816878 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
| @@ -761,7 +761,7 @@ static int __init kvm_s390_init(void) | |||
| 761 | * to hold the maximum amount of facilites. On the other hand, we | 761 | * to hold the maximum amount of facilites. On the other hand, we |
| 762 | * only set facilities that are known to work in KVM. | 762 | * only set facilities that are known to work in KVM. |
| 763 | */ | 763 | */ |
| 764 | facilities = (unsigned long long *) get_zeroed_page(GFP_DMA); | 764 | facilities = (unsigned long long *) get_zeroed_page(GFP_KERNEL|GFP_DMA); |
| 765 | if (!facilities) { | 765 | if (!facilities) { |
| 766 | kvm_exit(); | 766 | kvm_exit(); |
| 767 | return -ENOMEM; | 767 | return -ENOMEM; |
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c index eff3c5989b46..702276f5e2fa 100644 --- a/arch/s390/kvm/sigp.c +++ b/arch/s390/kvm/sigp.c | |||
| @@ -113,7 +113,7 @@ static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action) | |||
| 113 | { | 113 | { |
| 114 | struct kvm_s390_interrupt_info *inti; | 114 | struct kvm_s390_interrupt_info *inti; |
| 115 | 115 | ||
| 116 | inti = kzalloc(sizeof(*inti), GFP_KERNEL); | 116 | inti = kzalloc(sizeof(*inti), GFP_ATOMIC); |
| 117 | if (!inti) | 117 | if (!inti) |
| 118 | return -ENOMEM; | 118 | return -ENOMEM; |
| 119 | inti->type = KVM_S390_SIGP_STOP; | 119 | inti->type = KVM_S390_SIGP_STOP; |
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c index 6409fd57eb04..3cc95dd0a3a6 100644 --- a/arch/s390/mm/extmem.c +++ b/arch/s390/mm/extmem.c | |||
| @@ -105,7 +105,7 @@ static int | |||
| 105 | dcss_set_subcodes(void) | 105 | dcss_set_subcodes(void) |
| 106 | { | 106 | { |
| 107 | #ifdef CONFIG_64BIT | 107 | #ifdef CONFIG_64BIT |
| 108 | char *name = kmalloc(8 * sizeof(char), GFP_DMA); | 108 | char *name = kmalloc(8 * sizeof(char), GFP_KERNEL | GFP_DMA); |
| 109 | unsigned long rx, ry; | 109 | unsigned long rx, ry; |
| 110 | int rc; | 110 | int rc; |
| 111 | 111 | ||
| @@ -252,12 +252,13 @@ dcss_diag_translate_rc (int vm_rc) { | |||
| 252 | static int | 252 | static int |
| 253 | query_segment_type (struct dcss_segment *seg) | 253 | query_segment_type (struct dcss_segment *seg) |
| 254 | { | 254 | { |
| 255 | struct qin64 *qin = kmalloc (sizeof(struct qin64), GFP_DMA); | ||
| 256 | struct qout64 *qout = kmalloc (sizeof(struct qout64), GFP_DMA); | ||
| 257 | |||
| 258 | int diag_cc, rc, i; | ||
| 259 | unsigned long dummy, vmrc; | 255 | unsigned long dummy, vmrc; |
| 256 | int diag_cc, rc, i; | ||
| 257 | struct qout64 *qout; | ||
| 258 | struct qin64 *qin; | ||
| 260 | 259 | ||
| 260 | qin = kmalloc(sizeof(*qin), GFP_KERNEL | GFP_DMA); | ||
| 261 | qout = kmalloc(sizeof(*qout), GFP_KERNEL | GFP_DMA); | ||
| 261 | if ((qin == NULL) || (qout == NULL)) { | 262 | if ((qin == NULL) || (qout == NULL)) { |
| 262 | rc = -ENOMEM; | 263 | rc = -ENOMEM; |
| 263 | goto out_free; | 264 | goto out_free; |
| @@ -286,7 +287,7 @@ query_segment_type (struct dcss_segment *seg) | |||
| 286 | copy data for the new format. */ | 287 | copy data for the new format. */ |
| 287 | if (segext_scode == DCSS_SEGEXT) { | 288 | if (segext_scode == DCSS_SEGEXT) { |
| 288 | struct qout64_old *qout_old; | 289 | struct qout64_old *qout_old; |
| 289 | qout_old = kzalloc(sizeof(struct qout64_old), GFP_DMA); | 290 | qout_old = kzalloc(sizeof(*qout_old), GFP_KERNEL | GFP_DMA); |
| 290 | if (qout_old == NULL) { | 291 | if (qout_old == NULL) { |
| 291 | rc = -ENOMEM; | 292 | rc = -ENOMEM; |
| 292 | goto out_free; | 293 | goto out_free; |
| @@ -407,11 +408,11 @@ segment_overlaps_others (struct dcss_segment *seg) | |||
| 407 | static int | 408 | static int |
| 408 | __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long *end) | 409 | __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long *end) |
| 409 | { | 410 | { |
| 410 | struct dcss_segment *seg = kmalloc(sizeof(struct dcss_segment), | ||
| 411 | GFP_DMA); | ||
| 412 | int rc, diag_cc; | ||
| 413 | unsigned long start_addr, end_addr, dummy; | 411 | unsigned long start_addr, end_addr, dummy; |
| 412 | struct dcss_segment *seg; | ||
| 413 | int rc, diag_cc; | ||
| 414 | 414 | ||
| 415 | seg = kmalloc(sizeof(*seg), GFP_KERNEL | GFP_DMA); | ||
| 415 | if (seg == NULL) { | 416 | if (seg == NULL) { |
| 416 | rc = -ENOMEM; | 417 | rc = -ENOMEM; |
| 417 | goto out; | 418 | goto out; |
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index b49d8ca228f6..8c7ae4318629 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h | |||
| @@ -110,6 +110,7 @@ | |||
| 110 | #define MSR_AMD64_PATCH_LOADER 0xc0010020 | 110 | #define MSR_AMD64_PATCH_LOADER 0xc0010020 |
| 111 | #define MSR_AMD64_OSVW_ID_LENGTH 0xc0010140 | 111 | #define MSR_AMD64_OSVW_ID_LENGTH 0xc0010140 |
| 112 | #define MSR_AMD64_OSVW_STATUS 0xc0010141 | 112 | #define MSR_AMD64_OSVW_STATUS 0xc0010141 |
| 113 | #define MSR_AMD64_DC_CFG 0xc0011022 | ||
| 113 | #define MSR_AMD64_IBSFETCHCTL 0xc0011030 | 114 | #define MSR_AMD64_IBSFETCHCTL 0xc0011030 |
| 114 | #define MSR_AMD64_IBSFETCHLINAD 0xc0011031 | 115 | #define MSR_AMD64_IBSFETCHLINAD 0xc0011031 |
| 115 | #define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032 | 116 | #define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032 |
diff --git a/arch/x86/include/asm/suspend_32.h b/arch/x86/include/asm/suspend_32.h index 48dcfa62ea07..fd921c3a6841 100644 --- a/arch/x86/include/asm/suspend_32.h +++ b/arch/x86/include/asm/suspend_32.h | |||
| @@ -15,6 +15,8 @@ static inline int arch_prepare_suspend(void) { return 0; } | |||
| 15 | struct saved_context { | 15 | struct saved_context { |
| 16 | u16 es, fs, gs, ss; | 16 | u16 es, fs, gs, ss; |
| 17 | unsigned long cr0, cr2, cr3, cr4; | 17 | unsigned long cr0, cr2, cr3, cr4; |
| 18 | u64 misc_enable; | ||
| 19 | bool misc_enable_saved; | ||
| 18 | struct desc_ptr gdt; | 20 | struct desc_ptr gdt; |
| 19 | struct desc_ptr idt; | 21 | struct desc_ptr idt; |
| 20 | u16 ldt; | 22 | u16 ldt; |
diff --git a/arch/x86/include/asm/suspend_64.h b/arch/x86/include/asm/suspend_64.h index 06284f42b759..8d942afae681 100644 --- a/arch/x86/include/asm/suspend_64.h +++ b/arch/x86/include/asm/suspend_64.h | |||
| @@ -27,6 +27,8 @@ struct saved_context { | |||
| 27 | u16 ds, es, fs, gs, ss; | 27 | u16 ds, es, fs, gs, ss; |
| 28 | unsigned long gs_base, gs_kernel_base, fs_base; | 28 | unsigned long gs_base, gs_kernel_base, fs_base; |
| 29 | unsigned long cr0, cr2, cr3, cr4, cr8; | 29 | unsigned long cr0, cr2, cr3, cr4, cr8; |
| 30 | u64 misc_enable; | ||
| 31 | bool misc_enable_saved; | ||
| 30 | unsigned long efer; | 32 | unsigned long efer; |
| 31 | u16 gdt_pad; | 33 | u16 gdt_pad; |
| 32 | u16 gdt_limit; | 34 | u16 gdt_limit; |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 81563e76e28f..a6f695d76928 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
| @@ -1815,6 +1815,9 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, | |||
| 1815 | 1815 | ||
| 1816 | spte |= PT_WRITABLE_MASK; | 1816 | spte |= PT_WRITABLE_MASK; |
| 1817 | 1817 | ||
| 1818 | if (!tdp_enabled && !(pte_access & ACC_WRITE_MASK)) | ||
| 1819 | spte &= ~PT_USER_MASK; | ||
| 1820 | |||
| 1818 | /* | 1821 | /* |
| 1819 | * Optimization: for pte sync, if spte was writable the hash | 1822 | * Optimization: for pte sync, if spte was writable the hash |
| 1820 | * lookup is unnecessary (and expensive). Write protection | 1823 | * lookup is unnecessary (and expensive). Write protection |
| @@ -1870,6 +1873,8 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep, | |||
| 1870 | 1873 | ||
| 1871 | child = page_header(pte & PT64_BASE_ADDR_MASK); | 1874 | child = page_header(pte & PT64_BASE_ADDR_MASK); |
| 1872 | mmu_page_remove_parent_pte(child, sptep); | 1875 | mmu_page_remove_parent_pte(child, sptep); |
| 1876 | __set_spte(sptep, shadow_trap_nonpresent_pte); | ||
| 1877 | kvm_flush_remote_tlbs(vcpu->kvm); | ||
| 1873 | } else if (pfn != spte_to_pfn(*sptep)) { | 1878 | } else if (pfn != spte_to_pfn(*sptep)) { |
| 1874 | pgprintk("hfn old %lx new %lx\n", | 1879 | pgprintk("hfn old %lx new %lx\n", |
| 1875 | spte_to_pfn(*sptep), pfn); | 1880 | spte_to_pfn(*sptep), pfn); |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 96dc232bfc56..ce438e0fdd26 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/ftrace_event.h> | 28 | #include <linux/ftrace_event.h> |
| 29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
| 30 | 30 | ||
| 31 | #include <asm/tlbflush.h> | ||
| 31 | #include <asm/desc.h> | 32 | #include <asm/desc.h> |
| 32 | 33 | ||
| 33 | #include <asm/virtext.h> | 34 | #include <asm/virtext.h> |
| @@ -56,6 +57,8 @@ MODULE_LICENSE("GPL"); | |||
| 56 | 57 | ||
| 57 | #define DEBUGCTL_RESERVED_BITS (~(0x3fULL)) | 58 | #define DEBUGCTL_RESERVED_BITS (~(0x3fULL)) |
| 58 | 59 | ||
| 60 | static bool erratum_383_found __read_mostly; | ||
| 61 | |||
| 59 | static const u32 host_save_user_msrs[] = { | 62 | static const u32 host_save_user_msrs[] = { |
| 60 | #ifdef CONFIG_X86_64 | 63 | #ifdef CONFIG_X86_64 |
| 61 | MSR_STAR, MSR_LSTAR, MSR_CSTAR, MSR_SYSCALL_MASK, MSR_KERNEL_GS_BASE, | 64 | MSR_STAR, MSR_LSTAR, MSR_CSTAR, MSR_SYSCALL_MASK, MSR_KERNEL_GS_BASE, |
| @@ -374,6 +377,31 @@ static void svm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr, | |||
| 374 | svm->vmcb->control.event_inj_err = error_code; | 377 | svm->vmcb->control.event_inj_err = error_code; |
| 375 | } | 378 | } |
| 376 | 379 | ||
| 380 | static void svm_init_erratum_383(void) | ||
| 381 | { | ||
| 382 | u32 low, high; | ||
| 383 | int err; | ||
| 384 | u64 val; | ||
| 385 | |||
| 386 | /* Only Fam10h is affected */ | ||
| 387 | if (boot_cpu_data.x86 != 0x10) | ||
| 388 | return; | ||
| 389 | |||
| 390 | /* Use _safe variants to not break nested virtualization */ | ||
| 391 | val = native_read_msr_safe(MSR_AMD64_DC_CFG, &err); | ||
| 392 | if (err) | ||
| 393 | return; | ||
| 394 | |||
| 395 | val |= (1ULL << 47); | ||
| 396 | |||
| 397 | low = lower_32_bits(val); | ||
| 398 | high = upper_32_bits(val); | ||
| 399 | |||
| 400 | native_write_msr_safe(MSR_AMD64_DC_CFG, low, high); | ||
| 401 | |||
| 402 | erratum_383_found = true; | ||
| 403 | } | ||
| 404 | |||
| 377 | static int has_svm(void) | 405 | static int has_svm(void) |
| 378 | { | 406 | { |
| 379 | const char *msg; | 407 | const char *msg; |
| @@ -429,6 +457,8 @@ static int svm_hardware_enable(void *garbage) | |||
| 429 | 457 | ||
| 430 | wrmsrl(MSR_VM_HSAVE_PA, page_to_pfn(sd->save_area) << PAGE_SHIFT); | 458 | wrmsrl(MSR_VM_HSAVE_PA, page_to_pfn(sd->save_area) << PAGE_SHIFT); |
| 431 | 459 | ||
| 460 | svm_init_erratum_383(); | ||
| 461 | |||
| 432 | return 0; | 462 | return 0; |
| 433 | } | 463 | } |
| 434 | 464 | ||
| @@ -1410,8 +1440,59 @@ static int nm_interception(struct vcpu_svm *svm) | |||
| 1410 | return 1; | 1440 | return 1; |
| 1411 | } | 1441 | } |
| 1412 | 1442 | ||
| 1413 | static int mc_interception(struct vcpu_svm *svm) | 1443 | static bool is_erratum_383(void) |
| 1414 | { | 1444 | { |
| 1445 | int err, i; | ||
| 1446 | u64 value; | ||
| 1447 | |||
| 1448 | if (!erratum_383_found) | ||
| 1449 | return false; | ||
| 1450 | |||
| 1451 | value = native_read_msr_safe(MSR_IA32_MC0_STATUS, &err); | ||
| 1452 | if (err) | ||
| 1453 | return false; | ||
| 1454 | |||
| 1455 | /* Bit 62 may or may not be set for this mce */ | ||
| 1456 | value &= ~(1ULL << 62); | ||
| 1457 | |||
| 1458 | if (value != 0xb600000000010015ULL) | ||
| 1459 | return false; | ||
| 1460 | |||
| 1461 | /* Clear MCi_STATUS registers */ | ||
| 1462 | for (i = 0; i < 6; ++i) | ||
| 1463 | native_write_msr_safe(MSR_IA32_MCx_STATUS(i), 0, 0); | ||
| 1464 | |||
| 1465 | value = native_read_msr_safe(MSR_IA32_MCG_STATUS, &err); | ||
| 1466 | if (!err) { | ||
| 1467 | u32 low, high; | ||
| 1468 | |||
| 1469 | value &= ~(1ULL << 2); | ||
| 1470 | low = lower_32_bits(value); | ||
| 1471 | high = upper_32_bits(value); | ||
| 1472 | |||
| 1473 | native_write_msr_safe(MSR_IA32_MCG_STATUS, low, high); | ||
| 1474 | } | ||
| 1475 | |||
| 1476 | /* Flush tlb to evict multi-match entries */ | ||
| 1477 | __flush_tlb_all(); | ||
| 1478 | |||
| 1479 | return true; | ||
| 1480 | } | ||
| 1481 | |||
| 1482 | static void svm_handle_mce(struct vcpu_svm *svm) | ||
| 1483 | { | ||
| 1484 | if (is_erratum_383()) { | ||
| 1485 | /* | ||
| 1486 | * Erratum 383 triggered. Guest state is corrupt so kill the | ||
| 1487 | * guest. | ||
| 1488 | */ | ||
| 1489 | pr_err("KVM: Guest triggered AMD Erratum 383\n"); | ||
| 1490 | |||
| 1491 | set_bit(KVM_REQ_TRIPLE_FAULT, &svm->vcpu.requests); | ||
| 1492 | |||
| 1493 | return; | ||
| 1494 | } | ||
| 1495 | |||
| 1415 | /* | 1496 | /* |
| 1416 | * On an #MC intercept the MCE handler is not called automatically in | 1497 | * On an #MC intercept the MCE handler is not called automatically in |
| 1417 | * the host. So do it by hand here. | 1498 | * the host. So do it by hand here. |
| @@ -1420,6 +1501,11 @@ static int mc_interception(struct vcpu_svm *svm) | |||
| 1420 | "int $0x12\n"); | 1501 | "int $0x12\n"); |
| 1421 | /* not sure if we ever come back to this point */ | 1502 | /* not sure if we ever come back to this point */ |
| 1422 | 1503 | ||
| 1504 | return; | ||
| 1505 | } | ||
| 1506 | |||
| 1507 | static int mc_interception(struct vcpu_svm *svm) | ||
| 1508 | { | ||
| 1423 | return 1; | 1509 | return 1; |
| 1424 | } | 1510 | } |
| 1425 | 1511 | ||
| @@ -3088,6 +3174,14 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) | |||
| 3088 | vcpu->arch.regs_avail &= ~(1 << VCPU_EXREG_PDPTR); | 3174 | vcpu->arch.regs_avail &= ~(1 << VCPU_EXREG_PDPTR); |
| 3089 | vcpu->arch.regs_dirty &= ~(1 << VCPU_EXREG_PDPTR); | 3175 | vcpu->arch.regs_dirty &= ~(1 << VCPU_EXREG_PDPTR); |
| 3090 | } | 3176 | } |
| 3177 | |||
| 3178 | /* | ||
| 3179 | * We need to handle MC intercepts here before the vcpu has a chance to | ||
| 3180 | * change the physical cpu | ||
| 3181 | */ | ||
| 3182 | if (unlikely(svm->vmcb->control.exit_code == | ||
| 3183 | SVM_EXIT_EXCP_BASE + MC_VECTOR)) | ||
| 3184 | svm_handle_mce(svm); | ||
| 3091 | } | 3185 | } |
| 3092 | 3186 | ||
| 3093 | #undef R | 3187 | #undef R |
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index 97da2ba9344b..6fdb3ec30c31 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
| @@ -96,6 +96,7 @@ EXPORT_SYMBOL(pcibios_align_resource); | |||
| 96 | * the fact the PCI specs explicitly allow address decoders to be | 96 | * the fact the PCI specs explicitly allow address decoders to be |
| 97 | * shared between expansion ROMs and other resource regions, it's | 97 | * shared between expansion ROMs and other resource regions, it's |
| 98 | * at least dangerous) | 98 | * at least dangerous) |
| 99 | * - bad resource sizes or overlaps with other regions | ||
| 99 | * | 100 | * |
| 100 | * Our solution: | 101 | * Our solution: |
| 101 | * (1) Allocate resources for all buses behind PCI-to-PCI bridges. | 102 | * (1) Allocate resources for all buses behind PCI-to-PCI bridges. |
| @@ -136,6 +137,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) | |||
| 136 | * child resource allocations in this | 137 | * child resource allocations in this |
| 137 | * range. | 138 | * range. |
| 138 | */ | 139 | */ |
| 140 | r->start = r->end = 0; | ||
| 139 | r->flags = 0; | 141 | r->flags = 0; |
| 140 | } | 142 | } |
| 141 | } | 143 | } |
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c index 0a979f3e5b8a..1290ba54b350 100644 --- a/arch/x86/power/cpu.c +++ b/arch/x86/power/cpu.c | |||
| @@ -105,6 +105,8 @@ static void __save_processor_state(struct saved_context *ctxt) | |||
| 105 | ctxt->cr4 = read_cr4(); | 105 | ctxt->cr4 = read_cr4(); |
| 106 | ctxt->cr8 = read_cr8(); | 106 | ctxt->cr8 = read_cr8(); |
| 107 | #endif | 107 | #endif |
| 108 | ctxt->misc_enable_saved = !rdmsrl_safe(MSR_IA32_MISC_ENABLE, | ||
| 109 | &ctxt->misc_enable); | ||
| 108 | } | 110 | } |
| 109 | 111 | ||
| 110 | /* Needed by apm.c */ | 112 | /* Needed by apm.c */ |
| @@ -152,6 +154,8 @@ static void fix_processor_context(void) | |||
| 152 | */ | 154 | */ |
| 153 | static void __restore_processor_state(struct saved_context *ctxt) | 155 | static void __restore_processor_state(struct saved_context *ctxt) |
| 154 | { | 156 | { |
| 157 | if (ctxt->misc_enable_saved) | ||
| 158 | wrmsrl(MSR_IA32_MISC_ENABLE, ctxt->misc_enable); | ||
| 155 | /* | 159 | /* |
| 156 | * control registers | 160 | * control registers |
| 157 | */ | 161 | */ |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 1984a6e89e84..261f86d102e8 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
| @@ -541,29 +541,11 @@ static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) | |||
| 541 | return -EINVAL; | 541 | return -EINVAL; |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | static int ahci_is_device_present(void __iomem *port_mmio) | ||
| 545 | { | ||
| 546 | u8 status = readl(port_mmio + PORT_TFDATA) & 0xff; | ||
| 547 | |||
| 548 | /* Make sure PxTFD.STS.BSY and PxTFD.STS.DRQ are 0 */ | ||
| 549 | if (status & (ATA_BUSY | ATA_DRQ)) | ||
| 550 | return 0; | ||
| 551 | |||
| 552 | /* Make sure PxSSTS.DET is 3h */ | ||
| 553 | status = readl(port_mmio + PORT_SCR_STAT) & 0xf; | ||
| 554 | if (status != 3) | ||
| 555 | return 0; | ||
| 556 | return 1; | ||
| 557 | } | ||
| 558 | |||
| 559 | void ahci_start_engine(struct ata_port *ap) | 544 | void ahci_start_engine(struct ata_port *ap) |
| 560 | { | 545 | { |
| 561 | void __iomem *port_mmio = ahci_port_base(ap); | 546 | void __iomem *port_mmio = ahci_port_base(ap); |
| 562 | u32 tmp; | 547 | u32 tmp; |
| 563 | 548 | ||
| 564 | if (!ahci_is_device_present(port_mmio)) | ||
| 565 | return; | ||
| 566 | |||
| 567 | /* start DMA */ | 549 | /* start DMA */ |
| 568 | tmp = readl(port_mmio + PORT_CMD); | 550 | tmp = readl(port_mmio + PORT_CMD); |
| 569 | tmp |= PORT_CMD_START; | 551 | tmp |= PORT_CMD_START; |
| @@ -1892,6 +1874,9 @@ static void ahci_error_handler(struct ata_port *ap) | |||
| 1892 | } | 1874 | } |
| 1893 | 1875 | ||
| 1894 | sata_pmp_error_handler(ap); | 1876 | sata_pmp_error_handler(ap); |
| 1877 | |||
| 1878 | if (!ata_dev_enabled(ap->link.device)) | ||
| 1879 | ahci_stop_engine(ap); | ||
| 1895 | } | 1880 | } |
| 1896 | 1881 | ||
| 1897 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) | 1882 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index e9250514734b..be7726d7686d 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
| @@ -539,12 +539,12 @@ static void sil24_config_port(struct ata_port *ap) | |||
| 539 | writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_CLR); | 539 | writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_CLR); |
| 540 | 540 | ||
| 541 | /* zero error counters. */ | 541 | /* zero error counters. */ |
| 542 | writel(0x8000, port + PORT_DECODE_ERR_THRESH); | 542 | writew(0x8000, port + PORT_DECODE_ERR_THRESH); |
| 543 | writel(0x8000, port + PORT_CRC_ERR_THRESH); | 543 | writew(0x8000, port + PORT_CRC_ERR_THRESH); |
| 544 | writel(0x8000, port + PORT_HSHK_ERR_THRESH); | 544 | writew(0x8000, port + PORT_HSHK_ERR_THRESH); |
| 545 | writel(0x0000, port + PORT_DECODE_ERR_CNT); | 545 | writew(0x0000, port + PORT_DECODE_ERR_CNT); |
| 546 | writel(0x0000, port + PORT_CRC_ERR_CNT); | 546 | writew(0x0000, port + PORT_CRC_ERR_CNT); |
| 547 | writel(0x0000, port + PORT_HSHK_ERR_CNT); | 547 | writew(0x0000, port + PORT_HSHK_ERR_CNT); |
| 548 | 548 | ||
| 549 | /* always use 64bit activation */ | 549 | /* always use 64bit activation */ |
| 550 | writel(PORT_CS_32BIT_ACTV, port + PORT_CTRL_CLR); | 550 | writel(PORT_CS_32BIT_ACTV, port + PORT_CTRL_CLR); |
| @@ -622,6 +622,11 @@ static int sil24_exec_polled_cmd(struct ata_port *ap, int pmp, | |||
| 622 | irq_enabled = readl(port + PORT_IRQ_ENABLE_SET); | 622 | irq_enabled = readl(port + PORT_IRQ_ENABLE_SET); |
| 623 | writel(PORT_IRQ_COMPLETE | PORT_IRQ_ERROR, port + PORT_IRQ_ENABLE_CLR); | 623 | writel(PORT_IRQ_COMPLETE | PORT_IRQ_ERROR, port + PORT_IRQ_ENABLE_CLR); |
| 624 | 624 | ||
| 625 | /* | ||
| 626 | * The barrier is required to ensure that writes to cmd_block reach | ||
| 627 | * the memory before the write to PORT_CMD_ACTIVATE. | ||
| 628 | */ | ||
| 629 | wmb(); | ||
| 625 | writel((u32)paddr, port + PORT_CMD_ACTIVATE); | 630 | writel((u32)paddr, port + PORT_CMD_ACTIVATE); |
| 626 | writel((u64)paddr >> 32, port + PORT_CMD_ACTIVATE + 4); | 631 | writel((u64)paddr >> 32, port + PORT_CMD_ACTIVATE + 4); |
| 627 | 632 | ||
| @@ -865,7 +870,7 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc) | |||
| 865 | } else { | 870 | } else { |
| 866 | prb = &cb->atapi.prb; | 871 | prb = &cb->atapi.prb; |
| 867 | sge = cb->atapi.sge; | 872 | sge = cb->atapi.sge; |
| 868 | memset(cb->atapi.cdb, 0, 32); | 873 | memset(cb->atapi.cdb, 0, sizeof(cb->atapi.cdb)); |
| 869 | memcpy(cb->atapi.cdb, qc->cdb, qc->dev->cdb_len); | 874 | memcpy(cb->atapi.cdb, qc->cdb, qc->dev->cdb_len); |
| 870 | 875 | ||
| 871 | if (ata_is_data(qc->tf.protocol)) { | 876 | if (ata_is_data(qc->tf.protocol)) { |
| @@ -895,6 +900,11 @@ static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc) | |||
| 895 | paddr = pp->cmd_block_dma + tag * sizeof(*pp->cmd_block); | 900 | paddr = pp->cmd_block_dma + tag * sizeof(*pp->cmd_block); |
| 896 | activate = port + PORT_CMD_ACTIVATE + tag * 8; | 901 | activate = port + PORT_CMD_ACTIVATE + tag * 8; |
| 897 | 902 | ||
| 903 | /* | ||
| 904 | * The barrier is required to ensure that writes to cmd_block reach | ||
| 905 | * the memory before the write to PORT_CMD_ACTIVATE. | ||
| 906 | */ | ||
| 907 | wmb(); | ||
| 898 | writel((u32)paddr, activate); | 908 | writel((u32)paddr, activate); |
| 899 | writel((u64)paddr >> 32, activate + 4); | 909 | writel((u64)paddr >> 32, activate + 4); |
| 900 | 910 | ||
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 0ecd0f6aa2c0..4730c42a5ee5 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
| @@ -578,10 +578,24 @@ static void svia_configure(struct pci_dev *pdev) | |||
| 578 | 578 | ||
| 579 | /* | 579 | /* |
| 580 | * vt6421 has problems talking to some drives. The following | 580 | * vt6421 has problems talking to some drives. The following |
| 581 | * is the magic fix from Joseph Chan <JosephChan@via.com.tw>. | 581 | * is the fix from Joseph Chan <JosephChan@via.com.tw>. |
| 582 | * Please add proper documentation if possible. | 582 | * |
| 583 | * When host issues HOLD, device may send up to 20DW of data | ||
| 584 | * before acknowledging it with HOLDA and the host should be | ||
| 585 | * able to buffer them in FIFO. Unfortunately, some WD drives | ||
| 586 | * send upto 40DW before acknowledging HOLD and, in the | ||
| 587 | * default configuration, this ends up overflowing vt6421's | ||
| 588 | * FIFO, making the controller abort the transaction with | ||
| 589 | * R_ERR. | ||
| 590 | * | ||
| 591 | * Rx52[2] is the internal 128DW FIFO Flow control watermark | ||
| 592 | * adjusting mechanism enable bit and the default value 0 | ||
| 593 | * means host will issue HOLD to device when the left FIFO | ||
| 594 | * size goes below 32DW. Setting it to 1 makes the watermark | ||
| 595 | * 64DW. | ||
| 583 | * | 596 | * |
| 584 | * https://bugzilla.kernel.org/show_bug.cgi?id=15173 | 597 | * https://bugzilla.kernel.org/show_bug.cgi?id=15173 |
| 598 | * http://article.gmane.org/gmane.linux.ide/46352 | ||
| 585 | */ | 599 | */ |
| 586 | if (pdev->device == 0x3249) { | 600 | if (pdev->device == 0x3249) { |
| 587 | pci_read_config_byte(pdev, 0x52, &tmp8); | 601 | pci_read_config_byte(pdev, 0x52, &tmp8); |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 1296c42ed5c6..7cdb6ee569cd 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
| @@ -304,7 +304,7 @@ static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr) | |||
| 304 | d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); | 304 | d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); |
| 305 | s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr)); | 305 | s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr)); |
| 306 | scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row); | 306 | scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row); |
| 307 | scr_memsetw(d + (b - t - nr) * vc->vc_size_row, vc->vc_video_erase_char, | 307 | scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_video_erase_char, |
| 308 | vc->vc_size_row * nr); | 308 | vc->vc_size_row * nr); |
| 309 | } | 309 | } |
| 310 | 310 | ||
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c index 9dcb30466ec0..371713ff0266 100644 --- a/drivers/firewire/core-card.c +++ b/drivers/firewire/core-card.c | |||
| @@ -231,7 +231,7 @@ void fw_schedule_bm_work(struct fw_card *card, unsigned long delay) | |||
| 231 | static void fw_card_bm_work(struct work_struct *work) | 231 | static void fw_card_bm_work(struct work_struct *work) |
| 232 | { | 232 | { |
| 233 | struct fw_card *card = container_of(work, struct fw_card, work.work); | 233 | struct fw_card *card = container_of(work, struct fw_card, work.work); |
| 234 | struct fw_device *root_device; | 234 | struct fw_device *root_device, *irm_device; |
| 235 | struct fw_node *root_node; | 235 | struct fw_node *root_node; |
| 236 | unsigned long flags; | 236 | unsigned long flags; |
| 237 | int root_id, new_root_id, irm_id, local_id; | 237 | int root_id, new_root_id, irm_id, local_id; |
| @@ -239,6 +239,7 @@ static void fw_card_bm_work(struct work_struct *work) | |||
| 239 | bool do_reset = false; | 239 | bool do_reset = false; |
| 240 | bool root_device_is_running; | 240 | bool root_device_is_running; |
| 241 | bool root_device_is_cmc; | 241 | bool root_device_is_cmc; |
| 242 | bool irm_is_1394_1995_only; | ||
| 242 | 243 | ||
| 243 | spin_lock_irqsave(&card->lock, flags); | 244 | spin_lock_irqsave(&card->lock, flags); |
| 244 | 245 | ||
| @@ -248,12 +249,18 @@ static void fw_card_bm_work(struct work_struct *work) | |||
| 248 | } | 249 | } |
| 249 | 250 | ||
| 250 | generation = card->generation; | 251 | generation = card->generation; |
| 252 | |||
| 251 | root_node = card->root_node; | 253 | root_node = card->root_node; |
| 252 | fw_node_get(root_node); | 254 | fw_node_get(root_node); |
| 253 | root_device = root_node->data; | 255 | root_device = root_node->data; |
| 254 | root_device_is_running = root_device && | 256 | root_device_is_running = root_device && |
| 255 | atomic_read(&root_device->state) == FW_DEVICE_RUNNING; | 257 | atomic_read(&root_device->state) == FW_DEVICE_RUNNING; |
| 256 | root_device_is_cmc = root_device && root_device->cmc; | 258 | root_device_is_cmc = root_device && root_device->cmc; |
| 259 | |||
| 260 | irm_device = card->irm_node->data; | ||
| 261 | irm_is_1394_1995_only = irm_device && irm_device->config_rom && | ||
| 262 | (irm_device->config_rom[2] & 0x000000f0) == 0; | ||
| 263 | |||
| 257 | root_id = root_node->node_id; | 264 | root_id = root_node->node_id; |
| 258 | irm_id = card->irm_node->node_id; | 265 | irm_id = card->irm_node->node_id; |
| 259 | local_id = card->local_node->node_id; | 266 | local_id = card->local_node->node_id; |
| @@ -276,8 +283,15 @@ static void fw_card_bm_work(struct work_struct *work) | |||
| 276 | 283 | ||
| 277 | if (!card->irm_node->link_on) { | 284 | if (!card->irm_node->link_on) { |
| 278 | new_root_id = local_id; | 285 | new_root_id = local_id; |
| 279 | fw_notify("IRM has link off, making local node (%02x) root.\n", | 286 | fw_notify("%s, making local node (%02x) root.\n", |
| 280 | new_root_id); | 287 | "IRM has link off", new_root_id); |
| 288 | goto pick_me; | ||
| 289 | } | ||
| 290 | |||
| 291 | if (irm_is_1394_1995_only) { | ||
| 292 | new_root_id = local_id; | ||
| 293 | fw_notify("%s, making local node (%02x) root.\n", | ||
| 294 | "IRM is not 1394a compliant", new_root_id); | ||
| 281 | goto pick_me; | 295 | goto pick_me; |
| 282 | } | 296 | } |
| 283 | 297 | ||
| @@ -316,8 +330,8 @@ static void fw_card_bm_work(struct work_struct *work) | |||
| 316 | * root, and thus, IRM. | 330 | * root, and thus, IRM. |
| 317 | */ | 331 | */ |
| 318 | new_root_id = local_id; | 332 | new_root_id = local_id; |
| 319 | fw_notify("BM lock failed, making local node (%02x) root.\n", | 333 | fw_notify("%s, making local node (%02x) root.\n", |
| 320 | new_root_id); | 334 | "BM lock failed", new_root_id); |
| 321 | goto pick_me; | 335 | goto pick_me; |
| 322 | } | 336 | } |
| 323 | } else if (card->bm_generation != generation) { | 337 | } else if (card->bm_generation != generation) { |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 994d23beeb1d..57cea01c4ffb 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
| @@ -1840,8 +1840,10 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev, | |||
| 1840 | 1840 | ||
| 1841 | ret = copy_from_user(clips, clips_ptr, | 1841 | ret = copy_from_user(clips, clips_ptr, |
| 1842 | num_clips * sizeof(*clips)); | 1842 | num_clips * sizeof(*clips)); |
| 1843 | if (ret) | 1843 | if (ret) { |
| 1844 | ret = -EFAULT; | ||
| 1844 | goto out_err2; | 1845 | goto out_err2; |
| 1846 | } | ||
| 1845 | } | 1847 | } |
| 1846 | 1848 | ||
| 1847 | if (fb->funcs->dirty) { | 1849 | if (fb->funcs->dirty) { |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index b3779d243aef..08c4c926e65f 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
| @@ -264,7 +264,7 @@ bool drm_fb_helper_force_kernel_mode(void) | |||
| 264 | int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed, | 264 | int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed, |
| 265 | void *panic_str) | 265 | void *panic_str) |
| 266 | { | 266 | { |
| 267 | DRM_ERROR("panic occurred, switching back to text console\n"); | 267 | printk(KERN_ERR "panic occurred, switching back to text console\n"); |
| 268 | return drm_fb_helper_force_kernel_mode(); | 268 | return drm_fb_helper_force_kernel_mode(); |
| 269 | return 0; | 269 | return 0; |
| 270 | } | 270 | } |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index b2ebf02e4f8a..59a2bf8592ec 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
| @@ -1402,19 +1402,19 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
| 1402 | /* if we have > 1 VGA cards, then disable the radeon VGA resources */ | 1402 | /* if we have > 1 VGA cards, then disable the radeon VGA resources */ |
| 1403 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); | 1403 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); |
| 1404 | if (ret) | 1404 | if (ret) |
| 1405 | goto destroy_ringbuffer; | 1405 | goto cleanup_ringbuffer; |
| 1406 | 1406 | ||
| 1407 | ret = vga_switcheroo_register_client(dev->pdev, | 1407 | ret = vga_switcheroo_register_client(dev->pdev, |
| 1408 | i915_switcheroo_set_state, | 1408 | i915_switcheroo_set_state, |
| 1409 | i915_switcheroo_can_switch); | 1409 | i915_switcheroo_can_switch); |
| 1410 | if (ret) | 1410 | if (ret) |
| 1411 | goto destroy_ringbuffer; | 1411 | goto cleanup_vga_client; |
| 1412 | 1412 | ||
| 1413 | intel_modeset_init(dev); | 1413 | intel_modeset_init(dev); |
| 1414 | 1414 | ||
| 1415 | ret = drm_irq_install(dev); | 1415 | ret = drm_irq_install(dev); |
| 1416 | if (ret) | 1416 | if (ret) |
| 1417 | goto destroy_ringbuffer; | 1417 | goto cleanup_vga_switcheroo; |
| 1418 | 1418 | ||
| 1419 | /* Always safe in the mode setting case. */ | 1419 | /* Always safe in the mode setting case. */ |
| 1420 | /* FIXME: do pre/post-mode set stuff in core KMS code */ | 1420 | /* FIXME: do pre/post-mode set stuff in core KMS code */ |
| @@ -1426,11 +1426,20 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
| 1426 | 1426 | ||
| 1427 | I915_WRITE(INSTPM, (1 << 5) | (1 << 21)); | 1427 | I915_WRITE(INSTPM, (1 << 5) | (1 << 21)); |
| 1428 | 1428 | ||
| 1429 | intel_fbdev_init(dev); | 1429 | ret = intel_fbdev_init(dev); |
| 1430 | if (ret) | ||
| 1431 | goto cleanup_irq; | ||
| 1432 | |||
| 1430 | drm_kms_helper_poll_init(dev); | 1433 | drm_kms_helper_poll_init(dev); |
| 1431 | return 0; | 1434 | return 0; |
| 1432 | 1435 | ||
| 1433 | destroy_ringbuffer: | 1436 | cleanup_irq: |
| 1437 | drm_irq_uninstall(dev); | ||
| 1438 | cleanup_vga_switcheroo: | ||
| 1439 | vga_switcheroo_unregister_client(dev->pdev); | ||
| 1440 | cleanup_vga_client: | ||
| 1441 | vga_client_register(dev->pdev, NULL, NULL, NULL); | ||
| 1442 | cleanup_ringbuffer: | ||
| 1434 | mutex_lock(&dev->struct_mutex); | 1443 | mutex_lock(&dev->struct_mutex); |
| 1435 | i915_gem_cleanup_ringbuffer(dev); | 1444 | i915_gem_cleanup_ringbuffer(dev); |
| 1436 | mutex_unlock(&dev->struct_mutex); | 1445 | mutex_unlock(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 9ed8ecd95801..276583159847 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
| @@ -278,6 +278,7 @@ typedef struct drm_i915_private { | |||
| 278 | struct mem_block *agp_heap; | 278 | struct mem_block *agp_heap; |
| 279 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; | 279 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; |
| 280 | int vblank_pipe; | 280 | int vblank_pipe; |
| 281 | int num_pipe; | ||
| 281 | 282 | ||
| 282 | /* For hangcheck timer */ | 283 | /* For hangcheck timer */ |
| 283 | #define DRM_I915_HANGCHECK_PERIOD 75 /* in jiffies */ | 284 | #define DRM_I915_HANGCHECK_PERIOD 75 /* in jiffies */ |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 88a1ab7c05ce..cc8131ff319f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -3653,6 +3653,11 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
| 3653 | pipeconf &= ~PIPEACONF_DOUBLE_WIDE; | 3653 | pipeconf &= ~PIPEACONF_DOUBLE_WIDE; |
| 3654 | } | 3654 | } |
| 3655 | 3655 | ||
| 3656 | dspcntr |= DISPLAY_PLANE_ENABLE; | ||
| 3657 | pipeconf |= PIPEACONF_ENABLE; | ||
| 3658 | dpll |= DPLL_VCO_ENABLE; | ||
| 3659 | |||
| 3660 | |||
| 3656 | /* Disable the panel fitter if it was on our pipe */ | 3661 | /* Disable the panel fitter if it was on our pipe */ |
| 3657 | if (!HAS_PCH_SPLIT(dev) && intel_panel_fitter_pipe(dev) == pipe) | 3662 | if (!HAS_PCH_SPLIT(dev) && intel_panel_fitter_pipe(dev) == pipe) |
| 3658 | I915_WRITE(PFIT_CONTROL, 0); | 3663 | I915_WRITE(PFIT_CONTROL, 0); |
| @@ -3973,6 +3978,13 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
| 3973 | DRM_ERROR("failed to pin cursor bo\n"); | 3978 | DRM_ERROR("failed to pin cursor bo\n"); |
| 3974 | goto fail_locked; | 3979 | goto fail_locked; |
| 3975 | } | 3980 | } |
| 3981 | |||
| 3982 | ret = i915_gem_object_set_to_gtt_domain(bo, 0); | ||
| 3983 | if (ret) { | ||
| 3984 | DRM_ERROR("failed to move cursor bo into the GTT\n"); | ||
| 3985 | goto fail_unpin; | ||
| 3986 | } | ||
| 3987 | |||
| 3976 | addr = obj_priv->gtt_offset; | 3988 | addr = obj_priv->gtt_offset; |
| 3977 | } else { | 3989 | } else { |
| 3978 | ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1); | 3990 | ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1); |
| @@ -4016,6 +4028,8 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
| 4016 | intel_crtc->cursor_bo = bo; | 4028 | intel_crtc->cursor_bo = bo; |
| 4017 | 4029 | ||
| 4018 | return 0; | 4030 | return 0; |
| 4031 | fail_unpin: | ||
| 4032 | i915_gem_object_unpin(bo); | ||
| 4019 | fail_locked: | 4033 | fail_locked: |
| 4020 | mutex_unlock(&dev->struct_mutex); | 4034 | mutex_unlock(&dev->struct_mutex); |
| 4021 | fail: | 4035 | fail: |
| @@ -5461,7 +5475,6 @@ static void intel_init_display(struct drm_device *dev) | |||
| 5461 | void intel_modeset_init(struct drm_device *dev) | 5475 | void intel_modeset_init(struct drm_device *dev) |
| 5462 | { | 5476 | { |
| 5463 | struct drm_i915_private *dev_priv = dev->dev_private; | 5477 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 5464 | int num_pipe; | ||
| 5465 | int i; | 5478 | int i; |
| 5466 | 5479 | ||
| 5467 | drm_mode_config_init(dev); | 5480 | drm_mode_config_init(dev); |
| @@ -5491,13 +5504,13 @@ void intel_modeset_init(struct drm_device *dev) | |||
| 5491 | dev->mode_config.fb_base = pci_resource_start(dev->pdev, 0); | 5504 | dev->mode_config.fb_base = pci_resource_start(dev->pdev, 0); |
| 5492 | 5505 | ||
| 5493 | if (IS_MOBILE(dev) || IS_I9XX(dev)) | 5506 | if (IS_MOBILE(dev) || IS_I9XX(dev)) |
| 5494 | num_pipe = 2; | 5507 | dev_priv->num_pipe = 2; |
| 5495 | else | 5508 | else |
| 5496 | num_pipe = 1; | 5509 | dev_priv->num_pipe = 1; |
| 5497 | DRM_DEBUG_KMS("%d display pipe%s available.\n", | 5510 | DRM_DEBUG_KMS("%d display pipe%s available.\n", |
| 5498 | num_pipe, num_pipe > 1 ? "s" : ""); | 5511 | dev_priv->num_pipe, dev_priv->num_pipe > 1 ? "s" : ""); |
| 5499 | 5512 | ||
| 5500 | for (i = 0; i < num_pipe; i++) { | 5513 | for (i = 0; i < dev_priv->num_pipe; i++) { |
| 5501 | intel_crtc_init(dev, i); | 5514 | intel_crtc_init(dev, i); |
| 5502 | } | 5515 | } |
| 5503 | 5516 | ||
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index f8c76e64bb77..c3c505244e07 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
| @@ -245,6 +245,7 @@ int intel_fbdev_init(struct drm_device *dev) | |||
| 245 | { | 245 | { |
| 246 | struct intel_fbdev *ifbdev; | 246 | struct intel_fbdev *ifbdev; |
| 247 | drm_i915_private_t *dev_priv = dev->dev_private; | 247 | drm_i915_private_t *dev_priv = dev->dev_private; |
| 248 | int ret; | ||
| 248 | 249 | ||
| 249 | ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL); | 250 | ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL); |
| 250 | if (!ifbdev) | 251 | if (!ifbdev) |
| @@ -253,8 +254,13 @@ int intel_fbdev_init(struct drm_device *dev) | |||
| 253 | dev_priv->fbdev = ifbdev; | 254 | dev_priv->fbdev = ifbdev; |
| 254 | ifbdev->helper.funcs = &intel_fb_helper_funcs; | 255 | ifbdev->helper.funcs = &intel_fb_helper_funcs; |
| 255 | 256 | ||
| 256 | drm_fb_helper_init(dev, &ifbdev->helper, 2, | 257 | ret = drm_fb_helper_init(dev, &ifbdev->helper, |
| 257 | INTELFB_CONN_LIMIT); | 258 | dev_priv->num_pipe, |
| 259 | INTELFB_CONN_LIMIT); | ||
| 260 | if (ret) { | ||
| 261 | kfree(ifbdev); | ||
| 262 | return ret; | ||
| 263 | } | ||
| 258 | 264 | ||
| 259 | drm_fb_helper_single_add_all_connectors(&ifbdev->helper); | 265 | drm_fb_helper_single_add_all_connectors(&ifbdev->helper); |
| 260 | drm_fb_helper_initial_config(&ifbdev->helper, 32); | 266 | drm_fb_helper_initial_config(&ifbdev->helper, 32); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 9ba2deaadcc7..fc924b649195 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
| @@ -834,7 +834,7 @@ init_i2c_device_find(struct drm_device *dev, int i2c_index) | |||
| 834 | if (i2c_index == 0x81) | 834 | if (i2c_index == 0x81) |
| 835 | i2c_index = (dcb->i2c_default_indices & 0xf0) >> 4; | 835 | i2c_index = (dcb->i2c_default_indices & 0xf0) >> 4; |
| 836 | 836 | ||
| 837 | if (i2c_index > DCB_MAX_NUM_I2C_ENTRIES) { | 837 | if (i2c_index >= DCB_MAX_NUM_I2C_ENTRIES) { |
| 838 | NV_ERROR(dev, "invalid i2c_index 0x%x\n", i2c_index); | 838 | NV_ERROR(dev, "invalid i2c_index 0x%x\n", i2c_index); |
| 839 | return NULL; | 839 | return NULL; |
| 840 | } | 840 | } |
| @@ -3920,7 +3920,8 @@ int nouveau_bios_parse_lvds_table(struct drm_device *dev, int pxclk, bool *dl, b | |||
| 3920 | 3920 | ||
| 3921 | static uint8_t * | 3921 | static uint8_t * |
| 3922 | bios_output_config_match(struct drm_device *dev, struct dcb_entry *dcbent, | 3922 | bios_output_config_match(struct drm_device *dev, struct dcb_entry *dcbent, |
| 3923 | uint16_t record, int record_len, int record_nr) | 3923 | uint16_t record, int record_len, int record_nr, |
| 3924 | bool match_link) | ||
| 3924 | { | 3925 | { |
| 3925 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 3926 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 3926 | struct nvbios *bios = &dev_priv->vbios; | 3927 | struct nvbios *bios = &dev_priv->vbios; |
| @@ -3928,12 +3929,28 @@ bios_output_config_match(struct drm_device *dev, struct dcb_entry *dcbent, | |||
| 3928 | uint16_t table; | 3929 | uint16_t table; |
| 3929 | int i, v; | 3930 | int i, v; |
| 3930 | 3931 | ||
| 3932 | switch (dcbent->type) { | ||
| 3933 | case OUTPUT_TMDS: | ||
| 3934 | case OUTPUT_LVDS: | ||
| 3935 | case OUTPUT_DP: | ||
| 3936 | break; | ||
| 3937 | default: | ||
| 3938 | match_link = false; | ||
| 3939 | break; | ||
| 3940 | } | ||
| 3941 | |||
| 3931 | for (i = 0; i < record_nr; i++, record += record_len) { | 3942 | for (i = 0; i < record_nr; i++, record += record_len) { |
| 3932 | table = ROM16(bios->data[record]); | 3943 | table = ROM16(bios->data[record]); |
| 3933 | if (!table) | 3944 | if (!table) |
| 3934 | continue; | 3945 | continue; |
| 3935 | entry = ROM32(bios->data[table]); | 3946 | entry = ROM32(bios->data[table]); |
| 3936 | 3947 | ||
| 3948 | if (match_link) { | ||
| 3949 | v = (entry & 0x00c00000) >> 22; | ||
| 3950 | if (!(v & dcbent->sorconf.link)) | ||
| 3951 | continue; | ||
| 3952 | } | ||
| 3953 | |||
| 3937 | v = (entry & 0x000f0000) >> 16; | 3954 | v = (entry & 0x000f0000) >> 16; |
| 3938 | if (!(v & dcbent->or)) | 3955 | if (!(v & dcbent->or)) |
| 3939 | continue; | 3956 | continue; |
| @@ -3975,7 +3992,7 @@ nouveau_bios_dp_table(struct drm_device *dev, struct dcb_entry *dcbent, | |||
| 3975 | *length = table[4]; | 3992 | *length = table[4]; |
| 3976 | return bios_output_config_match(dev, dcbent, | 3993 | return bios_output_config_match(dev, dcbent, |
| 3977 | bios->display.dp_table_ptr + table[1], | 3994 | bios->display.dp_table_ptr + table[1], |
| 3978 | table[2], table[3]); | 3995 | table[2], table[3], table[0] >= 0x21); |
| 3979 | } | 3996 | } |
| 3980 | 3997 | ||
| 3981 | int | 3998 | int |
| @@ -4064,7 +4081,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent, | |||
| 4064 | dcbent->type, dcbent->location, dcbent->or); | 4081 | dcbent->type, dcbent->location, dcbent->or); |
| 4065 | otable = bios_output_config_match(dev, dcbent, table[1] + | 4082 | otable = bios_output_config_match(dev, dcbent, table[1] + |
| 4066 | bios->display.script_table_ptr, | 4083 | bios->display.script_table_ptr, |
| 4067 | table[2], table[3]); | 4084 | table[2], table[3], table[0] >= 0x21); |
| 4068 | if (!otable) { | 4085 | if (!otable) { |
| 4069 | NV_ERROR(dev, "Couldn't find matching output script table\n"); | 4086 | NV_ERROR(dev, "Couldn't find matching output script table\n"); |
| 4070 | return 1; | 4087 | return 1; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index fd4a2df715e9..c9a4a0d2a115 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
| @@ -377,6 +377,7 @@ int nouveau_fbcon_init(struct drm_device *dev) | |||
| 377 | { | 377 | { |
| 378 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 378 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 379 | struct nouveau_fbdev *nfbdev; | 379 | struct nouveau_fbdev *nfbdev; |
| 380 | int ret; | ||
| 380 | 381 | ||
| 381 | nfbdev = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL); | 382 | nfbdev = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL); |
| 382 | if (!nfbdev) | 383 | if (!nfbdev) |
| @@ -386,7 +387,12 @@ int nouveau_fbcon_init(struct drm_device *dev) | |||
| 386 | dev_priv->nfbdev = nfbdev; | 387 | dev_priv->nfbdev = nfbdev; |
| 387 | nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs; | 388 | nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs; |
| 388 | 389 | ||
| 389 | drm_fb_helper_init(dev, &nfbdev->helper, 2, 4); | 390 | ret = drm_fb_helper_init(dev, &nfbdev->helper, 2, 4); |
| 391 | if (ret) { | ||
| 392 | kfree(nfbdev); | ||
| 393 | return ret; | ||
| 394 | } | ||
| 395 | |||
| 390 | drm_fb_helper_single_add_all_connectors(&nfbdev->helper); | 396 | drm_fb_helper_single_add_all_connectors(&nfbdev->helper); |
| 391 | drm_fb_helper_initial_config(&nfbdev->helper, 32); | 397 | drm_fb_helper_initial_config(&nfbdev->helper, 32); |
| 392 | return 0; | 398 | return 0; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 147e59c40151..b02a231d6937 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
| @@ -779,29 +779,24 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
| 779 | return ret; | 779 | return ret; |
| 780 | } | 780 | } |
| 781 | 781 | ||
| 782 | /* map larger RAMIN aperture on NV40 cards */ | 782 | /* Map PRAMIN BAR, or on older cards, the aperture withing BAR0 */ |
| 783 | dev_priv->ramin = NULL; | ||
| 784 | if (dev_priv->card_type >= NV_40) { | 783 | if (dev_priv->card_type >= NV_40) { |
| 785 | int ramin_bar = 2; | 784 | int ramin_bar = 2; |
| 786 | if (pci_resource_len(dev->pdev, ramin_bar) == 0) | 785 | if (pci_resource_len(dev->pdev, ramin_bar) == 0) |
| 787 | ramin_bar = 3; | 786 | ramin_bar = 3; |
| 788 | 787 | ||
| 789 | dev_priv->ramin_size = pci_resource_len(dev->pdev, ramin_bar); | 788 | dev_priv->ramin_size = pci_resource_len(dev->pdev, ramin_bar); |
| 790 | dev_priv->ramin = ioremap( | 789 | dev_priv->ramin = |
| 791 | pci_resource_start(dev->pdev, ramin_bar), | 790 | ioremap(pci_resource_start(dev->pdev, ramin_bar), |
| 792 | dev_priv->ramin_size); | 791 | dev_priv->ramin_size); |
| 793 | if (!dev_priv->ramin) { | 792 | if (!dev_priv->ramin) { |
| 794 | NV_ERROR(dev, "Failed to init RAMIN mapping, " | 793 | NV_ERROR(dev, "Failed to PRAMIN BAR"); |
| 795 | "limited instance memory available\n"); | 794 | return -ENOMEM; |
| 796 | } | 795 | } |
| 797 | } | 796 | } else { |
| 798 | |||
| 799 | /* On older cards (or if the above failed), create a map covering | ||
| 800 | * the BAR0 PRAMIN aperture */ | ||
| 801 | if (!dev_priv->ramin) { | ||
| 802 | dev_priv->ramin_size = 1 * 1024 * 1024; | 797 | dev_priv->ramin_size = 1 * 1024 * 1024; |
| 803 | dev_priv->ramin = ioremap(mmio_start_offs + NV_RAMIN, | 798 | dev_priv->ramin = ioremap(mmio_start_offs + NV_RAMIN, |
| 804 | dev_priv->ramin_size); | 799 | dev_priv->ramin_size); |
| 805 | if (!dev_priv->ramin) { | 800 | if (!dev_priv->ramin) { |
| 806 | NV_ERROR(dev, "Failed to map BAR0 PRAMIN.\n"); | 801 | NV_ERROR(dev, "Failed to map BAR0 PRAMIN.\n"); |
| 807 | return -ENOMEM; | 802 | return -ENOMEM; |
diff --git a/drivers/gpu/drm/nouveau/nv50_fb.c b/drivers/gpu/drm/nouveau/nv50_fb.c index a95e6941ba88..32611bd30e6d 100644 --- a/drivers/gpu/drm/nouveau/nv50_fb.c +++ b/drivers/gpu/drm/nouveau/nv50_fb.c | |||
| @@ -6,10 +6,16 @@ | |||
| 6 | int | 6 | int |
| 7 | nv50_fb_init(struct drm_device *dev) | 7 | nv50_fb_init(struct drm_device *dev) |
| 8 | { | 8 | { |
| 9 | /* This is needed to get meaningful information from 100c90 | ||
| 10 | * on traps. No idea what these values mean exactly. */ | ||
| 11 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 9 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 12 | 10 | ||
| 11 | /* Not a clue what this is exactly. Without pointing it at a | ||
| 12 | * scratch page, VRAM->GART blits with M2MF (as in DDX DFS) | ||
| 13 | * cause IOMMU "read from address 0" errors (rh#561267) | ||
| 14 | */ | ||
| 15 | nv_wr32(dev, 0x100c08, dev_priv->gart_info.sg_dummy_bus >> 8); | ||
| 16 | |||
| 17 | /* This is needed to get meaningful information from 100c90 | ||
| 18 | * on traps. No idea what these values mean exactly. */ | ||
| 13 | switch (dev_priv->chipset) { | 19 | switch (dev_priv->chipset) { |
| 14 | case 0x50: | 20 | case 0x50: |
| 15 | nv_wr32(dev, 0x100c90, 0x0707ff); | 21 | nv_wr32(dev, 0x100c90, 0x0707ff); |
diff --git a/drivers/gpu/drm/nouveau/nv50_gpio.c b/drivers/gpu/drm/nouveau/nv50_gpio.c index c61782b314e7..bb47ad737267 100644 --- a/drivers/gpu/drm/nouveau/nv50_gpio.c +++ b/drivers/gpu/drm/nouveau/nv50_gpio.c | |||
| @@ -31,7 +31,7 @@ nv50_gpio_location(struct dcb_gpio_entry *gpio, uint32_t *reg, uint32_t *shift) | |||
| 31 | { | 31 | { |
| 32 | const uint32_t nv50_gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 }; | 32 | const uint32_t nv50_gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 }; |
| 33 | 33 | ||
| 34 | if (gpio->line > 32) | 34 | if (gpio->line >= 32) |
| 35 | return -EINVAL; | 35 | return -EINVAL; |
| 36 | 36 | ||
| 37 | *reg = nv50_gpio_reg[gpio->line >> 3]; | 37 | *reg = nv50_gpio_reg[gpio->line >> 3]; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 0440c0939bdd..4b6623df3b96 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
| @@ -41,12 +41,18 @@ void evergreen_fini(struct radeon_device *rdev); | |||
| 41 | 41 | ||
| 42 | void evergreen_pm_misc(struct radeon_device *rdev) | 42 | void evergreen_pm_misc(struct radeon_device *rdev) |
| 43 | { | 43 | { |
| 44 | int requested_index = rdev->pm.requested_power_state_index; | 44 | int req_ps_idx = rdev->pm.requested_power_state_index; |
| 45 | struct radeon_power_state *ps = &rdev->pm.power_state[requested_index]; | 45 | int req_cm_idx = rdev->pm.requested_clock_mode_index; |
| 46 | struct radeon_voltage *voltage = &ps->clock_info[0].voltage; | 46 | struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx]; |
| 47 | 47 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; | |
| 48 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) | 48 | |
| 49 | radeon_atom_set_voltage(rdev, voltage->voltage); | 49 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { |
| 50 | if (voltage->voltage != rdev->pm.current_vddc) { | ||
| 51 | radeon_atom_set_voltage(rdev, voltage->voltage); | ||
| 52 | rdev->pm.current_vddc = voltage->voltage; | ||
| 53 | DRM_DEBUG("Setting: v: %d\n", voltage->voltage); | ||
| 54 | } | ||
| 55 | } | ||
| 50 | } | 56 | } |
| 51 | 57 | ||
| 52 | void evergreen_pm_prepare(struct radeon_device *rdev) | 58 | void evergreen_pm_prepare(struct radeon_device *rdev) |
| @@ -2153,7 +2159,7 @@ int evergreen_init(struct radeon_device *rdev) | |||
| 2153 | if (r) | 2159 | if (r) |
| 2154 | return r; | 2160 | return r; |
| 2155 | 2161 | ||
| 2156 | rdev->accel_working = false; | 2162 | rdev->accel_working = true; |
| 2157 | r = evergreen_startup(rdev); | 2163 | r = evergreen_startup(rdev); |
| 2158 | if (r) { | 2164 | if (r) { |
| 2159 | dev_err(rdev->dev, "disabling GPU acceleration\n"); | 2165 | dev_err(rdev->dev, "disabling GPU acceleration\n"); |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index cc004b05d63e..cf89aa2eb28c 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
| @@ -162,6 +162,11 @@ void r100_pm_init_profile(struct radeon_device *rdev) | |||
| 162 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 0; | 162 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 0; |
| 163 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; | 163 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; |
| 164 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; | 164 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; |
| 165 | /* mid sh */ | ||
| 166 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_ps_idx = 0; | ||
| 167 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_ps_idx = 0; | ||
| 168 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_cm_idx = 0; | ||
| 169 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_cm_idx = 0; | ||
| 165 | /* high sh */ | 170 | /* high sh */ |
| 166 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 0; | 171 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 0; |
| 167 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | 172 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; |
| @@ -172,6 +177,11 @@ void r100_pm_init_profile(struct radeon_device *rdev) | |||
| 172 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | 177 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; |
| 173 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; | 178 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; |
| 174 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; | 179 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; |
| 180 | /* mid mh */ | ||
| 181 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_ps_idx = 0; | ||
| 182 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | ||
| 183 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_cm_idx = 0; | ||
| 184 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_cm_idx = 0; | ||
| 175 | /* high mh */ | 185 | /* high mh */ |
| 176 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 0; | 186 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 0; |
| 177 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | 187 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 4415a5ee5871..e6c89142bb4d 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
| @@ -45,9 +45,14 @@ void r420_pm_init_profile(struct radeon_device *rdev) | |||
| 45 | rdev->pm.profiles[PM_PROFILE_DEFAULT_IDX].dpms_on_cm_idx = 0; | 45 | rdev->pm.profiles[PM_PROFILE_DEFAULT_IDX].dpms_on_cm_idx = 0; |
| 46 | /* low sh */ | 46 | /* low sh */ |
| 47 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_ps_idx = 0; | 47 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_ps_idx = 0; |
| 48 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 1; | 48 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 0; |
| 49 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; | 49 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; |
| 50 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; | 50 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; |
| 51 | /* mid sh */ | ||
| 52 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_ps_idx = 0; | ||
| 53 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_ps_idx = 1; | ||
| 54 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_cm_idx = 0; | ||
| 55 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_cm_idx = 0; | ||
| 51 | /* high sh */ | 56 | /* high sh */ |
| 52 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 0; | 57 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 0; |
| 53 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | 58 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; |
| @@ -58,6 +63,11 @@ void r420_pm_init_profile(struct radeon_device *rdev) | |||
| 58 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | 63 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; |
| 59 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; | 64 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; |
| 60 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; | 65 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; |
| 66 | /* mid mh */ | ||
| 67 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_ps_idx = 0; | ||
| 68 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | ||
| 69 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_cm_idx = 0; | ||
| 70 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_cm_idx = 0; | ||
| 61 | /* high mh */ | 71 | /* high mh */ |
| 62 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 0; | 72 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 0; |
| 63 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | 73 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index e14f59748e65..0e91871f45be 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -291,6 +291,11 @@ void rs780_pm_init_profile(struct radeon_device *rdev) | |||
| 291 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 0; | 291 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 0; |
| 292 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; | 292 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; |
| 293 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; | 293 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; |
| 294 | /* mid sh */ | ||
| 295 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_ps_idx = 0; | ||
| 296 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_ps_idx = 0; | ||
| 297 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_cm_idx = 0; | ||
| 298 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_cm_idx = 0; | ||
| 294 | /* high sh */ | 299 | /* high sh */ |
| 295 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 0; | 300 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 0; |
| 296 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = 1; | 301 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = 1; |
| @@ -301,6 +306,11 @@ void rs780_pm_init_profile(struct radeon_device *rdev) | |||
| 301 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = 0; | 306 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = 0; |
| 302 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; | 307 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; |
| 303 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; | 308 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; |
| 309 | /* mid mh */ | ||
| 310 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_ps_idx = 0; | ||
| 311 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_ps_idx = 0; | ||
| 312 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_cm_idx = 0; | ||
| 313 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_cm_idx = 0; | ||
| 304 | /* high mh */ | 314 | /* high mh */ |
| 305 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 0; | 315 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 0; |
| 306 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = 1; | 316 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = 1; |
| @@ -317,6 +327,11 @@ void rs780_pm_init_profile(struct radeon_device *rdev) | |||
| 317 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 1; | 327 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 1; |
| 318 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; | 328 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; |
| 319 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; | 329 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; |
| 330 | /* mid sh */ | ||
| 331 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_ps_idx = 1; | ||
| 332 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_ps_idx = 1; | ||
| 333 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_cm_idx = 0; | ||
| 334 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_cm_idx = 0; | ||
| 320 | /* high sh */ | 335 | /* high sh */ |
| 321 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 1; | 336 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 1; |
| 322 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = 2; | 337 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = 2; |
| @@ -327,6 +342,11 @@ void rs780_pm_init_profile(struct radeon_device *rdev) | |||
| 327 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = 1; | 342 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = 1; |
| 328 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; | 343 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; |
| 329 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; | 344 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; |
| 345 | /* mid mh */ | ||
| 346 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_ps_idx = 1; | ||
| 347 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_ps_idx = 1; | ||
| 348 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_cm_idx = 0; | ||
| 349 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_cm_idx = 0; | ||
| 330 | /* high mh */ | 350 | /* high mh */ |
| 331 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 1; | 351 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 1; |
| 332 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = 2; | 352 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = 2; |
| @@ -343,6 +363,11 @@ void rs780_pm_init_profile(struct radeon_device *rdev) | |||
| 343 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 2; | 363 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 2; |
| 344 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; | 364 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; |
| 345 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; | 365 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; |
| 366 | /* mid sh */ | ||
| 367 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_ps_idx = 2; | ||
| 368 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_ps_idx = 2; | ||
| 369 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_cm_idx = 0; | ||
| 370 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_cm_idx = 0; | ||
| 346 | /* high sh */ | 371 | /* high sh */ |
| 347 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 2; | 372 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 2; |
| 348 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = 3; | 373 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = 3; |
| @@ -353,6 +378,11 @@ void rs780_pm_init_profile(struct radeon_device *rdev) | |||
| 353 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = 0; | 378 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = 0; |
| 354 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; | 379 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; |
| 355 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; | 380 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; |
| 381 | /* mid mh */ | ||
| 382 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_ps_idx = 2; | ||
| 383 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_ps_idx = 0; | ||
| 384 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_cm_idx = 0; | ||
| 385 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_cm_idx = 0; | ||
| 356 | /* high mh */ | 386 | /* high mh */ |
| 357 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 2; | 387 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 2; |
| 358 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = 3; | 388 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = 3; |
| @@ -375,6 +405,11 @@ void r600_pm_init_profile(struct radeon_device *rdev) | |||
| 375 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | 405 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; |
| 376 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; | 406 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; |
| 377 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; | 407 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; |
| 408 | /* mid sh */ | ||
| 409 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_ps_idx = rdev->pm.default_power_state_index; | ||
| 410 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | ||
| 411 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_cm_idx = 0; | ||
| 412 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_cm_idx = 0; | ||
| 378 | /* high sh */ | 413 | /* high sh */ |
| 379 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = rdev->pm.default_power_state_index; | 414 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = rdev->pm.default_power_state_index; |
| 380 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | 415 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; |
| @@ -385,6 +420,11 @@ void r600_pm_init_profile(struct radeon_device *rdev) | |||
| 385 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | 420 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; |
| 386 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; | 421 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; |
| 387 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; | 422 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; |
| 423 | /* mid mh */ | ||
| 424 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_ps_idx = rdev->pm.default_power_state_index; | ||
| 425 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | ||
| 426 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_cm_idx = 0; | ||
| 427 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_cm_idx = 0; | ||
| 388 | /* high mh */ | 428 | /* high mh */ |
| 389 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = rdev->pm.default_power_state_index; | 429 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = rdev->pm.default_power_state_index; |
| 390 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; | 430 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = rdev->pm.default_power_state_index; |
| @@ -401,7 +441,12 @@ void r600_pm_init_profile(struct radeon_device *rdev) | |||
| 401 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_ps_idx = 1; | 441 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_ps_idx = 1; |
| 402 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 1; | 442 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = 1; |
| 403 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; | 443 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; |
| 404 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 1; | 444 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; |
| 445 | /* mid sh */ | ||
| 446 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_ps_idx = 1; | ||
| 447 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_ps_idx = 1; | ||
| 448 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_cm_idx = 0; | ||
| 449 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_cm_idx = 1; | ||
| 405 | /* high sh */ | 450 | /* high sh */ |
| 406 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 1; | 451 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = 1; |
| 407 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = 1; | 452 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_on_ps_idx = 1; |
| @@ -411,7 +456,12 @@ void r600_pm_init_profile(struct radeon_device *rdev) | |||
| 411 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_ps_idx = 2; | 456 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_ps_idx = 2; |
| 412 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = 2; | 457 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = 2; |
| 413 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; | 458 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; |
| 414 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 1; | 459 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; |
| 460 | /* low mh */ | ||
| 461 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_ps_idx = 2; | ||
| 462 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_ps_idx = 2; | ||
| 463 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_cm_idx = 0; | ||
| 464 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_cm_idx = 1; | ||
| 415 | /* high mh */ | 465 | /* high mh */ |
| 416 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 2; | 466 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = 2; |
| 417 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = 2; | 467 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_ps_idx = 2; |
| @@ -430,14 +480,30 @@ void r600_pm_init_profile(struct radeon_device *rdev) | |||
| 430 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = | 480 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = |
| 431 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_BATTERY, 0); | 481 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_BATTERY, 0); |
| 432 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; | 482 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; |
| 433 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 1; | 483 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; |
| 434 | } else { | 484 | } else { |
| 435 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_ps_idx = | 485 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_ps_idx = |
| 436 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 0); | 486 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 0); |
| 437 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = | 487 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_ps_idx = |
| 438 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 0); | 488 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 0); |
| 439 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; | 489 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_off_cm_idx = 0; |
| 440 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 1; | 490 | rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX].dpms_on_cm_idx = 0; |
| 491 | } | ||
| 492 | /* mid sh */ | ||
| 493 | if (rdev->flags & RADEON_IS_MOBILITY) { | ||
| 494 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_ps_idx = | ||
| 495 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_BATTERY, 0); | ||
| 496 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_ps_idx = | ||
| 497 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_BATTERY, 0); | ||
| 498 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_cm_idx = 0; | ||
| 499 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_cm_idx = 1; | ||
| 500 | } else { | ||
| 501 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_ps_idx = | ||
| 502 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 0); | ||
| 503 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_ps_idx = | ||
| 504 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 0); | ||
| 505 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_off_cm_idx = 0; | ||
| 506 | rdev->pm.profiles[PM_PROFILE_MID_SH_IDX].dpms_on_cm_idx = 1; | ||
| 441 | } | 507 | } |
| 442 | /* high sh */ | 508 | /* high sh */ |
| 443 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = | 509 | rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX].dpms_off_ps_idx = |
| @@ -453,14 +519,30 @@ void r600_pm_init_profile(struct radeon_device *rdev) | |||
| 453 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = | 519 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = |
| 454 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_BATTERY, 1); | 520 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_BATTERY, 1); |
| 455 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; | 521 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; |
| 456 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 2; | 522 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; |
| 457 | } else { | 523 | } else { |
| 458 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_ps_idx = | 524 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_ps_idx = |
| 459 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 1); | 525 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 1); |
| 460 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = | 526 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_ps_idx = |
| 461 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 1); | 527 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 1); |
| 462 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; | 528 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_off_cm_idx = 0; |
| 463 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 1; | 529 | rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX].dpms_on_cm_idx = 0; |
| 530 | } | ||
| 531 | /* mid mh */ | ||
| 532 | if (rdev->flags & RADEON_IS_MOBILITY) { | ||
| 533 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_ps_idx = | ||
| 534 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_BATTERY, 1); | ||
| 535 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_ps_idx = | ||
| 536 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_BATTERY, 1); | ||
| 537 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_cm_idx = 0; | ||
| 538 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_cm_idx = 1; | ||
| 539 | } else { | ||
| 540 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_ps_idx = | ||
| 541 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 1); | ||
| 542 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_ps_idx = | ||
| 543 | r600_pm_get_type_index(rdev, POWER_STATE_TYPE_PERFORMANCE, 1); | ||
| 544 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_off_cm_idx = 0; | ||
| 545 | rdev->pm.profiles[PM_PROFILE_MID_MH_IDX].dpms_on_cm_idx = 1; | ||
| 464 | } | 546 | } |
| 465 | /* high mh */ | 547 | /* high mh */ |
| 466 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = | 548 | rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_off_ps_idx = |
| @@ -475,13 +557,18 @@ void r600_pm_init_profile(struct radeon_device *rdev) | |||
| 475 | 557 | ||
| 476 | void r600_pm_misc(struct radeon_device *rdev) | 558 | void r600_pm_misc(struct radeon_device *rdev) |
| 477 | { | 559 | { |
| 478 | int requested_index = rdev->pm.requested_power_state_index; | 560 | int req_ps_idx = rdev->pm.requested_power_state_index; |
| 479 | struct radeon_power_state *ps = &rdev->pm.power_state[requested_index]; | 561 | int req_cm_idx = rdev->pm.requested_clock_mode_index; |
| 480 | struct radeon_voltage *voltage = &ps->clock_info[0].voltage; | 562 | struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx]; |
| 481 | 563 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; | |
| 482 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) | ||
| 483 | radeon_atom_set_voltage(rdev, voltage->voltage); | ||
| 484 | 564 | ||
| 565 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { | ||
| 566 | if (voltage->voltage != rdev->pm.current_vddc) { | ||
| 567 | radeon_atom_set_voltage(rdev, voltage->voltage); | ||
| 568 | rdev->pm.current_vddc = voltage->voltage; | ||
| 569 | DRM_DEBUG("Setting: v: %d\n", voltage->voltage); | ||
| 570 | } | ||
| 571 | } | ||
| 485 | } | 572 | } |
| 486 | 573 | ||
| 487 | bool r600_gui_idle(struct radeon_device *rdev) | 574 | bool r600_gui_idle(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 5f96fe871b3f..8e1d44ca26ec 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
| @@ -648,15 +648,18 @@ enum radeon_pm_profile_type { | |||
| 648 | PM_PROFILE_DEFAULT, | 648 | PM_PROFILE_DEFAULT, |
| 649 | PM_PROFILE_AUTO, | 649 | PM_PROFILE_AUTO, |
| 650 | PM_PROFILE_LOW, | 650 | PM_PROFILE_LOW, |
| 651 | PM_PROFILE_MID, | ||
| 651 | PM_PROFILE_HIGH, | 652 | PM_PROFILE_HIGH, |
| 652 | }; | 653 | }; |
| 653 | 654 | ||
| 654 | #define PM_PROFILE_DEFAULT_IDX 0 | 655 | #define PM_PROFILE_DEFAULT_IDX 0 |
| 655 | #define PM_PROFILE_LOW_SH_IDX 1 | 656 | #define PM_PROFILE_LOW_SH_IDX 1 |
| 656 | #define PM_PROFILE_HIGH_SH_IDX 2 | 657 | #define PM_PROFILE_MID_SH_IDX 2 |
| 657 | #define PM_PROFILE_LOW_MH_IDX 3 | 658 | #define PM_PROFILE_HIGH_SH_IDX 3 |
| 658 | #define PM_PROFILE_HIGH_MH_IDX 4 | 659 | #define PM_PROFILE_LOW_MH_IDX 4 |
| 659 | #define PM_PROFILE_MAX 5 | 660 | #define PM_PROFILE_MID_MH_IDX 5 |
| 661 | #define PM_PROFILE_HIGH_MH_IDX 6 | ||
| 662 | #define PM_PROFILE_MAX 7 | ||
| 660 | 663 | ||
| 661 | struct radeon_pm_profile { | 664 | struct radeon_pm_profile { |
| 662 | int dpms_off_ps_idx; | 665 | int dpms_off_ps_idx; |
| @@ -745,6 +748,7 @@ struct radeon_pm { | |||
| 745 | int default_power_state_index; | 748 | int default_power_state_index; |
| 746 | u32 current_sclk; | 749 | u32 current_sclk; |
| 747 | u32 current_mclk; | 750 | u32 current_mclk; |
| 751 | u32 current_vddc; | ||
| 748 | struct radeon_i2c_chan *i2c_bus; | 752 | struct radeon_i2c_chan *i2c_bus; |
| 749 | /* selected pm method */ | 753 | /* selected pm method */ |
| 750 | enum radeon_pm_method pm_method; | 754 | enum radeon_pm_method pm_method; |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 4305cd55d0ac..99bd8a9c56b3 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
| @@ -1833,10 +1833,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) | |||
| 1833 | /* skip invalid modes */ | 1833 | /* skip invalid modes */ |
| 1834 | if (rdev->pm.power_state[state_index].clock_info[mode_index].sclk == 0) | 1834 | if (rdev->pm.power_state[state_index].clock_info[mode_index].sclk == 0) |
| 1835 | continue; | 1835 | continue; |
| 1836 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = | 1836 | /* voltage works differently on IGPs */ |
| 1837 | VOLTAGE_SW; | ||
| 1838 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = | ||
| 1839 | clock_info->usVDDC; | ||
| 1840 | mode_index++; | 1837 | mode_index++; |
| 1841 | } else if (ASIC_IS_DCE4(rdev)) { | 1838 | } else if (ASIC_IS_DCE4(rdev)) { |
| 1842 | struct _ATOM_PPLIB_EVERGREEN_CLOCK_INFO *clock_info = | 1839 | struct _ATOM_PPLIB_EVERGREEN_CLOCK_INFO *clock_info = |
| @@ -1969,6 +1966,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) | |||
| 1969 | 1966 | ||
| 1970 | rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; | 1967 | rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; |
| 1971 | rdev->pm.current_clock_mode_index = 0; | 1968 | rdev->pm.current_clock_mode_index = 0; |
| 1969 | rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage; | ||
| 1972 | } | 1970 | } |
| 1973 | 1971 | ||
| 1974 | void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable) | 1972 | void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable) |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 102c744eaf5a..1bee2f9e24a5 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
| @@ -2026,6 +2026,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 2026 | combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); | 2026 | combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); |
| 2027 | break; | 2027 | break; |
| 2028 | default: | 2028 | default: |
| 2029 | ddc_i2c.valid = false; | ||
| 2029 | break; | 2030 | break; |
| 2030 | } | 2031 | } |
| 2031 | 2032 | ||
| @@ -2339,6 +2340,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 2339 | if (RBIOS8(tv_info + 6) == 'T') { | 2340 | if (RBIOS8(tv_info + 6) == 'T') { |
| 2340 | if (radeon_apply_legacy_tv_quirks(dev)) { | 2341 | if (radeon_apply_legacy_tv_quirks(dev)) { |
| 2341 | hpd.hpd = RADEON_HPD_NONE; | 2342 | hpd.hpd = RADEON_HPD_NONE; |
| 2343 | ddc_i2c.valid = false; | ||
| 2342 | radeon_add_legacy_encoder(dev, | 2344 | radeon_add_legacy_encoder(dev, |
| 2343 | radeon_get_encoder_id | 2345 | radeon_get_encoder_id |
| 2344 | (dev, | 2346 | (dev, |
| @@ -2455,7 +2457,7 @@ default_mode: | |||
| 2455 | rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk; | 2457 | rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk; |
| 2456 | rdev->pm.power_state[state_index].default_clock_mode = &rdev->pm.power_state[state_index].clock_info[0]; | 2458 | rdev->pm.power_state[state_index].default_clock_mode = &rdev->pm.power_state[state_index].clock_info[0]; |
| 2457 | if ((state_index > 0) && | 2459 | if ((state_index > 0) && |
| 2458 | (rdev->pm.power_state[0].clock_info[0].voltage.type = VOLTAGE_GPIO)) | 2460 | (rdev->pm.power_state[0].clock_info[0].voltage.type == VOLTAGE_GPIO)) |
| 2459 | rdev->pm.power_state[state_index].clock_info[0].voltage = | 2461 | rdev->pm.power_state[state_index].clock_info[0].voltage = |
| 2460 | rdev->pm.power_state[0].clock_info[0].voltage; | 2462 | rdev->pm.power_state[0].clock_info[0].voltage; |
| 2461 | else | 2463 | else |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 1006549d1570..8154cdf796e4 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
| @@ -284,8 +284,7 @@ static const char *connector_names[15] = { | |||
| 284 | "eDP", | 284 | "eDP", |
| 285 | }; | 285 | }; |
| 286 | 286 | ||
| 287 | static const char *hpd_names[7] = { | 287 | static const char *hpd_names[6] = { |
| 288 | "NONE", | ||
| 289 | "HPD1", | 288 | "HPD1", |
| 290 | "HPD2", | 289 | "HPD2", |
| 291 | "HPD3", | 290 | "HPD3", |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 902d1731a652..e166fe4d7c30 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
| @@ -45,9 +45,10 @@ | |||
| 45 | * - 2.2.0 - add r6xx/r7xx const buffer support | 45 | * - 2.2.0 - add r6xx/r7xx const buffer support |
| 46 | * - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs | 46 | * - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs |
| 47 | * - 2.4.0 - add crtc id query | 47 | * - 2.4.0 - add crtc id query |
| 48 | * - 2.5.0 - add get accel 2 to work around ddx breakage for evergreen | ||
| 48 | */ | 49 | */ |
| 49 | #define KMS_DRIVER_MAJOR 2 | 50 | #define KMS_DRIVER_MAJOR 2 |
| 50 | #define KMS_DRIVER_MINOR 4 | 51 | #define KMS_DRIVER_MINOR 5 |
| 51 | #define KMS_DRIVER_PATCHLEVEL 0 | 52 | #define KMS_DRIVER_PATCHLEVEL 0 |
| 52 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); | 53 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); |
| 53 | int radeon_driver_unload_kms(struct drm_device *dev); | 54 | int radeon_driver_unload_kms(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index e192acfbf0cd..dc1634bb0c11 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
| @@ -363,6 +363,7 @@ int radeon_fbdev_init(struct radeon_device *rdev) | |||
| 363 | { | 363 | { |
| 364 | struct radeon_fbdev *rfbdev; | 364 | struct radeon_fbdev *rfbdev; |
| 365 | int bpp_sel = 32; | 365 | int bpp_sel = 32; |
| 366 | int ret; | ||
| 366 | 367 | ||
| 367 | /* select 8 bpp console on RN50 or 16MB cards */ | 368 | /* select 8 bpp console on RN50 or 16MB cards */ |
| 368 | if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024)) | 369 | if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024)) |
| @@ -376,9 +377,14 @@ int radeon_fbdev_init(struct radeon_device *rdev) | |||
| 376 | rdev->mode_info.rfbdev = rfbdev; | 377 | rdev->mode_info.rfbdev = rfbdev; |
| 377 | rfbdev->helper.funcs = &radeon_fb_helper_funcs; | 378 | rfbdev->helper.funcs = &radeon_fb_helper_funcs; |
| 378 | 379 | ||
| 379 | drm_fb_helper_init(rdev->ddev, &rfbdev->helper, | 380 | ret = drm_fb_helper_init(rdev->ddev, &rfbdev->helper, |
| 380 | rdev->num_crtc, | 381 | rdev->num_crtc, |
| 381 | RADEONFB_CONN_LIMIT); | 382 | RADEONFB_CONN_LIMIT); |
| 383 | if (ret) { | ||
| 384 | kfree(rfbdev); | ||
| 385 | return ret; | ||
| 386 | } | ||
| 387 | |||
| 382 | drm_fb_helper_single_add_all_connectors(&rfbdev->helper); | 388 | drm_fb_helper_single_add_all_connectors(&rfbdev->helper); |
| 383 | drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); | 389 | drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); |
| 384 | return 0; | 390 | return 0; |
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 04068352ccd2..6a70c0dc7f92 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
| @@ -118,7 +118,11 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
| 118 | value = rdev->num_z_pipes; | 118 | value = rdev->num_z_pipes; |
| 119 | break; | 119 | break; |
| 120 | case RADEON_INFO_ACCEL_WORKING: | 120 | case RADEON_INFO_ACCEL_WORKING: |
| 121 | value = rdev->accel_working; | 121 | /* xf86-video-ati 6.13.0 relies on this being false for evergreen */ |
| 122 | if ((rdev->family >= CHIP_CEDAR) && (rdev->family <= CHIP_HEMLOCK)) | ||
| 123 | value = false; | ||
| 124 | else | ||
| 125 | value = rdev->accel_working; | ||
| 122 | break; | 126 | break; |
| 123 | case RADEON_INFO_CRTC_FROM_ID: | 127 | case RADEON_INFO_CRTC_FROM_ID: |
| 124 | for (i = 0, found = 0; i < rdev->num_crtc; i++) { | 128 | for (i = 0, found = 0; i < rdev->num_crtc; i++) { |
| @@ -134,6 +138,9 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
| 134 | return -EINVAL; | 138 | return -EINVAL; |
| 135 | } | 139 | } |
| 136 | break; | 140 | break; |
| 141 | case RADEON_INFO_ACCEL_WORKING2: | ||
| 142 | value = rdev->accel_working; | ||
| 143 | break; | ||
| 137 | default: | 144 | default: |
| 138 | DRM_DEBUG("Invalid request %d\n", info->request); | 145 | DRM_DEBUG("Invalid request %d\n", info->request); |
| 139 | return -EINVAL; | 146 | return -EINVAL; |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 5a13b3eeef19..5b07b8848e09 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
| @@ -1168,6 +1168,17 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
| 1168 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1168 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 1169 | struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; | 1169 | struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; |
| 1170 | bool color = true; | 1170 | bool color = true; |
| 1171 | struct drm_crtc *crtc; | ||
| 1172 | |||
| 1173 | /* find out if crtc2 is in use or if this encoder is using it */ | ||
| 1174 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
| 1175 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
| 1176 | if ((radeon_crtc->crtc_id == 1) && crtc->enabled) { | ||
| 1177 | if (encoder->crtc != crtc) { | ||
| 1178 | return connector_status_disconnected; | ||
| 1179 | } | ||
| 1180 | } | ||
| 1181 | } | ||
| 1171 | 1182 | ||
| 1172 | if (connector->connector_type == DRM_MODE_CONNECTOR_SVIDEO || | 1183 | if (connector->connector_type == DRM_MODE_CONNECTOR_SVIDEO || |
| 1173 | connector->connector_type == DRM_MODE_CONNECTOR_Composite || | 1184 | connector->connector_type == DRM_MODE_CONNECTOR_Composite || |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 02281269a881..63f679a04b25 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
| @@ -33,6 +33,14 @@ | |||
| 33 | #define RADEON_WAIT_VBLANK_TIMEOUT 200 | 33 | #define RADEON_WAIT_VBLANK_TIMEOUT 200 |
| 34 | #define RADEON_WAIT_IDLE_TIMEOUT 200 | 34 | #define RADEON_WAIT_IDLE_TIMEOUT 200 |
| 35 | 35 | ||
| 36 | static const char *radeon_pm_state_type_name[5] = { | ||
| 37 | "Default", | ||
| 38 | "Powersave", | ||
| 39 | "Battery", | ||
| 40 | "Balanced", | ||
| 41 | "Performance", | ||
| 42 | }; | ||
| 43 | |||
| 36 | static void radeon_dynpm_idle_work_handler(struct work_struct *work); | 44 | static void radeon_dynpm_idle_work_handler(struct work_struct *work); |
| 37 | static int radeon_debugfs_pm_init(struct radeon_device *rdev); | 45 | static int radeon_debugfs_pm_init(struct radeon_device *rdev); |
| 38 | static bool radeon_pm_in_vbl(struct radeon_device *rdev); | 46 | static bool radeon_pm_in_vbl(struct radeon_device *rdev); |
| @@ -84,9 +92,9 @@ static void radeon_pm_update_profile(struct radeon_device *rdev) | |||
| 84 | rdev->pm.profile_index = PM_PROFILE_HIGH_SH_IDX; | 92 | rdev->pm.profile_index = PM_PROFILE_HIGH_SH_IDX; |
| 85 | } else { | 93 | } else { |
| 86 | if (rdev->pm.active_crtc_count > 1) | 94 | if (rdev->pm.active_crtc_count > 1) |
| 87 | rdev->pm.profile_index = PM_PROFILE_LOW_MH_IDX; | 95 | rdev->pm.profile_index = PM_PROFILE_MID_MH_IDX; |
| 88 | else | 96 | else |
| 89 | rdev->pm.profile_index = PM_PROFILE_LOW_SH_IDX; | 97 | rdev->pm.profile_index = PM_PROFILE_MID_SH_IDX; |
| 90 | } | 98 | } |
| 91 | break; | 99 | break; |
| 92 | case PM_PROFILE_LOW: | 100 | case PM_PROFILE_LOW: |
| @@ -95,6 +103,12 @@ static void radeon_pm_update_profile(struct radeon_device *rdev) | |||
| 95 | else | 103 | else |
| 96 | rdev->pm.profile_index = PM_PROFILE_LOW_SH_IDX; | 104 | rdev->pm.profile_index = PM_PROFILE_LOW_SH_IDX; |
| 97 | break; | 105 | break; |
| 106 | case PM_PROFILE_MID: | ||
| 107 | if (rdev->pm.active_crtc_count > 1) | ||
| 108 | rdev->pm.profile_index = PM_PROFILE_MID_MH_IDX; | ||
| 109 | else | ||
| 110 | rdev->pm.profile_index = PM_PROFILE_MID_SH_IDX; | ||
| 111 | break; | ||
| 98 | case PM_PROFILE_HIGH: | 112 | case PM_PROFILE_HIGH: |
| 99 | if (rdev->pm.active_crtc_count > 1) | 113 | if (rdev->pm.active_crtc_count > 1) |
| 100 | rdev->pm.profile_index = PM_PROFILE_HIGH_MH_IDX; | 114 | rdev->pm.profile_index = PM_PROFILE_HIGH_MH_IDX; |
| @@ -127,15 +141,6 @@ static void radeon_unmap_vram_bos(struct radeon_device *rdev) | |||
| 127 | if (bo->tbo.mem.mem_type == TTM_PL_VRAM) | 141 | if (bo->tbo.mem.mem_type == TTM_PL_VRAM) |
| 128 | ttm_bo_unmap_virtual(&bo->tbo); | 142 | ttm_bo_unmap_virtual(&bo->tbo); |
| 129 | } | 143 | } |
| 130 | |||
| 131 | if (rdev->gart.table.vram.robj) | ||
| 132 | ttm_bo_unmap_virtual(&rdev->gart.table.vram.robj->tbo); | ||
| 133 | |||
| 134 | if (rdev->stollen_vga_memory) | ||
| 135 | ttm_bo_unmap_virtual(&rdev->stollen_vga_memory->tbo); | ||
| 136 | |||
| 137 | if (rdev->r600_blit.shader_obj) | ||
| 138 | ttm_bo_unmap_virtual(&rdev->r600_blit.shader_obj->tbo); | ||
| 139 | } | 144 | } |
| 140 | 145 | ||
| 141 | static void radeon_sync_with_vblank(struct radeon_device *rdev) | 146 | static void radeon_sync_with_vblank(struct radeon_device *rdev) |
| @@ -281,6 +286,42 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev) | |||
| 281 | mutex_unlock(&rdev->ddev->struct_mutex); | 286 | mutex_unlock(&rdev->ddev->struct_mutex); |
| 282 | } | 287 | } |
| 283 | 288 | ||
| 289 | static void radeon_pm_print_states(struct radeon_device *rdev) | ||
| 290 | { | ||
| 291 | int i, j; | ||
| 292 | struct radeon_power_state *power_state; | ||
| 293 | struct radeon_pm_clock_info *clock_info; | ||
| 294 | |||
| 295 | DRM_DEBUG("%d Power State(s)\n", rdev->pm.num_power_states); | ||
| 296 | for (i = 0; i < rdev->pm.num_power_states; i++) { | ||
| 297 | power_state = &rdev->pm.power_state[i]; | ||
| 298 | DRM_DEBUG("State %d: %s\n", i, | ||
| 299 | radeon_pm_state_type_name[power_state->type]); | ||
| 300 | if (i == rdev->pm.default_power_state_index) | ||
| 301 | DRM_DEBUG("\tDefault"); | ||
| 302 | if ((rdev->flags & RADEON_IS_PCIE) && !(rdev->flags & RADEON_IS_IGP)) | ||
| 303 | DRM_DEBUG("\t%d PCIE Lanes\n", power_state->pcie_lanes); | ||
| 304 | if (power_state->flags & RADEON_PM_STATE_SINGLE_DISPLAY_ONLY) | ||
| 305 | DRM_DEBUG("\tSingle display only\n"); | ||
| 306 | DRM_DEBUG("\t%d Clock Mode(s)\n", power_state->num_clock_modes); | ||
| 307 | for (j = 0; j < power_state->num_clock_modes; j++) { | ||
| 308 | clock_info = &(power_state->clock_info[j]); | ||
| 309 | if (rdev->flags & RADEON_IS_IGP) | ||
| 310 | DRM_DEBUG("\t\t%d e: %d%s\n", | ||
| 311 | j, | ||
| 312 | clock_info->sclk * 10, | ||
| 313 | clock_info->flags & RADEON_PM_MODE_NO_DISPLAY ? "\tNo display only" : ""); | ||
| 314 | else | ||
| 315 | DRM_DEBUG("\t\t%d e: %d\tm: %d\tv: %d%s\n", | ||
| 316 | j, | ||
| 317 | clock_info->sclk * 10, | ||
| 318 | clock_info->mclk * 10, | ||
| 319 | clock_info->voltage.voltage, | ||
| 320 | clock_info->flags & RADEON_PM_MODE_NO_DISPLAY ? "\tNo display only" : ""); | ||
| 321 | } | ||
| 322 | } | ||
| 323 | } | ||
| 324 | |||
| 284 | static ssize_t radeon_get_pm_profile(struct device *dev, | 325 | static ssize_t radeon_get_pm_profile(struct device *dev, |
| 285 | struct device_attribute *attr, | 326 | struct device_attribute *attr, |
| 286 | char *buf) | 327 | char *buf) |
| @@ -311,6 +352,8 @@ static ssize_t radeon_set_pm_profile(struct device *dev, | |||
| 311 | rdev->pm.profile = PM_PROFILE_AUTO; | 352 | rdev->pm.profile = PM_PROFILE_AUTO; |
| 312 | else if (strncmp("low", buf, strlen("low")) == 0) | 353 | else if (strncmp("low", buf, strlen("low")) == 0) |
| 313 | rdev->pm.profile = PM_PROFILE_LOW; | 354 | rdev->pm.profile = PM_PROFILE_LOW; |
| 355 | else if (strncmp("mid", buf, strlen("mid")) == 0) | ||
| 356 | rdev->pm.profile = PM_PROFILE_MID; | ||
| 314 | else if (strncmp("high", buf, strlen("high")) == 0) | 357 | else if (strncmp("high", buf, strlen("high")) == 0) |
| 315 | rdev->pm.profile = PM_PROFILE_HIGH; | 358 | rdev->pm.profile = PM_PROFILE_HIGH; |
| 316 | else { | 359 | else { |
| @@ -377,15 +420,19 @@ void radeon_pm_suspend(struct radeon_device *rdev) | |||
| 377 | { | 420 | { |
| 378 | mutex_lock(&rdev->pm.mutex); | 421 | mutex_lock(&rdev->pm.mutex); |
| 379 | cancel_delayed_work(&rdev->pm.dynpm_idle_work); | 422 | cancel_delayed_work(&rdev->pm.dynpm_idle_work); |
| 380 | rdev->pm.current_power_state_index = -1; | ||
| 381 | rdev->pm.current_clock_mode_index = -1; | ||
| 382 | rdev->pm.current_sclk = 0; | ||
| 383 | rdev->pm.current_mclk = 0; | ||
| 384 | mutex_unlock(&rdev->pm.mutex); | 423 | mutex_unlock(&rdev->pm.mutex); |
| 385 | } | 424 | } |
| 386 | 425 | ||
| 387 | void radeon_pm_resume(struct radeon_device *rdev) | 426 | void radeon_pm_resume(struct radeon_device *rdev) |
| 388 | { | 427 | { |
| 428 | /* asic init will reset the default power state */ | ||
| 429 | mutex_lock(&rdev->pm.mutex); | ||
| 430 | rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; | ||
| 431 | rdev->pm.current_clock_mode_index = 0; | ||
| 432 | rdev->pm.current_sclk = rdev->clock.default_sclk; | ||
| 433 | rdev->pm.current_mclk = rdev->clock.default_mclk; | ||
| 434 | rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage; | ||
| 435 | mutex_unlock(&rdev->pm.mutex); | ||
| 389 | radeon_pm_compute_clocks(rdev); | 436 | radeon_pm_compute_clocks(rdev); |
| 390 | } | 437 | } |
| 391 | 438 | ||
| @@ -394,32 +441,24 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
| 394 | int ret; | 441 | int ret; |
| 395 | /* default to profile method */ | 442 | /* default to profile method */ |
| 396 | rdev->pm.pm_method = PM_METHOD_PROFILE; | 443 | rdev->pm.pm_method = PM_METHOD_PROFILE; |
| 444 | rdev->pm.profile = PM_PROFILE_DEFAULT; | ||
| 397 | rdev->pm.dynpm_state = DYNPM_STATE_DISABLED; | 445 | rdev->pm.dynpm_state = DYNPM_STATE_DISABLED; |
| 398 | rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; | 446 | rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; |
| 399 | rdev->pm.dynpm_can_upclock = true; | 447 | rdev->pm.dynpm_can_upclock = true; |
| 400 | rdev->pm.dynpm_can_downclock = true; | 448 | rdev->pm.dynpm_can_downclock = true; |
| 401 | rdev->pm.current_sclk = 0; | 449 | rdev->pm.current_sclk = rdev->clock.default_sclk; |
| 402 | rdev->pm.current_mclk = 0; | 450 | rdev->pm.current_mclk = rdev->clock.default_mclk; |
| 403 | 451 | ||
| 404 | if (rdev->bios) { | 452 | if (rdev->bios) { |
| 405 | if (rdev->is_atom_bios) | 453 | if (rdev->is_atom_bios) |
| 406 | radeon_atombios_get_power_modes(rdev); | 454 | radeon_atombios_get_power_modes(rdev); |
| 407 | else | 455 | else |
| 408 | radeon_combios_get_power_modes(rdev); | 456 | radeon_combios_get_power_modes(rdev); |
| 457 | radeon_pm_print_states(rdev); | ||
| 409 | radeon_pm_init_profile(rdev); | 458 | radeon_pm_init_profile(rdev); |
| 410 | rdev->pm.current_power_state_index = -1; | ||
| 411 | rdev->pm.current_clock_mode_index = -1; | ||
| 412 | } | 459 | } |
| 413 | 460 | ||
| 414 | if (rdev->pm.num_power_states > 1) { | 461 | if (rdev->pm.num_power_states > 1) { |
| 415 | if (rdev->pm.pm_method == PM_METHOD_PROFILE) { | ||
| 416 | mutex_lock(&rdev->pm.mutex); | ||
| 417 | rdev->pm.profile = PM_PROFILE_DEFAULT; | ||
| 418 | radeon_pm_update_profile(rdev); | ||
| 419 | radeon_pm_set_clocks(rdev); | ||
| 420 | mutex_unlock(&rdev->pm.mutex); | ||
| 421 | } | ||
| 422 | |||
| 423 | /* where's the best place to put these? */ | 462 | /* where's the best place to put these? */ |
| 424 | ret = device_create_file(rdev->dev, &dev_attr_power_profile); | 463 | ret = device_create_file(rdev->dev, &dev_attr_power_profile); |
| 425 | if (ret) | 464 | if (ret) |
| @@ -705,6 +744,8 @@ static int radeon_debugfs_pm_info(struct seq_file *m, void *data) | |||
| 705 | seq_printf(m, "default memory clock: %u0 kHz\n", rdev->clock.default_mclk); | 744 | seq_printf(m, "default memory clock: %u0 kHz\n", rdev->clock.default_mclk); |
| 706 | if (rdev->asic->get_memory_clock) | 745 | if (rdev->asic->get_memory_clock) |
| 707 | seq_printf(m, "current memory clock: %u0 kHz\n", radeon_get_memory_clock(rdev)); | 746 | seq_printf(m, "current memory clock: %u0 kHz\n", radeon_get_memory_clock(rdev)); |
| 747 | if (rdev->pm.current_vddc) | ||
| 748 | seq_printf(m, "voltage: %u mV\n", rdev->pm.current_vddc); | ||
| 708 | if (rdev->asic->get_pcie_lanes) | 749 | if (rdev->asic->get_pcie_lanes) |
| 709 | seq_printf(m, "PCIE lanes: %d\n", radeon_get_pcie_lanes(rdev)); | 750 | seq_printf(m, "PCIE lanes: %d\n", radeon_get_pcie_lanes(rdev)); |
| 710 | 751 | ||
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 33952da65340..cec536c222c5 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
| @@ -44,12 +44,18 @@ void rv770_fini(struct radeon_device *rdev); | |||
| 44 | 44 | ||
| 45 | void rv770_pm_misc(struct radeon_device *rdev) | 45 | void rv770_pm_misc(struct radeon_device *rdev) |
| 46 | { | 46 | { |
| 47 | int requested_index = rdev->pm.requested_power_state_index; | 47 | int req_ps_idx = rdev->pm.requested_power_state_index; |
| 48 | struct radeon_power_state *ps = &rdev->pm.power_state[requested_index]; | 48 | int req_cm_idx = rdev->pm.requested_clock_mode_index; |
| 49 | struct radeon_voltage *voltage = &ps->clock_info[0].voltage; | 49 | struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx]; |
| 50 | 50 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; | |
| 51 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) | 51 | |
| 52 | radeon_atom_set_voltage(rdev, voltage->voltage); | 52 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { |
| 53 | if (voltage->voltage != rdev->pm.current_vddc) { | ||
| 54 | radeon_atom_set_voltage(rdev, voltage->voltage); | ||
| 55 | rdev->pm.current_vddc = voltage->voltage; | ||
| 56 | DRM_DEBUG("Setting: v: %d\n", voltage->voltage); | ||
| 57 | } | ||
| 58 | } | ||
| 53 | } | 59 | } |
| 54 | 60 | ||
| 55 | /* | 61 | /* |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index bdd67cf83315..8e396850513c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | |||
| @@ -644,6 +644,7 @@ int vmw_execbuf_ioctl(struct drm_device *dev, void *data, | |||
| 644 | ret = copy_from_user(cmd, user_cmd, arg->command_size); | 644 | ret = copy_from_user(cmd, user_cmd, arg->command_size); |
| 645 | 645 | ||
| 646 | if (unlikely(ret != 0)) { | 646 | if (unlikely(ret != 0)) { |
| 647 | ret = -EFAULT; | ||
| 647 | DRM_ERROR("Failed copying commands.\n"); | 648 | DRM_ERROR("Failed copying commands.\n"); |
| 648 | goto out_commit; | 649 | goto out_commit; |
| 649 | } | 650 | } |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index f8fbbc67a406..8612378b131e 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
| @@ -597,8 +597,10 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, | |||
| 597 | 597 | ||
| 598 | ret = copy_from_user(srf->sizes, user_sizes, | 598 | ret = copy_from_user(srf->sizes, user_sizes, |
| 599 | srf->num_sizes * sizeof(*srf->sizes)); | 599 | srf->num_sizes * sizeof(*srf->sizes)); |
| 600 | if (unlikely(ret != 0)) | 600 | if (unlikely(ret != 0)) { |
| 601 | ret = -EFAULT; | ||
| 601 | goto out_err1; | 602 | goto out_err1; |
| 603 | } | ||
| 602 | 604 | ||
| 603 | if (srf->scanout && | 605 | if (srf->scanout && |
| 604 | srf->num_sizes == 1 && | 606 | srf->num_sizes == 1 && |
| @@ -697,9 +699,11 @@ int vmw_surface_reference_ioctl(struct drm_device *dev, void *data, | |||
| 697 | if (user_sizes) | 699 | if (user_sizes) |
| 698 | ret = copy_to_user(user_sizes, srf->sizes, | 700 | ret = copy_to_user(user_sizes, srf->sizes, |
| 699 | srf->num_sizes * sizeof(*srf->sizes)); | 701 | srf->num_sizes * sizeof(*srf->sizes)); |
| 700 | if (unlikely(ret != 0)) | 702 | if (unlikely(ret != 0)) { |
| 701 | DRM_ERROR("copy_to_user failed %p %u\n", | 703 | DRM_ERROR("copy_to_user failed %p %u\n", |
| 702 | user_sizes, srf->num_sizes); | 704 | user_sizes, srf->num_sizes); |
| 705 | ret = -EFAULT; | ||
| 706 | } | ||
| 703 | out_bad_resource: | 707 | out_bad_resource: |
| 704 | out_no_reference: | 708 | out_no_reference: |
| 705 | ttm_base_object_unref(&base); | 709 | ttm_base_object_unref(&base); |
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c index e00a1cc79c0a..c19066479057 100644 --- a/drivers/input/misc/hp_sdc_rtc.c +++ b/drivers/input/misc/hp_sdc_rtc.c | |||
| @@ -678,7 +678,7 @@ static const struct file_operations hp_sdc_rtc_fops = { | |||
| 678 | .llseek = no_llseek, | 678 | .llseek = no_llseek, |
| 679 | .read = hp_sdc_rtc_read, | 679 | .read = hp_sdc_rtc_read, |
| 680 | .poll = hp_sdc_rtc_poll, | 680 | .poll = hp_sdc_rtc_poll, |
| 681 | .unlocked_ioctl = hp_sdc_rtc_ioctl, | 681 | .unlocked_ioctl = hp_sdc_rtc_unlocked_ioctl, |
| 682 | .open = hp_sdc_rtc_open, | 682 | .open = hp_sdc_rtc_open, |
| 683 | .fasync = hp_sdc_rtc_fasync, | 683 | .fasync = hp_sdc_rtc_fasync, |
| 684 | }; | 684 | }; |
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c index bde3c88b8b27..b054494df846 100644 --- a/drivers/isdn/capi/kcapi.c +++ b/drivers/isdn/capi/kcapi.c | |||
| @@ -1020,12 +1020,12 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data) | |||
| 1020 | if (cmd == AVMB1_ADDCARD) { | 1020 | if (cmd == AVMB1_ADDCARD) { |
| 1021 | if ((retval = copy_from_user(&cdef, data, | 1021 | if ((retval = copy_from_user(&cdef, data, |
| 1022 | sizeof(avmb1_carddef)))) | 1022 | sizeof(avmb1_carddef)))) |
| 1023 | return retval; | 1023 | return -EFAULT; |
| 1024 | cdef.cardtype = AVM_CARDTYPE_B1; | 1024 | cdef.cardtype = AVM_CARDTYPE_B1; |
| 1025 | } else { | 1025 | } else { |
| 1026 | if ((retval = copy_from_user(&cdef, data, | 1026 | if ((retval = copy_from_user(&cdef, data, |
| 1027 | sizeof(avmb1_extcarddef)))) | 1027 | sizeof(avmb1_extcarddef)))) |
| 1028 | return retval; | 1028 | return -EFAULT; |
| 1029 | } | 1029 | } |
| 1030 | cparams.port = cdef.port; | 1030 | cparams.port = cdef.port; |
| 1031 | cparams.irq = cdef.irq; | 1031 | cparams.irq = cdef.irq; |
| @@ -1218,7 +1218,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data) | |||
| 1218 | kcapi_carddef cdef; | 1218 | kcapi_carddef cdef; |
| 1219 | 1219 | ||
| 1220 | if ((retval = copy_from_user(&cdef, data, sizeof(cdef)))) | 1220 | if ((retval = copy_from_user(&cdef, data, sizeof(cdef)))) |
| 1221 | return retval; | 1221 | return -EFAULT; |
| 1222 | 1222 | ||
| 1223 | cparams.port = cdef.port; | 1223 | cparams.port = cdef.port; |
| 1224 | cparams.irq = cdef.irq; | 1224 | cparams.irq = cdef.irq; |
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index e171e77f6129..f06d06e7fdfa 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig | |||
| @@ -249,7 +249,7 @@ config MMC_IMX | |||
| 249 | 249 | ||
| 250 | config MMC_MSM7X00A | 250 | config MMC_MSM7X00A |
| 251 | tristate "Qualcomm MSM 7X00A SDCC Controller Support" | 251 | tristate "Qualcomm MSM 7X00A SDCC Controller Support" |
| 252 | depends on MMC && ARCH_MSM | 252 | depends on MMC && ARCH_MSM && !ARCH_MSM7X30 |
| 253 | help | 253 | help |
| 254 | This provides support for the SD/MMC cell found in the | 254 | This provides support for the SD/MMC cell found in the |
| 255 | MSM 7X00A controllers from Qualcomm. | 255 | MSM 7X00A controllers from Qualcomm. |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 000d65ea55a4..91c8013cf0d9 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
| @@ -404,14 +404,9 @@ static int mtd_do_writeoob(struct file *file, struct mtd_info *mtd, | |||
| 404 | if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) | 404 | if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) |
| 405 | return -EINVAL; | 405 | return -EINVAL; |
| 406 | 406 | ||
| 407 | ops.oobbuf = kmalloc(length, GFP_KERNEL); | 407 | ops.oobbuf = memdup_user(ptr, length); |
| 408 | if (!ops.oobbuf) | 408 | if (IS_ERR(ops.oobbuf)) |
| 409 | return -ENOMEM; | 409 | return PTR_ERR(ops.oobbuf); |
| 410 | |||
| 411 | if (copy_from_user(ops.oobbuf, ptr, length)) { | ||
| 412 | kfree(ops.oobbuf); | ||
| 413 | return -EFAULT; | ||
| 414 | } | ||
| 415 | 410 | ||
| 416 | start &= ~((uint64_t)mtd->oobsize - 1); | 411 | start &= ~((uint64_t)mtd->oobsize - 1); |
| 417 | ret = mtd->write_oob(mtd, start, &ops); | 412 | ret = mtd->write_oob(mtd, start, &ops); |
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 98a04b3c9526..ffc3720929f1 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig | |||
| @@ -1,13 +1,3 @@ | |||
| 1 | menuconfig MTD_NAND | ||
| 2 | tristate "NAND Device Support" | ||
| 3 | depends on MTD | ||
| 4 | select MTD_NAND_IDS | ||
| 5 | select MTD_NAND_ECC | ||
| 6 | help | ||
| 7 | This enables support for accessing all type of NAND flash | ||
| 8 | devices. For further information see | ||
| 9 | <http://www.linux-mtd.infradead.org/doc/nand.html>. | ||
| 10 | |||
| 11 | config MTD_NAND_ECC | 1 | config MTD_NAND_ECC |
| 12 | tristate | 2 | tristate |
| 13 | 3 | ||
| @@ -19,6 +9,17 @@ config MTD_NAND_ECC_SMC | |||
| 19 | Software ECC according to the Smart Media Specification. | 9 | Software ECC according to the Smart Media Specification. |
| 20 | The original Linux implementation had byte 0 and 1 swapped. | 10 | The original Linux implementation had byte 0 and 1 swapped. |
| 21 | 11 | ||
| 12 | |||
| 13 | menuconfig MTD_NAND | ||
| 14 | tristate "NAND Device Support" | ||
| 15 | depends on MTD | ||
| 16 | select MTD_NAND_IDS | ||
| 17 | select MTD_NAND_ECC | ||
| 18 | help | ||
| 19 | This enables support for accessing all type of NAND flash | ||
| 20 | devices. For further information see | ||
| 21 | <http://www.linux-mtd.infradead.org/doc/nand.html>. | ||
| 22 | |||
| 22 | if MTD_NAND | 23 | if MTD_NAND |
| 23 | 24 | ||
| 24 | config MTD_NAND_VERIFY_WRITE | 25 | config MTD_NAND_VERIFY_WRITE |
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c index 78a423295474..bcfc851fe550 100644 --- a/drivers/mtd/nand/r852.c +++ b/drivers/mtd/nand/r852.c | |||
| @@ -150,7 +150,6 @@ static void r852_dma_done(struct r852_device *dev, int error) | |||
| 150 | if (dev->phys_dma_addr && dev->phys_dma_addr != dev->phys_bounce_buffer) | 150 | if (dev->phys_dma_addr && dev->phys_dma_addr != dev->phys_bounce_buffer) |
| 151 | pci_unmap_single(dev->pci_dev, dev->phys_dma_addr, R852_DMA_LEN, | 151 | pci_unmap_single(dev->pci_dev, dev->phys_dma_addr, R852_DMA_LEN, |
| 152 | dev->dma_dir ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); | 152 | dev->dma_dir ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); |
| 153 | complete(&dev->dma_done); | ||
| 154 | } | 153 | } |
| 155 | 154 | ||
| 156 | /* | 155 | /* |
| @@ -182,6 +181,7 @@ static void r852_do_dma(struct r852_device *dev, uint8_t *buf, int do_read) | |||
| 182 | /* Set dma direction */ | 181 | /* Set dma direction */ |
| 183 | dev->dma_dir = do_read; | 182 | dev->dma_dir = do_read; |
| 184 | dev->dma_stage = 1; | 183 | dev->dma_stage = 1; |
| 184 | INIT_COMPLETION(dev->dma_done); | ||
| 185 | 185 | ||
| 186 | dbg_verbose("doing dma %s ", do_read ? "read" : "write"); | 186 | dbg_verbose("doing dma %s ", do_read ? "read" : "write"); |
| 187 | 187 | ||
| @@ -494,6 +494,11 @@ int r852_ecc_correct(struct mtd_info *mtd, uint8_t *dat, | |||
| 494 | if (dev->card_unstable) | 494 | if (dev->card_unstable) |
| 495 | return 0; | 495 | return 0; |
| 496 | 496 | ||
| 497 | if (dev->dma_error) { | ||
| 498 | dev->dma_error = 0; | ||
| 499 | return -1; | ||
| 500 | } | ||
| 501 | |||
| 497 | r852_write_reg(dev, R852_CTL, dev->ctlreg | R852_CTL_ECC_ACCESS); | 502 | r852_write_reg(dev, R852_CTL, dev->ctlreg | R852_CTL_ECC_ACCESS); |
| 498 | ecc_reg = r852_read_reg_dword(dev, R852_DATALINE); | 503 | ecc_reg = r852_read_reg_dword(dev, R852_DATALINE); |
| 499 | r852_write_reg(dev, R852_CTL, dev->ctlreg); | 504 | r852_write_reg(dev, R852_CTL, dev->ctlreg); |
| @@ -707,6 +712,7 @@ void r852_card_detect_work(struct work_struct *work) | |||
| 707 | container_of(work, struct r852_device, card_detect_work.work); | 712 | container_of(work, struct r852_device, card_detect_work.work); |
| 708 | 713 | ||
| 709 | r852_card_update_present(dev); | 714 | r852_card_update_present(dev); |
| 715 | r852_update_card_detect(dev); | ||
| 710 | dev->card_unstable = 0; | 716 | dev->card_unstable = 0; |
| 711 | 717 | ||
| 712 | /* False alarm */ | 718 | /* False alarm */ |
| @@ -722,7 +728,6 @@ void r852_card_detect_work(struct work_struct *work) | |||
| 722 | else | 728 | else |
| 723 | r852_unregister_nand_device(dev); | 729 | r852_unregister_nand_device(dev); |
| 724 | exit: | 730 | exit: |
| 725 | /* Update detection logic */ | ||
| 726 | r852_update_card_detect(dev); | 731 | r852_update_card_detect(dev); |
| 727 | } | 732 | } |
| 728 | 733 | ||
| @@ -796,6 +801,7 @@ static irqreturn_t r852_irq(int irq, void *data) | |||
| 796 | if (dma_status & R852_DMA_IRQ_ERROR) { | 801 | if (dma_status & R852_DMA_IRQ_ERROR) { |
| 797 | dbg("recieved dma error IRQ"); | 802 | dbg("recieved dma error IRQ"); |
| 798 | r852_dma_done(dev, -EIO); | 803 | r852_dma_done(dev, -EIO); |
| 804 | complete(&dev->dma_done); | ||
| 799 | goto out; | 805 | goto out; |
| 800 | } | 806 | } |
| 801 | 807 | ||
| @@ -825,8 +831,10 @@ static irqreturn_t r852_irq(int irq, void *data) | |||
| 825 | r852_dma_enable(dev); | 831 | r852_dma_enable(dev); |
| 826 | 832 | ||
| 827 | /* Operation done */ | 833 | /* Operation done */ |
| 828 | if (dev->dma_stage == 3) | 834 | if (dev->dma_stage == 3) { |
| 829 | r852_dma_done(dev, 0); | 835 | r852_dma_done(dev, 0); |
| 836 | complete(&dev->dma_done); | ||
| 837 | } | ||
| 830 | goto out; | 838 | goto out; |
| 831 | } | 839 | } |
| 832 | 840 | ||
| @@ -940,18 +948,19 @@ int r852_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) | |||
| 940 | 948 | ||
| 941 | r852_dma_test(dev); | 949 | r852_dma_test(dev); |
| 942 | 950 | ||
| 951 | dev->irq = pci_dev->irq; | ||
| 952 | spin_lock_init(&dev->irqlock); | ||
| 953 | |||
| 954 | dev->card_detected = 0; | ||
| 955 | r852_card_update_present(dev); | ||
| 956 | |||
| 943 | /*register irq handler*/ | 957 | /*register irq handler*/ |
| 944 | error = -ENODEV; | 958 | error = -ENODEV; |
| 945 | if (request_irq(pci_dev->irq, &r852_irq, IRQF_SHARED, | 959 | if (request_irq(pci_dev->irq, &r852_irq, IRQF_SHARED, |
| 946 | DRV_NAME, dev)) | 960 | DRV_NAME, dev)) |
| 947 | goto error10; | 961 | goto error10; |
| 948 | 962 | ||
| 949 | dev->irq = pci_dev->irq; | ||
| 950 | spin_lock_init(&dev->irqlock); | ||
| 951 | |||
| 952 | /* kick initial present test */ | 963 | /* kick initial present test */ |
| 953 | dev->card_detected = 0; | ||
| 954 | r852_card_update_present(dev); | ||
| 955 | queue_delayed_work(dev->card_workqueue, | 964 | queue_delayed_work(dev->card_workqueue, |
| 956 | &dev->card_detect_work, 0); | 965 | &dev->card_detect_work, 0); |
| 957 | 966 | ||
| @@ -1081,7 +1090,7 @@ int r852_resume(struct device *device) | |||
| 1081 | dev->card_detected ? "added" : "removed"); | 1090 | dev->card_detected ? "added" : "removed"); |
| 1082 | 1091 | ||
| 1083 | queue_delayed_work(dev->card_workqueue, | 1092 | queue_delayed_work(dev->card_workqueue, |
| 1084 | &dev->card_detect_work, 1000); | 1093 | &dev->card_detect_work, msecs_to_jiffies(1000)); |
| 1085 | return 0; | 1094 | return 0; |
| 1086 | } | 1095 | } |
| 1087 | 1096 | ||
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 9c149750e2bf..284a5f4a63ac 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
| @@ -598,8 +598,8 @@ rx_next: | |||
| 598 | goto rx_status_loop; | 598 | goto rx_status_loop; |
| 599 | 599 | ||
| 600 | spin_lock_irqsave(&cp->lock, flags); | 600 | spin_lock_irqsave(&cp->lock, flags); |
| 601 | cpw16_f(IntrMask, cp_intr_mask); | ||
| 602 | __napi_complete(napi); | 601 | __napi_complete(napi); |
| 602 | cpw16_f(IntrMask, cp_intr_mask); | ||
| 603 | spin_unlock_irqrestore(&cp->lock, flags); | 603 | spin_unlock_irqrestore(&cp->lock, flags); |
| 604 | } | 604 | } |
| 605 | 605 | ||
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 4ba72933f0da..97d8068b372b 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
| @@ -860,6 +860,7 @@ retry: | |||
| 860 | } | 860 | } |
| 861 | 861 | ||
| 862 | /* if unknown chip, assume array element #0, original RTL-8139 in this case */ | 862 | /* if unknown chip, assume array element #0, original RTL-8139 in this case */ |
| 863 | i = 0; | ||
| 863 | dev_dbg(&pdev->dev, "unknown chip version, assuming RTL-8139\n"); | 864 | dev_dbg(&pdev->dev, "unknown chip version, assuming RTL-8139\n"); |
| 864 | dev_dbg(&pdev->dev, "TxConfig = 0x%lx\n", RTL_R32 (TxConfig)); | 865 | dev_dbg(&pdev->dev, "TxConfig = 0x%lx\n", RTL_R32 (TxConfig)); |
| 865 | tp->chipset = 0; | 866 | tp->chipset = 0; |
| @@ -2088,8 +2089,8 @@ static int rtl8139_poll(struct napi_struct *napi, int budget) | |||
| 2088 | * again when we think we are done. | 2089 | * again when we think we are done. |
| 2089 | */ | 2090 | */ |
| 2090 | spin_lock_irqsave(&tp->lock, flags); | 2091 | spin_lock_irqsave(&tp->lock, flags); |
| 2091 | RTL_W16_F(IntrMask, rtl8139_intr_mask); | ||
| 2092 | __napi_complete(napi); | 2092 | __napi_complete(napi); |
| 2093 | RTL_W16_F(IntrMask, rtl8139_intr_mask); | ||
| 2093 | spin_unlock_irqrestore(&tp->lock, flags); | 2094 | spin_unlock_irqrestore(&tp->lock, flags); |
| 2094 | } | 2095 | } |
| 2095 | spin_unlock(&tp->rx_lock); | 2096 | spin_unlock(&tp->rx_lock); |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 188e356c30a3..949d7a9dcf92 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
| @@ -247,6 +247,7 @@ static const struct flash_spec flash_5709 = { | |||
| 247 | MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl); | 247 | MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl); |
| 248 | 248 | ||
| 249 | static void bnx2_init_napi(struct bnx2 *bp); | 249 | static void bnx2_init_napi(struct bnx2 *bp); |
| 250 | static void bnx2_del_napi(struct bnx2 *bp); | ||
| 250 | 251 | ||
| 251 | static inline u32 bnx2_tx_avail(struct bnx2 *bp, struct bnx2_tx_ring_info *txr) | 252 | static inline u32 bnx2_tx_avail(struct bnx2 *bp, struct bnx2_tx_ring_info *txr) |
| 252 | { | 253 | { |
| @@ -6270,6 +6271,7 @@ open_err: | |||
| 6270 | bnx2_free_skbs(bp); | 6271 | bnx2_free_skbs(bp); |
| 6271 | bnx2_free_irq(bp); | 6272 | bnx2_free_irq(bp); |
| 6272 | bnx2_free_mem(bp); | 6273 | bnx2_free_mem(bp); |
| 6274 | bnx2_del_napi(bp); | ||
| 6273 | return rc; | 6275 | return rc; |
| 6274 | } | 6276 | } |
| 6275 | 6277 | ||
| @@ -6537,6 +6539,7 @@ bnx2_close(struct net_device *dev) | |||
| 6537 | bnx2_free_irq(bp); | 6539 | bnx2_free_irq(bp); |
| 6538 | bnx2_free_skbs(bp); | 6540 | bnx2_free_skbs(bp); |
| 6539 | bnx2_free_mem(bp); | 6541 | bnx2_free_mem(bp); |
| 6542 | bnx2_del_napi(bp); | ||
| 6540 | bp->link_up = 0; | 6543 | bp->link_up = 0; |
| 6541 | netif_carrier_off(bp->dev); | 6544 | netif_carrier_off(bp->dev); |
| 6542 | bnx2_set_power_state(bp, PCI_D3hot); | 6545 | bnx2_set_power_state(bp, PCI_D3hot); |
| @@ -8227,7 +8230,16 @@ bnx2_bus_string(struct bnx2 *bp, char *str) | |||
| 8227 | return str; | 8230 | return str; |
| 8228 | } | 8231 | } |
| 8229 | 8232 | ||
| 8230 | static void __devinit | 8233 | static void |
| 8234 | bnx2_del_napi(struct bnx2 *bp) | ||
| 8235 | { | ||
| 8236 | int i; | ||
| 8237 | |||
| 8238 | for (i = 0; i < bp->irq_nvecs; i++) | ||
| 8239 | netif_napi_del(&bp->bnx2_napi[i].napi); | ||
| 8240 | } | ||
| 8241 | |||
| 8242 | static void | ||
| 8231 | bnx2_init_napi(struct bnx2 *bp) | 8243 | bnx2_init_napi(struct bnx2 *bp) |
| 8232 | { | 8244 | { |
| 8233 | int i; | 8245 | int i; |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 24507f3b8b17..57a7e41da69e 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
| @@ -2554,7 +2554,7 @@ static void e1000_init_manageability_pt(struct e1000_adapter *adapter) | |||
| 2554 | mdef = er32(MDEF(i)); | 2554 | mdef = er32(MDEF(i)); |
| 2555 | 2555 | ||
| 2556 | /* Ignore filters with anything other than IPMI ports */ | 2556 | /* Ignore filters with anything other than IPMI ports */ |
| 2557 | if (mdef & !(E1000_MDEF_PORT_623 | E1000_MDEF_PORT_664)) | 2557 | if (mdef & ~(E1000_MDEF_PORT_623 | E1000_MDEF_PORT_664)) |
| 2558 | continue; | 2558 | continue; |
| 2559 | 2559 | ||
| 2560 | /* Enable this decision filter in MANC2H */ | 2560 | /* Enable this decision filter in MANC2H */ |
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 85f2a2e7030a..45e86d1e5b1b 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h | |||
| @@ -74,7 +74,14 @@ struct enic_msix_entry { | |||
| 74 | void *devid; | 74 | void *devid; |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | #define ENIC_SET_APPLIED (1 << 0) | ||
| 78 | #define ENIC_SET_REQUEST (1 << 1) | ||
| 79 | #define ENIC_SET_NAME (1 << 2) | ||
| 80 | #define ENIC_SET_INSTANCE (1 << 3) | ||
| 81 | #define ENIC_SET_HOST (1 << 4) | ||
| 82 | |||
| 77 | struct enic_port_profile { | 83 | struct enic_port_profile { |
| 84 | u32 set; | ||
| 78 | u8 request; | 85 | u8 request; |
| 79 | char name[PORT_PROFILE_MAX]; | 86 | char name[PORT_PROFILE_MAX]; |
| 80 | u8 instance_uuid[PORT_UUID_MAX]; | 87 | u8 instance_uuid[PORT_UUID_MAX]; |
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 6586b5c7e4b6..bc7d6b96de3d 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c | |||
| @@ -1029,8 +1029,7 @@ static int enic_dev_init_done(struct enic *enic, int *done, int *error) | |||
| 1029 | return err; | 1029 | return err; |
| 1030 | } | 1030 | } |
| 1031 | 1031 | ||
| 1032 | static int enic_set_port_profile(struct enic *enic, u8 request, u8 *mac, | 1032 | static int enic_set_port_profile(struct enic *enic, u8 *mac) |
| 1033 | char *name, u8 *instance_uuid, u8 *host_uuid) | ||
| 1034 | { | 1033 | { |
| 1035 | struct vic_provinfo *vp; | 1034 | struct vic_provinfo *vp; |
| 1036 | u8 oui[3] = VIC_PROVINFO_CISCO_OUI; | 1035 | u8 oui[3] = VIC_PROVINFO_CISCO_OUI; |
| @@ -1040,97 +1039,112 @@ static int enic_set_port_profile(struct enic *enic, u8 request, u8 *mac, | |||
| 1040 | "%02X%02X-%02X%02X%02X%02X%0X%02X"; | 1039 | "%02X%02X-%02X%02X%02X%02X%0X%02X"; |
| 1041 | int err; | 1040 | int err; |
| 1042 | 1041 | ||
| 1043 | if (!name) | 1042 | err = enic_vnic_dev_deinit(enic); |
| 1044 | return -EINVAL; | 1043 | if (err) |
| 1044 | return err; | ||
| 1045 | 1045 | ||
| 1046 | if (!is_valid_ether_addr(mac)) | 1046 | switch (enic->pp.request) { |
| 1047 | return -EADDRNOTAVAIL; | ||
| 1048 | 1047 | ||
| 1049 | vp = vic_provinfo_alloc(GFP_KERNEL, oui, VIC_PROVINFO_LINUX_TYPE); | 1048 | case PORT_REQUEST_ASSOCIATE: |
| 1050 | if (!vp) | ||
| 1051 | return -ENOMEM; | ||
| 1052 | 1049 | ||
| 1053 | vic_provinfo_add_tlv(vp, | 1050 | if (!(enic->pp.set & ENIC_SET_NAME) || !strlen(enic->pp.name)) |
| 1054 | VIC_LINUX_PROV_TLV_PORT_PROFILE_NAME_STR, | 1051 | return -EINVAL; |
| 1055 | strlen(name) + 1, name); | ||
| 1056 | |||
| 1057 | vic_provinfo_add_tlv(vp, | ||
| 1058 | VIC_LINUX_PROV_TLV_CLIENT_MAC_ADDR, | ||
| 1059 | ETH_ALEN, mac); | ||
| 1060 | |||
| 1061 | if (instance_uuid) { | ||
| 1062 | uuid = instance_uuid; | ||
| 1063 | sprintf(uuid_str, uuid_fmt, | ||
| 1064 | uuid[0], uuid[1], uuid[2], uuid[3], | ||
| 1065 | uuid[4], uuid[5], uuid[6], uuid[7], | ||
| 1066 | uuid[8], uuid[9], uuid[10], uuid[11], | ||
| 1067 | uuid[12], uuid[13], uuid[14], uuid[15]); | ||
| 1068 | vic_provinfo_add_tlv(vp, | ||
| 1069 | VIC_LINUX_PROV_TLV_CLIENT_UUID_STR, | ||
| 1070 | sizeof(uuid_str), uuid_str); | ||
| 1071 | } | ||
| 1072 | 1052 | ||
| 1073 | if (host_uuid) { | 1053 | if (!is_valid_ether_addr(mac)) |
| 1074 | uuid = host_uuid; | 1054 | return -EADDRNOTAVAIL; |
| 1075 | sprintf(uuid_str, uuid_fmt, | ||
| 1076 | uuid[0], uuid[1], uuid[2], uuid[3], | ||
| 1077 | uuid[4], uuid[5], uuid[6], uuid[7], | ||
| 1078 | uuid[8], uuid[9], uuid[10], uuid[11], | ||
| 1079 | uuid[12], uuid[13], uuid[14], uuid[15]); | ||
| 1080 | vic_provinfo_add_tlv(vp, | ||
| 1081 | VIC_LINUX_PROV_TLV_HOST_UUID_STR, | ||
| 1082 | sizeof(uuid_str), uuid_str); | ||
| 1083 | } | ||
| 1084 | 1055 | ||
| 1085 | err = enic_vnic_dev_deinit(enic); | 1056 | vp = vic_provinfo_alloc(GFP_KERNEL, oui, |
| 1086 | if (err) | 1057 | VIC_PROVINFO_LINUX_TYPE); |
| 1087 | goto err_out; | 1058 | if (!vp) |
| 1059 | return -ENOMEM; | ||
| 1088 | 1060 | ||
| 1089 | memset(&enic->pp, 0, sizeof(enic->pp)); | 1061 | vic_provinfo_add_tlv(vp, |
| 1062 | VIC_LINUX_PROV_TLV_PORT_PROFILE_NAME_STR, | ||
| 1063 | strlen(enic->pp.name) + 1, enic->pp.name); | ||
| 1090 | 1064 | ||
| 1091 | err = enic_dev_init_prov(enic, vp); | 1065 | vic_provinfo_add_tlv(vp, |
| 1092 | if (err) | 1066 | VIC_LINUX_PROV_TLV_CLIENT_MAC_ADDR, |
| 1093 | goto err_out; | 1067 | ETH_ALEN, mac); |
| 1068 | |||
| 1069 | if (enic->pp.set & ENIC_SET_INSTANCE) { | ||
| 1070 | uuid = enic->pp.instance_uuid; | ||
| 1071 | sprintf(uuid_str, uuid_fmt, | ||
| 1072 | uuid[0], uuid[1], uuid[2], uuid[3], | ||
| 1073 | uuid[4], uuid[5], uuid[6], uuid[7], | ||
| 1074 | uuid[8], uuid[9], uuid[10], uuid[11], | ||
| 1075 | uuid[12], uuid[13], uuid[14], uuid[15]); | ||
| 1076 | vic_provinfo_add_tlv(vp, | ||
| 1077 | VIC_LINUX_PROV_TLV_CLIENT_UUID_STR, | ||
| 1078 | sizeof(uuid_str), uuid_str); | ||
| 1079 | } | ||
| 1094 | 1080 | ||
| 1095 | enic->pp.request = request; | 1081 | if (enic->pp.set & ENIC_SET_HOST) { |
| 1096 | memcpy(enic->pp.name, name, PORT_PROFILE_MAX); | 1082 | uuid = enic->pp.host_uuid; |
| 1097 | if (instance_uuid) | 1083 | sprintf(uuid_str, uuid_fmt, |
| 1098 | memcpy(enic->pp.instance_uuid, | 1084 | uuid[0], uuid[1], uuid[2], uuid[3], |
| 1099 | instance_uuid, PORT_UUID_MAX); | 1085 | uuid[4], uuid[5], uuid[6], uuid[7], |
| 1100 | if (host_uuid) | 1086 | uuid[8], uuid[9], uuid[10], uuid[11], |
| 1101 | memcpy(enic->pp.host_uuid, | 1087 | uuid[12], uuid[13], uuid[14], uuid[15]); |
| 1102 | host_uuid, PORT_UUID_MAX); | 1088 | vic_provinfo_add_tlv(vp, |
| 1089 | VIC_LINUX_PROV_TLV_HOST_UUID_STR, | ||
| 1090 | sizeof(uuid_str), uuid_str); | ||
| 1091 | } | ||
| 1103 | 1092 | ||
| 1104 | err_out: | 1093 | err = enic_dev_init_prov(enic, vp); |
| 1105 | vic_provinfo_free(vp); | 1094 | vic_provinfo_free(vp); |
| 1095 | if (err) | ||
| 1096 | return err; | ||
| 1097 | break; | ||
| 1106 | 1098 | ||
| 1107 | return err; | 1099 | case PORT_REQUEST_DISASSOCIATE: |
| 1108 | } | 1100 | break; |
| 1109 | 1101 | ||
| 1110 | static int enic_unset_port_profile(struct enic *enic) | 1102 | default: |
| 1111 | { | 1103 | return -EINVAL; |
| 1112 | memset(&enic->pp, 0, sizeof(enic->pp)); | 1104 | } |
| 1113 | return enic_vnic_dev_deinit(enic); | 1105 | |
| 1106 | enic->pp.set |= ENIC_SET_APPLIED; | ||
| 1107 | return 0; | ||
| 1114 | } | 1108 | } |
| 1115 | 1109 | ||
| 1116 | static int enic_set_vf_port(struct net_device *netdev, int vf, | 1110 | static int enic_set_vf_port(struct net_device *netdev, int vf, |
| 1117 | struct nlattr *port[]) | 1111 | struct nlattr *port[]) |
| 1118 | { | 1112 | { |
| 1119 | struct enic *enic = netdev_priv(netdev); | 1113 | struct enic *enic = netdev_priv(netdev); |
| 1120 | char *name = NULL; | 1114 | |
| 1121 | u8 *instance_uuid = NULL; | 1115 | memset(&enic->pp, 0, sizeof(enic->pp)); |
| 1122 | u8 *host_uuid = NULL; | 1116 | |
| 1123 | u8 request = PORT_REQUEST_DISASSOCIATE; | 1117 | if (port[IFLA_PORT_REQUEST]) { |
| 1118 | enic->pp.set |= ENIC_SET_REQUEST; | ||
| 1119 | enic->pp.request = nla_get_u8(port[IFLA_PORT_REQUEST]); | ||
| 1120 | } | ||
| 1121 | |||
| 1122 | if (port[IFLA_PORT_PROFILE]) { | ||
| 1123 | enic->pp.set |= ENIC_SET_NAME; | ||
| 1124 | memcpy(enic->pp.name, nla_data(port[IFLA_PORT_PROFILE]), | ||
| 1125 | PORT_PROFILE_MAX); | ||
| 1126 | } | ||
| 1127 | |||
| 1128 | if (port[IFLA_PORT_INSTANCE_UUID]) { | ||
| 1129 | enic->pp.set |= ENIC_SET_INSTANCE; | ||
| 1130 | memcpy(enic->pp.instance_uuid, | ||
| 1131 | nla_data(port[IFLA_PORT_INSTANCE_UUID]), PORT_UUID_MAX); | ||
| 1132 | } | ||
| 1133 | |||
| 1134 | if (port[IFLA_PORT_HOST_UUID]) { | ||
| 1135 | enic->pp.set |= ENIC_SET_HOST; | ||
| 1136 | memcpy(enic->pp.host_uuid, | ||
| 1137 | nla_data(port[IFLA_PORT_HOST_UUID]), PORT_UUID_MAX); | ||
| 1138 | } | ||
| 1124 | 1139 | ||
| 1125 | /* don't support VFs, yet */ | 1140 | /* don't support VFs, yet */ |
| 1126 | if (vf != PORT_SELF_VF) | 1141 | if (vf != PORT_SELF_VF) |
| 1127 | return -EOPNOTSUPP; | 1142 | return -EOPNOTSUPP; |
| 1128 | 1143 | ||
| 1129 | if (port[IFLA_PORT_REQUEST]) | 1144 | if (!(enic->pp.set & ENIC_SET_REQUEST)) |
| 1130 | request = nla_get_u8(port[IFLA_PORT_REQUEST]); | 1145 | return -EOPNOTSUPP; |
| 1131 | 1146 | ||
| 1132 | switch (request) { | 1147 | if (enic->pp.request == PORT_REQUEST_ASSOCIATE) { |
| 1133 | case PORT_REQUEST_ASSOCIATE: | ||
| 1134 | 1148 | ||
| 1135 | /* If the interface mac addr hasn't been assigned, | 1149 | /* If the interface mac addr hasn't been assigned, |
| 1136 | * assign a random mac addr before setting port- | 1150 | * assign a random mac addr before setting port- |
| @@ -1139,30 +1153,9 @@ static int enic_set_vf_port(struct net_device *netdev, int vf, | |||
| 1139 | 1153 | ||
| 1140 | if (is_zero_ether_addr(netdev->dev_addr)) | 1154 | if (is_zero_ether_addr(netdev->dev_addr)) |
| 1141 | random_ether_addr(netdev->dev_addr); | 1155 | random_ether_addr(netdev->dev_addr); |
| 1142 | |||
| 1143 | if (port[IFLA_PORT_PROFILE]) | ||
| 1144 | name = nla_data(port[IFLA_PORT_PROFILE]); | ||
| 1145 | |||
| 1146 | if (port[IFLA_PORT_INSTANCE_UUID]) | ||
| 1147 | instance_uuid = | ||
| 1148 | nla_data(port[IFLA_PORT_INSTANCE_UUID]); | ||
| 1149 | |||
| 1150 | if (port[IFLA_PORT_HOST_UUID]) | ||
| 1151 | host_uuid = nla_data(port[IFLA_PORT_HOST_UUID]); | ||
| 1152 | |||
| 1153 | return enic_set_port_profile(enic, request, | ||
| 1154 | netdev->dev_addr, name, | ||
| 1155 | instance_uuid, host_uuid); | ||
| 1156 | |||
| 1157 | case PORT_REQUEST_DISASSOCIATE: | ||
| 1158 | |||
| 1159 | return enic_unset_port_profile(enic); | ||
| 1160 | |||
| 1161 | default: | ||
| 1162 | break; | ||
| 1163 | } | 1156 | } |
| 1164 | 1157 | ||
| 1165 | return -EOPNOTSUPP; | 1158 | return enic_set_port_profile(enic, netdev->dev_addr); |
| 1166 | } | 1159 | } |
| 1167 | 1160 | ||
| 1168 | static int enic_get_vf_port(struct net_device *netdev, int vf, | 1161 | static int enic_get_vf_port(struct net_device *netdev, int vf, |
| @@ -1172,14 +1165,12 @@ static int enic_get_vf_port(struct net_device *netdev, int vf, | |||
| 1172 | int err, error, done; | 1165 | int err, error, done; |
| 1173 | u16 response = PORT_PROFILE_RESPONSE_SUCCESS; | 1166 | u16 response = PORT_PROFILE_RESPONSE_SUCCESS; |
| 1174 | 1167 | ||
| 1175 | /* don't support VFs, yet */ | 1168 | if (!(enic->pp.set & ENIC_SET_APPLIED)) |
| 1176 | if (vf != PORT_SELF_VF) | 1169 | return -ENODATA; |
| 1177 | return -EOPNOTSUPP; | ||
| 1178 | 1170 | ||
| 1179 | err = enic_dev_init_done(enic, &done, &error); | 1171 | err = enic_dev_init_done(enic, &done, &error); |
| 1180 | |||
| 1181 | if (err) | 1172 | if (err) |
| 1182 | return err; | 1173 | error = err; |
| 1183 | 1174 | ||
| 1184 | switch (error) { | 1175 | switch (error) { |
| 1185 | case ERR_SUCCESS: | 1176 | case ERR_SUCCESS: |
| @@ -1202,12 +1193,15 @@ static int enic_get_vf_port(struct net_device *netdev, int vf, | |||
| 1202 | 1193 | ||
| 1203 | NLA_PUT_U16(skb, IFLA_PORT_REQUEST, enic->pp.request); | 1194 | NLA_PUT_U16(skb, IFLA_PORT_REQUEST, enic->pp.request); |
| 1204 | NLA_PUT_U16(skb, IFLA_PORT_RESPONSE, response); | 1195 | NLA_PUT_U16(skb, IFLA_PORT_RESPONSE, response); |
| 1205 | NLA_PUT(skb, IFLA_PORT_PROFILE, PORT_PROFILE_MAX, | 1196 | if (enic->pp.set & ENIC_SET_NAME) |
| 1206 | enic->pp.name); | 1197 | NLA_PUT(skb, IFLA_PORT_PROFILE, PORT_PROFILE_MAX, |
| 1207 | NLA_PUT(skb, IFLA_PORT_INSTANCE_UUID, PORT_UUID_MAX, | 1198 | enic->pp.name); |
| 1208 | enic->pp.instance_uuid); | 1199 | if (enic->pp.set & ENIC_SET_INSTANCE) |
| 1209 | NLA_PUT(skb, IFLA_PORT_HOST_UUID, PORT_UUID_MAX, | 1200 | NLA_PUT(skb, IFLA_PORT_INSTANCE_UUID, PORT_UUID_MAX, |
| 1210 | enic->pp.host_uuid); | 1201 | enic->pp.instance_uuid); |
| 1202 | if (enic->pp.set & ENIC_SET_HOST) | ||
| 1203 | NLA_PUT(skb, IFLA_PORT_HOST_UUID, PORT_UUID_MAX, | ||
| 1204 | enic->pp.host_uuid); | ||
| 1211 | 1205 | ||
| 1212 | return 0; | 1206 | return 0; |
| 1213 | 1207 | ||
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index 6838dfc9ef23..4c274657283c 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
| @@ -87,6 +87,7 @@ static int rx_copybreak; | |||
| 87 | #include <linux/bitops.h> | 87 | #include <linux/bitops.h> |
| 88 | #include <asm/io.h> | 88 | #include <asm/io.h> |
| 89 | #include <asm/uaccess.h> | 89 | #include <asm/uaccess.h> |
| 90 | #include <asm/byteorder.h> | ||
| 90 | 91 | ||
| 91 | /* These identify the driver base version and may not be removed. */ | 92 | /* These identify the driver base version and may not be removed. */ |
| 92 | static char version[] __devinitdata = | 93 | static char version[] __devinitdata = |
| @@ -230,7 +231,7 @@ static const u16 media2miictl[16] = { | |||
| 230 | * The EPIC100 Rx and Tx buffer descriptors. Note that these | 231 | * The EPIC100 Rx and Tx buffer descriptors. Note that these |
| 231 | * really ARE host-endian; it's not a misannotation. We tell | 232 | * really ARE host-endian; it's not a misannotation. We tell |
| 232 | * the card to byteswap them internally on big-endian hosts - | 233 | * the card to byteswap them internally on big-endian hosts - |
| 233 | * look for #ifdef CONFIG_BIG_ENDIAN in epic_open(). | 234 | * look for #ifdef __BIG_ENDIAN in epic_open(). |
| 234 | */ | 235 | */ |
| 235 | 236 | ||
| 236 | struct epic_tx_desc { | 237 | struct epic_tx_desc { |
| @@ -690,7 +691,7 @@ static int epic_open(struct net_device *dev) | |||
| 690 | outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); | 691 | outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); |
| 691 | 692 | ||
| 692 | /* Tell the chip to byteswap descriptors on big-endian hosts */ | 693 | /* Tell the chip to byteswap descriptors on big-endian hosts */ |
| 693 | #ifdef CONFIG_BIG_ENDIAN | 694 | #ifdef __BIG_ENDIAN |
| 694 | outl(0x4432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 695 | outl(0x4432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
| 695 | inl(ioaddr + GENCTL); | 696 | inl(ioaddr + GENCTL); |
| 696 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 697 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
| @@ -806,7 +807,7 @@ static void epic_restart(struct net_device *dev) | |||
| 806 | for (i = 16; i > 0; i--) | 807 | for (i = 16; i > 0; i--) |
| 807 | outl(0x0008, ioaddr + TEST1); | 808 | outl(0x0008, ioaddr + TEST1); |
| 808 | 809 | ||
| 809 | #ifdef CONFIG_BIG_ENDIAN | 810 | #ifdef __BIG_ENDIAN |
| 810 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 811 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
| 811 | #else | 812 | #else |
| 812 | outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 813 | outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index ddf7a86cd466..edfff92a6d8e 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
| @@ -1373,10 +1373,9 @@ fec_suspend(struct platform_device *dev, pm_message_t state) | |||
| 1373 | 1373 | ||
| 1374 | if (ndev) { | 1374 | if (ndev) { |
| 1375 | fep = netdev_priv(ndev); | 1375 | fep = netdev_priv(ndev); |
| 1376 | if (netif_running(ndev)) { | 1376 | if (netif_running(ndev)) |
| 1377 | netif_device_detach(ndev); | 1377 | fec_enet_close(ndev); |
| 1378 | fec_stop(ndev); | 1378 | clk_disable(fep->clk); |
| 1379 | } | ||
| 1380 | } | 1379 | } |
| 1381 | return 0; | 1380 | return 0; |
| 1382 | } | 1381 | } |
| @@ -1385,12 +1384,13 @@ static int | |||
| 1385 | fec_resume(struct platform_device *dev) | 1384 | fec_resume(struct platform_device *dev) |
| 1386 | { | 1385 | { |
| 1387 | struct net_device *ndev = platform_get_drvdata(dev); | 1386 | struct net_device *ndev = platform_get_drvdata(dev); |
| 1387 | struct fec_enet_private *fep; | ||
| 1388 | 1388 | ||
| 1389 | if (ndev) { | 1389 | if (ndev) { |
| 1390 | if (netif_running(ndev)) { | 1390 | fep = netdev_priv(ndev); |
| 1391 | fec_enet_init(ndev, 0); | 1391 | clk_enable(fep->clk); |
| 1392 | netif_device_attach(ndev); | 1392 | if (netif_running(ndev)) |
| 1393 | } | 1393 | fec_enet_open(ndev); |
| 1394 | } | 1394 | } |
| 1395 | return 0; | 1395 | return 0; |
| 1396 | } | 1396 | } |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 1830f3199cb5..46c69cd06553 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
| @@ -747,8 +747,7 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev) | |||
| 747 | FSL_GIANFAR_DEV_HAS_CSUM | | 747 | FSL_GIANFAR_DEV_HAS_CSUM | |
| 748 | FSL_GIANFAR_DEV_HAS_VLAN | | 748 | FSL_GIANFAR_DEV_HAS_VLAN | |
| 749 | FSL_GIANFAR_DEV_HAS_MAGIC_PACKET | | 749 | FSL_GIANFAR_DEV_HAS_MAGIC_PACKET | |
| 750 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH | | 750 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; |
| 751 | FSL_GIANFAR_DEV_HAS_TIMER; | ||
| 752 | 751 | ||
| 753 | ctype = of_get_property(np, "phy-connection-type", NULL); | 752 | ctype = of_get_property(np, "phy-connection-type", NULL); |
| 754 | 753 | ||
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index 1159d9138f05..9595b1bfb8dd 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c | |||
| @@ -1188,6 +1188,7 @@ s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq, | |||
| 1188 | IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high); | 1188 | IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high); |
| 1189 | } else { | 1189 | } else { |
| 1190 | hw_dbg(hw, "RAR index %d is out of range.\n", index); | 1190 | hw_dbg(hw, "RAR index %d is out of range.\n", index); |
| 1191 | return IXGBE_ERR_RAR_INDEX; | ||
| 1191 | } | 1192 | } |
| 1192 | 1193 | ||
| 1193 | return 0; | 1194 | return 0; |
| @@ -1219,6 +1220,7 @@ s32 ixgbe_clear_rar_generic(struct ixgbe_hw *hw, u32 index) | |||
| 1219 | IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high); | 1220 | IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high); |
| 1220 | } else { | 1221 | } else { |
| 1221 | hw_dbg(hw, "RAR index %d is out of range.\n", index); | 1222 | hw_dbg(hw, "RAR index %d is out of range.\n", index); |
| 1223 | return IXGBE_ERR_RAR_INDEX; | ||
| 1222 | } | 1224 | } |
| 1223 | 1225 | ||
| 1224 | /* clear VMDq pool/queue selection for this RAR */ | 1226 | /* clear VMDq pool/queue selection for this RAR */ |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index d571d101de08..b2af2f67f604 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
| @@ -642,7 +642,7 @@ static inline bool ixgbe_tx_xon_state(struct ixgbe_adapter *adapter, | |||
| 642 | u32 txoff = IXGBE_TFCS_TXOFF; | 642 | u32 txoff = IXGBE_TFCS_TXOFF; |
| 643 | 643 | ||
| 644 | #ifdef CONFIG_IXGBE_DCB | 644 | #ifdef CONFIG_IXGBE_DCB |
| 645 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | 645 | if (adapter->dcb_cfg.pfc_mode_enable) { |
| 646 | int tc; | 646 | int tc; |
| 647 | int reg_idx = tx_ring->reg_idx; | 647 | int reg_idx = tx_ring->reg_idx; |
| 648 | int dcb_i = adapter->ring_feature[RING_F_DCB].indices; | 648 | int dcb_i = adapter->ring_feature[RING_F_DCB].indices; |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index 2eb6e151016c..cdd1998f18c7 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
| @@ -2609,6 +2609,7 @@ struct ixgbe_info { | |||
| 2609 | #define IXGBE_ERR_EEPROM_VERSION -24 | 2609 | #define IXGBE_ERR_EEPROM_VERSION -24 |
| 2610 | #define IXGBE_ERR_NO_SPACE -25 | 2610 | #define IXGBE_ERR_NO_SPACE -25 |
| 2611 | #define IXGBE_ERR_OVERTEMP -26 | 2611 | #define IXGBE_ERR_OVERTEMP -26 |
| 2612 | #define IXGBE_ERR_RAR_INDEX -27 | ||
| 2612 | #define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF | 2613 | #define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF |
| 2613 | 2614 | ||
| 2614 | #endif /* _IXGBE_TYPE_H_ */ | 2615 | #endif /* _IXGBE_TYPE_H_ */ |
diff --git a/drivers/net/korina.c b/drivers/net/korina.c index 26bf1b76b997..c7a9bef4dfb0 100644 --- a/drivers/net/korina.c +++ b/drivers/net/korina.c | |||
| @@ -135,6 +135,7 @@ struct korina_private { | |||
| 135 | struct napi_struct napi; | 135 | struct napi_struct napi; |
| 136 | struct timer_list media_check_timer; | 136 | struct timer_list media_check_timer; |
| 137 | struct mii_if_info mii_if; | 137 | struct mii_if_info mii_if; |
| 138 | struct work_struct restart_task; | ||
| 138 | struct net_device *dev; | 139 | struct net_device *dev; |
| 139 | int phy_addr; | 140 | int phy_addr; |
| 140 | }; | 141 | }; |
| @@ -375,7 +376,7 @@ static int korina_rx(struct net_device *dev, int limit) | |||
| 375 | if (devcs & ETH_RX_LE) | 376 | if (devcs & ETH_RX_LE) |
| 376 | dev->stats.rx_length_errors++; | 377 | dev->stats.rx_length_errors++; |
| 377 | if (devcs & ETH_RX_OVR) | 378 | if (devcs & ETH_RX_OVR) |
| 378 | dev->stats.rx_over_errors++; | 379 | dev->stats.rx_fifo_errors++; |
| 379 | if (devcs & ETH_RX_CV) | 380 | if (devcs & ETH_RX_CV) |
| 380 | dev->stats.rx_frame_errors++; | 381 | dev->stats.rx_frame_errors++; |
| 381 | if (devcs & ETH_RX_CES) | 382 | if (devcs & ETH_RX_CES) |
| @@ -764,10 +765,9 @@ static int korina_alloc_ring(struct net_device *dev) | |||
| 764 | 765 | ||
| 765 | /* Initialize the receive descriptors */ | 766 | /* Initialize the receive descriptors */ |
| 766 | for (i = 0; i < KORINA_NUM_RDS; i++) { | 767 | for (i = 0; i < KORINA_NUM_RDS; i++) { |
| 767 | skb = dev_alloc_skb(KORINA_RBSIZE + 2); | 768 | skb = netdev_alloc_skb_ip_align(dev, KORINA_RBSIZE); |
| 768 | if (!skb) | 769 | if (!skb) |
| 769 | return -ENOMEM; | 770 | return -ENOMEM; |
| 770 | skb_reserve(skb, 2); | ||
| 771 | lp->rx_skb[i] = skb; | 771 | lp->rx_skb[i] = skb; |
| 772 | lp->rd_ring[i].control = DMA_DESC_IOD | | 772 | lp->rd_ring[i].control = DMA_DESC_IOD | |
| 773 | DMA_COUNT(KORINA_RBSIZE); | 773 | DMA_COUNT(KORINA_RBSIZE); |
| @@ -890,12 +890,12 @@ static int korina_init(struct net_device *dev) | |||
| 890 | 890 | ||
| 891 | /* | 891 | /* |
| 892 | * Restart the RC32434 ethernet controller. | 892 | * Restart the RC32434 ethernet controller. |
| 893 | * FIXME: check the return status where we call it | ||
| 894 | */ | 893 | */ |
| 895 | static int korina_restart(struct net_device *dev) | 894 | static void korina_restart_task(struct work_struct *work) |
| 896 | { | 895 | { |
| 897 | struct korina_private *lp = netdev_priv(dev); | 896 | struct korina_private *lp = container_of(work, |
| 898 | int ret; | 897 | struct korina_private, restart_task); |
| 898 | struct net_device *dev = lp->dev; | ||
| 899 | 899 | ||
| 900 | /* | 900 | /* |
| 901 | * Disable interrupts | 901 | * Disable interrupts |
| @@ -916,10 +916,9 @@ static int korina_restart(struct net_device *dev) | |||
| 916 | 916 | ||
| 917 | napi_disable(&lp->napi); | 917 | napi_disable(&lp->napi); |
| 918 | 918 | ||
| 919 | ret = korina_init(dev); | 919 | if (korina_init(dev) < 0) { |
| 920 | if (ret < 0) { | ||
| 921 | printk(KERN_ERR "%s: cannot restart device\n", dev->name); | 920 | printk(KERN_ERR "%s: cannot restart device\n", dev->name); |
| 922 | return ret; | 921 | return; |
| 923 | } | 922 | } |
| 924 | korina_multicast_list(dev); | 923 | korina_multicast_list(dev); |
| 925 | 924 | ||
| @@ -927,8 +926,6 @@ static int korina_restart(struct net_device *dev) | |||
| 927 | enable_irq(lp->ovr_irq); | 926 | enable_irq(lp->ovr_irq); |
| 928 | enable_irq(lp->tx_irq); | 927 | enable_irq(lp->tx_irq); |
| 929 | enable_irq(lp->rx_irq); | 928 | enable_irq(lp->rx_irq); |
| 930 | |||
| 931 | return ret; | ||
| 932 | } | 929 | } |
| 933 | 930 | ||
| 934 | static void korina_clear_and_restart(struct net_device *dev, u32 value) | 931 | static void korina_clear_and_restart(struct net_device *dev, u32 value) |
| @@ -937,7 +934,7 @@ static void korina_clear_and_restart(struct net_device *dev, u32 value) | |||
| 937 | 934 | ||
| 938 | netif_stop_queue(dev); | 935 | netif_stop_queue(dev); |
| 939 | writel(value, &lp->eth_regs->ethintfc); | 936 | writel(value, &lp->eth_regs->ethintfc); |
| 940 | korina_restart(dev); | 937 | schedule_work(&lp->restart_task); |
| 941 | } | 938 | } |
| 942 | 939 | ||
| 943 | /* Ethernet Tx Underflow interrupt */ | 940 | /* Ethernet Tx Underflow interrupt */ |
| @@ -962,11 +959,8 @@ static irqreturn_t korina_und_interrupt(int irq, void *dev_id) | |||
| 962 | static void korina_tx_timeout(struct net_device *dev) | 959 | static void korina_tx_timeout(struct net_device *dev) |
| 963 | { | 960 | { |
| 964 | struct korina_private *lp = netdev_priv(dev); | 961 | struct korina_private *lp = netdev_priv(dev); |
| 965 | unsigned long flags; | ||
| 966 | 962 | ||
| 967 | spin_lock_irqsave(&lp->lock, flags); | 963 | schedule_work(&lp->restart_task); |
| 968 | korina_restart(dev); | ||
| 969 | spin_unlock_irqrestore(&lp->lock, flags); | ||
| 970 | } | 964 | } |
| 971 | 965 | ||
| 972 | /* Ethernet Rx Overflow interrupt */ | 966 | /* Ethernet Rx Overflow interrupt */ |
| @@ -1086,6 +1080,8 @@ static int korina_close(struct net_device *dev) | |||
| 1086 | 1080 | ||
| 1087 | napi_disable(&lp->napi); | 1081 | napi_disable(&lp->napi); |
| 1088 | 1082 | ||
| 1083 | cancel_work_sync(&lp->restart_task); | ||
| 1084 | |||
| 1089 | free_irq(lp->rx_irq, dev); | 1085 | free_irq(lp->rx_irq, dev); |
| 1090 | free_irq(lp->tx_irq, dev); | 1086 | free_irq(lp->tx_irq, dev); |
| 1091 | free_irq(lp->ovr_irq, dev); | 1087 | free_irq(lp->ovr_irq, dev); |
| @@ -1198,6 +1194,8 @@ static int korina_probe(struct platform_device *pdev) | |||
| 1198 | } | 1194 | } |
| 1199 | setup_timer(&lp->media_check_timer, korina_poll_media, (unsigned long) dev); | 1195 | setup_timer(&lp->media_check_timer, korina_poll_media, (unsigned long) dev); |
| 1200 | 1196 | ||
| 1197 | INIT_WORK(&lp->restart_task, korina_restart_task); | ||
| 1198 | |||
| 1201 | printk(KERN_INFO "%s: " DRV_NAME "-" DRV_VERSION " " DRV_RELDATE "\n", | 1199 | printk(KERN_INFO "%s: " DRV_NAME "-" DRV_VERSION " " DRV_RELDATE "\n", |
| 1202 | dev->name); | 1200 | dev->name); |
| 1203 | out: | 1201 | out: |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 7b6fe89f9db0..64e6a84bbbbe 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
| @@ -322,6 +322,7 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
| 322 | return -ENOMEM; | 322 | return -ENOMEM; |
| 323 | smc = netdev_priv(dev); | 323 | smc = netdev_priv(dev); |
| 324 | smc->p_dev = link; | 324 | smc->p_dev = link; |
| 325 | link->priv = dev; | ||
| 325 | 326 | ||
| 326 | spin_lock_init(&smc->lock); | 327 | spin_lock_init(&smc->lock); |
| 327 | link->io.NumPorts1 = 16; | 328 | link->io.NumPorts1 = 16; |
diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c index 8ee929b796d8..dbd003453737 100644 --- a/drivers/net/phy/lxt.c +++ b/drivers/net/phy/lxt.c | |||
| @@ -53,6 +53,9 @@ | |||
| 53 | 53 | ||
| 54 | #define MII_LXT971_ISR 19 /* Interrupt Status Register */ | 54 | #define MII_LXT971_ISR 19 /* Interrupt Status Register */ |
| 55 | 55 | ||
| 56 | /* register definitions for the 973 */ | ||
| 57 | #define MII_LXT973_PCR 16 /* Port Configuration Register */ | ||
| 58 | #define PCR_FIBER_SELECT 1 | ||
| 56 | 59 | ||
| 57 | MODULE_DESCRIPTION("Intel LXT PHY driver"); | 60 | MODULE_DESCRIPTION("Intel LXT PHY driver"); |
| 58 | MODULE_AUTHOR("Andy Fleming"); | 61 | MODULE_AUTHOR("Andy Fleming"); |
| @@ -119,6 +122,33 @@ static int lxt971_config_intr(struct phy_device *phydev) | |||
| 119 | return err; | 122 | return err; |
| 120 | } | 123 | } |
| 121 | 124 | ||
| 125 | static int lxt973_probe(struct phy_device *phydev) | ||
| 126 | { | ||
| 127 | int val = phy_read(phydev, MII_LXT973_PCR); | ||
| 128 | |||
| 129 | if (val & PCR_FIBER_SELECT) { | ||
| 130 | /* | ||
| 131 | * If fiber is selected, then the only correct setting | ||
| 132 | * is 100Mbps, full duplex, and auto negotiation off. | ||
| 133 | */ | ||
| 134 | val = phy_read(phydev, MII_BMCR); | ||
| 135 | val |= (BMCR_SPEED100 | BMCR_FULLDPLX); | ||
| 136 | val &= ~BMCR_ANENABLE; | ||
| 137 | phy_write(phydev, MII_BMCR, val); | ||
| 138 | /* Remember that the port is in fiber mode. */ | ||
| 139 | phydev->priv = lxt973_probe; | ||
| 140 | } else { | ||
| 141 | phydev->priv = NULL; | ||
| 142 | } | ||
| 143 | return 0; | ||
| 144 | } | ||
| 145 | |||
| 146 | static int lxt973_config_aneg(struct phy_device *phydev) | ||
| 147 | { | ||
| 148 | /* Do nothing if port is in fiber mode. */ | ||
| 149 | return phydev->priv ? 0 : genphy_config_aneg(phydev); | ||
| 150 | } | ||
| 151 | |||
| 122 | static struct phy_driver lxt970_driver = { | 152 | static struct phy_driver lxt970_driver = { |
| 123 | .phy_id = 0x78100000, | 153 | .phy_id = 0x78100000, |
| 124 | .name = "LXT970", | 154 | .name = "LXT970", |
| @@ -146,6 +176,18 @@ static struct phy_driver lxt971_driver = { | |||
| 146 | .driver = { .owner = THIS_MODULE,}, | 176 | .driver = { .owner = THIS_MODULE,}, |
| 147 | }; | 177 | }; |
| 148 | 178 | ||
| 179 | static struct phy_driver lxt973_driver = { | ||
| 180 | .phy_id = 0x00137a10, | ||
| 181 | .name = "LXT973", | ||
| 182 | .phy_id_mask = 0xfffffff0, | ||
| 183 | .features = PHY_BASIC_FEATURES, | ||
| 184 | .flags = 0, | ||
| 185 | .probe = lxt973_probe, | ||
| 186 | .config_aneg = lxt973_config_aneg, | ||
| 187 | .read_status = genphy_read_status, | ||
| 188 | .driver = { .owner = THIS_MODULE,}, | ||
| 189 | }; | ||
| 190 | |||
| 149 | static int __init lxt_init(void) | 191 | static int __init lxt_init(void) |
| 150 | { | 192 | { |
| 151 | int ret; | 193 | int ret; |
| @@ -157,9 +199,15 @@ static int __init lxt_init(void) | |||
| 157 | ret = phy_driver_register(&lxt971_driver); | 199 | ret = phy_driver_register(&lxt971_driver); |
| 158 | if (ret) | 200 | if (ret) |
| 159 | goto err2; | 201 | goto err2; |
| 202 | |||
| 203 | ret = phy_driver_register(&lxt973_driver); | ||
| 204 | if (ret) | ||
| 205 | goto err3; | ||
| 160 | return 0; | 206 | return 0; |
| 161 | 207 | ||
| 162 | err2: | 208 | err3: |
| 209 | phy_driver_unregister(&lxt971_driver); | ||
| 210 | err2: | ||
| 163 | phy_driver_unregister(&lxt970_driver); | 211 | phy_driver_unregister(&lxt970_driver); |
| 164 | err1: | 212 | err1: |
| 165 | return ret; | 213 | return ret; |
| @@ -169,6 +217,7 @@ static void __exit lxt_exit(void) | |||
| 169 | { | 217 | { |
| 170 | phy_driver_unregister(&lxt970_driver); | 218 | phy_driver_unregister(&lxt970_driver); |
| 171 | phy_driver_unregister(&lxt971_driver); | 219 | phy_driver_unregister(&lxt971_driver); |
| 220 | phy_driver_unregister(&lxt973_driver); | ||
| 172 | } | 221 | } |
| 173 | 222 | ||
| 174 | module_init(lxt_init); | 223 | module_init(lxt_init); |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index c5f8eb102bf7..1b2c29150202 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
| @@ -1422,7 +1422,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
| 1422 | flen = len; | 1422 | flen = len; |
| 1423 | if (nfree > 0) { | 1423 | if (nfree > 0) { |
| 1424 | if (pch->speed == 0) { | 1424 | if (pch->speed == 0) { |
| 1425 | flen = totlen/nfree; | 1425 | flen = len/nfree; |
| 1426 | if (nbigger > 0) { | 1426 | if (nbigger > 0) { |
| 1427 | flen++; | 1427 | flen++; |
| 1428 | nbigger--; | 1428 | nbigger--; |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 217e709bda3e..96b6cfbf0a3a 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
| @@ -559,6 +559,11 @@ static void mdio_write(void __iomem *ioaddr, int reg_addr, int value) | |||
| 559 | break; | 559 | break; |
| 560 | udelay(25); | 560 | udelay(25); |
| 561 | } | 561 | } |
| 562 | /* | ||
| 563 | * According to hardware specs a 20us delay is required after write | ||
| 564 | * complete indication, but before sending next command. | ||
| 565 | */ | ||
| 566 | udelay(20); | ||
| 562 | } | 567 | } |
| 563 | 568 | ||
| 564 | static int mdio_read(void __iomem *ioaddr, int reg_addr) | 569 | static int mdio_read(void __iomem *ioaddr, int reg_addr) |
| @@ -578,6 +583,12 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr) | |||
| 578 | } | 583 | } |
| 579 | udelay(25); | 584 | udelay(25); |
| 580 | } | 585 | } |
| 586 | /* | ||
| 587 | * According to hardware specs a 20us delay is required after read | ||
| 588 | * complete indication, but before sending next command. | ||
| 589 | */ | ||
| 590 | udelay(20); | ||
| 591 | |||
| 581 | return value; | 592 | return value; |
| 582 | } | 593 | } |
| 583 | 594 | ||
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 2e6fd89f2a72..4762c91cb587 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
| @@ -830,7 +830,7 @@ static inline const char *efx_dev_name(struct efx_nic *efx) | |||
| 830 | 830 | ||
| 831 | static inline unsigned int efx_port_num(struct efx_nic *efx) | 831 | static inline unsigned int efx_port_num(struct efx_nic *efx) |
| 832 | { | 832 | { |
| 833 | return PCI_FUNC(efx->pci_dev->devfn); | 833 | return efx->net_dev->dev_id; |
| 834 | } | 834 | } |
| 835 | 835 | ||
| 836 | /** | 836 | /** |
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c index 727b4228e081..f2b1e6180753 100644 --- a/drivers/net/sfc/siena.c +++ b/drivers/net/sfc/siena.c | |||
| @@ -206,6 +206,7 @@ static int siena_probe_nic(struct efx_nic *efx) | |||
| 206 | { | 206 | { |
| 207 | struct siena_nic_data *nic_data; | 207 | struct siena_nic_data *nic_data; |
| 208 | bool already_attached = 0; | 208 | bool already_attached = 0; |
| 209 | efx_oword_t reg; | ||
| 209 | int rc; | 210 | int rc; |
| 210 | 211 | ||
| 211 | /* Allocate storage for hardware specific data */ | 212 | /* Allocate storage for hardware specific data */ |
| @@ -220,6 +221,9 @@ static int siena_probe_nic(struct efx_nic *efx) | |||
| 220 | goto fail1; | 221 | goto fail1; |
| 221 | } | 222 | } |
| 222 | 223 | ||
| 224 | efx_reado(efx, ®, FR_AZ_CS_DEBUG); | ||
| 225 | efx->net_dev->dev_id = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1; | ||
| 226 | |||
| 223 | efx_mcdi_init(efx); | 227 | efx_mcdi_init(efx); |
| 224 | 228 | ||
| 225 | /* Recover from a failed assertion before probing */ | 229 | /* Recover from a failed assertion before probing */ |
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index 20ab16192325..737df6032bbc 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c | |||
| @@ -646,7 +646,7 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd) | |||
| 646 | error = copy_from_user(data, ifr->ifr_data, sizeof(data)); | 646 | error = copy_from_user(data, ifr->ifr_data, sizeof(data)); |
| 647 | if (error) { | 647 | if (error) { |
| 648 | pr_err("cant copy from user\n"); | 648 | pr_err("cant copy from user\n"); |
| 649 | RET(error); | 649 | RET(-EFAULT); |
| 650 | } | 650 | } |
| 651 | DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]); | 651 | DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]); |
| 652 | } | 652 | } |
| @@ -665,7 +665,7 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd) | |||
| 665 | data[2]); | 665 | data[2]); |
| 666 | error = copy_to_user(ifr->ifr_data, data, sizeof(data)); | 666 | error = copy_to_user(ifr->ifr_data, data, sizeof(data)); |
| 667 | if (error) | 667 | if (error) |
| 668 | RET(error); | 668 | RET(-EFAULT); |
| 669 | break; | 669 | break; |
| 670 | 670 | ||
| 671 | case BDX_OP_WRITE: | 671 | case BDX_OP_WRITE: |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 1f802e90474c..9516f382a6ba 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
| @@ -344,7 +344,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
| 344 | return 2; | 344 | return 2; |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | if (size > ETH_FRAME_LEN) { | 347 | if (size > dev->net->mtu + ETH_HLEN) { |
| 348 | netdev_err(dev->net, "asix_rx_fixup() Bad RX Length %d\n", | 348 | netdev_err(dev->net, "asix_rx_fixup() Bad RX Length %d\n", |
| 349 | size); | 349 | size); |
| 350 | return 0; | 350 | return 0; |
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 166e77dfffda..e47f5a986b1c 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
| @@ -37,8 +37,6 @@ | |||
| 37 | #include <net/x25device.h> | 37 | #include <net/x25device.h> |
| 38 | #include "x25_asy.h" | 38 | #include "x25_asy.h" |
| 39 | 39 | ||
| 40 | #include <net/x25device.h> | ||
| 41 | |||
| 42 | static struct net_device **x25_asy_devs; | 40 | static struct net_device **x25_asy_devs; |
| 43 | static int x25_asy_maxdev = SL_NRUNIT; | 41 | static int x25_asy_maxdev = SL_NRUNIT; |
| 44 | 42 | ||
diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c index 3f283bff0ff7..11491354e5b5 100644 --- a/drivers/net/wimax/i2400m/fw.c +++ b/drivers/net/wimax/i2400m/fw.c | |||
| @@ -1192,7 +1192,7 @@ int i2400m_fw_hdr_check(struct i2400m *i2400m, | |||
| 1192 | unsigned module_type, header_len, major_version, minor_version, | 1192 | unsigned module_type, header_len, major_version, minor_version, |
| 1193 | module_id, module_vendor, date, size; | 1193 | module_id, module_vendor, date, size; |
| 1194 | 1194 | ||
| 1195 | module_type = bcf_hdr->module_type; | 1195 | module_type = le32_to_cpu(bcf_hdr->module_type); |
| 1196 | header_len = sizeof(u32) * le32_to_cpu(bcf_hdr->header_len); | 1196 | header_len = sizeof(u32) * le32_to_cpu(bcf_hdr->header_len); |
| 1197 | major_version = (le32_to_cpu(bcf_hdr->header_version) & 0xffff0000) | 1197 | major_version = (le32_to_cpu(bcf_hdr->header_version) & 0xffff0000) |
| 1198 | >> 16; | 1198 | >> 16; |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index cc6d41dec332..648972df369d 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
| @@ -195,7 +195,7 @@ static const struct ieee80211_rate ath5k_rates[] = { | |||
| 195 | static int __devinit ath5k_pci_probe(struct pci_dev *pdev, | 195 | static int __devinit ath5k_pci_probe(struct pci_dev *pdev, |
| 196 | const struct pci_device_id *id); | 196 | const struct pci_device_id *id); |
| 197 | static void __devexit ath5k_pci_remove(struct pci_dev *pdev); | 197 | static void __devexit ath5k_pci_remove(struct pci_dev *pdev); |
| 198 | #ifdef CONFIG_PM | 198 | #ifdef CONFIG_PM_SLEEP |
| 199 | static int ath5k_pci_suspend(struct device *dev); | 199 | static int ath5k_pci_suspend(struct device *dev); |
| 200 | static int ath5k_pci_resume(struct device *dev); | 200 | static int ath5k_pci_resume(struct device *dev); |
| 201 | 201 | ||
| @@ -203,7 +203,7 @@ static SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume); | |||
| 203 | #define ATH5K_PM_OPS (&ath5k_pm_ops) | 203 | #define ATH5K_PM_OPS (&ath5k_pm_ops) |
| 204 | #else | 204 | #else |
| 205 | #define ATH5K_PM_OPS NULL | 205 | #define ATH5K_PM_OPS NULL |
| 206 | #endif /* CONFIG_PM */ | 206 | #endif /* CONFIG_PM_SLEEP */ |
| 207 | 207 | ||
| 208 | static struct pci_driver ath5k_pci_driver = { | 208 | static struct pci_driver ath5k_pci_driver = { |
| 209 | .name = KBUILD_MODNAME, | 209 | .name = KBUILD_MODNAME, |
| @@ -222,7 +222,6 @@ static int ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
| 222 | static int ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, | 222 | static int ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, |
| 223 | struct ath5k_txq *txq); | 223 | struct ath5k_txq *txq); |
| 224 | static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan); | 224 | static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan); |
| 225 | static int ath5k_reset_wake(struct ath5k_softc *sc); | ||
| 226 | static int ath5k_start(struct ieee80211_hw *hw); | 225 | static int ath5k_start(struct ieee80211_hw *hw); |
| 227 | static void ath5k_stop(struct ieee80211_hw *hw); | 226 | static void ath5k_stop(struct ieee80211_hw *hw); |
| 228 | static int ath5k_add_interface(struct ieee80211_hw *hw, | 227 | static int ath5k_add_interface(struct ieee80211_hw *hw, |
| @@ -709,7 +708,7 @@ ath5k_pci_remove(struct pci_dev *pdev) | |||
| 709 | ieee80211_free_hw(hw); | 708 | ieee80211_free_hw(hw); |
| 710 | } | 709 | } |
| 711 | 710 | ||
| 712 | #ifdef CONFIG_PM | 711 | #ifdef CONFIG_PM_SLEEP |
| 713 | static int ath5k_pci_suspend(struct device *dev) | 712 | static int ath5k_pci_suspend(struct device *dev) |
| 714 | { | 713 | { |
| 715 | struct ieee80211_hw *hw = pci_get_drvdata(to_pci_dev(dev)); | 714 | struct ieee80211_hw *hw = pci_get_drvdata(to_pci_dev(dev)); |
| @@ -735,7 +734,7 @@ static int ath5k_pci_resume(struct device *dev) | |||
| 735 | ath5k_led_enable(sc); | 734 | ath5k_led_enable(sc); |
| 736 | return 0; | 735 | return 0; |
| 737 | } | 736 | } |
| 738 | #endif /* CONFIG_PM */ | 737 | #endif /* CONFIG_PM_SLEEP */ |
| 739 | 738 | ||
| 740 | 739 | ||
| 741 | /***********************\ | 740 | /***********************\ |
| @@ -2770,7 +2769,7 @@ ath5k_tasklet_reset(unsigned long data) | |||
| 2770 | { | 2769 | { |
| 2771 | struct ath5k_softc *sc = (void *)data; | 2770 | struct ath5k_softc *sc = (void *)data; |
| 2772 | 2771 | ||
| 2773 | ath5k_reset_wake(sc); | 2772 | ath5k_reset(sc, sc->curchan); |
| 2774 | } | 2773 | } |
| 2775 | 2774 | ||
| 2776 | /* | 2775 | /* |
| @@ -2941,23 +2940,13 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan) | |||
| 2941 | ath5k_beacon_config(sc); | 2940 | ath5k_beacon_config(sc); |
| 2942 | /* intrs are enabled by ath5k_beacon_config */ | 2941 | /* intrs are enabled by ath5k_beacon_config */ |
| 2943 | 2942 | ||
| 2943 | ieee80211_wake_queues(sc->hw); | ||
| 2944 | |||
| 2944 | return 0; | 2945 | return 0; |
| 2945 | err: | 2946 | err: |
| 2946 | return ret; | 2947 | return ret; |
| 2947 | } | 2948 | } |
| 2948 | 2949 | ||
| 2949 | static int | ||
| 2950 | ath5k_reset_wake(struct ath5k_softc *sc) | ||
| 2951 | { | ||
| 2952 | int ret; | ||
| 2953 | |||
| 2954 | ret = ath5k_reset(sc, sc->curchan); | ||
| 2955 | if (!ret) | ||
| 2956 | ieee80211_wake_queues(sc->hw); | ||
| 2957 | |||
| 2958 | return ret; | ||
| 2959 | } | ||
| 2960 | |||
| 2961 | static int ath5k_start(struct ieee80211_hw *hw) | 2950 | static int ath5k_start(struct ieee80211_hw *hw) |
| 2962 | { | 2951 | { |
| 2963 | return ath5k_init(hw->priv); | 2952 | return ath5k_init(hw->priv); |
| @@ -3151,13 +3140,15 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw, | |||
| 3151 | 3140 | ||
| 3152 | if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) { | 3141 | if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) { |
| 3153 | if (*new_flags & FIF_PROMISC_IN_BSS) { | 3142 | if (*new_flags & FIF_PROMISC_IN_BSS) { |
| 3154 | rfilt |= AR5K_RX_FILTER_PROM; | ||
| 3155 | __set_bit(ATH_STAT_PROMISC, sc->status); | 3143 | __set_bit(ATH_STAT_PROMISC, sc->status); |
| 3156 | } else { | 3144 | } else { |
| 3157 | __clear_bit(ATH_STAT_PROMISC, sc->status); | 3145 | __clear_bit(ATH_STAT_PROMISC, sc->status); |
| 3158 | } | 3146 | } |
| 3159 | } | 3147 | } |
| 3160 | 3148 | ||
| 3149 | if (test_bit(ATH_STAT_PROMISC, sc->status)) | ||
| 3150 | rfilt |= AR5K_RX_FILTER_PROM; | ||
| 3151 | |||
| 3161 | /* Note, AR5K_RX_FILTER_MCAST is already enabled */ | 3152 | /* Note, AR5K_RX_FILTER_MCAST is already enabled */ |
| 3162 | if (*new_flags & FIF_ALLMULTI) { | 3153 | if (*new_flags & FIF_ALLMULTI) { |
| 3163 | mfilt[0] = ~0; | 3154 | mfilt[0] = ~0; |
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 1b81c4778800..492cbb15720d 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
| @@ -1814,6 +1814,13 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode) | |||
| 1814 | u8 def_ant, tx_ant, ee_mode; | 1814 | u8 def_ant, tx_ant, ee_mode; |
| 1815 | u32 sta_id1 = 0; | 1815 | u32 sta_id1 = 0; |
| 1816 | 1816 | ||
| 1817 | /* if channel is not initialized yet we can't set the antennas | ||
| 1818 | * so just store the mode. it will be set on the next reset */ | ||
| 1819 | if (channel == NULL) { | ||
| 1820 | ah->ah_ant_mode = ant_mode; | ||
| 1821 | return; | ||
| 1822 | } | ||
| 1823 | |||
| 1817 | def_ant = ah->ah_def_ant; | 1824 | def_ant = ah->ah_def_ant; |
| 1818 | 1825 | ||
| 1819 | ATH5K_TRACE(ah->ah_sc); | 1826 | ATH5K_TRACE(ah->ah_sc); |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index d70732819423..ff9b5c882184 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
| @@ -2618,15 +2618,6 @@ static irqreturn_t prism2_interrupt(int irq, void *dev_id) | |||
| 2618 | int events = 0; | 2618 | int events = 0; |
| 2619 | u16 ev; | 2619 | u16 ev; |
| 2620 | 2620 | ||
| 2621 | /* Detect early interrupt before driver is fully configued */ | ||
| 2622 | if (!dev->base_addr) { | ||
| 2623 | if (net_ratelimit()) { | ||
| 2624 | printk(KERN_DEBUG "%s: Interrupt, but dev not configured\n", | ||
| 2625 | dev->name); | ||
| 2626 | } | ||
| 2627 | return IRQ_HANDLED; | ||
| 2628 | } | ||
| 2629 | |||
| 2630 | iface = netdev_priv(dev); | 2621 | iface = netdev_priv(dev); |
| 2631 | local = iface->local; | 2622 | local = iface->local; |
| 2632 | 2623 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 068f7f8435c5..c44a303e62ed 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
| @@ -2852,6 +2852,7 @@ static struct iwl_lib_ops iwl3945_lib = { | |||
| 2852 | .isr = iwl_isr_legacy, | 2852 | .isr = iwl_isr_legacy, |
| 2853 | .config_ap = iwl3945_config_ap, | 2853 | .config_ap = iwl3945_config_ap, |
| 2854 | .manage_ibss_station = iwl3945_manage_ibss_station, | 2854 | .manage_ibss_station = iwl3945_manage_ibss_station, |
| 2855 | .recover_from_tx_stall = iwl_bg_monitor_recover, | ||
| 2855 | .check_plcp_health = iwl3945_good_plcp_health, | 2856 | .check_plcp_health = iwl3945_good_plcp_health, |
| 2856 | 2857 | ||
| 2857 | .debugfs_ops = { | 2858 | .debugfs_ops = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 1004cfc403b1..0f292a210ed9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
| @@ -1119,10 +1119,9 @@ static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, | |||
| 1119 | struct iwl_scan_channel *scan_ch) | 1119 | struct iwl_scan_channel *scan_ch) |
| 1120 | { | 1120 | { |
| 1121 | const struct ieee80211_supported_band *sband; | 1121 | const struct ieee80211_supported_band *sband; |
| 1122 | const struct iwl_channel_info *ch_info; | ||
| 1123 | u16 passive_dwell = 0; | 1122 | u16 passive_dwell = 0; |
| 1124 | u16 active_dwell = 0; | 1123 | u16 active_dwell = 0; |
| 1125 | int i, added = 0; | 1124 | int added = 0; |
| 1126 | u16 channel = 0; | 1125 | u16 channel = 0; |
| 1127 | 1126 | ||
| 1128 | sband = iwl_get_hw_mode(priv, band); | 1127 | sband = iwl_get_hw_mode(priv, band); |
| @@ -1137,32 +1136,7 @@ static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, | |||
| 1137 | if (passive_dwell <= active_dwell) | 1136 | if (passive_dwell <= active_dwell) |
| 1138 | passive_dwell = active_dwell + 1; | 1137 | passive_dwell = active_dwell + 1; |
| 1139 | 1138 | ||
| 1140 | /* only scan single channel, good enough to reset the RF */ | 1139 | channel = iwl_get_single_channel_number(priv, band); |
| 1141 | /* pick the first valid not in-use channel */ | ||
| 1142 | if (band == IEEE80211_BAND_5GHZ) { | ||
| 1143 | for (i = 14; i < priv->channel_count; i++) { | ||
| 1144 | if (priv->channel_info[i].channel != | ||
| 1145 | le16_to_cpu(priv->staging_rxon.channel)) { | ||
| 1146 | channel = priv->channel_info[i].channel; | ||
| 1147 | ch_info = iwl_get_channel_info(priv, | ||
| 1148 | band, channel); | ||
| 1149 | if (is_channel_valid(ch_info)) | ||
| 1150 | break; | ||
| 1151 | } | ||
| 1152 | } | ||
| 1153 | } else { | ||
| 1154 | for (i = 0; i < 14; i++) { | ||
| 1155 | if (priv->channel_info[i].channel != | ||
| 1156 | le16_to_cpu(priv->staging_rxon.channel)) { | ||
| 1157 | channel = | ||
| 1158 | priv->channel_info[i].channel; | ||
| 1159 | ch_info = iwl_get_channel_info(priv, | ||
| 1160 | band, channel); | ||
| 1161 | if (is_channel_valid(ch_info)) | ||
| 1162 | break; | ||
| 1163 | } | ||
| 1164 | } | ||
| 1165 | } | ||
| 1166 | if (channel) { | 1140 | if (channel) { |
| 1167 | scan_ch->channel = cpu_to_le16(channel); | 1141 | scan_ch->channel = cpu_to_le16(channel); |
| 1168 | scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; | 1142 | scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index c402bfc83f36..a732f1094e5d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
| @@ -1125,6 +1125,7 @@ static void iwlagn_tx_status(struct iwl_priv *priv, struct sk_buff *skb) | |||
| 1125 | struct ieee80211_sta *sta; | 1125 | struct ieee80211_sta *sta; |
| 1126 | struct iwl_station_priv *sta_priv; | 1126 | struct iwl_station_priv *sta_priv; |
| 1127 | 1127 | ||
| 1128 | rcu_read_lock(); | ||
| 1128 | sta = ieee80211_find_sta(priv->vif, hdr->addr1); | 1129 | sta = ieee80211_find_sta(priv->vif, hdr->addr1); |
| 1129 | if (sta) { | 1130 | if (sta) { |
| 1130 | sta_priv = (void *)sta->drv_priv; | 1131 | sta_priv = (void *)sta->drv_priv; |
| @@ -1133,6 +1134,7 @@ static void iwlagn_tx_status(struct iwl_priv *priv, struct sk_buff *skb) | |||
| 1133 | atomic_dec_return(&sta_priv->pending_frames) == 0) | 1134 | atomic_dec_return(&sta_priv->pending_frames) == 0) |
| 1134 | ieee80211_sta_block_awake(priv->hw, sta, false); | 1135 | ieee80211_sta_block_awake(priv->hw, sta, false); |
| 1135 | } | 1136 | } |
| 1137 | rcu_read_unlock(); | ||
| 1136 | 1138 | ||
| 1137 | ieee80211_tx_status_irqsafe(priv->hw, skb); | 1139 | ieee80211_tx_status_irqsafe(priv->hw, skb); |
| 1138 | } | 1140 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index aef4f71f1981..7726e67044c0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
| @@ -1484,6 +1484,156 @@ bool iwl_good_ack_health(struct iwl_priv *priv, | |||
| 1484 | } | 1484 | } |
| 1485 | 1485 | ||
| 1486 | 1486 | ||
| 1487 | /***************************************************************************** | ||
| 1488 | * | ||
| 1489 | * sysfs attributes | ||
| 1490 | * | ||
| 1491 | *****************************************************************************/ | ||
| 1492 | |||
| 1493 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
| 1494 | |||
| 1495 | /* | ||
| 1496 | * The following adds a new attribute to the sysfs representation | ||
| 1497 | * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/) | ||
| 1498 | * used for controlling the debug level. | ||
| 1499 | * | ||
| 1500 | * See the level definitions in iwl for details. | ||
| 1501 | * | ||
| 1502 | * The debug_level being managed using sysfs below is a per device debug | ||
| 1503 | * level that is used instead of the global debug level if it (the per | ||
| 1504 | * device debug level) is set. | ||
| 1505 | */ | ||
| 1506 | static ssize_t show_debug_level(struct device *d, | ||
| 1507 | struct device_attribute *attr, char *buf) | ||
| 1508 | { | ||
| 1509 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 1510 | return sprintf(buf, "0x%08X\n", iwl_get_debug_level(priv)); | ||
| 1511 | } | ||
| 1512 | static ssize_t store_debug_level(struct device *d, | ||
| 1513 | struct device_attribute *attr, | ||
| 1514 | const char *buf, size_t count) | ||
| 1515 | { | ||
| 1516 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 1517 | unsigned long val; | ||
| 1518 | int ret; | ||
| 1519 | |||
| 1520 | ret = strict_strtoul(buf, 0, &val); | ||
| 1521 | if (ret) | ||
| 1522 | IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf); | ||
| 1523 | else { | ||
| 1524 | priv->debug_level = val; | ||
| 1525 | if (iwl_alloc_traffic_mem(priv)) | ||
| 1526 | IWL_ERR(priv, | ||
| 1527 | "Not enough memory to generate traffic log\n"); | ||
| 1528 | } | ||
| 1529 | return strnlen(buf, count); | ||
| 1530 | } | ||
| 1531 | |||
| 1532 | static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, | ||
| 1533 | show_debug_level, store_debug_level); | ||
| 1534 | |||
| 1535 | |||
| 1536 | #endif /* CONFIG_IWLWIFI_DEBUG */ | ||
| 1537 | |||
| 1538 | |||
| 1539 | static ssize_t show_temperature(struct device *d, | ||
| 1540 | struct device_attribute *attr, char *buf) | ||
| 1541 | { | ||
| 1542 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 1543 | |||
| 1544 | if (!iwl_is_alive(priv)) | ||
| 1545 | return -EAGAIN; | ||
| 1546 | |||
| 1547 | return sprintf(buf, "%d\n", priv->temperature); | ||
| 1548 | } | ||
| 1549 | |||
| 1550 | static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); | ||
| 1551 | |||
| 1552 | static ssize_t show_tx_power(struct device *d, | ||
| 1553 | struct device_attribute *attr, char *buf) | ||
| 1554 | { | ||
| 1555 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 1556 | |||
| 1557 | if (!iwl_is_ready_rf(priv)) | ||
| 1558 | return sprintf(buf, "off\n"); | ||
| 1559 | else | ||
| 1560 | return sprintf(buf, "%d\n", priv->tx_power_user_lmt); | ||
| 1561 | } | ||
| 1562 | |||
| 1563 | static ssize_t store_tx_power(struct device *d, | ||
| 1564 | struct device_attribute *attr, | ||
| 1565 | const char *buf, size_t count) | ||
| 1566 | { | ||
| 1567 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 1568 | unsigned long val; | ||
| 1569 | int ret; | ||
| 1570 | |||
| 1571 | ret = strict_strtoul(buf, 10, &val); | ||
| 1572 | if (ret) | ||
| 1573 | IWL_INFO(priv, "%s is not in decimal form.\n", buf); | ||
| 1574 | else { | ||
| 1575 | ret = iwl_set_tx_power(priv, val, false); | ||
| 1576 | if (ret) | ||
| 1577 | IWL_ERR(priv, "failed setting tx power (0x%d).\n", | ||
| 1578 | ret); | ||
| 1579 | else | ||
| 1580 | ret = count; | ||
| 1581 | } | ||
| 1582 | return ret; | ||
| 1583 | } | ||
| 1584 | |||
| 1585 | static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power); | ||
| 1586 | |||
| 1587 | static ssize_t show_rts_ht_protection(struct device *d, | ||
| 1588 | struct device_attribute *attr, char *buf) | ||
| 1589 | { | ||
| 1590 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 1591 | |||
| 1592 | return sprintf(buf, "%s\n", | ||
| 1593 | priv->cfg->use_rts_for_ht ? "RTS/CTS" : "CTS-to-self"); | ||
| 1594 | } | ||
| 1595 | |||
| 1596 | static ssize_t store_rts_ht_protection(struct device *d, | ||
| 1597 | struct device_attribute *attr, | ||
| 1598 | const char *buf, size_t count) | ||
| 1599 | { | ||
| 1600 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 1601 | unsigned long val; | ||
| 1602 | int ret; | ||
| 1603 | |||
| 1604 | ret = strict_strtoul(buf, 10, &val); | ||
| 1605 | if (ret) | ||
| 1606 | IWL_INFO(priv, "Input is not in decimal form.\n"); | ||
| 1607 | else { | ||
| 1608 | if (!iwl_is_associated(priv)) | ||
| 1609 | priv->cfg->use_rts_for_ht = val ? true : false; | ||
| 1610 | else | ||
| 1611 | IWL_ERR(priv, "Sta associated with AP - " | ||
| 1612 | "Change protection mechanism is not allowed\n"); | ||
| 1613 | ret = count; | ||
| 1614 | } | ||
| 1615 | return ret; | ||
| 1616 | } | ||
| 1617 | |||
| 1618 | static DEVICE_ATTR(rts_ht_protection, S_IWUSR | S_IRUGO, | ||
| 1619 | show_rts_ht_protection, store_rts_ht_protection); | ||
| 1620 | |||
| 1621 | |||
| 1622 | static struct attribute *iwl_sysfs_entries[] = { | ||
| 1623 | &dev_attr_temperature.attr, | ||
| 1624 | &dev_attr_tx_power.attr, | ||
| 1625 | &dev_attr_rts_ht_protection.attr, | ||
| 1626 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
| 1627 | &dev_attr_debug_level.attr, | ||
| 1628 | #endif | ||
| 1629 | NULL | ||
| 1630 | }; | ||
| 1631 | |||
| 1632 | static struct attribute_group iwl_attribute_group = { | ||
| 1633 | .name = NULL, /* put in device directory */ | ||
| 1634 | .attrs = iwl_sysfs_entries, | ||
| 1635 | }; | ||
| 1636 | |||
| 1487 | /****************************************************************************** | 1637 | /****************************************************************************** |
| 1488 | * | 1638 | * |
| 1489 | * uCode download functions | 1639 | * uCode download functions |
| @@ -1965,6 +2115,13 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
| 1965 | if (err) | 2115 | if (err) |
| 1966 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); | 2116 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); |
| 1967 | 2117 | ||
| 2118 | err = sysfs_create_group(&priv->pci_dev->dev.kobj, | ||
| 2119 | &iwl_attribute_group); | ||
| 2120 | if (err) { | ||
| 2121 | IWL_ERR(priv, "failed to create sysfs device attributes\n"); | ||
| 2122 | goto out_unbind; | ||
| 2123 | } | ||
| 2124 | |||
| 1968 | /* We have our copies now, allow OS release its copies */ | 2125 | /* We have our copies now, allow OS release its copies */ |
| 1969 | release_firmware(ucode_raw); | 2126 | release_firmware(ucode_raw); |
| 1970 | complete(&priv->_agn.firmware_loading_complete); | 2127 | complete(&priv->_agn.firmware_loading_complete); |
| @@ -3264,141 +3421,6 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | |||
| 3264 | 3421 | ||
| 3265 | /***************************************************************************** | 3422 | /***************************************************************************** |
| 3266 | * | 3423 | * |
| 3267 | * sysfs attributes | ||
| 3268 | * | ||
| 3269 | *****************************************************************************/ | ||
| 3270 | |||
| 3271 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
| 3272 | |||
| 3273 | /* | ||
| 3274 | * The following adds a new attribute to the sysfs representation | ||
| 3275 | * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/) | ||
| 3276 | * used for controlling the debug level. | ||
| 3277 | * | ||
| 3278 | * See the level definitions in iwl for details. | ||
| 3279 | * | ||
| 3280 | * The debug_level being managed using sysfs below is a per device debug | ||
| 3281 | * level that is used instead of the global debug level if it (the per | ||
| 3282 | * device debug level) is set. | ||
| 3283 | */ | ||
| 3284 | static ssize_t show_debug_level(struct device *d, | ||
| 3285 | struct device_attribute *attr, char *buf) | ||
| 3286 | { | ||
| 3287 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 3288 | return sprintf(buf, "0x%08X\n", iwl_get_debug_level(priv)); | ||
| 3289 | } | ||
| 3290 | static ssize_t store_debug_level(struct device *d, | ||
| 3291 | struct device_attribute *attr, | ||
| 3292 | const char *buf, size_t count) | ||
| 3293 | { | ||
| 3294 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 3295 | unsigned long val; | ||
| 3296 | int ret; | ||
| 3297 | |||
| 3298 | ret = strict_strtoul(buf, 0, &val); | ||
| 3299 | if (ret) | ||
| 3300 | IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf); | ||
| 3301 | else { | ||
| 3302 | priv->debug_level = val; | ||
| 3303 | if (iwl_alloc_traffic_mem(priv)) | ||
| 3304 | IWL_ERR(priv, | ||
| 3305 | "Not enough memory to generate traffic log\n"); | ||
| 3306 | } | ||
| 3307 | return strnlen(buf, count); | ||
| 3308 | } | ||
| 3309 | |||
| 3310 | static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, | ||
| 3311 | show_debug_level, store_debug_level); | ||
| 3312 | |||
| 3313 | |||
| 3314 | #endif /* CONFIG_IWLWIFI_DEBUG */ | ||
| 3315 | |||
| 3316 | |||
| 3317 | static ssize_t show_temperature(struct device *d, | ||
| 3318 | struct device_attribute *attr, char *buf) | ||
| 3319 | { | ||
| 3320 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 3321 | |||
| 3322 | if (!iwl_is_alive(priv)) | ||
| 3323 | return -EAGAIN; | ||
| 3324 | |||
| 3325 | return sprintf(buf, "%d\n", priv->temperature); | ||
| 3326 | } | ||
| 3327 | |||
| 3328 | static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); | ||
| 3329 | |||
| 3330 | static ssize_t show_tx_power(struct device *d, | ||
| 3331 | struct device_attribute *attr, char *buf) | ||
| 3332 | { | ||
| 3333 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 3334 | |||
| 3335 | if (!iwl_is_ready_rf(priv)) | ||
| 3336 | return sprintf(buf, "off\n"); | ||
| 3337 | else | ||
| 3338 | return sprintf(buf, "%d\n", priv->tx_power_user_lmt); | ||
| 3339 | } | ||
| 3340 | |||
| 3341 | static ssize_t store_tx_power(struct device *d, | ||
| 3342 | struct device_attribute *attr, | ||
| 3343 | const char *buf, size_t count) | ||
| 3344 | { | ||
| 3345 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 3346 | unsigned long val; | ||
| 3347 | int ret; | ||
| 3348 | |||
| 3349 | ret = strict_strtoul(buf, 10, &val); | ||
| 3350 | if (ret) | ||
| 3351 | IWL_INFO(priv, "%s is not in decimal form.\n", buf); | ||
| 3352 | else { | ||
| 3353 | ret = iwl_set_tx_power(priv, val, false); | ||
| 3354 | if (ret) | ||
| 3355 | IWL_ERR(priv, "failed setting tx power (0x%d).\n", | ||
| 3356 | ret); | ||
| 3357 | else | ||
| 3358 | ret = count; | ||
| 3359 | } | ||
| 3360 | return ret; | ||
| 3361 | } | ||
| 3362 | |||
| 3363 | static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power); | ||
| 3364 | |||
| 3365 | static ssize_t show_rts_ht_protection(struct device *d, | ||
| 3366 | struct device_attribute *attr, char *buf) | ||
| 3367 | { | ||
| 3368 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 3369 | |||
| 3370 | return sprintf(buf, "%s\n", | ||
| 3371 | priv->cfg->use_rts_for_ht ? "RTS/CTS" : "CTS-to-self"); | ||
| 3372 | } | ||
| 3373 | |||
| 3374 | static ssize_t store_rts_ht_protection(struct device *d, | ||
| 3375 | struct device_attribute *attr, | ||
| 3376 | const char *buf, size_t count) | ||
| 3377 | { | ||
| 3378 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
| 3379 | unsigned long val; | ||
| 3380 | int ret; | ||
| 3381 | |||
| 3382 | ret = strict_strtoul(buf, 10, &val); | ||
| 3383 | if (ret) | ||
| 3384 | IWL_INFO(priv, "Input is not in decimal form.\n"); | ||
| 3385 | else { | ||
| 3386 | if (!iwl_is_associated(priv)) | ||
| 3387 | priv->cfg->use_rts_for_ht = val ? true : false; | ||
| 3388 | else | ||
| 3389 | IWL_ERR(priv, "Sta associated with AP - " | ||
| 3390 | "Change protection mechanism is not allowed\n"); | ||
| 3391 | ret = count; | ||
| 3392 | } | ||
| 3393 | return ret; | ||
| 3394 | } | ||
| 3395 | |||
| 3396 | static DEVICE_ATTR(rts_ht_protection, S_IWUSR | S_IRUGO, | ||
| 3397 | show_rts_ht_protection, store_rts_ht_protection); | ||
| 3398 | |||
| 3399 | |||
| 3400 | /***************************************************************************** | ||
| 3401 | * | ||
| 3402 | * driver setup and teardown | 3424 | * driver setup and teardown |
| 3403 | * | 3425 | * |
| 3404 | *****************************************************************************/ | 3426 | *****************************************************************************/ |
| @@ -3550,21 +3572,6 @@ static void iwl_uninit_drv(struct iwl_priv *priv) | |||
| 3550 | kfree(priv->scan_cmd); | 3572 | kfree(priv->scan_cmd); |
| 3551 | } | 3573 | } |
| 3552 | 3574 | ||
| 3553 | static struct attribute *iwl_sysfs_entries[] = { | ||
| 3554 | &dev_attr_temperature.attr, | ||
| 3555 | &dev_attr_tx_power.attr, | ||
| 3556 | &dev_attr_rts_ht_protection.attr, | ||
| 3557 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
| 3558 | &dev_attr_debug_level.attr, | ||
| 3559 | #endif | ||
| 3560 | NULL | ||
| 3561 | }; | ||
| 3562 | |||
| 3563 | static struct attribute_group iwl_attribute_group = { | ||
| 3564 | .name = NULL, /* put in device directory */ | ||
| 3565 | .attrs = iwl_sysfs_entries, | ||
| 3566 | }; | ||
| 3567 | |||
| 3568 | static struct ieee80211_ops iwl_hw_ops = { | 3575 | static struct ieee80211_ops iwl_hw_ops = { |
| 3569 | .tx = iwl_mac_tx, | 3576 | .tx = iwl_mac_tx, |
| 3570 | .start = iwl_mac_start, | 3577 | .start = iwl_mac_start, |
| @@ -3750,11 +3757,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3750 | IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); | 3757 | IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); |
| 3751 | goto out_disable_msi; | 3758 | goto out_disable_msi; |
| 3752 | } | 3759 | } |
| 3753 | err = sysfs_create_group(&pdev->dev.kobj, &iwl_attribute_group); | ||
| 3754 | if (err) { | ||
| 3755 | IWL_ERR(priv, "failed to create sysfs device attributes\n"); | ||
| 3756 | goto out_free_irq; | ||
| 3757 | } | ||
| 3758 | 3760 | ||
| 3759 | iwl_setup_deferred_work(priv); | 3761 | iwl_setup_deferred_work(priv); |
| 3760 | iwl_setup_rx_handlers(priv); | 3762 | iwl_setup_rx_handlers(priv); |
| @@ -3788,15 +3790,13 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3788 | 3790 | ||
| 3789 | err = iwl_request_firmware(priv, true); | 3791 | err = iwl_request_firmware(priv, true); |
| 3790 | if (err) | 3792 | if (err) |
| 3791 | goto out_remove_sysfs; | 3793 | goto out_destroy_workqueue; |
| 3792 | 3794 | ||
| 3793 | return 0; | 3795 | return 0; |
| 3794 | 3796 | ||
| 3795 | out_remove_sysfs: | 3797 | out_destroy_workqueue: |
| 3796 | destroy_workqueue(priv->workqueue); | 3798 | destroy_workqueue(priv->workqueue); |
| 3797 | priv->workqueue = NULL; | 3799 | priv->workqueue = NULL; |
| 3798 | sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); | ||
| 3799 | out_free_irq: | ||
| 3800 | free_irq(priv->pci_dev->irq, priv); | 3800 | free_irq(priv->pci_dev->irq, priv); |
| 3801 | iwl_free_isr_ict(priv); | 3801 | iwl_free_isr_ict(priv); |
| 3802 | out_disable_msi: | 3802 | out_disable_msi: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 5a7eca8fb789..426e95567de3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
| @@ -854,6 +854,45 @@ void iwl_set_rxon_chain(struct iwl_priv *priv) | |||
| 854 | } | 854 | } |
| 855 | EXPORT_SYMBOL(iwl_set_rxon_chain); | 855 | EXPORT_SYMBOL(iwl_set_rxon_chain); |
| 856 | 856 | ||
| 857 | /* Return valid channel */ | ||
| 858 | u8 iwl_get_single_channel_number(struct iwl_priv *priv, | ||
| 859 | enum ieee80211_band band) | ||
| 860 | { | ||
| 861 | const struct iwl_channel_info *ch_info; | ||
| 862 | int i; | ||
| 863 | u8 channel = 0; | ||
| 864 | |||
| 865 | /* only scan single channel, good enough to reset the RF */ | ||
| 866 | /* pick the first valid not in-use channel */ | ||
| 867 | if (band == IEEE80211_BAND_5GHZ) { | ||
| 868 | for (i = 14; i < priv->channel_count; i++) { | ||
| 869 | if (priv->channel_info[i].channel != | ||
| 870 | le16_to_cpu(priv->staging_rxon.channel)) { | ||
| 871 | channel = priv->channel_info[i].channel; | ||
| 872 | ch_info = iwl_get_channel_info(priv, | ||
| 873 | band, channel); | ||
| 874 | if (is_channel_valid(ch_info)) | ||
| 875 | break; | ||
| 876 | } | ||
| 877 | } | ||
| 878 | } else { | ||
| 879 | for (i = 0; i < 14; i++) { | ||
| 880 | if (priv->channel_info[i].channel != | ||
| 881 | le16_to_cpu(priv->staging_rxon.channel)) { | ||
| 882 | channel = | ||
| 883 | priv->channel_info[i].channel; | ||
| 884 | ch_info = iwl_get_channel_info(priv, | ||
| 885 | band, channel); | ||
| 886 | if (is_channel_valid(ch_info)) | ||
| 887 | break; | ||
| 888 | } | ||
| 889 | } | ||
| 890 | } | ||
| 891 | |||
| 892 | return channel; | ||
| 893 | } | ||
| 894 | EXPORT_SYMBOL(iwl_get_single_channel_number); | ||
| 895 | |||
| 857 | /** | 896 | /** |
| 858 | * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON | 897 | * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON |
| 859 | * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz | 898 | * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 7e5a5ba41fd2..31775bd9c361 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
| @@ -343,6 +343,8 @@ int iwl_check_rxon_cmd(struct iwl_priv *priv); | |||
| 343 | int iwl_full_rxon_required(struct iwl_priv *priv); | 343 | int iwl_full_rxon_required(struct iwl_priv *priv); |
| 344 | void iwl_set_rxon_chain(struct iwl_priv *priv); | 344 | void iwl_set_rxon_chain(struct iwl_priv *priv); |
| 345 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); | 345 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); |
| 346 | u8 iwl_get_single_channel_number(struct iwl_priv *priv, | ||
| 347 | enum ieee80211_band band); | ||
| 346 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); | 348 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); |
| 347 | u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, | 349 | u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, |
| 348 | struct ieee80211_sta_ht_cap *sta_ht_inf); | 350 | struct ieee80211_sta_ht_cap *sta_ht_inf); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 3e5bffb6034f..6c353cacc8d6 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
| @@ -1844,6 +1844,49 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
| 1844 | #endif | 1844 | #endif |
| 1845 | } | 1845 | } |
| 1846 | 1846 | ||
| 1847 | static int iwl3945_get_single_channel_for_scan(struct iwl_priv *priv, | ||
| 1848 | struct ieee80211_vif *vif, | ||
| 1849 | enum ieee80211_band band, | ||
| 1850 | struct iwl3945_scan_channel *scan_ch) | ||
| 1851 | { | ||
| 1852 | const struct ieee80211_supported_band *sband; | ||
| 1853 | u16 passive_dwell = 0; | ||
| 1854 | u16 active_dwell = 0; | ||
| 1855 | int added = 0; | ||
| 1856 | u8 channel = 0; | ||
| 1857 | |||
| 1858 | sband = iwl_get_hw_mode(priv, band); | ||
| 1859 | if (!sband) { | ||
| 1860 | IWL_ERR(priv, "invalid band\n"); | ||
| 1861 | return added; | ||
| 1862 | } | ||
| 1863 | |||
| 1864 | active_dwell = iwl_get_active_dwell_time(priv, band, 0); | ||
| 1865 | passive_dwell = iwl_get_passive_dwell_time(priv, band, vif); | ||
| 1866 | |||
| 1867 | if (passive_dwell <= active_dwell) | ||
| 1868 | passive_dwell = active_dwell + 1; | ||
| 1869 | |||
| 1870 | |||
| 1871 | channel = iwl_get_single_channel_number(priv, band); | ||
| 1872 | |||
| 1873 | if (channel) { | ||
| 1874 | scan_ch->channel = channel; | ||
| 1875 | scan_ch->type = 0; /* passive */ | ||
| 1876 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | ||
| 1877 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | ||
| 1878 | /* Set txpower levels to defaults */ | ||
| 1879 | scan_ch->tpc.dsp_atten = 110; | ||
| 1880 | if (band == IEEE80211_BAND_5GHZ) | ||
| 1881 | scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; | ||
| 1882 | else | ||
| 1883 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); | ||
| 1884 | added++; | ||
| 1885 | } else | ||
| 1886 | IWL_ERR(priv, "no valid channel found\n"); | ||
| 1887 | return added; | ||
| 1888 | } | ||
| 1889 | |||
| 1847 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, | 1890 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, |
| 1848 | enum ieee80211_band band, | 1891 | enum ieee80211_band band, |
| 1849 | u8 is_active, u8 n_probes, | 1892 | u8 is_active, u8 n_probes, |
| @@ -2992,9 +3035,16 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
| 2992 | /* select Rx antennas */ | 3035 | /* select Rx antennas */ |
| 2993 | scan->flags |= iwl3945_get_antenna_flags(priv); | 3036 | scan->flags |= iwl3945_get_antenna_flags(priv); |
| 2994 | 3037 | ||
| 2995 | scan->channel_count = | 3038 | if (priv->is_internal_short_scan) { |
| 2996 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, | 3039 | scan->channel_count = |
| 2997 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)], vif); | 3040 | iwl3945_get_single_channel_for_scan(priv, vif, band, |
| 3041 | (void *)&scan->data[le16_to_cpu( | ||
| 3042 | scan->tx_cmd.len)]); | ||
| 3043 | } else { | ||
| 3044 | scan->channel_count = | ||
| 3045 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, | ||
| 3046 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)], vif); | ||
| 3047 | } | ||
| 2998 | 3048 | ||
| 2999 | if (scan->channel_count == 0) { | 3049 | if (scan->channel_count == 0) { |
| 3000 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); | 3050 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); |
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index d5b197b4d5bb..73073259f508 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
| @@ -80,6 +80,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
| 80 | {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ | 80 | {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ |
| 81 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ | 81 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ |
| 82 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ | 82 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ |
| 83 | {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ | ||
| 83 | {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ | 84 | {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ |
| 84 | {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */ | 85 | {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */ |
| 85 | {} | 86 | {} |
diff --git a/drivers/net/wireless/wl12xx/wl1251_sdio.c b/drivers/net/wireless/wl12xx/wl1251_sdio.c index d234285c2c81..c561332e7009 100644 --- a/drivers/net/wireless/wl12xx/wl1251_sdio.c +++ b/drivers/net/wireless/wl12xx/wl1251_sdio.c | |||
| @@ -259,6 +259,7 @@ disable: | |||
| 259 | sdio_disable_func(func); | 259 | sdio_disable_func(func); |
| 260 | release: | 260 | release: |
| 261 | sdio_release_host(func); | 261 | sdio_release_host(func); |
| 262 | wl1251_free_hw(wl); | ||
| 262 | return ret; | 263 | return ret; |
| 263 | } | 264 | } |
| 264 | 265 | ||
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index b3e5580c837b..4952c3b9379d 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
| @@ -828,7 +828,14 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 828 | pci_name(pdev), err); | 828 | pci_name(pdev), err); |
| 829 | return err; | 829 | return err; |
| 830 | } | 830 | } |
| 831 | |||
| 831 | bus = pdev->subordinate; | 832 | bus = pdev->subordinate; |
| 833 | if (!bus) { | ||
| 834 | dev_notice(&pdev->dev, "the device is not a bridge, " | ||
| 835 | "skipping\n"); | ||
| 836 | rc = -ENODEV; | ||
| 837 | goto err_disable_device; | ||
| 838 | } | ||
| 832 | 839 | ||
| 833 | /* Need to read VID early b/c it's used to differentiate CPQ and INTC | 840 | /* Need to read VID early b/c it's used to differentiate CPQ and INTC |
| 834 | * discovery | 841 | * discovery |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index afd2fbf7d797..c9957f68ac9b 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
| @@ -1035,39 +1035,6 @@ error: | |||
| 1035 | return retval; | 1035 | return retval; |
| 1036 | } | 1036 | } |
| 1037 | 1037 | ||
| 1038 | static void pci_remove_slot_links(struct pci_dev *dev) | ||
| 1039 | { | ||
| 1040 | char func[10]; | ||
| 1041 | struct pci_slot *slot; | ||
| 1042 | |||
| 1043 | sysfs_remove_link(&dev->dev.kobj, "slot"); | ||
| 1044 | list_for_each_entry(slot, &dev->bus->slots, list) { | ||
| 1045 | if (slot->number != PCI_SLOT(dev->devfn)) | ||
| 1046 | continue; | ||
| 1047 | snprintf(func, 10, "function%d", PCI_FUNC(dev->devfn)); | ||
| 1048 | sysfs_remove_link(&slot->kobj, func); | ||
| 1049 | } | ||
| 1050 | } | ||
| 1051 | |||
| 1052 | static int pci_create_slot_links(struct pci_dev *dev) | ||
| 1053 | { | ||
| 1054 | int result = 0; | ||
| 1055 | char func[10]; | ||
| 1056 | struct pci_slot *slot; | ||
| 1057 | |||
| 1058 | list_for_each_entry(slot, &dev->bus->slots, list) { | ||
| 1059 | if (slot->number != PCI_SLOT(dev->devfn)) | ||
| 1060 | continue; | ||
| 1061 | result = sysfs_create_link(&dev->dev.kobj, &slot->kobj, "slot"); | ||
| 1062 | if (result) | ||
| 1063 | goto out; | ||
| 1064 | snprintf(func, 10, "function%d", PCI_FUNC(dev->devfn)); | ||
| 1065 | result = sysfs_create_link(&slot->kobj, &dev->dev.kobj, func); | ||
| 1066 | } | ||
| 1067 | out: | ||
| 1068 | return result; | ||
| 1069 | } | ||
| 1070 | |||
| 1071 | int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | 1038 | int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) |
| 1072 | { | 1039 | { |
| 1073 | int retval; | 1040 | int retval; |
| @@ -1130,8 +1097,6 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | |||
| 1130 | if (retval) | 1097 | if (retval) |
| 1131 | goto err_vga_file; | 1098 | goto err_vga_file; |
| 1132 | 1099 | ||
| 1133 | pci_create_slot_links(pdev); | ||
| 1134 | |||
| 1135 | return 0; | 1100 | return 0; |
| 1136 | 1101 | ||
| 1137 | err_vga_file: | 1102 | err_vga_file: |
| @@ -1181,8 +1146,6 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev) | |||
| 1181 | if (!sysfs_initialized) | 1146 | if (!sysfs_initialized) |
| 1182 | return; | 1147 | return; |
| 1183 | 1148 | ||
| 1184 | pci_remove_slot_links(pdev); | ||
| 1185 | |||
| 1186 | pci_remove_capabilities_sysfs(pdev); | 1149 | pci_remove_capabilities_sysfs(pdev); |
| 1187 | 1150 | ||
| 1188 | if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) | 1151 | if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index b7512cf08c58..477345d41641 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
| @@ -1457,7 +1457,8 @@ static void quirk_jmicron_ata(struct pci_dev *pdev) | |||
| 1457 | conf5 &= ~(1 << 24); /* Clear bit 24 */ | 1457 | conf5 &= ~(1 << 24); /* Clear bit 24 */ |
| 1458 | 1458 | ||
| 1459 | switch (pdev->device) { | 1459 | switch (pdev->device) { |
| 1460 | case PCI_DEVICE_ID_JMICRON_JMB360: | 1460 | case PCI_DEVICE_ID_JMICRON_JMB360: /* SATA single port */ |
| 1461 | case PCI_DEVICE_ID_JMICRON_JMB362: /* SATA dual ports */ | ||
| 1461 | /* The controller should be in single function ahci mode */ | 1462 | /* The controller should be in single function ahci mode */ |
| 1462 | conf1 |= 0x0002A100; /* Set 8, 13, 15, 17 */ | 1463 | conf1 |= 0x0002A100; /* Set 8, 13, 15, 17 */ |
| 1463 | break; | 1464 | break; |
| @@ -1493,12 +1494,14 @@ static void quirk_jmicron_ata(struct pci_dev *pdev) | |||
| 1493 | } | 1494 | } |
| 1494 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata); | 1495 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata); |
| 1495 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata); | 1496 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata); |
| 1497 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB362, quirk_jmicron_ata); | ||
| 1496 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata); | 1498 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata); |
| 1497 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata); | 1499 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata); |
| 1498 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata); | 1500 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata); |
| 1499 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, quirk_jmicron_ata); | 1501 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, quirk_jmicron_ata); |
| 1500 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata); | 1502 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata); |
| 1501 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata); | 1503 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata); |
| 1504 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB362, quirk_jmicron_ata); | ||
| 1502 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata); | 1505 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata); |
| 1503 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata); | 1506 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata); |
| 1504 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata); | 1507 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata); |
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 17bed18d24ad..92379e2d37e7 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
| @@ -97,16 +97,16 @@ int pci_claim_resource(struct pci_dev *dev, int resource) | |||
| 97 | 97 | ||
| 98 | root = pci_find_parent_resource(dev, res); | 98 | root = pci_find_parent_resource(dev, res); |
| 99 | if (!root) { | 99 | if (!root) { |
| 100 | dev_err(&dev->dev, "no compatible bridge window for %pR\n", | 100 | dev_info(&dev->dev, "no compatible bridge window for %pR\n", |
| 101 | res); | 101 | res); |
| 102 | return -EINVAL; | 102 | return -EINVAL; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | conflict = request_resource_conflict(root, res); | 105 | conflict = request_resource_conflict(root, res); |
| 106 | if (conflict) { | 106 | if (conflict) { |
| 107 | dev_err(&dev->dev, | 107 | dev_info(&dev->dev, |
| 108 | "address space collision: %pR conflicts with %s %pR\n", | 108 | "address space collision: %pR conflicts with %s %pR\n", |
| 109 | res, conflict->name, conflict); | 109 | res, conflict->name, conflict); |
| 110 | return -EBUSY; | 110 | return -EBUSY; |
| 111 | } | 111 | } |
| 112 | 112 | ||
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index e0189cf7c558..659eaa0fc48f 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c | |||
| @@ -97,50 +97,6 @@ static ssize_t cur_speed_read_file(struct pci_slot *slot, char *buf) | |||
| 97 | return bus_speed_read(slot->bus->cur_bus_speed, buf); | 97 | return bus_speed_read(slot->bus->cur_bus_speed, buf); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | static void remove_sysfs_files(struct pci_slot *slot) | ||
| 101 | { | ||
| 102 | char func[10]; | ||
| 103 | struct list_head *tmp; | ||
| 104 | |||
| 105 | list_for_each(tmp, &slot->bus->devices) { | ||
| 106 | struct pci_dev *dev = pci_dev_b(tmp); | ||
| 107 | if (PCI_SLOT(dev->devfn) != slot->number) | ||
| 108 | continue; | ||
| 109 | sysfs_remove_link(&dev->dev.kobj, "slot"); | ||
| 110 | |||
| 111 | snprintf(func, 10, "function%d", PCI_FUNC(dev->devfn)); | ||
| 112 | sysfs_remove_link(&slot->kobj, func); | ||
| 113 | } | ||
| 114 | } | ||
| 115 | |||
| 116 | static int create_sysfs_files(struct pci_slot *slot) | ||
| 117 | { | ||
| 118 | int result; | ||
| 119 | char func[10]; | ||
| 120 | struct list_head *tmp; | ||
| 121 | |||
| 122 | list_for_each(tmp, &slot->bus->devices) { | ||
| 123 | struct pci_dev *dev = pci_dev_b(tmp); | ||
| 124 | if (PCI_SLOT(dev->devfn) != slot->number) | ||
| 125 | continue; | ||
| 126 | |||
| 127 | result = sysfs_create_link(&dev->dev.kobj, &slot->kobj, "slot"); | ||
| 128 | if (result) | ||
| 129 | goto fail; | ||
| 130 | |||
| 131 | snprintf(func, 10, "function%d", PCI_FUNC(dev->devfn)); | ||
| 132 | result = sysfs_create_link(&slot->kobj, &dev->dev.kobj, func); | ||
| 133 | if (result) | ||
| 134 | goto fail; | ||
| 135 | } | ||
| 136 | |||
| 137 | return 0; | ||
| 138 | |||
| 139 | fail: | ||
| 140 | remove_sysfs_files(slot); | ||
| 141 | return result; | ||
| 142 | } | ||
| 143 | |||
| 144 | static void pci_slot_release(struct kobject *kobj) | 100 | static void pci_slot_release(struct kobject *kobj) |
| 145 | { | 101 | { |
| 146 | struct pci_dev *dev; | 102 | struct pci_dev *dev; |
| @@ -153,8 +109,6 @@ static void pci_slot_release(struct kobject *kobj) | |||
| 153 | if (PCI_SLOT(dev->devfn) == slot->number) | 109 | if (PCI_SLOT(dev->devfn) == slot->number) |
| 154 | dev->slot = NULL; | 110 | dev->slot = NULL; |
| 155 | 111 | ||
| 156 | remove_sysfs_files(slot); | ||
| 157 | |||
| 158 | list_del(&slot->list); | 112 | list_del(&slot->list); |
| 159 | 113 | ||
| 160 | kfree(slot); | 114 | kfree(slot); |
| @@ -346,8 +300,6 @@ placeholder: | |||
| 346 | INIT_LIST_HEAD(&slot->list); | 300 | INIT_LIST_HEAD(&slot->list); |
| 347 | list_add(&slot->list, &parent->slots); | 301 | list_add(&slot->list, &parent->slots); |
| 348 | 302 | ||
| 349 | create_sysfs_files(slot); | ||
| 350 | |||
| 351 | list_for_each_entry(dev, &parent->devices, bus_list) | 303 | list_for_each_entry(dev, &parent->devices, bus_list) |
| 352 | if (PCI_SLOT(dev->devfn) == slot_nr) | 304 | if (PCI_SLOT(dev->devfn) == slot_nr) |
| 353 | dev->slot = slot; | 305 | dev->slot = slot; |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 7ef7adee5e4f..9fc339845538 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
| @@ -671,6 +671,7 @@ static void pcmcia_requery(struct pcmcia_socket *s) | |||
| 671 | if (old_funcs != new_funcs) { | 671 | if (old_funcs != new_funcs) { |
| 672 | /* we need to re-start */ | 672 | /* we need to re-start */ |
| 673 | pcmcia_card_remove(s, NULL); | 673 | pcmcia_card_remove(s, NULL); |
| 674 | s->functions = 0; | ||
| 674 | pcmcia_card_add(s); | 675 | pcmcia_card_add(s); |
| 675 | } | 676 | } |
| 676 | } | 677 | } |
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 424e576f3acb..f1d41374eea7 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c | |||
| @@ -880,6 +880,12 @@ static struct cardbus_type cardbus_type[] = { | |||
| 880 | .restore_state = ti_restore_state, | 880 | .restore_state = ti_restore_state, |
| 881 | .sock_init = ti_init, | 881 | .sock_init = ti_init, |
| 882 | }, | 882 | }, |
| 883 | [CARDBUS_TYPE_ENE] = { | ||
| 884 | .override = ene_override, | ||
| 885 | .save_state = ti_save_state, | ||
| 886 | .restore_state = ti_restore_state, | ||
| 887 | .sock_init = ti_init, | ||
| 888 | }, | ||
| 883 | #endif | 889 | #endif |
| 884 | #ifdef CONFIG_YENTA_RICOH | 890 | #ifdef CONFIG_YENTA_RICOH |
| 885 | [CARDBUS_TYPE_RICOH] = { | 891 | [CARDBUS_TYPE_RICOH] = { |
| @@ -902,14 +908,6 @@ static struct cardbus_type cardbus_type[] = { | |||
| 902 | .restore_state = o2micro_restore_state, | 908 | .restore_state = o2micro_restore_state, |
| 903 | }, | 909 | }, |
| 904 | #endif | 910 | #endif |
| 905 | #ifdef CONFIG_YENTA_TI | ||
| 906 | [CARDBUS_TYPE_ENE] = { | ||
| 907 | .override = ene_override, | ||
| 908 | .save_state = ti_save_state, | ||
| 909 | .restore_state = ti_restore_state, | ||
| 910 | .sock_init = ti_init, | ||
| 911 | }, | ||
| 912 | #endif | ||
| 913 | }; | 911 | }; |
| 914 | 912 | ||
| 915 | 913 | ||
| @@ -975,7 +973,7 @@ static irqreturn_t yenta_probe_handler(int irq, void *dev_id) | |||
| 975 | /* probes the PCI interrupt, use only on override functions */ | 973 | /* probes the PCI interrupt, use only on override functions */ |
| 976 | static int yenta_probe_cb_irq(struct yenta_socket *socket) | 974 | static int yenta_probe_cb_irq(struct yenta_socket *socket) |
| 977 | { | 975 | { |
| 978 | u8 reg; | 976 | u8 reg = 0; |
| 979 | 977 | ||
| 980 | if (!socket->cb_irq) | 978 | if (!socket->cb_irq) |
| 981 | return -1; | 979 | return -1; |
| @@ -989,7 +987,8 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket) | |||
| 989 | } | 987 | } |
| 990 | 988 | ||
| 991 | /* generate interrupt, wait */ | 989 | /* generate interrupt, wait */ |
| 992 | reg = exca_readb(socket, I365_CSCINT); | 990 | if (!socket->dev->irq) |
| 991 | reg = exca_readb(socket, I365_CSCINT); | ||
| 993 | exca_writeb(socket, I365_CSCINT, reg | I365_CSC_STSCHG); | 992 | exca_writeb(socket, I365_CSCINT, reg | I365_CSC_STSCHG); |
| 994 | cb_writel(socket, CB_SOCKET_EVENT, -1); | 993 | cb_writel(socket, CB_SOCKET_EVENT, -1); |
| 995 | cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK); | 994 | cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK); |
diff --git a/drivers/s390/cio/itcw.c b/drivers/s390/cio/itcw.c index 17da9ab932ed..a0ae29564774 100644 --- a/drivers/s390/cio/itcw.c +++ b/drivers/s390/cio/itcw.c | |||
| @@ -42,7 +42,7 @@ | |||
| 42 | * size_t size; | 42 | * size_t size; |
| 43 | * | 43 | * |
| 44 | * size = itcw_calc_size(1, 2, 0); | 44 | * size = itcw_calc_size(1, 2, 0); |
| 45 | * buffer = kmalloc(size, GFP_DMA); | 45 | * buffer = kmalloc(size, GFP_KERNEL | GFP_DMA); |
| 46 | * if (!buffer) | 46 | * if (!buffer) |
| 47 | * return -ENOMEM; | 47 | * return -ENOMEM; |
| 48 | * itcw = itcw_init(buffer, size, ITCW_OP_READ, 1, 2, 0); | 48 | * itcw = itcw_init(buffer, size, ITCW_OP_READ, 1, 2, 0); |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 0f41c9195e9b..df5b6b971f26 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
| @@ -637,7 +637,7 @@ const static struct file_operations vhost_net_fops = { | |||
| 637 | }; | 637 | }; |
| 638 | 638 | ||
| 639 | static struct miscdevice vhost_net_misc = { | 639 | static struct miscdevice vhost_net_misc = { |
| 640 | VHOST_NET_MINOR, | 640 | MISC_DYNAMIC_MINOR, |
| 641 | "vhost-net", | 641 | "vhost-net", |
| 642 | &vhost_net_fops, | 642 | &vhost_net_fops, |
| 643 | }; | 643 | }; |
diff --git a/drivers/watchdog/wm8350_wdt.c b/drivers/watchdog/wm8350_wdt.c index 89dd7b035295..b68d928c8f90 100644 --- a/drivers/watchdog/wm8350_wdt.c +++ b/drivers/watchdog/wm8350_wdt.c | |||
| @@ -284,7 +284,7 @@ static int __devinit wm8350_wdt_probe(struct platform_device *pdev) | |||
| 284 | struct wm8350 *wm8350 = platform_get_drvdata(pdev); | 284 | struct wm8350 *wm8350 = platform_get_drvdata(pdev); |
| 285 | 285 | ||
| 286 | if (!wm8350) { | 286 | if (!wm8350) { |
| 287 | dev_err(wm8350->dev, "No driver data supplied\n"); | 287 | pr_err("No driver data supplied\n"); |
| 288 | return -ENODEV; | 288 | return -ENODEV; |
| 289 | } | 289 | } |
| 290 | 290 | ||
diff --git a/fs/block_dev.c b/fs/block_dev.c index 7346c96308a5..99d6af811747 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
| @@ -706,8 +706,13 @@ retry: | |||
| 706 | * @bdev is about to be opened exclusively. Check @bdev can be opened | 706 | * @bdev is about to be opened exclusively. Check @bdev can be opened |
| 707 | * exclusively and mark that an exclusive open is in progress. Each | 707 | * exclusively and mark that an exclusive open is in progress. Each |
| 708 | * successful call to this function must be matched with a call to | 708 | * successful call to this function must be matched with a call to |
| 709 | * either bd_claim() or bd_abort_claiming(). If this function | 709 | * either bd_finish_claiming() or bd_abort_claiming() (which do not |
| 710 | * succeeds, the matching bd_claim() is guaranteed to succeed. | 710 | * fail). |
| 711 | * | ||
| 712 | * This function is used to gain exclusive access to the block device | ||
| 713 | * without actually causing other exclusive open attempts to fail. It | ||
| 714 | * should be used when the open sequence itself requires exclusive | ||
| 715 | * access but may subsequently fail. | ||
| 711 | * | 716 | * |
| 712 | * CONTEXT: | 717 | * CONTEXT: |
| 713 | * Might sleep. | 718 | * Might sleep. |
| @@ -734,6 +739,7 @@ static struct block_device *bd_start_claiming(struct block_device *bdev, | |||
| 734 | return ERR_PTR(-ENXIO); | 739 | return ERR_PTR(-ENXIO); |
| 735 | 740 | ||
| 736 | whole = bdget_disk(disk, 0); | 741 | whole = bdget_disk(disk, 0); |
| 742 | module_put(disk->fops->owner); | ||
| 737 | put_disk(disk); | 743 | put_disk(disk); |
| 738 | if (!whole) | 744 | if (!whole) |
| 739 | return ERR_PTR(-ENOMEM); | 745 | return ERR_PTR(-ENOMEM); |
| @@ -782,15 +788,46 @@ static void bd_abort_claiming(struct block_device *whole, void *holder) | |||
| 782 | __bd_abort_claiming(whole, holder); /* releases bdev_lock */ | 788 | __bd_abort_claiming(whole, holder); /* releases bdev_lock */ |
| 783 | } | 789 | } |
| 784 | 790 | ||
| 791 | /* increment holders when we have a legitimate claim. requires bdev_lock */ | ||
| 792 | static void __bd_claim(struct block_device *bdev, struct block_device *whole, | ||
| 793 | void *holder) | ||
| 794 | { | ||
| 795 | /* note that for a whole device bd_holders | ||
| 796 | * will be incremented twice, and bd_holder will | ||
| 797 | * be set to bd_claim before being set to holder | ||
| 798 | */ | ||
| 799 | whole->bd_holders++; | ||
| 800 | whole->bd_holder = bd_claim; | ||
| 801 | bdev->bd_holders++; | ||
| 802 | bdev->bd_holder = holder; | ||
| 803 | } | ||
| 804 | |||
| 805 | /** | ||
| 806 | * bd_finish_claiming - finish claiming a block device | ||
| 807 | * @bdev: block device of interest (passed to bd_start_claiming()) | ||
| 808 | * @whole: whole block device returned by bd_start_claiming() | ||
| 809 | * @holder: holder trying to claim @bdev | ||
| 810 | * | ||
| 811 | * Finish a claiming block started by bd_start_claiming(). | ||
| 812 | * | ||
| 813 | * CONTEXT: | ||
| 814 | * Grabs and releases bdev_lock. | ||
| 815 | */ | ||
| 816 | static void bd_finish_claiming(struct block_device *bdev, | ||
| 817 | struct block_device *whole, void *holder) | ||
| 818 | { | ||
| 819 | spin_lock(&bdev_lock); | ||
| 820 | BUG_ON(!bd_may_claim(bdev, whole, holder)); | ||
| 821 | __bd_claim(bdev, whole, holder); | ||
| 822 | __bd_abort_claiming(whole, holder); /* not actually an abort */ | ||
| 823 | } | ||
| 824 | |||
| 785 | /** | 825 | /** |
| 786 | * bd_claim - claim a block device | 826 | * bd_claim - claim a block device |
| 787 | * @bdev: block device to claim | 827 | * @bdev: block device to claim |
| 788 | * @holder: holder trying to claim @bdev | 828 | * @holder: holder trying to claim @bdev |
| 789 | * | 829 | * |
| 790 | * Try to claim @bdev which must have been opened successfully. This | 830 | * Try to claim @bdev which must have been opened successfully. |
| 791 | * function may be called with or without preceding | ||
| 792 | * blk_start_claiming(). In the former case, this function is always | ||
| 793 | * successful and terminates the claiming block. | ||
| 794 | * | 831 | * |
| 795 | * CONTEXT: | 832 | * CONTEXT: |
| 796 | * Might sleep. | 833 | * Might sleep. |
| @@ -806,23 +843,10 @@ int bd_claim(struct block_device *bdev, void *holder) | |||
| 806 | might_sleep(); | 843 | might_sleep(); |
| 807 | 844 | ||
| 808 | spin_lock(&bdev_lock); | 845 | spin_lock(&bdev_lock); |
| 809 | |||
| 810 | res = bd_prepare_to_claim(bdev, whole, holder); | 846 | res = bd_prepare_to_claim(bdev, whole, holder); |
| 811 | if (res == 0) { | 847 | if (res == 0) |
| 812 | /* note that for a whole device bd_holders | 848 | __bd_claim(bdev, whole, holder); |
| 813 | * will be incremented twice, and bd_holder will | 849 | spin_unlock(&bdev_lock); |
| 814 | * be set to bd_claim before being set to holder | ||
| 815 | */ | ||
| 816 | whole->bd_holders++; | ||
| 817 | whole->bd_holder = bd_claim; | ||
| 818 | bdev->bd_holders++; | ||
| 819 | bdev->bd_holder = holder; | ||
| 820 | } | ||
| 821 | |||
| 822 | if (whole->bd_claiming) | ||
| 823 | __bd_abort_claiming(whole, holder); /* releases bdev_lock */ | ||
| 824 | else | ||
| 825 | spin_unlock(&bdev_lock); | ||
| 826 | 850 | ||
| 827 | return res; | 851 | return res; |
| 828 | } | 852 | } |
| @@ -1476,7 +1500,7 @@ static int blkdev_open(struct inode * inode, struct file * filp) | |||
| 1476 | 1500 | ||
| 1477 | if (whole) { | 1501 | if (whole) { |
| 1478 | if (res == 0) | 1502 | if (res == 0) |
| 1479 | BUG_ON(bd_claim(bdev, filp) != 0); | 1503 | bd_finish_claiming(bdev, whole, filp); |
| 1480 | else | 1504 | else |
| 1481 | bd_abort_claiming(whole, filp); | 1505 | bd_abort_claiming(whole, filp); |
| 1482 | } | 1506 | } |
| @@ -1712,7 +1736,7 @@ struct block_device *open_bdev_exclusive(const char *path, fmode_t mode, void *h | |||
| 1712 | if ((mode & FMODE_WRITE) && bdev_read_only(bdev)) | 1736 | if ((mode & FMODE_WRITE) && bdev_read_only(bdev)) |
| 1713 | goto out_blkdev_put; | 1737 | goto out_blkdev_put; |
| 1714 | 1738 | ||
| 1715 | BUG_ON(bd_claim(bdev, holder) != 0); | 1739 | bd_finish_claiming(bdev, whole, holder); |
| 1716 | return bdev; | 1740 | return bdev; |
| 1717 | 1741 | ||
| 1718 | out_blkdev_put: | 1742 | out_blkdev_put: |
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 8d432cd9d580..2222d161c7b6 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
| @@ -60,6 +60,8 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type) | |||
| 60 | size = __btrfs_getxattr(inode, name, value, size); | 60 | size = __btrfs_getxattr(inode, name, value, size); |
| 61 | if (size > 0) { | 61 | if (size > 0) { |
| 62 | acl = posix_acl_from_xattr(value, size); | 62 | acl = posix_acl_from_xattr(value, size); |
| 63 | if (IS_ERR(acl)) | ||
| 64 | return acl; | ||
| 63 | set_cached_acl(inode, type, acl); | 65 | set_cached_acl(inode, type, acl); |
| 64 | } | 66 | } |
| 65 | kfree(value); | 67 | kfree(value); |
| @@ -160,6 +162,12 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name, | |||
| 160 | int ret; | 162 | int ret; |
| 161 | struct posix_acl *acl = NULL; | 163 | struct posix_acl *acl = NULL; |
| 162 | 164 | ||
| 165 | if (!is_owner_or_cap(dentry->d_inode)) | ||
| 166 | return -EPERM; | ||
| 167 | |||
| 168 | if (!IS_POSIXACL(dentry->d_inode)) | ||
| 169 | return -EOPNOTSUPP; | ||
| 170 | |||
| 163 | if (value) { | 171 | if (value) { |
| 164 | acl = posix_acl_from_xattr(value, size); | 172 | acl = posix_acl_from_xattr(value, size); |
| 165 | if (acl == NULL) { | 173 | if (acl == NULL) { |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f3b287c22caf..34f7c375567e 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -1941,8 +1941,11 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
| 1941 | btrfs_level_size(tree_root, | 1941 | btrfs_level_size(tree_root, |
| 1942 | btrfs_super_log_root_level(disk_super)); | 1942 | btrfs_super_log_root_level(disk_super)); |
| 1943 | 1943 | ||
| 1944 | log_tree_root = kzalloc(sizeof(struct btrfs_root), | 1944 | log_tree_root = kzalloc(sizeof(struct btrfs_root), GFP_NOFS); |
| 1945 | GFP_NOFS); | 1945 | if (!log_tree_root) { |
| 1946 | err = -ENOMEM; | ||
| 1947 | goto fail_trans_kthread; | ||
| 1948 | } | ||
| 1946 | 1949 | ||
| 1947 | __setup_root(nodesize, leafsize, sectorsize, stripesize, | 1950 | __setup_root(nodesize, leafsize, sectorsize, stripesize, |
| 1948 | log_tree_root, fs_info, BTRFS_TREE_LOG_OBJECTID); | 1951 | log_tree_root, fs_info, BTRFS_TREE_LOG_OBJECTID); |
| @@ -1982,6 +1985,10 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
| 1982 | fs_info->fs_root = btrfs_read_fs_root_no_name(fs_info, &location); | 1985 | fs_info->fs_root = btrfs_read_fs_root_no_name(fs_info, &location); |
| 1983 | if (!fs_info->fs_root) | 1986 | if (!fs_info->fs_root) |
| 1984 | goto fail_trans_kthread; | 1987 | goto fail_trans_kthread; |
| 1988 | if (IS_ERR(fs_info->fs_root)) { | ||
| 1989 | err = PTR_ERR(fs_info->fs_root); | ||
| 1990 | goto fail_trans_kthread; | ||
| 1991 | } | ||
| 1985 | 1992 | ||
| 1986 | if (!(sb->s_flags & MS_RDONLY)) { | 1993 | if (!(sb->s_flags & MS_RDONLY)) { |
| 1987 | down_read(&fs_info->cleanup_work_sem); | 1994 | down_read(&fs_info->cleanup_work_sem); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index b9080d71991a..32d094002a57 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -4360,7 +4360,8 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans, | |||
| 4360 | 4360 | ||
| 4361 | block_rsv = get_block_rsv(trans, root); | 4361 | block_rsv = get_block_rsv(trans, root); |
| 4362 | cache = btrfs_lookup_block_group(root->fs_info, buf->start); | 4362 | cache = btrfs_lookup_block_group(root->fs_info, buf->start); |
| 4363 | BUG_ON(block_rsv->space_info != cache->space_info); | 4363 | if (block_rsv->space_info != cache->space_info) |
| 4364 | goto out; | ||
| 4364 | 4365 | ||
| 4365 | if (btrfs_header_generation(buf) == trans->transid) { | 4366 | if (btrfs_header_generation(buf) == trans->transid) { |
| 4366 | if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) { | 4367 | if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) { |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 787b50a16a14..e354c33df082 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
| @@ -1140,7 +1140,7 @@ int btrfs_sync_file(struct file *file, int datasync) | |||
| 1140 | /* | 1140 | /* |
| 1141 | * ok we haven't committed the transaction yet, lets do a commit | 1141 | * ok we haven't committed the transaction yet, lets do a commit |
| 1142 | */ | 1142 | */ |
| 1143 | if (file && file->private_data) | 1143 | if (file->private_data) |
| 1144 | btrfs_ioctl_trans_end(file); | 1144 | btrfs_ioctl_trans_end(file); |
| 1145 | 1145 | ||
| 1146 | trans = btrfs_start_transaction(root, 0); | 1146 | trans = btrfs_start_transaction(root, 0); |
| @@ -1190,14 +1190,22 @@ static const struct vm_operations_struct btrfs_file_vm_ops = { | |||
| 1190 | 1190 | ||
| 1191 | static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma) | 1191 | static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma) |
| 1192 | { | 1192 | { |
| 1193 | vma->vm_ops = &btrfs_file_vm_ops; | 1193 | struct address_space *mapping = filp->f_mapping; |
| 1194 | |||
| 1195 | if (!mapping->a_ops->readpage) | ||
| 1196 | return -ENOEXEC; | ||
| 1197 | |||
| 1194 | file_accessed(filp); | 1198 | file_accessed(filp); |
| 1199 | vma->vm_ops = &btrfs_file_vm_ops; | ||
| 1200 | vma->vm_flags |= VM_CAN_NONLINEAR; | ||
| 1201 | |||
| 1195 | return 0; | 1202 | return 0; |
| 1196 | } | 1203 | } |
| 1197 | 1204 | ||
| 1198 | const struct file_operations btrfs_file_operations = { | 1205 | const struct file_operations btrfs_file_operations = { |
| 1199 | .llseek = generic_file_llseek, | 1206 | .llseek = generic_file_llseek, |
| 1200 | .read = do_sync_read, | 1207 | .read = do_sync_read, |
| 1208 | .write = do_sync_write, | ||
| 1201 | .aio_read = generic_file_aio_read, | 1209 | .aio_read = generic_file_aio_read, |
| 1202 | .splice_read = generic_file_splice_read, | 1210 | .splice_read = generic_file_splice_read, |
| 1203 | .aio_write = btrfs_file_aio_write, | 1211 | .aio_write = btrfs_file_aio_write, |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index fa6ccc1bfe2a..1bff92ad4744 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -2673,7 +2673,7 @@ static int check_path_shared(struct btrfs_root *root, | |||
| 2673 | struct extent_buffer *eb; | 2673 | struct extent_buffer *eb; |
| 2674 | int level; | 2674 | int level; |
| 2675 | int ret; | 2675 | int ret; |
| 2676 | u64 refs; | 2676 | u64 refs = 1; |
| 2677 | 2677 | ||
| 2678 | for (level = 0; level < BTRFS_MAX_LEVEL; level++) { | 2678 | for (level = 0; level < BTRFS_MAX_LEVEL; level++) { |
| 2679 | if (!path->nodes[level]) | 2679 | if (!path->nodes[level]) |
| @@ -6884,7 +6884,7 @@ static long btrfs_fallocate(struct inode *inode, int mode, | |||
| 6884 | if (em->block_start == EXTENT_MAP_HOLE || | 6884 | if (em->block_start == EXTENT_MAP_HOLE || |
| 6885 | (cur_offset >= inode->i_size && | 6885 | (cur_offset >= inode->i_size && |
| 6886 | !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { | 6886 | !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { |
| 6887 | ret = btrfs_prealloc_file_range(inode, 0, cur_offset, | 6887 | ret = btrfs_prealloc_file_range(inode, mode, cur_offset, |
| 6888 | last_byte - cur_offset, | 6888 | last_byte - cur_offset, |
| 6889 | 1 << inode->i_blkbits, | 6889 | 1 << inode->i_blkbits, |
| 6890 | offset + len, | 6890 | offset + len, |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 4cdb98cf26de..4dbaf89b1337 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -1280,7 +1280,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, | |||
| 1280 | trans = btrfs_start_transaction(root, 0); | 1280 | trans = btrfs_start_transaction(root, 0); |
| 1281 | if (IS_ERR(trans)) { | 1281 | if (IS_ERR(trans)) { |
| 1282 | err = PTR_ERR(trans); | 1282 | err = PTR_ERR(trans); |
| 1283 | goto out; | 1283 | goto out_up_write; |
| 1284 | } | 1284 | } |
| 1285 | trans->block_rsv = &root->fs_info->global_block_rsv; | 1285 | trans->block_rsv = &root->fs_info->global_block_rsv; |
| 1286 | 1286 | ||
| @@ -1845,7 +1845,7 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp) | |||
| 1845 | dir_id = btrfs_super_root_dir(&root->fs_info->super_copy); | 1845 | dir_id = btrfs_super_root_dir(&root->fs_info->super_copy); |
| 1846 | di = btrfs_lookup_dir_item(trans, root->fs_info->tree_root, path, | 1846 | di = btrfs_lookup_dir_item(trans, root->fs_info->tree_root, path, |
| 1847 | dir_id, "default", 7, 1); | 1847 | dir_id, "default", 7, 1); |
| 1848 | if (!di) { | 1848 | if (IS_ERR_OR_NULL(di)) { |
| 1849 | btrfs_free_path(path); | 1849 | btrfs_free_path(path); |
| 1850 | btrfs_end_transaction(trans, root); | 1850 | btrfs_end_transaction(trans, root); |
| 1851 | printk(KERN_ERR "Umm, you don't have the default dir item, " | 1851 | printk(KERN_ERR "Umm, you don't have the default dir item, " |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 05d41e569236..b37d723b9d4a 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
| @@ -784,16 +784,17 @@ again: | |||
| 784 | struct btrfs_extent_ref_v0 *ref0; | 784 | struct btrfs_extent_ref_v0 *ref0; |
| 785 | ref0 = btrfs_item_ptr(eb, path1->slots[0], | 785 | ref0 = btrfs_item_ptr(eb, path1->slots[0], |
| 786 | struct btrfs_extent_ref_v0); | 786 | struct btrfs_extent_ref_v0); |
| 787 | root = find_tree_root(rc, eb, ref0); | ||
| 788 | if (!root->ref_cows) | ||
| 789 | cur->cowonly = 1; | ||
| 790 | if (key.objectid == key.offset) { | 787 | if (key.objectid == key.offset) { |
| 788 | root = find_tree_root(rc, eb, ref0); | ||
| 791 | if (root && !should_ignore_root(root)) | 789 | if (root && !should_ignore_root(root)) |
| 792 | cur->root = root; | 790 | cur->root = root; |
| 793 | else | 791 | else |
| 794 | list_add(&cur->list, &useless); | 792 | list_add(&cur->list, &useless); |
| 795 | break; | 793 | break; |
| 796 | } | 794 | } |
| 795 | if (is_cowonly_root(btrfs_ref_root_v0(eb, | ||
| 796 | ref0))) | ||
| 797 | cur->cowonly = 1; | ||
| 797 | } | 798 | } |
| 798 | #else | 799 | #else |
| 799 | BUG_ON(key.type == BTRFS_EXTENT_REF_V0_KEY); | 800 | BUG_ON(key.type == BTRFS_EXTENT_REF_V0_KEY); |
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index b91ccd972644..2d958be761c8 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c | |||
| @@ -330,7 +330,6 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
| 330 | { | 330 | { |
| 331 | struct btrfs_path *path; | 331 | struct btrfs_path *path; |
| 332 | int ret; | 332 | int ret; |
| 333 | u32 refs; | ||
| 334 | struct btrfs_root_item *ri; | 333 | struct btrfs_root_item *ri; |
| 335 | struct extent_buffer *leaf; | 334 | struct extent_buffer *leaf; |
| 336 | 335 | ||
| @@ -344,8 +343,6 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
| 344 | leaf = path->nodes[0]; | 343 | leaf = path->nodes[0]; |
| 345 | ri = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_root_item); | 344 | ri = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_root_item); |
| 346 | 345 | ||
| 347 | refs = btrfs_disk_root_refs(leaf, ri); | ||
| 348 | BUG_ON(refs != 0); | ||
| 349 | ret = btrfs_del_item(trans, root, path); | 346 | ret = btrfs_del_item(trans, root, path); |
| 350 | out: | 347 | out: |
| 351 | btrfs_free_path(path); | 348 | btrfs_free_path(path); |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index d34b2dfc9628..f2393b390318 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -360,6 +360,8 @@ static struct dentry *get_default_root(struct super_block *sb, | |||
| 360 | */ | 360 | */ |
| 361 | dir_id = btrfs_super_root_dir(&root->fs_info->super_copy); | 361 | dir_id = btrfs_super_root_dir(&root->fs_info->super_copy); |
| 362 | di = btrfs_lookup_dir_item(NULL, root, path, dir_id, "default", 7, 0); | 362 | di = btrfs_lookup_dir_item(NULL, root, path, dir_id, "default", 7, 0); |
| 363 | if (IS_ERR(di)) | ||
| 364 | return ERR_CAST(di); | ||
| 363 | if (!di) { | 365 | if (!di) { |
| 364 | /* | 366 | /* |
| 365 | * Ok the default dir item isn't there. This is weird since | 367 | * Ok the default dir item isn't there. This is weird since |
| @@ -390,8 +392,8 @@ setup_root: | |||
| 390 | location.offset = 0; | 392 | location.offset = 0; |
| 391 | 393 | ||
| 392 | inode = btrfs_iget(sb, &location, new_root, &new); | 394 | inode = btrfs_iget(sb, &location, new_root, &new); |
| 393 | if (!inode) | 395 | if (IS_ERR(inode)) |
| 394 | return ERR_PTR(-ENOMEM); | 396 | return ERR_CAST(inode); |
| 395 | 397 | ||
| 396 | /* | 398 | /* |
| 397 | * If we're just mounting the root most subvol put the inode and return | 399 | * If we're just mounting the root most subvol put the inode and return |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index ae3e3a306445..619b61655ee5 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
| @@ -981,6 +981,46 @@ static int send_cap_msg(struct ceph_mds_session *session, | |||
| 981 | return 0; | 981 | return 0; |
| 982 | } | 982 | } |
| 983 | 983 | ||
| 984 | static void __queue_cap_release(struct ceph_mds_session *session, | ||
| 985 | u64 ino, u64 cap_id, u32 migrate_seq, | ||
| 986 | u32 issue_seq) | ||
| 987 | { | ||
| 988 | struct ceph_msg *msg; | ||
| 989 | struct ceph_mds_cap_release *head; | ||
| 990 | struct ceph_mds_cap_item *item; | ||
| 991 | |||
| 992 | spin_lock(&session->s_cap_lock); | ||
| 993 | BUG_ON(!session->s_num_cap_releases); | ||
| 994 | msg = list_first_entry(&session->s_cap_releases, | ||
| 995 | struct ceph_msg, list_head); | ||
| 996 | |||
| 997 | dout(" adding %llx release to mds%d msg %p (%d left)\n", | ||
| 998 | ino, session->s_mds, msg, session->s_num_cap_releases); | ||
| 999 | |||
| 1000 | BUG_ON(msg->front.iov_len + sizeof(*item) > PAGE_CACHE_SIZE); | ||
| 1001 | head = msg->front.iov_base; | ||
| 1002 | head->num = cpu_to_le32(le32_to_cpu(head->num) + 1); | ||
| 1003 | item = msg->front.iov_base + msg->front.iov_len; | ||
| 1004 | item->ino = cpu_to_le64(ino); | ||
| 1005 | item->cap_id = cpu_to_le64(cap_id); | ||
| 1006 | item->migrate_seq = cpu_to_le32(migrate_seq); | ||
| 1007 | item->seq = cpu_to_le32(issue_seq); | ||
| 1008 | |||
| 1009 | session->s_num_cap_releases--; | ||
| 1010 | |||
| 1011 | msg->front.iov_len += sizeof(*item); | ||
| 1012 | if (le32_to_cpu(head->num) == CEPH_CAPS_PER_RELEASE) { | ||
| 1013 | dout(" release msg %p full\n", msg); | ||
| 1014 | list_move_tail(&msg->list_head, &session->s_cap_releases_done); | ||
| 1015 | } else { | ||
| 1016 | dout(" release msg %p at %d/%d (%d)\n", msg, | ||
| 1017 | (int)le32_to_cpu(head->num), | ||
| 1018 | (int)CEPH_CAPS_PER_RELEASE, | ||
| 1019 | (int)msg->front.iov_len); | ||
| 1020 | } | ||
| 1021 | spin_unlock(&session->s_cap_lock); | ||
| 1022 | } | ||
| 1023 | |||
| 984 | /* | 1024 | /* |
| 985 | * Queue cap releases when an inode is dropped from our cache. Since | 1025 | * Queue cap releases when an inode is dropped from our cache. Since |
| 986 | * inode is about to be destroyed, there is no need for i_lock. | 1026 | * inode is about to be destroyed, there is no need for i_lock. |
| @@ -994,41 +1034,9 @@ void ceph_queue_caps_release(struct inode *inode) | |||
| 994 | while (p) { | 1034 | while (p) { |
| 995 | struct ceph_cap *cap = rb_entry(p, struct ceph_cap, ci_node); | 1035 | struct ceph_cap *cap = rb_entry(p, struct ceph_cap, ci_node); |
| 996 | struct ceph_mds_session *session = cap->session; | 1036 | struct ceph_mds_session *session = cap->session; |
| 997 | struct ceph_msg *msg; | ||
| 998 | struct ceph_mds_cap_release *head; | ||
| 999 | struct ceph_mds_cap_item *item; | ||
| 1000 | 1037 | ||
| 1001 | spin_lock(&session->s_cap_lock); | 1038 | __queue_cap_release(session, ceph_ino(inode), cap->cap_id, |
| 1002 | BUG_ON(!session->s_num_cap_releases); | 1039 | cap->mseq, cap->issue_seq); |
| 1003 | msg = list_first_entry(&session->s_cap_releases, | ||
| 1004 | struct ceph_msg, list_head); | ||
| 1005 | |||
| 1006 | dout(" adding %p release to mds%d msg %p (%d left)\n", | ||
| 1007 | inode, session->s_mds, msg, session->s_num_cap_releases); | ||
| 1008 | |||
| 1009 | BUG_ON(msg->front.iov_len + sizeof(*item) > PAGE_CACHE_SIZE); | ||
| 1010 | head = msg->front.iov_base; | ||
| 1011 | head->num = cpu_to_le32(le32_to_cpu(head->num) + 1); | ||
| 1012 | item = msg->front.iov_base + msg->front.iov_len; | ||
| 1013 | item->ino = cpu_to_le64(ceph_ino(inode)); | ||
| 1014 | item->cap_id = cpu_to_le64(cap->cap_id); | ||
| 1015 | item->migrate_seq = cpu_to_le32(cap->mseq); | ||
| 1016 | item->seq = cpu_to_le32(cap->issue_seq); | ||
| 1017 | |||
| 1018 | session->s_num_cap_releases--; | ||
| 1019 | |||
| 1020 | msg->front.iov_len += sizeof(*item); | ||
| 1021 | if (le32_to_cpu(head->num) == CEPH_CAPS_PER_RELEASE) { | ||
| 1022 | dout(" release msg %p full\n", msg); | ||
| 1023 | list_move_tail(&msg->list_head, | ||
| 1024 | &session->s_cap_releases_done); | ||
| 1025 | } else { | ||
| 1026 | dout(" release msg %p at %d/%d (%d)\n", msg, | ||
| 1027 | (int)le32_to_cpu(head->num), | ||
| 1028 | (int)CEPH_CAPS_PER_RELEASE, | ||
| 1029 | (int)msg->front.iov_len); | ||
| 1030 | } | ||
| 1031 | spin_unlock(&session->s_cap_lock); | ||
| 1032 | p = rb_next(p); | 1040 | p = rb_next(p); |
| 1033 | __ceph_remove_cap(cap); | 1041 | __ceph_remove_cap(cap); |
| 1034 | } | 1042 | } |
| @@ -2655,7 +2663,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
| 2655 | struct ceph_mds_caps *h; | 2663 | struct ceph_mds_caps *h; |
| 2656 | int mds = session->s_mds; | 2664 | int mds = session->s_mds; |
| 2657 | int op; | 2665 | int op; |
| 2658 | u32 seq; | 2666 | u32 seq, mseq; |
| 2659 | struct ceph_vino vino; | 2667 | struct ceph_vino vino; |
| 2660 | u64 cap_id; | 2668 | u64 cap_id; |
| 2661 | u64 size, max_size; | 2669 | u64 size, max_size; |
| @@ -2675,6 +2683,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
| 2675 | vino.snap = CEPH_NOSNAP; | 2683 | vino.snap = CEPH_NOSNAP; |
| 2676 | cap_id = le64_to_cpu(h->cap_id); | 2684 | cap_id = le64_to_cpu(h->cap_id); |
| 2677 | seq = le32_to_cpu(h->seq); | 2685 | seq = le32_to_cpu(h->seq); |
| 2686 | mseq = le32_to_cpu(h->migrate_seq); | ||
| 2678 | size = le64_to_cpu(h->size); | 2687 | size = le64_to_cpu(h->size); |
| 2679 | max_size = le64_to_cpu(h->max_size); | 2688 | max_size = le64_to_cpu(h->max_size); |
| 2680 | 2689 | ||
| @@ -2689,6 +2698,18 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
| 2689 | vino.snap, inode); | 2698 | vino.snap, inode); |
| 2690 | if (!inode) { | 2699 | if (!inode) { |
| 2691 | dout(" i don't have ino %llx\n", vino.ino); | 2700 | dout(" i don't have ino %llx\n", vino.ino); |
| 2701 | |||
| 2702 | if (op == CEPH_CAP_OP_IMPORT) | ||
| 2703 | __queue_cap_release(session, vino.ino, cap_id, | ||
| 2704 | mseq, seq); | ||
| 2705 | |||
| 2706 | /* | ||
| 2707 | * send any full release message to try to move things | ||
| 2708 | * along for the mds (who clearly thinks we still have this | ||
| 2709 | * cap). | ||
| 2710 | */ | ||
| 2711 | ceph_add_cap_releases(mdsc, session, -1); | ||
| 2712 | ceph_send_cap_releases(mdsc, session); | ||
| 2692 | goto done; | 2713 | goto done; |
| 2693 | } | 2714 | } |
| 2694 | 2715 | ||
| @@ -2714,7 +2735,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
| 2714 | spin_lock(&inode->i_lock); | 2735 | spin_lock(&inode->i_lock); |
| 2715 | cap = __get_cap_for_mds(ceph_inode(inode), mds); | 2736 | cap = __get_cap_for_mds(ceph_inode(inode), mds); |
| 2716 | if (!cap) { | 2737 | if (!cap) { |
| 2717 | dout("no cap on %p ino %llx.%llx from mds%d, releasing\n", | 2738 | dout(" no cap on %p ino %llx.%llx from mds%d\n", |
| 2718 | inode, ceph_ino(inode), ceph_snap(inode), mds); | 2739 | inode, ceph_ino(inode), ceph_snap(inode), mds); |
| 2719 | spin_unlock(&inode->i_lock); | 2740 | spin_unlock(&inode->i_lock); |
| 2720 | goto done; | 2741 | goto done; |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 226f5a50d362..ab47f46ca282 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
| @@ -827,7 +827,7 @@ static void ceph_set_dentry_offset(struct dentry *dn) | |||
| 827 | 827 | ||
| 828 | spin_lock(&dcache_lock); | 828 | spin_lock(&dcache_lock); |
| 829 | spin_lock(&dn->d_lock); | 829 | spin_lock(&dn->d_lock); |
| 830 | list_move_tail(&dir->d_subdirs, &dn->d_u.d_child); | 830 | list_move(&dn->d_u.d_child, &dir->d_subdirs); |
| 831 | dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset, | 831 | dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset, |
| 832 | dn->d_u.d_child.prev, dn->d_u.d_child.next); | 832 | dn->d_u.d_child.prev, dn->d_u.d_child.next); |
| 833 | spin_unlock(&dn->d_lock); | 833 | spin_unlock(&dn->d_lock); |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index b49f12822cbc..1766947fc07a 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
| @@ -1066,9 +1066,9 @@ static int trim_caps(struct ceph_mds_client *mdsc, | |||
| 1066 | * | 1066 | * |
| 1067 | * Called under s_mutex. | 1067 | * Called under s_mutex. |
| 1068 | */ | 1068 | */ |
| 1069 | static int add_cap_releases(struct ceph_mds_client *mdsc, | 1069 | int ceph_add_cap_releases(struct ceph_mds_client *mdsc, |
| 1070 | struct ceph_mds_session *session, | 1070 | struct ceph_mds_session *session, |
| 1071 | int extra) | 1071 | int extra) |
| 1072 | { | 1072 | { |
| 1073 | struct ceph_msg *msg; | 1073 | struct ceph_msg *msg; |
| 1074 | struct ceph_mds_cap_release *head; | 1074 | struct ceph_mds_cap_release *head; |
| @@ -1176,8 +1176,8 @@ static int check_cap_flush(struct ceph_mds_client *mdsc, u64 want_flush_seq) | |||
| 1176 | /* | 1176 | /* |
| 1177 | * called under s_mutex | 1177 | * called under s_mutex |
| 1178 | */ | 1178 | */ |
| 1179 | static void send_cap_releases(struct ceph_mds_client *mdsc, | 1179 | void ceph_send_cap_releases(struct ceph_mds_client *mdsc, |
| 1180 | struct ceph_mds_session *session) | 1180 | struct ceph_mds_session *session) |
| 1181 | { | 1181 | { |
| 1182 | struct ceph_msg *msg; | 1182 | struct ceph_msg *msg; |
| 1183 | 1183 | ||
| @@ -1980,7 +1980,7 @@ out_err: | |||
| 1980 | } | 1980 | } |
| 1981 | mutex_unlock(&mdsc->mutex); | 1981 | mutex_unlock(&mdsc->mutex); |
| 1982 | 1982 | ||
| 1983 | add_cap_releases(mdsc, req->r_session, -1); | 1983 | ceph_add_cap_releases(mdsc, req->r_session, -1); |
| 1984 | mutex_unlock(&session->s_mutex); | 1984 | mutex_unlock(&session->s_mutex); |
| 1985 | 1985 | ||
| 1986 | /* kick calling process */ | 1986 | /* kick calling process */ |
| @@ -2433,6 +2433,7 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
| 2433 | struct ceph_dentry_info *di; | 2433 | struct ceph_dentry_info *di; |
| 2434 | int mds = session->s_mds; | 2434 | int mds = session->s_mds; |
| 2435 | struct ceph_mds_lease *h = msg->front.iov_base; | 2435 | struct ceph_mds_lease *h = msg->front.iov_base; |
| 2436 | u32 seq; | ||
| 2436 | struct ceph_vino vino; | 2437 | struct ceph_vino vino; |
| 2437 | int mask; | 2438 | int mask; |
| 2438 | struct qstr dname; | 2439 | struct qstr dname; |
| @@ -2446,6 +2447,7 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
| 2446 | vino.ino = le64_to_cpu(h->ino); | 2447 | vino.ino = le64_to_cpu(h->ino); |
| 2447 | vino.snap = CEPH_NOSNAP; | 2448 | vino.snap = CEPH_NOSNAP; |
| 2448 | mask = le16_to_cpu(h->mask); | 2449 | mask = le16_to_cpu(h->mask); |
| 2450 | seq = le32_to_cpu(h->seq); | ||
| 2449 | dname.name = (void *)h + sizeof(*h) + sizeof(u32); | 2451 | dname.name = (void *)h + sizeof(*h) + sizeof(u32); |
| 2450 | dname.len = msg->front.iov_len - sizeof(*h) - sizeof(u32); | 2452 | dname.len = msg->front.iov_len - sizeof(*h) - sizeof(u32); |
| 2451 | if (dname.len != get_unaligned_le32(h+1)) | 2453 | if (dname.len != get_unaligned_le32(h+1)) |
| @@ -2456,8 +2458,9 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
| 2456 | 2458 | ||
| 2457 | /* lookup inode */ | 2459 | /* lookup inode */ |
| 2458 | inode = ceph_find_inode(sb, vino); | 2460 | inode = ceph_find_inode(sb, vino); |
| 2459 | dout("handle_lease '%s', mask %d, ino %llx %p\n", | 2461 | dout("handle_lease %s, mask %d, ino %llx %p %.*s\n", |
| 2460 | ceph_lease_op_name(h->action), mask, vino.ino, inode); | 2462 | ceph_lease_op_name(h->action), mask, vino.ino, inode, |
| 2463 | dname.len, dname.name); | ||
| 2461 | if (inode == NULL) { | 2464 | if (inode == NULL) { |
| 2462 | dout("handle_lease no inode %llx\n", vino.ino); | 2465 | dout("handle_lease no inode %llx\n", vino.ino); |
| 2463 | goto release; | 2466 | goto release; |
| @@ -2482,7 +2485,8 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
| 2482 | switch (h->action) { | 2485 | switch (h->action) { |
| 2483 | case CEPH_MDS_LEASE_REVOKE: | 2486 | case CEPH_MDS_LEASE_REVOKE: |
| 2484 | if (di && di->lease_session == session) { | 2487 | if (di && di->lease_session == session) { |
| 2485 | h->seq = cpu_to_le32(di->lease_seq); | 2488 | if (ceph_seq_cmp(di->lease_seq, seq) > 0) |
| 2489 | h->seq = cpu_to_le32(di->lease_seq); | ||
| 2486 | __ceph_mdsc_drop_dentry_lease(dentry); | 2490 | __ceph_mdsc_drop_dentry_lease(dentry); |
| 2487 | } | 2491 | } |
| 2488 | release = 1; | 2492 | release = 1; |
| @@ -2496,7 +2500,7 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
| 2496 | unsigned long duration = | 2500 | unsigned long duration = |
| 2497 | le32_to_cpu(h->duration_ms) * HZ / 1000; | 2501 | le32_to_cpu(h->duration_ms) * HZ / 1000; |
| 2498 | 2502 | ||
| 2499 | di->lease_seq = le32_to_cpu(h->seq); | 2503 | di->lease_seq = seq; |
| 2500 | dentry->d_time = di->lease_renew_from + duration; | 2504 | dentry->d_time = di->lease_renew_from + duration; |
| 2501 | di->lease_renew_after = di->lease_renew_from + | 2505 | di->lease_renew_after = di->lease_renew_from + |
| 2502 | (duration >> 1); | 2506 | (duration >> 1); |
| @@ -2686,10 +2690,10 @@ static void delayed_work(struct work_struct *work) | |||
| 2686 | send_renew_caps(mdsc, s); | 2690 | send_renew_caps(mdsc, s); |
| 2687 | else | 2691 | else |
| 2688 | ceph_con_keepalive(&s->s_con); | 2692 | ceph_con_keepalive(&s->s_con); |
| 2689 | add_cap_releases(mdsc, s, -1); | 2693 | ceph_add_cap_releases(mdsc, s, -1); |
| 2690 | if (s->s_state == CEPH_MDS_SESSION_OPEN || | 2694 | if (s->s_state == CEPH_MDS_SESSION_OPEN || |
| 2691 | s->s_state == CEPH_MDS_SESSION_HUNG) | 2695 | s->s_state == CEPH_MDS_SESSION_HUNG) |
| 2692 | send_cap_releases(mdsc, s); | 2696 | ceph_send_cap_releases(mdsc, s); |
| 2693 | mutex_unlock(&s->s_mutex); | 2697 | mutex_unlock(&s->s_mutex); |
| 2694 | ceph_put_mds_session(s); | 2698 | ceph_put_mds_session(s); |
| 2695 | 2699 | ||
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index d9936c4f1212..b292fa42a66d 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h | |||
| @@ -322,6 +322,12 @@ static inline void ceph_mdsc_put_request(struct ceph_mds_request *req) | |||
| 322 | kref_put(&req->r_kref, ceph_mdsc_release_request); | 322 | kref_put(&req->r_kref, ceph_mdsc_release_request); |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | extern int ceph_add_cap_releases(struct ceph_mds_client *mdsc, | ||
| 326 | struct ceph_mds_session *session, | ||
| 327 | int extra); | ||
| 328 | extern void ceph_send_cap_releases(struct ceph_mds_client *mdsc, | ||
| 329 | struct ceph_mds_session *session); | ||
| 330 | |||
| 325 | extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc); | 331 | extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc); |
| 326 | 332 | ||
| 327 | extern char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base, | 333 | extern char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base, |
diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c index 21c62e9b7d1d..07a539906e67 100644 --- a/fs/ceph/mon_client.c +++ b/fs/ceph/mon_client.c | |||
| @@ -400,6 +400,8 @@ static void release_generic_request(struct kref *kref) | |||
| 400 | ceph_msg_put(req->reply); | 400 | ceph_msg_put(req->reply); |
| 401 | if (req->request) | 401 | if (req->request) |
| 402 | ceph_msg_put(req->request); | 402 | ceph_msg_put(req->request); |
| 403 | |||
| 404 | kfree(req); | ||
| 403 | } | 405 | } |
| 404 | 406 | ||
| 405 | static void put_generic_request(struct ceph_mon_generic_request *req) | 407 | static void put_generic_request(struct ceph_mon_generic_request *req) |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 4e0bee240b9d..fa87f51e38e1 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
| @@ -89,7 +89,7 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 89 | 89 | ||
| 90 | buf->f_files = le64_to_cpu(st.num_objects); | 90 | buf->f_files = le64_to_cpu(st.num_objects); |
| 91 | buf->f_ffree = -1; | 91 | buf->f_ffree = -1; |
| 92 | buf->f_namelen = PATH_MAX; | 92 | buf->f_namelen = NAME_MAX; |
| 93 | buf->f_frsize = PAGE_CACHE_SIZE; | 93 | buf->f_frsize = PAGE_CACHE_SIZE; |
| 94 | 94 | ||
| 95 | /* leave fsid little-endian, regardless of host endianness */ | 95 | /* leave fsid little-endian, regardless of host endianness */ |
| @@ -926,7 +926,7 @@ static int ceph_compare_super(struct super_block *sb, void *data) | |||
| 926 | /* | 926 | /* |
| 927 | * construct our own bdi so we can control readahead, etc. | 927 | * construct our own bdi so we can control readahead, etc. |
| 928 | */ | 928 | */ |
| 929 | static atomic_long_t bdi_seq = ATOMIC_INIT(0); | 929 | static atomic_long_t bdi_seq = ATOMIC_LONG_INIT(0); |
| 930 | 930 | ||
| 931 | static int ceph_register_bdi(struct super_block *sb, struct ceph_client *client) | 931 | static int ceph_register_bdi(struct super_block *sb, struct ceph_client *client) |
| 932 | { | 932 | { |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 19df61c321fd..42272d67955a 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
| @@ -4942,20 +4942,26 @@ void ext4_set_inode_flags(struct inode *inode) | |||
| 4942 | /* Propagate flags from i_flags to EXT4_I(inode)->i_flags */ | 4942 | /* Propagate flags from i_flags to EXT4_I(inode)->i_flags */ |
| 4943 | void ext4_get_inode_flags(struct ext4_inode_info *ei) | 4943 | void ext4_get_inode_flags(struct ext4_inode_info *ei) |
| 4944 | { | 4944 | { |
| 4945 | unsigned int flags = ei->vfs_inode.i_flags; | 4945 | unsigned int vfs_fl; |
| 4946 | 4946 | unsigned long old_fl, new_fl; | |
| 4947 | ei->i_flags &= ~(EXT4_SYNC_FL|EXT4_APPEND_FL| | 4947 | |
| 4948 | EXT4_IMMUTABLE_FL|EXT4_NOATIME_FL|EXT4_DIRSYNC_FL); | 4948 | do { |
| 4949 | if (flags & S_SYNC) | 4949 | vfs_fl = ei->vfs_inode.i_flags; |
| 4950 | ei->i_flags |= EXT4_SYNC_FL; | 4950 | old_fl = ei->i_flags; |
| 4951 | if (flags & S_APPEND) | 4951 | new_fl = old_fl & ~(EXT4_SYNC_FL|EXT4_APPEND_FL| |
| 4952 | ei->i_flags |= EXT4_APPEND_FL; | 4952 | EXT4_IMMUTABLE_FL|EXT4_NOATIME_FL| |
| 4953 | if (flags & S_IMMUTABLE) | 4953 | EXT4_DIRSYNC_FL); |
| 4954 | ei->i_flags |= EXT4_IMMUTABLE_FL; | 4954 | if (vfs_fl & S_SYNC) |
| 4955 | if (flags & S_NOATIME) | 4955 | new_fl |= EXT4_SYNC_FL; |
| 4956 | ei->i_flags |= EXT4_NOATIME_FL; | 4956 | if (vfs_fl & S_APPEND) |
| 4957 | if (flags & S_DIRSYNC) | 4957 | new_fl |= EXT4_APPEND_FL; |
| 4958 | ei->i_flags |= EXT4_DIRSYNC_FL; | 4958 | if (vfs_fl & S_IMMUTABLE) |
| 4959 | new_fl |= EXT4_IMMUTABLE_FL; | ||
| 4960 | if (vfs_fl & S_NOATIME) | ||
| 4961 | new_fl |= EXT4_NOATIME_FL; | ||
| 4962 | if (vfs_fl & S_DIRSYNC) | ||
| 4963 | new_fl |= EXT4_DIRSYNC_FL; | ||
| 4964 | } while (cmpxchg(&ei->i_flags, old_fl, new_fl) != old_fl); | ||
| 4959 | } | 4965 | } |
| 4960 | 4966 | ||
| 4961 | static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode, | 4967 | static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode, |
| @@ -5191,7 +5197,7 @@ static int ext4_inode_blocks_set(handle_t *handle, | |||
| 5191 | */ | 5197 | */ |
| 5192 | raw_inode->i_blocks_lo = cpu_to_le32(i_blocks); | 5198 | raw_inode->i_blocks_lo = cpu_to_le32(i_blocks); |
| 5193 | raw_inode->i_blocks_high = 0; | 5199 | raw_inode->i_blocks_high = 0; |
| 5194 | ei->i_flags &= ~EXT4_HUGE_FILE_FL; | 5200 | ext4_clear_inode_flag(inode, EXT4_INODE_HUGE_FILE); |
| 5195 | return 0; | 5201 | return 0; |
| 5196 | } | 5202 | } |
| 5197 | if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) | 5203 | if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) |
| @@ -5204,9 +5210,9 @@ static int ext4_inode_blocks_set(handle_t *handle, | |||
| 5204 | */ | 5210 | */ |
| 5205 | raw_inode->i_blocks_lo = cpu_to_le32(i_blocks); | 5211 | raw_inode->i_blocks_lo = cpu_to_le32(i_blocks); |
| 5206 | raw_inode->i_blocks_high = cpu_to_le16(i_blocks >> 32); | 5212 | raw_inode->i_blocks_high = cpu_to_le16(i_blocks >> 32); |
| 5207 | ei->i_flags &= ~EXT4_HUGE_FILE_FL; | 5213 | ext4_clear_inode_flag(inode, EXT4_INODE_HUGE_FILE); |
| 5208 | } else { | 5214 | } else { |
| 5209 | ei->i_flags |= EXT4_HUGE_FILE_FL; | 5215 | ext4_set_inode_flag(inode, EXT4_INODE_HUGE_FILE); |
| 5210 | /* i_block is stored in file system block size */ | 5216 | /* i_block is stored in file system block size */ |
| 5211 | i_blocks = i_blocks >> (inode->i_blkbits - 9); | 5217 | i_blocks = i_blocks >> (inode->i_blkbits - 9); |
| 5212 | raw_inode->i_blocks_lo = cpu_to_le32(i_blocks); | 5218 | raw_inode->i_blocks_lo = cpu_to_le32(i_blocks); |
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 3a6c92ac131c..52abfa12762a 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
| @@ -960,6 +960,9 @@ mext_check_arguments(struct inode *orig_inode, | |||
| 960 | return -EINVAL; | 960 | return -EINVAL; |
| 961 | } | 961 | } |
| 962 | 962 | ||
| 963 | if (IS_IMMUTABLE(donor_inode) || IS_APPEND(donor_inode)) | ||
| 964 | return -EPERM; | ||
| 965 | |||
| 963 | /* Ext4 move extent does not support swapfile */ | 966 | /* Ext4 move extent does not support swapfile */ |
| 964 | if (IS_SWAPFILE(orig_inode) || IS_SWAPFILE(donor_inode)) { | 967 | if (IS_SWAPFILE(orig_inode) || IS_SWAPFILE(donor_inode)) { |
| 965 | ext4_debug("ext4 move extent: The argument files should " | 968 | ext4_debug("ext4 move extent: The argument files should " |
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index a33aab6b5e68..54a92fd02bbd 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c | |||
| @@ -234,8 +234,9 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl) | |||
| 234 | if (inode->i_mode != mode) { | 234 | if (inode->i_mode != mode) { |
| 235 | struct iattr attr; | 235 | struct iattr attr; |
| 236 | 236 | ||
| 237 | attr.ia_valid = ATTR_MODE; | 237 | attr.ia_valid = ATTR_MODE | ATTR_CTIME; |
| 238 | attr.ia_mode = mode; | 238 | attr.ia_mode = mode; |
| 239 | attr.ia_ctime = CURRENT_TIME_SEC; | ||
| 239 | rc = jffs2_do_setattr(inode, &attr); | 240 | rc = jffs2_do_setattr(inode, &attr); |
| 240 | if (rc < 0) | 241 | if (rc < 0) |
| 241 | return rc; | 242 | return rc; |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 7aa4417e085f..166062a68230 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
| @@ -222,15 +222,18 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, | |||
| 222 | dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(ri->ctime)); | 222 | dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(ri->ctime)); |
| 223 | 223 | ||
| 224 | jffs2_free_raw_inode(ri); | 224 | jffs2_free_raw_inode(ri); |
| 225 | d_instantiate(dentry, inode); | ||
| 226 | 225 | ||
| 227 | D1(printk(KERN_DEBUG "jffs2_create: Created ino #%lu with mode %o, nlink %d(%d). nrpages %ld\n", | 226 | D1(printk(KERN_DEBUG "jffs2_create: Created ino #%lu with mode %o, nlink %d(%d). nrpages %ld\n", |
| 228 | inode->i_ino, inode->i_mode, inode->i_nlink, | 227 | inode->i_ino, inode->i_mode, inode->i_nlink, |
| 229 | f->inocache->pino_nlink, inode->i_mapping->nrpages)); | 228 | f->inocache->pino_nlink, inode->i_mapping->nrpages)); |
| 229 | |||
| 230 | d_instantiate(dentry, inode); | ||
| 231 | unlock_new_inode(inode); | ||
| 230 | return 0; | 232 | return 0; |
| 231 | 233 | ||
| 232 | fail: | 234 | fail: |
| 233 | make_bad_inode(inode); | 235 | make_bad_inode(inode); |
| 236 | unlock_new_inode(inode); | ||
| 234 | iput(inode); | 237 | iput(inode); |
| 235 | jffs2_free_raw_inode(ri); | 238 | jffs2_free_raw_inode(ri); |
| 236 | return ret; | 239 | return ret; |
| @@ -360,8 +363,8 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
| 360 | /* Eeek. Wave bye bye */ | 363 | /* Eeek. Wave bye bye */ |
| 361 | mutex_unlock(&f->sem); | 364 | mutex_unlock(&f->sem); |
| 362 | jffs2_complete_reservation(c); | 365 | jffs2_complete_reservation(c); |
| 363 | jffs2_clear_inode(inode); | 366 | ret = PTR_ERR(fn); |
| 364 | return PTR_ERR(fn); | 367 | goto fail; |
| 365 | } | 368 | } |
| 366 | 369 | ||
| 367 | /* We use f->target field to store the target path. */ | 370 | /* We use f->target field to store the target path. */ |
| @@ -370,8 +373,8 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
| 370 | printk(KERN_WARNING "Can't allocate %d bytes of memory\n", targetlen + 1); | 373 | printk(KERN_WARNING "Can't allocate %d bytes of memory\n", targetlen + 1); |
| 371 | mutex_unlock(&f->sem); | 374 | mutex_unlock(&f->sem); |
| 372 | jffs2_complete_reservation(c); | 375 | jffs2_complete_reservation(c); |
| 373 | jffs2_clear_inode(inode); | 376 | ret = -ENOMEM; |
| 374 | return -ENOMEM; | 377 | goto fail; |
| 375 | } | 378 | } |
| 376 | 379 | ||
| 377 | memcpy(f->target, target, targetlen + 1); | 380 | memcpy(f->target, target, targetlen + 1); |
| @@ -386,30 +389,24 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
| 386 | jffs2_complete_reservation(c); | 389 | jffs2_complete_reservation(c); |
| 387 | 390 | ||
| 388 | ret = jffs2_init_security(inode, dir_i); | 391 | ret = jffs2_init_security(inode, dir_i); |
| 389 | if (ret) { | 392 | if (ret) |
| 390 | jffs2_clear_inode(inode); | 393 | goto fail; |
| 391 | return ret; | 394 | |
| 392 | } | ||
| 393 | ret = jffs2_init_acl_post(inode); | 395 | ret = jffs2_init_acl_post(inode); |
| 394 | if (ret) { | 396 | if (ret) |
| 395 | jffs2_clear_inode(inode); | 397 | goto fail; |
| 396 | return ret; | ||
| 397 | } | ||
| 398 | 398 | ||
| 399 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, | 399 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, |
| 400 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | 400 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); |
| 401 | if (ret) { | 401 | if (ret) |
| 402 | /* Eep. */ | 402 | goto fail; |
| 403 | jffs2_clear_inode(inode); | ||
| 404 | return ret; | ||
| 405 | } | ||
| 406 | 403 | ||
| 407 | rd = jffs2_alloc_raw_dirent(); | 404 | rd = jffs2_alloc_raw_dirent(); |
| 408 | if (!rd) { | 405 | if (!rd) { |
| 409 | /* Argh. Now we treat it like a normal delete */ | 406 | /* Argh. Now we treat it like a normal delete */ |
| 410 | jffs2_complete_reservation(c); | 407 | jffs2_complete_reservation(c); |
| 411 | jffs2_clear_inode(inode); | 408 | ret = -ENOMEM; |
| 412 | return -ENOMEM; | 409 | goto fail; |
| 413 | } | 410 | } |
| 414 | 411 | ||
| 415 | dir_f = JFFS2_INODE_INFO(dir_i); | 412 | dir_f = JFFS2_INODE_INFO(dir_i); |
| @@ -437,8 +434,8 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
| 437 | jffs2_complete_reservation(c); | 434 | jffs2_complete_reservation(c); |
| 438 | jffs2_free_raw_dirent(rd); | 435 | jffs2_free_raw_dirent(rd); |
| 439 | mutex_unlock(&dir_f->sem); | 436 | mutex_unlock(&dir_f->sem); |
| 440 | jffs2_clear_inode(inode); | 437 | ret = PTR_ERR(fd); |
| 441 | return PTR_ERR(fd); | 438 | goto fail; |
| 442 | } | 439 | } |
| 443 | 440 | ||
| 444 | dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); | 441 | dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); |
| @@ -453,7 +450,14 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
| 453 | jffs2_complete_reservation(c); | 450 | jffs2_complete_reservation(c); |
| 454 | 451 | ||
| 455 | d_instantiate(dentry, inode); | 452 | d_instantiate(dentry, inode); |
| 453 | unlock_new_inode(inode); | ||
| 456 | return 0; | 454 | return 0; |
| 455 | |||
| 456 | fail: | ||
| 457 | make_bad_inode(inode); | ||
| 458 | unlock_new_inode(inode); | ||
| 459 | iput(inode); | ||
| 460 | return ret; | ||
| 457 | } | 461 | } |
| 458 | 462 | ||
| 459 | 463 | ||
| @@ -519,8 +523,8 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | |||
| 519 | /* Eeek. Wave bye bye */ | 523 | /* Eeek. Wave bye bye */ |
| 520 | mutex_unlock(&f->sem); | 524 | mutex_unlock(&f->sem); |
| 521 | jffs2_complete_reservation(c); | 525 | jffs2_complete_reservation(c); |
| 522 | jffs2_clear_inode(inode); | 526 | ret = PTR_ERR(fn); |
| 523 | return PTR_ERR(fn); | 527 | goto fail; |
| 524 | } | 528 | } |
| 525 | /* No data here. Only a metadata node, which will be | 529 | /* No data here. Only a metadata node, which will be |
| 526 | obsoleted by the first data write | 530 | obsoleted by the first data write |
| @@ -531,30 +535,24 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | |||
| 531 | jffs2_complete_reservation(c); | 535 | jffs2_complete_reservation(c); |
| 532 | 536 | ||
| 533 | ret = jffs2_init_security(inode, dir_i); | 537 | ret = jffs2_init_security(inode, dir_i); |
| 534 | if (ret) { | 538 | if (ret) |
| 535 | jffs2_clear_inode(inode); | 539 | goto fail; |
| 536 | return ret; | 540 | |
| 537 | } | ||
| 538 | ret = jffs2_init_acl_post(inode); | 541 | ret = jffs2_init_acl_post(inode); |
| 539 | if (ret) { | 542 | if (ret) |
| 540 | jffs2_clear_inode(inode); | 543 | goto fail; |
| 541 | return ret; | ||
| 542 | } | ||
| 543 | 544 | ||
| 544 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, | 545 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, |
| 545 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | 546 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); |
| 546 | if (ret) { | 547 | if (ret) |
| 547 | /* Eep. */ | 548 | goto fail; |
| 548 | jffs2_clear_inode(inode); | ||
| 549 | return ret; | ||
| 550 | } | ||
| 551 | 549 | ||
| 552 | rd = jffs2_alloc_raw_dirent(); | 550 | rd = jffs2_alloc_raw_dirent(); |
| 553 | if (!rd) { | 551 | if (!rd) { |
| 554 | /* Argh. Now we treat it like a normal delete */ | 552 | /* Argh. Now we treat it like a normal delete */ |
| 555 | jffs2_complete_reservation(c); | 553 | jffs2_complete_reservation(c); |
| 556 | jffs2_clear_inode(inode); | 554 | ret = -ENOMEM; |
| 557 | return -ENOMEM; | 555 | goto fail; |
| 558 | } | 556 | } |
| 559 | 557 | ||
| 560 | dir_f = JFFS2_INODE_INFO(dir_i); | 558 | dir_f = JFFS2_INODE_INFO(dir_i); |
| @@ -582,8 +580,8 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | |||
| 582 | jffs2_complete_reservation(c); | 580 | jffs2_complete_reservation(c); |
| 583 | jffs2_free_raw_dirent(rd); | 581 | jffs2_free_raw_dirent(rd); |
| 584 | mutex_unlock(&dir_f->sem); | 582 | mutex_unlock(&dir_f->sem); |
| 585 | jffs2_clear_inode(inode); | 583 | ret = PTR_ERR(fd); |
| 586 | return PTR_ERR(fd); | 584 | goto fail; |
| 587 | } | 585 | } |
| 588 | 586 | ||
| 589 | dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); | 587 | dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); |
| @@ -599,7 +597,14 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | |||
| 599 | jffs2_complete_reservation(c); | 597 | jffs2_complete_reservation(c); |
| 600 | 598 | ||
| 601 | d_instantiate(dentry, inode); | 599 | d_instantiate(dentry, inode); |
| 600 | unlock_new_inode(inode); | ||
| 602 | return 0; | 601 | return 0; |
| 602 | |||
| 603 | fail: | ||
| 604 | make_bad_inode(inode); | ||
| 605 | unlock_new_inode(inode); | ||
| 606 | iput(inode); | ||
| 607 | return ret; | ||
| 603 | } | 608 | } |
| 604 | 609 | ||
| 605 | static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry) | 610 | static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry) |
| @@ -693,8 +698,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de | |||
| 693 | /* Eeek. Wave bye bye */ | 698 | /* Eeek. Wave bye bye */ |
| 694 | mutex_unlock(&f->sem); | 699 | mutex_unlock(&f->sem); |
| 695 | jffs2_complete_reservation(c); | 700 | jffs2_complete_reservation(c); |
| 696 | jffs2_clear_inode(inode); | 701 | ret = PTR_ERR(fn); |
| 697 | return PTR_ERR(fn); | 702 | goto fail; |
| 698 | } | 703 | } |
| 699 | /* No data here. Only a metadata node, which will be | 704 | /* No data here. Only a metadata node, which will be |
| 700 | obsoleted by the first data write | 705 | obsoleted by the first data write |
| @@ -705,30 +710,24 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de | |||
| 705 | jffs2_complete_reservation(c); | 710 | jffs2_complete_reservation(c); |
| 706 | 711 | ||
| 707 | ret = jffs2_init_security(inode, dir_i); | 712 | ret = jffs2_init_security(inode, dir_i); |
| 708 | if (ret) { | 713 | if (ret) |
| 709 | jffs2_clear_inode(inode); | 714 | goto fail; |
| 710 | return ret; | 715 | |
| 711 | } | ||
| 712 | ret = jffs2_init_acl_post(inode); | 716 | ret = jffs2_init_acl_post(inode); |
| 713 | if (ret) { | 717 | if (ret) |
| 714 | jffs2_clear_inode(inode); | 718 | goto fail; |
| 715 | return ret; | ||
| 716 | } | ||
| 717 | 719 | ||
| 718 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, | 720 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, |
| 719 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | 721 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); |
| 720 | if (ret) { | 722 | if (ret) |
| 721 | /* Eep. */ | 723 | goto fail; |
| 722 | jffs2_clear_inode(inode); | ||
| 723 | return ret; | ||
| 724 | } | ||
| 725 | 724 | ||
| 726 | rd = jffs2_alloc_raw_dirent(); | 725 | rd = jffs2_alloc_raw_dirent(); |
| 727 | if (!rd) { | 726 | if (!rd) { |
| 728 | /* Argh. Now we treat it like a normal delete */ | 727 | /* Argh. Now we treat it like a normal delete */ |
| 729 | jffs2_complete_reservation(c); | 728 | jffs2_complete_reservation(c); |
| 730 | jffs2_clear_inode(inode); | 729 | ret = -ENOMEM; |
| 731 | return -ENOMEM; | 730 | goto fail; |
| 732 | } | 731 | } |
| 733 | 732 | ||
| 734 | dir_f = JFFS2_INODE_INFO(dir_i); | 733 | dir_f = JFFS2_INODE_INFO(dir_i); |
| @@ -759,8 +758,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de | |||
| 759 | jffs2_complete_reservation(c); | 758 | jffs2_complete_reservation(c); |
| 760 | jffs2_free_raw_dirent(rd); | 759 | jffs2_free_raw_dirent(rd); |
| 761 | mutex_unlock(&dir_f->sem); | 760 | mutex_unlock(&dir_f->sem); |
| 762 | jffs2_clear_inode(inode); | 761 | ret = PTR_ERR(fd); |
| 763 | return PTR_ERR(fd); | 762 | goto fail; |
| 764 | } | 763 | } |
| 765 | 764 | ||
| 766 | dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); | 765 | dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); |
| @@ -775,8 +774,14 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de | |||
| 775 | jffs2_complete_reservation(c); | 774 | jffs2_complete_reservation(c); |
| 776 | 775 | ||
| 777 | d_instantiate(dentry, inode); | 776 | d_instantiate(dentry, inode); |
| 778 | 777 | unlock_new_inode(inode); | |
| 779 | return 0; | 778 | return 0; |
| 779 | |||
| 780 | fail: | ||
| 781 | make_bad_inode(inode); | ||
| 782 | unlock_new_inode(inode); | ||
| 783 | iput(inode); | ||
| 784 | return ret; | ||
| 780 | } | 785 | } |
| 781 | 786 | ||
| 782 | static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | 787 | static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 8bc2c80ab159..459d39d1ea0b 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
| @@ -465,7 +465,12 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i | |||
| 465 | inode->i_blocks = 0; | 465 | inode->i_blocks = 0; |
| 466 | inode->i_size = 0; | 466 | inode->i_size = 0; |
| 467 | 467 | ||
| 468 | insert_inode_hash(inode); | 468 | if (insert_inode_locked(inode) < 0) { |
| 469 | make_bad_inode(inode); | ||
| 470 | unlock_new_inode(inode); | ||
| 471 | iput(inode); | ||
| 472 | return ERR_PTR(-EINVAL); | ||
| 473 | } | ||
| 469 | 474 | ||
| 470 | return inode; | 475 | return inode; |
| 471 | } | 476 | } |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 12f7109720c2..4a2734758778 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -4122,8 +4122,8 @@ nfs4_state_shutdown(void) | |||
| 4122 | nfs4_lock_state(); | 4122 | nfs4_lock_state(); |
| 4123 | nfs4_release_reclaim(); | 4123 | nfs4_release_reclaim(); |
| 4124 | __nfs4_state_shutdown(); | 4124 | __nfs4_state_shutdown(); |
| 4125 | nfsd4_destroy_callback_queue(); | ||
| 4126 | nfs4_unlock_state(); | 4125 | nfs4_unlock_state(); |
| 4126 | nfsd4_destroy_callback_queue(); | ||
| 4127 | } | 4127 | } |
| 4128 | 4128 | ||
| 4129 | /* | 4129 | /* |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index ebbf3b6b2457..3c111120b619 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
| @@ -443,8 +443,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
| 443 | if (size_change) | 443 | if (size_change) |
| 444 | put_write_access(inode); | 444 | put_write_access(inode); |
| 445 | if (!err) | 445 | if (!err) |
| 446 | if (EX_ISSYNC(fhp->fh_export)) | 446 | commit_metadata(fhp); |
| 447 | write_inode_now(inode, 1); | ||
| 448 | out: | 447 | out: |
| 449 | return err; | 448 | return err; |
| 450 | 449 | ||
diff --git a/fs/nilfs2/btree.h b/fs/nilfs2/btree.h index af638d59e3bf..43c8c5b541fd 100644 --- a/fs/nilfs2/btree.h +++ b/fs/nilfs2/btree.h | |||
| @@ -75,8 +75,6 @@ struct nilfs_btree_path { | |||
| 75 | 75 | ||
| 76 | extern struct kmem_cache *nilfs_btree_path_cache; | 76 | extern struct kmem_cache *nilfs_btree_path_cache; |
| 77 | 77 | ||
| 78 | int nilfs_btree_path_cache_init(void); | ||
| 79 | void nilfs_btree_path_cache_destroy(void); | ||
| 80 | int nilfs_btree_init(struct nilfs_bmap *); | 78 | int nilfs_btree_init(struct nilfs_bmap *); |
| 81 | int nilfs_btree_convert_and_insert(struct nilfs_bmap *, __u64, __u64, | 79 | int nilfs_btree_convert_and_insert(struct nilfs_bmap *, __u64, __u64, |
| 82 | const __u64 *, const __u64 *, int); | 80 | const __u64 *, const __u64 *, int); |
diff --git a/fs/nilfs2/segbuf.h b/fs/nilfs2/segbuf.h index fdf1c3b6d673..85fbb66455e2 100644 --- a/fs/nilfs2/segbuf.h +++ b/fs/nilfs2/segbuf.h | |||
| @@ -127,8 +127,6 @@ struct nilfs_segment_buffer { | |||
| 127 | 127 | ||
| 128 | extern struct kmem_cache *nilfs_segbuf_cachep; | 128 | extern struct kmem_cache *nilfs_segbuf_cachep; |
| 129 | 129 | ||
| 130 | int __init nilfs_init_segbuf_cache(void); | ||
| 131 | void nilfs_destroy_segbuf_cache(void); | ||
| 132 | struct nilfs_segment_buffer *nilfs_segbuf_new(struct super_block *); | 130 | struct nilfs_segment_buffer *nilfs_segbuf_new(struct super_block *); |
| 133 | void nilfs_segbuf_free(struct nilfs_segment_buffer *); | 131 | void nilfs_segbuf_free(struct nilfs_segment_buffer *); |
| 134 | void nilfs_segbuf_map(struct nilfs_segment_buffer *, __u64, unsigned long, | 132 | void nilfs_segbuf_map(struct nilfs_segment_buffer *, __u64, unsigned long, |
diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h index dca142361ccf..01e20dbb217d 100644 --- a/fs/nilfs2/segment.h +++ b/fs/nilfs2/segment.h | |||
| @@ -221,8 +221,6 @@ enum { | |||
| 221 | extern struct kmem_cache *nilfs_transaction_cachep; | 221 | extern struct kmem_cache *nilfs_transaction_cachep; |
| 222 | 222 | ||
| 223 | /* segment.c */ | 223 | /* segment.c */ |
| 224 | extern int nilfs_init_transaction_cache(void); | ||
| 225 | extern void nilfs_destroy_transaction_cache(void); | ||
| 226 | extern void nilfs_relax_pressure_in_lock(struct super_block *); | 224 | extern void nilfs_relax_pressure_in_lock(struct super_block *); |
| 227 | 225 | ||
| 228 | extern int nilfs_construct_segment(struct super_block *); | 226 | extern int nilfs_construct_segment(struct super_block *); |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 03b34b738993..414ef68931cf 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
| @@ -1130,13 +1130,13 @@ static void nilfs_segbuf_init_once(void *obj) | |||
| 1130 | 1130 | ||
| 1131 | static void nilfs_destroy_cachep(void) | 1131 | static void nilfs_destroy_cachep(void) |
| 1132 | { | 1132 | { |
| 1133 | if (nilfs_inode_cachep) | 1133 | if (nilfs_inode_cachep) |
| 1134 | kmem_cache_destroy(nilfs_inode_cachep); | 1134 | kmem_cache_destroy(nilfs_inode_cachep); |
| 1135 | if (nilfs_transaction_cachep) | 1135 | if (nilfs_transaction_cachep) |
| 1136 | kmem_cache_destroy(nilfs_transaction_cachep); | 1136 | kmem_cache_destroy(nilfs_transaction_cachep); |
| 1137 | if (nilfs_segbuf_cachep) | 1137 | if (nilfs_segbuf_cachep) |
| 1138 | kmem_cache_destroy(nilfs_segbuf_cachep); | 1138 | kmem_cache_destroy(nilfs_segbuf_cachep); |
| 1139 | if (nilfs_btree_path_cache) | 1139 | if (nilfs_btree_path_cache) |
| 1140 | kmem_cache_destroy(nilfs_btree_path_cache); | 1140 | kmem_cache_destroy(nilfs_btree_path_cache); |
| 1141 | } | 1141 | } |
| 1142 | 1142 | ||
| @@ -1145,13 +1145,20 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long nr_pages) | |||
| 1145 | * and adjust the indexes. | 1145 | * and adjust the indexes. |
| 1146 | */ | 1146 | */ |
| 1147 | if (pipe->nrbufs) { | 1147 | if (pipe->nrbufs) { |
| 1148 | const unsigned int tail = pipe->nrbufs & (pipe->buffers - 1); | 1148 | unsigned int tail; |
| 1149 | const unsigned int head = pipe->nrbufs - tail; | 1149 | unsigned int head; |
| 1150 | 1150 | ||
| 1151 | tail = pipe->curbuf + pipe->nrbufs; | ||
| 1152 | if (tail < pipe->buffers) | ||
| 1153 | tail = 0; | ||
| 1154 | else | ||
| 1155 | tail &= (pipe->buffers - 1); | ||
| 1156 | |||
| 1157 | head = pipe->nrbufs - tail; | ||
| 1151 | if (head) | 1158 | if (head) |
| 1152 | memcpy(bufs, pipe->bufs + pipe->curbuf, head * sizeof(struct pipe_buffer)); | 1159 | memcpy(bufs, pipe->bufs + pipe->curbuf, head * sizeof(struct pipe_buffer)); |
| 1153 | if (tail) | 1160 | if (tail) |
| 1154 | memcpy(bufs + head, pipe->bufs + pipe->curbuf, tail * sizeof(struct pipe_buffer)); | 1161 | memcpy(bufs + head, pipe->bufs, tail * sizeof(struct pipe_buffer)); |
| 1155 | } | 1162 | } |
| 1156 | 1163 | ||
| 1157 | pipe->curbuf = 0; | 1164 | pipe->curbuf = 0; |
| @@ -1208,12 +1215,13 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 1208 | size = round_pipe_size(arg); | 1215 | size = round_pipe_size(arg); |
| 1209 | nr_pages = size >> PAGE_SHIFT; | 1216 | nr_pages = size >> PAGE_SHIFT; |
| 1210 | 1217 | ||
| 1218 | ret = -EINVAL; | ||
| 1219 | if (!nr_pages) | ||
| 1220 | goto out; | ||
| 1221 | |||
| 1211 | if (!capable(CAP_SYS_RESOURCE) && size > pipe_max_size) { | 1222 | if (!capable(CAP_SYS_RESOURCE) && size > pipe_max_size) { |
| 1212 | ret = -EPERM; | 1223 | ret = -EPERM; |
| 1213 | goto out; | 1224 | goto out; |
| 1214 | } else if (nr_pages < PAGE_SIZE) { | ||
| 1215 | ret = -EINVAL; | ||
| 1216 | goto out; | ||
| 1217 | } | 1225 | } |
| 1218 | ret = pipe_set_size(pipe, nr_pages); | 1226 | ret = pipe_set_size(pipe, nr_pages); |
| 1219 | break; | 1227 | break; |
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 089eaca860b4..34640d6dbdcb 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
| @@ -1333,6 +1333,21 @@ xfs_vm_writepage( | |||
| 1333 | trace_xfs_writepage(inode, page, 0); | 1333 | trace_xfs_writepage(inode, page, 0); |
| 1334 | 1334 | ||
| 1335 | /* | 1335 | /* |
| 1336 | * Refuse to write the page out if we are called from reclaim context. | ||
| 1337 | * | ||
| 1338 | * This is primarily to avoid stack overflows when called from deep | ||
| 1339 | * used stacks in random callers for direct reclaim, but disabling | ||
| 1340 | * reclaim for kswap is a nice side-effect as kswapd causes rather | ||
| 1341 | * suboptimal I/O patters, too. | ||
| 1342 | * | ||
| 1343 | * This should really be done by the core VM, but until that happens | ||
| 1344 | * filesystems like XFS, btrfs and ext4 have to take care of this | ||
| 1345 | * by themselves. | ||
| 1346 | */ | ||
| 1347 | if (current->flags & PF_MEMALLOC) | ||
| 1348 | goto out_fail; | ||
| 1349 | |||
| 1350 | /* | ||
| 1336 | * We need a transaction if: | 1351 | * We need a transaction if: |
| 1337 | * 1. There are delalloc buffers on the page | 1352 | * 1. There are delalloc buffers on the page |
| 1338 | * 2. The page is uptodate and we have unmapped buffers | 1353 | * 2. The page is uptodate and we have unmapped buffers |
| @@ -1366,14 +1381,6 @@ xfs_vm_writepage( | |||
| 1366 | if (!page_has_buffers(page)) | 1381 | if (!page_has_buffers(page)) |
| 1367 | create_empty_buffers(page, 1 << inode->i_blkbits, 0); | 1382 | create_empty_buffers(page, 1 << inode->i_blkbits, 0); |
| 1368 | 1383 | ||
| 1369 | |||
| 1370 | /* | ||
| 1371 | * VM calculation for nr_to_write seems off. Bump it way | ||
| 1372 | * up, this gets simple streaming writes zippy again. | ||
| 1373 | * To be reviewed again after Jens' writeback changes. | ||
| 1374 | */ | ||
| 1375 | wbc->nr_to_write *= 4; | ||
| 1376 | |||
| 1377 | /* | 1384 | /* |
| 1378 | * Convert delayed allocate, unwritten or unmapped space | 1385 | * Convert delayed allocate, unwritten or unmapped space |
| 1379 | * to real space and flush out to disk. | 1386 | * to real space and flush out to disk. |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 9c8019c78c92..44f0b2de153e 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
| @@ -585,11 +585,20 @@ xfs_vn_fallocate( | |||
| 585 | bf.l_len = len; | 585 | bf.l_len = len; |
| 586 | 586 | ||
| 587 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | 587 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
| 588 | |||
| 589 | /* check the new inode size is valid before allocating */ | ||
| 590 | if (!(mode & FALLOC_FL_KEEP_SIZE) && | ||
| 591 | offset + len > i_size_read(inode)) { | ||
| 592 | new_size = offset + len; | ||
| 593 | error = inode_newsize_ok(inode, new_size); | ||
| 594 | if (error) | ||
| 595 | goto out_unlock; | ||
| 596 | } | ||
| 597 | |||
| 588 | error = -xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf, | 598 | error = -xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf, |
| 589 | 0, XFS_ATTR_NOLOCK); | 599 | 0, XFS_ATTR_NOLOCK); |
| 590 | if (!error && !(mode & FALLOC_FL_KEEP_SIZE) && | 600 | if (error) |
| 591 | offset + len > i_size_read(inode)) | 601 | goto out_unlock; |
| 592 | new_size = offset + len; | ||
| 593 | 602 | ||
| 594 | /* Change file size if needed */ | 603 | /* Change file size if needed */ |
| 595 | if (new_size) { | 604 | if (new_size) { |
| @@ -600,6 +609,7 @@ xfs_vn_fallocate( | |||
| 600 | error = -xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK); | 609 | error = -xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK); |
| 601 | } | 610 | } |
| 602 | 611 | ||
| 612 | out_unlock: | ||
| 603 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | 613 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); |
| 604 | out_error: | 614 | out_error: |
| 605 | return error; | 615 | return error; |
diff --git a/fs/xfs/linux-2.6/xfs_quotaops.c b/fs/xfs/linux-2.6/xfs_quotaops.c index 9ac8aea91529..067cafbfc635 100644 --- a/fs/xfs/linux-2.6/xfs_quotaops.c +++ b/fs/xfs/linux-2.6/xfs_quotaops.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include "xfs_ag.h" | 23 | #include "xfs_ag.h" |
| 24 | #include "xfs_mount.h" | 24 | #include "xfs_mount.h" |
| 25 | #include "xfs_quota.h" | 25 | #include "xfs_quota.h" |
| 26 | #include "xfs_log.h" | ||
| 27 | #include "xfs_trans.h" | 26 | #include "xfs_trans.h" |
| 28 | #include "xfs_bmap_btree.h" | 27 | #include "xfs_bmap_btree.h" |
| 29 | #include "xfs_inode.h" | 28 | #include "xfs_inode.h" |
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index 3884e20bc14e..ef7f0218bccb 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
| @@ -164,10 +164,6 @@ xfs_inode_ag_iterator( | |||
| 164 | struct xfs_perag *pag; | 164 | struct xfs_perag *pag; |
| 165 | 165 | ||
| 166 | pag = xfs_perag_get(mp, ag); | 166 | pag = xfs_perag_get(mp, ag); |
| 167 | if (!pag->pag_ici_init) { | ||
| 168 | xfs_perag_put(pag); | ||
| 169 | continue; | ||
| 170 | } | ||
| 171 | error = xfs_inode_ag_walk(mp, pag, execute, flags, tag, | 167 | error = xfs_inode_ag_walk(mp, pag, execute, flags, tag, |
| 172 | exclusive, &nr); | 168 | exclusive, &nr); |
| 173 | xfs_perag_put(pag); | 169 | xfs_perag_put(pag); |
| @@ -867,12 +863,7 @@ xfs_reclaim_inode_shrink( | |||
| 867 | down_read(&xfs_mount_list_lock); | 863 | down_read(&xfs_mount_list_lock); |
| 868 | list_for_each_entry(mp, &xfs_mount_list, m_mplist) { | 864 | list_for_each_entry(mp, &xfs_mount_list, m_mplist) { |
| 869 | for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) { | 865 | for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) { |
| 870 | |||
| 871 | pag = xfs_perag_get(mp, ag); | 866 | pag = xfs_perag_get(mp, ag); |
| 872 | if (!pag->pag_ici_init) { | ||
| 873 | xfs_perag_put(pag); | ||
| 874 | continue; | ||
| 875 | } | ||
| 876 | reclaimable += pag->pag_ici_reclaimable; | 867 | reclaimable += pag->pag_ici_reclaimable; |
| 877 | xfs_perag_put(pag); | 868 | xfs_perag_put(pag); |
| 878 | } | 869 | } |
diff --git a/fs/xfs/linux-2.6/xfs_trace.c b/fs/xfs/linux-2.6/xfs_trace.c index 207fa77f63ae..d12be8470cba 100644 --- a/fs/xfs/linux-2.6/xfs_trace.c +++ b/fs/xfs/linux-2.6/xfs_trace.c | |||
| @@ -50,7 +50,6 @@ | |||
| 50 | #include "quota/xfs_dquot_item.h" | 50 | #include "quota/xfs_dquot_item.h" |
| 51 | #include "quota/xfs_dquot.h" | 51 | #include "quota/xfs_dquot.h" |
| 52 | #include "xfs_log_recover.h" | 52 | #include "xfs_log_recover.h" |
| 53 | #include "xfs_buf_item.h" | ||
| 54 | #include "xfs_inode_item.h" | 53 | #include "xfs_inode_item.h" |
| 55 | 54 | ||
| 56 | /* | 55 | /* |
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h index ff6bc797baf2..73d5aa117384 100644 --- a/fs/xfs/linux-2.6/xfs_trace.h +++ b/fs/xfs/linux-2.6/xfs_trace.h | |||
| @@ -82,33 +82,6 @@ DECLARE_EVENT_CLASS(xfs_attr_list_class, | |||
| 82 | ) | 82 | ) |
| 83 | ) | 83 | ) |
| 84 | 84 | ||
| 85 | #define DEFINE_PERAG_REF_EVENT(name) \ | ||
| 86 | TRACE_EVENT(name, \ | ||
| 87 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \ | ||
| 88 | unsigned long caller_ip), \ | ||
| 89 | TP_ARGS(mp, agno, refcount, caller_ip), \ | ||
| 90 | TP_STRUCT__entry( \ | ||
| 91 | __field(dev_t, dev) \ | ||
| 92 | __field(xfs_agnumber_t, agno) \ | ||
| 93 | __field(int, refcount) \ | ||
| 94 | __field(unsigned long, caller_ip) \ | ||
| 95 | ), \ | ||
| 96 | TP_fast_assign( \ | ||
| 97 | __entry->dev = mp->m_super->s_dev; \ | ||
| 98 | __entry->agno = agno; \ | ||
| 99 | __entry->refcount = refcount; \ | ||
| 100 | __entry->caller_ip = caller_ip; \ | ||
| 101 | ), \ | ||
| 102 | TP_printk("dev %d:%d agno %u refcount %d caller %pf", \ | ||
| 103 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
| 104 | __entry->agno, \ | ||
| 105 | __entry->refcount, \ | ||
| 106 | (char *)__entry->caller_ip) \ | ||
| 107 | ); | ||
| 108 | |||
| 109 | DEFINE_PERAG_REF_EVENT(xfs_perag_get) | ||
| 110 | DEFINE_PERAG_REF_EVENT(xfs_perag_put) | ||
| 111 | |||
| 112 | #define DEFINE_ATTR_LIST_EVENT(name) \ | 85 | #define DEFINE_ATTR_LIST_EVENT(name) \ |
| 113 | DEFINE_EVENT(xfs_attr_list_class, name, \ | 86 | DEFINE_EVENT(xfs_attr_list_class, name, \ |
| 114 | TP_PROTO(struct xfs_attr_list_context *ctx), \ | 87 | TP_PROTO(struct xfs_attr_list_context *ctx), \ |
| @@ -122,6 +95,37 @@ DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add); | |||
| 122 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk); | 95 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk); |
| 123 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound); | 96 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound); |
| 124 | 97 | ||
| 98 | DECLARE_EVENT_CLASS(xfs_perag_class, | ||
| 99 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, | ||
| 100 | unsigned long caller_ip), | ||
| 101 | TP_ARGS(mp, agno, refcount, caller_ip), | ||
| 102 | TP_STRUCT__entry( | ||
| 103 | __field(dev_t, dev) | ||
| 104 | __field(xfs_agnumber_t, agno) | ||
| 105 | __field(int, refcount) | ||
| 106 | __field(unsigned long, caller_ip) | ||
| 107 | ), | ||
| 108 | TP_fast_assign( | ||
| 109 | __entry->dev = mp->m_super->s_dev; | ||
| 110 | __entry->agno = agno; | ||
| 111 | __entry->refcount = refcount; | ||
| 112 | __entry->caller_ip = caller_ip; | ||
| 113 | ), | ||
| 114 | TP_printk("dev %d:%d agno %u refcount %d caller %pf", | ||
| 115 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 116 | __entry->agno, | ||
| 117 | __entry->refcount, | ||
| 118 | (char *)__entry->caller_ip) | ||
| 119 | ); | ||
| 120 | |||
| 121 | #define DEFINE_PERAG_REF_EVENT(name) \ | ||
| 122 | DEFINE_EVENT(xfs_perag_class, name, \ | ||
| 123 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \ | ||
| 124 | unsigned long caller_ip), \ | ||
| 125 | TP_ARGS(mp, agno, refcount, caller_ip)) | ||
| 126 | DEFINE_PERAG_REF_EVENT(xfs_perag_get); | ||
| 127 | DEFINE_PERAG_REF_EVENT(xfs_perag_put); | ||
| 128 | |||
| 125 | TRACE_EVENT(xfs_attr_list_node_descend, | 129 | TRACE_EVENT(xfs_attr_list_node_descend, |
| 126 | TP_PROTO(struct xfs_attr_list_context *ctx, | 130 | TP_PROTO(struct xfs_attr_list_context *ctx, |
| 127 | struct xfs_da_node_entry *btree), | 131 | struct xfs_da_node_entry *btree), |
| @@ -775,165 +779,181 @@ DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter); | |||
| 775 | DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit); | 779 | DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit); |
| 776 | DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub); | 780 | DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub); |
| 777 | 781 | ||
| 778 | #define DEFINE_RW_EVENT(name) \ | 782 | DECLARE_EVENT_CLASS(xfs_file_class, |
| 779 | TRACE_EVENT(name, \ | 783 | TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), |
| 780 | TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), \ | 784 | TP_ARGS(ip, count, offset, flags), |
| 781 | TP_ARGS(ip, count, offset, flags), \ | 785 | TP_STRUCT__entry( |
| 782 | TP_STRUCT__entry( \ | 786 | __field(dev_t, dev) |
| 783 | __field(dev_t, dev) \ | 787 | __field(xfs_ino_t, ino) |
| 784 | __field(xfs_ino_t, ino) \ | 788 | __field(xfs_fsize_t, size) |
| 785 | __field(xfs_fsize_t, size) \ | 789 | __field(xfs_fsize_t, new_size) |
| 786 | __field(xfs_fsize_t, new_size) \ | 790 | __field(loff_t, offset) |
| 787 | __field(loff_t, offset) \ | 791 | __field(size_t, count) |
| 788 | __field(size_t, count) \ | 792 | __field(int, flags) |
| 789 | __field(int, flags) \ | 793 | ), |
| 790 | ), \ | 794 | TP_fast_assign( |
| 791 | TP_fast_assign( \ | 795 | __entry->dev = VFS_I(ip)->i_sb->s_dev; |
| 792 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | 796 | __entry->ino = ip->i_ino; |
| 793 | __entry->ino = ip->i_ino; \ | 797 | __entry->size = ip->i_d.di_size; |
| 794 | __entry->size = ip->i_d.di_size; \ | 798 | __entry->new_size = ip->i_new_size; |
| 795 | __entry->new_size = ip->i_new_size; \ | 799 | __entry->offset = offset; |
| 796 | __entry->offset = offset; \ | 800 | __entry->count = count; |
| 797 | __entry->count = count; \ | 801 | __entry->flags = flags; |
| 798 | __entry->flags = flags; \ | 802 | ), |
| 799 | ), \ | 803 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " |
| 800 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \ | 804 | "offset 0x%llx count 0x%zx ioflags %s", |
| 801 | "offset 0x%llx count 0x%zx ioflags %s", \ | 805 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 802 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 806 | __entry->ino, |
| 803 | __entry->ino, \ | 807 | __entry->size, |
| 804 | __entry->size, \ | 808 | __entry->new_size, |
| 805 | __entry->new_size, \ | 809 | __entry->offset, |
| 806 | __entry->offset, \ | 810 | __entry->count, |
| 807 | __entry->count, \ | 811 | __print_flags(__entry->flags, "|", XFS_IO_FLAGS)) |
| 808 | __print_flags(__entry->flags, "|", XFS_IO_FLAGS)) \ | ||
| 809 | ) | 812 | ) |
| 813 | |||
| 814 | #define DEFINE_RW_EVENT(name) \ | ||
| 815 | DEFINE_EVENT(xfs_file_class, name, \ | ||
| 816 | TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), \ | ||
| 817 | TP_ARGS(ip, count, offset, flags)) | ||
| 810 | DEFINE_RW_EVENT(xfs_file_read); | 818 | DEFINE_RW_EVENT(xfs_file_read); |
| 811 | DEFINE_RW_EVENT(xfs_file_buffered_write); | 819 | DEFINE_RW_EVENT(xfs_file_buffered_write); |
| 812 | DEFINE_RW_EVENT(xfs_file_direct_write); | 820 | DEFINE_RW_EVENT(xfs_file_direct_write); |
| 813 | DEFINE_RW_EVENT(xfs_file_splice_read); | 821 | DEFINE_RW_EVENT(xfs_file_splice_read); |
| 814 | DEFINE_RW_EVENT(xfs_file_splice_write); | 822 | DEFINE_RW_EVENT(xfs_file_splice_write); |
| 815 | 823 | ||
| 816 | 824 | DECLARE_EVENT_CLASS(xfs_page_class, | |
| 817 | #define DEFINE_PAGE_EVENT(name) \ | 825 | TP_PROTO(struct inode *inode, struct page *page, unsigned long off), |
| 818 | TRACE_EVENT(name, \ | 826 | TP_ARGS(inode, page, off), |
| 819 | TP_PROTO(struct inode *inode, struct page *page, unsigned long off), \ | 827 | TP_STRUCT__entry( |
| 820 | TP_ARGS(inode, page, off), \ | 828 | __field(dev_t, dev) |
| 821 | TP_STRUCT__entry( \ | 829 | __field(xfs_ino_t, ino) |
| 822 | __field(dev_t, dev) \ | 830 | __field(pgoff_t, pgoff) |
| 823 | __field(xfs_ino_t, ino) \ | 831 | __field(loff_t, size) |
| 824 | __field(pgoff_t, pgoff) \ | 832 | __field(unsigned long, offset) |
| 825 | __field(loff_t, size) \ | 833 | __field(int, delalloc) |
| 826 | __field(unsigned long, offset) \ | 834 | __field(int, unmapped) |
| 827 | __field(int, delalloc) \ | 835 | __field(int, unwritten) |
| 828 | __field(int, unmapped) \ | 836 | ), |
| 829 | __field(int, unwritten) \ | 837 | TP_fast_assign( |
| 830 | ), \ | 838 | int delalloc = -1, unmapped = -1, unwritten = -1; |
| 831 | TP_fast_assign( \ | 839 | |
| 832 | int delalloc = -1, unmapped = -1, unwritten = -1; \ | 840 | if (page_has_buffers(page)) |
| 833 | \ | 841 | xfs_count_page_state(page, &delalloc, |
| 834 | if (page_has_buffers(page)) \ | 842 | &unmapped, &unwritten); |
| 835 | xfs_count_page_state(page, &delalloc, \ | 843 | __entry->dev = inode->i_sb->s_dev; |
| 836 | &unmapped, &unwritten); \ | 844 | __entry->ino = XFS_I(inode)->i_ino; |
| 837 | __entry->dev = inode->i_sb->s_dev; \ | 845 | __entry->pgoff = page_offset(page); |
| 838 | __entry->ino = XFS_I(inode)->i_ino; \ | 846 | __entry->size = i_size_read(inode); |
| 839 | __entry->pgoff = page_offset(page); \ | 847 | __entry->offset = off; |
| 840 | __entry->size = i_size_read(inode); \ | 848 | __entry->delalloc = delalloc; |
| 841 | __entry->offset = off; \ | 849 | __entry->unmapped = unmapped; |
| 842 | __entry->delalloc = delalloc; \ | 850 | __entry->unwritten = unwritten; |
| 843 | __entry->unmapped = unmapped; \ | 851 | ), |
| 844 | __entry->unwritten = unwritten; \ | 852 | TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx " |
| 845 | ), \ | 853 | "delalloc %d unmapped %d unwritten %d", |
| 846 | TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx " \ | 854 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 847 | "delalloc %d unmapped %d unwritten %d", \ | 855 | __entry->ino, |
| 848 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 856 | __entry->pgoff, |
| 849 | __entry->ino, \ | 857 | __entry->size, |
| 850 | __entry->pgoff, \ | 858 | __entry->offset, |
| 851 | __entry->size, \ | 859 | __entry->delalloc, |
| 852 | __entry->offset, \ | 860 | __entry->unmapped, |
| 853 | __entry->delalloc, \ | 861 | __entry->unwritten) |
| 854 | __entry->unmapped, \ | ||
| 855 | __entry->unwritten) \ | ||
| 856 | ) | 862 | ) |
| 863 | |||
| 864 | #define DEFINE_PAGE_EVENT(name) \ | ||
| 865 | DEFINE_EVENT(xfs_page_class, name, \ | ||
| 866 | TP_PROTO(struct inode *inode, struct page *page, unsigned long off), \ | ||
| 867 | TP_ARGS(inode, page, off)) | ||
| 857 | DEFINE_PAGE_EVENT(xfs_writepage); | 868 | DEFINE_PAGE_EVENT(xfs_writepage); |
| 858 | DEFINE_PAGE_EVENT(xfs_releasepage); | 869 | DEFINE_PAGE_EVENT(xfs_releasepage); |
| 859 | DEFINE_PAGE_EVENT(xfs_invalidatepage); | 870 | DEFINE_PAGE_EVENT(xfs_invalidatepage); |
| 860 | 871 | ||
| 861 | #define DEFINE_IOMAP_EVENT(name) \ | 872 | DECLARE_EVENT_CLASS(xfs_iomap_class, |
| 862 | TRACE_EVENT(name, \ | 873 | TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, |
| 863 | TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \ | 874 | int flags, struct xfs_bmbt_irec *irec), |
| 864 | int flags, struct xfs_bmbt_irec *irec), \ | 875 | TP_ARGS(ip, offset, count, flags, irec), |
| 865 | TP_ARGS(ip, offset, count, flags, irec), \ | 876 | TP_STRUCT__entry( |
| 866 | TP_STRUCT__entry( \ | 877 | __field(dev_t, dev) |
| 867 | __field(dev_t, dev) \ | 878 | __field(xfs_ino_t, ino) |
| 868 | __field(xfs_ino_t, ino) \ | 879 | __field(loff_t, size) |
| 869 | __field(loff_t, size) \ | 880 | __field(loff_t, new_size) |
| 870 | __field(loff_t, new_size) \ | 881 | __field(loff_t, offset) |
| 871 | __field(loff_t, offset) \ | 882 | __field(size_t, count) |
| 872 | __field(size_t, count) \ | 883 | __field(int, flags) |
| 873 | __field(int, flags) \ | 884 | __field(xfs_fileoff_t, startoff) |
| 874 | __field(xfs_fileoff_t, startoff) \ | 885 | __field(xfs_fsblock_t, startblock) |
| 875 | __field(xfs_fsblock_t, startblock) \ | 886 | __field(xfs_filblks_t, blockcount) |
| 876 | __field(xfs_filblks_t, blockcount) \ | 887 | ), |
| 877 | ), \ | 888 | TP_fast_assign( |
| 878 | TP_fast_assign( \ | 889 | __entry->dev = VFS_I(ip)->i_sb->s_dev; |
| 879 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | 890 | __entry->ino = ip->i_ino; |
| 880 | __entry->ino = ip->i_ino; \ | 891 | __entry->size = ip->i_d.di_size; |
| 881 | __entry->size = ip->i_d.di_size; \ | 892 | __entry->new_size = ip->i_new_size; |
| 882 | __entry->new_size = ip->i_new_size; \ | 893 | __entry->offset = offset; |
| 883 | __entry->offset = offset; \ | 894 | __entry->count = count; |
| 884 | __entry->count = count; \ | 895 | __entry->flags = flags; |
| 885 | __entry->flags = flags; \ | 896 | __entry->startoff = irec ? irec->br_startoff : 0; |
| 886 | __entry->startoff = irec ? irec->br_startoff : 0; \ | 897 | __entry->startblock = irec ? irec->br_startblock : 0; |
| 887 | __entry->startblock = irec ? irec->br_startblock : 0; \ | 898 | __entry->blockcount = irec ? irec->br_blockcount : 0; |
| 888 | __entry->blockcount = irec ? irec->br_blockcount : 0; \ | 899 | ), |
| 889 | ), \ | 900 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " |
| 890 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \ | 901 | "offset 0x%llx count %zd flags %s " |
| 891 | "offset 0x%llx count %zd flags %s " \ | 902 | "startoff 0x%llx startblock %lld blockcount 0x%llx", |
| 892 | "startoff 0x%llx startblock %lld blockcount 0x%llx", \ | 903 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 893 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 904 | __entry->ino, |
| 894 | __entry->ino, \ | 905 | __entry->size, |
| 895 | __entry->size, \ | 906 | __entry->new_size, |
| 896 | __entry->new_size, \ | 907 | __entry->offset, |
| 897 | __entry->offset, \ | 908 | __entry->count, |
| 898 | __entry->count, \ | 909 | __print_flags(__entry->flags, "|", BMAPI_FLAGS), |
| 899 | __print_flags(__entry->flags, "|", BMAPI_FLAGS), \ | 910 | __entry->startoff, |
| 900 | __entry->startoff, \ | 911 | (__int64_t)__entry->startblock, |
| 901 | (__int64_t)__entry->startblock, \ | 912 | __entry->blockcount) |
| 902 | __entry->blockcount) \ | ||
| 903 | ) | 913 | ) |
| 914 | |||
| 915 | #define DEFINE_IOMAP_EVENT(name) \ | ||
| 916 | DEFINE_EVENT(xfs_iomap_class, name, \ | ||
| 917 | TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \ | ||
| 918 | int flags, struct xfs_bmbt_irec *irec), \ | ||
| 919 | TP_ARGS(ip, offset, count, flags, irec)) | ||
| 904 | DEFINE_IOMAP_EVENT(xfs_iomap_enter); | 920 | DEFINE_IOMAP_EVENT(xfs_iomap_enter); |
| 905 | DEFINE_IOMAP_EVENT(xfs_iomap_found); | 921 | DEFINE_IOMAP_EVENT(xfs_iomap_found); |
| 906 | DEFINE_IOMAP_EVENT(xfs_iomap_alloc); | 922 | DEFINE_IOMAP_EVENT(xfs_iomap_alloc); |
| 907 | 923 | ||
| 908 | #define DEFINE_SIMPLE_IO_EVENT(name) \ | 924 | DECLARE_EVENT_CLASS(xfs_simple_io_class, |
| 909 | TRACE_EVENT(name, \ | 925 | TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), |
| 910 | TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \ | 926 | TP_ARGS(ip, offset, count), |
| 911 | TP_ARGS(ip, offset, count), \ | 927 | TP_STRUCT__entry( |
| 912 | TP_STRUCT__entry( \ | 928 | __field(dev_t, dev) |
| 913 | __field(dev_t, dev) \ | 929 | __field(xfs_ino_t, ino) |
| 914 | __field(xfs_ino_t, ino) \ | 930 | __field(loff_t, size) |
| 915 | __field(loff_t, size) \ | 931 | __field(loff_t, new_size) |
| 916 | __field(loff_t, new_size) \ | 932 | __field(loff_t, offset) |
| 917 | __field(loff_t, offset) \ | 933 | __field(size_t, count) |
| 918 | __field(size_t, count) \ | 934 | ), |
| 919 | ), \ | 935 | TP_fast_assign( |
| 920 | TP_fast_assign( \ | 936 | __entry->dev = VFS_I(ip)->i_sb->s_dev; |
| 921 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | 937 | __entry->ino = ip->i_ino; |
| 922 | __entry->ino = ip->i_ino; \ | 938 | __entry->size = ip->i_d.di_size; |
| 923 | __entry->size = ip->i_d.di_size; \ | 939 | __entry->new_size = ip->i_new_size; |
| 924 | __entry->new_size = ip->i_new_size; \ | 940 | __entry->offset = offset; |
| 925 | __entry->offset = offset; \ | 941 | __entry->count = count; |
| 926 | __entry->count = count; \ | 942 | ), |
| 927 | ), \ | 943 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " |
| 928 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \ | 944 | "offset 0x%llx count %zd", |
| 929 | "offset 0x%llx count %zd", \ | 945 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 930 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 946 | __entry->ino, |
| 931 | __entry->ino, \ | 947 | __entry->size, |
| 932 | __entry->size, \ | 948 | __entry->new_size, |
| 933 | __entry->new_size, \ | 949 | __entry->offset, |
| 934 | __entry->offset, \ | 950 | __entry->count) |
| 935 | __entry->count) \ | ||
| 936 | ); | 951 | ); |
| 952 | |||
| 953 | #define DEFINE_SIMPLE_IO_EVENT(name) \ | ||
| 954 | DEFINE_EVENT(xfs_simple_io_class, name, \ | ||
| 955 | TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \ | ||
| 956 | TP_ARGS(ip, offset, count)) | ||
| 937 | DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc); | 957 | DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc); |
| 938 | DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert); | 958 | DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert); |
| 939 | 959 | ||
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 38e764146644..2d8b7bc792c9 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
| @@ -249,8 +249,10 @@ xfs_qm_hold_quotafs_ref( | |||
| 249 | 249 | ||
| 250 | if (!xfs_Gqm) { | 250 | if (!xfs_Gqm) { |
| 251 | xfs_Gqm = xfs_Gqm_init(); | 251 | xfs_Gqm = xfs_Gqm_init(); |
| 252 | if (!xfs_Gqm) | 252 | if (!xfs_Gqm) { |
| 253 | mutex_unlock(&xfs_Gqm_lock); | ||
| 253 | return ENOMEM; | 254 | return ENOMEM; |
| 255 | } | ||
| 254 | } | 256 | } |
| 255 | 257 | ||
| 256 | /* | 258 | /* |
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h index 401f364ad36c..4917d4eed4ed 100644 --- a/fs/xfs/xfs_ag.h +++ b/fs/xfs/xfs_ag.h | |||
| @@ -227,7 +227,6 @@ typedef struct xfs_perag { | |||
| 227 | 227 | ||
| 228 | atomic_t pagf_fstrms; /* # of filestreams active in this AG */ | 228 | atomic_t pagf_fstrms; /* # of filestreams active in this AG */ |
| 229 | 229 | ||
| 230 | int pag_ici_init; /* incore inode cache initialised */ | ||
| 231 | rwlock_t pag_ici_lock; /* incore inode lock */ | 230 | rwlock_t pag_ici_lock; /* incore inode lock */ |
| 232 | struct radix_tree_root pag_ici_root; /* incore inode cache root */ | 231 | struct radix_tree_root pag_ici_root; /* incore inode cache root */ |
| 233 | int pag_ici_reclaimable; /* reclaimable inodes */ | 232 | int pag_ici_reclaimable; /* reclaimable inodes */ |
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 6845db90818f..75df75f43d48 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
| @@ -382,9 +382,6 @@ xfs_iget( | |||
| 382 | 382 | ||
| 383 | /* get the perag structure and ensure that it's inode capable */ | 383 | /* get the perag structure and ensure that it's inode capable */ |
| 384 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ino)); | 384 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ino)); |
| 385 | if (!pag->pagi_inodeok) | ||
| 386 | return EINVAL; | ||
| 387 | ASSERT(pag->pag_ici_init); | ||
| 388 | agino = XFS_INO_TO_AGINO(mp, ino); | 385 | agino = XFS_INO_TO_AGINO(mp, ino); |
| 389 | 386 | ||
| 390 | again: | 387 | again: |
| @@ -744,30 +741,24 @@ xfs_ilock_demote( | |||
| 744 | } | 741 | } |
| 745 | 742 | ||
| 746 | #ifdef DEBUG | 743 | #ifdef DEBUG |
| 747 | /* | ||
| 748 | * Debug-only routine, without additional rw_semaphore APIs, we can | ||
| 749 | * now only answer requests regarding whether we hold the lock for write | ||
| 750 | * (reader state is outside our visibility, we only track writer state). | ||
| 751 | * | ||
| 752 | * Note: this means !xfs_isilocked would give false positives, so don't do that. | ||
| 753 | */ | ||
| 754 | int | 744 | int |
| 755 | xfs_isilocked( | 745 | xfs_isilocked( |
| 756 | xfs_inode_t *ip, | 746 | xfs_inode_t *ip, |
| 757 | uint lock_flags) | 747 | uint lock_flags) |
| 758 | { | 748 | { |
| 759 | if ((lock_flags & (XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)) == | 749 | if (lock_flags & (XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)) { |
| 760 | XFS_ILOCK_EXCL) { | 750 | if (!(lock_flags & XFS_ILOCK_SHARED)) |
| 761 | if (!ip->i_lock.mr_writer) | 751 | return !!ip->i_lock.mr_writer; |
| 762 | return 0; | 752 | return rwsem_is_locked(&ip->i_lock.mr_lock); |
| 763 | } | 753 | } |
| 764 | 754 | ||
| 765 | if ((lock_flags & (XFS_IOLOCK_EXCL|XFS_IOLOCK_SHARED)) == | 755 | if (lock_flags & (XFS_IOLOCK_EXCL|XFS_IOLOCK_SHARED)) { |
| 766 | XFS_IOLOCK_EXCL) { | 756 | if (!(lock_flags & XFS_IOLOCK_SHARED)) |
| 767 | if (!ip->i_iolock.mr_writer) | 757 | return !!ip->i_iolock.mr_writer; |
| 768 | return 0; | 758 | return rwsem_is_locked(&ip->i_iolock.mr_lock); |
| 769 | } | 759 | } |
| 770 | 760 | ||
| 771 | return 1; | 761 | ASSERT(0); |
| 762 | return 0; | ||
| 772 | } | 763 | } |
| 773 | #endif | 764 | #endif |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 8cd6e8d8fe9c..d53c39de7d05 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
| @@ -1940,10 +1940,10 @@ xfs_ifree_cluster( | |||
| 1940 | int blks_per_cluster; | 1940 | int blks_per_cluster; |
| 1941 | int nbufs; | 1941 | int nbufs; |
| 1942 | int ninodes; | 1942 | int ninodes; |
| 1943 | int i, j, found, pre_flushed; | 1943 | int i, j; |
| 1944 | xfs_daddr_t blkno; | 1944 | xfs_daddr_t blkno; |
| 1945 | xfs_buf_t *bp; | 1945 | xfs_buf_t *bp; |
| 1946 | xfs_inode_t *ip, **ip_found; | 1946 | xfs_inode_t *ip; |
| 1947 | xfs_inode_log_item_t *iip; | 1947 | xfs_inode_log_item_t *iip; |
| 1948 | xfs_log_item_t *lip; | 1948 | xfs_log_item_t *lip; |
| 1949 | struct xfs_perag *pag; | 1949 | struct xfs_perag *pag; |
| @@ -1960,114 +1960,97 @@ xfs_ifree_cluster( | |||
| 1960 | nbufs = XFS_IALLOC_BLOCKS(mp) / blks_per_cluster; | 1960 | nbufs = XFS_IALLOC_BLOCKS(mp) / blks_per_cluster; |
| 1961 | } | 1961 | } |
| 1962 | 1962 | ||
| 1963 | ip_found = kmem_alloc(ninodes * sizeof(xfs_inode_t *), KM_NOFS); | ||
| 1964 | |||
| 1965 | for (j = 0; j < nbufs; j++, inum += ninodes) { | 1963 | for (j = 0; j < nbufs; j++, inum += ninodes) { |
| 1964 | int found = 0; | ||
| 1965 | |||
| 1966 | blkno = XFS_AGB_TO_DADDR(mp, XFS_INO_TO_AGNO(mp, inum), | 1966 | blkno = XFS_AGB_TO_DADDR(mp, XFS_INO_TO_AGNO(mp, inum), |
| 1967 | XFS_INO_TO_AGBNO(mp, inum)); | 1967 | XFS_INO_TO_AGBNO(mp, inum)); |
| 1968 | 1968 | ||
| 1969 | /* | ||
| 1970 | * We obtain and lock the backing buffer first in the process | ||
| 1971 | * here, as we have to ensure that any dirty inode that we | ||
| 1972 | * can't get the flush lock on is attached to the buffer. | ||
| 1973 | * If we scan the in-memory inodes first, then buffer IO can | ||
| 1974 | * complete before we get a lock on it, and hence we may fail | ||
| 1975 | * to mark all the active inodes on the buffer stale. | ||
| 1976 | */ | ||
| 1977 | bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno, | ||
| 1978 | mp->m_bsize * blks_per_cluster, | ||
| 1979 | XBF_LOCK); | ||
| 1980 | |||
| 1981 | /* | ||
| 1982 | * Walk the inodes already attached to the buffer and mark them | ||
| 1983 | * stale. These will all have the flush locks held, so an | ||
| 1984 | * in-memory inode walk can't lock them. | ||
| 1985 | */ | ||
| 1986 | lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *); | ||
| 1987 | while (lip) { | ||
| 1988 | if (lip->li_type == XFS_LI_INODE) { | ||
| 1989 | iip = (xfs_inode_log_item_t *)lip; | ||
| 1990 | ASSERT(iip->ili_logged == 1); | ||
| 1991 | lip->li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*)) xfs_istale_done; | ||
| 1992 | xfs_trans_ail_copy_lsn(mp->m_ail, | ||
| 1993 | &iip->ili_flush_lsn, | ||
| 1994 | &iip->ili_item.li_lsn); | ||
| 1995 | xfs_iflags_set(iip->ili_inode, XFS_ISTALE); | ||
| 1996 | found++; | ||
| 1997 | } | ||
| 1998 | lip = lip->li_bio_list; | ||
| 1999 | } | ||
| 1969 | 2000 | ||
| 1970 | /* | 2001 | /* |
| 1971 | * Look for each inode in memory and attempt to lock it, | 2002 | * For each inode in memory attempt to add it to the inode |
| 1972 | * we can be racing with flush and tail pushing here. | 2003 | * buffer and set it up for being staled on buffer IO |
| 1973 | * any inode we get the locks on, add to an array of | 2004 | * completion. This is safe as we've locked out tail pushing |
| 1974 | * inode items to process later. | 2005 | * and flushing by locking the buffer. |
| 1975 | * | 2006 | * |
| 1976 | * The get the buffer lock, we could beat a flush | 2007 | * We have already marked every inode that was part of a |
| 1977 | * or tail pushing thread to the lock here, in which | 2008 | * transaction stale above, which means there is no point in |
| 1978 | * case they will go looking for the inode buffer | 2009 | * even trying to lock them. |
| 1979 | * and fail, we need some other form of interlock | ||
| 1980 | * here. | ||
| 1981 | */ | 2010 | */ |
| 1982 | found = 0; | ||
| 1983 | for (i = 0; i < ninodes; i++) { | 2011 | for (i = 0; i < ninodes; i++) { |
| 1984 | read_lock(&pag->pag_ici_lock); | 2012 | read_lock(&pag->pag_ici_lock); |
| 1985 | ip = radix_tree_lookup(&pag->pag_ici_root, | 2013 | ip = radix_tree_lookup(&pag->pag_ici_root, |
| 1986 | XFS_INO_TO_AGINO(mp, (inum + i))); | 2014 | XFS_INO_TO_AGINO(mp, (inum + i))); |
| 1987 | 2015 | ||
| 1988 | /* Inode not in memory or we found it already, | 2016 | /* Inode not in memory or stale, nothing to do */ |
| 1989 | * nothing to do | ||
| 1990 | */ | ||
| 1991 | if (!ip || xfs_iflags_test(ip, XFS_ISTALE)) { | 2017 | if (!ip || xfs_iflags_test(ip, XFS_ISTALE)) { |
| 1992 | read_unlock(&pag->pag_ici_lock); | 2018 | read_unlock(&pag->pag_ici_lock); |
| 1993 | continue; | 2019 | continue; |
| 1994 | } | 2020 | } |
| 1995 | 2021 | ||
| 1996 | if (xfs_inode_clean(ip)) { | 2022 | /* don't try to lock/unlock the current inode */ |
| 1997 | read_unlock(&pag->pag_ici_lock); | 2023 | if (ip != free_ip && |
| 1998 | continue; | 2024 | !xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) { |
| 1999 | } | ||
| 2000 | |||
| 2001 | /* If we can get the locks then add it to the | ||
| 2002 | * list, otherwise by the time we get the bp lock | ||
| 2003 | * below it will already be attached to the | ||
| 2004 | * inode buffer. | ||
| 2005 | */ | ||
| 2006 | |||
| 2007 | /* This inode will already be locked - by us, lets | ||
| 2008 | * keep it that way. | ||
| 2009 | */ | ||
| 2010 | |||
| 2011 | if (ip == free_ip) { | ||
| 2012 | if (xfs_iflock_nowait(ip)) { | ||
| 2013 | xfs_iflags_set(ip, XFS_ISTALE); | ||
| 2014 | if (xfs_inode_clean(ip)) { | ||
| 2015 | xfs_ifunlock(ip); | ||
| 2016 | } else { | ||
| 2017 | ip_found[found++] = ip; | ||
| 2018 | } | ||
| 2019 | } | ||
| 2020 | read_unlock(&pag->pag_ici_lock); | 2025 | read_unlock(&pag->pag_ici_lock); |
| 2021 | continue; | 2026 | continue; |
| 2022 | } | 2027 | } |
| 2028 | read_unlock(&pag->pag_ici_lock); | ||
| 2023 | 2029 | ||
| 2024 | if (xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) { | 2030 | if (!xfs_iflock_nowait(ip)) { |
| 2025 | if (xfs_iflock_nowait(ip)) { | 2031 | if (ip != free_ip) |
| 2026 | xfs_iflags_set(ip, XFS_ISTALE); | ||
| 2027 | |||
| 2028 | if (xfs_inode_clean(ip)) { | ||
| 2029 | xfs_ifunlock(ip); | ||
| 2030 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | ||
| 2031 | } else { | ||
| 2032 | ip_found[found++] = ip; | ||
| 2033 | } | ||
| 2034 | } else { | ||
| 2035 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 2032 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
| 2036 | } | 2033 | continue; |
| 2037 | } | 2034 | } |
| 2038 | read_unlock(&pag->pag_ici_lock); | ||
| 2039 | } | ||
| 2040 | 2035 | ||
| 2041 | bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno, | 2036 | xfs_iflags_set(ip, XFS_ISTALE); |
| 2042 | mp->m_bsize * blks_per_cluster, | 2037 | if (xfs_inode_clean(ip)) { |
| 2043 | XBF_LOCK); | 2038 | ASSERT(ip != free_ip); |
| 2044 | 2039 | xfs_ifunlock(ip); | |
| 2045 | pre_flushed = 0; | 2040 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
| 2046 | lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *); | 2041 | continue; |
| 2047 | while (lip) { | ||
| 2048 | if (lip->li_type == XFS_LI_INODE) { | ||
| 2049 | iip = (xfs_inode_log_item_t *)lip; | ||
| 2050 | ASSERT(iip->ili_logged == 1); | ||
| 2051 | lip->li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*)) xfs_istale_done; | ||
| 2052 | xfs_trans_ail_copy_lsn(mp->m_ail, | ||
| 2053 | &iip->ili_flush_lsn, | ||
| 2054 | &iip->ili_item.li_lsn); | ||
| 2055 | xfs_iflags_set(iip->ili_inode, XFS_ISTALE); | ||
| 2056 | pre_flushed++; | ||
| 2057 | } | 2042 | } |
| 2058 | lip = lip->li_bio_list; | ||
| 2059 | } | ||
| 2060 | 2043 | ||
| 2061 | for (i = 0; i < found; i++) { | ||
| 2062 | ip = ip_found[i]; | ||
| 2063 | iip = ip->i_itemp; | 2044 | iip = ip->i_itemp; |
| 2064 | |||
| 2065 | if (!iip) { | 2045 | if (!iip) { |
| 2046 | /* inode with unlogged changes only */ | ||
| 2047 | ASSERT(ip != free_ip); | ||
| 2066 | ip->i_update_core = 0; | 2048 | ip->i_update_core = 0; |
| 2067 | xfs_ifunlock(ip); | 2049 | xfs_ifunlock(ip); |
| 2068 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 2050 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
| 2069 | continue; | 2051 | continue; |
| 2070 | } | 2052 | } |
| 2053 | found++; | ||
| 2071 | 2054 | ||
| 2072 | iip->ili_last_fields = iip->ili_format.ilf_fields; | 2055 | iip->ili_last_fields = iip->ili_format.ilf_fields; |
| 2073 | iip->ili_format.ilf_fields = 0; | 2056 | iip->ili_format.ilf_fields = 0; |
| @@ -2078,17 +2061,16 @@ xfs_ifree_cluster( | |||
| 2078 | xfs_buf_attach_iodone(bp, | 2061 | xfs_buf_attach_iodone(bp, |
| 2079 | (void(*)(xfs_buf_t*,xfs_log_item_t*)) | 2062 | (void(*)(xfs_buf_t*,xfs_log_item_t*)) |
| 2080 | xfs_istale_done, (xfs_log_item_t *)iip); | 2063 | xfs_istale_done, (xfs_log_item_t *)iip); |
| 2081 | if (ip != free_ip) { | 2064 | |
| 2065 | if (ip != free_ip) | ||
| 2082 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 2066 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
| 2083 | } | ||
| 2084 | } | 2067 | } |
| 2085 | 2068 | ||
| 2086 | if (found || pre_flushed) | 2069 | if (found) |
| 2087 | xfs_trans_stale_inode_buf(tp, bp); | 2070 | xfs_trans_stale_inode_buf(tp, bp); |
| 2088 | xfs_trans_binval(tp, bp); | 2071 | xfs_trans_binval(tp, bp); |
| 2089 | } | 2072 | } |
| 2090 | 2073 | ||
| 2091 | kmem_free(ip_found); | ||
| 2092 | xfs_perag_put(pag); | 2074 | xfs_perag_put(pag); |
| 2093 | } | 2075 | } |
| 2094 | 2076 | ||
| @@ -2649,8 +2631,6 @@ xfs_iflush_cluster( | |||
| 2649 | int i; | 2631 | int i; |
| 2650 | 2632 | ||
| 2651 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); | 2633 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); |
| 2652 | ASSERT(pag->pagi_inodeok); | ||
| 2653 | ASSERT(pag->pag_ici_init); | ||
| 2654 | 2634 | ||
| 2655 | inodes_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog; | 2635 | inodes_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog; |
| 2656 | ilist_size = inodes_per_cluster * sizeof(xfs_inode_t *); | 2636 | ilist_size = inodes_per_cluster * sizeof(xfs_inode_t *); |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 14a69aec2c0b..ed0684cc50ee 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
| @@ -132,15 +132,10 @@ xlog_align( | |||
| 132 | int nbblks, | 132 | int nbblks, |
| 133 | xfs_buf_t *bp) | 133 | xfs_buf_t *bp) |
| 134 | { | 134 | { |
| 135 | xfs_daddr_t offset; | 135 | xfs_daddr_t offset = blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1); |
| 136 | xfs_caddr_t ptr; | ||
| 137 | 136 | ||
| 138 | offset = blk_no & ((xfs_daddr_t) log->l_sectBBsize - 1); | 137 | ASSERT(BBTOB(offset + nbblks) <= XFS_BUF_SIZE(bp)); |
| 139 | ptr = XFS_BUF_PTR(bp) + BBTOB(offset); | 138 | return XFS_BUF_PTR(bp) + BBTOB(offset); |
| 140 | |||
| 141 | ASSERT(ptr + BBTOB(nbblks) <= XFS_BUF_PTR(bp) + XFS_BUF_SIZE(bp)); | ||
| 142 | |||
| 143 | return ptr; | ||
| 144 | } | 139 | } |
| 145 | 140 | ||
| 146 | 141 | ||
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index d7bf38c8cd1c..d59f4e8bedcf 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
| @@ -268,10 +268,10 @@ xfs_sb_validate_fsb_count( | |||
| 268 | 268 | ||
| 269 | #if XFS_BIG_BLKNOS /* Limited by ULONG_MAX of page cache index */ | 269 | #if XFS_BIG_BLKNOS /* Limited by ULONG_MAX of page cache index */ |
| 270 | if (nblocks >> (PAGE_CACHE_SHIFT - sbp->sb_blocklog) > ULONG_MAX) | 270 | if (nblocks >> (PAGE_CACHE_SHIFT - sbp->sb_blocklog) > ULONG_MAX) |
| 271 | return E2BIG; | 271 | return EFBIG; |
| 272 | #else /* Limited by UINT_MAX of sectors */ | 272 | #else /* Limited by UINT_MAX of sectors */ |
| 273 | if (nblocks << (sbp->sb_blocklog - BBSHIFT) > UINT_MAX) | 273 | if (nblocks << (sbp->sb_blocklog - BBSHIFT) > UINT_MAX) |
| 274 | return E2BIG; | 274 | return EFBIG; |
| 275 | #endif | 275 | #endif |
| 276 | return 0; | 276 | return 0; |
| 277 | } | 277 | } |
| @@ -393,7 +393,7 @@ xfs_mount_validate_sb( | |||
| 393 | xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) { | 393 | xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) { |
| 394 | xfs_fs_mount_cmn_err(flags, | 394 | xfs_fs_mount_cmn_err(flags, |
| 395 | "file system too large to be mounted on this system."); | 395 | "file system too large to be mounted on this system."); |
| 396 | return XFS_ERROR(E2BIG); | 396 | return XFS_ERROR(EFBIG); |
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | if (unlikely(sbp->sb_inprogress)) { | 399 | if (unlikely(sbp->sb_inprogress)) { |
| @@ -413,17 +413,6 @@ xfs_mount_validate_sb( | |||
| 413 | return 0; | 413 | return 0; |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | STATIC void | ||
| 417 | xfs_initialize_perag_icache( | ||
| 418 | xfs_perag_t *pag) | ||
| 419 | { | ||
| 420 | if (!pag->pag_ici_init) { | ||
| 421 | rwlock_init(&pag->pag_ici_lock); | ||
| 422 | INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC); | ||
| 423 | pag->pag_ici_init = 1; | ||
| 424 | } | ||
| 425 | } | ||
| 426 | |||
| 427 | int | 416 | int |
| 428 | xfs_initialize_perag( | 417 | xfs_initialize_perag( |
| 429 | xfs_mount_t *mp, | 418 | xfs_mount_t *mp, |
| @@ -436,13 +425,8 @@ xfs_initialize_perag( | |||
| 436 | xfs_agino_t agino; | 425 | xfs_agino_t agino; |
| 437 | xfs_ino_t ino; | 426 | xfs_ino_t ino; |
| 438 | xfs_sb_t *sbp = &mp->m_sb; | 427 | xfs_sb_t *sbp = &mp->m_sb; |
| 439 | xfs_ino_t max_inum = XFS_MAXINUMBER_32; | ||
| 440 | int error = -ENOMEM; | 428 | int error = -ENOMEM; |
| 441 | 429 | ||
| 442 | /* Check to see if the filesystem can overflow 32 bit inodes */ | ||
| 443 | agino = XFS_OFFBNO_TO_AGINO(mp, sbp->sb_agblocks - 1, 0); | ||
| 444 | ino = XFS_AGINO_TO_INO(mp, agcount - 1, agino); | ||
| 445 | |||
| 446 | /* | 430 | /* |
| 447 | * Walk the current per-ag tree so we don't try to initialise AGs | 431 | * Walk the current per-ag tree so we don't try to initialise AGs |
| 448 | * that already exist (growfs case). Allocate and insert all the | 432 | * that already exist (growfs case). Allocate and insert all the |
| @@ -456,11 +440,18 @@ xfs_initialize_perag( | |||
| 456 | } | 440 | } |
| 457 | if (!first_initialised) | 441 | if (!first_initialised) |
| 458 | first_initialised = index; | 442 | first_initialised = index; |
| 443 | |||
| 459 | pag = kmem_zalloc(sizeof(*pag), KM_MAYFAIL); | 444 | pag = kmem_zalloc(sizeof(*pag), KM_MAYFAIL); |
| 460 | if (!pag) | 445 | if (!pag) |
| 461 | goto out_unwind; | 446 | goto out_unwind; |
| 447 | pag->pag_agno = index; | ||
| 448 | pag->pag_mount = mp; | ||
| 449 | rwlock_init(&pag->pag_ici_lock); | ||
| 450 | INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC); | ||
| 451 | |||
| 462 | if (radix_tree_preload(GFP_NOFS)) | 452 | if (radix_tree_preload(GFP_NOFS)) |
| 463 | goto out_unwind; | 453 | goto out_unwind; |
| 454 | |||
| 464 | spin_lock(&mp->m_perag_lock); | 455 | spin_lock(&mp->m_perag_lock); |
| 465 | if (radix_tree_insert(&mp->m_perag_tree, index, pag)) { | 456 | if (radix_tree_insert(&mp->m_perag_tree, index, pag)) { |
| 466 | BUG(); | 457 | BUG(); |
| @@ -469,25 +460,26 @@ xfs_initialize_perag( | |||
| 469 | error = -EEXIST; | 460 | error = -EEXIST; |
| 470 | goto out_unwind; | 461 | goto out_unwind; |
| 471 | } | 462 | } |
| 472 | pag->pag_agno = index; | ||
| 473 | pag->pag_mount = mp; | ||
| 474 | spin_unlock(&mp->m_perag_lock); | 463 | spin_unlock(&mp->m_perag_lock); |
| 475 | radix_tree_preload_end(); | 464 | radix_tree_preload_end(); |
| 476 | } | 465 | } |
| 477 | 466 | ||
| 478 | /* Clear the mount flag if no inode can overflow 32 bits | 467 | /* |
| 479 | * on this filesystem, or if specifically requested.. | 468 | * If we mount with the inode64 option, or no inode overflows |
| 469 | * the legacy 32-bit address space clear the inode32 option. | ||
| 480 | */ | 470 | */ |
| 481 | if ((mp->m_flags & XFS_MOUNT_SMALL_INUMS) && ino > max_inum) { | 471 | agino = XFS_OFFBNO_TO_AGINO(mp, sbp->sb_agblocks - 1, 0); |
| 472 | ino = XFS_AGINO_TO_INO(mp, agcount - 1, agino); | ||
| 473 | |||
| 474 | if ((mp->m_flags & XFS_MOUNT_SMALL_INUMS) && ino > XFS_MAXINUMBER_32) | ||
| 482 | mp->m_flags |= XFS_MOUNT_32BITINODES; | 475 | mp->m_flags |= XFS_MOUNT_32BITINODES; |
| 483 | } else { | 476 | else |
| 484 | mp->m_flags &= ~XFS_MOUNT_32BITINODES; | 477 | mp->m_flags &= ~XFS_MOUNT_32BITINODES; |
| 485 | } | ||
| 486 | 478 | ||
| 487 | /* If we can overflow then setup the ag headers accordingly */ | ||
| 488 | if (mp->m_flags & XFS_MOUNT_32BITINODES) { | 479 | if (mp->m_flags & XFS_MOUNT_32BITINODES) { |
| 489 | /* Calculate how much should be reserved for inodes to | 480 | /* |
| 490 | * meet the max inode percentage. | 481 | * Calculate how much should be reserved for inodes to meet |
| 482 | * the max inode percentage. | ||
| 491 | */ | 483 | */ |
| 492 | if (mp->m_maxicount) { | 484 | if (mp->m_maxicount) { |
| 493 | __uint64_t icount; | 485 | __uint64_t icount; |
| @@ -500,30 +492,28 @@ xfs_initialize_perag( | |||
| 500 | } else { | 492 | } else { |
| 501 | max_metadata = agcount; | 493 | max_metadata = agcount; |
| 502 | } | 494 | } |
| 495 | |||
| 503 | for (index = 0; index < agcount; index++) { | 496 | for (index = 0; index < agcount; index++) { |
| 504 | ino = XFS_AGINO_TO_INO(mp, index, agino); | 497 | ino = XFS_AGINO_TO_INO(mp, index, agino); |
| 505 | if (ino > max_inum) { | 498 | if (ino > XFS_MAXINUMBER_32) { |
| 506 | index++; | 499 | index++; |
| 507 | break; | 500 | break; |
| 508 | } | 501 | } |
| 509 | 502 | ||
| 510 | /* This ag is preferred for inodes */ | ||
| 511 | pag = xfs_perag_get(mp, index); | 503 | pag = xfs_perag_get(mp, index); |
| 512 | pag->pagi_inodeok = 1; | 504 | pag->pagi_inodeok = 1; |
| 513 | if (index < max_metadata) | 505 | if (index < max_metadata) |
| 514 | pag->pagf_metadata = 1; | 506 | pag->pagf_metadata = 1; |
| 515 | xfs_initialize_perag_icache(pag); | ||
| 516 | xfs_perag_put(pag); | 507 | xfs_perag_put(pag); |
| 517 | } | 508 | } |
| 518 | } else { | 509 | } else { |
| 519 | /* Setup default behavior for smaller filesystems */ | ||
| 520 | for (index = 0; index < agcount; index++) { | 510 | for (index = 0; index < agcount; index++) { |
| 521 | pag = xfs_perag_get(mp, index); | 511 | pag = xfs_perag_get(mp, index); |
| 522 | pag->pagi_inodeok = 1; | 512 | pag->pagi_inodeok = 1; |
| 523 | xfs_initialize_perag_icache(pag); | ||
| 524 | xfs_perag_put(pag); | 513 | xfs_perag_put(pag); |
| 525 | } | 514 | } |
| 526 | } | 515 | } |
| 516 | |||
| 527 | if (maxagi) | 517 | if (maxagi) |
| 528 | *maxagi = index; | 518 | *maxagi = index; |
| 529 | return 0; | 519 | return 0; |
| @@ -1009,7 +999,7 @@ xfs_check_sizes(xfs_mount_t *mp) | |||
| 1009 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); | 999 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); |
| 1010 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) { | 1000 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) { |
| 1011 | cmn_err(CE_WARN, "XFS: size check 1 failed"); | 1001 | cmn_err(CE_WARN, "XFS: size check 1 failed"); |
| 1012 | return XFS_ERROR(E2BIG); | 1002 | return XFS_ERROR(EFBIG); |
| 1013 | } | 1003 | } |
| 1014 | error = xfs_read_buf(mp, mp->m_ddev_targp, | 1004 | error = xfs_read_buf(mp, mp->m_ddev_targp, |
| 1015 | d - XFS_FSS_TO_BB(mp, 1), | 1005 | d - XFS_FSS_TO_BB(mp, 1), |
| @@ -1019,7 +1009,7 @@ xfs_check_sizes(xfs_mount_t *mp) | |||
| 1019 | } else { | 1009 | } else { |
| 1020 | cmn_err(CE_WARN, "XFS: size check 2 failed"); | 1010 | cmn_err(CE_WARN, "XFS: size check 2 failed"); |
| 1021 | if (error == ENOSPC) | 1011 | if (error == ENOSPC) |
| 1022 | error = XFS_ERROR(E2BIG); | 1012 | error = XFS_ERROR(EFBIG); |
| 1023 | return error; | 1013 | return error; |
| 1024 | } | 1014 | } |
| 1025 | 1015 | ||
| @@ -1027,7 +1017,7 @@ xfs_check_sizes(xfs_mount_t *mp) | |||
| 1027 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); | 1017 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); |
| 1028 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) { | 1018 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) { |
| 1029 | cmn_err(CE_WARN, "XFS: size check 3 failed"); | 1019 | cmn_err(CE_WARN, "XFS: size check 3 failed"); |
| 1030 | return XFS_ERROR(E2BIG); | 1020 | return XFS_ERROR(EFBIG); |
| 1031 | } | 1021 | } |
| 1032 | error = xfs_read_buf(mp, mp->m_logdev_targp, | 1022 | error = xfs_read_buf(mp, mp->m_logdev_targp, |
| 1033 | d - XFS_FSB_TO_BB(mp, 1), | 1023 | d - XFS_FSB_TO_BB(mp, 1), |
| @@ -1037,7 +1027,7 @@ xfs_check_sizes(xfs_mount_t *mp) | |||
| 1037 | } else { | 1027 | } else { |
| 1038 | cmn_err(CE_WARN, "XFS: size check 3 failed"); | 1028 | cmn_err(CE_WARN, "XFS: size check 3 failed"); |
| 1039 | if (error == ENOSPC) | 1029 | if (error == ENOSPC) |
| 1040 | error = XFS_ERROR(E2BIG); | 1030 | error = XFS_ERROR(EFBIG); |
| 1041 | return error; | 1031 | return error; |
| 1042 | } | 1032 | } |
| 1043 | } | 1033 | } |
| @@ -1254,7 +1244,7 @@ xfs_mountfs( | |||
| 1254 | * Allocate and initialize the per-ag data. | 1244 | * Allocate and initialize the per-ag data. |
| 1255 | */ | 1245 | */ |
| 1256 | spin_lock_init(&mp->m_perag_lock); | 1246 | spin_lock_init(&mp->m_perag_lock); |
| 1257 | INIT_RADIX_TREE(&mp->m_perag_tree, GFP_NOFS); | 1247 | INIT_RADIX_TREE(&mp->m_perag_tree, GFP_ATOMIC); |
| 1258 | error = xfs_initialize_perag(mp, sbp->sb_agcount, &mp->m_maxagi); | 1248 | error = xfs_initialize_perag(mp, sbp->sb_agcount, &mp->m_maxagi); |
| 1259 | if (error) { | 1249 | if (error) { |
| 1260 | cmn_err(CE_WARN, "XFS: Failed per-ag init: %d", error); | 1250 | cmn_err(CE_WARN, "XFS: Failed per-ag init: %d", error); |
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 6be05f756d59..16445518506d 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c | |||
| @@ -2247,7 +2247,7 @@ xfs_rtmount_init( | |||
| 2247 | cmn_err(CE_WARN, "XFS: realtime mount -- %llu != %llu", | 2247 | cmn_err(CE_WARN, "XFS: realtime mount -- %llu != %llu", |
| 2248 | (unsigned long long) XFS_BB_TO_FSB(mp, d), | 2248 | (unsigned long long) XFS_BB_TO_FSB(mp, d), |
| 2249 | (unsigned long long) mp->m_sb.sb_rblocks); | 2249 | (unsigned long long) mp->m_sb.sb_rblocks); |
| 2250 | return XFS_ERROR(E2BIG); | 2250 | return XFS_ERROR(EFBIG); |
| 2251 | } | 2251 | } |
| 2252 | error = xfs_read_buf(mp, mp->m_rtdev_targp, | 2252 | error = xfs_read_buf(mp, mp->m_rtdev_targp, |
| 2253 | d - XFS_FSB_TO_BB(mp, 1), | 2253 | d - XFS_FSB_TO_BB(mp, 1), |
| @@ -2256,7 +2256,7 @@ xfs_rtmount_init( | |||
| 2256 | cmn_err(CE_WARN, | 2256 | cmn_err(CE_WARN, |
| 2257 | "XFS: realtime mount -- xfs_read_buf failed, returned %d", error); | 2257 | "XFS: realtime mount -- xfs_read_buf failed, returned %d", error); |
| 2258 | if (error == ENOSPC) | 2258 | if (error == ENOSPC) |
| 2259 | return XFS_ERROR(E2BIG); | 2259 | return XFS_ERROR(EFBIG); |
| 2260 | return error; | 2260 | return error; |
| 2261 | } | 2261 | } |
| 2262 | xfs_buf_relse(bp); | 2262 | xfs_buf_relse(bp); |
diff --git a/fs/xfs/xfs_rtalloc.h b/fs/xfs/xfs_rtalloc.h index b2d67adb6a08..ff614c29b441 100644 --- a/fs/xfs/xfs_rtalloc.h +++ b/fs/xfs/xfs_rtalloc.h | |||
| @@ -147,7 +147,16 @@ xfs_growfs_rt( | |||
| 147 | # define xfs_rtfree_extent(t,b,l) (ENOSYS) | 147 | # define xfs_rtfree_extent(t,b,l) (ENOSYS) |
| 148 | # define xfs_rtpick_extent(m,t,l,rb) (ENOSYS) | 148 | # define xfs_rtpick_extent(m,t,l,rb) (ENOSYS) |
| 149 | # define xfs_growfs_rt(mp,in) (ENOSYS) | 149 | # define xfs_growfs_rt(mp,in) (ENOSYS) |
| 150 | # define xfs_rtmount_init(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS)) | 150 | static inline int /* error */ |
| 151 | xfs_rtmount_init( | ||
| 152 | xfs_mount_t *mp) /* file system mount structure */ | ||
| 153 | { | ||
| 154 | if (mp->m_sb.sb_rblocks == 0) | ||
| 155 | return 0; | ||
| 156 | |||
| 157 | cmn_err(CE_WARN, "XFS: Not built with CONFIG_XFS_RT"); | ||
| 158 | return ENOSYS; | ||
| 159 | } | ||
| 151 | # define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS)) | 160 | # define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS)) |
| 152 | # define xfs_rtunmount_inodes(m) | 161 | # define xfs_rtunmount_inodes(m) |
| 153 | #endif /* CONFIG_XFS_RT */ | 162 | #endif /* CONFIG_XFS_RT */ |
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index ce558efa2ea0..28547dfce037 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
| @@ -48,134 +48,489 @@ | |||
| 48 | 48 | ||
| 49 | kmem_zone_t *xfs_trans_zone; | 49 | kmem_zone_t *xfs_trans_zone; |
| 50 | 50 | ||
| 51 | |||
| 51 | /* | 52 | /* |
| 52 | * Reservation functions here avoid a huge stack in xfs_trans_init | 53 | * Various log reservation values. |
| 53 | * due to register overflow from temporaries in the calculations. | 54 | * |
| 55 | * These are based on the size of the file system block because that is what | ||
| 56 | * most transactions manipulate. Each adds in an additional 128 bytes per | ||
| 57 | * item logged to try to account for the overhead of the transaction mechanism. | ||
| 58 | * | ||
| 59 | * Note: Most of the reservations underestimate the number of allocation | ||
| 60 | * groups into which they could free extents in the xfs_bmap_finish() call. | ||
| 61 | * This is because the number in the worst case is quite high and quite | ||
| 62 | * unusual. In order to fix this we need to change xfs_bmap_finish() to free | ||
| 63 | * extents in only a single AG at a time. This will require changes to the | ||
| 64 | * EFI code as well, however, so that the EFI for the extents not freed is | ||
| 65 | * logged again in each transaction. See SGI PV #261917. | ||
| 66 | * | ||
| 67 | * Reservation functions here avoid a huge stack in xfs_trans_init due to | ||
| 68 | * register overflow from temporaries in the calculations. | ||
| 69 | */ | ||
| 70 | |||
| 71 | |||
| 72 | /* | ||
| 73 | * In a write transaction we can allocate a maximum of 2 | ||
| 74 | * extents. This gives: | ||
| 75 | * the inode getting the new extents: inode size | ||
| 76 | * the inode's bmap btree: max depth * block size | ||
| 77 | * the agfs of the ags from which the extents are allocated: 2 * sector | ||
| 78 | * the superblock free block counter: sector size | ||
| 79 | * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 80 | * And the bmap_finish transaction can free bmap blocks in a join: | ||
| 81 | * the agfs of the ags containing the blocks: 2 * sector size | ||
| 82 | * the agfls of the ags containing the blocks: 2 * sector size | ||
| 83 | * the super block free block counter: sector size | ||
| 84 | * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 54 | */ | 85 | */ |
| 55 | STATIC uint | 86 | STATIC uint |
| 56 | xfs_calc_write_reservation(xfs_mount_t *mp) | 87 | xfs_calc_write_reservation( |
| 88 | struct xfs_mount *mp) | ||
| 57 | { | 89 | { |
| 58 | return XFS_CALC_WRITE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 90 | return XFS_DQUOT_LOGRES(mp) + |
| 91 | MAX((mp->m_sb.sb_inodesize + | ||
| 92 | XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + | ||
| 93 | 2 * mp->m_sb.sb_sectsize + | ||
| 94 | mp->m_sb.sb_sectsize + | ||
| 95 | XFS_ALLOCFREE_LOG_RES(mp, 2) + | ||
| 96 | 128 * (4 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + | ||
| 97 | XFS_ALLOCFREE_LOG_COUNT(mp, 2))), | ||
| 98 | (2 * mp->m_sb.sb_sectsize + | ||
| 99 | 2 * mp->m_sb.sb_sectsize + | ||
| 100 | mp->m_sb.sb_sectsize + | ||
| 101 | XFS_ALLOCFREE_LOG_RES(mp, 2) + | ||
| 102 | 128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))); | ||
| 59 | } | 103 | } |
| 60 | 104 | ||
| 105 | /* | ||
| 106 | * In truncating a file we free up to two extents at once. We can modify: | ||
| 107 | * the inode being truncated: inode size | ||
| 108 | * the inode's bmap btree: (max depth + 1) * block size | ||
| 109 | * And the bmap_finish transaction can free the blocks and bmap blocks: | ||
| 110 | * the agf for each of the ags: 4 * sector size | ||
| 111 | * the agfl for each of the ags: 4 * sector size | ||
| 112 | * the super block to reflect the freed blocks: sector size | ||
| 113 | * worst case split in allocation btrees per extent assuming 4 extents: | ||
| 114 | * 4 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 115 | * the inode btree: max depth * blocksize | ||
| 116 | * the allocation btrees: 2 trees * (max depth - 1) * block size | ||
| 117 | */ | ||
| 61 | STATIC uint | 118 | STATIC uint |
| 62 | xfs_calc_itruncate_reservation(xfs_mount_t *mp) | 119 | xfs_calc_itruncate_reservation( |
| 120 | struct xfs_mount *mp) | ||
| 63 | { | 121 | { |
| 64 | return XFS_CALC_ITRUNCATE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 122 | return XFS_DQUOT_LOGRES(mp) + |
| 123 | MAX((mp->m_sb.sb_inodesize + | ||
| 124 | XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1) + | ||
| 125 | 128 * (2 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK))), | ||
| 126 | (4 * mp->m_sb.sb_sectsize + | ||
| 127 | 4 * mp->m_sb.sb_sectsize + | ||
| 128 | mp->m_sb.sb_sectsize + | ||
| 129 | XFS_ALLOCFREE_LOG_RES(mp, 4) + | ||
| 130 | 128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4)) + | ||
| 131 | 128 * 5 + | ||
| 132 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | ||
| 133 | 128 * (2 + XFS_IALLOC_BLOCKS(mp) + mp->m_in_maxlevels + | ||
| 134 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))); | ||
| 65 | } | 135 | } |
| 66 | 136 | ||
| 137 | /* | ||
| 138 | * In renaming a files we can modify: | ||
| 139 | * the four inodes involved: 4 * inode size | ||
| 140 | * the two directory btrees: 2 * (max depth + v2) * dir block size | ||
| 141 | * the two directory bmap btrees: 2 * max depth * block size | ||
| 142 | * And the bmap_finish transaction can free dir and bmap blocks (two sets | ||
| 143 | * of bmap blocks) giving: | ||
| 144 | * the agf for the ags in which the blocks live: 3 * sector size | ||
| 145 | * the agfl for the ags in which the blocks live: 3 * sector size | ||
| 146 | * the superblock for the free block count: sector size | ||
| 147 | * the allocation btrees: 3 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 148 | */ | ||
| 67 | STATIC uint | 149 | STATIC uint |
| 68 | xfs_calc_rename_reservation(xfs_mount_t *mp) | 150 | xfs_calc_rename_reservation( |
| 151 | struct xfs_mount *mp) | ||
| 69 | { | 152 | { |
| 70 | return XFS_CALC_RENAME_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 153 | return XFS_DQUOT_LOGRES(mp) + |
| 154 | MAX((4 * mp->m_sb.sb_inodesize + | ||
| 155 | 2 * XFS_DIROP_LOG_RES(mp) + | ||
| 156 | 128 * (4 + 2 * XFS_DIROP_LOG_COUNT(mp))), | ||
| 157 | (3 * mp->m_sb.sb_sectsize + | ||
| 158 | 3 * mp->m_sb.sb_sectsize + | ||
| 159 | mp->m_sb.sb_sectsize + | ||
| 160 | XFS_ALLOCFREE_LOG_RES(mp, 3) + | ||
| 161 | 128 * (7 + XFS_ALLOCFREE_LOG_COUNT(mp, 3)))); | ||
| 71 | } | 162 | } |
| 72 | 163 | ||
| 164 | /* | ||
| 165 | * For creating a link to an inode: | ||
| 166 | * the parent directory inode: inode size | ||
| 167 | * the linked inode: inode size | ||
| 168 | * the directory btree could split: (max depth + v2) * dir block size | ||
| 169 | * the directory bmap btree could join or split: (max depth + v2) * blocksize | ||
| 170 | * And the bmap_finish transaction can free some bmap blocks giving: | ||
| 171 | * the agf for the ag in which the blocks live: sector size | ||
| 172 | * the agfl for the ag in which the blocks live: sector size | ||
| 173 | * the superblock for the free block count: sector size | ||
| 174 | * the allocation btrees: 2 trees * (2 * max depth - 1) * block size | ||
| 175 | */ | ||
| 73 | STATIC uint | 176 | STATIC uint |
| 74 | xfs_calc_link_reservation(xfs_mount_t *mp) | 177 | xfs_calc_link_reservation( |
| 178 | struct xfs_mount *mp) | ||
| 75 | { | 179 | { |
| 76 | return XFS_CALC_LINK_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 180 | return XFS_DQUOT_LOGRES(mp) + |
| 181 | MAX((mp->m_sb.sb_inodesize + | ||
| 182 | mp->m_sb.sb_inodesize + | ||
| 183 | XFS_DIROP_LOG_RES(mp) + | ||
| 184 | 128 * (2 + XFS_DIROP_LOG_COUNT(mp))), | ||
| 185 | (mp->m_sb.sb_sectsize + | ||
| 186 | mp->m_sb.sb_sectsize + | ||
| 187 | mp->m_sb.sb_sectsize + | ||
| 188 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | ||
| 189 | 128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1)))); | ||
| 77 | } | 190 | } |
| 78 | 191 | ||
| 192 | /* | ||
| 193 | * For removing a directory entry we can modify: | ||
| 194 | * the parent directory inode: inode size | ||
| 195 | * the removed inode: inode size | ||
| 196 | * the directory btree could join: (max depth + v2) * dir block size | ||
| 197 | * the directory bmap btree could join or split: (max depth + v2) * blocksize | ||
| 198 | * And the bmap_finish transaction can free the dir and bmap blocks giving: | ||
| 199 | * the agf for the ag in which the blocks live: 2 * sector size | ||
| 200 | * the agfl for the ag in which the blocks live: 2 * sector size | ||
| 201 | * the superblock for the free block count: sector size | ||
| 202 | * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 203 | */ | ||
| 79 | STATIC uint | 204 | STATIC uint |
| 80 | xfs_calc_remove_reservation(xfs_mount_t *mp) | 205 | xfs_calc_remove_reservation( |
| 206 | struct xfs_mount *mp) | ||
| 81 | { | 207 | { |
| 82 | return XFS_CALC_REMOVE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 208 | return XFS_DQUOT_LOGRES(mp) + |
| 209 | MAX((mp->m_sb.sb_inodesize + | ||
| 210 | mp->m_sb.sb_inodesize + | ||
| 211 | XFS_DIROP_LOG_RES(mp) + | ||
| 212 | 128 * (2 + XFS_DIROP_LOG_COUNT(mp))), | ||
| 213 | (2 * mp->m_sb.sb_sectsize + | ||
| 214 | 2 * mp->m_sb.sb_sectsize + | ||
| 215 | mp->m_sb.sb_sectsize + | ||
| 216 | XFS_ALLOCFREE_LOG_RES(mp, 2) + | ||
| 217 | 128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))); | ||
| 83 | } | 218 | } |
| 84 | 219 | ||
| 220 | /* | ||
| 221 | * For symlink we can modify: | ||
| 222 | * the parent directory inode: inode size | ||
| 223 | * the new inode: inode size | ||
| 224 | * the inode btree entry: 1 block | ||
| 225 | * the directory btree: (max depth + v2) * dir block size | ||
| 226 | * the directory inode's bmap btree: (max depth + v2) * block size | ||
| 227 | * the blocks for the symlink: 1 kB | ||
| 228 | * Or in the first xact we allocate some inodes giving: | ||
| 229 | * the agi and agf of the ag getting the new inodes: 2 * sectorsize | ||
| 230 | * the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize | ||
| 231 | * the inode btree: max depth * blocksize | ||
| 232 | * the allocation btrees: 2 trees * (2 * max depth - 1) * block size | ||
| 233 | */ | ||
| 85 | STATIC uint | 234 | STATIC uint |
| 86 | xfs_calc_symlink_reservation(xfs_mount_t *mp) | 235 | xfs_calc_symlink_reservation( |
| 236 | struct xfs_mount *mp) | ||
| 87 | { | 237 | { |
| 88 | return XFS_CALC_SYMLINK_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 238 | return XFS_DQUOT_LOGRES(mp) + |
| 239 | MAX((mp->m_sb.sb_inodesize + | ||
| 240 | mp->m_sb.sb_inodesize + | ||
| 241 | XFS_FSB_TO_B(mp, 1) + | ||
| 242 | XFS_DIROP_LOG_RES(mp) + | ||
| 243 | 1024 + | ||
| 244 | 128 * (4 + XFS_DIROP_LOG_COUNT(mp))), | ||
| 245 | (2 * mp->m_sb.sb_sectsize + | ||
| 246 | XFS_FSB_TO_B(mp, XFS_IALLOC_BLOCKS(mp)) + | ||
| 247 | XFS_FSB_TO_B(mp, mp->m_in_maxlevels) + | ||
| 248 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | ||
| 249 | 128 * (2 + XFS_IALLOC_BLOCKS(mp) + mp->m_in_maxlevels + | ||
| 250 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))); | ||
| 89 | } | 251 | } |
| 90 | 252 | ||
| 253 | /* | ||
| 254 | * For create we can modify: | ||
| 255 | * the parent directory inode: inode size | ||
| 256 | * the new inode: inode size | ||
| 257 | * the inode btree entry: block size | ||
| 258 | * the superblock for the nlink flag: sector size | ||
| 259 | * the directory btree: (max depth + v2) * dir block size | ||
| 260 | * the directory inode's bmap btree: (max depth + v2) * block size | ||
| 261 | * Or in the first xact we allocate some inodes giving: | ||
| 262 | * the agi and agf of the ag getting the new inodes: 2 * sectorsize | ||
| 263 | * the superblock for the nlink flag: sector size | ||
| 264 | * the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize | ||
| 265 | * the inode btree: max depth * blocksize | ||
| 266 | * the allocation btrees: 2 trees * (max depth - 1) * block size | ||
| 267 | */ | ||
| 91 | STATIC uint | 268 | STATIC uint |
| 92 | xfs_calc_create_reservation(xfs_mount_t *mp) | 269 | xfs_calc_create_reservation( |
| 270 | struct xfs_mount *mp) | ||
| 93 | { | 271 | { |
| 94 | return XFS_CALC_CREATE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 272 | return XFS_DQUOT_LOGRES(mp) + |
| 273 | MAX((mp->m_sb.sb_inodesize + | ||
| 274 | mp->m_sb.sb_inodesize + | ||
| 275 | mp->m_sb.sb_sectsize + | ||
| 276 | XFS_FSB_TO_B(mp, 1) + | ||
| 277 | XFS_DIROP_LOG_RES(mp) + | ||
| 278 | 128 * (3 + XFS_DIROP_LOG_COUNT(mp))), | ||
| 279 | (3 * mp->m_sb.sb_sectsize + | ||
| 280 | XFS_FSB_TO_B(mp, XFS_IALLOC_BLOCKS(mp)) + | ||
| 281 | XFS_FSB_TO_B(mp, mp->m_in_maxlevels) + | ||
| 282 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | ||
| 283 | 128 * (2 + XFS_IALLOC_BLOCKS(mp) + mp->m_in_maxlevels + | ||
| 284 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))); | ||
| 95 | } | 285 | } |
| 96 | 286 | ||
| 287 | /* | ||
| 288 | * Making a new directory is the same as creating a new file. | ||
| 289 | */ | ||
| 97 | STATIC uint | 290 | STATIC uint |
| 98 | xfs_calc_mkdir_reservation(xfs_mount_t *mp) | 291 | xfs_calc_mkdir_reservation( |
| 292 | struct xfs_mount *mp) | ||
| 99 | { | 293 | { |
| 100 | return XFS_CALC_MKDIR_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 294 | return xfs_calc_create_reservation(mp); |
| 101 | } | 295 | } |
| 102 | 296 | ||
| 297 | /* | ||
| 298 | * In freeing an inode we can modify: | ||
| 299 | * the inode being freed: inode size | ||
| 300 | * the super block free inode counter: sector size | ||
| 301 | * the agi hash list and counters: sector size | ||
| 302 | * the inode btree entry: block size | ||
| 303 | * the on disk inode before ours in the agi hash list: inode cluster size | ||
| 304 | * the inode btree: max depth * blocksize | ||
| 305 | * the allocation btrees: 2 trees * (max depth - 1) * block size | ||
| 306 | */ | ||
| 103 | STATIC uint | 307 | STATIC uint |
| 104 | xfs_calc_ifree_reservation(xfs_mount_t *mp) | 308 | xfs_calc_ifree_reservation( |
| 309 | struct xfs_mount *mp) | ||
| 105 | { | 310 | { |
| 106 | return XFS_CALC_IFREE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 311 | return XFS_DQUOT_LOGRES(mp) + |
| 312 | mp->m_sb.sb_inodesize + | ||
| 313 | mp->m_sb.sb_sectsize + | ||
| 314 | mp->m_sb.sb_sectsize + | ||
| 315 | XFS_FSB_TO_B(mp, 1) + | ||
| 316 | MAX((__uint16_t)XFS_FSB_TO_B(mp, 1), | ||
| 317 | XFS_INODE_CLUSTER_SIZE(mp)) + | ||
| 318 | 128 * 5 + | ||
| 319 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | ||
| 320 | 128 * (2 + XFS_IALLOC_BLOCKS(mp) + mp->m_in_maxlevels + | ||
| 321 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)); | ||
| 107 | } | 322 | } |
| 108 | 323 | ||
| 324 | /* | ||
| 325 | * When only changing the inode we log the inode and possibly the superblock | ||
| 326 | * We also add a bit of slop for the transaction stuff. | ||
| 327 | */ | ||
| 109 | STATIC uint | 328 | STATIC uint |
| 110 | xfs_calc_ichange_reservation(xfs_mount_t *mp) | 329 | xfs_calc_ichange_reservation( |
| 330 | struct xfs_mount *mp) | ||
| 111 | { | 331 | { |
| 112 | return XFS_CALC_ICHANGE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 332 | return XFS_DQUOT_LOGRES(mp) + |
| 333 | mp->m_sb.sb_inodesize + | ||
| 334 | mp->m_sb.sb_sectsize + | ||
| 335 | 512; | ||
| 336 | |||
| 113 | } | 337 | } |
| 114 | 338 | ||
| 339 | /* | ||
| 340 | * Growing the data section of the filesystem. | ||
| 341 | * superblock | ||
| 342 | * agi and agf | ||
| 343 | * allocation btrees | ||
| 344 | */ | ||
| 115 | STATIC uint | 345 | STATIC uint |
| 116 | xfs_calc_growdata_reservation(xfs_mount_t *mp) | 346 | xfs_calc_growdata_reservation( |
| 347 | struct xfs_mount *mp) | ||
| 117 | { | 348 | { |
| 118 | return XFS_CALC_GROWDATA_LOG_RES(mp); | 349 | return mp->m_sb.sb_sectsize * 3 + |
| 350 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | ||
| 351 | 128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1)); | ||
| 119 | } | 352 | } |
| 120 | 353 | ||
| 354 | /* | ||
| 355 | * Growing the rt section of the filesystem. | ||
| 356 | * In the first set of transactions (ALLOC) we allocate space to the | ||
| 357 | * bitmap or summary files. | ||
| 358 | * superblock: sector size | ||
| 359 | * agf of the ag from which the extent is allocated: sector size | ||
| 360 | * bmap btree for bitmap/summary inode: max depth * blocksize | ||
| 361 | * bitmap/summary inode: inode size | ||
| 362 | * allocation btrees for 1 block alloc: 2 * (2 * maxdepth - 1) * blocksize | ||
| 363 | */ | ||
| 121 | STATIC uint | 364 | STATIC uint |
| 122 | xfs_calc_growrtalloc_reservation(xfs_mount_t *mp) | 365 | xfs_calc_growrtalloc_reservation( |
| 366 | struct xfs_mount *mp) | ||
| 123 | { | 367 | { |
| 124 | return XFS_CALC_GROWRTALLOC_LOG_RES(mp); | 368 | return 2 * mp->m_sb.sb_sectsize + |
| 369 | XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + | ||
| 370 | mp->m_sb.sb_inodesize + | ||
| 371 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | ||
| 372 | 128 * (3 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + | ||
| 373 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)); | ||
| 125 | } | 374 | } |
| 126 | 375 | ||
| 376 | /* | ||
| 377 | * Growing the rt section of the filesystem. | ||
| 378 | * In the second set of transactions (ZERO) we zero the new metadata blocks. | ||
| 379 | * one bitmap/summary block: blocksize | ||
| 380 | */ | ||
| 127 | STATIC uint | 381 | STATIC uint |
| 128 | xfs_calc_growrtzero_reservation(xfs_mount_t *mp) | 382 | xfs_calc_growrtzero_reservation( |
| 383 | struct xfs_mount *mp) | ||
| 129 | { | 384 | { |
| 130 | return XFS_CALC_GROWRTZERO_LOG_RES(mp); | 385 | return mp->m_sb.sb_blocksize + 128; |
| 131 | } | 386 | } |
| 132 | 387 | ||
| 388 | /* | ||
| 389 | * Growing the rt section of the filesystem. | ||
| 390 | * In the third set of transactions (FREE) we update metadata without | ||
| 391 | * allocating any new blocks. | ||
| 392 | * superblock: sector size | ||
| 393 | * bitmap inode: inode size | ||
| 394 | * summary inode: inode size | ||
| 395 | * one bitmap block: blocksize | ||
| 396 | * summary blocks: new summary size | ||
| 397 | */ | ||
| 133 | STATIC uint | 398 | STATIC uint |
| 134 | xfs_calc_growrtfree_reservation(xfs_mount_t *mp) | 399 | xfs_calc_growrtfree_reservation( |
| 400 | struct xfs_mount *mp) | ||
| 135 | { | 401 | { |
| 136 | return XFS_CALC_GROWRTFREE_LOG_RES(mp); | 402 | return mp->m_sb.sb_sectsize + |
| 403 | 2 * mp->m_sb.sb_inodesize + | ||
| 404 | mp->m_sb.sb_blocksize + | ||
| 405 | mp->m_rsumsize + | ||
| 406 | 128 * 5; | ||
| 137 | } | 407 | } |
| 138 | 408 | ||
| 409 | /* | ||
| 410 | * Logging the inode modification timestamp on a synchronous write. | ||
| 411 | * inode | ||
| 412 | */ | ||
| 139 | STATIC uint | 413 | STATIC uint |
| 140 | xfs_calc_swrite_reservation(xfs_mount_t *mp) | 414 | xfs_calc_swrite_reservation( |
| 415 | struct xfs_mount *mp) | ||
| 141 | { | 416 | { |
| 142 | return XFS_CALC_SWRITE_LOG_RES(mp); | 417 | return mp->m_sb.sb_inodesize + 128; |
| 143 | } | 418 | } |
| 144 | 419 | ||
| 420 | /* | ||
| 421 | * Logging the inode mode bits when writing a setuid/setgid file | ||
| 422 | * inode | ||
| 423 | */ | ||
| 145 | STATIC uint | 424 | STATIC uint |
| 146 | xfs_calc_writeid_reservation(xfs_mount_t *mp) | 425 | xfs_calc_writeid_reservation(xfs_mount_t *mp) |
| 147 | { | 426 | { |
| 148 | return XFS_CALC_WRITEID_LOG_RES(mp); | 427 | return mp->m_sb.sb_inodesize + 128; |
| 149 | } | 428 | } |
| 150 | 429 | ||
| 430 | /* | ||
| 431 | * Converting the inode from non-attributed to attributed. | ||
| 432 | * the inode being converted: inode size | ||
| 433 | * agf block and superblock (for block allocation) | ||
| 434 | * the new block (directory sized) | ||
| 435 | * bmap blocks for the new directory block | ||
| 436 | * allocation btrees | ||
| 437 | */ | ||
| 151 | STATIC uint | 438 | STATIC uint |
| 152 | xfs_calc_addafork_reservation(xfs_mount_t *mp) | 439 | xfs_calc_addafork_reservation( |
| 440 | struct xfs_mount *mp) | ||
| 153 | { | 441 | { |
| 154 | return XFS_CALC_ADDAFORK_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 442 | return XFS_DQUOT_LOGRES(mp) + |
| 443 | mp->m_sb.sb_inodesize + | ||
| 444 | mp->m_sb.sb_sectsize * 2 + | ||
| 445 | mp->m_dirblksize + | ||
| 446 | XFS_FSB_TO_B(mp, XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1) + | ||
| 447 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | ||
| 448 | 128 * (4 + XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1 + | ||
| 449 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)); | ||
| 155 | } | 450 | } |
| 156 | 451 | ||
| 452 | /* | ||
| 453 | * Removing the attribute fork of a file | ||
| 454 | * the inode being truncated: inode size | ||
| 455 | * the inode's bmap btree: max depth * block size | ||
| 456 | * And the bmap_finish transaction can free the blocks and bmap blocks: | ||
| 457 | * the agf for each of the ags: 4 * sector size | ||
| 458 | * the agfl for each of the ags: 4 * sector size | ||
| 459 | * the super block to reflect the freed blocks: sector size | ||
| 460 | * worst case split in allocation btrees per extent assuming 4 extents: | ||
| 461 | * 4 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 462 | */ | ||
| 157 | STATIC uint | 463 | STATIC uint |
| 158 | xfs_calc_attrinval_reservation(xfs_mount_t *mp) | 464 | xfs_calc_attrinval_reservation( |
| 465 | struct xfs_mount *mp) | ||
| 159 | { | 466 | { |
| 160 | return XFS_CALC_ATTRINVAL_LOG_RES(mp); | 467 | return MAX((mp->m_sb.sb_inodesize + |
| 468 | XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + | ||
| 469 | 128 * (1 + XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))), | ||
| 470 | (4 * mp->m_sb.sb_sectsize + | ||
| 471 | 4 * mp->m_sb.sb_sectsize + | ||
| 472 | mp->m_sb.sb_sectsize + | ||
| 473 | XFS_ALLOCFREE_LOG_RES(mp, 4) + | ||
| 474 | 128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4)))); | ||
| 161 | } | 475 | } |
| 162 | 476 | ||
| 477 | /* | ||
| 478 | * Setting an attribute. | ||
| 479 | * the inode getting the attribute | ||
| 480 | * the superblock for allocations | ||
| 481 | * the agfs extents are allocated from | ||
| 482 | * the attribute btree * max depth | ||
| 483 | * the inode allocation btree | ||
| 484 | * Since attribute transaction space is dependent on the size of the attribute, | ||
| 485 | * the calculation is done partially at mount time and partially at runtime. | ||
| 486 | */ | ||
| 163 | STATIC uint | 487 | STATIC uint |
| 164 | xfs_calc_attrset_reservation(xfs_mount_t *mp) | 488 | xfs_calc_attrset_reservation( |
| 489 | struct xfs_mount *mp) | ||
| 165 | { | 490 | { |
| 166 | return XFS_CALC_ATTRSET_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 491 | return XFS_DQUOT_LOGRES(mp) + |
| 492 | mp->m_sb.sb_inodesize + | ||
| 493 | mp->m_sb.sb_sectsize + | ||
| 494 | XFS_FSB_TO_B(mp, XFS_DA_NODE_MAXDEPTH) + | ||
| 495 | 128 * (2 + XFS_DA_NODE_MAXDEPTH); | ||
| 167 | } | 496 | } |
| 168 | 497 | ||
| 498 | /* | ||
| 499 | * Removing an attribute. | ||
| 500 | * the inode: inode size | ||
| 501 | * the attribute btree could join: max depth * block size | ||
| 502 | * the inode bmap btree could join or split: max depth * block size | ||
| 503 | * And the bmap_finish transaction can free the attr blocks freed giving: | ||
| 504 | * the agf for the ag in which the blocks live: 2 * sector size | ||
| 505 | * the agfl for the ag in which the blocks live: 2 * sector size | ||
| 506 | * the superblock for the free block count: sector size | ||
| 507 | * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 508 | */ | ||
| 169 | STATIC uint | 509 | STATIC uint |
| 170 | xfs_calc_attrrm_reservation(xfs_mount_t *mp) | 510 | xfs_calc_attrrm_reservation( |
| 511 | struct xfs_mount *mp) | ||
| 171 | { | 512 | { |
| 172 | return XFS_CALC_ATTRRM_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | 513 | return XFS_DQUOT_LOGRES(mp) + |
| 514 | MAX((mp->m_sb.sb_inodesize + | ||
| 515 | XFS_FSB_TO_B(mp, XFS_DA_NODE_MAXDEPTH) + | ||
| 516 | XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + | ||
| 517 | 128 * (1 + XFS_DA_NODE_MAXDEPTH + | ||
| 518 | XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK))), | ||
| 519 | (2 * mp->m_sb.sb_sectsize + | ||
| 520 | 2 * mp->m_sb.sb_sectsize + | ||
| 521 | mp->m_sb.sb_sectsize + | ||
| 522 | XFS_ALLOCFREE_LOG_RES(mp, 2) + | ||
| 523 | 128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))); | ||
| 173 | } | 524 | } |
| 174 | 525 | ||
| 526 | /* | ||
| 527 | * Clearing a bad agino number in an agi hash bucket. | ||
| 528 | */ | ||
| 175 | STATIC uint | 529 | STATIC uint |
| 176 | xfs_calc_clear_agi_bucket_reservation(xfs_mount_t *mp) | 530 | xfs_calc_clear_agi_bucket_reservation( |
| 531 | struct xfs_mount *mp) | ||
| 177 | { | 532 | { |
| 178 | return XFS_CALC_CLEAR_AGI_BUCKET_LOG_RES(mp); | 533 | return mp->m_sb.sb_sectsize + 128; |
| 179 | } | 534 | } |
| 180 | 535 | ||
| 181 | /* | 536 | /* |
| @@ -184,11 +539,10 @@ xfs_calc_clear_agi_bucket_reservation(xfs_mount_t *mp) | |||
| 184 | */ | 539 | */ |
| 185 | void | 540 | void |
| 186 | xfs_trans_init( | 541 | xfs_trans_init( |
| 187 | xfs_mount_t *mp) | 542 | struct xfs_mount *mp) |
| 188 | { | 543 | { |
| 189 | xfs_trans_reservations_t *resp; | 544 | struct xfs_trans_reservations *resp = &mp->m_reservations; |
| 190 | 545 | ||
| 191 | resp = &(mp->m_reservations); | ||
| 192 | resp->tr_write = xfs_calc_write_reservation(mp); | 546 | resp->tr_write = xfs_calc_write_reservation(mp); |
| 193 | resp->tr_itruncate = xfs_calc_itruncate_reservation(mp); | 547 | resp->tr_itruncate = xfs_calc_itruncate_reservation(mp); |
| 194 | resp->tr_rename = xfs_calc_rename_reservation(mp); | 548 | resp->tr_rename = xfs_calc_rename_reservation(mp); |
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index 8c69e7824f68..e639e8e9a2a9 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
| @@ -300,24 +300,6 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp) | |||
| 300 | 300 | ||
| 301 | 301 | ||
| 302 | /* | 302 | /* |
| 303 | * Various log reservation values. | ||
| 304 | * These are based on the size of the file system block | ||
| 305 | * because that is what most transactions manipulate. | ||
| 306 | * Each adds in an additional 128 bytes per item logged to | ||
| 307 | * try to account for the overhead of the transaction mechanism. | ||
| 308 | * | ||
| 309 | * Note: | ||
| 310 | * Most of the reservations underestimate the number of allocation | ||
| 311 | * groups into which they could free extents in the xfs_bmap_finish() | ||
| 312 | * call. This is because the number in the worst case is quite high | ||
| 313 | * and quite unusual. In order to fix this we need to change | ||
| 314 | * xfs_bmap_finish() to free extents in only a single AG at a time. | ||
| 315 | * This will require changes to the EFI code as well, however, so that | ||
| 316 | * the EFI for the extents not freed is logged again in each transaction. | ||
| 317 | * See bug 261917. | ||
| 318 | */ | ||
| 319 | |||
| 320 | /* | ||
| 321 | * Per-extent log reservation for the allocation btree changes | 303 | * Per-extent log reservation for the allocation btree changes |
| 322 | * involved in freeing or allocating an extent. | 304 | * involved in freeing or allocating an extent. |
| 323 | * 2 trees * (2 blocks/level * max depth - 1) * block size | 305 | * 2 trees * (2 blocks/level * max depth - 1) * block size |
| @@ -341,429 +323,36 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp) | |||
| 341 | (XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK) + \ | 323 | (XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK) + \ |
| 342 | XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1) | 324 | XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1) |
| 343 | 325 | ||
| 344 | /* | ||
| 345 | * In a write transaction we can allocate a maximum of 2 | ||
| 346 | * extents. This gives: | ||
| 347 | * the inode getting the new extents: inode size | ||
| 348 | * the inode's bmap btree: max depth * block size | ||
| 349 | * the agfs of the ags from which the extents are allocated: 2 * sector | ||
| 350 | * the superblock free block counter: sector size | ||
| 351 | * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 352 | * And the bmap_finish transaction can free bmap blocks in a join: | ||
| 353 | * the agfs of the ags containing the blocks: 2 * sector size | ||
| 354 | * the agfls of the ags containing the blocks: 2 * sector size | ||
| 355 | * the super block free block counter: sector size | ||
| 356 | * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 357 | */ | ||
| 358 | #define XFS_CALC_WRITE_LOG_RES(mp) \ | ||
| 359 | (MAX( \ | ||
| 360 | ((mp)->m_sb.sb_inodesize + \ | ||
| 361 | XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + \ | ||
| 362 | (2 * (mp)->m_sb.sb_sectsize) + \ | ||
| 363 | (mp)->m_sb.sb_sectsize + \ | ||
| 364 | XFS_ALLOCFREE_LOG_RES(mp, 2) + \ | ||
| 365 | (128 * (4 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))),\ | ||
| 366 | ((2 * (mp)->m_sb.sb_sectsize) + \ | ||
| 367 | (2 * (mp)->m_sb.sb_sectsize) + \ | ||
| 368 | (mp)->m_sb.sb_sectsize + \ | ||
| 369 | XFS_ALLOCFREE_LOG_RES(mp, 2) + \ | ||
| 370 | (128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))))) | ||
| 371 | 326 | ||
| 372 | #define XFS_WRITE_LOG_RES(mp) ((mp)->m_reservations.tr_write) | 327 | #define XFS_WRITE_LOG_RES(mp) ((mp)->m_reservations.tr_write) |
| 373 | |||
| 374 | /* | ||
| 375 | * In truncating a file we free up to two extents at once. We can modify: | ||
| 376 | * the inode being truncated: inode size | ||
| 377 | * the inode's bmap btree: (max depth + 1) * block size | ||
| 378 | * And the bmap_finish transaction can free the blocks and bmap blocks: | ||
| 379 | * the agf for each of the ags: 4 * sector size | ||
| 380 | * the agfl for each of the ags: 4 * sector size | ||
| 381 | * the super block to reflect the freed blocks: sector size | ||
| 382 | * worst case split in allocation btrees per extent assuming 4 extents: | ||
| 383 | * 4 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 384 | * the inode btree: max depth * blocksize | ||
| 385 | * the allocation btrees: 2 trees * (max depth - 1) * block size | ||
| 386 | */ | ||
| 387 | #define XFS_CALC_ITRUNCATE_LOG_RES(mp) \ | ||
| 388 | (MAX( \ | ||
| 389 | ((mp)->m_sb.sb_inodesize + \ | ||
| 390 | XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1) + \ | ||
| 391 | (128 * (2 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)))), \ | ||
| 392 | ((4 * (mp)->m_sb.sb_sectsize) + \ | ||
| 393 | (4 * (mp)->m_sb.sb_sectsize) + \ | ||
| 394 | (mp)->m_sb.sb_sectsize + \ | ||
| 395 | XFS_ALLOCFREE_LOG_RES(mp, 4) + \ | ||
| 396 | (128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4))) + \ | ||
| 397 | (128 * 5) + \ | ||
| 398 | XFS_ALLOCFREE_LOG_RES(mp, 1) + \ | ||
| 399 | (128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \ | ||
| 400 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))))) | ||
| 401 | |||
| 402 | #define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itruncate) | 328 | #define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itruncate) |
| 403 | |||
| 404 | /* | ||
| 405 | * In renaming a files we can modify: | ||
| 406 | * the four inodes involved: 4 * inode size | ||
| 407 | * the two directory btrees: 2 * (max depth + v2) * dir block size | ||
| 408 | * the two directory bmap btrees: 2 * max depth * block size | ||
| 409 | * And the bmap_finish transaction can free dir and bmap blocks (two sets | ||
| 410 | * of bmap blocks) giving: | ||
| 411 | * the agf for the ags in which the blocks live: 3 * sector size | ||
| 412 | * the agfl for the ags in which the blocks live: 3 * sector size | ||
| 413 | * the superblock for the free block count: sector size | ||
| 414 | * the allocation btrees: 3 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 415 | */ | ||
| 416 | #define XFS_CALC_RENAME_LOG_RES(mp) \ | ||
| 417 | (MAX( \ | ||
| 418 | ((4 * (mp)->m_sb.sb_inodesize) + \ | ||
| 419 | (2 * XFS_DIROP_LOG_RES(mp)) + \ | ||
| 420 | (128 * (4 + 2 * XFS_DIROP_LOG_COUNT(mp)))), \ | ||
| 421 | ((3 * (mp)->m_sb.sb_sectsize) + \ | ||
| 422 | (3 * (mp)->m_sb.sb_sectsize) + \ | ||
| 423 | (mp)->m_sb.sb_sectsize + \ | ||
| 424 | XFS_ALLOCFREE_LOG_RES(mp, 3) + \ | ||
| 425 | (128 * (7 + XFS_ALLOCFREE_LOG_COUNT(mp, 3)))))) | ||
| 426 | |||
| 427 | #define XFS_RENAME_LOG_RES(mp) ((mp)->m_reservations.tr_rename) | 329 | #define XFS_RENAME_LOG_RES(mp) ((mp)->m_reservations.tr_rename) |
| 428 | |||
| 429 | /* | ||
| 430 | * For creating a link to an inode: | ||
| 431 | * the parent directory inode: inode size | ||
| 432 | * the linked inode: inode size | ||
| 433 | * the directory btree could split: (max depth + v2) * dir block size | ||
| 434 | * the directory bmap btree could join or split: (max depth + v2) * blocksize | ||
| 435 | * And the bmap_finish transaction can free some bmap blocks giving: | ||
| 436 | * the agf for the ag in which the blocks live: sector size | ||
| 437 | * the agfl for the ag in which the blocks live: sector size | ||
| 438 | * the superblock for the free block count: sector size | ||
| 439 | * the allocation btrees: 2 trees * (2 * max depth - 1) * block size | ||
| 440 | */ | ||
| 441 | #define XFS_CALC_LINK_LOG_RES(mp) \ | ||
| 442 | (MAX( \ | ||
| 443 | ((mp)->m_sb.sb_inodesize + \ | ||
| 444 | (mp)->m_sb.sb_inodesize + \ | ||
| 445 | XFS_DIROP_LOG_RES(mp) + \ | ||
| 446 | (128 * (2 + XFS_DIROP_LOG_COUNT(mp)))), \ | ||
| 447 | ((mp)->m_sb.sb_sectsize + \ | ||
| 448 | (mp)->m_sb.sb_sectsize + \ | ||
| 449 | (mp)->m_sb.sb_sectsize + \ | ||
| 450 | XFS_ALLOCFREE_LOG_RES(mp, 1) + \ | ||
| 451 | (128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1)))))) | ||
| 452 | |||
| 453 | #define XFS_LINK_LOG_RES(mp) ((mp)->m_reservations.tr_link) | 330 | #define XFS_LINK_LOG_RES(mp) ((mp)->m_reservations.tr_link) |
| 454 | |||
| 455 | /* | ||
| 456 | * For removing a directory entry we can modify: | ||
| 457 | * the parent directory inode: inode size | ||
| 458 | * the removed inode: inode size | ||
| 459 | * the directory btree could join: (max depth + v2) * dir block size | ||
| 460 | * the directory bmap btree could join or split: (max depth + v2) * blocksize | ||
| 461 | * And the bmap_finish transaction can free the dir and bmap blocks giving: | ||
| 462 | * the agf for the ag in which the blocks live: 2 * sector size | ||
| 463 | * the agfl for the ag in which the blocks live: 2 * sector size | ||
| 464 | * the superblock for the free block count: sector size | ||
| 465 | * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 466 | */ | ||
| 467 | #define XFS_CALC_REMOVE_LOG_RES(mp) \ | ||
| 468 | (MAX( \ | ||
| 469 | ((mp)->m_sb.sb_inodesize + \ | ||
| 470 | (mp)->m_sb.sb_inodesize + \ | ||
| 471 | XFS_DIROP_LOG_RES(mp) + \ | ||
| 472 | (128 * (2 + XFS_DIROP_LOG_COUNT(mp)))), \ | ||
| 473 | ((2 * (mp)->m_sb.sb_sectsize) + \ | ||
| 474 | (2 * (mp)->m_sb.sb_sectsize) + \ | ||
| 475 | (mp)->m_sb.sb_sectsize + \ | ||
| 476 | XFS_ALLOCFREE_LOG_RES(mp, 2) + \ | ||
| 477 | (128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))))) | ||
| 478 | |||
| 479 | #define XFS_REMOVE_LOG_RES(mp) ((mp)->m_reservations.tr_remove) | 331 | #define XFS_REMOVE_LOG_RES(mp) ((mp)->m_reservations.tr_remove) |
| 480 | |||
| 481 | /* | ||
| 482 | * For symlink we can modify: | ||
| 483 | * the parent directory inode: inode size | ||
| 484 | * the new inode: inode size | ||
| 485 | * the inode btree entry: 1 block | ||
| 486 | * the directory btree: (max depth + v2) * dir block size | ||
| 487 | * the directory inode's bmap btree: (max depth + v2) * block size | ||
| 488 | * the blocks for the symlink: 1 kB | ||
| 489 | * Or in the first xact we allocate some inodes giving: | ||
| 490 | * the agi and agf of the ag getting the new inodes: 2 * sectorsize | ||
| 491 | * the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize | ||
| 492 | * the inode btree: max depth * blocksize | ||
| 493 | * the allocation btrees: 2 trees * (2 * max depth - 1) * block size | ||
| 494 | */ | ||
| 495 | #define XFS_CALC_SYMLINK_LOG_RES(mp) \ | ||
| 496 | (MAX( \ | ||
| 497 | ((mp)->m_sb.sb_inodesize + \ | ||
| 498 | (mp)->m_sb.sb_inodesize + \ | ||
| 499 | XFS_FSB_TO_B(mp, 1) + \ | ||
| 500 | XFS_DIROP_LOG_RES(mp) + \ | ||
| 501 | 1024 + \ | ||
| 502 | (128 * (4 + XFS_DIROP_LOG_COUNT(mp)))), \ | ||
| 503 | (2 * (mp)->m_sb.sb_sectsize + \ | ||
| 504 | XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \ | ||
| 505 | XFS_FSB_TO_B((mp), (mp)->m_in_maxlevels) + \ | ||
| 506 | XFS_ALLOCFREE_LOG_RES(mp, 1) + \ | ||
| 507 | (128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \ | ||
| 508 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))))) | ||
| 509 | |||
| 510 | #define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink) | 332 | #define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink) |
| 511 | |||
| 512 | /* | ||
| 513 | * For create we can modify: | ||
| 514 | * the parent directory inode: inode size | ||
| 515 | * the new inode: inode size | ||
| 516 | * the inode btree entry: block size | ||
| 517 | * the superblock for the nlink flag: sector size | ||
| 518 | * the directory btree: (max depth + v2) * dir block size | ||
| 519 | * the directory inode's bmap btree: (max depth + v2) * block size | ||
| 520 | * Or in the first xact we allocate some inodes giving: | ||
| 521 | * the agi and agf of the ag getting the new inodes: 2 * sectorsize | ||
| 522 | * the superblock for the nlink flag: sector size | ||
| 523 | * the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize | ||
| 524 | * the inode btree: max depth * blocksize | ||
| 525 | * the allocation btrees: 2 trees * (max depth - 1) * block size | ||
| 526 | */ | ||
| 527 | #define XFS_CALC_CREATE_LOG_RES(mp) \ | ||
| 528 | (MAX( \ | ||
| 529 | ((mp)->m_sb.sb_inodesize + \ | ||
| 530 | (mp)->m_sb.sb_inodesize + \ | ||
| 531 | (mp)->m_sb.sb_sectsize + \ | ||
| 532 | XFS_FSB_TO_B(mp, 1) + \ | ||
| 533 | XFS_DIROP_LOG_RES(mp) + \ | ||
| 534 | (128 * (3 + XFS_DIROP_LOG_COUNT(mp)))), \ | ||
| 535 | (3 * (mp)->m_sb.sb_sectsize + \ | ||
| 536 | XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \ | ||
| 537 | XFS_FSB_TO_B((mp), (mp)->m_in_maxlevels) + \ | ||
| 538 | XFS_ALLOCFREE_LOG_RES(mp, 1) + \ | ||
| 539 | (128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \ | ||
| 540 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))))) | ||
| 541 | |||
| 542 | #define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create) | 333 | #define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create) |
| 543 | |||
| 544 | /* | ||
| 545 | * Making a new directory is the same as creating a new file. | ||
| 546 | */ | ||
| 547 | #define XFS_CALC_MKDIR_LOG_RES(mp) XFS_CALC_CREATE_LOG_RES(mp) | ||
| 548 | |||
| 549 | #define XFS_MKDIR_LOG_RES(mp) ((mp)->m_reservations.tr_mkdir) | 334 | #define XFS_MKDIR_LOG_RES(mp) ((mp)->m_reservations.tr_mkdir) |
| 550 | |||
| 551 | /* | ||
| 552 | * In freeing an inode we can modify: | ||
| 553 | * the inode being freed: inode size | ||
| 554 | * the super block free inode counter: sector size | ||
| 555 | * the agi hash list and counters: sector size | ||
| 556 | * the inode btree entry: block size | ||
| 557 | * the on disk inode before ours in the agi hash list: inode cluster size | ||
| 558 | * the inode btree: max depth * blocksize | ||
| 559 | * the allocation btrees: 2 trees * (max depth - 1) * block size | ||
| 560 | */ | ||
| 561 | #define XFS_CALC_IFREE_LOG_RES(mp) \ | ||
| 562 | ((mp)->m_sb.sb_inodesize + \ | ||
| 563 | (mp)->m_sb.sb_sectsize + \ | ||
| 564 | (mp)->m_sb.sb_sectsize + \ | ||
| 565 | XFS_FSB_TO_B((mp), 1) + \ | ||
| 566 | MAX((__uint16_t)XFS_FSB_TO_B((mp), 1), XFS_INODE_CLUSTER_SIZE(mp)) + \ | ||
| 567 | (128 * 5) + \ | ||
| 568 | XFS_ALLOCFREE_LOG_RES(mp, 1) + \ | ||
| 569 | (128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \ | ||
| 570 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))) | ||
| 571 | |||
| 572 | |||
| 573 | #define XFS_IFREE_LOG_RES(mp) ((mp)->m_reservations.tr_ifree) | 335 | #define XFS_IFREE_LOG_RES(mp) ((mp)->m_reservations.tr_ifree) |
| 574 | |||
| 575 | /* | ||
| 576 | * When only changing the inode we log the inode and possibly the superblock | ||
| 577 | * We also add a bit of slop for the transaction stuff. | ||
| 578 | */ | ||
| 579 | #define XFS_CALC_ICHANGE_LOG_RES(mp) ((mp)->m_sb.sb_inodesize + \ | ||
| 580 | (mp)->m_sb.sb_sectsize + 512) | ||
| 581 | |||
| 582 | #define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_ichange) | 336 | #define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_ichange) |
| 583 | |||
| 584 | /* | ||
| 585 | * Growing the data section of the filesystem. | ||
| 586 | * superblock | ||
| 587 | * agi and agf | ||
| 588 | * allocation btrees | ||
| 589 | */ | ||
| 590 | #define XFS_CALC_GROWDATA_LOG_RES(mp) \ | ||
| 591 | ((mp)->m_sb.sb_sectsize * 3 + \ | ||
| 592 | XFS_ALLOCFREE_LOG_RES(mp, 1) + \ | ||
| 593 | (128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1)))) | ||
| 594 | |||
| 595 | #define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_reservations.tr_growdata) | 337 | #define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_reservations.tr_growdata) |
| 596 | |||
| 597 | /* | ||
| 598 | * Growing the rt section of the filesystem. | ||
| 599 | * In the first set of transactions (ALLOC) we allocate space to the | ||
| 600 | * bitmap or summary files. | ||
| 601 | * superblock: sector size | ||
| 602 | * agf of the ag from which the extent is allocated: sector size | ||
| 603 | * bmap btree for bitmap/summary inode: max depth * blocksize | ||
| 604 | * bitmap/summary inode: inode size | ||
| 605 | * allocation btrees for 1 block alloc: 2 * (2 * maxdepth - 1) * blocksize | ||
| 606 | */ | ||
| 607 | #define XFS_CALC_GROWRTALLOC_LOG_RES(mp) \ | ||
| 608 | (2 * (mp)->m_sb.sb_sectsize + \ | ||
| 609 | XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + \ | ||
| 610 | (mp)->m_sb.sb_inodesize + \ | ||
| 611 | XFS_ALLOCFREE_LOG_RES(mp, 1) + \ | ||
| 612 | (128 * \ | ||
| 613 | (3 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + \ | ||
| 614 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))) | ||
| 615 | |||
| 616 | #define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_growrtalloc) | 338 | #define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_growrtalloc) |
| 617 | |||
| 618 | /* | ||
| 619 | * Growing the rt section of the filesystem. | ||
| 620 | * In the second set of transactions (ZERO) we zero the new metadata blocks. | ||
| 621 | * one bitmap/summary block: blocksize | ||
| 622 | */ | ||
| 623 | #define XFS_CALC_GROWRTZERO_LOG_RES(mp) \ | ||
| 624 | ((mp)->m_sb.sb_blocksize + 128) | ||
| 625 | |||
| 626 | #define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_reservations.tr_growrtzero) | 339 | #define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_reservations.tr_growrtzero) |
| 627 | |||
| 628 | /* | ||
| 629 | * Growing the rt section of the filesystem. | ||
| 630 | * In the third set of transactions (FREE) we update metadata without | ||
| 631 | * allocating any new blocks. | ||
| 632 | * superblock: sector size | ||
| 633 | * bitmap inode: inode size | ||
| 634 | * summary inode: inode size | ||
| 635 | * one bitmap block: blocksize | ||
| 636 | * summary blocks: new summary size | ||
| 637 | */ | ||
| 638 | #define XFS_CALC_GROWRTFREE_LOG_RES(mp) \ | ||
| 639 | ((mp)->m_sb.sb_sectsize + \ | ||
| 640 | 2 * (mp)->m_sb.sb_inodesize + \ | ||
| 641 | (mp)->m_sb.sb_blocksize + \ | ||
| 642 | (mp)->m_rsumsize + \ | ||
| 643 | (128 * 5)) | ||
| 644 | |||
| 645 | #define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_reservations.tr_growrtfree) | 340 | #define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_reservations.tr_growrtfree) |
| 646 | |||
| 647 | /* | ||
| 648 | * Logging the inode modification timestamp on a synchronous write. | ||
| 649 | * inode | ||
| 650 | */ | ||
| 651 | #define XFS_CALC_SWRITE_LOG_RES(mp) \ | ||
| 652 | ((mp)->m_sb.sb_inodesize + 128) | ||
| 653 | |||
| 654 | #define XFS_SWRITE_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) | 341 | #define XFS_SWRITE_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) |
| 655 | |||
| 656 | /* | 342 | /* |
| 657 | * Logging the inode timestamps on an fsync -- same as SWRITE | 343 | * Logging the inode timestamps on an fsync -- same as SWRITE |
| 658 | * as long as SWRITE logs the entire inode core | 344 | * as long as SWRITE logs the entire inode core |
| 659 | */ | 345 | */ |
| 660 | #define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) | 346 | #define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) |
| 661 | |||
| 662 | /* | ||
| 663 | * Logging the inode mode bits when writing a setuid/setgid file | ||
| 664 | * inode | ||
| 665 | */ | ||
| 666 | #define XFS_CALC_WRITEID_LOG_RES(mp) \ | ||
| 667 | ((mp)->m_sb.sb_inodesize + 128) | ||
| 668 | |||
| 669 | #define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) | 347 | #define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) |
| 670 | |||
| 671 | /* | ||
| 672 | * Converting the inode from non-attributed to attributed. | ||
| 673 | * the inode being converted: inode size | ||
| 674 | * agf block and superblock (for block allocation) | ||
| 675 | * the new block (directory sized) | ||
| 676 | * bmap blocks for the new directory block | ||
| 677 | * allocation btrees | ||
| 678 | */ | ||
| 679 | #define XFS_CALC_ADDAFORK_LOG_RES(mp) \ | ||
| 680 | ((mp)->m_sb.sb_inodesize + \ | ||
| 681 | (mp)->m_sb.sb_sectsize * 2 + \ | ||
| 682 | (mp)->m_dirblksize + \ | ||
| 683 | XFS_FSB_TO_B(mp, (XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1)) + \ | ||
| 684 | XFS_ALLOCFREE_LOG_RES(mp, 1) + \ | ||
| 685 | (128 * (4 + (XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1) + \ | ||
| 686 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))) | ||
| 687 | |||
| 688 | #define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork) | 348 | #define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork) |
| 689 | |||
| 690 | /* | ||
| 691 | * Removing the attribute fork of a file | ||
| 692 | * the inode being truncated: inode size | ||
| 693 | * the inode's bmap btree: max depth * block size | ||
| 694 | * And the bmap_finish transaction can free the blocks and bmap blocks: | ||
| 695 | * the agf for each of the ags: 4 * sector size | ||
| 696 | * the agfl for each of the ags: 4 * sector size | ||
| 697 | * the super block to reflect the freed blocks: sector size | ||
| 698 | * worst case split in allocation btrees per extent assuming 4 extents: | ||
| 699 | * 4 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 700 | */ | ||
| 701 | #define XFS_CALC_ATTRINVAL_LOG_RES(mp) \ | ||
| 702 | (MAX( \ | ||
| 703 | ((mp)->m_sb.sb_inodesize + \ | ||
| 704 | XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + \ | ||
| 705 | (128 * (1 + XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)))), \ | ||
| 706 | ((4 * (mp)->m_sb.sb_sectsize) + \ | ||
| 707 | (4 * (mp)->m_sb.sb_sectsize) + \ | ||
| 708 | (mp)->m_sb.sb_sectsize + \ | ||
| 709 | XFS_ALLOCFREE_LOG_RES(mp, 4) + \ | ||
| 710 | (128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4)))))) | ||
| 711 | |||
| 712 | #define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval) | 349 | #define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval) |
| 713 | |||
| 714 | /* | ||
| 715 | * Setting an attribute. | ||
| 716 | * the inode getting the attribute | ||
| 717 | * the superblock for allocations | ||
| 718 | * the agfs extents are allocated from | ||
| 719 | * the attribute btree * max depth | ||
| 720 | * the inode allocation btree | ||
| 721 | * Since attribute transaction space is dependent on the size of the attribute, | ||
| 722 | * the calculation is done partially at mount time and partially at runtime. | ||
| 723 | */ | ||
| 724 | #define XFS_CALC_ATTRSET_LOG_RES(mp) \ | ||
| 725 | ((mp)->m_sb.sb_inodesize + \ | ||
| 726 | (mp)->m_sb.sb_sectsize + \ | ||
| 727 | XFS_FSB_TO_B((mp), XFS_DA_NODE_MAXDEPTH) + \ | ||
| 728 | (128 * (2 + XFS_DA_NODE_MAXDEPTH))) | ||
| 729 | |||
| 730 | #define XFS_ATTRSET_LOG_RES(mp, ext) \ | 350 | #define XFS_ATTRSET_LOG_RES(mp, ext) \ |
| 731 | ((mp)->m_reservations.tr_attrset + \ | 351 | ((mp)->m_reservations.tr_attrset + \ |
| 732 | (ext * (mp)->m_sb.sb_sectsize) + \ | 352 | (ext * (mp)->m_sb.sb_sectsize) + \ |
| 733 | (ext * XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))) + \ | 353 | (ext * XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))) + \ |
| 734 | (128 * (ext + (ext * XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))))) | 354 | (128 * (ext + (ext * XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))))) |
| 735 | |||
| 736 | /* | ||
| 737 | * Removing an attribute. | ||
| 738 | * the inode: inode size | ||
| 739 | * the attribute btree could join: max depth * block size | ||
| 740 | * the inode bmap btree could join or split: max depth * block size | ||
| 741 | * And the bmap_finish transaction can free the attr blocks freed giving: | ||
| 742 | * the agf for the ag in which the blocks live: 2 * sector size | ||
| 743 | * the agfl for the ag in which the blocks live: 2 * sector size | ||
| 744 | * the superblock for the free block count: sector size | ||
| 745 | * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size | ||
| 746 | */ | ||
| 747 | #define XFS_CALC_ATTRRM_LOG_RES(mp) \ | ||
| 748 | (MAX( \ | ||
| 749 | ((mp)->m_sb.sb_inodesize + \ | ||
| 750 | XFS_FSB_TO_B((mp), XFS_DA_NODE_MAXDEPTH) + \ | ||
| 751 | XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + \ | ||
| 752 | (128 * (1 + XFS_DA_NODE_MAXDEPTH + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)))), \ | ||
| 753 | ((2 * (mp)->m_sb.sb_sectsize) + \ | ||
| 754 | (2 * (mp)->m_sb.sb_sectsize) + \ | ||
| 755 | (mp)->m_sb.sb_sectsize + \ | ||
| 756 | XFS_ALLOCFREE_LOG_RES(mp, 2) + \ | ||
| 757 | (128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))))) | ||
| 758 | |||
| 759 | #define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm) | 355 | #define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm) |
| 760 | |||
| 761 | /* | ||
| 762 | * Clearing a bad agino number in an agi hash bucket. | ||
| 763 | */ | ||
| 764 | #define XFS_CALC_CLEAR_AGI_BUCKET_LOG_RES(mp) \ | ||
| 765 | ((mp)->m_sb.sb_sectsize + 128) | ||
| 766 | |||
| 767 | #define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi) | 356 | #define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi) |
| 768 | 357 | ||
| 769 | 358 | ||
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 9d376be0ea38..a06bd62504fc 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
| @@ -267,7 +267,7 @@ xfs_setattr( | |||
| 267 | if (code) { | 267 | if (code) { |
| 268 | ASSERT(tp == NULL); | 268 | ASSERT(tp == NULL); |
| 269 | lock_flags &= ~XFS_ILOCK_EXCL; | 269 | lock_flags &= ~XFS_ILOCK_EXCL; |
| 270 | ASSERT(lock_flags == XFS_IOLOCK_EXCL); | 270 | ASSERT(lock_flags == XFS_IOLOCK_EXCL || !need_iolock); |
| 271 | goto error_return; | 271 | goto error_return; |
| 272 | } | 272 | } |
| 273 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_SIZE); | 273 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_SIZE); |
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index 3ff9fc071dfe..5347063e9d5a 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
| @@ -903,6 +903,7 @@ struct drm_radeon_cs { | |||
| 903 | #define RADEON_INFO_NUM_Z_PIPES 0x02 | 903 | #define RADEON_INFO_NUM_Z_PIPES 0x02 |
| 904 | #define RADEON_INFO_ACCEL_WORKING 0x03 | 904 | #define RADEON_INFO_ACCEL_WORKING 0x03 |
| 905 | #define RADEON_INFO_CRTC_FROM_ID 0x04 | 905 | #define RADEON_INFO_CRTC_FROM_ID 0x04 |
| 906 | #define RADEON_INFO_ACCEL_WORKING2 0x05 | ||
| 906 | 907 | ||
| 907 | struct drm_radeon_info { | 908 | struct drm_radeon_info { |
| 908 | uint32_t request; | 909 | uint32_t request; |
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index b631c46cffd9..f6c9b7dcb9fd 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h | |||
| @@ -3,6 +3,12 @@ | |||
| 3 | #include <linux/module.h> | 3 | #include <linux/module.h> |
| 4 | #include <linux/major.h> | 4 | #include <linux/major.h> |
| 5 | 5 | ||
| 6 | /* | ||
| 7 | * These allocations are managed by device@lanana.org. If you use an | ||
| 8 | * entry that is not in assigned your entry may well be moved and | ||
| 9 | * reassigned, or set dynamic if a fixed value is not justified. | ||
| 10 | */ | ||
| 11 | |||
| 6 | #define PSMOUSE_MINOR 1 | 12 | #define PSMOUSE_MINOR 1 |
| 7 | #define MS_BUSMOUSE_MINOR 2 | 13 | #define MS_BUSMOUSE_MINOR 2 |
| 8 | #define ATIXL_BUSMOUSE_MINOR 3 | 14 | #define ATIXL_BUSMOUSE_MINOR 3 |
| @@ -30,7 +36,6 @@ | |||
| 30 | #define HPET_MINOR 228 | 36 | #define HPET_MINOR 228 |
| 31 | #define FUSE_MINOR 229 | 37 | #define FUSE_MINOR 229 |
| 32 | #define KVM_MINOR 232 | 38 | #define KVM_MINOR 232 |
| 33 | #define VHOST_NET_MINOR 233 | ||
| 34 | #define BTRFS_MINOR 234 | 39 | #define BTRFS_MINOR 234 |
| 35 | #define AUTOFS_MINOR 235 | 40 | #define AUTOFS_MINOR 235 |
| 36 | #define MISC_DYNAMIC_MINOR 255 | 41 | #define MISC_DYNAMIC_MINOR 255 |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index f149dd10908b..4eb467910a45 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -2321,6 +2321,7 @@ | |||
| 2321 | #define PCI_VENDOR_ID_JMICRON 0x197B | 2321 | #define PCI_VENDOR_ID_JMICRON 0x197B |
| 2322 | #define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 | 2322 | #define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 |
| 2323 | #define PCI_DEVICE_ID_JMICRON_JMB361 0x2361 | 2323 | #define PCI_DEVICE_ID_JMICRON_JMB361 0x2361 |
| 2324 | #define PCI_DEVICE_ID_JMICRON_JMB362 0x2362 | ||
| 2324 | #define PCI_DEVICE_ID_JMICRON_JMB363 0x2363 | 2325 | #define PCI_DEVICE_ID_JMICRON_JMB363 0x2363 |
| 2325 | #define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 | 2326 | #define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 |
| 2326 | #define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 | 2327 | #define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bf243fc54959..f89e7fd59a4c 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -380,7 +380,10 @@ struct sk_buff { | |||
| 380 | kmemcheck_bitfield_begin(flags2); | 380 | kmemcheck_bitfield_begin(flags2); |
| 381 | __u16 queue_mapping:16; | 381 | __u16 queue_mapping:16; |
| 382 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | 382 | #ifdef CONFIG_IPV6_NDISC_NODETYPE |
| 383 | __u8 ndisc_nodetype:2; | 383 | __u8 ndisc_nodetype:2, |
| 384 | deliver_no_wcard:1; | ||
| 385 | #else | ||
| 386 | __u8 deliver_no_wcard:1; | ||
| 384 | #endif | 387 | #endif |
| 385 | kmemcheck_bitfield_end(flags2); | 388 | kmemcheck_bitfield_end(flags2); |
| 386 | 389 | ||
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index f64134653a8c..d63ef8f9609f 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
| @@ -56,15 +56,6 @@ struct writeback_control { | |||
| 56 | unsigned for_reclaim:1; /* Invoked from the page allocator */ | 56 | unsigned for_reclaim:1; /* Invoked from the page allocator */ |
| 57 | unsigned range_cyclic:1; /* range_start is cyclic */ | 57 | unsigned range_cyclic:1; /* range_start is cyclic */ |
| 58 | unsigned more_io:1; /* more io to be dispatched */ | 58 | unsigned more_io:1; /* more io to be dispatched */ |
| 59 | /* | ||
| 60 | * write_cache_pages() won't update wbc->nr_to_write and | ||
| 61 | * mapping->writeback_index if no_nrwrite_index_update | ||
| 62 | * is set. write_cache_pages() may write more than we | ||
| 63 | * requested and we want to make sure nr_to_write and | ||
| 64 | * writeback_index are updated in a consistent manner | ||
| 65 | * so we use a single control to update them | ||
| 66 | */ | ||
| 67 | unsigned no_nrwrite_index_update:1; | ||
| 68 | }; | 59 | }; |
| 69 | 60 | ||
| 70 | /* | 61 | /* |
diff --git a/include/net/dst.h b/include/net/dst.h index 612069beda73..81d1413a8701 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -250,11 +250,11 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev) | |||
| 250 | * Linux networking. Thus, destinations are stackable. | 250 | * Linux networking. Thus, destinations are stackable. |
| 251 | */ | 251 | */ |
| 252 | 252 | ||
| 253 | static inline struct dst_entry *dst_pop(struct dst_entry *dst) | 253 | static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb) |
| 254 | { | 254 | { |
| 255 | struct dst_entry *child = dst_clone(dst->child); | 255 | struct dst_entry *child = skb_dst(skb)->child; |
| 256 | 256 | ||
| 257 | dst_release(dst); | 257 | skb_dst_drop(skb); |
| 258 | return child; | 258 | return child; |
| 259 | } | 259 | } |
| 260 | 260 | ||
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index f5b1ba90e952..f3865c7b4166 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
| @@ -306,7 +306,6 @@ TRACE_EVENT(ext4_da_writepages_result, | |||
| 306 | __field( int, pages_written ) | 306 | __field( int, pages_written ) |
| 307 | __field( long, pages_skipped ) | 307 | __field( long, pages_skipped ) |
| 308 | __field( char, more_io ) | 308 | __field( char, more_io ) |
| 309 | __field( char, no_nrwrite_index_update ) | ||
| 310 | __field( pgoff_t, writeback_index ) | 309 | __field( pgoff_t, writeback_index ) |
| 311 | ), | 310 | ), |
| 312 | 311 | ||
| @@ -317,16 +316,14 @@ TRACE_EVENT(ext4_da_writepages_result, | |||
| 317 | __entry->pages_written = pages_written; | 316 | __entry->pages_written = pages_written; |
| 318 | __entry->pages_skipped = wbc->pages_skipped; | 317 | __entry->pages_skipped = wbc->pages_skipped; |
| 319 | __entry->more_io = wbc->more_io; | 318 | __entry->more_io = wbc->more_io; |
| 320 | __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update; | ||
| 321 | __entry->writeback_index = inode->i_mapping->writeback_index; | 319 | __entry->writeback_index = inode->i_mapping->writeback_index; |
| 322 | ), | 320 | ), |
| 323 | 321 | ||
| 324 | TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld more_io %d no_nrwrite_index_update %d writeback_index %lu", | 322 | TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld more_io %d writeback_index %lu", |
| 325 | jbd2_dev_to_name(__entry->dev), | 323 | jbd2_dev_to_name(__entry->dev), |
| 326 | (unsigned long) __entry->ino, __entry->ret, | 324 | (unsigned long) __entry->ino, __entry->ret, |
| 327 | __entry->pages_written, __entry->pages_skipped, | 325 | __entry->pages_written, __entry->pages_skipped, |
| 328 | __entry->more_io, | 326 | __entry->more_io, |
| 329 | __entry->no_nrwrite_index_update, | ||
| 330 | (unsigned long) __entry->writeback_index) | 327 | (unsigned long) __entry->writeback_index) |
| 331 | ); | 328 | ); |
| 332 | 329 | ||
diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h index 814566c99d29..17df43464df0 100644 --- a/include/trace/events/signal.h +++ b/include/trace/events/signal.h | |||
| @@ -10,7 +10,8 @@ | |||
| 10 | 10 | ||
| 11 | #define TP_STORE_SIGINFO(__entry, info) \ | 11 | #define TP_STORE_SIGINFO(__entry, info) \ |
| 12 | do { \ | 12 | do { \ |
| 13 | if (info == SEND_SIG_NOINFO) { \ | 13 | if (info == SEND_SIG_NOINFO || \ |
| 14 | info == SEND_SIG_FORCED) { \ | ||
| 14 | __entry->errno = 0; \ | 15 | __entry->errno = 0; \ |
| 15 | __entry->code = SI_USER; \ | 16 | __entry->code = SI_USER; \ |
| 16 | } else if (info == SEND_SIG_PRIV) { \ | 17 | } else if (info == SEND_SIG_PRIV) { \ |
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 31d6afe92594..ff86c558af4c 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
| @@ -1507,6 +1507,9 @@ do { \ | |||
| 1507 | divisor = nsec * frequency; | 1507 | divisor = nsec * frequency; |
| 1508 | } | 1508 | } |
| 1509 | 1509 | ||
| 1510 | if (!divisor) | ||
| 1511 | return dividend; | ||
| 1512 | |||
| 1510 | return div64_u64(dividend, divisor); | 1513 | return div64_u64(dividend, divisor); |
| 1511 | } | 1514 | } |
| 1512 | 1515 | ||
| @@ -1529,7 +1532,7 @@ static int perf_event_start(struct perf_event *event) | |||
| 1529 | static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) | 1532 | static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) |
| 1530 | { | 1533 | { |
| 1531 | struct hw_perf_event *hwc = &event->hw; | 1534 | struct hw_perf_event *hwc = &event->hw; |
| 1532 | u64 period, sample_period; | 1535 | s64 period, sample_period; |
| 1533 | s64 delta; | 1536 | s64 delta; |
| 1534 | 1537 | ||
| 1535 | period = perf_calculate_period(event, nsec, count); | 1538 | period = perf_calculate_period(event, nsec, count); |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 5fa63bdf52e4..bbd396ac9546 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
| @@ -835,7 +835,6 @@ int write_cache_pages(struct address_space *mapping, | |||
| 835 | pgoff_t done_index; | 835 | pgoff_t done_index; |
| 836 | int cycled; | 836 | int cycled; |
| 837 | int range_whole = 0; | 837 | int range_whole = 0; |
| 838 | long nr_to_write = wbc->nr_to_write; | ||
| 839 | 838 | ||
| 840 | pagevec_init(&pvec, 0); | 839 | pagevec_init(&pvec, 0); |
| 841 | if (wbc->range_cyclic) { | 840 | if (wbc->range_cyclic) { |
| @@ -852,7 +851,22 @@ int write_cache_pages(struct address_space *mapping, | |||
| 852 | if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) | 851 | if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) |
| 853 | range_whole = 1; | 852 | range_whole = 1; |
| 854 | cycled = 1; /* ignore range_cyclic tests */ | 853 | cycled = 1; /* ignore range_cyclic tests */ |
| 854 | |||
| 855 | /* | ||
| 856 | * If this is a data integrity sync, cap the writeback to the | ||
| 857 | * current end of file. Any extension to the file that occurs | ||
| 858 | * after this is a new write and we don't need to write those | ||
| 859 | * pages out to fulfil our data integrity requirements. If we | ||
| 860 | * try to write them out, we can get stuck in this scan until | ||
| 861 | * the concurrent writer stops adding dirty pages and extending | ||
| 862 | * EOF. | ||
| 863 | */ | ||
| 864 | if (wbc->sync_mode == WB_SYNC_ALL && | ||
| 865 | wbc->range_end == LLONG_MAX) { | ||
| 866 | end = i_size_read(mapping->host) >> PAGE_CACHE_SHIFT; | ||
| 867 | } | ||
| 855 | } | 868 | } |
| 869 | |||
| 856 | retry: | 870 | retry: |
| 857 | done_index = index; | 871 | done_index = index; |
| 858 | while (!done && (index <= end)) { | 872 | while (!done && (index <= end)) { |
| @@ -935,11 +949,10 @@ continue_unlock: | |||
| 935 | done = 1; | 949 | done = 1; |
| 936 | break; | 950 | break; |
| 937 | } | 951 | } |
| 938 | } | 952 | } |
| 939 | 953 | ||
| 940 | if (nr_to_write > 0) { | 954 | if (wbc->nr_to_write > 0) { |
| 941 | nr_to_write--; | 955 | if (--wbc->nr_to_write == 0 && |
| 942 | if (nr_to_write == 0 && | ||
| 943 | wbc->sync_mode == WB_SYNC_NONE) { | 956 | wbc->sync_mode == WB_SYNC_NONE) { |
| 944 | /* | 957 | /* |
| 945 | * We stop writing back only if we are | 958 | * We stop writing back only if we are |
| @@ -970,11 +983,8 @@ continue_unlock: | |||
| 970 | end = writeback_index - 1; | 983 | end = writeback_index - 1; |
| 971 | goto retry; | 984 | goto retry; |
| 972 | } | 985 | } |
| 973 | if (!wbc->no_nrwrite_index_update) { | 986 | if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) |
| 974 | if (wbc->range_cyclic || (range_whole && nr_to_write > 0)) | 987 | mapping->writeback_index = done_index; |
| 975 | mapping->writeback_index = done_index; | ||
| 976 | wbc->nr_to_write = nr_to_write; | ||
| 977 | } | ||
| 978 | 988 | ||
| 979 | return ret; | 989 | return ret; |
| 980 | } | 990 | } |
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index bd537fc10254..50f58f5f1c34 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
| @@ -12,7 +12,7 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | |||
| 12 | return NET_RX_DROP; | 12 | return NET_RX_DROP; |
| 13 | 13 | ||
| 14 | if (skb_bond_should_drop(skb, ACCESS_ONCE(skb->dev->master))) | 14 | if (skb_bond_should_drop(skb, ACCESS_ONCE(skb->dev->master))) |
| 15 | goto drop; | 15 | skb->deliver_no_wcard = 1; |
| 16 | 16 | ||
| 17 | skb->skb_iif = skb->dev->ifindex; | 17 | skb->skb_iif = skb->dev->ifindex; |
| 18 | __vlan_hwaccel_put_tag(skb, vlan_tci); | 18 | __vlan_hwaccel_put_tag(skb, vlan_tci); |
| @@ -84,7 +84,7 @@ vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp, | |||
| 84 | struct sk_buff *p; | 84 | struct sk_buff *p; |
| 85 | 85 | ||
| 86 | if (skb_bond_should_drop(skb, ACCESS_ONCE(skb->dev->master))) | 86 | if (skb_bond_should_drop(skb, ACCESS_ONCE(skb->dev->master))) |
| 87 | goto drop; | 87 | skb->deliver_no_wcard = 1; |
| 88 | 88 | ||
| 89 | skb->skb_iif = skb->dev->ifindex; | 89 | skb->skb_iif = skb->dev->ifindex; |
| 90 | __vlan_hwaccel_put_tag(skb, vlan_tci); | 90 | __vlan_hwaccel_put_tag(skb, vlan_tci); |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 55be90826f5f..529842677817 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
| @@ -708,7 +708,8 @@ static int vlan_dev_init(struct net_device *dev) | |||
| 708 | netif_carrier_off(dev); | 708 | netif_carrier_off(dev); |
| 709 | 709 | ||
| 710 | /* IFF_BROADCAST|IFF_MULTICAST; ??? */ | 710 | /* IFF_BROADCAST|IFF_MULTICAST; ??? */ |
| 711 | dev->flags = real_dev->flags & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI); | 711 | dev->flags = real_dev->flags & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI | |
| 712 | IFF_MASTER | IFF_SLAVE); | ||
| 712 | dev->iflink = real_dev->ifindex; | 713 | dev->iflink = real_dev->ifindex; |
| 713 | dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) | | 714 | dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) | |
| 714 | (1<<__LINK_STATE_DORMANT))) | | 715 | (1<<__LINK_STATE_DORMANT))) | |
diff --git a/net/caif/cfrfml.c b/net/caif/cfrfml.c index cd2830fec935..fd27b172fb5d 100644 --- a/net/caif/cfrfml.c +++ b/net/caif/cfrfml.c | |||
| @@ -83,7 +83,7 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt) | |||
| 83 | if (!cfsrvl_ready(service, &ret)) | 83 | if (!cfsrvl_ready(service, &ret)) |
| 84 | return ret; | 84 | return ret; |
| 85 | 85 | ||
| 86 | if (!cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) { | 86 | if (cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) { |
| 87 | pr_err("CAIF: %s():Packet too large - size=%d\n", | 87 | pr_err("CAIF: %s():Packet too large - size=%d\n", |
| 88 | __func__, cfpkt_getlen(pkt)); | 88 | __func__, cfpkt_getlen(pkt)); |
| 89 | return -EOVERFLOW; | 89 | return -EOVERFLOW; |
diff --git a/net/caif/cfveil.c b/net/caif/cfveil.c index 0fd827f49491..e04f7d964e83 100644 --- a/net/caif/cfveil.c +++ b/net/caif/cfveil.c | |||
| @@ -84,7 +84,7 @@ static int cfvei_transmit(struct cflayer *layr, struct cfpkt *pkt) | |||
| 84 | return ret; | 84 | return ret; |
| 85 | caif_assert(layr->dn != NULL); | 85 | caif_assert(layr->dn != NULL); |
| 86 | caif_assert(layr->dn->transmit != NULL); | 86 | caif_assert(layr->dn->transmit != NULL); |
| 87 | if (!cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) { | 87 | if (cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) { |
| 88 | pr_warning("CAIF: %s(): Packet too large - size=%d\n", | 88 | pr_warning("CAIF: %s(): Packet too large - size=%d\n", |
| 89 | __func__, cfpkt_getlen(pkt)); | 89 | __func__, cfpkt_getlen(pkt)); |
| 90 | return -EOVERFLOW; | 90 | return -EOVERFLOW; |
diff --git a/net/core/dev.c b/net/core/dev.c index 1845b08c624e..2b3bf53bc687 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -2253,11 +2253,9 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, | |||
| 2253 | if (skb_rx_queue_recorded(skb)) { | 2253 | if (skb_rx_queue_recorded(skb)) { |
| 2254 | u16 index = skb_get_rx_queue(skb); | 2254 | u16 index = skb_get_rx_queue(skb); |
| 2255 | if (unlikely(index >= dev->num_rx_queues)) { | 2255 | if (unlikely(index >= dev->num_rx_queues)) { |
| 2256 | if (net_ratelimit()) { | 2256 | WARN_ONCE(dev->num_rx_queues > 1, "%s received packet " |
| 2257 | pr_warning("%s received packet on queue " | 2257 | "on queue %u, but number of RX queues is %u\n", |
| 2258 | "%u, but number of RX queues is %u\n", | 2258 | dev->name, index, dev->num_rx_queues); |
| 2259 | dev->name, index, dev->num_rx_queues); | ||
| 2260 | } | ||
| 2261 | goto done; | 2259 | goto done; |
| 2262 | } | 2260 | } |
| 2263 | rxqueue = dev->_rx + index; | 2261 | rxqueue = dev->_rx + index; |
| @@ -2795,7 +2793,7 @@ static int __netif_receive_skb(struct sk_buff *skb) | |||
| 2795 | struct net_device *orig_dev; | 2793 | struct net_device *orig_dev; |
| 2796 | struct net_device *master; | 2794 | struct net_device *master; |
| 2797 | struct net_device *null_or_orig; | 2795 | struct net_device *null_or_orig; |
| 2798 | struct net_device *null_or_bond; | 2796 | struct net_device *orig_or_bond; |
| 2799 | int ret = NET_RX_DROP; | 2797 | int ret = NET_RX_DROP; |
| 2800 | __be16 type; | 2798 | __be16 type; |
| 2801 | 2799 | ||
| @@ -2812,13 +2810,24 @@ static int __netif_receive_skb(struct sk_buff *skb) | |||
| 2812 | if (!skb->skb_iif) | 2810 | if (!skb->skb_iif) |
| 2813 | skb->skb_iif = skb->dev->ifindex; | 2811 | skb->skb_iif = skb->dev->ifindex; |
| 2814 | 2812 | ||
| 2813 | /* | ||
| 2814 | * bonding note: skbs received on inactive slaves should only | ||
| 2815 | * be delivered to pkt handlers that are exact matches. Also | ||
| 2816 | * the deliver_no_wcard flag will be set. If packet handlers | ||
| 2817 | * are sensitive to duplicate packets these skbs will need to | ||
| 2818 | * be dropped at the handler. The vlan accel path may have | ||
| 2819 | * already set the deliver_no_wcard flag. | ||
| 2820 | */ | ||
| 2815 | null_or_orig = NULL; | 2821 | null_or_orig = NULL; |
| 2816 | orig_dev = skb->dev; | 2822 | orig_dev = skb->dev; |
| 2817 | master = ACCESS_ONCE(orig_dev->master); | 2823 | master = ACCESS_ONCE(orig_dev->master); |
| 2818 | if (master) { | 2824 | if (skb->deliver_no_wcard) |
| 2819 | if (skb_bond_should_drop(skb, master)) | 2825 | null_or_orig = orig_dev; |
| 2826 | else if (master) { | ||
| 2827 | if (skb_bond_should_drop(skb, master)) { | ||
| 2828 | skb->deliver_no_wcard = 1; | ||
| 2820 | null_or_orig = orig_dev; /* deliver only exact match */ | 2829 | null_or_orig = orig_dev; /* deliver only exact match */ |
| 2821 | else | 2830 | } else |
| 2822 | skb->dev = master; | 2831 | skb->dev = master; |
| 2823 | } | 2832 | } |
| 2824 | 2833 | ||
| @@ -2868,10 +2877,10 @@ ncls: | |||
| 2868 | * device that may have registered for a specific ptype. The | 2877 | * device that may have registered for a specific ptype. The |
| 2869 | * handler may have to adjust skb->dev and orig_dev. | 2878 | * handler may have to adjust skb->dev and orig_dev. |
| 2870 | */ | 2879 | */ |
| 2871 | null_or_bond = NULL; | 2880 | orig_or_bond = orig_dev; |
| 2872 | if ((skb->dev->priv_flags & IFF_802_1Q_VLAN) && | 2881 | if ((skb->dev->priv_flags & IFF_802_1Q_VLAN) && |
| 2873 | (vlan_dev_real_dev(skb->dev)->priv_flags & IFF_BONDING)) { | 2882 | (vlan_dev_real_dev(skb->dev)->priv_flags & IFF_BONDING)) { |
| 2874 | null_or_bond = vlan_dev_real_dev(skb->dev); | 2883 | orig_or_bond = vlan_dev_real_dev(skb->dev); |
| 2875 | } | 2884 | } |
| 2876 | 2885 | ||
| 2877 | type = skb->protocol; | 2886 | type = skb->protocol; |
| @@ -2879,7 +2888,7 @@ ncls: | |||
| 2879 | &ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) { | 2888 | &ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) { |
| 2880 | if (ptype->type == type && (ptype->dev == null_or_orig || | 2889 | if (ptype->type == type && (ptype->dev == null_or_orig || |
| 2881 | ptype->dev == skb->dev || ptype->dev == orig_dev || | 2890 | ptype->dev == skb->dev || ptype->dev == orig_dev || |
| 2882 | ptype->dev == null_or_bond)) { | 2891 | ptype->dev == orig_or_bond)) { |
| 2883 | if (pt_prev) | 2892 | if (pt_prev) |
| 2884 | ret = deliver_skb(skb, pt_prev, orig_dev); | 2893 | ret = deliver_skb(skb, pt_prev, orig_dev); |
| 2885 | pt_prev = ptype; | 2894 | pt_prev = ptype; |
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index cf8e70392fe0..785e5276a300 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c | |||
| @@ -107,6 +107,7 @@ static DEFINE_RWLOCK(est_lock); | |||
| 107 | 107 | ||
| 108 | /* Protects against soft lockup during large deletion */ | 108 | /* Protects against soft lockup during large deletion */ |
| 109 | static struct rb_root est_root = RB_ROOT; | 109 | static struct rb_root est_root = RB_ROOT; |
| 110 | static DEFINE_SPINLOCK(est_tree_lock); | ||
| 110 | 111 | ||
| 111 | static void est_timer(unsigned long arg) | 112 | static void est_timer(unsigned long arg) |
| 112 | { | 113 | { |
| @@ -201,7 +202,6 @@ struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats | |||
| 201 | * | 202 | * |
| 202 | * Returns 0 on success or a negative error code. | 203 | * Returns 0 on success or a negative error code. |
| 203 | * | 204 | * |
| 204 | * NOTE: Called under rtnl_mutex | ||
| 205 | */ | 205 | */ |
| 206 | int gen_new_estimator(struct gnet_stats_basic_packed *bstats, | 206 | int gen_new_estimator(struct gnet_stats_basic_packed *bstats, |
| 207 | struct gnet_stats_rate_est *rate_est, | 207 | struct gnet_stats_rate_est *rate_est, |
| @@ -232,6 +232,7 @@ int gen_new_estimator(struct gnet_stats_basic_packed *bstats, | |||
| 232 | est->last_packets = bstats->packets; | 232 | est->last_packets = bstats->packets; |
| 233 | est->avpps = rate_est->pps<<10; | 233 | est->avpps = rate_est->pps<<10; |
| 234 | 234 | ||
| 235 | spin_lock(&est_tree_lock); | ||
| 235 | if (!elist[idx].timer.function) { | 236 | if (!elist[idx].timer.function) { |
| 236 | INIT_LIST_HEAD(&elist[idx].list); | 237 | INIT_LIST_HEAD(&elist[idx].list); |
| 237 | setup_timer(&elist[idx].timer, est_timer, idx); | 238 | setup_timer(&elist[idx].timer, est_timer, idx); |
| @@ -242,6 +243,7 @@ int gen_new_estimator(struct gnet_stats_basic_packed *bstats, | |||
| 242 | 243 | ||
| 243 | list_add_rcu(&est->list, &elist[idx].list); | 244 | list_add_rcu(&est->list, &elist[idx].list); |
| 244 | gen_add_node(est); | 245 | gen_add_node(est); |
| 246 | spin_unlock(&est_tree_lock); | ||
| 245 | 247 | ||
| 246 | return 0; | 248 | return 0; |
| 247 | } | 249 | } |
| @@ -261,13 +263,13 @@ static void __gen_kill_estimator(struct rcu_head *head) | |||
| 261 | * | 263 | * |
| 262 | * Removes the rate estimator specified by &bstats and &rate_est. | 264 | * Removes the rate estimator specified by &bstats and &rate_est. |
| 263 | * | 265 | * |
| 264 | * NOTE: Called under rtnl_mutex | ||
| 265 | */ | 266 | */ |
| 266 | void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, | 267 | void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, |
| 267 | struct gnet_stats_rate_est *rate_est) | 268 | struct gnet_stats_rate_est *rate_est) |
| 268 | { | 269 | { |
| 269 | struct gen_estimator *e; | 270 | struct gen_estimator *e; |
| 270 | 271 | ||
| 272 | spin_lock(&est_tree_lock); | ||
| 271 | while ((e = gen_find_node(bstats, rate_est))) { | 273 | while ((e = gen_find_node(bstats, rate_est))) { |
| 272 | rb_erase(&e->node, &est_root); | 274 | rb_erase(&e->node, &est_root); |
| 273 | 275 | ||
| @@ -278,6 +280,7 @@ void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, | |||
| 278 | list_del_rcu(&e->list); | 280 | list_del_rcu(&e->list); |
| 279 | call_rcu(&e->e_rcu, __gen_kill_estimator); | 281 | call_rcu(&e->e_rcu, __gen_kill_estimator); |
| 280 | } | 282 | } |
| 283 | spin_unlock(&est_tree_lock); | ||
| 281 | } | 284 | } |
| 282 | EXPORT_SYMBOL(gen_kill_estimator); | 285 | EXPORT_SYMBOL(gen_kill_estimator); |
| 283 | 286 | ||
| @@ -312,8 +315,14 @@ EXPORT_SYMBOL(gen_replace_estimator); | |||
| 312 | bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, | 315 | bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, |
| 313 | const struct gnet_stats_rate_est *rate_est) | 316 | const struct gnet_stats_rate_est *rate_est) |
| 314 | { | 317 | { |
| 318 | bool res; | ||
| 319 | |||
| 315 | ASSERT_RTNL(); | 320 | ASSERT_RTNL(); |
| 316 | 321 | ||
| 317 | return gen_find_node(bstats, rate_est) != NULL; | 322 | spin_lock(&est_tree_lock); |
| 323 | res = gen_find_node(bstats, rate_est) != NULL; | ||
| 324 | spin_unlock(&est_tree_lock); | ||
| 325 | |||
| 326 | return res; | ||
| 318 | } | 327 | } |
| 319 | EXPORT_SYMBOL(gen_estimator_active); | 328 | EXPORT_SYMBOL(gen_estimator_active); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 2ad68da418df..1dacd7ba8dbb 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
| @@ -2170,7 +2170,7 @@ static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until) | |||
| 2170 | end_time = ktime_now(); | 2170 | end_time = ktime_now(); |
| 2171 | 2171 | ||
| 2172 | pkt_dev->idle_acc += ktime_to_ns(ktime_sub(end_time, start_time)); | 2172 | pkt_dev->idle_acc += ktime_to_ns(ktime_sub(end_time, start_time)); |
| 2173 | pkt_dev->next_tx = ktime_add_ns(end_time, pkt_dev->delay); | 2173 | pkt_dev->next_tx = ktime_add_ns(spin_until, pkt_dev->delay); |
| 2174 | } | 2174 | } |
| 2175 | 2175 | ||
| 2176 | static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev) | 2176 | static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev) |
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 8e3a1fd938ab..7c3a7d191249 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
| @@ -303,7 +303,7 @@ config ARPD | |||
| 303 | If unsure, say N. | 303 | If unsure, say N. |
| 304 | 304 | ||
| 305 | config SYN_COOKIES | 305 | config SYN_COOKIES |
| 306 | bool "IP: TCP syncookie support (disabled per default)" | 306 | bool "IP: TCP syncookie support" |
| 307 | ---help--- | 307 | ---help--- |
| 308 | Normal TCP/IP networking is open to an attack known as "SYN | 308 | Normal TCP/IP networking is open to an attack known as "SYN |
| 309 | flooding". This denial-of-service attack prevents legitimate remote | 309 | flooding". This denial-of-service attack prevents legitimate remote |
| @@ -328,13 +328,13 @@ config SYN_COOKIES | |||
| 328 | server is really overloaded. If this happens frequently better turn | 328 | server is really overloaded. If this happens frequently better turn |
| 329 | them off. | 329 | them off. |
| 330 | 330 | ||
| 331 | If you say Y here, note that SYN cookies aren't enabled by default; | 331 | If you say Y here, you can disable SYN cookies at run time by |
| 332 | you can enable them by saying Y to "/proc file system support" and | 332 | saying Y to "/proc file system support" and |
| 333 | "Sysctl support" below and executing the command | 333 | "Sysctl support" below and executing the command |
| 334 | 334 | ||
| 335 | echo 1 >/proc/sys/net/ipv4/tcp_syncookies | 335 | echo 0 > /proc/sys/net/ipv4/tcp_syncookies |
| 336 | 336 | ||
| 337 | at boot time after the /proc file system has been mounted. | 337 | after the /proc file system has been mounted. |
| 338 | 338 | ||
| 339 | If unsure, say N. | 339 | If unsure, say N. |
| 340 | 340 | ||
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 856123fe32f9..757f25eb9b4b 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
| @@ -267,8 +267,10 @@ static void __net_exit ipmr_rules_exit(struct net *net) | |||
| 267 | { | 267 | { |
| 268 | struct mr_table *mrt, *next; | 268 | struct mr_table *mrt, *next; |
| 269 | 269 | ||
| 270 | list_for_each_entry_safe(mrt, next, &net->ipv4.mr_tables, list) | 270 | list_for_each_entry_safe(mrt, next, &net->ipv4.mr_tables, list) { |
| 271 | list_del(&mrt->list); | ||
| 271 | kfree(mrt); | 272 | kfree(mrt); |
| 273 | } | ||
| 272 | fib_rules_unregister(net->ipv4.mr_rules_ops); | 274 | fib_rules_unregister(net->ipv4.mr_rules_ops); |
| 273 | } | 275 | } |
| 274 | #else | 276 | #else |
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 5c24db4a3c91..9f6b22206c52 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
| @@ -347,7 +347,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | |||
| 347 | { .sport = th->dest, | 347 | { .sport = th->dest, |
| 348 | .dport = th->source } } }; | 348 | .dport = th->source } } }; |
| 349 | security_req_classify_flow(req, &fl); | 349 | security_req_classify_flow(req, &fl); |
| 350 | if (ip_route_output_key(&init_net, &rt, &fl)) { | 350 | if (ip_route_output_key(sock_net(sk), &rt, &fl)) { |
| 351 | reqsk_free(req); | 351 | reqsk_free(req); |
| 352 | goto out; | 352 | goto out; |
| 353 | } | 353 | } |
diff --git a/net/ipv4/tcp_hybla.c b/net/ipv4/tcp_hybla.c index c209e054a634..377bc9349371 100644 --- a/net/ipv4/tcp_hybla.c +++ b/net/ipv4/tcp_hybla.c | |||
| @@ -126,8 +126,8 @@ static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
| 126 | * calculate 2^fract in a <<7 value. | 126 | * calculate 2^fract in a <<7 value. |
| 127 | */ | 127 | */ |
| 128 | is_slowstart = 1; | 128 | is_slowstart = 1; |
| 129 | increment = ((1 << ca->rho) * hybla_fraction(rho_fractions)) | 129 | increment = ((1 << min(ca->rho, 16U)) * |
| 130 | - 128; | 130 | hybla_fraction(rho_fractions)) - 128; |
| 131 | } else { | 131 | } else { |
| 132 | /* | 132 | /* |
| 133 | * congestion avoidance | 133 | * congestion avoidance |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 202cf09c4cd4..fe193e53af44 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -1555,6 +1555,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
| 1555 | #endif | 1555 | #endif |
| 1556 | 1556 | ||
| 1557 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ | 1557 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ |
| 1558 | sock_rps_save_rxhash(sk, skb->rxhash); | ||
| 1558 | TCP_CHECK_TIMER(sk); | 1559 | TCP_CHECK_TIMER(sk); |
| 1559 | if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) { | 1560 | if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) { |
| 1560 | rsk = sk; | 1561 | rsk = sk; |
| @@ -1579,7 +1580,9 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
| 1579 | } | 1580 | } |
| 1580 | return 0; | 1581 | return 0; |
| 1581 | } | 1582 | } |
| 1582 | } | 1583 | } else |
| 1584 | sock_rps_save_rxhash(sk, skb->rxhash); | ||
| 1585 | |||
| 1583 | 1586 | ||
| 1584 | TCP_CHECK_TIMER(sk); | 1587 | TCP_CHECK_TIMER(sk); |
| 1585 | if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len)) { | 1588 | if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len)) { |
| @@ -1672,8 +1675,6 @@ process: | |||
| 1672 | 1675 | ||
| 1673 | skb->dev = NULL; | 1676 | skb->dev = NULL; |
| 1674 | 1677 | ||
| 1675 | sock_rps_save_rxhash(sk, skb->rxhash); | ||
| 1676 | |||
| 1677 | bh_lock_sock_nested(sk); | 1678 | bh_lock_sock_nested(sk); |
| 1678 | ret = 0; | 1679 | ret = 0; |
| 1679 | if (!sock_owned_by_user(sk)) { | 1680 | if (!sock_owned_by_user(sk)) { |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index ce7992982557..03e62f94ff8e 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
| @@ -483,7 +483,7 @@ route_done: | |||
| 483 | np->tclass, NULL, &fl, (struct rt6_info*)dst, | 483 | np->tclass, NULL, &fl, (struct rt6_info*)dst, |
| 484 | MSG_DONTWAIT, np->dontfrag); | 484 | MSG_DONTWAIT, np->dontfrag); |
| 485 | if (err) { | 485 | if (err) { |
| 486 | ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS); | 486 | ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS); |
| 487 | ip6_flush_pending_frames(sk); | 487 | ip6_flush_pending_frames(sk); |
| 488 | goto out_put; | 488 | goto out_put; |
| 489 | } | 489 | } |
| @@ -565,7 +565,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
| 565 | np->dontfrag); | 565 | np->dontfrag); |
| 566 | 566 | ||
| 567 | if (err) { | 567 | if (err) { |
| 568 | ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS); | 568 | ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS); |
| 569 | ip6_flush_pending_frames(sk); | 569 | ip6_flush_pending_frames(sk); |
| 570 | goto out_put; | 570 | goto out_put; |
| 571 | } | 571 | } |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 073071f2b75b..66078dad7fe8 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
| @@ -120,7 +120,7 @@ static void mroute_clean_tables(struct mr6_table *mrt); | |||
| 120 | static void ipmr_expire_process(unsigned long arg); | 120 | static void ipmr_expire_process(unsigned long arg); |
| 121 | 121 | ||
| 122 | #ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES | 122 | #ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES |
| 123 | #define ip6mr_for_each_table(mrt, met) \ | 123 | #define ip6mr_for_each_table(mrt, net) \ |
| 124 | list_for_each_entry_rcu(mrt, &net->ipv6.mr6_tables, list) | 124 | list_for_each_entry_rcu(mrt, &net->ipv6.mr6_tables, list) |
| 125 | 125 | ||
| 126 | static struct mr6_table *ip6mr_get_table(struct net *net, u32 id) | 126 | static struct mr6_table *ip6mr_get_table(struct net *net, u32 id) |
| @@ -254,8 +254,10 @@ static void __net_exit ip6mr_rules_exit(struct net *net) | |||
| 254 | { | 254 | { |
| 255 | struct mr6_table *mrt, *next; | 255 | struct mr6_table *mrt, *next; |
| 256 | 256 | ||
| 257 | list_for_each_entry_safe(mrt, next, &net->ipv6.mr6_tables, list) | 257 | list_for_each_entry_safe(mrt, next, &net->ipv6.mr6_tables, list) { |
| 258 | list_del(&mrt->list); | ||
| 258 | ip6mr_free_table(mrt); | 259 | ip6mr_free_table(mrt); |
| 260 | } | ||
| 259 | fib_rules_unregister(net->ipv6.mr6_rules_ops); | 261 | fib_rules_unregister(net->ipv6.mr6_rules_ops); |
| 260 | } | 262 | } |
| 261 | #else | 263 | #else |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 59f1881968c7..ab1622d7d409 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
| @@ -1356,7 +1356,10 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size) | |||
| 1356 | IPV6_TLV_PADN, 0 }; | 1356 | IPV6_TLV_PADN, 0 }; |
| 1357 | 1357 | ||
| 1358 | /* we assume size > sizeof(ra) here */ | 1358 | /* we assume size > sizeof(ra) here */ |
| 1359 | skb = sock_alloc_send_skb(sk, size + LL_ALLOCATED_SPACE(dev), 1, &err); | 1359 | size += LL_ALLOCATED_SPACE(dev); |
| 1360 | /* limit our allocations to order-0 page */ | ||
| 1361 | size = min_t(int, size, SKB_MAX_ORDER(0, 0)); | ||
| 1362 | skb = sock_alloc_send_skb(sk, size, 1, &err); | ||
| 1360 | 1363 | ||
| 1361 | if (!skb) | 1364 | if (!skb) |
| 1362 | return NULL; | 1365 | return NULL; |
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index c163d0a149f4..98258b7341e3 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
| @@ -332,14 +332,16 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid) | |||
| 332 | IEEE80211_QUEUE_STOP_REASON_AGGREGATION); | 332 | IEEE80211_QUEUE_STOP_REASON_AGGREGATION); |
| 333 | 333 | ||
| 334 | spin_unlock(&local->ampdu_lock); | 334 | spin_unlock(&local->ampdu_lock); |
| 335 | spin_unlock_bh(&sta->lock); | ||
| 336 | 335 | ||
| 337 | /* send an addBA request */ | 336 | /* prepare tid data */ |
| 338 | sta->ampdu_mlme.dialog_token_allocator++; | 337 | sta->ampdu_mlme.dialog_token_allocator++; |
| 339 | sta->ampdu_mlme.tid_tx[tid]->dialog_token = | 338 | sta->ampdu_mlme.tid_tx[tid]->dialog_token = |
| 340 | sta->ampdu_mlme.dialog_token_allocator; | 339 | sta->ampdu_mlme.dialog_token_allocator; |
| 341 | sta->ampdu_mlme.tid_tx[tid]->ssn = start_seq_num; | 340 | sta->ampdu_mlme.tid_tx[tid]->ssn = start_seq_num; |
| 342 | 341 | ||
| 342 | spin_unlock_bh(&sta->lock); | ||
| 343 | |||
| 344 | /* send AddBA request */ | ||
| 343 | ieee80211_send_addba_request(sdata, pubsta->addr, tid, | 345 | ieee80211_send_addba_request(sdata, pubsta->addr, tid, |
| 344 | sta->ampdu_mlme.tid_tx[tid]->dialog_token, | 346 | sta->ampdu_mlme.tid_tx[tid]->dialog_token, |
| 345 | sta->ampdu_mlme.tid_tx[tid]->ssn, | 347 | sta->ampdu_mlme.tid_tx[tid]->ssn, |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 4f2271316650..9c1da0809160 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
| @@ -349,7 +349,7 @@ static inline int drv_get_survey(struct ieee80211_local *local, int idx, | |||
| 349 | struct survey_info *survey) | 349 | struct survey_info *survey) |
| 350 | { | 350 | { |
| 351 | int ret = -EOPNOTSUPP; | 351 | int ret = -EOPNOTSUPP; |
| 352 | if (local->ops->conf_tx) | 352 | if (local->ops->get_survey) |
| 353 | ret = local->ops->get_survey(&local->hw, idx, survey); | 353 | ret = local->ops->get_survey(&local->hw, idx, survey); |
| 354 | /* trace_drv_get_survey(local, idx, survey, ret); */ | 354 | /* trace_drv_get_survey(local, idx, survey, ret); */ |
| 355 | return ret; | 355 | return ret; |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 0839c4e8fd2e..f803f8b72a93 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
| @@ -1692,14 +1692,52 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | |||
| 1692 | rma = ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->len); | 1692 | rma = ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->len); |
| 1693 | break; | 1693 | break; |
| 1694 | case IEEE80211_STYPE_ACTION: | 1694 | case IEEE80211_STYPE_ACTION: |
| 1695 | if (mgmt->u.action.category != WLAN_CATEGORY_SPECTRUM_MGMT) | 1695 | switch (mgmt->u.action.category) { |
| 1696 | case WLAN_CATEGORY_BACK: { | ||
| 1697 | struct ieee80211_local *local = sdata->local; | ||
| 1698 | int len = skb->len; | ||
| 1699 | struct sta_info *sta; | ||
| 1700 | |||
| 1701 | rcu_read_lock(); | ||
| 1702 | sta = sta_info_get(sdata, mgmt->sa); | ||
| 1703 | if (!sta) { | ||
| 1704 | rcu_read_unlock(); | ||
| 1705 | break; | ||
| 1706 | } | ||
| 1707 | |||
| 1708 | local_bh_disable(); | ||
| 1709 | |||
| 1710 | switch (mgmt->u.action.u.addba_req.action_code) { | ||
| 1711 | case WLAN_ACTION_ADDBA_REQ: | ||
| 1712 | if (len < (IEEE80211_MIN_ACTION_SIZE + | ||
| 1713 | sizeof(mgmt->u.action.u.addba_req))) | ||
| 1714 | break; | ||
| 1715 | ieee80211_process_addba_request(local, sta, mgmt, len); | ||
| 1716 | break; | ||
| 1717 | case WLAN_ACTION_ADDBA_RESP: | ||
| 1718 | if (len < (IEEE80211_MIN_ACTION_SIZE + | ||
| 1719 | sizeof(mgmt->u.action.u.addba_resp))) | ||
| 1720 | break; | ||
| 1721 | ieee80211_process_addba_resp(local, sta, mgmt, len); | ||
| 1722 | break; | ||
| 1723 | case WLAN_ACTION_DELBA: | ||
| 1724 | if (len < (IEEE80211_MIN_ACTION_SIZE + | ||
| 1725 | sizeof(mgmt->u.action.u.delba))) | ||
| 1726 | break; | ||
| 1727 | ieee80211_process_delba(sdata, sta, mgmt, len); | ||
| 1728 | break; | ||
| 1729 | } | ||
| 1730 | local_bh_enable(); | ||
| 1731 | rcu_read_unlock(); | ||
| 1696 | break; | 1732 | break; |
| 1697 | 1733 | } | |
| 1698 | ieee80211_sta_process_chanswitch(sdata, | 1734 | case WLAN_CATEGORY_SPECTRUM_MGMT: |
| 1699 | &mgmt->u.action.u.chan_switch.sw_elem, | 1735 | ieee80211_sta_process_chanswitch(sdata, |
| 1700 | (void *)ifmgd->associated->priv, | 1736 | &mgmt->u.action.u.chan_switch.sw_elem, |
| 1701 | rx_status->mactime); | 1737 | (void *)ifmgd->associated->priv, |
| 1702 | break; | 1738 | rx_status->mactime); |
| 1739 | break; | ||
| 1740 | } | ||
| 1703 | } | 1741 | } |
| 1704 | mutex_unlock(&ifmgd->mtx); | 1742 | mutex_unlock(&ifmgd->mtx); |
| 1705 | 1743 | ||
| @@ -1722,9 +1760,45 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | |||
| 1722 | mutex_unlock(&ifmgd->mtx); | 1760 | mutex_unlock(&ifmgd->mtx); |
| 1723 | 1761 | ||
| 1724 | if (skb->len >= 24 + 2 /* mgmt + deauth reason */ && | 1762 | if (skb->len >= 24 + 2 /* mgmt + deauth reason */ && |
| 1725 | (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_DEAUTH) | 1763 | (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_DEAUTH) { |
| 1726 | cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len); | 1764 | struct ieee80211_local *local = sdata->local; |
| 1765 | struct ieee80211_work *wk; | ||
| 1766 | |||
| 1767 | mutex_lock(&local->work_mtx); | ||
| 1768 | list_for_each_entry(wk, &local->work_list, list) { | ||
| 1769 | if (wk->sdata != sdata) | ||
| 1770 | continue; | ||
| 1771 | |||
| 1772 | if (wk->type != IEEE80211_WORK_ASSOC) | ||
| 1773 | continue; | ||
| 1774 | |||
| 1775 | if (memcmp(mgmt->bssid, wk->filter_ta, ETH_ALEN)) | ||
| 1776 | continue; | ||
| 1777 | if (memcmp(mgmt->sa, wk->filter_ta, ETH_ALEN)) | ||
| 1778 | continue; | ||
| 1727 | 1779 | ||
| 1780 | /* | ||
| 1781 | * Printing the message only here means we can't | ||
| 1782 | * spuriously print it, but it also means that it | ||
| 1783 | * won't be printed when the frame comes in before | ||
| 1784 | * we even tried to associate or in similar cases. | ||
| 1785 | * | ||
| 1786 | * Ultimately, I suspect cfg80211 should print the | ||
| 1787 | * messages instead. | ||
| 1788 | */ | ||
| 1789 | printk(KERN_DEBUG | ||
| 1790 | "%s: deauthenticated from %pM (Reason: %u)\n", | ||
| 1791 | sdata->name, mgmt->bssid, | ||
| 1792 | le16_to_cpu(mgmt->u.deauth.reason_code)); | ||
| 1793 | |||
| 1794 | list_del_rcu(&wk->list); | ||
| 1795 | free_work(wk); | ||
| 1796 | break; | ||
| 1797 | } | ||
| 1798 | mutex_unlock(&local->work_mtx); | ||
| 1799 | |||
| 1800 | cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len); | ||
| 1801 | } | ||
| 1728 | out: | 1802 | out: |
| 1729 | kfree_skb(skb); | 1803 | kfree_skb(skb); |
| 1730 | } | 1804 | } |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 6e2a7bcd8cb8..be9abc2e6348 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
| @@ -1818,17 +1818,26 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx, struct sk_buff_head *frames) | |||
| 1818 | return RX_CONTINUE; | 1818 | return RX_CONTINUE; |
| 1819 | 1819 | ||
| 1820 | if (ieee80211_is_back_req(bar->frame_control)) { | 1820 | if (ieee80211_is_back_req(bar->frame_control)) { |
| 1821 | struct { | ||
| 1822 | __le16 control, start_seq_num; | ||
| 1823 | } __packed bar_data; | ||
| 1824 | |||
| 1821 | if (!rx->sta) | 1825 | if (!rx->sta) |
| 1822 | return RX_DROP_MONITOR; | 1826 | return RX_DROP_MONITOR; |
| 1827 | |||
| 1828 | if (skb_copy_bits(skb, offsetof(struct ieee80211_bar, control), | ||
| 1829 | &bar_data, sizeof(bar_data))) | ||
| 1830 | return RX_DROP_MONITOR; | ||
| 1831 | |||
| 1823 | spin_lock(&rx->sta->lock); | 1832 | spin_lock(&rx->sta->lock); |
| 1824 | tid = le16_to_cpu(bar->control) >> 12; | 1833 | tid = le16_to_cpu(bar_data.control) >> 12; |
| 1825 | if (!rx->sta->ampdu_mlme.tid_active_rx[tid]) { | 1834 | if (!rx->sta->ampdu_mlme.tid_active_rx[tid]) { |
| 1826 | spin_unlock(&rx->sta->lock); | 1835 | spin_unlock(&rx->sta->lock); |
| 1827 | return RX_DROP_MONITOR; | 1836 | return RX_DROP_MONITOR; |
| 1828 | } | 1837 | } |
| 1829 | tid_agg_rx = rx->sta->ampdu_mlme.tid_rx[tid]; | 1838 | tid_agg_rx = rx->sta->ampdu_mlme.tid_rx[tid]; |
| 1830 | 1839 | ||
| 1831 | start_seq_num = le16_to_cpu(bar->start_seq_num) >> 4; | 1840 | start_seq_num = le16_to_cpu(bar_data.start_seq_num) >> 4; |
| 1832 | 1841 | ||
| 1833 | /* reset session timer */ | 1842 | /* reset session timer */ |
| 1834 | if (tid_agg_rx->timeout) | 1843 | if (tid_agg_rx->timeout) |
| @@ -1935,6 +1944,9 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
| 1935 | if (len < IEEE80211_MIN_ACTION_SIZE + 1) | 1944 | if (len < IEEE80211_MIN_ACTION_SIZE + 1) |
| 1936 | break; | 1945 | break; |
| 1937 | 1946 | ||
| 1947 | if (sdata->vif.type == NL80211_IFTYPE_STATION) | ||
| 1948 | return ieee80211_sta_rx_mgmt(sdata, rx->skb); | ||
| 1949 | |||
| 1938 | switch (mgmt->u.action.u.addba_req.action_code) { | 1950 | switch (mgmt->u.action.u.addba_req.action_code) { |
| 1939 | case WLAN_ACTION_ADDBA_REQ: | 1951 | case WLAN_ACTION_ADDBA_REQ: |
| 1940 | if (len < (IEEE80211_MIN_ACTION_SIZE + | 1952 | if (len < (IEEE80211_MIN_ACTION_SIZE + |
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index d885ba311564..570949417f38 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c | |||
| @@ -159,6 +159,9 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a, | |||
| 159 | iph->daddr = new_addr; | 159 | iph->daddr = new_addr; |
| 160 | 160 | ||
| 161 | csum_replace4(&iph->check, addr, new_addr); | 161 | csum_replace4(&iph->check, addr, new_addr); |
| 162 | } else if ((iph->frag_off & htons(IP_OFFSET)) || | ||
| 163 | iph->protocol != IPPROTO_ICMP) { | ||
| 164 | goto out; | ||
| 162 | } | 165 | } |
| 163 | 166 | ||
| 164 | ihl = iph->ihl * 4; | 167 | ihl = iph->ihl * 4; |
| @@ -247,6 +250,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a, | |||
| 247 | break; | 250 | break; |
| 248 | } | 251 | } |
| 249 | 252 | ||
| 253 | out: | ||
| 250 | return action; | 254 | return action; |
| 251 | 255 | ||
| 252 | drop: | 256 | drop: |
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index fdbd0b7bd840..50e3d945e1f4 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
| @@ -125,7 +125,7 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, | |||
| 125 | { | 125 | { |
| 126 | struct tcf_pedit *p = a->priv; | 126 | struct tcf_pedit *p = a->priv; |
| 127 | int i, munged = 0; | 127 | int i, munged = 0; |
| 128 | u8 *pptr; | 128 | unsigned int off; |
| 129 | 129 | ||
| 130 | if (!(skb->tc_verd & TC_OK2MUNGE)) { | 130 | if (!(skb->tc_verd & TC_OK2MUNGE)) { |
| 131 | /* should we set skb->cloned? */ | 131 | /* should we set skb->cloned? */ |
| @@ -134,7 +134,7 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, | |||
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | pptr = skb_network_header(skb); | 137 | off = skb_network_offset(skb); |
| 138 | 138 | ||
| 139 | spin_lock(&p->tcf_lock); | 139 | spin_lock(&p->tcf_lock); |
| 140 | 140 | ||
| @@ -144,17 +144,17 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, | |||
| 144 | struct tc_pedit_key *tkey = p->tcfp_keys; | 144 | struct tc_pedit_key *tkey = p->tcfp_keys; |
| 145 | 145 | ||
| 146 | for (i = p->tcfp_nkeys; i > 0; i--, tkey++) { | 146 | for (i = p->tcfp_nkeys; i > 0; i--, tkey++) { |
| 147 | u32 *ptr; | 147 | u32 *ptr, _data; |
| 148 | int offset = tkey->off; | 148 | int offset = tkey->off; |
| 149 | 149 | ||
| 150 | if (tkey->offmask) { | 150 | if (tkey->offmask) { |
| 151 | if (skb->len > tkey->at) { | 151 | char *d, _d; |
| 152 | char *j = pptr + tkey->at; | 152 | |
| 153 | offset += ((*j & tkey->offmask) >> | 153 | d = skb_header_pointer(skb, off + tkey->at, 1, |
| 154 | tkey->shift); | 154 | &_d); |
| 155 | } else { | 155 | if (!d) |
| 156 | goto bad; | 156 | goto bad; |
| 157 | } | 157 | offset += (*d & tkey->offmask) >> tkey->shift; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | if (offset % 4) { | 160 | if (offset % 4) { |
| @@ -169,9 +169,13 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, | |||
| 169 | goto bad; | 169 | goto bad; |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | ptr = (u32 *)(pptr+offset); | 172 | ptr = skb_header_pointer(skb, off + offset, 4, &_data); |
| 173 | if (!ptr) | ||
| 174 | goto bad; | ||
| 173 | /* just do it, baby */ | 175 | /* just do it, baby */ |
| 174 | *ptr = ((*ptr & tkey->mask) ^ tkey->val); | 176 | *ptr = ((*ptr & tkey->mask) ^ tkey->val); |
| 177 | if (ptr == &_data) | ||
| 178 | skb_store_bits(skb, off + offset, ptr, 4); | ||
| 175 | munged++; | 179 | munged++; |
| 176 | } | 180 | } |
| 177 | 181 | ||
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 96275422c619..4f522143811e 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
| @@ -98,11 +98,11 @@ static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_re | |||
| 98 | { | 98 | { |
| 99 | struct { | 99 | struct { |
| 100 | struct tc_u_knode *knode; | 100 | struct tc_u_knode *knode; |
| 101 | u8 *ptr; | 101 | unsigned int off; |
| 102 | } stack[TC_U32_MAXDEPTH]; | 102 | } stack[TC_U32_MAXDEPTH]; |
| 103 | 103 | ||
| 104 | struct tc_u_hnode *ht = (struct tc_u_hnode*)tp->root; | 104 | struct tc_u_hnode *ht = (struct tc_u_hnode*)tp->root; |
| 105 | u8 *ptr = skb_network_header(skb); | 105 | unsigned int off = skb_network_offset(skb); |
| 106 | struct tc_u_knode *n; | 106 | struct tc_u_knode *n; |
| 107 | int sdepth = 0; | 107 | int sdepth = 0; |
| 108 | int off2 = 0; | 108 | int off2 = 0; |
| @@ -134,8 +134,14 @@ next_knode: | |||
| 134 | #endif | 134 | #endif |
| 135 | 135 | ||
| 136 | for (i = n->sel.nkeys; i>0; i--, key++) { | 136 | for (i = n->sel.nkeys; i>0; i--, key++) { |
| 137 | 137 | unsigned int toff; | |
| 138 | if ((*(__be32*)(ptr+key->off+(off2&key->offmask))^key->val)&key->mask) { | 138 | __be32 *data, _data; |
| 139 | |||
| 140 | toff = off + key->off + (off2 & key->offmask); | ||
| 141 | data = skb_header_pointer(skb, toff, 4, &_data); | ||
| 142 | if (!data) | ||
| 143 | goto out; | ||
| 144 | if ((*data ^ key->val) & key->mask) { | ||
| 139 | n = n->next; | 145 | n = n->next; |
| 140 | goto next_knode; | 146 | goto next_knode; |
| 141 | } | 147 | } |
| @@ -174,29 +180,45 @@ check_terminal: | |||
| 174 | if (sdepth >= TC_U32_MAXDEPTH) | 180 | if (sdepth >= TC_U32_MAXDEPTH) |
| 175 | goto deadloop; | 181 | goto deadloop; |
| 176 | stack[sdepth].knode = n; | 182 | stack[sdepth].knode = n; |
| 177 | stack[sdepth].ptr = ptr; | 183 | stack[sdepth].off = off; |
| 178 | sdepth++; | 184 | sdepth++; |
| 179 | 185 | ||
| 180 | ht = n->ht_down; | 186 | ht = n->ht_down; |
| 181 | sel = 0; | 187 | sel = 0; |
| 182 | if (ht->divisor) | 188 | if (ht->divisor) { |
| 183 | sel = ht->divisor&u32_hash_fold(*(__be32*)(ptr+n->sel.hoff), &n->sel,n->fshift); | 189 | __be32 *data, _data; |
| 184 | 190 | ||
| 191 | data = skb_header_pointer(skb, off + n->sel.hoff, 4, | ||
| 192 | &_data); | ||
| 193 | if (!data) | ||
| 194 | goto out; | ||
| 195 | sel = ht->divisor & u32_hash_fold(*data, &n->sel, | ||
| 196 | n->fshift); | ||
| 197 | } | ||
| 185 | if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT))) | 198 | if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT))) |
| 186 | goto next_ht; | 199 | goto next_ht; |
| 187 | 200 | ||
| 188 | if (n->sel.flags&(TC_U32_OFFSET|TC_U32_VAROFFSET)) { | 201 | if (n->sel.flags&(TC_U32_OFFSET|TC_U32_VAROFFSET)) { |
| 189 | off2 = n->sel.off + 3; | 202 | off2 = n->sel.off + 3; |
| 190 | if (n->sel.flags&TC_U32_VAROFFSET) | 203 | if (n->sel.flags & TC_U32_VAROFFSET) { |
| 191 | off2 += ntohs(n->sel.offmask & *(__be16*)(ptr+n->sel.offoff)) >>n->sel.offshift; | 204 | __be16 *data, _data; |
| 205 | |||
| 206 | data = skb_header_pointer(skb, | ||
| 207 | off + n->sel.offoff, | ||
| 208 | 2, &_data); | ||
| 209 | if (!data) | ||
| 210 | goto out; | ||
| 211 | off2 += ntohs(n->sel.offmask & *data) >> | ||
| 212 | n->sel.offshift; | ||
| 213 | } | ||
| 192 | off2 &= ~3; | 214 | off2 &= ~3; |
| 193 | } | 215 | } |
| 194 | if (n->sel.flags&TC_U32_EAT) { | 216 | if (n->sel.flags&TC_U32_EAT) { |
| 195 | ptr += off2; | 217 | off += off2; |
| 196 | off2 = 0; | 218 | off2 = 0; |
| 197 | } | 219 | } |
| 198 | 220 | ||
| 199 | if (ptr < skb_tail_pointer(skb)) | 221 | if (off < skb->len) |
| 200 | goto next_ht; | 222 | goto next_ht; |
| 201 | } | 223 | } |
| 202 | 224 | ||
| @@ -204,9 +226,10 @@ check_terminal: | |||
| 204 | if (sdepth--) { | 226 | if (sdepth--) { |
| 205 | n = stack[sdepth].knode; | 227 | n = stack[sdepth].knode; |
| 206 | ht = n->ht_up; | 228 | ht = n->ht_up; |
| 207 | ptr = stack[sdepth].ptr; | 229 | off = stack[sdepth].off; |
| 208 | goto check_terminal; | 230 | goto check_terminal; |
| 209 | } | 231 | } |
| 232 | out: | ||
| 210 | return -1; | 233 | return -1; |
| 211 | 234 | ||
| 212 | deadloop: | 235 | deadloop: |
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index 6a329158bdfa..a3cca0a94346 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c | |||
| @@ -95,13 +95,13 @@ resume: | |||
| 95 | goto error_nolock; | 95 | goto error_nolock; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | dst = dst_pop(dst); | 98 | dst = skb_dst_pop(skb); |
| 99 | if (!dst) { | 99 | if (!dst) { |
| 100 | XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR); | 100 | XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR); |
| 101 | err = -EHOSTUNREACH; | 101 | err = -EHOSTUNREACH; |
| 102 | goto error_nolock; | 102 | goto error_nolock; |
| 103 | } | 103 | } |
| 104 | skb_dst_set(skb, dst); | 104 | skb_dst_set_noref(skb, dst); |
| 105 | x = dst->xfrm; | 105 | x = dst->xfrm; |
| 106 | } while (x && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL)); | 106 | } while (x && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL)); |
| 107 | 107 | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index d965a2bad8d3..4bf27d901333 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
| @@ -2153,6 +2153,7 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family) | |||
| 2153 | return 0; | 2153 | return 0; |
| 2154 | } | 2154 | } |
| 2155 | 2155 | ||
| 2156 | skb_dst_force(skb); | ||
| 2156 | dst = skb_dst(skb); | 2157 | dst = skb_dst(skb); |
| 2157 | 2158 | ||
| 2158 | res = xfrm_lookup(net, &dst, &fl, NULL, 0) == 0; | 2159 | res = xfrm_lookup(net, &dst, &fl, NULL, 0) == 0; |
diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin index 102a276f6eea..1adb974e6950 100644 --- a/scripts/Makefile.modbuiltin +++ b/scripts/Makefile.modbuiltin | |||
| @@ -14,6 +14,11 @@ __modbuiltin: | |||
| 14 | 14 | ||
| 15 | include scripts/Kbuild.include | 15 | include scripts/Kbuild.include |
| 16 | 16 | ||
| 17 | ifneq ($(KBUILD_SRC),) | ||
| 18 | # Create output directory if not already present | ||
| 19 | _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) | ||
| 20 | endif | ||
| 21 | |||
| 17 | # The filename Kbuild has precedence over Makefile | 22 | # The filename Kbuild has precedence over Makefile |
| 18 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | 23 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) |
| 19 | kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) | 24 | kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) |
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index 428121a7e705..10c3a871a12d 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c | |||
| @@ -657,7 +657,7 @@ static irqreturn_t atmel_ac97c_interrupt(int irq, void *dev) | |||
| 657 | if (sr & AC97C_SR_CAEVT) { | 657 | if (sr & AC97C_SR_CAEVT) { |
| 658 | struct snd_pcm_runtime *runtime; | 658 | struct snd_pcm_runtime *runtime; |
| 659 | int offset, next_period, block_size; | 659 | int offset, next_period, block_size; |
| 660 | dev_info(&chip->pdev->dev, "channel A event%s%s%s%s%s%s\n", | 660 | dev_dbg(&chip->pdev->dev, "channel A event%s%s%s%s%s%s\n", |
| 661 | casr & AC97C_CSR_OVRUN ? " OVRUN" : "", | 661 | casr & AC97C_CSR_OVRUN ? " OVRUN" : "", |
| 662 | casr & AC97C_CSR_RXRDY ? " RXRDY" : "", | 662 | casr & AC97C_CSR_RXRDY ? " RXRDY" : "", |
| 663 | casr & AC97C_CSR_UNRUN ? " UNRUN" : "", | 663 | casr & AC97C_CSR_UNRUN ? " UNRUN" : "", |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d792cddbf4c2..fc767b6b4785 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -9477,6 +9477,9 @@ static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | |||
| 9477 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), | 9477 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9478 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), | 9478 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 9479 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), | 9479 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
| 9480 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), | ||
| 9481 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), | ||
| 9482 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), | ||
| 9480 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), | 9483 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9481 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | 9484 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9482 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | 9485 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index 1941a357e8c4..d256f5f313b5 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c | |||
| @@ -328,38 +328,6 @@ static struct snd_soc_device spitz_snd_devdata = { | |||
| 328 | .codec_dev = &soc_codec_dev_wm8750, | 328 | .codec_dev = &soc_codec_dev_wm8750, |
| 329 | }; | 329 | }; |
| 330 | 330 | ||
| 331 | /* | ||
| 332 | * FIXME: This is a temporary bodge to avoid cross-tree merge issues. | ||
| 333 | * New drivers should register the wm8750 I2C device in the machine | ||
| 334 | * setup code (under arch/arm for ARM systems). | ||
| 335 | */ | ||
| 336 | static int wm8750_i2c_register(void) | ||
| 337 | { | ||
| 338 | struct i2c_board_info info; | ||
| 339 | struct i2c_adapter *adapter; | ||
| 340 | struct i2c_client *client; | ||
| 341 | |||
| 342 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
| 343 | info.addr = 0x1b; | ||
| 344 | strlcpy(info.type, "wm8750", I2C_NAME_SIZE); | ||
| 345 | |||
| 346 | adapter = i2c_get_adapter(0); | ||
| 347 | if (!adapter) { | ||
| 348 | printk(KERN_ERR "can't get i2c adapter 0\n"); | ||
| 349 | return -ENODEV; | ||
| 350 | } | ||
| 351 | |||
| 352 | client = i2c_new_device(adapter, &info); | ||
| 353 | i2c_put_adapter(adapter); | ||
| 354 | if (!client) { | ||
| 355 | printk(KERN_ERR "can't add i2c device at 0x%x\n", | ||
| 356 | (unsigned int)info.addr); | ||
| 357 | return -ENODEV; | ||
| 358 | } | ||
| 359 | |||
| 360 | return 0; | ||
| 361 | } | ||
| 362 | |||
| 363 | static struct platform_device *spitz_snd_device; | 331 | static struct platform_device *spitz_snd_device; |
| 364 | 332 | ||
| 365 | static int __init spitz_init(void) | 333 | static int __init spitz_init(void) |
| @@ -369,10 +337,6 @@ static int __init spitz_init(void) | |||
| 369 | if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita())) | 337 | if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita())) |
| 370 | return -ENODEV; | 338 | return -ENODEV; |
| 371 | 339 | ||
| 372 | ret = wm8750_i2c_setup(); | ||
| 373 | if (ret != 0) | ||
| 374 | return ret; | ||
| 375 | |||
| 376 | spitz_snd_device = platform_device_alloc("soc-audio", -1); | 340 | spitz_snd_device = platform_device_alloc("soc-audio", -1); |
| 377 | if (!spitz_snd_device) | 341 | if (!spitz_snd_device) |
| 378 | return -ENOMEM; | 342 | return -ENOMEM; |
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c index 4c7b051f9d17..1bc56b2b94e2 100644 --- a/sound/spi/at73c213.c +++ b/sound/spi/at73c213.c | |||
| @@ -69,7 +69,6 @@ struct snd_at73c213 { | |||
| 69 | int irq; | 69 | int irq; |
| 70 | int period; | 70 | int period; |
| 71 | unsigned long bitrate; | 71 | unsigned long bitrate; |
| 72 | struct clk *bitclk; | ||
| 73 | struct ssc_device *ssc; | 72 | struct ssc_device *ssc; |
| 74 | struct spi_device *spi; | 73 | struct spi_device *spi; |
| 75 | u8 spi_wbuffer[2]; | 74 | u8 spi_wbuffer[2]; |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 7fd6b151feb5..b63e5713849f 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
| @@ -1745,7 +1745,12 @@ static int dso__load_kernel_sym(struct dso *self, struct map *map, | |||
| 1745 | if (symbol_conf.vmlinux_name != NULL) { | 1745 | if (symbol_conf.vmlinux_name != NULL) { |
| 1746 | err = dso__load_vmlinux(self, map, | 1746 | err = dso__load_vmlinux(self, map, |
| 1747 | symbol_conf.vmlinux_name, filter); | 1747 | symbol_conf.vmlinux_name, filter); |
| 1748 | goto out_try_fixup; | 1748 | if (err > 0) { |
| 1749 | dso__set_long_name(self, | ||
| 1750 | strdup(symbol_conf.vmlinux_name)); | ||
| 1751 | goto out_fixup; | ||
| 1752 | } | ||
| 1753 | return err; | ||
| 1749 | } | 1754 | } |
| 1750 | 1755 | ||
| 1751 | if (vmlinux_path != NULL) { | 1756 | if (vmlinux_path != NULL) { |
| @@ -1806,7 +1811,6 @@ do_kallsyms: | |||
| 1806 | pr_debug("Using %s for symbols\n", kallsyms_filename); | 1811 | pr_debug("Using %s for symbols\n", kallsyms_filename); |
| 1807 | free(kallsyms_allocated_filename); | 1812 | free(kallsyms_allocated_filename); |
| 1808 | 1813 | ||
| 1809 | out_try_fixup: | ||
| 1810 | if (err > 0) { | 1814 | if (err > 0) { |
| 1811 | out_fixup: | 1815 | out_fixup: |
| 1812 | if (kallsyms_filename != NULL) | 1816 | if (kallsyms_filename != NULL) |
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 7c79c1d76d0c..3500dee9cf2b 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
| @@ -192,12 +192,13 @@ static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) | |||
| 192 | 192 | ||
| 193 | int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level) | 193 | int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level) |
| 194 | { | 194 | { |
| 195 | u32 old_irr = ioapic->irr; | 195 | u32 old_irr; |
| 196 | u32 mask = 1 << irq; | 196 | u32 mask = 1 << irq; |
| 197 | union kvm_ioapic_redirect_entry entry; | 197 | union kvm_ioapic_redirect_entry entry; |
| 198 | int ret = 1; | 198 | int ret = 1; |
| 199 | 199 | ||
| 200 | spin_lock(&ioapic->lock); | 200 | spin_lock(&ioapic->lock); |
| 201 | old_irr = ioapic->irr; | ||
| 201 | if (irq >= 0 && irq < IOAPIC_NUM_PINS) { | 202 | if (irq >= 0 && irq < IOAPIC_NUM_PINS) { |
| 202 | entry = ioapic->redirtbl[irq]; | 203 | entry = ioapic->redirtbl[irq]; |
| 203 | level ^= entry.fields.polarity; | 204 | level ^= entry.fields.polarity; |
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index d2f06be63354..96048ee9e39e 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c | |||
| @@ -271,7 +271,7 @@ static void kvm_iommu_put_pages(struct kvm *kvm, | |||
| 271 | pfn = phys >> PAGE_SHIFT; | 271 | pfn = phys >> PAGE_SHIFT; |
| 272 | 272 | ||
| 273 | /* Unmap address from IO address space */ | 273 | /* Unmap address from IO address space */ |
| 274 | order = iommu_unmap(domain, gfn_to_gpa(gfn), PAGE_SIZE); | 274 | order = iommu_unmap(domain, gfn_to_gpa(gfn), 0); |
| 275 | unmap_pages = 1ULL << order; | 275 | unmap_pages = 1ULL << order; |
| 276 | 276 | ||
| 277 | /* Unpin all pages we just unmapped to not leak any memory */ | 277 | /* Unpin all pages we just unmapped to not leak any memory */ |
