Conflicts: drivers/net/ethernet/emulex/benet/be_main.c drivers/net/ethernet/intel/igb/igb_main.c drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c include/net/scm.h net/batman-adv/routing.c net/ipv4/tcp_input.c The e{uid,gid} --> {uid,gid} credentials fix conflicted with the cleanup in net-next to now pass cred structs around. The be2net driver had a bug fix in 'net' that overlapped with the VLAN interface changes by Patrick McHardy in net-next. An IGB conflict existed because in 'net' the build_skb() support was reverted, and in 'net-next' there was a comment style fix within that code. Several batman-adv conflicts were resolved by making sure that all calls to batadv_is_my_mac() are changed to have a new bat_priv first argument. Eric Dumazet's TS ECR fix in TCP in 'net' conflicted with the F-RTO rewrite in 'net-next', mostly overlapping changes. Thanks to Stephen Rothwell and Antonio Quartulli for help with several of these merge resolutions.
Unified · Split
| @@ -227,7 +227,7 @@ X!Isound/sound_firmware.c · 226 unmodified lines | ||
| 227 | 227 | <chapter id="uart16x50"> |
| 228 | 228 | <title>16x50 UART Driver</title> |
| 229 | 229 | !Edrivers/tty/serial/serial_core.c |
| 230 | −!Edrivers/tty/serial/8250/8250.c | |
| 230 | +!Edrivers/tty/serial/8250/8250_core.c | |
| 231 | 231 | </chapter> |
| 232 | 232 | |
| 233 | 233 | <chapter id="fbdev"> |
| @@ -596,9 +596,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 595 unmodified lines | ||
| 596 | 596 | is selected automatically. Check |
| 597 | 597 | Documentation/kdump/kdump.txt for further details. |
| 598 | 598 | |
| 599 | − crashkernel_low=size[KMG] | |
| 600 | − [KNL, x86] parts under 4G. | |
| 601 | − | |
| 602 | 599 | crashkernel=range1:size1[,range2:size2,...][@offset] |
| 603 | 600 | [KNL] Same as above, but depends on the memory |
| 604 | 601 | in the running system. The syntax of range is |
| @@ -606,6 +603,26 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 1 unmodified line | ||
| 606 | 603 | a memory unit (amount[KMG]). See also |
| 607 | 604 | Documentation/kdump/kdump.txt for an example. |
| 608 | 605 | |
| 606 | + crashkernel=size[KMG],high | |
| 607 | + [KNL, x86_64] range could be above 4G. Allow kernel | |
| 608 | + to allocate physical memory region from top, so could | |
| 609 | + be above 4G if system have more than 4G ram installed. | |
| 610 | + Otherwise memory region will be allocated below 4G, if | |
| 611 | + available. | |
| 612 | + It will be ignored if crashkernel=X is specified. | |
| 613 | + crashkernel=size[KMG],low | |
| 614 | + [KNL, x86_64] range under 4G. When crashkernel=X,high | |
| 615 | + is passed, kernel could allocate physical memory region | |
| 616 | + above 4G, that cause second kernel crash on system | |
| 617 | + that require some amount of low memory, e.g. swiotlb | |
| 618 | + requires at least 64M+32K low memory. Kernel would | |
| 619 | + try to allocate 72M below 4G automatically. | |
| 620 | + This one let user to specify own low range under 4G | |
| 621 | + for second kernel instead. | |
| 622 | + 0: to disable low allocation. | |
| 623 | + It will be ignored when crashkernel=X,high is not used | |
| 624 | + or memory reserved is below 4G. | |
| 625 | + | |
| 609 | 626 | cs89x0_dma= [HW,NET] |
| 610 | 627 | Format: <dma> |
| 611 | 628 | |
| @@ -788,6 +805,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 176 unmodified lines | ||
| 788 | 805 | edd= [EDD] |
| 789 | 806 | Format: {"off" | "on" | "skip[mbr]"} |
| 790 | 807 | |
| 808 | + efi_no_storage_paranoia [EFI; X86] | |
| 809 | + Using this parameter you can use more than 50% of | |
| 810 | + your efi variable storage. Use this parameter only if | |
| 811 | + you are really sure that your UEFI does sane gc and | |
| 812 | + fulfills the spec otherwise your board may brick. | |
| 813 | + | |
| 791 | 814 | eisa_irq_edge= [PARISC,HW] |
| 792 | 815 | See header of drivers/parisc/eisa.c. |
| 793 | 816 | |
| @@ -1,4 +1,4 @@ | ||
| 1 | −Copyright (c) 2003-2012 QLogic Corporation | |
| 1 | +Copyright (c) 2003-2013 QLogic Corporation | |
| 2 | 2 | QLogic Linux FC-FCoE Driver |
| 3 | 3 | |
| 4 | 4 | This program includes a device driver for Linux 3.x. |
| @@ -4941,6 +4941,12 @@ W: logfs.org · 4940 unmodified lines | ||
| 4941 | 4941 | S: Maintained |
| 4942 | 4942 | F: fs/logfs/ |
| 4943 | 4943 | |
| 4944 | +LPC32XX MACHINE SUPPORT | |
| 4945 | +M: Roland Stigge <stigge@antcom.de> | |
| 4946 | +L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | |
| 4947 | +S: Maintained | |
| 4948 | +F: arch/arm/mach-lpc32xx/ | |
| 4949 | + | |
| 4944 | 4950 | LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) |
| 4945 | 4951 | M: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com> |
| 4946 | 4952 | M: Sreekanth Reddy <Sreekanth.Reddy@lsi.com> |
| @@ -6627,7 +6633,7 @@ S: Supported · 1680 unmodified lines | ||
| 6627 | 6633 | F: fs/reiserfs/ |
| 6628 | 6634 | |
| 6629 | 6635 | REGISTER MAP ABSTRACTION |
| 6630 | −M: Mark Brown <broonie@opensource.wolfsonmicro.com> | |
| 6636 | +M: Mark Brown <broonie@kernel.org> | |
| 6631 | 6637 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git |
| 6632 | 6638 | S: Supported |
| 6633 | 6639 | F: drivers/base/regmap/ |
| @@ -7375,7 +7381,7 @@ F: sound/ · 741 unmodified lines | ||
| 7375 | 7381 | |
| 7376 | 7382 | SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC) |
| 7377 | 7383 | M: Liam Girdwood <lgirdwood@gmail.com> |
| 7378 | −M: Mark Brown <broonie@opensource.wolfsonmicro.com> | |
| 7384 | +M: Mark Brown <broonie@kernel.org> | |
| 7379 | 7385 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git |
| 7380 | 7386 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
| 7381 | 7387 | W: http://alsa-project.org/main/index.php/ASoC |
| @@ -7464,7 +7470,7 @@ F: drivers/clk/spear/ · 82 unmodified lines | ||
| 7464 | 7470 | |
| 7465 | 7471 | SPI SUBSYSTEM |
| 7466 | 7472 | M: Grant Likely <grant.likely@secretlab.ca> |
| 7467 | −M: Mark Brown <broonie@opensource.wolfsonmicro.com> | |
| 7473 | +M: Mark Brown <broonie@kernel.org> | |
| 7468 | 7474 | L: spi-devel-general@lists.sourceforge.net |
| 7469 | 7475 | Q: http://patchwork.kernel.org/project/spi-devel-general/list/ |
| 7470 | 7476 | T: git git://git.secretlab.ca/git/linux-2.6.git |
| @@ -8709,7 +8715,7 @@ F: drivers/scsi/vmw_pvscsi.h · 1238 unmodified lines | ||
| 8709 | 8715 | |
| 8710 | 8716 | VOLTAGE AND CURRENT REGULATOR FRAMEWORK |
| 8711 | 8717 | M: Liam Girdwood <lrg@ti.com> |
| 8712 | −M: Mark Brown <broonie@opensource.wolfsonmicro.com> | |
| 8718 | +M: Mark Brown <broonie@kernel.org> | |
| 8713 | 8719 | W: http://opensource.wolfsonmicro.com/node/15 |
| 8714 | 8720 | W: http://www.slimlogic.co.uk/?p=48 |
| 8715 | 8721 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/lrg/regulator.git |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | VERSION = 3 |
| 2 | 2 | PATCHLEVEL = 9 |
| 3 | 3 | SUBLEVEL = 0 |
| 4 | −EXTRAVERSION = -rc5 | |
| 4 | +EXTRAVERSION = -rc8 | |
| 5 | 5 | NAME = Unicycling Gorilla |
| 6 | 6 | |
| 7 | 7 | # *DOCUMENTATION* |
| @@ -513,7 +513,8 @@ ifeq ($(KBUILD_EXTMOD),) · 505 unmodified lines | ||
| 513 | 513 | # Carefully list dependencies so we do not try to build scripts twice |
| 514 | 514 | # in parallel |
| 515 | 515 | PHONY += scripts |
| 516 | −scripts: scripts_basic include/config/auto.conf include/config/tristate.conf | |
| 516 | +scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \ | |
| 517 | + asm-generic | |
| 517 | 518 | $(Q)$(MAKE) $(build)=$(@) |
| 518 | 519 | |
| 519 | 520 | # Objects we will link into vmlinux / subdirs we need to visit |
| @@ -12,7 +12,7 @@ NM := $(NM) -B · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | LDFLAGS_vmlinux := -static -N #-relax |
| 14 | 14 | CHECKFLAGS += -D__alpha__ -m64 |
| 15 | −cflags-y := -pipe -mno-fp-regs -ffixed-8 -msmall-data | |
| 15 | +cflags-y := -pipe -mno-fp-regs -ffixed-8 | |
| 16 | 16 | cflags-y += $(call cc-option, -fno-jump-tables) |
| 17 | 17 | |
| 18 | 18 | cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4 |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #define fd_disable_irq() disable_irq(FLOPPY_IRQ) |
| 27 | 27 | #define fd_cacheflush(addr,size) /* nothing */ |
| 28 | 28 | #define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt,\ |
| 29 | − IRQF_DISABLED, "floppy", NULL) | |
| 29 | + 0, "floppy", NULL) | |
| 30 | 30 | #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL) |
| 31 | 31 | |
| 32 | 32 | #ifdef CONFIG_PCI |
| @@ -117,13 +117,6 @@ handle_irq(int irq) · 116 unmodified lines | ||
| 117 | 117 | return; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | − /* | |
| 121 | − * From here we must proceed with IPL_MAX. Note that we do not | |
| 122 | − * explicitly enable interrupts afterwards - some MILO PALcode | |
| 123 | − * (namely LX164 one) seems to have severe problems with RTI | |
| 124 | − * at IPL 0. | |
| 125 | − */ | |
| 126 | − local_irq_disable(); | |
| 127 | 120 | irq_enter(); |
| 128 | 121 | generic_handle_irq_desc(irq, desc); |
| 129 | 122 | irq_exit(); |
| @@ -45,6 +45,14 @@ do_entInt(unsigned long type, unsigned long vector, · 44 unmodified lines | ||
| 45 | 45 | unsigned long la_ptr, struct pt_regs *regs) |
| 46 | 46 | { |
| 47 | 47 | struct pt_regs *old_regs; |
| 48 | + | |
| 49 | + /* | |
| 50 | + * Disable interrupts during IRQ handling. | |
| 51 | + * Note that there is no matching local_irq_enable() due to | |
| 52 | + * severe problems with RTI at IPL0 and some MILO PALcode | |
| 53 | + * (namely LX164). | |
| 54 | + */ | |
| 55 | + local_irq_disable(); | |
| 48 | 56 | switch (type) { |
| 49 | 57 | case 0: |
| 50 | 58 | #ifdef CONFIG_SMP |
| @@ -62,7 +70,6 @@ do_entInt(unsigned long type, unsigned long vector, · 11 unmodified lines | ||
| 62 | 70 | { |
| 63 | 71 | long cpu; |
| 64 | 72 | |
| 65 | − local_irq_disable(); | |
| 66 | 73 | smp_percpu_timer_interrupt(regs); |
| 67 | 74 | cpu = smp_processor_id(); |
| 68 | 75 | if (cpu != boot_cpuid) { |
| @@ -222,7 +229,6 @@ process_mcheck_info(unsigned long vector, unsigned long la_ptr, · 153 unmodified lines | ||
| 222 | 229 | |
| 223 | 230 | struct irqaction timer_irqaction = { |
| 224 | 231 | .handler = timer_interrupt, |
| 225 | − .flags = IRQF_DISABLED, | |
| 226 | 232 | .name = "timer", |
| 227 | 233 | }; |
| 228 | 234 | |
| @@ -188,6 +188,10 @@ nautilus_machine_check(unsigned long vector, unsigned long la_ptr) · 187 unmodified lines | ||
| 188 | 188 | extern void free_reserved_mem(void *, void *); |
| 189 | 189 | extern void pcibios_claim_one_bus(struct pci_bus *); |
| 190 | 190 | |
| 191 | +static struct resource irongate_io = { | |
| 192 | + .name = "Irongate PCI IO", | |
| 193 | + .flags = IORESOURCE_IO, | |
| 194 | +}; | |
| 191 | 195 | static struct resource irongate_mem = { |
| 192 | 196 | .name = "Irongate PCI MEM", |
| 193 | 197 | .flags = IORESOURCE_MEM, |
| @@ -209,6 +213,7 @@ nautilus_init_pci(void) · 15 unmodified lines | ||
| 209 | 213 | |
| 210 | 214 | irongate = pci_get_bus_and_slot(0, 0); |
| 211 | 215 | bus->self = irongate; |
| 216 | + bus->resource[0] = &irongate_io; | |
| 212 | 217 | bus->resource[1] = &irongate_mem; |
| 213 | 218 | |
| 214 | 219 | pci_bus_size_bridges(bus); |
| @@ -280,15 +280,15 @@ titan_late_init(void) · 279 unmodified lines | ||
| 280 | 280 | * all reported to the kernel as machine checks, so the handler |
| 281 | 281 | * is a nop so it can be called to count the individual events. |
| 282 | 282 | */ |
| 283 | − titan_request_irq(63+16, titan_intr_nop, IRQF_DISABLED, | |
| 283 | + titan_request_irq(63+16, titan_intr_nop, 0, | |
| 284 | 284 | "CChip Error", NULL); |
| 285 | − titan_request_irq(62+16, titan_intr_nop, IRQF_DISABLED, | |
| 285 | + titan_request_irq(62+16, titan_intr_nop, 0, | |
| 286 | 286 | "PChip 0 H_Error", NULL); |
| 287 | − titan_request_irq(61+16, titan_intr_nop, IRQF_DISABLED, | |
| 287 | + titan_request_irq(61+16, titan_intr_nop, 0, | |
| 288 | 288 | "PChip 1 H_Error", NULL); |
| 289 | − titan_request_irq(60+16, titan_intr_nop, IRQF_DISABLED, | |
| 289 | + titan_request_irq(60+16, titan_intr_nop, 0, | |
| 290 | 290 | "PChip 0 C_Error", NULL); |
| 291 | − titan_request_irq(59+16, titan_intr_nop, IRQF_DISABLED, | |
| 291 | + titan_request_irq(59+16, titan_intr_nop, 0, | |
| 292 | 292 | "PChip 1 C_Error", NULL); |
| 293 | 293 | |
| 294 | 294 | /* |
| @@ -348,9 +348,9 @@ privateer_init_pci(void) · 53 unmodified lines | ||
| 348 | 348 | * Hook a couple of extra err interrupts that the |
| 349 | 349 | * common titan code won't. |
| 350 | 350 | */ |
| 351 | − titan_request_irq(53+16, titan_intr_nop, IRQF_DISABLED, | |
| 351 | + titan_request_irq(53+16, titan_intr_nop, 0, | |
| 352 | 352 | "NMI", NULL); |
| 353 | − titan_request_irq(50+16, titan_intr_nop, IRQF_DISABLED, | |
| 353 | + titan_request_irq(50+16, titan_intr_nop, 0, | |
| 354 | 354 | "Temperature Warning", NULL); |
| 355 | 355 | |
| 356 | 356 | /* |
| @@ -39,7 +39,7 @@ static inline long arch_local_irq_save(void) · 38 unmodified lines | ||
| 39 | 39 | " flag.nz %0 \n" |
| 40 | 40 | : "=r"(temp), "=r"(flags) |
| 41 | 41 | : "n"((STATUS_E1_MASK | STATUS_E2_MASK)) |
| 42 | − : "cc"); | |
| 42 | + : "memory", "cc"); | |
| 43 | 43 | |
| 44 | 44 | return flags; |
| 45 | 45 | } |
| @@ -53,7 +53,8 @@ static inline void arch_local_irq_restore(unsigned long flags) · 7 unmodified lines | ||
| 53 | 53 | __asm__ __volatile__( |
| 54 | 54 | " flag %0 \n" |
| 55 | 55 | : |
| 56 | − : "r"(flags)); | |
| 56 | + : "r"(flags) | |
| 57 | + : "memory"); | |
| 57 | 58 | } |
| 58 | 59 | |
| 59 | 60 | /* |
| @@ -73,7 +74,8 @@ static inline void arch_local_irq_disable(void) · 13 unmodified lines | ||
| 73 | 74 | " and %0, %0, %1 \n" |
| 74 | 75 | " flag %0 \n" |
| 75 | 76 | : "=&r"(temp) |
| 76 | − : "n"(~(STATUS_E1_MASK | STATUS_E2_MASK))); | |
| 77 | + : "n"(~(STATUS_E1_MASK | STATUS_E2_MASK)) | |
| 78 | + : "memory"); | |
| 77 | 79 | } |
| 78 | 80 | |
| 79 | 81 | /* |
| @@ -85,7 +87,9 @@ static inline long arch_local_save_flags(void) · 5 unmodified lines | ||
| 85 | 87 | |
| 86 | 88 | __asm__ __volatile__( |
| 87 | 89 | " lr %0, [status32] \n" |
| 88 | − : "=&r"(temp)); | |
| 90 | + : "=&r"(temp) | |
| 91 | + : | |
| 92 | + : "memory"); | |
| 89 | 93 | |
| 90 | 94 | return temp; |
| 91 | 95 | } |
| @@ -152,7 +152,6 @@ · 151 unmodified lines | ||
| 152 | 152 | i2c0: i2c@80058000 { |
| 153 | 153 | pinctrl-names = "default"; |
| 154 | 154 | pinctrl-0 = <&i2c0_pins_a>; |
| 155 | − clock-frequency = <400000>; | |
| 156 | 155 | status = "okay"; |
| 157 | 156 | |
| 158 | 157 | sgtl5000: codec@0a { |
| @@ -70,7 +70,6 @@ · 69 unmodified lines | ||
| 70 | 70 | i2c0: i2c@80058000 { |
| 71 | 71 | pinctrl-names = "default"; |
| 72 | 72 | pinctrl-0 = <&i2c0_pins_a>; |
| 73 | − clock-frequency = <400000>; | |
| 74 | 73 | status = "okay"; |
| 75 | 74 | |
| 76 | 75 | rtc: rtc@51 { |
| @@ -91,6 +91,7 @@ · 90 unmodified lines | ||
| 91 | 91 | compatible = "arm,cortex-a9-twd-timer"; |
| 92 | 92 | reg = <0x00a00600 0x20>; |
| 93 | 93 | interrupts = <1 13 0xf01>; |
| 94 | + clocks = <&clks 15>; | |
| 94 | 95 | }; |
| 95 | 96 | |
| 96 | 97 | L2: l2-cache@00a02000 { |
| @@ -96,11 +96,11 @@ · 95 unmodified lines | ||
| 96 | 96 | marvell,function = "gpio"; |
| 97 | 97 | }; |
| 98 | 98 | pmx_led_rebuild_brt_ctrl_1: pmx-led-rebuild-brt-ctrl-1 { |
| 99 | − marvell,pins = "mpp44"; | |
| 99 | + marvell,pins = "mpp46"; | |
| 100 | 100 | marvell,function = "gpio"; |
| 101 | 101 | }; |
| 102 | 102 | pmx_led_rebuild_brt_ctrl_2: pmx-led-rebuild-brt-ctrl-2 { |
| 103 | − marvell,pins = "mpp45"; | |
| 103 | + marvell,pins = "mpp47"; | |
| 104 | 104 | marvell,function = "gpio"; |
| 105 | 105 | }; |
| 106 | 106 | |
| @@ -157,14 +157,14 @@ · 50 unmodified lines | ||
| 157 | 157 | gpios = <&gpio0 16 0>; |
| 158 | 158 | linux,default-trigger = "default-on"; |
| 159 | 159 | }; |
| 160 | − health_led1 { | |
| 160 | + rebuild_led { | |
| 161 | + label = "status:white:rebuild_led"; | |
| 162 | + gpios = <&gpio1 4 0>; | |
| 163 | + }; | |
| 164 | + health_led { | |
| 161 | 165 | label = "status:red:health_led"; |
| 162 | 166 | gpios = <&gpio1 5 0>; |
| 163 | 167 | }; |
| 164 | − health_led2 { | |
| 165 | − label = "status:white:health_led"; | |
| 166 | − gpios = <&gpio1 4 0>; | |
| 167 | − }; | |
| 168 | 168 | backup_led { |
| 169 | 169 | label = "status:blue:backup_led"; |
| 170 | 170 | gpios = <&gpio0 15 0>; |
| @@ -19,14 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | #undef _CACHE |
| 20 | 20 | #undef MULTI_CACHE |
| 21 | 21 | |
| 22 | −#if defined(CONFIG_CPU_CACHE_V3) | |
| 23 | −# ifdef _CACHE | |
| 24 | −# define MULTI_CACHE 1 | |
| 25 | −# else | |
| 26 | −# define _CACHE v3 | |
| 27 | −# endif | |
| 28 | −#endif | |
| 29 | − | |
| 30 | 22 | #if defined(CONFIG_CPU_CACHE_V4) |
| 31 | 23 | # ifdef _CACHE |
| 32 | 24 | # define MULTI_CACHE 1 |
| @@ -37,7 +37,7 @@ extern int iop3xx_get_init_atu(void); · 36 unmodified lines | ||
| 37 | 37 | * IOP3XX processor registers |
| 38 | 38 | */ |
| 39 | 39 | #define IOP3XX_PERIPHERAL_PHYS_BASE 0xffffe000 |
| 40 | −#define IOP3XX_PERIPHERAL_VIRT_BASE 0xfeffe000 | |
| 40 | +#define IOP3XX_PERIPHERAL_VIRT_BASE 0xfedfe000 | |
| 41 | 41 | #define IOP3XX_PERIPHERAL_SIZE 0x00002000 |
| 42 | 42 | #define IOP3XX_PERIPHERAL_UPPER_PA (IOP3XX_PERIPHERAL_PHYS_BASE +\ |
| 43 | 43 | IOP3XX_PERIPHERAL_SIZE - 1) |
| @@ -111,7 +111,7 @@ · 110 unmodified lines | ||
| 111 | 111 | #define L_PTE_S2_MT_WRITETHROUGH (_AT(pteval_t, 0xa) << 2) /* MemAttr[3:0] */ |
| 112 | 112 | #define L_PTE_S2_MT_WRITEBACK (_AT(pteval_t, 0xf) << 2) /* MemAttr[3:0] */ |
| 113 | 113 | #define L_PTE_S2_RDONLY (_AT(pteval_t, 1) << 6) /* HAP[1] */ |
| 114 | −#define L_PTE_S2_RDWR (_AT(pteval_t, 2) << 6) /* HAP[2:1] */ | |
| 114 | +#define L_PTE_S2_RDWR (_AT(pteval_t, 3) << 6) /* HAP[2:1] */ | |
| 115 | 115 | |
| 116 | 116 | /* |
| 117 | 117 | * Hyp-mode PL2 PTE definitions for LPAE. |
| @@ -14,7 +14,6 @@ · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | #include <asm/glue.h> |
| 16 | 16 | |
| 17 | −#define TLB_V3_PAGE (1 << 0) | |
| 18 | 17 | #define TLB_V4_U_PAGE (1 << 1) |
| 19 | 18 | #define TLB_V4_D_PAGE (1 << 2) |
| 20 | 19 | #define TLB_V4_I_PAGE (1 << 3) |
| @@ -22,7 +21,6 @@ · 1 unmodified line | ||
| 22 | 21 | #define TLB_V6_D_PAGE (1 << 5) |
| 23 | 22 | #define TLB_V6_I_PAGE (1 << 6) |
| 24 | 23 | |
| 25 | −#define TLB_V3_FULL (1 << 8) | |
| 26 | 24 | #define TLB_V4_U_FULL (1 << 9) |
| 27 | 25 | #define TLB_V4_D_FULL (1 << 10) |
| 28 | 26 | #define TLB_V4_I_FULL (1 << 11) |
| @@ -52,7 +50,6 @@ · 23 unmodified lines | ||
| 52 | 50 | * ============= |
| 53 | 51 | * |
| 54 | 52 | * We have the following to choose from: |
| 55 | − * v3 - ARMv3 | |
| 56 | 53 | * v4 - ARMv4 without write buffer |
| 57 | 54 | * v4wb - ARMv4 with write buffer without I TLB flush entry instruction |
| 58 | 55 | * v4wbi - ARMv4 with write buffer with I TLB flush entry instruction |
| @@ -330,7 +327,6 @@ static inline void local_flush_tlb_all(void) · 271 unmodified lines | ||
| 330 | 327 | if (tlb_flag(TLB_WB)) |
| 331 | 328 | dsb(); |
| 332 | 329 | |
| 333 | − tlb_op(TLB_V3_FULL, "c6, c0, 0", zero); | |
| 334 | 330 | tlb_op(TLB_V4_U_FULL | TLB_V6_U_FULL, "c8, c7, 0", zero); |
| 335 | 331 | tlb_op(TLB_V4_D_FULL | TLB_V6_D_FULL, "c8, c6, 0", zero); |
| 336 | 332 | tlb_op(TLB_V4_I_FULL | TLB_V6_I_FULL, "c8, c5, 0", zero); |
| @@ -351,9 +347,8 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm) · 14 unmodified lines | ||
| 351 | 347 | if (tlb_flag(TLB_WB)) |
| 352 | 348 | dsb(); |
| 353 | 349 | |
| 354 | − if (possible_tlb_flags & (TLB_V3_FULL|TLB_V4_U_FULL|TLB_V4_D_FULL|TLB_V4_I_FULL)) { | |
| 350 | + if (possible_tlb_flags & (TLB_V4_U_FULL|TLB_V4_D_FULL|TLB_V4_I_FULL)) { | |
| 355 | 351 | if (cpumask_test_cpu(get_cpu(), mm_cpumask(mm))) { |
| 356 | − tlb_op(TLB_V3_FULL, "c6, c0, 0", zero); | |
| 357 | 352 | tlb_op(TLB_V4_U_FULL, "c8, c7, 0", zero); |
| 358 | 353 | tlb_op(TLB_V4_D_FULL, "c8, c6, 0", zero); |
| 359 | 354 | tlb_op(TLB_V4_I_FULL, "c8, c5, 0", zero); |
| @@ -385,9 +380,8 @@ local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) · 25 unmodified lines | ||
| 385 | 380 | if (tlb_flag(TLB_WB)) |
| 386 | 381 | dsb(); |
| 387 | 382 | |
| 388 | − if (possible_tlb_flags & (TLB_V3_PAGE|TLB_V4_U_PAGE|TLB_V4_D_PAGE|TLB_V4_I_PAGE|TLB_V4_I_FULL) && | |
| 383 | + if (possible_tlb_flags & (TLB_V4_U_PAGE|TLB_V4_D_PAGE|TLB_V4_I_PAGE|TLB_V4_I_FULL) && | |
| 389 | 384 | cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) { |
| 390 | − tlb_op(TLB_V3_PAGE, "c6, c0, 0", uaddr); | |
| 391 | 385 | tlb_op(TLB_V4_U_PAGE, "c8, c7, 1", uaddr); |
| 392 | 386 | tlb_op(TLB_V4_D_PAGE, "c8, c6, 1", uaddr); |
| 393 | 387 | tlb_op(TLB_V4_I_PAGE, "c8, c5, 1", uaddr); |
| @@ -418,7 +412,6 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr) · 24 unmodified lines | ||
| 418 | 412 | if (tlb_flag(TLB_WB)) |
| 419 | 413 | dsb(); |
| 420 | 414 | |
| 421 | − tlb_op(TLB_V3_PAGE, "c6, c0, 0", kaddr); | |
| 422 | 415 | tlb_op(TLB_V4_U_PAGE, "c8, c7, 1", kaddr); |
| 423 | 416 | tlb_op(TLB_V4_D_PAGE, "c8, c6, 1", kaddr); |
| 424 | 417 | tlb_op(TLB_V4_I_PAGE, "c8, c5, 1", kaddr); |
| @@ -1043,7 +1043,7 @@ static int dbg_cpu_pm_notify(struct notifier_block *self, unsigned long action, · 1042 unmodified lines | ||
| 1043 | 1043 | return NOTIFY_OK; |
| 1044 | 1044 | } |
| 1045 | 1045 | |
| 1046 | −static struct notifier_block __cpuinitdata dbg_cpu_pm_nb = { | |
| 1046 | +static struct notifier_block dbg_cpu_pm_nb = { | |
| 1047 | 1047 | .notifier_call = dbg_cpu_pm_notify, |
| 1048 | 1048 | }; |
| 1049 | 1049 | |
| @@ -253,7 +253,10 @@ validate_event(struct pmu_hw_events *hw_events, · 252 unmodified lines | ||
| 253 | 253 | struct arm_pmu *armpmu = to_arm_pmu(event->pmu); |
| 254 | 254 | struct pmu *leader_pmu = event->group_leader->pmu; |
| 255 | 255 | |
| 256 | − if (event->pmu != leader_pmu || event->state <= PERF_EVENT_STATE_OFF) | |
| 256 | + if (event->pmu != leader_pmu || event->state < PERF_EVENT_STATE_OFF) | |
| 257 | + return 1; | |
| 258 | + | |
| 259 | + if (event->state == PERF_EVENT_STATE_OFF && !event->attr.enable_on_exec) | |
| 257 | 260 | return 1; |
| 258 | 261 | |
| 259 | 262 | return armpmu->get_event_idx(hw_events, event) >= 0; |
| @@ -45,12 +45,12 @@ static u32 notrace jiffy_sched_clock_read(void) · 44 unmodified lines | ||
| 45 | 45 | |
| 46 | 46 | static u32 __read_mostly (*read_sched_clock)(void) = jiffy_sched_clock_read; |
| 47 | 47 | |
| 48 | −static inline u64 cyc_to_ns(u64 cyc, u32 mult, u32 shift) | |
| 48 | +static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift) | |
| 49 | 49 | { |
| 50 | 50 | return (cyc * mult) >> shift; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | −static unsigned long long cyc_to_sched_clock(u32 cyc, u32 mask) | |
| 53 | +static unsigned long long notrace cyc_to_sched_clock(u32 cyc, u32 mask) | |
| 54 | 54 | { |
| 55 | 55 | u64 epoch_ns; |
| 56 | 56 | u32 epoch_cyc; |
| @@ -56,7 +56,6 @@ · 55 unmodified lines | ||
| 56 | 56 | #include <asm/virt.h> |
| 57 | 57 | |
| 58 | 58 | #include "atags.h" |
| 59 | −#include "tcm.h" | |
| 60 | 59 | |
| 61 | 60 | |
| 62 | 61 | #if defined(CONFIG_FPE_NWFPE) || defined(CONFIG_FPE_FASTFPE) |
| @@ -798,8 +797,6 @@ void __init setup_arch(char **cmdline_p) · 735 unmodified lines | ||
| 798 | 797 | |
| 799 | 798 | reserve_crashkernel(); |
| 800 | 799 | |
| 801 | − tcm_init(); | |
| 802 | − | |
| 803 | 800 | #ifdef CONFIG_MULTI_IRQ_HANDLER |
| 804 | 801 | handle_arch_irq = mdesc->handle_irq; |
| 805 | 802 | #endif |
| @@ -17,7 +17,6 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <asm/mach/map.h> |
| 18 | 18 | #include <asm/memory.h> |
| 19 | 19 | #include <asm/system_info.h> |
| 20 | −#include "tcm.h" | |
| 21 | 20 | |
| 22 | 21 | static struct gen_pool *tcm_pool; |
| 23 | 22 | static bool dtcm_present; |
| @@ -201,6 +201,7 @@ int kvm_dev_ioctl_check_extension(long ext) · 200 unmodified lines | ||
| 201 | 201 | break; |
| 202 | 202 | case KVM_CAP_ARM_SET_DEVICE_ADDR: |
| 203 | 203 | r = 1; |
| 204 | + break; | |
| 204 | 205 | case KVM_CAP_NR_VCPUS: |
| 205 | 206 | r = num_online_cpus(); |
| 206 | 207 | break; |
| @@ -79,11 +79,11 @@ static bool access_dcsw(struct kvm_vcpu *vcpu, · 78 unmodified lines | ||
| 79 | 79 | u32 val; |
| 80 | 80 | int cpu; |
| 81 | 81 | |
| 82 | − cpu = get_cpu(); | |
| 83 | − | |
| 84 | 82 | if (!p->is_write) |
| 85 | 83 | return read_from_write_only(vcpu, p); |
| 86 | 84 | |
| 85 | + cpu = get_cpu(); | |
| 86 | + | |
| 87 | 87 | cpumask_setall(&vcpu->arch.require_dcache_flush); |
| 88 | 88 | cpumask_clear_cpu(cpu, &vcpu->arch.require_dcache_flush); |
| 89 | 89 | |
| @@ -28,13 +28,11 @@ extern void secondary_startup(void); · 27 unmodified lines | ||
| 28 | 28 | */ |
| 29 | 29 | void __ref highbank_cpu_die(unsigned int cpu) |
| 30 | 30 | { |
| 31 | − flush_cache_all(); | |
| 32 | − | |
| 33 | 31 | highbank_set_cpu_jump(cpu, phys_to_virt(0)); |
| 34 | − highbank_set_core_pwr(); | |
| 35 | 32 | |
| 36 | − cpu_do_idle(); | |
| 33 | + flush_cache_louis(); | |
| 34 | + highbank_set_core_pwr(); | |
| 37 | 35 | |
| 38 | − /* We should never return from idle */ | |
| 39 | − panic("highbank: cpu %d unexpectedly exit from shutdown\n", cpu); | |
| 36 | + while (1) | |
| 37 | + cpu_do_idle(); | |
| 40 | 38 | } |
| @@ -257,6 +257,7 @@ int __init mx35_clocks_init(void) · 256 unmodified lines | ||
| 257 | 257 | clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0"); |
| 258 | 258 | clk_register_clkdev(clk[nfc_div], NULL, "imx25-nand.0"); |
| 259 | 259 | clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0"); |
| 260 | + clk_register_clkdev(clk[admux_gate], "audmux", NULL); | |
| 260 | 261 | |
| 261 | 262 | clk_prepare_enable(clk[spba_gate]); |
| 262 | 263 | clk_prepare_enable(clk[gpio1_gate]); |
| @@ -265,6 +266,7 @@ int __init mx35_clocks_init(void) · 2 unmodified lines | ||
| 265 | 266 | clk_prepare_enable(clk[iim_gate]); |
| 266 | 267 | clk_prepare_enable(clk[emi_gate]); |
| 267 | 268 | clk_prepare_enable(clk[max_gate]); |
| 269 | + clk_prepare_enable(clk[iomuxc_gate]); | |
| 268 | 270 | |
| 269 | 271 | /* |
| 270 | 272 | * SCC is needed to boot via mmc after a watchdog reset. The clock code |
| @@ -115,7 +115,7 @@ static const char *gpu2d_core_sels[] = { "axi", "pll3_usb_otg", "pll2_pfd0_352m" · 114 unmodified lines | ||
| 115 | 115 | static const char *gpu3d_core_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd2_396m", }; |
| 116 | 116 | static const char *gpu3d_shader_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd9_720m", }; |
| 117 | 117 | static const char *ipu_sels[] = { "mmdc_ch0_axi", "pll2_pfd2_396m", "pll3_120m", "pll3_pfd1_540m", }; |
| 118 | −static const char *ldb_di_sels[] = { "pll5_video", "pll2_pfd0_352m", "pll2_pfd2_396m", "mmdc_ch1_axi", "pll3_pfd1_540m", }; | |
| 118 | +static const char *ldb_di_sels[] = { "pll5_video", "pll2_pfd0_352m", "pll2_pfd2_396m", "mmdc_ch1_axi", "pll3_usb_otg", }; | |
| 119 | 119 | static const char *ipu_di_pre_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll5_video", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll3_pfd1_540m", }; |
| 120 | 120 | static const char *ipu1_di0_sels[] = { "ipu1_di0_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; |
| 121 | 121 | static const char *ipu1_di1_sels[] = { "ipu1_di1_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; |
| @@ -443,7 +443,6 @@ int __init mx6q_clocks_init(void) · 321 unmodified lines | ||
| 443 | 443 | |
| 444 | 444 | clk_register_clkdev(clk[gpt_ipg], "ipg", "imx-gpt.0"); |
| 445 | 445 | clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0"); |
| 446 | − clk_register_clkdev(clk[twd], NULL, "smp_twd"); | |
| 447 | 446 | clk_register_clkdev(clk[cko1_sel], "cko1_sel", NULL); |
| 448 | 447 | clk_register_clkdev(clk[ahb], "ahb", NULL); |
| 449 | 448 | clk_register_clkdev(clk[cko1], "cko1", NULL); |
| @@ -20,10 +20,15 @@ static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = { · 19 unmodified lines | ||
| 20 | 20 | .duplex = DUPLEX_FULL, |
| 21 | 21 | }; |
| 22 | 22 | |
| 23 | +static struct mv643xx_eth_platform_data iomega_ix2_200_ge01_data = { | |
| 24 | + .phy_addr = MV643XX_ETH_PHY_ADDR(11), | |
| 25 | +}; | |
| 26 | + | |
| 23 | 27 | void __init iomega_ix2_200_init(void) |
| 24 | 28 | { |
| 25 | 29 | /* |
| 26 | 30 | * Basic setup. Needs to be called early. |
| 27 | 31 | */ |
| 28 | − kirkwood_ge01_init(&iomega_ix2_200_ge00_data); | |
| 32 | + kirkwood_ge00_init(&iomega_ix2_200_ge00_data); | |
| 33 | + kirkwood_ge01_init(&iomega_ix2_200_ge01_data); | |
| 29 | 34 | } |
| @@ -61,7 +61,6 @@ static struct irq_domain *armada_370_xp_mpic_domain; · 60 unmodified lines | ||
| 61 | 61 | */ |
| 62 | 62 | static void armada_370_xp_irq_mask(struct irq_data *d) |
| 63 | 63 | { |
| 64 | −#ifdef CONFIG_SMP | |
| 65 | 64 | irq_hw_number_t hwirq = irqd_to_hwirq(d); |
| 66 | 65 | |
| 67 | 66 | if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ) |
| @@ -70,15 +69,10 @@ static void armada_370_xp_irq_mask(struct irq_data *d) · 2 unmodified lines | ||
| 70 | 69 | else |
| 71 | 70 | writel(hwirq, per_cpu_int_base + |
| 72 | 71 | ARMADA_370_XP_INT_SET_MASK_OFFS); |
| 73 | −#else | |
| 74 | − writel(irqd_to_hwirq(d), | |
| 75 | − per_cpu_int_base + ARMADA_370_XP_INT_SET_MASK_OFFS); | |
| 76 | −#endif | |
| 77 | 72 | } |
| 78 | 73 | |
| 79 | 74 | static void armada_370_xp_irq_unmask(struct irq_data *d) |
| 80 | 75 | { |
| 81 | −#ifdef CONFIG_SMP | |
| 82 | 76 | irq_hw_number_t hwirq = irqd_to_hwirq(d); |
| 83 | 77 | |
| 84 | 78 | if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ) |
| @@ -87,10 +81,6 @@ static void armada_370_xp_irq_unmask(struct irq_data *d) · 2 unmodified lines | ||
| 87 | 81 | else |
| 88 | 82 | writel(hwirq, per_cpu_int_base + |
| 89 | 83 | ARMADA_370_XP_INT_CLEAR_MASK_OFFS); |
| 90 | −#else | |
| 91 | − writel(irqd_to_hwirq(d), | |
| 92 | − per_cpu_int_base + ARMADA_370_XP_INT_CLEAR_MASK_OFFS); | |
| 93 | −#endif | |
| 94 | 84 | } |
| 95 | 85 | |
| 96 | 86 | #ifdef CONFIG_SMP |
| @@ -146,7 +136,11 @@ static int armada_370_xp_mpic_irq_map(struct irq_domain *h, · 49 unmodified lines | ||
| 146 | 136 | unsigned int virq, irq_hw_number_t hw) |
| 147 | 137 | { |
| 148 | 138 | armada_370_xp_irq_mask(irq_get_irq_data(virq)); |
| 149 | − writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS); | |
| 139 | + if (hw != ARMADA_370_XP_TIMER0_PER_CPU_IRQ) | |
| 140 | + writel(hw, per_cpu_int_base + | |
| 141 | + ARMADA_370_XP_INT_CLEAR_MASK_OFFS); | |
| 142 | + else | |
| 143 | + writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS); | |
| 150 | 144 | irq_set_status_flags(virq, IRQ_LEVEL); |
| 151 | 145 | |
| 152 | 146 | if (hw == ARMADA_370_XP_TIMER0_PER_CPU_IRQ) { |
| @@ -188,10 +188,8 @@ · 187 unmodified lines | ||
| 188 | 188 | |
| 189 | 189 | #if defined(CONFIG_CPU_S3C2416) |
| 190 | 190 | #define NR_IRQS (IRQ_S3C2416_I2S1 + 1) |
| 191 | −#elif defined(CONFIG_CPU_S3C2443) | |
| 192 | −#define NR_IRQS (IRQ_S3C2443_AC97+1) | |
| 193 | 191 | #else |
| 194 | −#define NR_IRQS (IRQ_S3C2440_AC97+1) | |
| 192 | +#define NR_IRQS (IRQ_S3C2443_AC97 + 1) | |
| 195 | 193 | #endif |
| 196 | 194 | |
| 197 | 195 | /* compatibility define. */ |
| @@ -500,7 +500,7 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, · 499 unmodified lines | ||
| 500 | 500 | base = (void *)0xfd000000; |
| 501 | 501 | |
| 502 | 502 | intc->reg_mask = base + 0xa4; |
| 503 | − intc->reg_pending = base + 0x08; | |
| 503 | + intc->reg_pending = base + 0xa8; | |
| 504 | 504 | irq_num = 20; |
| 505 | 505 | irq_start = S3C2410_IRQ(32); |
| 506 | 506 | irq_offset = 4; |
| @@ -43,7 +43,7 @@ config CPU_ARM740T · 42 unmodified lines | ||
| 43 | 43 | depends on !MMU |
| 44 | 44 | select CPU_32v4T |
| 45 | 45 | select CPU_ABRT_LV4T |
| 46 | − select CPU_CACHE_V3 # although the core is v4t | |
| 46 | + select CPU_CACHE_V4 | |
| 47 | 47 | select CPU_CP15_MPU |
| 48 | 48 | select CPU_PABRT_LEGACY |
| 49 | 49 | help |
| @@ -469,9 +469,6 @@ config CPU_PABRT_V7 · 419 unmodified lines | ||
| 469 | 469 | bool |
| 470 | 470 | |
| 471 | 471 | # The cache model |
| 472 | −config CPU_CACHE_V3 | |
| 473 | − bool | |
| 474 | − | |
| 475 | 472 | config CPU_CACHE_V4 |
| 476 | 473 | bool |
| 477 | 474 | |
| @@ -33,7 +33,6 @@ obj-$(CONFIG_CPU_PABRT_LEGACY) += pabort-legacy.o · 32 unmodified lines | ||
| 33 | 33 | obj-$(CONFIG_CPU_PABRT_V6) += pabort-v6.o |
| 34 | 34 | obj-$(CONFIG_CPU_PABRT_V7) += pabort-v7.o |
| 35 | 35 | |
| 36 | −obj-$(CONFIG_CPU_CACHE_V3) += cache-v3.o | |
| 37 | 36 | obj-$(CONFIG_CPU_CACHE_V4) += cache-v4.o |
| 38 | 37 | obj-$(CONFIG_CPU_CACHE_V4WT) += cache-v4wt.o |
| 39 | 38 | obj-$(CONFIG_CPU_CACHE_V4WB) += cache-v4wb.o |
| @@ -343,6 +343,7 @@ void __init feroceon_l2_init(int __l2_wt_override) · 342 unmodified lines | ||
| 343 | 343 | outer_cache.inv_range = feroceon_l2_inv_range; |
| 344 | 344 | outer_cache.clean_range = feroceon_l2_clean_range; |
| 345 | 345 | outer_cache.flush_range = feroceon_l2_flush_range; |
| 346 | + outer_cache.inv_all = l2_inv_all; | |
| 346 | 347 | |
| 347 | 348 | enable_l2(); |
| 348 | 349 | |
| @@ -1,137 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * linux/arch/arm/mm/cache-v3.S | |
| 3 | − * | |
| 4 | − * Copyright (C) 1997-2002 Russell king | |
| 5 | − * | |
| 6 | − * This program is free software; you can redistribute it and/or modify | |
| 7 | − * it under the terms of the GNU General Public License version 2 as | |
| 8 | − * published by the Free Software Foundation. | |
| 9 | − */ | |
| 10 | −#include <linux/linkage.h> | |
| 11 | −#include <linux/init.h> | |
| 12 | −#include <asm/page.h> | |
| 13 | −#include "proc-macros.S" | |
| 14 | − | |
| 15 | −/* | |
| 16 | − * flush_icache_all() | |
| 17 | − * | |
| 18 | − * Unconditionally clean and invalidate the entire icache. | |
| 19 | − */ | |
| 20 | −ENTRY(v3_flush_icache_all) | |
| 21 | − mov pc, lr | |
| 22 | −ENDPROC(v3_flush_icache_all) | |
| 23 | − | |
| 24 | −/* | |
| 25 | − * flush_user_cache_all() | |
| 26 | − * | |
| 27 | − * Invalidate all cache entries in a particular address | |
| 28 | − * space. | |
| 29 | − * | |
| 30 | − * - mm - mm_struct describing address space | |
| 31 | − */ | |
| 32 | −ENTRY(v3_flush_user_cache_all) | |
| 33 | − /* FALLTHROUGH */ | |
| 34 | −/* | |
| 35 | − * flush_kern_cache_all() | |
| 36 | − * | |
| 37 | − * Clean and invalidate the entire cache. | |
| 38 | − */ | |
| 39 | −ENTRY(v3_flush_kern_cache_all) | |
| 40 | − /* FALLTHROUGH */ | |
| 41 | − | |
| 42 | −/* | |
| 43 | − * flush_user_cache_range(start, end, flags) | |
| 44 | − * | |
| 45 | − * Invalidate a range of cache entries in the specified | |
| 46 | − * address space. | |
| 47 | − * | |
| 48 | − * - start - start address (may not be aligned) | |
| 49 | − * - end - end address (exclusive, may not be aligned) | |
| 50 | − * - flags - vma_area_struct flags describing address space | |
| 51 | − */ | |
| 52 | −ENTRY(v3_flush_user_cache_range) | |
| 53 | − mov ip, #0 | |
| 54 | − mcreq p15, 0, ip, c7, c0, 0 @ flush ID cache | |
| 55 | − mov pc, lr | |
| 56 | − | |
| 57 | −/* | |
| 58 | − * coherent_kern_range(start, end) | |
| 59 | − * | |
| 60 | − * Ensure coherency between the Icache and the Dcache in the | |
| 61 | − * region described by start. If you have non-snooping | |
| 62 | − * Harvard caches, you need to implement this function. | |
| 63 | − * | |
| 64 | − * - start - virtual start address | |
| 65 | − * - end - virtual end address | |
| 66 | − */ | |
| 67 | −ENTRY(v3_coherent_kern_range) | |
| 68 | − /* FALLTHROUGH */ | |
| 69 | − | |
| 70 | −/* | |
| 71 | − * coherent_user_range(start, end) | |
| 72 | − * | |
| 73 | − * Ensure coherency between the Icache and the Dcache in the | |
| 74 | − * region described by start. If you have non-snooping | |
| 75 | − * Harvard caches, you need to implement this function. | |
| 76 | − * | |
| 77 | − * - start - virtual start address | |
| 78 | − * - end - virtual end address | |
| 79 | − */ | |
| 80 | −ENTRY(v3_coherent_user_range) | |
| 81 | − mov r0, #0 | |
| 82 | − mov pc, lr | |
| 83 | − | |
| 84 | −/* | |
| 85 | − * flush_kern_dcache_area(void *page, size_t size) | |
| 86 | − * | |
| 87 | − * Ensure no D cache aliasing occurs, either with itself or | |
| 88 | − * the I cache | |
| 89 | − * | |
| 90 | − * - addr - kernel address | |
| 91 | − * - size - region size | |
| 92 | − */ | |
| 93 | −ENTRY(v3_flush_kern_dcache_area) | |
| 94 | − /* FALLTHROUGH */ | |
| 95 | − | |
| 96 | −/* | |
| 97 | − * dma_flush_range(start, end) | |
| 98 | − * | |
| 99 | − * Clean and invalidate the specified virtual address range. | |
| 100 | − * | |
| 101 | − * - start - virtual start address | |
| 102 | − * - end - virtual end address | |
| 103 | − */ | |
| 104 | −ENTRY(v3_dma_flush_range) | |
| 105 | − mov r0, #0 | |
| 106 | − mcr p15, 0, r0, c7, c0, 0 @ flush ID cache | |
| 107 | − mov pc, lr | |
| 108 | − | |
| 109 | −/* | |
| 110 | − * dma_unmap_area(start, size, dir) | |
| 111 | − * - start - kernel virtual start address | |
| 112 | − * - size - size of region | |
| 113 | − * - dir - DMA direction | |
| 114 | − */ | |
| 115 | −ENTRY(v3_dma_unmap_area) | |
| 116 | − teq r2, #DMA_TO_DEVICE | |
| 117 | − bne v3_dma_flush_range | |
| 118 | − /* FALLTHROUGH */ | |
| 119 | − | |
| 120 | −/* | |
| 121 | − * dma_map_area(start, size, dir) | |
| 122 | − * - start - kernel virtual start address | |
| 123 | − * - size - size of region | |
| 124 | − * - dir - DMA direction | |
| 125 | − */ | |
| 126 | −ENTRY(v3_dma_map_area) | |
| 127 | − mov pc, lr | |
| 128 | −ENDPROC(v3_dma_unmap_area) | |
| 129 | −ENDPROC(v3_dma_map_area) | |
| 130 | − | |
| 131 | − .globl v3_flush_kern_cache_louis | |
| 132 | − .equ v3_flush_kern_cache_louis, v3_flush_kern_cache_all | |
| 133 | − | |
| 134 | − __INITDATA | |
| 135 | − | |
| 136 | − @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S) | |
| 137 | − define_cache_functions v3 | |
| @@ -58,7 +58,7 @@ ENTRY(v4_flush_kern_cache_all) · 57 unmodified lines | ||
| 58 | 58 | ENTRY(v4_flush_user_cache_range) |
| 59 | 59 | #ifdef CONFIG_CPU_CP15 |
| 60 | 60 | mov ip, #0 |
| 61 | − mcreq p15, 0, ip, c7, c7, 0 @ flush ID cache | |
| 61 | + mcr p15, 0, ip, c7, c7, 0 @ flush ID cache | |
| 62 | 62 | mov pc, lr |
| 63 | 63 | #else |
| 64 | 64 | /* FALLTHROUGH */ |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #include <asm/mach/pci.h> |
| 35 | 35 | |
| 36 | 36 | #include "mm.h" |
| 37 | +#include "tcm.h" | |
| 37 | 38 | |
| 38 | 39 | /* |
| 39 | 40 | * empty_zero_page is a special page that is used for |
| @@ -1277,6 +1278,7 @@ void __init paging_init(struct machine_desc *mdesc) · 1237 unmodified lines | ||
| 1277 | 1278 | dma_contiguous_remap(); |
| 1278 | 1279 | devicemaps_init(mdesc); |
| 1279 | 1280 | kmap_init(); |
| 1281 | + tcm_init(); | |
| 1280 | 1282 | |
| 1281 | 1283 | top_pmd = pmd_off_k(0xffff0000); |
| 1282 | 1284 | |
| @@ -77,24 +77,27 @@ __arm740_setup: · 76 unmodified lines | ||
| 77 | 77 | mcr p15, 0, r0, c6, c0 @ set area 0, default |
| 78 | 78 | |
| 79 | 79 | ldr r0, =(CONFIG_DRAM_BASE & 0xFFFFF000) @ base[31:12] of RAM |
| 80 | − ldr r1, =(CONFIG_DRAM_SIZE >> 12) @ size of RAM (must be >= 4KB) | |
| 81 | − mov r2, #10 @ 11 is the minimum (4KB) | |
| 82 | −1: add r2, r2, #1 @ area size *= 2 | |
| 83 | − mov r1, r1, lsr #1 | |
| 80 | + ldr r3, =(CONFIG_DRAM_SIZE >> 12) @ size of RAM (must be >= 4KB) | |
| 81 | + mov r4, #10 @ 11 is the minimum (4KB) | |
| 82 | +1: add r4, r4, #1 @ area size *= 2 | |
| 83 | + movs r3, r3, lsr #1 | |
| 84 | 84 | bne 1b @ count not zero r-shift |
| 85 | − orr r0, r0, r2, lsl #1 @ the area register value | |
| 85 | + orr r0, r0, r4, lsl #1 @ the area register value | |
| 86 | 86 | orr r0, r0, #1 @ set enable bit |
| 87 | 87 | mcr p15, 0, r0, c6, c1 @ set area 1, RAM |
| 88 | 88 | |
| 89 | 89 | ldr r0, =(CONFIG_FLASH_MEM_BASE & 0xFFFFF000) @ base[31:12] of FLASH |
| 90 | − ldr r1, =(CONFIG_FLASH_SIZE >> 12) @ size of FLASH (must be >= 4KB) | |
| 91 | − mov r2, #10 @ 11 is the minimum (4KB) | |
| 92 | −1: add r2, r2, #1 @ area size *= 2 | |
| 93 | − mov r1, r1, lsr #1 | |
| 90 | + ldr r3, =(CONFIG_FLASH_SIZE >> 12) @ size of FLASH (must be >= 4KB) | |
| 91 | + cmp r3, #0 | |
| 92 | + moveq r0, #0 | |
| 93 | + beq 2f | |
| 94 | + mov r4, #10 @ 11 is the minimum (4KB) | |
| 95 | +1: add r4, r4, #1 @ area size *= 2 | |
| 96 | + movs r3, r3, lsr #1 | |
| 94 | 97 | bne 1b @ count not zero r-shift |
| 95 | − orr r0, r0, r2, lsl #1 @ the area register value | |
| 98 | + orr r0, r0, r4, lsl #1 @ the area register value | |
| 96 | 99 | orr r0, r0, #1 @ set enable bit |
| 97 | − mcr p15, 0, r0, c6, c2 @ set area 2, ROM/FLASH | |
| 100 | +2: mcr p15, 0, r0, c6, c2 @ set area 2, ROM/FLASH | |
| 98 | 101 | |
| 99 | 102 | mov r0, #0x06 |
| 100 | 103 | mcr p15, 0, r0, c2, c0 @ Region 1&2 cacheable |
| @@ -137,13 +140,14 @@ __arm740_proc_info: · 36 unmodified lines | ||
| 137 | 140 | .long 0x41807400 |
| 138 | 141 | .long 0xfffffff0 |
| 139 | 142 | .long 0 |
| 143 | + .long 0 | |
| 140 | 144 | b __arm740_setup |
| 141 | 145 | .long cpu_arch_name |
| 142 | 146 | .long cpu_elf_name |
| 143 | − .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT | |
| 147 | + .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB | HWCAP_26BIT | |
| 144 | 148 | .long cpu_arm740_name |
| 145 | 149 | .long arm740_processor_functions |
| 146 | 150 | .long 0 |
| 147 | 151 | .long 0 |
| 148 | − .long v3_cache_fns @ cache model | |
| 152 | + .long v4_cache_fns @ cache model | |
| 149 | 153 | .size __arm740_proc_info, . - __arm740_proc_info |
| @@ -387,7 +387,7 @@ ENTRY(cpu_arm920_set_pte_ext) · 386 unmodified lines | ||
| 387 | 387 | /* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ |
| 388 | 388 | .globl cpu_arm920_suspend_size |
| 389 | 389 | .equ cpu_arm920_suspend_size, 4 * 3 |
| 390 | −#ifdef CONFIG_PM_SLEEP | |
| 390 | +#ifdef CONFIG_ARM_CPU_SUSPEND | |
| 391 | 391 | ENTRY(cpu_arm920_do_suspend) |
| 392 | 392 | stmfd sp!, {r4 - r6, lr} |
| 393 | 393 | mrc p15, 0, r4, c13, c0, 0 @ PID |
| @@ -402,7 +402,7 @@ ENTRY(cpu_arm926_set_pte_ext) · 401 unmodified lines | ||
| 402 | 402 | /* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ |
| 403 | 403 | .globl cpu_arm926_suspend_size |
| 404 | 404 | .equ cpu_arm926_suspend_size, 4 * 3 |
| 405 | −#ifdef CONFIG_PM_SLEEP | |
| 405 | +#ifdef CONFIG_ARM_CPU_SUSPEND | |
| 406 | 406 | ENTRY(cpu_arm926_do_suspend) |
| 407 | 407 | stmfd sp!, {r4 - r6, lr} |
| 408 | 408 | mrc p15, 0, r4, c13, c0, 0 @ PID |
| @@ -350,7 +350,7 @@ ENTRY(cpu_mohawk_set_pte_ext) · 349 unmodified lines | ||
| 350 | 350 | |
| 351 | 351 | .globl cpu_mohawk_suspend_size |
| 352 | 352 | .equ cpu_mohawk_suspend_size, 4 * 6 |
| 353 | −#ifdef CONFIG_PM_SLEEP | |
| 353 | +#ifdef CONFIG_ARM_CPU_SUSPEND | |
| 354 | 354 | ENTRY(cpu_mohawk_do_suspend) |
| 355 | 355 | stmfd sp!, {r4 - r9, lr} |
| 356 | 356 | mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode |
| @@ -172,7 +172,7 @@ ENTRY(cpu_sa1100_set_pte_ext) · 171 unmodified lines | ||
| 172 | 172 | |
| 173 | 173 | .globl cpu_sa1100_suspend_size |
| 174 | 174 | .equ cpu_sa1100_suspend_size, 4 * 3 |
| 175 | −#ifdef CONFIG_PM_SLEEP | |
| 175 | +#ifdef CONFIG_ARM_CPU_SUSPEND | |
| 176 | 176 | ENTRY(cpu_sa1100_do_suspend) |
| 177 | 177 | stmfd sp!, {r4 - r6, lr} |
| 178 | 178 | mrc p15, 0, r4, c3, c0, 0 @ domain ID |
| @@ -17,7 +17,9 @@ · 16 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | #ifndef MULTI_CPU |
| 19 | 19 | EXPORT_SYMBOL(cpu_dcache_clean_area); |
| 20 | +#ifdef CONFIG_MMU | |
| 20 | 21 | EXPORT_SYMBOL(cpu_set_pte_ext); |
| 22 | +#endif | |
| 21 | 23 | #else |
| 22 | 24 | EXPORT_SYMBOL(processor); |
| 23 | 25 | #endif |
| @@ -138,7 +138,7 @@ ENTRY(cpu_v6_set_pte_ext) · 137 unmodified lines | ||
| 138 | 138 | /* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */ |
| 139 | 139 | .globl cpu_v6_suspend_size |
| 140 | 140 | .equ cpu_v6_suspend_size, 4 * 6 |
| 141 | −#ifdef CONFIG_PM_SLEEP | |
| 141 | +#ifdef CONFIG_ARM_CPU_SUSPEND | |
| 142 | 142 | ENTRY(cpu_v6_do_suspend) |
| 143 | 143 | stmfd sp!, {r4 - r9, lr} |
| 144 | 144 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID |
| @@ -413,7 +413,7 @@ ENTRY(cpu_xsc3_set_pte_ext) · 412 unmodified lines | ||
| 413 | 413 | |
| 414 | 414 | .globl cpu_xsc3_suspend_size |
| 415 | 415 | .equ cpu_xsc3_suspend_size, 4 * 6 |
| 416 | −#ifdef CONFIG_PM_SLEEP | |
| 416 | +#ifdef CONFIG_ARM_CPU_SUSPEND | |
| 417 | 417 | ENTRY(cpu_xsc3_do_suspend) |
| 418 | 418 | stmfd sp!, {r4 - r9, lr} |
| 419 | 419 | mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode |
| @@ -528,7 +528,7 @@ ENTRY(cpu_xscale_set_pte_ext) · 527 unmodified lines | ||
| 528 | 528 | |
| 529 | 529 | .globl cpu_xscale_suspend_size |
| 530 | 530 | .equ cpu_xscale_suspend_size, 4 * 6 |
| 531 | −#ifdef CONFIG_PM_SLEEP | |
| 531 | +#ifdef CONFIG_ARM_CPU_SUSPEND | |
| 532 | 532 | ENTRY(cpu_xscale_do_suspend) |
| 533 | 533 | stmfd sp!, {r4 - r9, lr} |
| 534 | 534 | mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode |
File renamed without changes.
| @@ -165,6 +165,10 @@ BUILDIO_IOPORT(l, u32) · 164 unmodified lines | ||
| 165 | 165 | #define readw_be __raw_readw |
| 166 | 166 | #define readl_be __raw_readl |
| 167 | 167 | |
| 168 | +#define writeb_relaxed writeb | |
| 169 | +#define writew_relaxed writew | |
| 170 | +#define writel_relaxed writel | |
| 171 | + | |
| 168 | 172 | #define writeb_be __raw_writeb |
| 169 | 173 | #define writew_be __raw_writew |
| 170 | 174 | #define writel_be __raw_writel |
| @@ -27,7 +27,7 @@ static inline unsigned long arch_local_save_flags(void) · 26 unmodified lines | ||
| 27 | 27 | /* set interrupt enabled status */ |
| 28 | 28 | static inline void arch_local_irq_restore(unsigned long flags) |
| 29 | 29 | { |
| 30 | − asm volatile (" mvc .s2 %0,CSR\n" : : "b"(flags)); | |
| 30 | + asm volatile (" mvc .s2 %0,CSR\n" : : "b"(flags) : "memory"); | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /* unconditionally enable interrupts */ |
| @@ -849,17 +849,6 @@ static palinfo_entry_t palinfo_entries[]={ · 848 unmodified lines | ||
| 849 | 849 | |
| 850 | 850 | #define NR_PALINFO_ENTRIES (int) ARRAY_SIZE(palinfo_entries) |
| 851 | 851 | |
| 852 | −/* | |
| 853 | − * this array is used to keep track of the proc entries we create. This is | |
| 854 | − * required in the module mode when we need to remove all entries. The procfs code | |
| 855 | − * does not do recursion of deletion | |
| 856 | − * | |
| 857 | − * Notes: | |
| 858 | − * - +1 accounts for the cpuN directory entry in /proc/pal | |
| 859 | − */ | |
| 860 | −#define NR_PALINFO_PROC_ENTRIES (NR_CPUS*(NR_PALINFO_ENTRIES+1)) | |
| 861 | − | |
| 862 | −static struct proc_dir_entry *palinfo_proc_entries[NR_PALINFO_PROC_ENTRIES]; | |
| 863 | 852 | static struct proc_dir_entry *palinfo_dir; |
| 864 | 853 | |
| 865 | 854 | /* |
| @@ -971,60 +960,32 @@ palinfo_read_entry(char *page, char **start, off_t off, int count, int *eof, voi · 105 unmodified lines | ||
| 971 | 960 | static void __cpuinit |
| 972 | 961 | create_palinfo_proc_entries(unsigned int cpu) |
| 973 | 962 | { |
| 974 | −# define CPUSTR "cpu%d" | |
| 975 | − | |
| 976 | 963 | pal_func_cpu_u_t f; |
| 977 | − struct proc_dir_entry **pdir; | |
| 978 | 964 | struct proc_dir_entry *cpu_dir; |
| 979 | 965 | int j; |
| 980 | − char cpustr[sizeof(CPUSTR)]; | |
| 981 | − | |
| 982 | − | |
| 983 | − /* | |
| 984 | − * we keep track of created entries in a depth-first order for | |
| 985 | − * cleanup purposes. Each entry is stored into palinfo_proc_entries | |
| 986 | − */ | |
| 987 | − sprintf(cpustr,CPUSTR, cpu); | |
| 966 | + char cpustr[3+4+1]; /* cpu numbers are up to 4095 on itanic */ | |
| 967 | + sprintf(cpustr, "cpu%d", cpu); | |
| 988 | 968 | |
| 989 | 969 | cpu_dir = proc_mkdir(cpustr, palinfo_dir); |
| 970 | + if (!cpu_dir) | |
| 971 | + return; | |
| 990 | 972 | |
| 991 | 973 | f.req_cpu = cpu; |
| 992 | 974 | |
| 993 | − /* | |
| 994 | − * Compute the location to store per cpu entries | |
| 995 | − * We dont store the top level entry in this list, but | |
| 996 | − * remove it finally after removing all cpu entries. | |
| 997 | − */ | |
| 998 | − pdir = &palinfo_proc_entries[cpu*(NR_PALINFO_ENTRIES+1)]; | |
| 999 | − *pdir++ = cpu_dir; | |
| 1000 | 975 | for (j=0; j < NR_PALINFO_ENTRIES; j++) { |
| 1001 | 976 | f.func_id = j; |
| 1002 | − *pdir = create_proc_read_entry( | |
| 1003 | − palinfo_entries[j].name, 0, cpu_dir, | |
| 1004 | − palinfo_read_entry, (void *)f.value); | |
| 1005 | − pdir++; | |
| 977 | + create_proc_read_entry( | |
| 978 | + palinfo_entries[j].name, 0, cpu_dir, | |
| 979 | + palinfo_read_entry, (void *)f.value); | |
| 1006 | 980 | } |
| 1007 | 981 | } |
| 1008 | 982 | |
| 1009 | 983 | static void |
| 1010 | 984 | remove_palinfo_proc_entries(unsigned int hcpu) |
| 1011 | 985 | { |
| 1012 | − int j; | |
| 1013 | − struct proc_dir_entry *cpu_dir, **pdir; | |
| 1014 | − | |
| 1015 | − pdir = &palinfo_proc_entries[hcpu*(NR_PALINFO_ENTRIES+1)]; | |
| 1016 | − cpu_dir = *pdir; | |
| 1017 | − *pdir++=NULL; | |
| 1018 | − for (j=0; j < (NR_PALINFO_ENTRIES); j++) { | |
| 1019 | − if ((*pdir)) { | |
| 1020 | − remove_proc_entry ((*pdir)->name, cpu_dir); | |
| 1021 | − *pdir ++= NULL; | |
| 1022 | − } | |
| 1023 | − } | |
| 1024 | − | |
| 1025 | − if (cpu_dir) { | |
| 1026 | − remove_proc_entry(cpu_dir->name, palinfo_dir); | |
| 1027 | − } | |
| 986 | + char cpustr[3+4+1]; /* cpu numbers are up to 4095 on itanic */ | |
| 987 | + sprintf(cpustr, "cpu%d", hcpu); | |
| 988 | + remove_proc_subtree(cpustr, palinfo_dir); | |
| 1028 | 989 | } |
| 1029 | 990 | |
| 1030 | 991 | static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb, |
| @@ -1058,6 +1019,8 @@ palinfo_init(void) · 27 unmodified lines | ||
| 1058 | 1019 | |
| 1059 | 1020 | printk(KERN_INFO "PAL Information Facility v%s\n", PALINFO_VERSION); |
| 1060 | 1021 | palinfo_dir = proc_mkdir("pal", NULL); |
| 1022 | + if (!palinfo_dir) | |
| 1023 | + return -ENOMEM; | |
| 1061 | 1024 | |
| 1062 | 1025 | /* Create palinfo dirs in /proc for all online cpus */ |
| 1063 | 1026 | for_each_online_cpu(i) { |
| @@ -1073,22 +1036,8 @@ palinfo_init(void) · 9 unmodified lines | ||
| 1073 | 1036 | static void __exit |
| 1074 | 1037 | palinfo_exit(void) |
| 1075 | 1038 | { |
| 1076 | − int i = 0; | |
| 1077 | − | |
| 1078 | − /* remove all nodes: depth first pass. Could optimize this */ | |
| 1079 | − for_each_online_cpu(i) { | |
| 1080 | − remove_palinfo_proc_entries(i); | |
| 1081 | − } | |
| 1082 | − | |
| 1083 | − /* | |
| 1084 | − * Remove the top level entry finally | |
| 1085 | − */ | |
| 1086 | − remove_proc_entry(palinfo_dir->name, NULL); | |
| 1087 | − | |
| 1088 | − /* | |
| 1089 | − * Unregister from cpu notifier callbacks | |
| 1090 | − */ | |
| 1091 | 1039 | unregister_hotcpu_notifier(&palinfo_cpu_notifier); |
| 1040 | + remove_proc_subtree("pal", NULL); | |
| 1092 | 1041 | } |
| 1093 | 1042 | |
| 1094 | 1043 | module_init(palinfo_init); |
| @@ -86,4 +86,24 @@ static inline int gpio_cansleep(unsigned gpio) · 85 unmodified lines | ||
| 86 | 86 | return gpio < MCFGPIO_PIN_MAX ? 0 : __gpio_cansleep(gpio); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | +static inline int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) | |
| 90 | +{ | |
| 91 | + int err; | |
| 92 | + | |
| 93 | + err = gpio_request(gpio, label); | |
| 94 | + if (err) | |
| 95 | + return err; | |
| 96 | + | |
| 97 | + if (flags & GPIOF_DIR_IN) | |
| 98 | + err = gpio_direction_input(gpio); | |
| 99 | + else | |
| 100 | + err = gpio_direction_output(gpio, | |
| 101 | + (flags & GPIOF_INIT_HIGH) ? 1 : 0); | |
| 102 | + | |
| 103 | + if (err) | |
| 104 | + gpio_free(gpio); | |
| 105 | + | |
| 106 | + return err; | |
| 107 | +} | |
| 108 | + | |
| 89 | 109 | #endif |
| @@ -304,7 +304,7 @@ syscall_exit_work: · 303 unmodified lines | ||
| 304 | 304 | subi r12,r12,TI_FLAGS |
| 305 | 305 | |
| 306 | 306 | 4: /* Anything else left to do? */ |
| 307 | − SET_DEFAULT_THREAD_PPR(r3, r9) /* Set thread.ppr = 3 */ | |
| 307 | + SET_DEFAULT_THREAD_PPR(r3, r10) /* Set thread.ppr = 3 */ | |
| 308 | 308 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP) |
| 309 | 309 | beq .ret_from_except_lite |
| 310 | 310 | |
| @@ -657,7 +657,7 @@ resume_kernel: · 346 unmodified lines | ||
| 657 | 657 | /* Clear _TIF_EMULATE_STACK_STORE flag */ |
| 658 | 658 | lis r11,_TIF_EMULATE_STACK_STORE@h |
| 659 | 659 | addi r5,r9,TI_FLAGS |
| 660 | − ldarx r4,0,r5 | |
| 660 | +0: ldarx r4,0,r5 | |
| 661 | 661 | andc r4,r4,r11 |
| 662 | 662 | stdcx. r4,0,r5 |
| 663 | 663 | bne- 0b |
| @@ -555,10 +555,12 @@ static inline void tm_recheckpoint_new_task(struct task_struct *new) · 554 unmodified lines | ||
| 555 | 555 | new->thread.regs->msr |= |
| 556 | 556 | (MSR_FP | new->thread.fpexc_mode); |
| 557 | 557 | } |
| 558 | +#ifdef CONFIG_ALTIVEC | |
| 558 | 559 | if (msr & MSR_VEC) { |
| 559 | 560 | do_load_up_transact_altivec(&new->thread); |
| 560 | 561 | new->thread.regs->msr |= MSR_VEC; |
| 561 | 562 | } |
| 563 | +#endif | |
| 562 | 564 | /* We may as well turn on VSX too since all the state is restored now */ |
| 563 | 565 | if (msr & MSR_VSX) |
| 564 | 566 | new->thread.regs->msr |= MSR_VSX; |
| @@ -866,10 +866,12 @@ static long restore_tm_user_regs(struct pt_regs *regs, · 865 unmodified lines | ||
| 866 | 866 | do_load_up_transact_fpu(¤t->thread); |
| 867 | 867 | regs->msr |= (MSR_FP | current->thread.fpexc_mode); |
| 868 | 868 | } |
| 869 | +#ifdef CONFIG_ALTIVEC | |
| 869 | 870 | if (msr & MSR_VEC) { |
| 870 | 871 | do_load_up_transact_altivec(¤t->thread); |
| 871 | 872 | regs->msr |= MSR_VEC; |
| 872 | 873 | } |
| 874 | +#endif | |
| 873 | 875 | |
| 874 | 876 | return 0; |
| 875 | 877 | } |
| @@ -522,10 +522,12 @@ static long restore_tm_sigcontexts(struct pt_regs *regs, · 521 unmodified lines | ||
| 522 | 522 | do_load_up_transact_fpu(¤t->thread); |
| 523 | 523 | regs->msr |= (MSR_FP | current->thread.fpexc_mode); |
| 524 | 524 | } |
| 525 | +#ifdef CONFIG_ALTIVEC | |
| 525 | 526 | if (msr & MSR_VEC) { |
| 526 | 527 | do_load_up_transact_altivec(¤t->thread); |
| 527 | 528 | regs->msr |= MSR_VEC; |
| 528 | 529 | } |
| 530 | +#endif | |
| 529 | 531 | |
| 530 | 532 | return err; |
| 531 | 533 | } |
| @@ -309,6 +309,7 @@ _GLOBAL(tm_recheckpoint) · 308 unmodified lines | ||
| 309 | 309 | or r5, r6, r5 /* Set MSR.FP+.VSX/.VEC */ |
| 310 | 310 | mtmsr r5 |
| 311 | 311 | |
| 312 | +#ifdef CONFIG_ALTIVEC | |
| 312 | 313 | /* FP and VEC registers: These are recheckpointed from thread.fpr[] |
| 313 | 314 | * and thread.vr[] respectively. The thread.transact_fpr[] version |
| 314 | 315 | * is more modern, and will be loaded subsequently by any FPUnavailable |
| @@ -323,6 +324,7 @@ _GLOBAL(tm_recheckpoint) · 8 unmodified lines | ||
| 323 | 324 | REST_32VRS(0, r5, r3) /* r5 scratch, r3 THREAD ptr */ |
| 324 | 325 | ld r5, THREAD_VRSAVE(r3) |
| 325 | 326 | mtspr SPRN_VRSAVE, r5 |
| 327 | +#endif | |
| 326 | 328 | |
| 327 | 329 | dont_restore_vec: |
| 328 | 330 | andi. r0, r4, MSR_FP |
| @@ -26,17 +26,20 @@ · 25 unmodified lines | ||
| 26 | 26 | #define E500_PID_NUM 3 |
| 27 | 27 | #define E500_TLB_NUM 2 |
| 28 | 28 | |
| 29 | −#define E500_TLB_VALID 1 | |
| 30 | −#define E500_TLB_BITMAP 2 | |
| 29 | +/* entry is mapped somewhere in host TLB */ | |
| 30 | +#define E500_TLB_VALID (1 << 0) | |
| 31 | +/* TLB1 entry is mapped by host TLB1, tracked by bitmaps */ | |
| 32 | +#define E500_TLB_BITMAP (1 << 1) | |
| 33 | +/* TLB1 entry is mapped by host TLB0 */ | |
| 31 | 34 | #define E500_TLB_TLB0 (1 << 2) |
| 32 | 35 | |
| 33 | 36 | struct tlbe_ref { |
| 34 | − pfn_t pfn; | |
| 35 | − unsigned int flags; /* E500_TLB_* */ | |
| 37 | + pfn_t pfn; /* valid only for TLB0, except briefly */ | |
| 38 | + unsigned int flags; /* E500_TLB_* */ | |
| 36 | 39 | }; |
| 37 | 40 | |
| 38 | 41 | struct tlbe_priv { |
| 39 | − struct tlbe_ref ref; /* TLB0 only -- TLB1 uses tlb_refs */ | |
| 42 | + struct tlbe_ref ref; | |
| 40 | 43 | }; |
| 41 | 44 | |
| 42 | 45 | #ifdef CONFIG_KVM_E500V2 |
| @@ -63,17 +66,6 @@ struct kvmppc_vcpu_e500 { · 20 unmodified lines | ||
| 63 | 66 | |
| 64 | 67 | unsigned int gtlb_nv[E500_TLB_NUM]; |
| 65 | 68 | |
| 66 | − /* | |
| 67 | − * information associated with each host TLB entry -- | |
| 68 | − * TLB1 only for now. If/when guest TLB1 entries can be | |
| 69 | − * mapped with host TLB0, this will be used for that too. | |
| 70 | − * | |
| 71 | − * We don't want to use this for guest TLB0 because then we'd | |
| 72 | − * have the overhead of doing the translation again even if | |
| 73 | − * the entry is still in the guest TLB (e.g. we swapped out | |
| 74 | − * and back, and our host TLB entries got evicted). | |
| 75 | − */ | |
| 76 | − struct tlbe_ref *tlb_refs[E500_TLB_NUM]; | |
| 77 | 69 | unsigned int host_tlb1_nv; |
| 78 | 70 | |
| 79 | 71 | u32 svr; |
| @@ -193,8 +193,11 @@ void inval_gtlbe_on_host(struct kvmppc_vcpu_e500 *vcpu_e500, int tlbsel, · 192 unmodified lines | ||
| 193 | 193 | struct tlbe_ref *ref = &vcpu_e500->gtlb_priv[tlbsel][esel].ref; |
| 194 | 194 | |
| 195 | 195 | /* Don't bother with unmapped entries */ |
| 196 | − if (!(ref->flags & E500_TLB_VALID)) | |
| 197 | − return; | |
| 196 | + if (!(ref->flags & E500_TLB_VALID)) { | |
| 197 | + WARN(ref->flags & (E500_TLB_BITMAP | E500_TLB_TLB0), | |
| 198 | + "%s: flags %x\n", __func__, ref->flags); | |
| 199 | + WARN_ON(tlbsel == 1 && vcpu_e500->g2h_tlb1_map[esel]); | |
| 200 | + } | |
| 198 | 201 | |
| 199 | 202 | if (tlbsel == 1 && ref->flags & E500_TLB_BITMAP) { |
| 200 | 203 | u64 tmp = vcpu_e500->g2h_tlb1_map[esel]; |
| @@ -248,7 +251,7 @@ static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref, · 47 unmodified lines | ||
| 248 | 251 | pfn_t pfn) |
| 249 | 252 | { |
| 250 | 253 | ref->pfn = pfn; |
| 251 | − ref->flags = E500_TLB_VALID; | |
| 254 | + ref->flags |= E500_TLB_VALID; | |
| 252 | 255 | |
| 253 | 256 | if (tlbe_is_writable(gtlbe)) |
| 254 | 257 | kvm_set_pfn_dirty(pfn); |
| @@ -257,6 +260,7 @@ static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref, · 2 unmodified lines | ||
| 257 | 260 | static inline void kvmppc_e500_ref_release(struct tlbe_ref *ref) |
| 258 | 261 | { |
| 259 | 262 | if (ref->flags & E500_TLB_VALID) { |
| 263 | + /* FIXME: don't log bogus pfn for TLB1 */ | |
| 260 | 264 | trace_kvm_booke206_ref_release(ref->pfn, ref->flags); |
| 261 | 265 | ref->flags = 0; |
| 262 | 266 | } |
| @@ -274,36 +278,23 @@ static void clear_tlb1_bitmap(struct kvmppc_vcpu_e500 *vcpu_e500) · 11 unmodified lines | ||
| 274 | 278 | |
| 275 | 279 | static void clear_tlb_privs(struct kvmppc_vcpu_e500 *vcpu_e500) |
| 276 | 280 | { |
| 277 | − int tlbsel = 0; | |
| 278 | − int i; | |
| 279 | − | |
| 280 | − for (i = 0; i < vcpu_e500->gtlb_params[tlbsel].entries; i++) { | |
| 281 | − struct tlbe_ref *ref = | |
| 282 | − &vcpu_e500->gtlb_priv[tlbsel][i].ref; | |
| 283 | − kvmppc_e500_ref_release(ref); | |
| 284 | − } | |
| 285 | −} | |
| 286 | − | |
| 287 | −static void clear_tlb_refs(struct kvmppc_vcpu_e500 *vcpu_e500) | |
| 288 | −{ | |
| 289 | − int stlbsel = 1; | |
| 281 | + int tlbsel; | |
| 290 | 282 | int i; |
| 291 | 283 | |
| 292 | − kvmppc_e500_tlbil_all(vcpu_e500); | |
| 293 | − | |
| 294 | − for (i = 0; i < host_tlb_params[stlbsel].entries; i++) { | |
| 295 | − struct tlbe_ref *ref = | |
| 296 | − &vcpu_e500->tlb_refs[stlbsel][i]; | |
| 297 | − kvmppc_e500_ref_release(ref); | |
| 284 | + for (tlbsel = 0; tlbsel <= 1; tlbsel++) { | |
| 285 | + for (i = 0; i < vcpu_e500->gtlb_params[tlbsel].entries; i++) { | |
| 286 | + struct tlbe_ref *ref = | |
| 287 | + &vcpu_e500->gtlb_priv[tlbsel][i].ref; | |
| 288 | + kvmppc_e500_ref_release(ref); | |
| 289 | + } | |
| 298 | 290 | } |
| 299 | − | |
| 300 | − clear_tlb_privs(vcpu_e500); | |
| 301 | 291 | } |
| 302 | 292 | |
| 303 | 293 | void kvmppc_core_flush_tlb(struct kvm_vcpu *vcpu) |
| 304 | 294 | { |
| 305 | 295 | struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); |
| 306 | − clear_tlb_refs(vcpu_e500); | |
| 296 | + kvmppc_e500_tlbil_all(vcpu_e500); | |
| 297 | + clear_tlb_privs(vcpu_e500); | |
| 307 | 298 | clear_tlb1_bitmap(vcpu_e500); |
| 308 | 299 | } |
| 309 | 300 | |
| @@ -458,8 +449,6 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500, · 148 unmodified lines | ||
| 458 | 449 | gvaddr &= ~((tsize_pages << PAGE_SHIFT) - 1); |
| 459 | 450 | } |
| 460 | 451 | |
| 461 | − /* Drop old ref and setup new one. */ | |
| 462 | − kvmppc_e500_ref_release(ref); | |
| 463 | 452 | kvmppc_e500_ref_setup(ref, gtlbe, pfn); |
| 464 | 453 | |
| 465 | 454 | kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize, |
| @@ -507,14 +496,15 @@ static int kvmppc_e500_tlb1_map_tlb1(struct kvmppc_vcpu_e500 *vcpu_e500, · 41 unmodified lines | ||
| 507 | 496 | if (unlikely(vcpu_e500->host_tlb1_nv >= tlb1_max_shadow_size())) |
| 508 | 497 | vcpu_e500->host_tlb1_nv = 0; |
| 509 | 498 | |
| 510 | − vcpu_e500->tlb_refs[1][sesel] = *ref; | |
| 511 | − vcpu_e500->g2h_tlb1_map[esel] |= (u64)1 << sesel; | |
| 512 | − vcpu_e500->gtlb_priv[1][esel].ref.flags |= E500_TLB_BITMAP; | |
| 513 | 499 | if (vcpu_e500->h2g_tlb1_rmap[sesel]) { |
| 514 | − unsigned int idx = vcpu_e500->h2g_tlb1_rmap[sesel]; | |
| 500 | + unsigned int idx = vcpu_e500->h2g_tlb1_rmap[sesel] - 1; | |
| 515 | 501 | vcpu_e500->g2h_tlb1_map[idx] &= ~(1ULL << sesel); |
| 516 | 502 | } |
| 517 | − vcpu_e500->h2g_tlb1_rmap[sesel] = esel; | |
| 503 | + | |
| 504 | + vcpu_e500->gtlb_priv[1][esel].ref.flags |= E500_TLB_BITMAP; | |
| 505 | + vcpu_e500->g2h_tlb1_map[esel] |= (u64)1 << sesel; | |
| 506 | + vcpu_e500->h2g_tlb1_rmap[sesel] = esel + 1; | |
| 507 | + WARN_ON(!(ref->flags & E500_TLB_VALID)); | |
| 518 | 508 | |
| 519 | 509 | return sesel; |
| 520 | 510 | } |
| @@ -526,13 +516,12 @@ static int kvmppc_e500_tlb1_map(struct kvmppc_vcpu_e500 *vcpu_e500, · 5 unmodified lines | ||
| 526 | 516 | u64 gvaddr, gfn_t gfn, struct kvm_book3e_206_tlb_entry *gtlbe, |
| 527 | 517 | struct kvm_book3e_206_tlb_entry *stlbe, int esel) |
| 528 | 518 | { |
| 529 | − struct tlbe_ref ref; | |
| 519 | + struct tlbe_ref *ref = &vcpu_e500->gtlb_priv[1][esel].ref; | |
| 530 | 520 | int sesel; |
| 531 | 521 | int r; |
| 532 | 522 | |
| 533 | − ref.flags = 0; | |
| 534 | 523 | r = kvmppc_e500_shadow_map(vcpu_e500, gvaddr, gfn, gtlbe, 1, stlbe, |
| 535 | − &ref); | |
| 524 | + ref); | |
| 536 | 525 | if (r) |
| 537 | 526 | return r; |
| 538 | 527 | |
| @@ -544,7 +533,7 @@ static int kvmppc_e500_tlb1_map(struct kvmppc_vcpu_e500 *vcpu_e500, · 5 unmodified lines | ||
| 544 | 533 | } |
| 545 | 534 | |
| 546 | 535 | /* Otherwise map into TLB1 */ |
| 547 | − sesel = kvmppc_e500_tlb1_map_tlb1(vcpu_e500, &ref, esel); | |
| 536 | + sesel = kvmppc_e500_tlb1_map_tlb1(vcpu_e500, ref, esel); | |
| 548 | 537 | write_stlbe(vcpu_e500, gtlbe, stlbe, 1, sesel); |
| 549 | 538 | |
| 550 | 539 | return 0; |
| @@ -565,7 +554,7 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 eaddr, gpa_t gpaddr, · 14 unmodified lines | ||
| 565 | 554 | case 0: |
| 566 | 555 | priv = &vcpu_e500->gtlb_priv[tlbsel][esel]; |
| 567 | 556 | |
| 568 | − /* Triggers after clear_tlb_refs or on initial mapping */ | |
| 557 | + /* Triggers after clear_tlb_privs or on initial mapping */ | |
| 569 | 558 | if (!(priv->ref.flags & E500_TLB_VALID)) { |
| 570 | 559 | kvmppc_e500_tlb0_map(vcpu_e500, esel, &stlbe); |
| 571 | 560 | } else { |
| @@ -665,35 +654,16 @@ int e500_mmu_host_init(struct kvmppc_vcpu_e500 *vcpu_e500) · 93 unmodified lines | ||
| 665 | 654 | host_tlb_params[0].entries / host_tlb_params[0].ways; |
| 666 | 655 | host_tlb_params[1].sets = 1; |
| 667 | 656 | |
| 668 | − vcpu_e500->tlb_refs[0] = | |
| 669 | − kzalloc(sizeof(struct tlbe_ref) * host_tlb_params[0].entries, | |
| 670 | − GFP_KERNEL); | |
| 671 | − if (!vcpu_e500->tlb_refs[0]) | |
| 672 | − goto err; | |
| 673 | − | |
| 674 | − vcpu_e500->tlb_refs[1] = | |
| 675 | − kzalloc(sizeof(struct tlbe_ref) * host_tlb_params[1].entries, | |
| 676 | − GFP_KERNEL); | |
| 677 | − if (!vcpu_e500->tlb_refs[1]) | |
| 678 | − goto err; | |
| 679 | − | |
| 680 | 657 | vcpu_e500->h2g_tlb1_rmap = kzalloc(sizeof(unsigned int) * |
| 681 | 658 | host_tlb_params[1].entries, |
| 682 | 659 | GFP_KERNEL); |
| 683 | 660 | if (!vcpu_e500->h2g_tlb1_rmap) |
| 684 | − goto err; | |
| 661 | + return -EINVAL; | |
| 685 | 662 | |
| 686 | 663 | return 0; |
| 687 | − | |
| 688 | −err: | |
| 689 | − kfree(vcpu_e500->tlb_refs[0]); | |
| 690 | − kfree(vcpu_e500->tlb_refs[1]); | |
| 691 | − return -EINVAL; | |
| 692 | 664 | } |
| 693 | 665 | |
| 694 | 666 | void e500_mmu_host_uninit(struct kvmppc_vcpu_e500 *vcpu_e500) |
| 695 | 667 | { |
| 696 | 668 | kfree(vcpu_e500->h2g_tlb1_rmap); |
| 697 | − kfree(vcpu_e500->tlb_refs[0]); | |
| 698 | − kfree(vcpu_e500->tlb_refs[1]); | |
| 699 | 669 | } |
| @@ -108,6 +108,8 @@ void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr) · 107 unmodified lines | ||
| 108 | 108 | { |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | +static DEFINE_PER_CPU(struct kvm_vcpu *, last_vcpu_on_cpu); | |
| 112 | + | |
| 111 | 113 | void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
| 112 | 114 | { |
| 113 | 115 | struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); |
| @@ -136,8 +138,11 @@ void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 22 unmodified lines | ||
| 136 | 138 | mtspr(SPRN_GDEAR, vcpu->arch.shared->dar); |
| 137 | 139 | mtspr(SPRN_GESR, vcpu->arch.shared->esr); |
| 138 | 140 | |
| 139 | − if (vcpu->arch.oldpir != mfspr(SPRN_PIR)) | |
| 141 | + if (vcpu->arch.oldpir != mfspr(SPRN_PIR) || | |
| 142 | + __get_cpu_var(last_vcpu_on_cpu) != vcpu) { | |
| 140 | 143 | kvmppc_e500_tlbil_all(vcpu_e500); |
| 144 | + __get_cpu_var(last_vcpu_on_cpu) = vcpu; | |
| 145 | + } | |
| 141 | 146 | |
| 142 | 147 | kvmppc_load_guest_fp(vcpu); |
| 143 | 148 | } |
| @@ -186,7 +186,13 @@ static long pSeries_lpar_hpte_remove(unsigned long hpte_group) · 185 unmodified lines | ||
| 186 | 186 | (0x1UL << 4), &dummy1, &dummy2); |
| 187 | 187 | if (lpar_rc == H_SUCCESS) |
| 188 | 188 | return i; |
| 189 | − BUG_ON(lpar_rc != H_NOT_FOUND); | |
| 189 | + | |
| 190 | + /* | |
| 191 | + * The test for adjunct partition is performed before the | |
| 192 | + * ANDCOND test. H_RESOURCE may be returned, so we need to | |
| 193 | + * check for that as well. | |
| 194 | + */ | |
| 195 | + BUG_ON(lpar_rc != H_NOT_FOUND && lpar_rc != H_RESOURCE); | |
| 190 | 196 | |
| 191 | 197 | slot_offset++; |
| 192 | 198 | slot_offset &= 0x7; |
| @@ -50,10 +50,6 @@ void unxlate_dev_mem_ptr(unsigned long phys, void *addr); · 49 unmodified lines | ||
| 50 | 50 | #define ioremap_nocache(addr, size) ioremap(addr, size) |
| 51 | 51 | #define ioremap_wc ioremap_nocache |
| 52 | 52 | |
| 53 | −/* TODO: s390 cannot support io_remap_pfn_range... */ | |
| 54 | −#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | |
| 55 | − remap_pfn_range(vma, vaddr, pfn, size, prot) | |
| 56 | − | |
| 57 | 53 | static inline void __iomem *ioremap(unsigned long offset, unsigned long size) |
| 58 | 54 | { |
| 59 | 55 | return (void __iomem *) offset; |
| @@ -57,6 +57,10 @@ extern unsigned long zero_page_mask; · 56 unmodified lines | ||
| 57 | 57 | (((unsigned long)(vaddr)) &zero_page_mask)))) |
| 58 | 58 | #define __HAVE_COLOR_ZERO_PAGE |
| 59 | 59 | |
| 60 | +/* TODO: s390 cannot support io_remap_pfn_range... */ | |
| 61 | +#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | |
| 62 | + remap_pfn_range(vma, vaddr, pfn, size, prot) | |
| 63 | + | |
| 60 | 64 | #endif /* !__ASSEMBLY__ */ |
| 61 | 65 | |
| 62 | 66 | /* |
| @@ -2,11 +2,16 @@ · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | generic-y += clkdev.h |
| 5 | +generic-y += cputime.h | |
| 5 | 6 | generic-y += div64.h |
| 7 | +generic-y += emergency-restart.h | |
| 6 | 8 | generic-y += exec.h |
| 7 | 9 | generic-y += local64.h |
| 10 | +generic-y += mutex.h | |
| 8 | 11 | generic-y += irq_regs.h |
| 9 | 12 | generic-y += local.h |
| 10 | 13 | generic-y += module.h |
| 14 | +generic-y += serial.h | |
| 11 | 15 | generic-y += trace_clock.h |
| 16 | +generic-y += types.h | |
| 12 | 17 | generic-y += word-at-a-time.h |
| @@ -1,6 +0,0 @@ | ||
| 1 | −#ifndef __SPARC_CPUTIME_H | |
| 2 | −#define __SPARC_CPUTIME_H | |
| 3 | − | |
| 4 | −#include <asm-generic/cputime.h> | |
| 5 | − | |
| 6 | −#endif /* __SPARC_CPUTIME_H */ | |
| @@ -1,6 +0,0 @@ | ||
| 1 | −#ifndef _ASM_EMERGENCY_RESTART_H | |
| 2 | −#define _ASM_EMERGENCY_RESTART_H | |
| 3 | − | |
| 4 | −#include <asm-generic/emergency-restart.h> | |
| 5 | − | |
| 6 | −#endif /* _ASM_EMERGENCY_RESTART_H */ | |
| @@ -1,9 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Pull in the generic implementation for the mutex fastpath. | |
| 3 | − * | |
| 4 | − * TODO: implement optimized primitives instead, or leave the generic | |
| 5 | − * implementation in place, or pick the atomic_xchg() based generic | |
| 6 | − * implementation. (see asm-generic/mutex-xchg.h for details) | |
| 7 | − */ | |
| 8 | − | |
| 9 | −#include <asm-generic/mutex-dec.h> | |
| @@ -915,6 +915,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma, · 914 unmodified lines | ||
| 915 | 915 | return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot); |
| 916 | 916 | } |
| 917 | 917 | |
| 918 | +#include <asm/tlbflush.h> | |
| 918 | 919 | #include <asm-generic/pgtable.h> |
| 919 | 920 | |
| 920 | 921 | /* We provide our own get_unmapped_area to cope with VA holes and |
| @@ -1,6 +0,0 @@ | ||
| 1 | −#ifndef __SPARC_SERIAL_H | |
| 2 | −#define __SPARC_SERIAL_H | |
| 3 | − | |
| 4 | −#define BASE_BAUD ( 1843200 / 16 ) | |
| 5 | − | |
| 6 | −#endif /* __SPARC_SERIAL_H */ | |
| @@ -36,7 +36,6 @@ typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long, · 35 unmodified lines | ||
| 36 | 36 | unsigned long, unsigned long); |
| 37 | 37 | |
| 38 | 38 | void cpu_panic(void); |
| 39 | −extern void smp4m_irq_rotate(int cpu); | |
| 40 | 39 | |
| 41 | 40 | /* |
| 42 | 41 | * General functions that each host system must provide. |
| @@ -46,7 +45,6 @@ void sun4m_init_smp(void); · 3 unmodified lines | ||
| 46 | 45 | void sun4d_init_smp(void); |
| 47 | 46 | |
| 48 | 47 | void smp_callin(void); |
| 49 | −void smp_boot_cpus(void); | |
| 50 | 48 | void smp_store_cpu_info(int); |
| 51 | 49 | |
| 52 | 50 | void smp_resched_interrupt(void); |
| @@ -107,9 +105,6 @@ extern int hard_smp_processor_id(void); · 54 unmodified lines | ||
| 107 | 105 | |
| 108 | 106 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
| 109 | 107 | |
| 110 | −#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier | |
| 111 | −#define prof_counter(__cpu) cpu_data(__cpu).counter | |
| 112 | − | |
| 113 | 108 | void smp_setup_cpu_possible_map(void); |
| 114 | 109 | |
| 115 | 110 | #endif /* !(__ASSEMBLY__) */ |
| @@ -18,8 +18,7 @@ do { \ · 17 unmodified lines | ||
| 18 | 18 | * and 2 stores in this critical code path. -DaveM |
| 19 | 19 | */ |
| 20 | 20 | #define switch_to(prev, next, last) \ |
| 21 | −do { flush_tlb_pending(); \ | |
| 22 | − save_and_clear_fpu(); \ | |
| 21 | +do { save_and_clear_fpu(); \ | |
| 23 | 22 | /* If you are tempted to conditionalize the following */ \ |
| 24 | 23 | /* so that ASI is only written if it changes, think again. */ \ |
| 25 | 24 | __asm__ __volatile__("wr %%g0, %0, %%asi" \ |
| @@ -11,24 +11,40 @@ · 10 unmodified lines | ||
| 11 | 11 | struct tlb_batch { |
| 12 | 12 | struct mm_struct *mm; |
| 13 | 13 | unsigned long tlb_nr; |
| 14 | + unsigned long active; | |
| 14 | 15 | unsigned long vaddrs[TLB_BATCH_NR]; |
| 15 | 16 | }; |
| 16 | 17 | |
| 17 | 18 | extern void flush_tsb_kernel_range(unsigned long start, unsigned long end); |
| 18 | 19 | extern void flush_tsb_user(struct tlb_batch *tb); |
| 20 | +extern void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr); | |
| 19 | 21 | |
| 20 | 22 | /* TLB flush operations. */ |
| 21 | 23 | |
| 22 | −extern void flush_tlb_pending(void); | |
| 24 | +static inline void flush_tlb_mm(struct mm_struct *mm) | |
| 25 | +{ | |
| 26 | +} | |
| 27 | + | |
| 28 | +static inline void flush_tlb_page(struct vm_area_struct *vma, | |
| 29 | + unsigned long vmaddr) | |
| 30 | +{ | |
| 31 | +} | |
| 32 | + | |
| 33 | +static inline void flush_tlb_range(struct vm_area_struct *vma, | |
| 34 | + unsigned long start, unsigned long end) | |
| 35 | +{ | |
| 36 | +} | |
| 37 | + | |
| 38 | +#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE | |
| 23 | 39 | |
| 24 | −#define flush_tlb_range(vma,start,end) \ | |
| 25 | − do { (void)(start); flush_tlb_pending(); } while (0) | |
| 26 | −#define flush_tlb_page(vma,addr) flush_tlb_pending() | |
| 27 | −#define flush_tlb_mm(mm) flush_tlb_pending() | |
| 40 | +extern void flush_tlb_pending(void); | |
| 41 | +extern void arch_enter_lazy_mmu_mode(void); | |
| 42 | +extern void arch_leave_lazy_mmu_mode(void); | |
| 43 | +#define arch_flush_lazy_mmu_mode() do {} while (0) | |
| 28 | 44 | |
| 29 | 45 | /* Local cpu only. */ |
| 30 | 46 | extern void __flush_tlb_all(void); |
| 31 | − | |
| 47 | +extern void __flush_tlb_page(unsigned long context, unsigned long vaddr); | |
| 32 | 48 | extern void __flush_tlb_kernel_range(unsigned long start, unsigned long end); |
| 33 | 49 | |
| 34 | 50 | #ifndef CONFIG_SMP |
| @@ -38,15 +54,24 @@ do { flush_tsb_kernel_range(start,end); \ · 3 unmodified lines | ||
| 38 | 54 | __flush_tlb_kernel_range(start,end); \ |
| 39 | 55 | } while (0) |
| 40 | 56 | |
| 57 | +static inline void global_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr) | |
| 58 | +{ | |
| 59 | + __flush_tlb_page(CTX_HWBITS(mm->context), vaddr); | |
| 60 | +} | |
| 61 | + | |
| 41 | 62 | #else /* CONFIG_SMP */ |
| 42 | 63 | |
| 43 | 64 | extern void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end); |
| 65 | +extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr); | |
| 44 | 66 | |
| 45 | 67 | #define flush_tlb_kernel_range(start, end) \ |
| 46 | 68 | do { flush_tsb_kernel_range(start,end); \ |
| 47 | 69 | smp_flush_tlb_kernel_range(start, end); \ |
| 48 | 70 | } while (0) |
| 49 | 71 | |
| 72 | +#define global_flush_tlb_page(mm, vaddr) \ | |
| 73 | + smp_flush_tlb_page(mm, vaddr) | |
| 74 | + | |
| 50 | 75 | #endif /* ! CONFIG_SMP */ |
| 51 | 76 | |
| 52 | 77 | #endif /* _SPARC64_TLBFLUSH_H */ |
| @@ -44,7 +44,6 @@ header-y += swab.h · 43 unmodified lines | ||
| 44 | 44 | header-y += termbits.h |
| 45 | 45 | header-y += termios.h |
| 46 | 46 | header-y += traps.h |
| 47 | −header-y += types.h | |
| 48 | 47 | header-y += uctx.h |
| 49 | 48 | header-y += unistd.h |
| 50 | 49 | header-y += utrap.h |
| @@ -1,17 +0,0 @@ | ||
| 1 | −#ifndef _SPARC_TYPES_H | |
| 2 | −#define _SPARC_TYPES_H | |
| 3 | −/* | |
| 4 | − * This file is never included by application software unless | |
| 5 | − * explicitly requested (e.g., via linux/types.h) in which case the | |
| 6 | − * application is Linux specific so (user-) name space pollution is | |
| 7 | − * not a major issue. However, for interoperability, libraries still | |
| 8 | − * need to be careful to avoid a name clashes. | |
| 9 | − */ | |
| 10 | − | |
| 11 | −#if defined(__sparc__) | |
| 12 | − | |
| 13 | −#include <asm-generic/int-ll64.h> | |
| 14 | − | |
| 15 | −#endif /* defined(__sparc__) */ | |
| 16 | − | |
| 17 | −#endif /* defined(_SPARC_TYPES_H) */ | |
| @@ -849,7 +849,7 @@ void smp_tsb_sync(struct mm_struct *mm) · 848 unmodified lines | ||
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | extern unsigned long xcall_flush_tlb_mm; |
| 852 | −extern unsigned long xcall_flush_tlb_pending; | |
| 852 | +extern unsigned long xcall_flush_tlb_page; | |
| 853 | 853 | extern unsigned long xcall_flush_tlb_kernel_range; |
| 854 | 854 | extern unsigned long xcall_fetch_glob_regs; |
| 855 | 855 | extern unsigned long xcall_fetch_glob_pmu; |
| @@ -1074,23 +1074,56 @@ local_flush_and_out: · 218 unmodified lines | ||
| 1074 | 1074 | put_cpu(); |
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | +struct tlb_pending_info { | |
| 1078 | + unsigned long ctx; | |
| 1079 | + unsigned long nr; | |
| 1080 | + unsigned long *vaddrs; | |
| 1081 | +}; | |
| 1082 | + | |
| 1083 | +static void tlb_pending_func(void *info) | |
| 1084 | +{ | |
| 1085 | + struct tlb_pending_info *t = info; | |
| 1086 | + | |
| 1087 | + __flush_tlb_pending(t->ctx, t->nr, t->vaddrs); | |
| 1088 | +} | |
| 1089 | + | |
| 1077 | 1090 | void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long *vaddrs) |
| 1078 | 1091 | { |
| 1079 | 1092 | u32 ctx = CTX_HWBITS(mm->context); |
| 1093 | + struct tlb_pending_info info; | |
| 1080 | 1094 | int cpu = get_cpu(); |
| 1081 | 1095 | |
| 1096 | + info.ctx = ctx; | |
| 1097 | + info.nr = nr; | |
| 1098 | + info.vaddrs = vaddrs; | |
| 1099 | + | |
| 1082 | 1100 | if (mm == current->mm && atomic_read(&mm->mm_users) == 1) |
| 1083 | 1101 | cpumask_copy(mm_cpumask(mm), cpumask_of(cpu)); |
| 1084 | 1102 | else |
| 1085 | − smp_cross_call_masked(&xcall_flush_tlb_pending, | |
| 1086 | − ctx, nr, (unsigned long) vaddrs, | |
| 1087 | − mm_cpumask(mm)); | |
| 1103 | + smp_call_function_many(mm_cpumask(mm), tlb_pending_func, | |
| 1104 | + &info, 1); | |
| 1088 | 1105 | |
| 1089 | 1106 | __flush_tlb_pending(ctx, nr, vaddrs); |
| 1090 | 1107 | |
| 1091 | 1108 | put_cpu(); |
| 1092 | 1109 | } |
| 1093 | 1110 | |
| 1111 | +void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr) | |
| 1112 | +{ | |
| 1113 | + unsigned long context = CTX_HWBITS(mm->context); | |
| 1114 | + int cpu = get_cpu(); | |
| 1115 | + | |
| 1116 | + if (mm == current->mm && atomic_read(&mm->mm_users) == 1) | |
| 1117 | + cpumask_copy(mm_cpumask(mm), cpumask_of(cpu)); | |
| 1118 | + else | |
| 1119 | + smp_cross_call_masked(&xcall_flush_tlb_page, | |
| 1120 | + context, vaddr, 0, | |
| 1121 | + mm_cpumask(mm)); | |
| 1122 | + __flush_tlb_page(context, vaddr); | |
| 1123 | + | |
| 1124 | + put_cpu(); | |
| 1125 | +} | |
| 1126 | + | |
| 1094 | 1127 | void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end) |
| 1095 | 1128 | { |
| 1096 | 1129 | start &= PAGE_MASK; |
| @@ -119,11 +119,7 @@ void bit_map_clear(struct bit_map *t, int offset, int len) · 118 unmodified lines | ||
| 119 | 119 | |
| 120 | 120 | void bit_map_init(struct bit_map *t, unsigned long *map, int size) |
| 121 | 121 | { |
| 122 | − | |
| 123 | − if ((size & 07) != 0) | |
| 124 | − BUG(); | |
| 125 | − memset(map, 0, size>>3); | |
| 126 | − | |
| 122 | + bitmap_zero(map, size); | |
| 127 | 123 | memset(t, 0, sizeof *t); |
| 128 | 124 | spin_lock_init(&t->lock); |
| 129 | 125 | t->map = map; |
| @@ -34,7 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #define IOMMU_RNGE IOMMU_RNGE_256MB |
| 35 | 35 | #define IOMMU_START 0xF0000000 |
| 36 | 36 | #define IOMMU_WINSIZE (256*1024*1024U) |
| 37 | −#define IOMMU_NPTES (IOMMU_WINSIZE/PAGE_SIZE) /* 64K PTEs, 265KB */ | |
| 37 | +#define IOMMU_NPTES (IOMMU_WINSIZE/PAGE_SIZE) /* 64K PTEs, 256KB */ | |
| 38 | 38 | #define IOMMU_ORDER 6 /* 4096 * (1<<6) */ |
| 39 | 39 | |
| 40 | 40 | /* srmmu.c */ |
| @@ -280,7 +280,9 @@ static void __init srmmu_nocache_init(void) · 279 unmodified lines | ||
| 280 | 280 | SRMMU_NOCACHE_ALIGN_MAX, 0UL); |
| 281 | 281 | memset(srmmu_nocache_pool, 0, srmmu_nocache_size); |
| 282 | 282 | |
| 283 | − srmmu_nocache_bitmap = __alloc_bootmem(bitmap_bits >> 3, SMP_CACHE_BYTES, 0UL); | |
| 283 | + srmmu_nocache_bitmap = | |
| 284 | + __alloc_bootmem(BITS_TO_LONGS(bitmap_bits) * sizeof(long), | |
| 285 | + SMP_CACHE_BYTES, 0UL); | |
| 284 | 286 | bit_map_init(&srmmu_nocache_map, srmmu_nocache_bitmap, bitmap_bits); |
| 285 | 287 | |
| 286 | 288 | srmmu_swapper_pg_dir = __srmmu_get_nocache(SRMMU_PGD_TABLE_SIZE, SRMMU_PGD_TABLE_SIZE); |
| @@ -24,11 +24,17 @@ static DEFINE_PER_CPU(struct tlb_batch, tlb_batch); · 23 unmodified lines | ||
| 24 | 24 | void flush_tlb_pending(void) |
| 25 | 25 | { |
| 26 | 26 | struct tlb_batch *tb = &get_cpu_var(tlb_batch); |
| 27 | + struct mm_struct *mm = tb->mm; | |
| 27 | 28 | |
| 28 | − if (tb->tlb_nr) { | |
| 29 | − flush_tsb_user(tb); | |
| 29 | + if (!tb->tlb_nr) | |
| 30 | + goto out; | |
| 30 | 31 | |
| 31 | − if (CTX_VALID(tb->mm->context)) { | |
| 32 | + flush_tsb_user(tb); | |
| 33 | + | |
| 34 | + if (CTX_VALID(mm->context)) { | |
| 35 | + if (tb->tlb_nr == 1) { | |
| 36 | + global_flush_tlb_page(mm, tb->vaddrs[0]); | |
| 37 | + } else { | |
| 32 | 38 | #ifdef CONFIG_SMP |
| 33 | 39 | smp_flush_tlb_pending(tb->mm, tb->tlb_nr, |
| 34 | 40 | &tb->vaddrs[0]); |
| @@ -37,12 +43,30 @@ void flush_tlb_pending(void) · 2 unmodified lines | ||
| 37 | 43 | tb->tlb_nr, &tb->vaddrs[0]); |
| 38 | 44 | #endif |
| 39 | 45 | } |
| 40 | − tb->tlb_nr = 0; | |
| 41 | 46 | } |
| 42 | 47 | |
| 48 | + tb->tlb_nr = 0; | |
| 49 | + | |
| 50 | +out: | |
| 43 | 51 | put_cpu_var(tlb_batch); |
| 44 | 52 | } |
| 45 | 53 | |
| 54 | +void arch_enter_lazy_mmu_mode(void) | |
| 55 | +{ | |
| 56 | + struct tlb_batch *tb = &__get_cpu_var(tlb_batch); | |
| 57 | + | |
| 58 | + tb->active = 1; | |
| 59 | +} | |
| 60 | + | |
| 61 | +void arch_leave_lazy_mmu_mode(void) | |
| 62 | +{ | |
| 63 | + struct tlb_batch *tb = &__get_cpu_var(tlb_batch); | |
| 64 | + | |
| 65 | + if (tb->tlb_nr) | |
| 66 | + flush_tlb_pending(); | |
| 67 | + tb->active = 0; | |
| 68 | +} | |
| 69 | + | |
| 46 | 70 | static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr, |
| 47 | 71 | bool exec) |
| 48 | 72 | { |
| @@ -60,6 +84,12 @@ static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr, · 11 unmodified lines | ||
| 60 | 84 | nr = 0; |
| 61 | 85 | } |
| 62 | 86 | |
| 87 | + if (!tb->active) { | |
| 88 | + global_flush_tlb_page(mm, vaddr); | |
| 89 | + flush_tsb_user_page(mm, vaddr); | |
| 90 | + return; | |
| 91 | + } | |
| 92 | + | |
| 63 | 93 | if (nr == 0) |
| 64 | 94 | tb->mm = mm; |
| 65 | 95 | |
| @@ -7,11 +7,10 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/preempt.h> |
| 8 | 8 | #include <linux/slab.h> |
| 9 | 9 | #include <asm/page.h> |
| 10 | −#include <asm/tlbflush.h> | |
| 11 | −#include <asm/tlb.h> | |
| 12 | −#include <asm/mmu_context.h> | |
| 13 | 10 | #include <asm/pgtable.h> |
| 11 | +#include <asm/mmu_context.h> | |
| 14 | 12 | #include <asm/tsb.h> |
| 13 | +#include <asm/tlb.h> | |
| 15 | 14 | #include <asm/oplib.h> |
| 16 | 15 | |
| 17 | 16 | extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES]; |
| @@ -46,23 +45,27 @@ void flush_tsb_kernel_range(unsigned long start, unsigned long end) · 28 unmodified lines | ||
| 46 | 45 | } |
| 47 | 46 | } |
| 48 | 47 | |
| 49 | −static void __flush_tsb_one(struct tlb_batch *tb, unsigned long hash_shift, | |
| 50 | − unsigned long tsb, unsigned long nentries) | |
| 48 | +static void __flush_tsb_one_entry(unsigned long tsb, unsigned long v, | |
| 49 | + unsigned long hash_shift, | |
| 50 | + unsigned long nentries) | |
| 51 | 51 | { |
| 52 | − unsigned long i; | |
| 52 | + unsigned long tag, ent, hash; | |
| 53 | 53 | |
| 54 | − for (i = 0; i < tb->tlb_nr; i++) { | |
| 55 | − unsigned long v = tb->vaddrs[i]; | |
| 56 | − unsigned long tag, ent, hash; | |
| 54 | + v &= ~0x1UL; | |
| 55 | + hash = tsb_hash(v, hash_shift, nentries); | |
| 56 | + ent = tsb + (hash * sizeof(struct tsb)); | |
| 57 | + tag = (v >> 22UL); | |
| 57 | 58 | |
| 58 | − v &= ~0x1UL; | |
| 59 | + tsb_flush(ent, tag); | |
| 60 | +} | |
| 59 | 61 | |
| 60 | − hash = tsb_hash(v, hash_shift, nentries); | |
| 61 | − ent = tsb + (hash * sizeof(struct tsb)); | |
| 62 | − tag = (v >> 22UL); | |
| 62 | +static void __flush_tsb_one(struct tlb_batch *tb, unsigned long hash_shift, | |
| 63 | + unsigned long tsb, unsigned long nentries) | |
| 64 | +{ | |
| 65 | + unsigned long i; | |
| 63 | 66 | |
| 64 | − tsb_flush(ent, tag); | |
| 65 | − } | |
| 67 | + for (i = 0; i < tb->tlb_nr; i++) | |
| 68 | + __flush_tsb_one_entry(tsb, tb->vaddrs[i], hash_shift, nentries); | |
| 66 | 69 | } |
| 67 | 70 | |
| 68 | 71 | void flush_tsb_user(struct tlb_batch *tb) |
| @@ -90,6 +93,30 @@ void flush_tsb_user(struct tlb_batch *tb) · 21 unmodified lines | ||
| 90 | 93 | spin_unlock_irqrestore(&mm->context.lock, flags); |
| 91 | 94 | } |
| 92 | 95 | |
| 96 | +void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr) | |
| 97 | +{ | |
| 98 | + unsigned long nentries, base, flags; | |
| 99 | + | |
| 100 | + spin_lock_irqsave(&mm->context.lock, flags); | |
| 101 | + | |
| 102 | + base = (unsigned long) mm->context.tsb_block[MM_TSB_BASE].tsb; | |
| 103 | + nentries = mm->context.tsb_block[MM_TSB_BASE].tsb_nentries; | |
| 104 | + if (tlb_type == cheetah_plus || tlb_type == hypervisor) | |
| 105 | + base = __pa(base); | |
| 106 | + __flush_tsb_one_entry(base, vaddr, PAGE_SHIFT, nentries); | |
| 107 | + | |
| 108 | +#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) | |
| 109 | + if (mm->context.tsb_block[MM_TSB_HUGE].tsb) { | |
| 110 | + base = (unsigned long) mm->context.tsb_block[MM_TSB_HUGE].tsb; | |
| 111 | + nentries = mm->context.tsb_block[MM_TSB_HUGE].tsb_nentries; | |
| 112 | + if (tlb_type == cheetah_plus || tlb_type == hypervisor) | |
| 113 | + base = __pa(base); | |
| 114 | + __flush_tsb_one_entry(base, vaddr, HPAGE_SHIFT, nentries); | |
| 115 | + } | |
| 116 | +#endif | |
| 117 | + spin_unlock_irqrestore(&mm->context.lock, flags); | |
| 118 | +} | |
| 119 | + | |
| 93 | 120 | #define HV_PGSZ_IDX_BASE HV_PGSZ_IDX_8K |
| 94 | 121 | #define HV_PGSZ_MASK_BASE HV_PGSZ_MASK_8K |
| 95 | 122 | |
| @@ -52,6 +52,33 @@ __flush_tlb_mm: /* 18 insns */ · 51 unmodified lines | ||
| 52 | 52 | nop |
| 53 | 53 | nop |
| 54 | 54 | |
| 55 | + .align 32 | |
| 56 | + .globl __flush_tlb_page | |
| 57 | +__flush_tlb_page: /* 22 insns */ | |
| 58 | + /* %o0 = context, %o1 = vaddr */ | |
| 59 | + rdpr %pstate, %g7 | |
| 60 | + andn %g7, PSTATE_IE, %g2 | |
| 61 | + wrpr %g2, %pstate | |
| 62 | + mov SECONDARY_CONTEXT, %o4 | |
| 63 | + ldxa [%o4] ASI_DMMU, %g2 | |
| 64 | + stxa %o0, [%o4] ASI_DMMU | |
| 65 | + andcc %o1, 1, %g0 | |
| 66 | + andn %o1, 1, %o3 | |
| 67 | + be,pn %icc, 1f | |
| 68 | + or %o3, 0x10, %o3 | |
| 69 | + stxa %g0, [%o3] ASI_IMMU_DEMAP | |
| 70 | +1: stxa %g0, [%o3] ASI_DMMU_DEMAP | |
| 71 | + membar #Sync | |
| 72 | + stxa %g2, [%o4] ASI_DMMU | |
| 73 | + sethi %hi(KERNBASE), %o4 | |
| 74 | + flush %o4 | |
| 75 | + retl | |
| 76 | + wrpr %g7, 0x0, %pstate | |
| 77 | + nop | |
| 78 | + nop | |
| 79 | + nop | |
| 80 | + nop | |
| 81 | + | |
| 55 | 82 | .align 32 |
| 56 | 83 | .globl __flush_tlb_pending |
| 57 | 84 | __flush_tlb_pending: /* 26 insns */ |
| @@ -203,6 +230,31 @@ __cheetah_flush_tlb_mm: /* 19 insns */ · 145 unmodified lines | ||
| 203 | 230 | retl |
| 204 | 231 | wrpr %g7, 0x0, %pstate |
| 205 | 232 | |
| 233 | +__cheetah_flush_tlb_page: /* 22 insns */ | |
| 234 | + /* %o0 = context, %o1 = vaddr */ | |
| 235 | + rdpr %pstate, %g7 | |
| 236 | + andn %g7, PSTATE_IE, %g2 | |
| 237 | + wrpr %g2, 0x0, %pstate | |
| 238 | + wrpr %g0, 1, %tl | |
| 239 | + mov PRIMARY_CONTEXT, %o4 | |
| 240 | + ldxa [%o4] ASI_DMMU, %g2 | |
| 241 | + srlx %g2, CTX_PGSZ1_NUC_SHIFT, %o3 | |
| 242 | + sllx %o3, CTX_PGSZ1_NUC_SHIFT, %o3 | |
| 243 | + or %o0, %o3, %o0 /* Preserve nucleus page size fields */ | |
| 244 | + stxa %o0, [%o4] ASI_DMMU | |
| 245 | + andcc %o1, 1, %g0 | |
| 246 | + be,pn %icc, 1f | |
| 247 | + andn %o1, 1, %o3 | |
| 248 | + stxa %g0, [%o3] ASI_IMMU_DEMAP | |
| 249 | +1: stxa %g0, [%o3] ASI_DMMU_DEMAP | |
| 250 | + membar #Sync | |
| 251 | + stxa %g2, [%o4] ASI_DMMU | |
| 252 | + sethi %hi(KERNBASE), %o4 | |
| 253 | + flush %o4 | |
| 254 | + wrpr %g0, 0, %tl | |
| 255 | + retl | |
| 256 | + wrpr %g7, 0x0, %pstate | |
| 257 | + | |
| 206 | 258 | __cheetah_flush_tlb_pending: /* 27 insns */ |
| 207 | 259 | /* %o0 = context, %o1 = nr, %o2 = vaddrs[] */ |
| 208 | 260 | rdpr %pstate, %g7 |
| @@ -269,6 +321,20 @@ __hypervisor_flush_tlb_mm: /* 10 insns */ · 60 unmodified lines | ||
| 269 | 321 | retl |
| 270 | 322 | nop |
| 271 | 323 | |
| 324 | +__hypervisor_flush_tlb_page: /* 11 insns */ | |
| 325 | + /* %o0 = context, %o1 = vaddr */ | |
| 326 | + mov %o0, %g2 | |
| 327 | + mov %o1, %o0 /* ARG0: vaddr + IMMU-bit */ | |
| 328 | + mov %g2, %o1 /* ARG1: mmu context */ | |
| 329 | + mov HV_MMU_ALL, %o2 /* ARG2: flags */ | |
| 330 | + srlx %o0, PAGE_SHIFT, %o0 | |
| 331 | + sllx %o0, PAGE_SHIFT, %o0 | |
| 332 | + ta HV_MMU_UNMAP_ADDR_TRAP | |
| 333 | + brnz,pn %o0, __hypervisor_tlb_tl0_error | |
| 334 | + mov HV_MMU_UNMAP_ADDR_TRAP, %o1 | |
| 335 | + retl | |
| 336 | + nop | |
| 337 | + | |
| 272 | 338 | __hypervisor_flush_tlb_pending: /* 16 insns */ |
| 273 | 339 | /* %o0 = context, %o1 = nr, %o2 = vaddrs[] */ |
| 274 | 340 | sllx %o1, 3, %g1 |
| @@ -339,6 +405,13 @@ cheetah_patch_cachetlbops: · 64 unmodified lines | ||
| 339 | 405 | call tlb_patch_one |
| 340 | 406 | mov 19, %o2 |
| 341 | 407 | |
| 408 | + sethi %hi(__flush_tlb_page), %o0 | |
| 409 | + or %o0, %lo(__flush_tlb_page), %o0 | |
| 410 | + sethi %hi(__cheetah_flush_tlb_page), %o1 | |
| 411 | + or %o1, %lo(__cheetah_flush_tlb_page), %o1 | |
| 412 | + call tlb_patch_one | |
| 413 | + mov 22, %o2 | |
| 414 | + | |
| 342 | 415 | sethi %hi(__flush_tlb_pending), %o0 |
| 343 | 416 | or %o0, %lo(__flush_tlb_pending), %o0 |
| 344 | 417 | sethi %hi(__cheetah_flush_tlb_pending), %o1 |
| @@ -397,10 +470,9 @@ xcall_flush_tlb_mm: /* 21 insns */ · 52 unmodified lines | ||
| 397 | 470 | nop |
| 398 | 471 | nop |
| 399 | 472 | |
| 400 | − .globl xcall_flush_tlb_pending | |
| 401 | −xcall_flush_tlb_pending: /* 21 insns */ | |
| 402 | − /* %g5=context, %g1=nr, %g7=vaddrs[] */ | |
| 403 | − sllx %g1, 3, %g1 | |
| 473 | + .globl xcall_flush_tlb_page | |
| 474 | +xcall_flush_tlb_page: /* 17 insns */ | |
| 475 | + /* %g5=context, %g1=vaddr */ | |
| 404 | 476 | mov PRIMARY_CONTEXT, %g4 |
| 405 | 477 | ldxa [%g4] ASI_DMMU, %g2 |
| 406 | 478 | srlx %g2, CTX_PGSZ1_NUC_SHIFT, %g4 |
| @@ -408,20 +480,16 @@ xcall_flush_tlb_pending: /* 21 insns */ · 1 unmodified line | ||
| 408 | 480 | or %g5, %g4, %g5 |
| 409 | 481 | mov PRIMARY_CONTEXT, %g4 |
| 410 | 482 | stxa %g5, [%g4] ASI_DMMU |
| 411 | −1: sub %g1, (1 << 3), %g1 | |
| 412 | − ldx [%g7 + %g1], %g5 | |
| 413 | − andcc %g5, 0x1, %g0 | |
| 483 | + andcc %g1, 0x1, %g0 | |
| 414 | 484 | be,pn %icc, 2f |
| 415 | − | |
| 416 | − andn %g5, 0x1, %g5 | |
| 485 | + andn %g1, 0x1, %g5 | |
| 417 | 486 | stxa %g0, [%g5] ASI_IMMU_DEMAP |
| 418 | 487 | 2: stxa %g0, [%g5] ASI_DMMU_DEMAP |
| 419 | 488 | membar #Sync |
| 420 | − brnz,pt %g1, 1b | |
| 421 | − nop | |
| 422 | 489 | stxa %g2, [%g4] ASI_DMMU |
| 423 | 490 | retry |
| 424 | 491 | nop |
| 492 | + nop | |
| 425 | 493 | |
| 426 | 494 | .globl xcall_flush_tlb_kernel_range |
| 427 | 495 | xcall_flush_tlb_kernel_range: /* 25 insns */ |
| @@ -656,15 +724,13 @@ __hypervisor_xcall_flush_tlb_mm: /* 21 insns */ · 228 unmodified lines | ||
| 656 | 724 | membar #Sync |
| 657 | 725 | retry |
| 658 | 726 | |
| 659 | − .globl __hypervisor_xcall_flush_tlb_pending | |
| 660 | −__hypervisor_xcall_flush_tlb_pending: /* 21 insns */ | |
| 661 | − /* %g5=ctx, %g1=nr, %g7=vaddrs[], %g2,%g3,%g4,g6=scratch */ | |
| 662 | − sllx %g1, 3, %g1 | |
| 727 | + .globl __hypervisor_xcall_flush_tlb_page | |
| 728 | +__hypervisor_xcall_flush_tlb_page: /* 17 insns */ | |
| 729 | + /* %g5=ctx, %g1=vaddr */ | |
| 663 | 730 | mov %o0, %g2 |
| 664 | 731 | mov %o1, %g3 |
| 665 | 732 | mov %o2, %g4 |
| 666 | −1: sub %g1, (1 << 3), %g1 | |
| 667 | − ldx [%g7 + %g1], %o0 /* ARG0: virtual address */ | |
| 733 | + mov %g1, %o0 /* ARG0: virtual address */ | |
| 668 | 734 | mov %g5, %o1 /* ARG1: mmu context */ |
| 669 | 735 | mov HV_MMU_ALL, %o2 /* ARG2: flags */ |
| 670 | 736 | srlx %o0, PAGE_SHIFT, %o0 |
| @@ -673,8 +739,6 @@ __hypervisor_xcall_flush_tlb_pending: /* 21 insns */ · 2 unmodified lines | ||
| 673 | 739 | mov HV_MMU_UNMAP_ADDR_TRAP, %g6 |
| 674 | 740 | brnz,a,pn %o0, __hypervisor_tlb_xcall_error |
| 675 | 741 | mov %o0, %g5 |
| 676 | − brnz,pt %g1, 1b | |
| 677 | − nop | |
| 678 | 742 | mov %g2, %o0 |
| 679 | 743 | mov %g3, %o1 |
| 680 | 744 | mov %g4, %o2 |
| @@ -757,6 +821,13 @@ hypervisor_patch_cachetlbops: · 76 unmodified lines | ||
| 757 | 821 | call tlb_patch_one |
| 758 | 822 | mov 10, %o2 |
| 759 | 823 | |
| 824 | + sethi %hi(__flush_tlb_page), %o0 | |
| 825 | + or %o0, %lo(__flush_tlb_page), %o0 | |
| 826 | + sethi %hi(__hypervisor_flush_tlb_page), %o1 | |
| 827 | + or %o1, %lo(__hypervisor_flush_tlb_page), %o1 | |
| 828 | + call tlb_patch_one | |
| 829 | + mov 11, %o2 | |
| 830 | + | |
| 760 | 831 | sethi %hi(__flush_tlb_pending), %o0 |
| 761 | 832 | or %o0, %lo(__flush_tlb_pending), %o0 |
| 762 | 833 | sethi %hi(__hypervisor_flush_tlb_pending), %o1 |
| @@ -788,12 +859,12 @@ hypervisor_patch_cachetlbops: · 25 unmodified lines | ||
| 788 | 859 | call tlb_patch_one |
| 789 | 860 | mov 21, %o2 |
| 790 | 861 | |
| 791 | − sethi %hi(xcall_flush_tlb_pending), %o0 | |
| 792 | − or %o0, %lo(xcall_flush_tlb_pending), %o0 | |
| 793 | − sethi %hi(__hypervisor_xcall_flush_tlb_pending), %o1 | |
| 794 | − or %o1, %lo(__hypervisor_xcall_flush_tlb_pending), %o1 | |
| 862 | + sethi %hi(xcall_flush_tlb_page), %o0 | |
| 863 | + or %o0, %lo(xcall_flush_tlb_page), %o0 | |
| 864 | + sethi %hi(__hypervisor_xcall_flush_tlb_page), %o1 | |
| 865 | + or %o1, %lo(__hypervisor_xcall_flush_tlb_page), %o1 | |
| 795 | 866 | call tlb_patch_one |
| 796 | − mov 21, %o2 | |
| 867 | + mov 17, %o2 | |
| 797 | 868 | |
| 798 | 869 | sethi %hi(xcall_flush_tlb_kernel_range), %o0 |
| 799 | 870 | or %o0, %lo(xcall_flush_tlb_kernel_range), %o0 |
| @@ -40,7 +40,15 @@ · 39 unmodified lines | ||
| 40 | 40 | #include <asm/percpu.h> |
| 41 | 41 | #include <arch/spr_def.h> |
| 42 | 42 | |
| 43 | −/* Set and clear kernel interrupt masks. */ | |
| 43 | +/* | |
| 44 | + * Set and clear kernel interrupt masks. | |
| 45 | + * | |
| 46 | + * NOTE: __insn_mtspr() is a compiler builtin marked as a memory | |
| 47 | + * clobber. We rely on it being equivalent to a compiler barrier in | |
| 48 | + * this code since arch_local_irq_save() and friends must act as | |
| 49 | + * compiler barriers. This compiler semantic is baked into enough | |
| 50 | + * places that the compiler will maintain it going forward. | |
| 51 | + */ | |
| 44 | 52 | #if CHIP_HAS_SPLIT_INTR_MASK() |
| 45 | 53 | #if INT_PERF_COUNT < 32 || INT_AUX_PERF_COUNT < 32 || INT_MEM_ERROR >= 32 |
| 46 | 54 | # error Fix assumptions about which word various interrupts are in |
| @@ -1549,6 +1549,7 @@ config X86_SMAP · 1548 unmodified lines | ||
| 1549 | 1549 | config EFI |
| 1550 | 1550 | bool "EFI runtime service support" |
| 1551 | 1551 | depends on ACPI |
| 1552 | + select UCS2_STRING | |
| 1552 | 1553 | ---help--- |
| 1553 | 1554 | This enables the kernel to use EFI runtime services that are |
| 1554 | 1555 | available (such as the EFI variable services). |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | # create a compressed vmlinux image from the original vmlinux |
| 5 | 5 | # |
| 6 | 6 | |
| 7 | −targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo head_$(BITS).o misc.o string.o cmdline.o early_serial_console.o piggy.o | |
| 7 | +targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo | |
| 8 | 8 | |
| 9 | 9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 |
| 10 | 10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC |
| @@ -29,7 +29,6 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ · 18 unmodified lines | ||
| 29 | 29 | $(obj)/piggy.o |
| 30 | 30 | |
| 31 | 31 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone |
| 32 | −$(obj)/efi_stub_$(BITS).o: KBUILD_CLFAGS += -fshort-wchar -mno-red-zone | |
| 33 | 32 | |
| 34 | 33 | ifeq ($(CONFIG_EFI_STUB), y) |
| 35 | 34 | VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o |
| @@ -43,7 +42,7 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -S · 7 unmodified lines | ||
| 43 | 42 | $(obj)/vmlinux.bin: vmlinux FORCE |
| 44 | 43 | $(call if_changed,objcopy) |
| 45 | 44 | |
| 46 | −targets += vmlinux.bin.all vmlinux.relocs | |
| 45 | +targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs | |
| 47 | 46 | |
| 48 | 47 | CMD_RELOCS = arch/x86/tools/relocs |
| 49 | 48 | quiet_cmd_relocs = RELOCS $@ |
| @@ -251,6 +251,51 @@ static void find_bits(unsigned long mask, u8 *pos, u8 *size) · 250 unmodified lines | ||
| 251 | 251 | *size = len; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | +static efi_status_t setup_efi_vars(struct boot_params *params) | |
| 255 | +{ | |
| 256 | + struct setup_data *data; | |
| 257 | + struct efi_var_bootdata *efidata; | |
| 258 | + u64 store_size, remaining_size, var_size; | |
| 259 | + efi_status_t status; | |
| 260 | + | |
| 261 | + if (!sys_table->runtime->query_variable_info) | |
| 262 | + return EFI_UNSUPPORTED; | |
| 263 | + | |
| 264 | + data = (struct setup_data *)(unsigned long)params->hdr.setup_data; | |
| 265 | + | |
| 266 | + while (data && data->next) | |
| 267 | + data = (struct setup_data *)(unsigned long)data->next; | |
| 268 | + | |
| 269 | + status = efi_call_phys4(sys_table->runtime->query_variable_info, | |
| 270 | + EFI_VARIABLE_NON_VOLATILE | | |
| 271 | + EFI_VARIABLE_BOOTSERVICE_ACCESS | | |
| 272 | + EFI_VARIABLE_RUNTIME_ACCESS, &store_size, | |
| 273 | + &remaining_size, &var_size); | |
| 274 | + | |
| 275 | + if (status != EFI_SUCCESS) | |
| 276 | + return status; | |
| 277 | + | |
| 278 | + status = efi_call_phys3(sys_table->boottime->allocate_pool, | |
| 279 | + EFI_LOADER_DATA, sizeof(*efidata), &efidata); | |
| 280 | + | |
| 281 | + if (status != EFI_SUCCESS) | |
| 282 | + return status; | |
| 283 | + | |
| 284 | + efidata->data.type = SETUP_EFI_VARS; | |
| 285 | + efidata->data.len = sizeof(struct efi_var_bootdata) - | |
| 286 | + sizeof(struct setup_data); | |
| 287 | + efidata->data.next = 0; | |
| 288 | + efidata->store_size = store_size; | |
| 289 | + efidata->remaining_size = remaining_size; | |
| 290 | + efidata->max_var_size = var_size; | |
| 291 | + | |
| 292 | + if (data) | |
| 293 | + data->next = (unsigned long)efidata; | |
| 294 | + else | |
| 295 | + params->hdr.setup_data = (unsigned long)efidata; | |
| 296 | + | |
| 297 | +} | |
| 298 | + | |
| 254 | 299 | static efi_status_t setup_efi_pci(struct boot_params *params) |
| 255 | 300 | { |
| 256 | 301 | efi_pci_io_protocol *pci; |
| @@ -1157,6 +1202,8 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table, · 900 unmodified lines | ||
| 1157 | 1202 | |
| 1158 | 1203 | setup_graphics(boot_params); |
| 1159 | 1204 | |
| 1205 | + setup_efi_vars(boot_params); | |
| 1206 | + | |
| 1160 | 1207 | setup_efi_pci(boot_params); |
| 1161 | 1208 | |
| 1162 | 1209 | status = efi_call_phys3(sys_table->boottime->allocate_pool, |
| @@ -102,6 +102,13 @@ extern void efi_call_phys_epilog(void); · 101 unmodified lines | ||
| 102 | 102 | extern void efi_unmap_memmap(void); |
| 103 | 103 | extern void efi_memory_uc(u64 addr, unsigned long size); |
| 104 | 104 | |
| 105 | +struct efi_var_bootdata { | |
| 106 | + struct setup_data data; | |
| 107 | + u64 store_size; | |
| 108 | + u64 remaining_size; | |
| 109 | + u64 max_var_size; | |
| 110 | +}; | |
| 111 | + | |
| 105 | 112 | #ifdef CONFIG_EFI |
| 106 | 113 | |
| 107 | 114 | static inline bool efi_is_native(void) |
| @@ -703,7 +703,10 @@ static inline void arch_leave_lazy_mmu_mode(void) · 702 unmodified lines | ||
| 703 | 703 | PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave); |
| 704 | 704 | } |
| 705 | 705 | |
| 706 | −void arch_flush_lazy_mmu_mode(void); | |
| 706 | +static inline void arch_flush_lazy_mmu_mode(void) | |
| 707 | +{ | |
| 708 | + PVOP_VCALL0(pv_mmu_ops.lazy_mode.flush); | |
| 709 | +} | |
| 707 | 710 | |
| 708 | 711 | static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, |
| 709 | 712 | phys_addr_t phys, pgprot_t flags) |
| @@ -91,6 +91,7 @@ struct pv_lazy_ops { · 90 unmodified lines | ||
| 91 | 91 | /* Set deferred update mode, used for batching operations. */ |
| 92 | 92 | void (*enter)(void); |
| 93 | 93 | void (*leave)(void); |
| 94 | + void (*flush)(void); | |
| 94 | 95 | }; |
| 95 | 96 | |
| 96 | 97 | struct pv_time_ops { |
| @@ -679,6 +680,7 @@ void paravirt_end_context_switch(struct task_struct *next); · 582 unmodified lines | ||
| 679 | 680 | |
| 680 | 681 | void paravirt_enter_lazy_mmu(void); |
| 681 | 682 | void paravirt_leave_lazy_mmu(void); |
| 683 | +void paravirt_flush_lazy_mmu(void); | |
| 682 | 684 | |
| 683 | 685 | void _paravirt_nop(void); |
| 684 | 686 | u32 _paravirt_ident_32(u32); |
| @@ -29,13 +29,13 @@ extern const unsigned long sys_call_table[]; · 28 unmodified lines | ||
| 29 | 29 | */ |
| 30 | 30 | static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) |
| 31 | 31 | { |
| 32 | − return regs->orig_ax & __SYSCALL_MASK; | |
| 32 | + return regs->orig_ax; | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | static inline void syscall_rollback(struct task_struct *task, |
| 36 | 36 | struct pt_regs *regs) |
| 37 | 37 | { |
| 38 | − regs->ax = regs->orig_ax & __SYSCALL_MASK; | |
| 38 | + regs->ax = regs->orig_ax; | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | static inline long syscall_get_error(struct task_struct *task, |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | |
| 8 | 8 | #define tlb_flush(tlb) \ |
| 9 | 9 | { \ |
| 10 | − if (tlb->fullmm == 0) \ | |
| 10 | + if (!tlb->fullmm && !tlb->need_flush_all) \ | |
| 11 | 11 | flush_tlb_mm_range(tlb->mm, tlb->start, tlb->end, 0UL); \ |
| 12 | 12 | else \ |
| 13 | 13 | flush_tlb_mm_range(tlb->mm, 0UL, TLB_FLUSH_ALL, 0UL); \ |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | #define SETUP_E820_EXT 1 |
| 7 | 7 | #define SETUP_DTB 2 |
| 8 | 8 | #define SETUP_PCI 3 |
| 9 | +#define SETUP_EFI_VARS 4 | |
| 9 | 10 | |
| 10 | 11 | /* ram_size flags */ |
| 11 | 12 | #define RAMDISK_IMAGE_START_MASK 0x07FF |
| @@ -35,13 +35,6 @@ static bool __init ms_hyperv_platform(void) · 34 unmodified lines | ||
| 35 | 35 | if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) |
| 36 | 36 | return false; |
| 37 | 37 | |
| 38 | − /* | |
| 39 | − * Xen emulates Hyper-V to support enlightened Windows. | |
| 40 | − * Check to see first if we are on a Xen Hypervisor. | |
| 41 | − */ | |
| 42 | − if (xen_cpuid_base()) | |
| 43 | − return false; | |
| 44 | − | |
| 45 | 38 | cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS, |
| 46 | 39 | &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]); |
| 47 | 40 | |
| @@ -82,12 +75,6 @@ static void __init ms_hyperv_init_platform(void) · 34 unmodified lines | ||
| 82 | 75 | |
| 83 | 76 | if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE) |
| 84 | 77 | clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100); |
| 85 | −#if IS_ENABLED(CONFIG_HYPERV) | |
| 86 | − /* | |
| 87 | − * Setup the IDT for hypervisor callback. | |
| 88 | − */ | |
| 89 | − alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector); | |
| 90 | −#endif | |
| 91 | 78 | } |
| 92 | 79 | |
| 93 | 80 | const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { |
| @@ -103,6 +90,11 @@ static irq_handler_t vmbus_isr; · 9 unmodified lines | ||
| 103 | 90 | |
| 104 | 91 | void hv_register_vmbus_handler(int irq, irq_handler_t handler) |
| 105 | 92 | { |
| 93 | + /* | |
| 94 | + * Setup the IDT for hypervisor callback. | |
| 95 | + */ | |
| 96 | + alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector); | |
| 97 | + | |
| 106 | 98 | vmbus_irq = irq; |
| 107 | 99 | vmbus_isr = handler; |
| 108 | 100 | } |
| @@ -153,8 +153,14 @@ static struct event_constraint intel_gen_event_constraints[] __read_mostly = · 152 unmodified lines | ||
| 153 | 153 | }; |
| 154 | 154 | |
| 155 | 155 | static struct extra_reg intel_snb_extra_regs[] __read_mostly = { |
| 156 | − INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3fffffffffull, RSP_0), | |
| 157 | − INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3fffffffffull, RSP_1), | |
| 156 | + INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3f807f8fffull, RSP_0), | |
| 157 | + INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3f807f8fffull, RSP_1), | |
| 158 | + EVENT_EXTRA_END | |
| 159 | +}; | |
| 160 | + | |
| 161 | +static struct extra_reg intel_snbep_extra_regs[] __read_mostly = { | |
| 162 | + INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3fffff8fffull, RSP_0), | |
| 163 | + INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3fffff8fffull, RSP_1), | |
| 158 | 164 | EVENT_EXTRA_END |
| 159 | 165 | }; |
| 160 | 166 | |
| @@ -2097,7 +2103,10 @@ __init int intel_pmu_init(void) · 1936 unmodified lines | ||
| 2097 | 2103 | x86_pmu.event_constraints = intel_snb_event_constraints; |
| 2098 | 2104 | x86_pmu.pebs_constraints = intel_snb_pebs_event_constraints; |
| 2099 | 2105 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; |
| 2100 | − x86_pmu.extra_regs = intel_snb_extra_regs; | |
| 2106 | + if (boot_cpu_data.x86_model == 45) | |
| 2107 | + x86_pmu.extra_regs = intel_snbep_extra_regs; | |
| 2108 | + else | |
| 2109 | + x86_pmu.extra_regs = intel_snb_extra_regs; | |
| 2101 | 2110 | /* all extra regs are per-cpu when HT is on */ |
| 2102 | 2111 | x86_pmu.er_flags |= ERF_HAS_RSP_1; |
| 2103 | 2112 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; |
| @@ -2123,7 +2132,10 @@ __init int intel_pmu_init(void) · 19 unmodified lines | ||
| 2123 | 2132 | x86_pmu.event_constraints = intel_ivb_event_constraints; |
| 2124 | 2133 | x86_pmu.pebs_constraints = intel_ivb_pebs_event_constraints; |
| 2125 | 2134 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; |
| 2126 | − x86_pmu.extra_regs = intel_snb_extra_regs; | |
| 2135 | + if (boot_cpu_data.x86_model == 62) | |
| 2136 | + x86_pmu.extra_regs = intel_snbep_extra_regs; | |
| 2137 | + else | |
| 2138 | + x86_pmu.extra_regs = intel_snb_extra_regs; | |
| 2127 | 2139 | /* all extra regs are per-cpu when HT is on */ |
| 2128 | 2140 | x86_pmu.er_flags |= ERF_HAS_RSP_1; |
| 2129 | 2141 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; |
| @@ -314,10 +314,11 @@ int intel_pmu_drain_bts_buffer(void) · 313 unmodified lines | ||
| 314 | 314 | if (top <= at) |
| 315 | 315 | return 0; |
| 316 | 316 | |
| 317 | + memset(®s, 0, sizeof(regs)); | |
| 318 | + | |
| 317 | 319 | ds->bts_index = ds->bts_buffer_base; |
| 318 | 320 | |
| 319 | 321 | perf_sample_data_init(&data, 0, event->hw.last_period); |
| 320 | − regs.ip = 0; | |
| 321 | 322 | |
| 322 | 323 | /* |
| 323 | 324 | * Prepare a generic sample, i.e. fill in the invariant fields. |
| @@ -45,9 +45,6 @@ static int __cpuinit x86_vendor(void) · 44 unmodified lines | ||
| 45 | 45 | u32 eax = 0x00000000; |
| 46 | 46 | u32 ebx, ecx = 0, edx; |
| 47 | 47 | |
| 48 | − if (!have_cpuid_p()) | |
| 49 | − return X86_VENDOR_UNKNOWN; | |
| 50 | − | |
| 51 | 48 | native_cpuid(&eax, &ebx, &ecx, &edx); |
| 52 | 49 | |
| 53 | 50 | if (CPUID_IS(CPUID_INTEL1, CPUID_INTEL2, CPUID_INTEL3, ebx, ecx, edx)) |
| @@ -59,18 +56,45 @@ static int __cpuinit x86_vendor(void) · 5 unmodified lines | ||
| 59 | 56 | return X86_VENDOR_UNKNOWN; |
| 60 | 57 | } |
| 61 | 58 | |
| 59 | +static int __cpuinit x86_family(void) | |
| 60 | +{ | |
| 61 | + u32 eax = 0x00000001; | |
| 62 | + u32 ebx, ecx = 0, edx; | |
| 63 | + int x86; | |
| 64 | + | |
| 65 | + native_cpuid(&eax, &ebx, &ecx, &edx); | |
| 66 | + | |
| 67 | + x86 = (eax >> 8) & 0xf; | |
| 68 | + if (x86 == 15) | |
| 69 | + x86 += (eax >> 20) & 0xff; | |
| 70 | + | |
| 71 | + return x86; | |
| 72 | +} | |
| 73 | + | |
| 62 | 74 | void __init load_ucode_bsp(void) |
| 63 | 75 | { |
| 64 | − int vendor = x86_vendor(); | |
| 76 | + int vendor, x86; | |
| 77 | + | |
| 78 | + if (!have_cpuid_p()) | |
| 79 | + return; | |
| 65 | 80 | |
| 66 | − if (vendor == X86_VENDOR_INTEL) | |
| 81 | + vendor = x86_vendor(); | |
| 82 | + x86 = x86_family(); | |
| 83 | + | |
| 84 | + if (vendor == X86_VENDOR_INTEL && x86 >= 6) | |
| 67 | 85 | load_ucode_intel_bsp(); |
| 68 | 86 | } |
| 69 | 87 | |
| 70 | 88 | void __cpuinit load_ucode_ap(void) |
| 71 | 89 | { |
| 72 | − int vendor = x86_vendor(); | |
| 90 | + int vendor, x86; | |
| 91 | + | |
| 92 | + if (!have_cpuid_p()) | |
| 93 | + return; | |
| 94 | + | |
| 95 | + vendor = x86_vendor(); | |
| 96 | + x86 = x86_family(); | |
| 73 | 97 | |
| 74 | − if (vendor == X86_VENDOR_INTEL) | |
| 98 | + if (vendor == X86_VENDOR_INTEL && x86 >= 6) | |
| 75 | 99 | load_ucode_intel_ap(); |
| 76 | 100 | } |
| @@ -263,6 +263,18 @@ void paravirt_leave_lazy_mmu(void) · 262 unmodified lines | ||
| 263 | 263 | leave_lazy(PARAVIRT_LAZY_MMU); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | +void paravirt_flush_lazy_mmu(void) | |
| 267 | +{ | |
| 268 | + preempt_disable(); | |
| 269 | + | |
| 270 | + if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) { | |
| 271 | + arch_leave_lazy_mmu_mode(); | |
| 272 | + arch_enter_lazy_mmu_mode(); | |
| 273 | + } | |
| 274 | + | |
| 275 | + preempt_enable(); | |
| 276 | +} | |
| 277 | + | |
| 266 | 278 | void paravirt_start_context_switch(struct task_struct *prev) |
| 267 | 279 | { |
| 268 | 280 | BUG_ON(preemptible()); |
| @@ -292,18 +304,6 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void) · 23 unmodified lines | ||
| 292 | 304 | return this_cpu_read(paravirt_lazy_mode); |
| 293 | 305 | } |
| 294 | 306 | |
| 295 | −void arch_flush_lazy_mmu_mode(void) | |
| 296 | −{ | |
| 297 | − preempt_disable(); | |
| 298 | − | |
| 299 | − if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) { | |
| 300 | − arch_leave_lazy_mmu_mode(); | |
| 301 | − arch_enter_lazy_mmu_mode(); | |
| 302 | − } | |
| 303 | − | |
| 304 | − preempt_enable(); | |
| 305 | −} | |
| 306 | − | |
| 307 | 307 | struct pv_info pv_info = { |
| 308 | 308 | .name = "bare hardware", |
| 309 | 309 | .paravirt_enabled = 0, |
| @@ -475,6 +475,7 @@ struct pv_mmu_ops pv_mmu_ops = { · 165 unmodified lines | ||
| 475 | 475 | .lazy_mode = { |
| 476 | 476 | .enter = paravirt_nop, |
| 477 | 477 | .leave = paravirt_nop, |
| 478 | + .flush = paravirt_nop, | |
| 478 | 479 | }, |
| 479 | 480 | |
| 480 | 481 | .set_fixmap = native_set_fixmap, |
| @@ -507,11 +507,14 @@ static void __init memblock_x86_reserve_range_setup_data(void) · 506 unmodified lines | ||
| 507 | 507 | /* |
| 508 | 508 | * Keep the crash kernel below this limit. On 32 bits earlier kernels |
| 509 | 509 | * would limit the kernel to the low 512 MiB due to mapping restrictions. |
| 510 | + * On 64bit, old kexec-tools need to under 896MiB. | |
| 510 | 511 | */ |
| 511 | 512 | #ifdef CONFIG_X86_32 |
| 512 | −# define CRASH_KERNEL_ADDR_MAX (512 << 20) | |
| 513 | +# define CRASH_KERNEL_ADDR_LOW_MAX (512 << 20) | |
| 514 | +# define CRASH_KERNEL_ADDR_HIGH_MAX (512 << 20) | |
| 513 | 515 | #else |
| 514 | −# define CRASH_KERNEL_ADDR_MAX MAXMEM | |
| 516 | +# define CRASH_KERNEL_ADDR_LOW_MAX (896UL<<20) | |
| 517 | +# define CRASH_KERNEL_ADDR_HIGH_MAX MAXMEM | |
| 515 | 518 | #endif |
| 516 | 519 | |
| 517 | 520 | static void __init reserve_crashkernel_low(void) |
| @@ -521,19 +524,35 @@ static void __init reserve_crashkernel_low(void) · 3 unmodified lines | ||
| 521 | 524 | unsigned long long low_base = 0, low_size = 0; |
| 522 | 525 | unsigned long total_low_mem; |
| 523 | 526 | unsigned long long base; |
| 527 | + bool auto_set = false; | |
| 524 | 528 | int ret; |
| 525 | 529 | |
| 526 | 530 | total_low_mem = memblock_mem_size(1UL<<(32-PAGE_SHIFT)); |
| 531 | + /* crashkernel=Y,low */ | |
| 527 | 532 | ret = parse_crashkernel_low(boot_command_line, total_low_mem, |
| 528 | 533 | &low_size, &base); |
| 529 | − if (ret != 0 || low_size <= 0) | |
| 530 | − return; | |
| 534 | + if (ret != 0) { | |
| 535 | + /* | |
| 536 | + * two parts from lib/swiotlb.c: | |
| 537 | + * swiotlb size: user specified with swiotlb= or default. | |
| 538 | + * swiotlb overflow buffer: now is hardcoded to 32k. | |
| 539 | + * We round it to 8M for other buffers that | |
| 540 | + * may need to stay low too. | |
| 541 | + */ | |
| 542 | + low_size = swiotlb_size_or_default() + (8UL<<20); | |
| 543 | + auto_set = true; | |
| 544 | + } else { | |
| 545 | + /* passed with crashkernel=0,low ? */ | |
| 546 | + if (!low_size) | |
| 547 | + return; | |
| 548 | + } | |
| 531 | 549 | |
| 532 | 550 | low_base = memblock_find_in_range(low_size, (1ULL<<32), |
| 533 | 551 | low_size, alignment); |
| 534 | 552 | |
| 535 | 553 | if (!low_base) { |
| 536 | − pr_info("crashkernel low reservation failed - No suitable area found.\n"); | |
| 554 | + if (!auto_set) | |
| 555 | + pr_info("crashkernel low reservation failed - No suitable area found.\n"); | |
| 537 | 556 | |
| 538 | 557 | return; |
| 539 | 558 | } |
| @@ -554,14 +573,22 @@ static void __init reserve_crashkernel(void) · 14 unmodified lines | ||
| 554 | 573 | const unsigned long long alignment = 16<<20; /* 16M */ |
| 555 | 574 | unsigned long long total_mem; |
| 556 | 575 | unsigned long long crash_size, crash_base; |
| 576 | + bool high = false; | |
| 557 | 577 | int ret; |
| 558 | 578 | |
| 559 | 579 | total_mem = memblock_phys_mem_size(); |
| 560 | 580 | |
| 581 | + /* crashkernel=XM */ | |
| 561 | 582 | ret = parse_crashkernel(boot_command_line, total_mem, |
| 562 | 583 | &crash_size, &crash_base); |
| 563 | − if (ret != 0 || crash_size <= 0) | |
| 564 | − return; | |
| 584 | + if (ret != 0 || crash_size <= 0) { | |
| 585 | + /* crashkernel=X,high */ | |
| 586 | + ret = parse_crashkernel_high(boot_command_line, total_mem, | |
| 587 | + &crash_size, &crash_base); | |
| 588 | + if (ret != 0 || crash_size <= 0) | |
| 589 | + return; | |
| 590 | + high = true; | |
| 591 | + } | |
| 565 | 592 | |
| 566 | 593 | /* 0 means: find the address automatically */ |
| 567 | 594 | if (crash_base <= 0) { |
| @@ -569,7 +596,9 @@ static void __init reserve_crashkernel(void) · 1 unmodified line | ||
| 569 | 596 | * kexec want bzImage is below CRASH_KERNEL_ADDR_MAX |
| 570 | 597 | */ |
| 571 | 598 | crash_base = memblock_find_in_range(alignment, |
| 572 | − CRASH_KERNEL_ADDR_MAX, crash_size, alignment); | |
| 599 | + high ? CRASH_KERNEL_ADDR_HIGH_MAX : | |
| 600 | + CRASH_KERNEL_ADDR_LOW_MAX, | |
| 601 | + crash_size, alignment); | |
| 573 | 602 | |
| 574 | 603 | if (!crash_base) { |
| 575 | 604 | pr_info("crashkernel reservation failed - No suitable area found.\n"); |
| @@ -1857,7 +1857,7 @@ int kvm_lapic_enable_pv_eoi(struct kvm_vcpu *vcpu, u64 data) · 1856 unmodified lines | ||
| 1857 | 1857 | if (!pv_eoi_enabled(vcpu)) |
| 1858 | 1858 | return 0; |
| 1859 | 1859 | return kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.pv_eoi.data, |
| 1860 | − addr); | |
| 1860 | + addr, sizeof(u8)); | |
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | 1863 | void kvm_lapic_init(void) |
| @@ -1823,7 +1823,8 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) · 1822 unmodified lines | ||
| 1823 | 1823 | return 0; |
| 1824 | 1824 | } |
| 1825 | 1825 | |
| 1826 | − if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.apf.data, gpa)) | |
| 1826 | + if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.apf.data, gpa, | |
| 1827 | + sizeof(u32))) | |
| 1827 | 1828 | return 1; |
| 1828 | 1829 | |
| 1829 | 1830 | vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS); |
| @@ -1952,12 +1953,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 122 unmodified lines | ||
| 1952 | 1953 | |
| 1953 | 1954 | gpa_offset = data & ~(PAGE_MASK | 1); |
| 1954 | 1955 | |
| 1955 | − /* Check that the address is 32-byte aligned. */ | |
| 1956 | − if (gpa_offset & (sizeof(struct pvclock_vcpu_time_info) - 1)) | |
| 1957 | − break; | |
| 1958 | − | |
| 1959 | 1956 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, |
| 1960 | − &vcpu->arch.pv_time, data & ~1ULL)) | |
| 1957 | + &vcpu->arch.pv_time, data & ~1ULL, | |
| 1958 | + sizeof(struct pvclock_vcpu_time_info))) | |
| 1961 | 1959 | vcpu->arch.pv_time_enabled = false; |
| 1962 | 1960 | else |
| 1963 | 1961 | vcpu->arch.pv_time_enabled = true; |
| @@ -1977,7 +1975,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 13 unmodified lines | ||
| 1977 | 1975 | return 1; |
| 1978 | 1976 | |
| 1979 | 1977 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.st.stime, |
| 1980 | − data & KVM_STEAL_VALID_BITS)) | |
| 1978 | + data & KVM_STEAL_VALID_BITS, | |
| 1979 | + sizeof(struct kvm_steal_time))) | |
| 1981 | 1980 | return 1; |
| 1982 | 1981 | |
| 1983 | 1982 | vcpu->arch.st.msr_val = data; |
| @@ -1334,6 +1334,7 @@ __init void lguest_init(void) · 1333 unmodified lines | ||
| 1334 | 1334 | pv_mmu_ops.read_cr3 = lguest_read_cr3; |
| 1335 | 1335 | pv_mmu_ops.lazy_mode.enter = paravirt_enter_lazy_mmu; |
| 1336 | 1336 | pv_mmu_ops.lazy_mode.leave = lguest_leave_lazy_mmu_mode; |
| 1337 | + pv_mmu_ops.lazy_mode.flush = paravirt_flush_lazy_mmu; | |
| 1337 | 1338 | pv_mmu_ops.pte_update = lguest_pte_update; |
| 1338 | 1339 | pv_mmu_ops.pte_update_defer = lguest_pte_update; |
| 1339 | 1340 | |
| @@ -378,10 +378,12 @@ static noinline __kprobes int vmalloc_fault(unsigned long address) · 377 unmodified lines | ||
| 378 | 378 | if (pgd_none(*pgd_ref)) |
| 379 | 379 | return -1; |
| 380 | 380 | |
| 381 | − if (pgd_none(*pgd)) | |
| 381 | + if (pgd_none(*pgd)) { | |
| 382 | 382 | set_pgd(pgd, *pgd_ref); |
| 383 | − else | |
| 383 | + arch_flush_lazy_mmu_mode(); | |
| 384 | + } else { | |
| 384 | 385 | BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref)); |
| 386 | + } | |
| 385 | 387 | |
| 386 | 388 | /* |
| 387 | 389 | * Below here mismatches are bugs because these lower tables |
| @@ -68,7 +68,7 @@ static int print_split(struct split_state *s) · 67 unmodified lines | ||
| 68 | 68 | s->gpg++; |
| 69 | 69 | i += GPS/PAGE_SIZE; |
| 70 | 70 | } else if (level == PG_LEVEL_2M) { |
| 71 | − if (!(pte_val(*pte) & _PAGE_PSE)) { | |
| 71 | + if ((pte_val(*pte) & _PAGE_PRESENT) && !(pte_val(*pte) & _PAGE_PSE)) { | |
| 72 | 72 | printk(KERN_ERR |
| 73 | 73 | "%lx level %d but not PSE %Lx\n", |
| 74 | 74 | addr, level, (u64)pte_val(*pte)); |
| @@ -467,7 +467,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, · 466 unmodified lines | ||
| 467 | 467 | * We are safe now. Check whether the new pgprot is the same: |
| 468 | 468 | */ |
| 469 | 469 | old_pte = *kpte; |
| 470 | − old_prot = new_prot = req_prot = pte_pgprot(old_pte); | |
| 470 | + old_prot = req_prot = pte_pgprot(old_pte); | |
| 471 | 471 | |
| 472 | 472 | pgprot_val(req_prot) &= ~pgprot_val(cpa->mask_clr); |
| 473 | 473 | pgprot_val(req_prot) |= pgprot_val(cpa->mask_set); |
| @@ -478,12 +478,12 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, · 4 unmodified lines | ||
| 478 | 478 | * a non present pmd. The canon_pgprot will clear _PAGE_GLOBAL |
| 479 | 479 | * for the ancient hardware that doesn't support it. |
| 480 | 480 | */ |
| 481 | − if (pgprot_val(new_prot) & _PAGE_PRESENT) | |
| 482 | − pgprot_val(new_prot) |= _PAGE_PSE | _PAGE_GLOBAL; | |
| 481 | + if (pgprot_val(req_prot) & _PAGE_PRESENT) | |
| 482 | + pgprot_val(req_prot) |= _PAGE_PSE | _PAGE_GLOBAL; | |
| 483 | 483 | else |
| 484 | − pgprot_val(new_prot) &= ~(_PAGE_PSE | _PAGE_GLOBAL); | |
| 484 | + pgprot_val(req_prot) &= ~(_PAGE_PSE | _PAGE_GLOBAL); | |
| 485 | 485 | |
| 486 | − new_prot = canon_pgprot(new_prot); | |
| 486 | + req_prot = canon_pgprot(req_prot); | |
| 487 | 487 | |
| 488 | 488 | /* |
| 489 | 489 | * old_pte points to the large page base address. So we need |
| @@ -1413,6 +1413,8 @@ void kernel_map_pages(struct page *page, int numpages, int enable) · 923 unmodified lines | ||
| 1413 | 1413 | * but that can deadlock->flush only current cpu: |
| 1414 | 1414 | */ |
| 1415 | 1415 | __flush_tlb_all(); |
| 1416 | + | |
| 1417 | + arch_flush_lazy_mmu_mode(); | |
| 1416 | 1418 | } |
| 1417 | 1419 | |
| 1418 | 1420 | #ifdef CONFIG_HIBERNATION |
| @@ -58,6 +58,13 @@ void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) · 57 unmodified lines | ||
| 58 | 58 | void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) |
| 59 | 59 | { |
| 60 | 60 | paravirt_release_pmd(__pa(pmd) >> PAGE_SHIFT); |
| 61 | + /* | |
| 62 | + * NOTE! For PAE, any changes to the top page-directory-pointer-table | |
| 63 | + * entries need a full cr3 reload to flush. | |
| 64 | + */ | |
| 65 | +#ifdef CONFIG_X86_PAE | |
| 66 | + tlb->need_flush_all = 1; | |
| 67 | +#endif | |
| 61 | 68 | tlb_remove_page(tlb, virt_to_page(pmd)); |
| 62 | 69 | } |
| 63 | 70 | |
| @@ -41,6 +41,7 @@ · 40 unmodified lines | ||
| 41 | 41 | #include <linux/io.h> |
| 42 | 42 | #include <linux/reboot.h> |
| 43 | 43 | #include <linux/bcd.h> |
| 44 | +#include <linux/ucs2_string.h> | |
| 44 | 45 | |
| 45 | 46 | #include <asm/setup.h> |
| 46 | 47 | #include <asm/efi.h> |
| @@ -51,6 +52,13 @@ · 4 unmodified lines | ||
| 51 | 52 | |
| 52 | 53 | #define EFI_DEBUG 1 |
| 53 | 54 | |
| 55 | +/* | |
| 56 | + * There's some additional metadata associated with each | |
| 57 | + * variable. Intel's reference implementation is 60 bytes - bump that | |
| 58 | + * to account for potential alignment constraints | |
| 59 | + */ | |
| 60 | +#define VAR_METADATA_SIZE 64 | |
| 61 | + | |
| 54 | 62 | struct efi __read_mostly efi = { |
| 55 | 63 | .mps = EFI_INVALID_TABLE_ADDR, |
| 56 | 64 | .acpi = EFI_INVALID_TABLE_ADDR, |
| @@ -69,6 +77,13 @@ struct efi_memory_map memmap; · 12 unmodified lines | ||
| 69 | 77 | static struct efi efi_phys __initdata; |
| 70 | 78 | static efi_system_table_t efi_systab __initdata; |
| 71 | 79 | |
| 80 | +static u64 efi_var_store_size; | |
| 81 | +static u64 efi_var_remaining_size; | |
| 82 | +static u64 efi_var_max_var_size; | |
| 83 | +static u64 boot_used_size; | |
| 84 | +static u64 boot_var_size; | |
| 85 | +static u64 active_size; | |
| 86 | + | |
| 72 | 87 | unsigned long x86_efi_facility; |
| 73 | 88 | |
| 74 | 89 | /* |
| @@ -98,6 +113,15 @@ static int __init setup_add_efi_memmap(char *arg) · 23 unmodified lines | ||
| 98 | 113 | } |
| 99 | 114 | early_param("add_efi_memmap", setup_add_efi_memmap); |
| 100 | 115 | |
| 116 | +static bool efi_no_storage_paranoia; | |
| 117 | + | |
| 118 | +static int __init setup_storage_paranoia(char *arg) | |
| 119 | +{ | |
| 120 | + efi_no_storage_paranoia = true; | |
| 121 | + return 0; | |
| 122 | +} | |
| 123 | +early_param("efi_no_storage_paranoia", setup_storage_paranoia); | |
| 124 | + | |
| 101 | 125 | |
| 102 | 126 | static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) |
| 103 | 127 | { |
| @@ -162,8 +186,53 @@ static efi_status_t virt_efi_get_next_variable(unsigned long *name_size, · 58 unmodified lines | ||
| 162 | 186 | efi_char16_t *name, |
| 163 | 187 | efi_guid_t *vendor) |
| 164 | 188 | { |
| 165 | − return efi_call_virt3(get_next_variable, | |
| 166 | − name_size, name, vendor); | |
| 189 | + efi_status_t status; | |
| 190 | + static bool finished = false; | |
| 191 | + static u64 var_size; | |
| 192 | + | |
| 193 | + status = efi_call_virt3(get_next_variable, | |
| 194 | + name_size, name, vendor); | |
| 195 | + | |
| 196 | + if (status == EFI_NOT_FOUND) { | |
| 197 | + finished = true; | |
| 198 | + if (var_size < boot_used_size) { | |
| 199 | + boot_var_size = boot_used_size - var_size; | |
| 200 | + active_size += boot_var_size; | |
| 201 | + } else { | |
| 202 | + printk(KERN_WARNING FW_BUG "efi: Inconsistent initial sizes\n"); | |
| 203 | + } | |
| 204 | + } | |
| 205 | + | |
| 206 | + if (boot_used_size && !finished) { | |
| 207 | + unsigned long size; | |
| 208 | + u32 attr; | |
| 209 | + efi_status_t s; | |
| 210 | + void *tmp; | |
| 211 | + | |
| 212 | + s = virt_efi_get_variable(name, vendor, &attr, &size, NULL); | |
| 213 | + | |
| 214 | + if (s != EFI_BUFFER_TOO_SMALL || !size) | |
| 215 | + return status; | |
| 216 | + | |
| 217 | + tmp = kmalloc(size, GFP_ATOMIC); | |
| 218 | + | |
| 219 | + if (!tmp) | |
| 220 | + return status; | |
| 221 | + | |
| 222 | + s = virt_efi_get_variable(name, vendor, &attr, &size, tmp); | |
| 223 | + | |
| 224 | + if (s == EFI_SUCCESS && (attr & EFI_VARIABLE_NON_VOLATILE)) { | |
| 225 | + var_size += size; | |
| 226 | + var_size += ucs2_strsize(name, 1024); | |
| 227 | + active_size += size; | |
| 228 | + active_size += VAR_METADATA_SIZE; | |
| 229 | + active_size += ucs2_strsize(name, 1024); | |
| 230 | + } | |
| 231 | + | |
| 232 | + kfree(tmp); | |
| 233 | + } | |
| 234 | + | |
| 235 | + return status; | |
| 167 | 236 | } |
| 168 | 237 | |
| 169 | 238 | static efi_status_t virt_efi_set_variable(efi_char16_t *name, |
| @@ -172,9 +241,34 @@ static efi_status_t virt_efi_set_variable(efi_char16_t *name, · 2 unmodified lines | ||
| 172 | 241 | unsigned long data_size, |
| 173 | 242 | void *data) |
| 174 | 243 | { |
| 175 | − return efi_call_virt5(set_variable, | |
| 176 | − name, vendor, attr, | |
| 177 | − data_size, data); | |
| 244 | + efi_status_t status; | |
| 245 | + u32 orig_attr = 0; | |
| 246 | + unsigned long orig_size = 0; | |
| 247 | + | |
| 248 | + status = virt_efi_get_variable(name, vendor, &orig_attr, &orig_size, | |
| 249 | + NULL); | |
| 250 | + | |
| 251 | + if (status != EFI_BUFFER_TOO_SMALL) | |
| 252 | + orig_size = 0; | |
| 253 | + | |
| 254 | + status = efi_call_virt5(set_variable, | |
| 255 | + name, vendor, attr, | |
| 256 | + data_size, data); | |
| 257 | + | |
| 258 | + if (status == EFI_SUCCESS) { | |
| 259 | + if (orig_size) { | |
| 260 | + active_size -= orig_size; | |
| 261 | + active_size -= ucs2_strsize(name, 1024); | |
| 262 | + active_size -= VAR_METADATA_SIZE; | |
| 263 | + } | |
| 264 | + if (data_size) { | |
| 265 | + active_size += data_size; | |
| 266 | + active_size += ucs2_strsize(name, 1024); | |
| 267 | + active_size += VAR_METADATA_SIZE; | |
| 268 | + } | |
| 269 | + } | |
| 270 | + | |
| 271 | + return status; | |
| 178 | 272 | } |
| 179 | 273 | |
| 180 | 274 | static efi_status_t virt_efi_query_variable_info(u32 attr, |
| @@ -682,6 +776,9 @@ void __init efi_init(void) · 501 unmodified lines | ||
| 682 | 776 | char vendor[100] = "unknown"; |
| 683 | 777 | int i = 0; |
| 684 | 778 | void *tmp; |
| 779 | + struct setup_data *data; | |
| 780 | + struct efi_var_bootdata *efi_var_data; | |
| 781 | + u64 pa_data; | |
| 685 | 782 | |
| 686 | 783 | #ifdef CONFIG_X86_32 |
| 687 | 784 | if (boot_params.efi_info.efi_systab_hi || |
| @@ -699,6 +796,22 @@ void __init efi_init(void) · 11 unmodified lines | ||
| 699 | 796 | if (efi_systab_init(efi_phys.systab)) |
| 700 | 797 | return; |
| 701 | 798 | |
| 799 | + pa_data = boot_params.hdr.setup_data; | |
| 800 | + while (pa_data) { | |
| 801 | + data = early_ioremap(pa_data, sizeof(*efi_var_data)); | |
| 802 | + if (data->type == SETUP_EFI_VARS) { | |
| 803 | + efi_var_data = (struct efi_var_bootdata *)data; | |
| 804 | + | |
| 805 | + efi_var_store_size = efi_var_data->store_size; | |
| 806 | + efi_var_remaining_size = efi_var_data->remaining_size; | |
| 807 | + efi_var_max_var_size = efi_var_data->max_var_size; | |
| 808 | + } | |
| 809 | + pa_data = data->next; | |
| 810 | + early_iounmap(data, sizeof(*efi_var_data)); | |
| 811 | + } | |
| 812 | + | |
| 813 | + boot_used_size = efi_var_store_size - efi_var_remaining_size; | |
| 814 | + | |
| 702 | 815 | set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility); |
| 703 | 816 | |
| 704 | 817 | /* |
| @@ -999,3 +1112,48 @@ u64 efi_mem_attributes(unsigned long phys_addr) · 294 unmodified lines | ||
| 999 | 1112 | } |
| 1000 | 1113 | return 0; |
| 1001 | 1114 | } |
| 1115 | + | |
| 1116 | +/* | |
| 1117 | + * Some firmware has serious problems when using more than 50% of the EFI | |
| 1118 | + * variable store, i.e. it triggers bugs that can brick machines. Ensure that | |
| 1119 | + * we never use more than this safe limit. | |
| 1120 | + * | |
| 1121 | + * Return EFI_SUCCESS if it is safe to write 'size' bytes to the variable | |
| 1122 | + * store. | |
| 1123 | + */ | |
| 1124 | +efi_status_t efi_query_variable_store(u32 attributes, unsigned long size) | |
| 1125 | +{ | |
| 1126 | + efi_status_t status; | |
| 1127 | + u64 storage_size, remaining_size, max_size; | |
| 1128 | + | |
| 1129 | + status = efi.query_variable_info(attributes, &storage_size, | |
| 1130 | + &remaining_size, &max_size); | |
| 1131 | + if (status != EFI_SUCCESS) | |
| 1132 | + return status; | |
| 1133 | + | |
| 1134 | + if (!max_size && remaining_size > size) | |
| 1135 | + printk_once(KERN_ERR FW_BUG "Broken EFI implementation" | |
| 1136 | + " is returning MaxVariableSize=0\n"); | |
| 1137 | + /* | |
| 1138 | + * Some firmware implementations refuse to boot if there's insufficient | |
| 1139 | + * space in the variable store. We account for that by refusing the | |
| 1140 | + * write if permitting it would reduce the available space to under | |
| 1141 | + * 50%. However, some firmware won't reclaim variable space until | |
| 1142 | + * after the used (not merely the actively used) space drops below | |
| 1143 | + * a threshold. We can approximate that case with the value calculated | |
| 1144 | + * above. If both the firmware and our calculations indicate that the | |
| 1145 | + * available space would drop below 50%, refuse the write. | |
| 1146 | + */ | |
| 1147 | + | |
| 1148 | + if (!storage_size || size > remaining_size || | |
| 1149 | + (max_size && size > max_size)) | |
| 1150 | + return EFI_OUT_OF_RESOURCES; | |
| 1151 | + | |
| 1152 | + if (!efi_no_storage_paranoia && | |
| 1153 | + ((active_size + size + VAR_METADATA_SIZE > storage_size / 2) && | |
| 1154 | + (remaining_size - size < storage_size / 2))) | |
| 1155 | + return EFI_OUT_OF_RESOURCES; | |
| 1156 | + | |
| 1157 | + return EFI_SUCCESS; | |
| 1158 | +} | |
| 1159 | +EXPORT_SYMBOL_GPL(efi_query_variable_store); | |
| @@ -1748,14 +1748,18 @@ static void *m2v(phys_addr_t maddr) · 1747 unmodified lines | ||
| 1748 | 1748 | } |
| 1749 | 1749 | |
| 1750 | 1750 | /* Set the page permissions on an identity-mapped pages */ |
| 1751 | −static void set_page_prot(void *addr, pgprot_t prot) | |
| 1751 | +static void set_page_prot_flags(void *addr, pgprot_t prot, unsigned long flags) | |
| 1752 | 1752 | { |
| 1753 | 1753 | unsigned long pfn = __pa(addr) >> PAGE_SHIFT; |
| 1754 | 1754 | pte_t pte = pfn_pte(pfn, prot); |
| 1755 | 1755 | |
| 1756 | − if (HYPERVISOR_update_va_mapping((unsigned long)addr, pte, 0)) | |
| 1756 | + if (HYPERVISOR_update_va_mapping((unsigned long)addr, pte, flags)) | |
| 1757 | 1757 | BUG(); |
| 1758 | 1758 | } |
| 1759 | +static void set_page_prot(void *addr, pgprot_t prot) | |
| 1760 | +{ | |
| 1761 | + return set_page_prot_flags(addr, prot, UVMF_NONE); | |
| 1762 | +} | |
| 1759 | 1763 | #ifdef CONFIG_X86_32 |
| 1760 | 1764 | static void __init xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn) |
| 1761 | 1765 | { |
| @@ -1839,12 +1843,12 @@ static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end, · 77 unmodified lines | ||
| 1839 | 1843 | unsigned long addr) |
| 1840 | 1844 | { |
| 1841 | 1845 | if (*pt_base == PFN_DOWN(__pa(addr))) { |
| 1842 | − set_page_prot((void *)addr, PAGE_KERNEL); | |
| 1846 | + set_page_prot_flags((void *)addr, PAGE_KERNEL, UVMF_INVLPG); | |
| 1843 | 1847 | clear_page((void *)addr); |
| 1844 | 1848 | (*pt_base)++; |
| 1845 | 1849 | } |
| 1846 | 1850 | if (*pt_end == PFN_DOWN(__pa(addr))) { |
| 1847 | − set_page_prot((void *)addr, PAGE_KERNEL); | |
| 1851 | + set_page_prot_flags((void *)addr, PAGE_KERNEL, UVMF_INVLPG); | |
| 1848 | 1852 | clear_page((void *)addr); |
| 1849 | 1853 | (*pt_end)--; |
| 1850 | 1854 | } |
| @@ -2196,6 +2200,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = { · 345 unmodified lines | ||
| 2196 | 2200 | .lazy_mode = { |
| 2197 | 2201 | .enter = paravirt_enter_lazy_mmu, |
| 2198 | 2202 | .leave = xen_leave_lazy_mmu, |
| 2203 | + .flush = paravirt_flush_lazy_mmu, | |
| 2199 | 2204 | }, |
| 2200 | 2205 | |
| 2201 | 2206 | .set_fixmap = xen_set_fixmap, |
| @@ -39,6 +39,7 @@ · 38 unmodified lines | ||
| 39 | 39 | |
| 40 | 40 | EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_remap); |
| 41 | 41 | EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap); |
| 42 | +EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete); | |
| 42 | 43 | EXPORT_TRACEPOINT_SYMBOL_GPL(block_unplug); |
| 43 | 44 | |
| 44 | 45 | DEFINE_IDA(blk_queue_ida); |
| @@ -229,6 +229,8 @@ queue_store_##name(struct request_queue *q, const char *page, size_t count) \ · 228 unmodified lines | ||
| 229 | 229 | unsigned long val; \ |
| 230 | 230 | ssize_t ret; \ |
| 231 | 231 | ret = queue_var_store(&val, page, count); \ |
| 232 | + if (ret < 0) \ | |
| 233 | + return ret; \ | |
| 232 | 234 | if (neg) \ |
| 233 | 235 | val = !val; \ |
| 234 | 236 | \ |
| @@ -257,7 +257,6 @@ void delete_partition(struct gendisk *disk, int partno) · 256 unmodified lines | ||
| 257 | 257 | |
| 258 | 258 | hd_struct_put(part); |
| 259 | 259 | } |
| 260 | −EXPORT_SYMBOL(delete_partition); | |
| 261 | 260 | |
| 262 | 261 | static ssize_t whole_disk_show(struct device *dev, |
| 263 | 262 | struct device_attribute *attr, char *buf) |
| @@ -44,6 +44,7 @@ struct crypto_rfc4543_ctx { · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | struct crypto_rfc4543_req_ctx { |
| 46 | 46 | u8 auth_tag[16]; |
| 47 | + u8 assocbuf[32]; | |
| 47 | 48 | struct scatterlist cipher[1]; |
| 48 | 49 | struct scatterlist payload[2]; |
| 49 | 50 | struct scatterlist assoc[2]; |
| @@ -1133,9 +1134,19 @@ static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req, · 1083 unmodified lines | ||
| 1133 | 1134 | scatterwalk_crypto_chain(payload, dst, vdst == req->iv + 8, 2); |
| 1134 | 1135 | assoclen += 8 + req->cryptlen - (enc ? 0 : authsize); |
| 1135 | 1136 | |
| 1136 | − sg_init_table(assoc, 2); | |
| 1137 | − sg_set_page(assoc, sg_page(req->assoc), req->assoc->length, | |
| 1138 | − req->assoc->offset); | |
| 1137 | + if (req->assoc->length == req->assoclen) { | |
| 1138 | + sg_init_table(assoc, 2); | |
| 1139 | + sg_set_page(assoc, sg_page(req->assoc), req->assoc->length, | |
| 1140 | + req->assoc->offset); | |
| 1141 | + } else { | |
| 1142 | + BUG_ON(req->assoclen > sizeof(rctx->assocbuf)); | |
| 1143 | + | |
| 1144 | + scatterwalk_map_and_copy(rctx->assocbuf, req->assoc, 0, | |
| 1145 | + req->assoclen, 0); | |
| 1146 | + | |
| 1147 | + sg_init_table(assoc, 2); | |
| 1148 | + sg_set_buf(assoc, rctx->assocbuf, req->assoclen); | |
| 1149 | + } | |
| 1139 | 1150 | scatterwalk_crypto_chain(assoc, payload, 0, 2); |
| 1140 | 1151 | |
| 1141 | 1152 | aead_request_set_tfm(subreq, ctx->child); |
| @@ -415,7 +415,6 @@ static int acpi_pci_root_add(struct acpi_device *device, · 414 unmodified lines | ||
| 415 | 415 | struct acpi_pci_root *root; |
| 416 | 416 | struct acpi_pci_driver *driver; |
| 417 | 417 | u32 flags, base_flags; |
| 418 | − bool is_osc_granted = false; | |
| 419 | 418 | |
| 420 | 419 | root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); |
| 421 | 420 | if (!root) |
| @@ -476,6 +475,30 @@ static int acpi_pci_root_add(struct acpi_device *device, · 54 unmodified lines | ||
| 476 | 475 | flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; |
| 477 | 476 | acpi_pci_osc_support(root, flags); |
| 478 | 477 | |
| 478 | + /* | |
| 479 | + * TBD: Need PCI interface for enumeration/configuration of roots. | |
| 480 | + */ | |
| 481 | + | |
| 482 | + mutex_lock(&acpi_pci_root_lock); | |
| 483 | + list_add_tail(&root->node, &acpi_pci_roots); | |
| 484 | + mutex_unlock(&acpi_pci_root_lock); | |
| 485 | + | |
| 486 | + /* | |
| 487 | + * Scan the Root Bridge | |
| 488 | + * -------------------- | |
| 489 | + * Must do this prior to any attempt to bind the root device, as the | |
| 490 | + * PCI namespace does not get created until this call is made (and | |
| 491 | + * thus the root bridge's pci_dev does not exist). | |
| 492 | + */ | |
| 493 | + root->bus = pci_acpi_scan_root(root); | |
| 494 | + if (!root->bus) { | |
| 495 | + printk(KERN_ERR PREFIX | |
| 496 | + "Bus %04x:%02x not present in PCI namespace\n", | |
| 497 | + root->segment, (unsigned int)root->secondary.start); | |
| 498 | + result = -ENODEV; | |
| 499 | + goto out_del_root; | |
| 500 | + } | |
| 501 | + | |
| 479 | 502 | /* Indicate support for various _OSC capabilities. */ |
| 480 | 503 | if (pci_ext_cfg_avail()) |
| 481 | 504 | flags |= OSC_EXT_PCI_CONFIG_SUPPORT; |
| @@ -494,6 +517,7 @@ static int acpi_pci_root_add(struct acpi_device *device, · 12 unmodified lines | ||
| 494 | 517 | flags = base_flags; |
| 495 | 518 | } |
| 496 | 519 | } |
| 520 | + | |
| 497 | 521 | if (!pcie_ports_disabled |
| 498 | 522 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { |
| 499 | 523 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL |
| @@ -514,54 +538,28 @@ static int acpi_pci_root_add(struct acpi_device *device, · 14 unmodified lines | ||
| 514 | 538 | status = acpi_pci_osc_control_set(device->handle, &flags, |
| 515 | 539 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); |
| 516 | 540 | if (ACPI_SUCCESS(status)) { |
| 517 | − is_osc_granted = true; | |
| 518 | 541 | dev_info(&device->dev, |
| 519 | 542 | "ACPI _OSC control (0x%02x) granted\n", flags); |
| 543 | + if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { | |
| 544 | + /* | |
| 545 | + * We have ASPM control, but the FADT indicates | |
| 546 | + * that it's unsupported. Clear it. | |
| 547 | + */ | |
| 548 | + pcie_clear_aspm(root->bus); | |
| 549 | + } | |
| 520 | 550 | } else { |
| 521 | − is_osc_granted = false; | |
| 522 | 551 | dev_info(&device->dev, |
| 523 | 552 | "ACPI _OSC request failed (%s), " |
| 524 | 553 | "returned control mask: 0x%02x\n", |
| 525 | 554 | acpi_format_exception(status), flags); |
| 555 | + pr_info("ACPI _OSC control for PCIe not granted, " | |
| 556 | + "disabling ASPM\n"); | |
| 557 | + pcie_no_aspm(); | |
| 526 | 558 | } |
| 527 | 559 | } else { |
| 528 | 560 | dev_info(&device->dev, |
| 529 | − "Unable to request _OSC control " | |
| 530 | − "(_OSC support mask: 0x%02x)\n", flags); | |
| 531 | − } | |
| 532 | − | |
| 533 | − /* | |
| 534 | − * TBD: Need PCI interface for enumeration/configuration of roots. | |
| 535 | − */ | |
| 536 | − | |
| 537 | − mutex_lock(&acpi_pci_root_lock); | |
| 538 | − list_add_tail(&root->node, &acpi_pci_roots); | |
| 539 | − mutex_unlock(&acpi_pci_root_lock); | |
| 540 | − | |
| 541 | − /* | |
| 542 | − * Scan the Root Bridge | |
| 543 | − * -------------------- | |
| 544 | − * Must do this prior to any attempt to bind the root device, as the | |
| 545 | − * PCI namespace does not get created until this call is made (and | |
| 546 | − * thus the root bridge's pci_dev does not exist). | |
| 547 | − */ | |
| 548 | − root->bus = pci_acpi_scan_root(root); | |
| 549 | − if (!root->bus) { | |
| 550 | − printk(KERN_ERR PREFIX | |
| 551 | − "Bus %04x:%02x not present in PCI namespace\n", | |
| 552 | − root->segment, (unsigned int)root->secondary.start); | |
| 553 | − result = -ENODEV; | |
| 554 | − goto out_del_root; | |
| 555 | − } | |
| 556 | − | |
| 557 | − /* ASPM setting */ | |
| 558 | − if (is_osc_granted) { | |
| 559 | − if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) | |
| 560 | − pcie_clear_aspm(root->bus); | |
| 561 | − } else { | |
| 562 | − pr_info("ACPI _OSC control for PCIe not granted, " | |
| 563 | − "disabling ASPM\n"); | |
| 564 | − pcie_no_aspm(); | |
| 561 | + "Unable to request _OSC control " | |
| 562 | + "(_OSC support mask: 0x%02x)\n", flags); | |
| 565 | 563 | } |
| 566 | 564 | |
| 567 | 565 | pci_acpi_add_bus_pm_notifier(device, root->bus); |
| @@ -150,6 +150,7 @@ enum piix_controller_ids { · 149 unmodified lines | ||
| 150 | 150 | tolapai_sata, |
| 151 | 151 | piix_pata_vmw, /* PIIX4 for VMware, spurious DMA_ERR */ |
| 152 | 152 | ich8_sata_snb, |
| 153 | + ich8_2port_sata_snb, | |
| 153 | 154 | }; |
| 154 | 155 | |
| 155 | 156 | struct piix_map_db { |
| @@ -304,7 +305,7 @@ static const struct pci_device_id piix_pci_tbl[] = { · 148 unmodified lines | ||
| 304 | 305 | /* SATA Controller IDE (Lynx Point) */ |
| 305 | 306 | { 0x8086, 0x8c01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, |
| 306 | 307 | /* SATA Controller IDE (Lynx Point) */ |
| 307 | − { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | |
| 308 | + { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, | |
| 308 | 309 | /* SATA Controller IDE (Lynx Point) */ |
| 309 | 310 | { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
| 310 | 311 | /* SATA Controller IDE (Lynx Point-LP) */ |
| @@ -439,6 +440,7 @@ static const struct piix_map_db *piix_map_db_table[] = { · 128 unmodified lines | ||
| 439 | 440 | [ich8m_apple_sata] = &ich8m_apple_map_db, |
| 440 | 441 | [tolapai_sata] = &tolapai_map_db, |
| 441 | 442 | [ich8_sata_snb] = &ich8_map_db, |
| 443 | + [ich8_2port_sata_snb] = &ich8_2port_map_db, | |
| 442 | 444 | }; |
| 443 | 445 | |
| 444 | 446 | static struct pci_bits piix_enable_bits[] = { |
| @@ -1242,6 +1244,16 @@ static struct ata_port_info piix_port_info[] = { · 797 unmodified lines | ||
| 1242 | 1244 | .udma_mask = ATA_UDMA6, |
| 1243 | 1245 | .port_ops = &piix_sata_ops, |
| 1244 | 1246 | }, |
| 1247 | + | |
| 1248 | + [ich8_2port_sata_snb] = | |
| 1249 | + { | |
| 1250 | + .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR | |
| 1251 | + | PIIX_FLAG_PIO16, | |
| 1252 | + .pio_mask = ATA_PIO4, | |
| 1253 | + .mwdma_mask = ATA_MWDMA2, | |
| 1254 | + .udma_mask = ATA_UDMA6, | |
| 1255 | + .port_ops = &piix_sata_ops, | |
| 1256 | + }, | |
| 1245 | 1257 | }; |
| 1246 | 1258 | |
| 1247 | 1259 | #define AHCI_PCI_BAR 5 |
| @@ -2329,7 +2329,7 @@ int ata_dev_configure(struct ata_device *dev) · 2328 unmodified lines | ||
| 2329 | 2329 | * from SATA Settings page of Identify Device Data Log. |
| 2330 | 2330 | */ |
| 2331 | 2331 | if (ata_id_has_devslp(dev->id)) { |
| 2332 | − u8 sata_setting[ATA_SECT_SIZE]; | |
| 2332 | + u8 *sata_setting = ap->sector_buf; | |
| 2333 | 2333 | int i, j; |
| 2334 | 2334 | |
| 2335 | 2335 | dev->flags |= ATA_DFLAG_DEVSLP; |
| @@ -2439,6 +2439,9 @@ int ata_dev_configure(struct ata_device *dev) · 103 unmodified lines | ||
| 2439 | 2439 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, |
| 2440 | 2440 | dev->max_sectors); |
| 2441 | 2441 | |
| 2442 | + if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48) | |
| 2443 | + dev->max_sectors = ATA_MAX_SECTORS_LBA48; | |
| 2444 | + | |
| 2442 | 2445 | if (ap->ops->dev_config) |
| 2443 | 2446 | ap->ops->dev_config(dev); |
| 2444 | 2447 | |
| @@ -4100,6 +4103,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 1655 unmodified lines | ||
| 4100 | 4103 | /* Weird ATAPI devices */ |
| 4101 | 4104 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, |
| 4102 | 4105 | { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA }, |
| 4106 | + { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, | |
| 4103 | 4107 | |
| 4104 | 4108 | /* Devices we expect to fail diagnostics */ |
| 4105 | 4109 | |
| @@ -532,8 +532,8 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg) · 531 unmodified lines | ||
| 532 | 532 | struct scsi_sense_hdr sshdr; |
| 533 | 533 | scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, |
| 534 | 534 | &sshdr); |
| 535 | − if (sshdr.sense_key == 0 && | |
| 536 | − sshdr.asc == 0 && sshdr.ascq == 0) | |
| 535 | + if (sshdr.sense_key == RECOVERED_ERROR && | |
| 536 | + sshdr.asc == 0 && sshdr.ascq == 0x1d) | |
| 537 | 537 | cmd_result &= ~SAM_STAT_CHECK_CONDITION; |
| 538 | 538 | } |
| 539 | 539 | |
| @@ -618,8 +618,8 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg) · 78 unmodified lines | ||
| 618 | 618 | struct scsi_sense_hdr sshdr; |
| 619 | 619 | scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, |
| 620 | 620 | &sshdr); |
| 621 | − if (sshdr.sense_key == 0 && | |
| 622 | − sshdr.asc == 0 && sshdr.ascq == 0) | |
| 621 | + if (sshdr.sense_key == RECOVERED_ERROR && | |
| 622 | + sshdr.asc == 0 && sshdr.ascq == 0x1d) | |
| 623 | 623 | cmd_result &= ~SAM_STAT_CHECK_CONDITION; |
| 624 | 624 | } |
| 625 | 625 | |
| @@ -943,7 +943,8 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg, · 942 unmodified lines | ||
| 943 | 943 | unsigned int ival; |
| 944 | 944 | int val_bytes = map->format.val_bytes; |
| 945 | 945 | for (i = 0; i < val_len / val_bytes; i++) { |
| 946 | − ival = map->format.parse_val(val + (i * val_bytes)); | |
| 946 | + memcpy(map->work_buf, val + (i * val_bytes), val_bytes); | |
| 947 | + ival = map->format.parse_val(map->work_buf); | |
| 947 | 948 | ret = regcache_write(map, reg + (i * map->reg_stride), |
| 948 | 949 | ival); |
| 949 | 950 | if (ret) { |
| @@ -1051,29 +1051,12 @@ static int loop_clr_fd(struct loop_device *lo) · 1050 unmodified lines | ||
| 1051 | 1051 | lo->lo_state = Lo_unbound; |
| 1052 | 1052 | /* This is safe: open() is still holding a reference. */ |
| 1053 | 1053 | module_put(THIS_MODULE); |
| 1054 | + if (lo->lo_flags & LO_FLAGS_PARTSCAN && bdev) | |
| 1055 | + ioctl_by_bdev(bdev, BLKRRPART, 0); | |
| 1054 | 1056 | lo->lo_flags = 0; |
| 1055 | 1057 | if (!part_shift) |
| 1056 | 1058 | lo->lo_disk->flags |= GENHD_FL_NO_PART_SCAN; |
| 1057 | 1059 | mutex_unlock(&lo->lo_ctl_mutex); |
| 1058 | − | |
| 1059 | − /* | |
| 1060 | − * Remove all partitions, since BLKRRPART won't remove user | |
| 1061 | − * added partitions when max_part=0 | |
| 1062 | − */ | |
| 1063 | − if (bdev) { | |
| 1064 | − struct disk_part_iter piter; | |
| 1065 | − struct hd_struct *part; | |
| 1066 | − | |
| 1067 | − mutex_lock_nested(&bdev->bd_mutex, 1); | |
| 1068 | − invalidate_partition(bdev->bd_disk, 0); | |
| 1069 | − disk_part_iter_init(&piter, bdev->bd_disk, | |
| 1070 | − DISK_PITER_INCL_EMPTY); | |
| 1071 | − while ((part = disk_part_iter_next(&piter))) | |
| 1072 | − delete_partition(bdev->bd_disk, part->partno); | |
| 1073 | − disk_part_iter_exit(&piter); | |
| 1074 | − mutex_unlock(&bdev->bd_mutex); | |
| 1075 | − } | |
| 1076 | − | |
| 1077 | 1060 | /* |
| 1078 | 1061 | * Need not hold lo_ctl_mutex to fput backing file. |
| 1079 | 1062 | * Calling fput holding lo_ctl_mutex triggers a circular |
| @@ -81,12 +81,17 @@ · 80 unmodified lines | ||
| 81 | 81 | /* Device instance number, incremented each time a device is probed. */ |
| 82 | 82 | static int instance; |
| 83 | 83 | |
| 84 | +struct list_head online_list; | |
| 85 | +struct list_head removing_list; | |
| 86 | +spinlock_t dev_lock; | |
| 87 | + | |
| 84 | 88 | /* |
| 85 | 89 | * Global variable used to hold the major block device number |
| 86 | 90 | * allocated in mtip_init(). |
| 87 | 91 | */ |
| 88 | 92 | static int mtip_major; |
| 89 | 93 | static struct dentry *dfs_parent; |
| 94 | +static struct dentry *dfs_device_status; | |
| 90 | 95 | |
| 91 | 96 | static u32 cpu_use[NR_CPUS]; |
| 92 | 97 | |
| @@ -243,40 +248,31 @@ static inline void release_slot(struct mtip_port *port, int tag) · 150 unmodified lines | ||
| 243 | 248 | /* |
| 244 | 249 | * Reset the HBA (without sleeping) |
| 245 | 250 | * |
| 246 | − * Just like hba_reset, except does not call sleep, so can be | |
| 247 | − * run from interrupt/tasklet context. | |
| 248 | − * | |
| 249 | 251 | * @dd Pointer to the driver data structure. |
| 250 | 252 | * |
| 251 | 253 | * return value |
| 252 | 254 | * 0 The reset was successful. |
| 253 | 255 | * -1 The HBA Reset bit did not clear. |
| 254 | 256 | */ |
| 255 | −static int hba_reset_nosleep(struct driver_data *dd) | |
| 257 | +static int mtip_hba_reset(struct driver_data *dd) | |
| 256 | 258 | { |
| 257 | 259 | unsigned long timeout; |
| 258 | 260 | |
| 259 | − /* Chip quirk: quiesce any chip function */ | |
| 260 | − mdelay(10); | |
| 261 | − | |
| 262 | 261 | /* Set the reset bit */ |
| 263 | 262 | writel(HOST_RESET, dd->mmio + HOST_CTL); |
| 264 | 263 | |
| 265 | 264 | /* Flush */ |
| 266 | 265 | readl(dd->mmio + HOST_CTL); |
| 267 | 266 | |
| 268 | − /* | |
| 269 | − * Wait 10ms then spin for up to 1 second | |
| 270 | − * waiting for reset acknowledgement | |
| 271 | − */ | |
| 272 | − timeout = jiffies + msecs_to_jiffies(1000); | |
| 273 | − mdelay(10); | |
| 274 | − while ((readl(dd->mmio + HOST_CTL) & HOST_RESET) | |
| 275 | − && time_before(jiffies, timeout)) | |
| 276 | − mdelay(1); | |
| 267 | + /* Spin for up to 2 seconds, waiting for reset acknowledgement */ | |
| 268 | + timeout = jiffies + msecs_to_jiffies(2000); | |
| 269 | + do { | |
| 270 | + mdelay(10); | |
| 271 | + if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) | |
| 272 | + return -1; | |
| 277 | 273 | |
| 278 | − if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) | |
| 279 | − return -1; | |
| 274 | + } while ((readl(dd->mmio + HOST_CTL) & HOST_RESET) | |
| 275 | + && time_before(jiffies, timeout)); | |
| 280 | 276 | |
| 281 | 277 | if (readl(dd->mmio + HOST_CTL) & HOST_RESET) |
| 282 | 278 | return -1; |
| @@ -481,7 +477,7 @@ static void mtip_restart_port(struct mtip_port *port) · 198 unmodified lines | ||
| 481 | 477 | dev_warn(&port->dd->pdev->dev, |
| 482 | 478 | "PxCMD.CR not clear, escalating reset\n"); |
| 483 | 479 | |
| 484 | − if (hba_reset_nosleep(port->dd)) | |
| 480 | + if (mtip_hba_reset(port->dd)) | |
| 485 | 481 | dev_err(&port->dd->pdev->dev, |
| 486 | 482 | "HBA reset escalation failed.\n"); |
| 487 | 483 | |
| @@ -527,6 +523,26 @@ static void mtip_restart_port(struct mtip_port *port) · 39 unmodified lines | ||
| 527 | 523 | |
| 528 | 524 | } |
| 529 | 525 | |
| 526 | +static int mtip_device_reset(struct driver_data *dd) | |
| 527 | +{ | |
| 528 | + int rv = 0; | |
| 529 | + | |
| 530 | + if (mtip_check_surprise_removal(dd->pdev)) | |
| 531 | + return 0; | |
| 532 | + | |
| 533 | + if (mtip_hba_reset(dd) < 0) | |
| 534 | + rv = -EFAULT; | |
| 535 | + | |
| 536 | + mdelay(1); | |
| 537 | + mtip_init_port(dd->port); | |
| 538 | + mtip_start_port(dd->port); | |
| 539 | + | |
| 540 | + /* Enable interrupts on the HBA. */ | |
| 541 | + writel(readl(dd->mmio + HOST_CTL) | HOST_IRQ_EN, | |
| 542 | + dd->mmio + HOST_CTL); | |
| 543 | + return rv; | |
| 544 | +} | |
| 545 | + | |
| 530 | 546 | /* |
| 531 | 547 | * Helper function for tag logging |
| 532 | 548 | */ |
| @@ -632,7 +648,7 @@ static void mtip_timeout_function(unsigned long int data) · 99 unmodified lines | ||
| 632 | 648 | if (cmdto_cnt) { |
| 633 | 649 | print_tags(port->dd, "timed out", tagaccum, cmdto_cnt); |
| 634 | 650 | if (!test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { |
| 635 | − mtip_restart_port(port); | |
| 651 | + mtip_device_reset(port->dd); | |
| 636 | 652 | wake_up_interruptible(&port->svc_wait); |
| 637 | 653 | } |
| 638 | 654 | clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); |
| @@ -1283,11 +1299,11 @@ static int mtip_exec_internal_command(struct mtip_port *port, · 644 unmodified lines | ||
| 1283 | 1299 | int rv = 0, ready2go = 1; |
| 1284 | 1300 | struct mtip_cmd *int_cmd = &port->commands[MTIP_TAG_INTERNAL]; |
| 1285 | 1301 | unsigned long to; |
| 1302 | + struct driver_data *dd = port->dd; | |
| 1286 | 1303 | |
| 1287 | 1304 | /* Make sure the buffer is 8 byte aligned. This is asic specific. */ |
| 1288 | 1305 | if (buffer & 0x00000007) { |
| 1289 | − dev_err(&port->dd->pdev->dev, | |
| 1290 | − "SG buffer is not 8 byte aligned\n"); | |
| 1306 | + dev_err(&dd->pdev->dev, "SG buffer is not 8 byte aligned\n"); | |
| 1291 | 1307 | return -EFAULT; |
| 1292 | 1308 | } |
| 1293 | 1309 | |
| @@ -1300,23 +1316,21 @@ static int mtip_exec_internal_command(struct mtip_port *port, · 6 unmodified lines | ||
| 1300 | 1316 | mdelay(100); |
| 1301 | 1317 | } while (time_before(jiffies, to)); |
| 1302 | 1318 | if (!ready2go) { |
| 1303 | − dev_warn(&port->dd->pdev->dev, | |
| 1319 | + dev_warn(&dd->pdev->dev, | |
| 1304 | 1320 | "Internal cmd active. new cmd [%02X]\n", fis->command); |
| 1305 | 1321 | return -EBUSY; |
| 1306 | 1322 | } |
| 1307 | 1323 | set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); |
| 1308 | 1324 | port->ic_pause_timer = 0; |
| 1309 | 1325 | |
| 1310 | − if (fis->command == ATA_CMD_SEC_ERASE_UNIT) | |
| 1311 | − clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | |
| 1312 | − else if (fis->command == ATA_CMD_DOWNLOAD_MICRO) | |
| 1313 | − clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | |
| 1326 | + clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | |
| 1327 | + clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | |
| 1314 | 1328 | |
| 1315 | 1329 | if (atomic == GFP_KERNEL) { |
| 1316 | 1330 | if (fis->command != ATA_CMD_STANDBYNOW1) { |
| 1317 | 1331 | /* wait for io to complete if non atomic */ |
| 1318 | 1332 | if (mtip_quiesce_io(port, 5000) < 0) { |
| 1319 | − dev_warn(&port->dd->pdev->dev, | |
| 1333 | + dev_warn(&dd->pdev->dev, | |
| 1320 | 1334 | "Failed to quiesce IO\n"); |
| 1321 | 1335 | release_slot(port, MTIP_TAG_INTERNAL); |
| 1322 | 1336 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); |
| @@ -1361,58 +1375,84 @@ static int mtip_exec_internal_command(struct mtip_port *port, · 38 unmodified lines | ||
| 1361 | 1375 | /* Issue the command to the hardware */ |
| 1362 | 1376 | mtip_issue_non_ncq_command(port, MTIP_TAG_INTERNAL); |
| 1363 | 1377 | |
| 1364 | − /* Poll if atomic, wait_for_completion otherwise */ | |
| 1365 | 1378 | if (atomic == GFP_KERNEL) { |
| 1366 | 1379 | /* Wait for the command to complete or timeout. */ |
| 1367 | − if (wait_for_completion_timeout( | |
| 1380 | + if (wait_for_completion_interruptible_timeout( | |
| 1368 | 1381 | &wait, |
| 1369 | − msecs_to_jiffies(timeout)) == 0) { | |
| 1370 | − dev_err(&port->dd->pdev->dev, | |
| 1371 | − "Internal command did not complete [%d] " | |
| 1372 | − "within timeout of %lu ms\n", | |
| 1373 | − atomic, timeout); | |
| 1374 | − if (mtip_check_surprise_removal(port->dd->pdev) || | |
| 1382 | + msecs_to_jiffies(timeout)) <= 0) { | |
| 1383 | + if (rv == -ERESTARTSYS) { /* interrupted */ | |
| 1384 | + dev_err(&dd->pdev->dev, | |
| 1385 | + "Internal command [%02X] was interrupted after %lu ms\n", | |
| 1386 | + fis->command, timeout); | |
| 1387 | + rv = -EINTR; | |
| 1388 | + goto exec_ic_exit; | |
| 1389 | + } else if (rv == 0) /* timeout */ | |
| 1390 | + dev_err(&dd->pdev->dev, | |
| 1391 | + "Internal command did not complete [%02X] within timeout of %lu ms\n", | |
| 1392 | + fis->command, timeout); | |
| 1393 | + else | |
| 1394 | + dev_err(&dd->pdev->dev, | |
| 1395 | + "Internal command [%02X] wait returned code [%d] after %lu ms - unhandled\n", | |
| 1396 | + fis->command, rv, timeout); | |
| 1397 | + | |
| 1398 | + if (mtip_check_surprise_removal(dd->pdev) || | |
| 1375 | 1399 | test_bit(MTIP_DDF_REMOVE_PENDING_BIT, |
| 1376 | − &port->dd->dd_flag)) { | |
| 1400 | + &dd->dd_flag)) { | |
| 1401 | + dev_err(&dd->pdev->dev, | |
| 1402 | + "Internal command [%02X] wait returned due to SR\n", | |
| 1403 | + fis->command); | |
| 1377 | 1404 | rv = -ENXIO; |
| 1378 | 1405 | goto exec_ic_exit; |
| 1379 | 1406 | } |
| 1407 | + mtip_device_reset(dd); /* recover from timeout issue */ | |
| 1380 | 1408 | rv = -EAGAIN; |
| 1409 | + goto exec_ic_exit; | |
| 1381 | 1410 | } |
| 1382 | 1411 | } else { |
| 1412 | + u32 hba_stat, port_stat; | |
| 1413 | + | |
| 1383 | 1414 | /* Spin for <timeout> checking if command still outstanding */ |
| 1384 | 1415 | timeout = jiffies + msecs_to_jiffies(timeout); |
| 1385 | 1416 | while ((readl(port->cmd_issue[MTIP_TAG_INTERNAL]) |
| 1386 | 1417 | & (1 << MTIP_TAG_INTERNAL)) |
| 1387 | 1418 | && time_before(jiffies, timeout)) { |
| 1388 | − if (mtip_check_surprise_removal(port->dd->pdev)) { | |
| 1419 | + if (mtip_check_surprise_removal(dd->pdev)) { | |
| 1389 | 1420 | rv = -ENXIO; |
| 1390 | 1421 | goto exec_ic_exit; |
| 1391 | 1422 | } |
| 1392 | 1423 | if ((fis->command != ATA_CMD_STANDBYNOW1) && |
| 1393 | 1424 | test_bit(MTIP_DDF_REMOVE_PENDING_BIT, |
| 1394 | − &port->dd->dd_flag)) { | |
| 1425 | + &dd->dd_flag)) { | |
| 1395 | 1426 | rv = -ENXIO; |
| 1396 | 1427 | goto exec_ic_exit; |
| 1397 | 1428 | } |
| 1398 | − if (readl(port->mmio + PORT_IRQ_STAT) & PORT_IRQ_ERR) { | |
| 1399 | − atomic_inc(&int_cmd->active); /* error */ | |
| 1400 | − break; | |
| 1429 | + port_stat = readl(port->mmio + PORT_IRQ_STAT); | |
| 1430 | + if (!port_stat) | |
| 1431 | + continue; | |
| 1432 | + | |
| 1433 | + if (port_stat & PORT_IRQ_ERR) { | |
| 1434 | + dev_err(&dd->pdev->dev, | |
| 1435 | + "Internal command [%02X] failed\n", | |
| 1436 | + fis->command); | |
| 1437 | + mtip_device_reset(dd); | |
| 1438 | + rv = -EIO; | |
| 1439 | + goto exec_ic_exit; | |
| 1440 | + } else { | |
| 1441 | + writel(port_stat, port->mmio + PORT_IRQ_STAT); | |
| 1442 | + hba_stat = readl(dd->mmio + HOST_IRQ_STAT); | |
| 1443 | + if (hba_stat) | |
| 1444 | + writel(hba_stat, | |
| 1445 | + dd->mmio + HOST_IRQ_STAT); | |
| 1401 | 1446 | } |
| 1447 | + break; | |
| 1402 | 1448 | } |
| 1403 | 1449 | } |
| 1404 | 1450 | |
| 1405 | − if (atomic_read(&int_cmd->active) > 1) { | |
| 1406 | − dev_err(&port->dd->pdev->dev, | |
| 1407 | − "Internal command [%02X] failed\n", fis->command); | |
| 1408 | − rv = -EIO; | |
| 1409 | − } | |
| 1410 | 1451 | if (readl(port->cmd_issue[MTIP_TAG_INTERNAL]) |
| 1411 | 1452 | & (1 << MTIP_TAG_INTERNAL)) { |
| 1412 | 1453 | rv = -ENXIO; |
| 1413 | − if (!test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | |
| 1414 | − &port->dd->dd_flag)) { | |
| 1415 | − mtip_restart_port(port); | |
| 1454 | + if (!test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) { | |
| 1455 | + mtip_device_reset(dd); | |
| 1416 | 1456 | rv = -EAGAIN; |
| 1417 | 1457 | } |
| 1418 | 1458 | } |
| @@ -1724,7 +1764,8 @@ static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id, · 305 unmodified lines | ||
| 1724 | 1764 | * -EINVAL Invalid parameters passed in, trim not supported |
| 1725 | 1765 | * -EIO Error submitting trim request to hw |
| 1726 | 1766 | */ |
| 1727 | −static int mtip_send_trim(struct driver_data *dd, unsigned int lba, unsigned int len) | |
| 1767 | +static int mtip_send_trim(struct driver_data *dd, unsigned int lba, | |
| 1768 | + unsigned int len) | |
| 1728 | 1769 | { |
| 1729 | 1770 | int i, rv = 0; |
| 1730 | 1771 | u64 tlba, tlen, sect_left; |
| @@ -1810,45 +1851,6 @@ static bool mtip_hw_get_capacity(struct driver_data *dd, sector_t *sectors) · 79 unmodified lines | ||
| 1810 | 1851 | return (bool) !!port->identify_valid; |
| 1811 | 1852 | } |
| 1812 | 1853 | |
| 1813 | −/* | |
| 1814 | − * Reset the HBA. | |
| 1815 | − * | |
| 1816 | − * Resets the HBA by setting the HBA Reset bit in the Global | |
| 1817 | − * HBA Control register. After setting the HBA Reset bit the | |
| 1818 | − * function waits for 1 second before reading the HBA Reset | |
| 1819 | − * bit to make sure it has cleared. If HBA Reset is not clear | |
| 1820 | − * an error is returned. Cannot be used in non-blockable | |
| 1821 | − * context. | |
| 1822 | − * | |
| 1823 | − * @dd Pointer to the driver data structure. | |
| 1824 | − * | |
| 1825 | − * return value | |
| 1826 | − * 0 The reset was successful. | |
| 1827 | − * -1 The HBA Reset bit did not clear. | |
| 1828 | − */ | |
| 1829 | −static int mtip_hba_reset(struct driver_data *dd) | |
| 1830 | −{ | |
| 1831 | − mtip_deinit_port(dd->port); | |
| 1832 | − | |
| 1833 | − /* Set the reset bit */ | |
| 1834 | − writel(HOST_RESET, dd->mmio + HOST_CTL); | |
| 1835 | − | |
| 1836 | − /* Flush */ | |
| 1837 | − readl(dd->mmio + HOST_CTL); | |
| 1838 | − | |
| 1839 | − /* Wait for reset to clear */ | |
| 1840 | − ssleep(1); | |
| 1841 | − | |
| 1842 | − /* Check the bit has cleared */ | |
| 1843 | − if (readl(dd->mmio + HOST_CTL) & HOST_RESET) { | |
| 1844 | − dev_err(&dd->pdev->dev, | |
| 1845 | − "Reset bit did not clear.\n"); | |
| 1846 | − return -1; | |
| 1847 | − } | |
| 1848 | − | |
| 1849 | − return 0; | |
| 1850 | −} | |
| 1851 | − | |
| 1852 | 1854 | /* |
| 1853 | 1855 | * Display the identify command data. |
| 1854 | 1856 | * |
| @@ -2710,6 +2712,100 @@ static ssize_t mtip_hw_show_status(struct device *dev, · 855 unmodified lines | ||
| 2710 | 2712 | |
| 2711 | 2713 | static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); |
| 2712 | 2714 | |
| 2715 | +/* debugsfs entries */ | |
| 2716 | + | |
| 2717 | +static ssize_t show_device_status(struct device_driver *drv, char *buf) | |
| 2718 | +{ | |
| 2719 | + int size = 0; | |
| 2720 | + struct driver_data *dd, *tmp; | |
| 2721 | + unsigned long flags; | |
| 2722 | + char id_buf[42]; | |
| 2723 | + u16 status = 0; | |
| 2724 | + | |
| 2725 | + spin_lock_irqsave(&dev_lock, flags); | |
| 2726 | + size += sprintf(&buf[size], "Devices Present:\n"); | |
| 2727 | + list_for_each_entry_safe(dd, tmp, &online_list, online_list) { | |
| 2728 | + if (dd->pdev) { | |
| 2729 | + if (dd->port && | |
| 2730 | + dd->port->identify && | |
| 2731 | + dd->port->identify_valid) { | |
| 2732 | + strlcpy(id_buf, | |
| 2733 | + (char *) (dd->port->identify + 10), 21); | |
| 2734 | + status = *(dd->port->identify + 141); | |
| 2735 | + } else { | |
| 2736 | + memset(id_buf, 0, 42); | |
| 2737 | + status = 0; | |
| 2738 | + } | |
| 2739 | + | |
| 2740 | + if (dd->port && | |
| 2741 | + test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags)) { | |
| 2742 | + size += sprintf(&buf[size], | |
| 2743 | + " device %s %s (ftl rebuild %d %%)\n", | |
| 2744 | + dev_name(&dd->pdev->dev), | |
| 2745 | + id_buf, | |
| 2746 | + status); | |
| 2747 | + } else { | |
| 2748 | + size += sprintf(&buf[size], | |
| 2749 | + " device %s %s\n", | |
| 2750 | + dev_name(&dd->pdev->dev), | |
| 2751 | + id_buf); | |
| 2752 | + } | |
| 2753 | + } | |
| 2754 | + } | |
| 2755 | + | |
| 2756 | + size += sprintf(&buf[size], "Devices Being Removed:\n"); | |
| 2757 | + list_for_each_entry_safe(dd, tmp, &removing_list, remove_list) { | |
| 2758 | + if (dd->pdev) { | |
| 2759 | + if (dd->port && | |
| 2760 | + dd->port->identify && | |
| 2761 | + dd->port->identify_valid) { | |
| 2762 | + strlcpy(id_buf, | |
| 2763 | + (char *) (dd->port->identify+10), 21); | |
| 2764 | + status = *(dd->port->identify + 141); | |
| 2765 | + } else { | |
| 2766 | + memset(id_buf, 0, 42); | |
| 2767 | + status = 0; | |
| 2768 | + } | |
| 2769 | + | |
| 2770 | + if (dd->port && | |
| 2771 | + test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags)) { | |
| 2772 | + size += sprintf(&buf[size], | |
| 2773 | + " device %s %s (ftl rebuild %d %%)\n", | |
| 2774 | + dev_name(&dd->pdev->dev), | |
| 2775 | + id_buf, | |
| 2776 | + status); | |
| 2777 | + } else { | |
| 2778 | + size += sprintf(&buf[size], | |
| 2779 | + " device %s %s\n", | |
| 2780 | + dev_name(&dd->pdev->dev), | |
| 2781 | + id_buf); | |
| 2782 | + } | |
| 2783 | + } | |
| 2784 | + } | |
| 2785 | + spin_unlock_irqrestore(&dev_lock, flags); | |
| 2786 | + | |
| 2787 | + return size; | |
| 2788 | +} | |
| 2789 | + | |
| 2790 | +static ssize_t mtip_hw_read_device_status(struct file *f, char __user *ubuf, | |
| 2791 | + size_t len, loff_t *offset) | |
| 2792 | +{ | |
| 2793 | + int size = *offset; | |
| 2794 | + char buf[MTIP_DFS_MAX_BUF_SIZE]; | |
| 2795 | + | |
| 2796 | + if (!len || *offset) | |
| 2797 | + return 0; | |
| 2798 | + | |
| 2799 | + size += show_device_status(NULL, buf); | |
| 2800 | + | |
| 2801 | + *offset = size <= len ? size : len; | |
| 2802 | + size = copy_to_user(ubuf, buf, *offset); | |
| 2803 | + if (size) | |
| 2804 | + return -EFAULT; | |
| 2805 | + | |
| 2806 | + return *offset; | |
| 2807 | +} | |
| 2808 | + | |
| 2713 | 2809 | static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf, |
| 2714 | 2810 | size_t len, loff_t *offset) |
| 2715 | 2811 | { |
| @@ -2804,6 +2900,13 @@ static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf, · 88 unmodified lines | ||
| 2804 | 2900 | return *offset; |
| 2805 | 2901 | } |
| 2806 | 2902 | |
| 2903 | +static const struct file_operations mtip_device_status_fops = { | |
| 2904 | + .owner = THIS_MODULE, | |
| 2905 | + .open = simple_open, | |
| 2906 | + .read = mtip_hw_read_device_status, | |
| 2907 | + .llseek = no_llseek, | |
| 2908 | +}; | |
| 2909 | + | |
| 2807 | 2910 | static const struct file_operations mtip_regs_fops = { |
| 2808 | 2911 | .owner = THIS_MODULE, |
| 2809 | 2912 | .open = simple_open, |
| @@ -4161,6 +4264,7 @@ static int mtip_pci_probe(struct pci_dev *pdev, · 1351 unmodified lines | ||
| 4161 | 4264 | const struct cpumask *node_mask; |
| 4162 | 4265 | int cpu, i = 0, j = 0; |
| 4163 | 4266 | int my_node = NUMA_NO_NODE; |
| 4267 | + unsigned long flags; | |
| 4164 | 4268 | |
| 4165 | 4269 | /* Allocate memory for this devices private data. */ |
| 4166 | 4270 | my_node = pcibus_to_node(pdev->bus); |
| @@ -4218,6 +4322,9 @@ static int mtip_pci_probe(struct pci_dev *pdev, · 51 unmodified lines | ||
| 4218 | 4322 | dd->pdev = pdev; |
| 4219 | 4323 | dd->numa_node = my_node; |
| 4220 | 4324 | |
| 4325 | + INIT_LIST_HEAD(&dd->online_list); | |
| 4326 | + INIT_LIST_HEAD(&dd->remove_list); | |
| 4327 | + | |
| 4221 | 4328 | memset(dd->workq_name, 0, 32); |
| 4222 | 4329 | snprintf(dd->workq_name, 31, "mtipq%d", dd->instance); |
| 4223 | 4330 | |
| @@ -4305,6 +4412,14 @@ static int mtip_pci_probe(struct pci_dev *pdev, · 81 unmodified lines | ||
| 4305 | 4412 | instance++; |
| 4306 | 4413 | if (rv != MTIP_FTL_REBUILD_MAGIC) |
| 4307 | 4414 | set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); |
| 4415 | + else | |
| 4416 | + rv = 0; /* device in rebuild state, return 0 from probe */ | |
| 4417 | + | |
| 4418 | + /* Add to online list even if in ftl rebuild */ | |
| 4419 | + spin_lock_irqsave(&dev_lock, flags); | |
| 4420 | + list_add(&dd->online_list, &online_list); | |
| 4421 | + spin_unlock_irqrestore(&dev_lock, flags); | |
| 4422 | + | |
| 4308 | 4423 | goto done; |
| 4309 | 4424 | |
| 4310 | 4425 | block_initialize_err: |
| @@ -4338,9 +4453,15 @@ static void mtip_pci_remove(struct pci_dev *pdev) · 27 unmodified lines | ||
| 4338 | 4453 | { |
| 4339 | 4454 | struct driver_data *dd = pci_get_drvdata(pdev); |
| 4340 | 4455 | int counter = 0; |
| 4456 | + unsigned long flags; | |
| 4341 | 4457 | |
| 4342 | 4458 | set_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag); |
| 4343 | 4459 | |
| 4460 | + spin_lock_irqsave(&dev_lock, flags); | |
| 4461 | + list_del_init(&dd->online_list); | |
| 4462 | + list_add(&dd->remove_list, &removing_list); | |
| 4463 | + spin_unlock_irqrestore(&dev_lock, flags); | |
| 4464 | + | |
| 4344 | 4465 | if (mtip_check_surprise_removal(pdev)) { |
| 4345 | 4466 | while (!test_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag)) { |
| 4346 | 4467 | counter++; |
| @@ -4366,6 +4487,10 @@ static void mtip_pci_remove(struct pci_dev *pdev) · 19 unmodified lines | ||
| 4366 | 4487 | |
| 4367 | 4488 | pci_disable_msi(pdev); |
| 4368 | 4489 | |
| 4490 | + spin_lock_irqsave(&dev_lock, flags); | |
| 4491 | + list_del_init(&dd->remove_list); | |
| 4492 | + spin_unlock_irqrestore(&dev_lock, flags); | |
| 4493 | + | |
| 4369 | 4494 | kfree(dd); |
| 4370 | 4495 | pcim_iounmap_regions(pdev, 1 << MTIP_ABAR); |
| 4371 | 4496 | } |
| @@ -4513,6 +4638,11 @@ static int __init mtip_init(void) · 141 unmodified lines | ||
| 4513 | 4638 | |
| 4514 | 4639 | pr_info(MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); |
| 4515 | 4640 | |
| 4641 | + spin_lock_init(&dev_lock); | |
| 4642 | + | |
| 4643 | + INIT_LIST_HEAD(&online_list); | |
| 4644 | + INIT_LIST_HEAD(&removing_list); | |
| 4645 | + | |
| 4516 | 4646 | /* Allocate a major block device number to use with this driver. */ |
| 4517 | 4647 | error = register_blkdev(0, MTIP_DRV_NAME); |
| 4518 | 4648 | if (error <= 0) { |
| @@ -4522,11 +4652,18 @@ static int __init mtip_init(void) · 3 unmodified lines | ||
| 4522 | 4652 | } |
| 4523 | 4653 | mtip_major = error; |
| 4524 | 4654 | |
| 4525 | − if (!dfs_parent) { | |
| 4526 | − dfs_parent = debugfs_create_dir("rssd", NULL); | |
| 4527 | − if (IS_ERR_OR_NULL(dfs_parent)) { | |
| 4528 | − pr_warn("Error creating debugfs parent\n"); | |
| 4529 | − dfs_parent = NULL; | |
| 4655 | + dfs_parent = debugfs_create_dir("rssd", NULL); | |
| 4656 | + if (IS_ERR_OR_NULL(dfs_parent)) { | |
| 4657 | + pr_warn("Error creating debugfs parent\n"); | |
| 4658 | + dfs_parent = NULL; | |
| 4659 | + } | |
| 4660 | + if (dfs_parent) { | |
| 4661 | + dfs_device_status = debugfs_create_file("device_status", | |
| 4662 | + S_IRUGO, dfs_parent, NULL, | |
| 4663 | + &mtip_device_status_fops); | |
| 4664 | + if (IS_ERR_OR_NULL(dfs_device_status)) { | |
| 4665 | + pr_err("Error creating device_status node\n"); | |
| 4666 | + dfs_device_status = NULL; | |
| 4530 | 4667 | } |
| 4531 | 4668 | } |
| 4532 | 4669 | |
| @@ -129,9 +129,9 @@ enum { · 128 unmodified lines | ||
| 129 | 129 | MTIP_PF_EH_ACTIVE_BIT = 1, /* error handling */ |
| 130 | 130 | MTIP_PF_SE_ACTIVE_BIT = 2, /* secure erase */ |
| 131 | 131 | MTIP_PF_DM_ACTIVE_BIT = 3, /* download microcde */ |
| 132 | − MTIP_PF_PAUSE_IO = ((1 << MTIP_PF_IC_ACTIVE_BIT) | \ | |
| 133 | − (1 << MTIP_PF_EH_ACTIVE_BIT) | \ | |
| 134 | − (1 << MTIP_PF_SE_ACTIVE_BIT) | \ | |
| 132 | + MTIP_PF_PAUSE_IO = ((1 << MTIP_PF_IC_ACTIVE_BIT) | | |
| 133 | + (1 << MTIP_PF_EH_ACTIVE_BIT) | | |
| 134 | + (1 << MTIP_PF_SE_ACTIVE_BIT) | | |
| 135 | 135 | (1 << MTIP_PF_DM_ACTIVE_BIT)), |
| 136 | 136 | |
| 137 | 137 | MTIP_PF_SVC_THD_ACTIVE_BIT = 4, |
| @@ -144,9 +144,9 @@ enum { · 6 unmodified lines | ||
| 144 | 144 | MTIP_DDF_REMOVE_PENDING_BIT = 1, |
| 145 | 145 | MTIP_DDF_OVER_TEMP_BIT = 2, |
| 146 | 146 | MTIP_DDF_WRITE_PROTECT_BIT = 3, |
| 147 | − MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \ | |
| 148 | − (1 << MTIP_DDF_SEC_LOCK_BIT) | \ | |
| 149 | − (1 << MTIP_DDF_OVER_TEMP_BIT) | \ | |
| 147 | + MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | | |
| 148 | + (1 << MTIP_DDF_SEC_LOCK_BIT) | | |
| 149 | + (1 << MTIP_DDF_OVER_TEMP_BIT) | | |
| 150 | 150 | (1 << MTIP_DDF_WRITE_PROTECT_BIT)), |
| 151 | 151 | |
| 152 | 152 | MTIP_DDF_CLEANUP_BIT = 5, |
| @@ -180,7 +180,7 @@ struct mtip_work { · 27 unmodified lines | ||
| 180 | 180 | |
| 181 | 181 | #define MTIP_TRIM_TIMEOUT_MS 240000 |
| 182 | 182 | #define MTIP_MAX_TRIM_ENTRIES 8 |
| 183 | −#define MTIP_MAX_TRIM_ENTRY_LEN 0xfff8 | |
| 183 | +#define MTIP_MAX_TRIM_ENTRY_LEN 0xfff8 | |
| 184 | 184 | |
| 185 | 185 | struct mtip_trim_entry { |
| 186 | 186 | u32 lba; /* starting lba of region */ |
| @@ -501,6 +501,10 @@ struct driver_data { · 314 unmodified lines | ||
| 501 | 501 | atomic_t irq_workers_active; |
| 502 | 502 | |
| 503 | 503 | int isr_binding; |
| 504 | + | |
| 505 | + struct list_head online_list; /* linkage for online list */ | |
| 506 | + | |
| 507 | + struct list_head remove_list; /* linkage for removing list */ | |
| 504 | 508 | }; |
| 505 | 509 | |
| 506 | 510 | #endif |
| @@ -1742,9 +1742,10 @@ static int rbd_img_request_submit(struct rbd_img_request *img_request) · 1741 unmodified lines | ||
| 1742 | 1742 | struct rbd_device *rbd_dev = img_request->rbd_dev; |
| 1743 | 1743 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; |
| 1744 | 1744 | struct rbd_obj_request *obj_request; |
| 1745 | + struct rbd_obj_request *next_obj_request; | |
| 1745 | 1746 | |
| 1746 | 1747 | dout("%s: img %p\n", __func__, img_request); |
| 1747 | − for_each_obj_request(img_request, obj_request) { | |
| 1748 | + for_each_obj_request_safe(img_request, obj_request, next_obj_request) { | |
| 1748 | 1749 | int ret; |
| 1749 | 1750 | |
| 1750 | 1751 | obj_request->callback = rbd_img_obj_callback; |
| @@ -373,26 +373,14 @@ static int hpet_mmap(struct file *file, struct vm_area_struct *vma) · 372 unmodified lines | ||
| 373 | 373 | struct hpet_dev *devp; |
| 374 | 374 | unsigned long addr; |
| 375 | 375 | |
| 376 | − if (((vma->vm_end - vma->vm_start) != PAGE_SIZE) || vma->vm_pgoff) | |
| 377 | − return -EINVAL; | |
| 378 | − | |
| 379 | 376 | devp = file->private_data; |
| 380 | 377 | addr = devp->hd_hpets->hp_hpet_phys; |
| 381 | 378 | |
| 382 | 379 | if (addr & (PAGE_SIZE - 1)) |
| 383 | 380 | return -ENOSYS; |
| 384 | 381 | |
| 385 | − vma->vm_flags |= VM_IO; | |
| 386 | 382 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
| 387 | − | |
| 388 | − if (io_remap_pfn_range(vma, vma->vm_start, addr >> PAGE_SHIFT, | |
| 389 | − PAGE_SIZE, vma->vm_page_prot)) { | |
| 390 | − printk(KERN_ERR "%s: io_remap_pfn_range failed\n", | |
| 391 | − __func__); | |
| 392 | − return -EAGAIN; | |
| 393 | − } | |
| 394 | − | |
| 395 | − return 0; | |
| 383 | + return vm_iomap_memory(vma, addr, PAGE_SIZE); | |
| 396 | 384 | #else |
| 397 | 385 | return -ENOSYS; |
| 398 | 386 | #endif |
| @@ -502,7 +502,6 @@ static inline void intel_pstate_set_sample_time(struct cpudata *cpu) · 501 unmodified lines | ||
| 502 | 502 | |
| 503 | 503 | sample_time = cpu->pstate_policy->sample_rate_ms; |
| 504 | 504 | delay = msecs_to_jiffies(sample_time); |
| 505 | − delay -= jiffies % delay; | |
| 506 | 505 | mod_timer_pinned(&cpu->timer, jiffies + delay); |
| 507 | 506 | } |
| 508 | 507 | |
| @@ -1750,7 +1750,7 @@ static struct platform_driver cryp_driver = { · 1749 unmodified lines | ||
| 1750 | 1750 | .shutdown = ux500_cryp_shutdown, |
| 1751 | 1751 | .driver = { |
| 1752 | 1752 | .owner = THIS_MODULE, |
| 1753 | − .name = "cryp1" | |
| 1753 | + .name = "cryp1", | |
| 1754 | 1754 | .pm = &ux500_cryp_pm, |
| 1755 | 1755 | } |
| 1756 | 1756 | }; |
| @@ -310,8 +310,6 @@ static void atc_complete_all(struct at_dma_chan *atchan) · 309 unmodified lines | ||
| 310 | 310 | |
| 311 | 311 | dev_vdbg(chan2dev(&atchan->chan_common), "complete all\n"); |
| 312 | 312 | |
| 313 | − BUG_ON(atc_chan_is_enabled(atchan)); | |
| 314 | − | |
| 315 | 313 | /* |
| 316 | 314 | * Submit queued descriptors ASAP, i.e. before we go through |
| 317 | 315 | * the completed ones. |
| @@ -368,6 +366,9 @@ static void atc_advance_work(struct at_dma_chan *atchan) · 50 unmodified lines | ||
| 368 | 366 | { |
| 369 | 367 | dev_vdbg(chan2dev(&atchan->chan_common), "advance_work\n"); |
| 370 | 368 | |
| 369 | + if (atc_chan_is_enabled(atchan)) | |
| 370 | + return; | |
| 371 | + | |
| 371 | 372 | if (list_empty(&atchan->active_list) || |
| 372 | 373 | list_is_singular(&atchan->active_list)) { |
| 373 | 374 | atc_complete_all(atchan); |
| @@ -1078,9 +1079,7 @@ static void atc_issue_pending(struct dma_chan *chan) · 704 unmodified lines | ||
| 1078 | 1079 | return; |
| 1079 | 1080 | |
| 1080 | 1081 | spin_lock_irqsave(&atchan->lock, flags); |
| 1081 | − if (!atc_chan_is_enabled(atchan)) { | |
| 1082 | − atc_advance_work(atchan); | |
| 1083 | − } | |
| 1082 | + atc_advance_work(atchan); | |
| 1084 | 1083 | spin_unlock_irqrestore(&atchan->lock, flags); |
| 1085 | 1084 | } |
| 1086 | 1085 | |
| @@ -276,12 +276,20 @@ static void omap_dma_issue_pending(struct dma_chan *chan) · 275 unmodified lines | ||
| 276 | 276 | |
| 277 | 277 | spin_lock_irqsave(&c->vc.lock, flags); |
| 278 | 278 | if (vchan_issue_pending(&c->vc) && !c->desc) { |
| 279 | − struct omap_dmadev *d = to_omap_dma_dev(chan->device); | |
| 280 | − spin_lock(&d->lock); | |
| 281 | − if (list_empty(&c->node)) | |
| 282 | − list_add_tail(&c->node, &d->pending); | |
| 283 | − spin_unlock(&d->lock); | |
| 284 | − tasklet_schedule(&d->task); | |
| 279 | + /* | |
| 280 | + * c->cyclic is used only by audio and in this case the DMA need | |
| 281 | + * to be started without delay. | |
| 282 | + */ | |
| 283 | + if (!c->cyclic) { | |
| 284 | + struct omap_dmadev *d = to_omap_dma_dev(chan->device); | |
| 285 | + spin_lock(&d->lock); | |
| 286 | + if (list_empty(&c->node)) | |
| 287 | + list_add_tail(&c->node, &d->pending); | |
| 288 | + spin_unlock(&d->lock); | |
| 289 | + tasklet_schedule(&d->task); | |
| 290 | + } else { | |
| 291 | + omap_dma_start_desc(c); | |
| 292 | + } | |
| 285 | 293 | } |
| 286 | 294 | spin_unlock_irqrestore(&c->vc.lock, flags); |
| 287 | 295 | } |
| @@ -2882,7 +2882,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) · 2881 unmodified lines | ||
| 2882 | 2882 | { |
| 2883 | 2883 | struct dma_pl330_platdata *pdat; |
| 2884 | 2884 | struct dma_pl330_dmac *pdmac; |
| 2885 | − struct dma_pl330_chan *pch; | |
| 2885 | + struct dma_pl330_chan *pch, *_p; | |
| 2886 | 2886 | struct pl330_info *pi; |
| 2887 | 2887 | struct dma_device *pd; |
| 2888 | 2888 | struct resource *res; |
| @@ -2984,7 +2984,16 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) · 95 unmodified lines | ||
| 2984 | 2984 | ret = dma_async_device_register(pd); |
| 2985 | 2985 | if (ret) { |
| 2986 | 2986 | dev_err(&adev->dev, "unable to register DMAC\n"); |
| 2987 | − goto probe_err2; | |
| 2987 | + goto probe_err3; | |
| 2988 | + } | |
| 2989 | + | |
| 2990 | + if (adev->dev.of_node) { | |
| 2991 | + ret = of_dma_controller_register(adev->dev.of_node, | |
| 2992 | + of_dma_pl330_xlate, pdmac); | |
| 2993 | + if (ret) { | |
| 2994 | + dev_err(&adev->dev, | |
| 2995 | + "unable to register DMA to the generic DT DMA helpers\n"); | |
| 2996 | + } | |
| 2988 | 2997 | } |
| 2989 | 2998 | |
| 2990 | 2999 | dev_info(&adev->dev, |
| @@ -2995,16 +3004,21 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) · 4 unmodified lines | ||
| 2995 | 3004 | pi->pcfg.data_bus_width / 8, pi->pcfg.num_chan, |
| 2996 | 3005 | pi->pcfg.num_peri, pi->pcfg.num_events); |
| 2997 | 3006 | |
| 2998 | − ret = of_dma_controller_register(adev->dev.of_node, | |
| 2999 | − of_dma_pl330_xlate, pdmac); | |
| 3000 | − if (ret) { | |
| 3001 | − dev_err(&adev->dev, | |
| 3002 | − "unable to register DMA to the generic DT DMA helpers\n"); | |
| 3003 | − goto probe_err2; | |
| 3004 | − } | |
| 3005 | − | |
| 3006 | 3007 | return 0; |
| 3008 | +probe_err3: | |
| 3009 | + amba_set_drvdata(adev, NULL); | |
| 3007 | 3010 | |
| 3011 | + /* Idle the DMAC */ | |
| 3012 | + list_for_each_entry_safe(pch, _p, &pdmac->ddma.channels, | |
| 3013 | + chan.device_node) { | |
| 3014 | + | |
| 3015 | + /* Remove the channel */ | |
| 3016 | + list_del(&pch->chan.device_node); | |
| 3017 | + | |
| 3018 | + /* Flush the channel */ | |
| 3019 | + pl330_control(&pch->chan, DMA_TERMINATE_ALL, 0); | |
| 3020 | + pl330_free_chan_resources(&pch->chan); | |
| 3021 | + } | |
| 3008 | 3022 | probe_err2: |
| 3009 | 3023 | pl330_del(pi); |
| 3010 | 3024 | probe_err1: |
| @@ -3023,8 +3037,10 @@ static int pl330_remove(struct amba_device *adev) · 12 unmodified lines | ||
| 3023 | 3037 | if (!pdmac) |
| 3024 | 3038 | return 0; |
| 3025 | 3039 | |
| 3026 | − of_dma_controller_free(adev->dev.of_node); | |
| 3040 | + if (adev->dev.of_node) | |
| 3041 | + of_dma_controller_free(adev->dev.of_node); | |
| 3027 | 3042 | |
| 3043 | + dma_async_device_unregister(&pdmac->ddma); | |
| 3028 | 3044 | amba_set_drvdata(adev, NULL); |
| 3029 | 3045 | |
| 3030 | 3046 | /* Idle the DMAC */ |
| @@ -19,10 +19,10 @@ · 18 unmodified lines | ||
| 19 | 19 | /* There is only *one* pci_eisa device per machine, right ? */ |
| 20 | 20 | static struct eisa_root_device pci_eisa_root; |
| 21 | 21 | |
| 22 | −static int __init pci_eisa_init(struct pci_dev *pdev, | |
| 23 | − const struct pci_device_id *ent) | |
| 22 | +static int __init pci_eisa_init(struct pci_dev *pdev) | |
| 24 | 23 | { |
| 25 | − int rc; | |
| 24 | + int rc, i; | |
| 25 | + struct resource *res, *bus_res = NULL; | |
| 26 | 26 | |
| 27 | 27 | if ((rc = pci_enable_device (pdev))) { |
| 28 | 28 | printk (KERN_ERR "pci_eisa : Could not enable device %s\n", |
| @@ -30,9 +30,30 @@ static int __init pci_eisa_init(struct pci_dev *pdev, · 1 unmodified line | ||
| 30 | 30 | return rc; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | + /* | |
| 34 | + * The Intel 82375 PCI-EISA bridge is a subtractive-decode PCI | |
| 35 | + * device, so the resources available on EISA are the same as those | |
| 36 | + * available on the 82375 bus. This works the same as a PCI-PCI | |
| 37 | + * bridge in subtractive-decode mode (see pci_read_bridge_bases()). | |
| 38 | + * We assume other PCI-EISA bridges are similar. | |
| 39 | + * | |
| 40 | + * eisa_root_register() can only deal with a single io port resource, | |
| 41 | + * so we use the first valid io port resource. | |
| 42 | + */ | |
| 43 | + pci_bus_for_each_resource(pdev->bus, res, i) | |
| 44 | + if (res && (res->flags & IORESOURCE_IO)) { | |
| 45 | + bus_res = res; | |
| 46 | + break; | |
| 47 | + } | |
| 48 | + | |
| 49 | + if (!bus_res) { | |
| 50 | + dev_err(&pdev->dev, "No resources available\n"); | |
| 51 | + return -1; | |
| 52 | + } | |
| 53 | + | |
| 33 | 54 | pci_eisa_root.dev = &pdev->dev; |
| 34 | − pci_eisa_root.res = pdev->bus->resource[0]; | |
| 35 | − pci_eisa_root.bus_base_addr = pdev->bus->resource[0]->start; | |
| 55 | + pci_eisa_root.res = bus_res; | |
| 56 | + pci_eisa_root.bus_base_addr = bus_res->start; | |
| 36 | 57 | pci_eisa_root.slots = EISA_MAX_SLOTS; |
| 37 | 58 | pci_eisa_root.dma_mask = pdev->dma_mask; |
| 38 | 59 | dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root); |
| @@ -45,22 +66,26 @@ static int __init pci_eisa_init(struct pci_dev *pdev, · 6 unmodified lines | ||
| 45 | 66 | return 0; |
| 46 | 67 | } |
| 47 | 68 | |
| 48 | −static struct pci_device_id pci_eisa_pci_tbl[] = { | |
| 49 | − { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | |
| 50 | − PCI_CLASS_BRIDGE_EISA << 8, 0xffff00, 0 }, | |
| 51 | − { 0, } | |
| 52 | −}; | |
| 69 | +/* | |
| 70 | + * We have to call pci_eisa_init_early() before pnpacpi_init()/isapnp_init(). | |
| 71 | + * Otherwise pnp resource will get enabled early and could prevent eisa | |
| 72 | + * to be initialized. | |
| 73 | + * Also need to make sure pci_eisa_init_early() is called after | |
| 74 | + * x86/pci_subsys_init(). | |
| 75 | + * So need to use subsys_initcall_sync with it. | |
| 76 | + */ | |
| 77 | +static int __init pci_eisa_init_early(void) | |
| 78 | +{ | |
| 79 | + struct pci_dev *dev = NULL; | |
| 80 | + int ret; | |
| 53 | 81 | |
| 54 | −static struct pci_driver __refdata pci_eisa_driver = { | |
| 55 | − .name = "pci_eisa", | |
| 56 | − .id_table = pci_eisa_pci_tbl, | |
| 57 | − .probe = pci_eisa_init, | |
| 58 | −}; | |
| 82 | + for_each_pci_dev(dev) | |
| 83 | + if ((dev->class >> 8) == PCI_CLASS_BRIDGE_EISA) { | |
| 84 | + ret = pci_eisa_init(dev); | |
| 85 | + if (ret) | |
| 86 | + return ret; | |
| 87 | + } | |
| 59 | 88 | |
| 60 | −static int __init pci_eisa_init_module (void) | |
| 61 | −{ | |
| 62 | − return pci_register_driver (&pci_eisa_driver); | |
| 89 | + return 0; | |
| 63 | 90 | } |
| 64 | − | |
| 65 | −device_initcall(pci_eisa_init_module); | |
| 66 | −MODULE_DEVICE_TABLE(pci, pci_eisa_pci_tbl); | |
| 91 | +subsys_initcall_sync(pci_eisa_init_early); | |
| @@ -39,6 +39,7 @@ config FIRMWARE_MEMMAP · 38 unmodified lines | ||
| 39 | 39 | config EFI_VARS |
| 40 | 40 | tristate "EFI Variable Support via sysfs" |
| 41 | 41 | depends on EFI |
| 42 | + select UCS2_STRING | |
| 42 | 43 | default n |
| 43 | 44 | help |
| 44 | 45 | If you say Y here, you are able to get EFI (Extensible Firmware |
| @@ -80,6 +80,7 @@ · 79 unmodified lines | ||
| 80 | 80 | #include <linux/slab.h> |
| 81 | 81 | #include <linux/pstore.h> |
| 82 | 82 | #include <linux/ctype.h> |
| 83 | +#include <linux/ucs2_string.h> | |
| 83 | 84 | |
| 84 | 85 | #include <linux/fs.h> |
| 85 | 86 | #include <linux/ramfs.h> |
| @@ -172,51 +173,6 @@ static void efivar_update_sysfs_entries(struct work_struct *); · 86 unmodified lines | ||
| 172 | 173 | static DECLARE_WORK(efivar_work, efivar_update_sysfs_entries); |
| 173 | 174 | static bool efivar_wq_enabled = true; |
| 174 | 175 | |
| 175 | −/* Return the number of unicode characters in data */ | |
| 176 | −static unsigned long | |
| 177 | −utf16_strnlen(efi_char16_t *s, size_t maxlength) | |
| 178 | −{ | |
| 179 | − unsigned long length = 0; | |
| 180 | − | |
| 181 | − while (*s++ != 0 && length < maxlength) | |
| 182 | − length++; | |
| 183 | − return length; | |
| 184 | −} | |
| 185 | − | |
| 186 | −static inline unsigned long | |
| 187 | −utf16_strlen(efi_char16_t *s) | |
| 188 | −{ | |
| 189 | − return utf16_strnlen(s, ~0UL); | |
| 190 | −} | |
| 191 | − | |
| 192 | −/* | |
| 193 | − * Return the number of bytes is the length of this string | |
| 194 | − * Note: this is NOT the same as the number of unicode characters | |
| 195 | − */ | |
| 196 | −static inline unsigned long | |
| 197 | −utf16_strsize(efi_char16_t *data, unsigned long maxlength) | |
| 198 | −{ | |
| 199 | − return utf16_strnlen(data, maxlength/sizeof(efi_char16_t)) * sizeof(efi_char16_t); | |
| 200 | −} | |
| 201 | − | |
| 202 | −static inline int | |
| 203 | −utf16_strncmp(const efi_char16_t *a, const efi_char16_t *b, size_t len) | |
| 204 | −{ | |
| 205 | − while (1) { | |
| 206 | − if (len == 0) | |
| 207 | − return 0; | |
| 208 | − if (*a < *b) | |
| 209 | − return -1; | |
| 210 | − if (*a > *b) | |
| 211 | − return 1; | |
| 212 | − if (*a == 0) /* implies *b == 0 */ | |
| 213 | − return 0; | |
| 214 | − a++; | |
| 215 | − b++; | |
| 216 | − len--; | |
| 217 | − } | |
| 218 | −} | |
| 219 | − | |
| 220 | 176 | static bool |
| 221 | 177 | validate_device_path(struct efi_variable *var, int match, u8 *buffer, |
| 222 | 178 | unsigned long len) |
| @@ -268,7 +224,7 @@ validate_load_option(struct efi_variable *var, int match, u8 *buffer, · 45 unmodified lines | ||
| 268 | 224 | u16 filepathlength; |
| 269 | 225 | int i, desclength = 0, namelen; |
| 270 | 226 | |
| 271 | − namelen = utf16_strnlen(var->VariableName, sizeof(var->VariableName)); | |
| 227 | + namelen = ucs2_strnlen(var->VariableName, sizeof(var->VariableName)); | |
| 272 | 228 | |
| 273 | 229 | /* Either "Boot" or "Driver" followed by four digits of hex */ |
| 274 | 230 | for (i = match; i < match+4; i++) { |
| @@ -291,7 +247,7 @@ validate_load_option(struct efi_variable *var, int match, u8 *buffer, · 16 unmodified lines | ||
| 291 | 247 | * There's no stored length for the description, so it has to be |
| 292 | 248 | * found by hand |
| 293 | 249 | */ |
| 294 | − desclength = utf16_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2; | |
| 250 | + desclength = ucs2_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2; | |
| 295 | 251 | |
| 296 | 252 | /* Each boot entry must have a descriptor */ |
| 297 | 253 | if (!desclength) |
| @@ -436,24 +392,12 @@ static efi_status_t · 138 unmodified lines | ||
| 436 | 392 | check_var_size_locked(struct efivars *efivars, u32 attributes, |
| 437 | 393 | unsigned long size) |
| 438 | 394 | { |
| 439 | − u64 storage_size, remaining_size, max_size; | |
| 440 | − efi_status_t status; | |
| 441 | 395 | const struct efivar_operations *fops = efivars->ops; |
| 442 | 396 | |
| 443 | − if (!efivars->ops->query_variable_info) | |
| 397 | + if (!efivars->ops->query_variable_store) | |
| 444 | 398 | return EFI_UNSUPPORTED; |
| 445 | 399 | |
| 446 | − status = fops->query_variable_info(attributes, &storage_size, | |
| 447 | − &remaining_size, &max_size); | |
| 448 | − | |
| 449 | − if (status != EFI_SUCCESS) | |
| 450 | − return status; | |
| 451 | − | |
| 452 | − if (!storage_size || size > remaining_size || size > max_size || | |
| 453 | − (remaining_size - size) < (storage_size / 2)) | |
| 454 | − return EFI_OUT_OF_RESOURCES; | |
| 455 | − | |
| 456 | − return status; | |
| 400 | + return fops->query_variable_store(attributes, size); | |
| 457 | 401 | } |
| 458 | 402 | |
| 459 | 403 | |
| @@ -593,7 +537,7 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count) · 133 unmodified lines | ||
| 593 | 537 | spin_lock_irq(&efivars->lock); |
| 594 | 538 | |
| 595 | 539 | status = check_var_size_locked(efivars, new_var->Attributes, |
| 596 | − new_var->DataSize + utf16_strsize(new_var->VariableName, 1024)); | |
| 540 | + new_var->DataSize + ucs2_strsize(new_var->VariableName, 1024)); | |
| 597 | 541 | |
| 598 | 542 | if (status == EFI_SUCCESS || status == EFI_UNSUPPORTED) |
| 599 | 543 | status = efivars->ops->set_variable(new_var->VariableName, |
| @@ -771,7 +715,7 @@ static ssize_t efivarfs_file_write(struct file *file, · 171 unmodified lines | ||
| 771 | 715 | * QueryVariableInfo() isn't supported by the firmware. |
| 772 | 716 | */ |
| 773 | 717 | |
| 774 | − varsize = datasize + utf16_strsize(var->var.VariableName, 1024); | |
| 718 | + varsize = datasize + ucs2_strsize(var->var.VariableName, 1024); | |
| 775 | 719 | status = check_var_size(efivars, attributes, varsize); |
| 776 | 720 | |
| 777 | 721 | if (status != EFI_SUCCESS) { |
| @@ -1223,7 +1167,7 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) · 445 unmodified lines | ||
| 1223 | 1167 | |
| 1224 | 1168 | inode = NULL; |
| 1225 | 1169 | |
| 1226 | − len = utf16_strlen(entry->var.VariableName); | |
| 1170 | + len = ucs2_strlen(entry->var.VariableName); | |
| 1227 | 1171 | |
| 1228 | 1172 | /* name, plus '-', plus GUID, plus NUL*/ |
| 1229 | 1173 | name = kmalloc(len + 1 + GUID_LEN + 1, GFP_ATOMIC); |
| @@ -1481,8 +1425,8 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, · 251 unmodified lines | ||
| 1481 | 1425 | |
| 1482 | 1426 | if (efi_guidcmp(entry->var.VendorGuid, vendor)) |
| 1483 | 1427 | continue; |
| 1484 | − if (utf16_strncmp(entry->var.VariableName, efi_name, | |
| 1485 | − utf16_strlen(efi_name))) { | |
| 1428 | + if (ucs2_strncmp(entry->var.VariableName, efi_name, | |
| 1429 | + ucs2_strlen(efi_name))) { | |
| 1486 | 1430 | /* |
| 1487 | 1431 | * Check if an old format, |
| 1488 | 1432 | * which doesn't support holding |
| @@ -1494,8 +1438,8 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, · 5 unmodified lines | ||
| 1494 | 1438 | for (i = 0; i < DUMP_NAME_LEN; i++) |
| 1495 | 1439 | efi_name_old[i] = name_old[i]; |
| 1496 | 1440 | |
| 1497 | − if (utf16_strncmp(entry->var.VariableName, efi_name_old, | |
| 1498 | − utf16_strlen(efi_name_old))) | |
| 1441 | + if (ucs2_strncmp(entry->var.VariableName, efi_name_old, | |
| 1442 | + ucs2_strlen(efi_name_old))) | |
| 1499 | 1443 | continue; |
| 1500 | 1444 | } |
| 1501 | 1445 | |
| @@ -1573,8 +1517,8 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, · 71 unmodified lines | ||
| 1573 | 1517 | * Does this variable already exist? |
| 1574 | 1518 | */ |
| 1575 | 1519 | list_for_each_entry_safe(search_efivar, n, &efivars->list, list) { |
| 1576 | − strsize1 = utf16_strsize(search_efivar->var.VariableName, 1024); | |
| 1577 | − strsize2 = utf16_strsize(new_var->VariableName, 1024); | |
| 1520 | + strsize1 = ucs2_strsize(search_efivar->var.VariableName, 1024); | |
| 1521 | + strsize2 = ucs2_strsize(new_var->VariableName, 1024); | |
| 1578 | 1522 | if (strsize1 == strsize2 && |
| 1579 | 1523 | !memcmp(&(search_efivar->var.VariableName), |
| 1580 | 1524 | new_var->VariableName, strsize1) && |
| @@ -1590,7 +1534,7 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, · 9 unmodified lines | ||
| 1590 | 1534 | } |
| 1591 | 1535 | |
| 1592 | 1536 | status = check_var_size_locked(efivars, new_var->Attributes, |
| 1593 | − new_var->DataSize + utf16_strsize(new_var->VariableName, 1024)); | |
| 1537 | + new_var->DataSize + ucs2_strsize(new_var->VariableName, 1024)); | |
| 1594 | 1538 | |
| 1595 | 1539 | if (status && status != EFI_UNSUPPORTED) { |
| 1596 | 1540 | spin_unlock_irq(&efivars->lock); |
| @@ -1614,7 +1558,7 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, · 17 unmodified lines | ||
| 1614 | 1558 | |
| 1615 | 1559 | /* Create the entry in sysfs. Locking is not required here */ |
| 1616 | 1560 | status = efivar_create_sysfs_entry(efivars, |
| 1617 | − utf16_strsize(new_var->VariableName, | |
| 1561 | + ucs2_strsize(new_var->VariableName, | |
| 1618 | 1562 | 1024), |
| 1619 | 1563 | new_var->VariableName, |
| 1620 | 1564 | &new_var->VendorGuid); |
| @@ -1644,8 +1588,8 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj, · 23 unmodified lines | ||
| 1644 | 1588 | * Does this variable already exist? |
| 1645 | 1589 | */ |
| 1646 | 1590 | list_for_each_entry_safe(search_efivar, n, &efivars->list, list) { |
| 1647 | − strsize1 = utf16_strsize(search_efivar->var.VariableName, 1024); | |
| 1648 | − strsize2 = utf16_strsize(del_var->VariableName, 1024); | |
| 1591 | + strsize1 = ucs2_strsize(search_efivar->var.VariableName, 1024); | |
| 1592 | + strsize2 = ucs2_strsize(del_var->VariableName, 1024); | |
| 1649 | 1593 | if (strsize1 == strsize2 && |
| 1650 | 1594 | !memcmp(&(search_efivar->var.VariableName), |
| 1651 | 1595 | del_var->VariableName, strsize1) && |
| @@ -1691,9 +1635,9 @@ static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor) · 39 unmodified lines | ||
| 1691 | 1635 | unsigned long strsize1, strsize2; |
| 1692 | 1636 | bool found = false; |
| 1693 | 1637 | |
| 1694 | − strsize1 = utf16_strsize(variable_name, 1024); | |
| 1638 | + strsize1 = ucs2_strsize(variable_name, 1024); | |
| 1695 | 1639 | list_for_each_entry_safe(entry, n, &efivars->list, list) { |
| 1696 | − strsize2 = utf16_strsize(entry->var.VariableName, 1024); | |
| 1640 | + strsize2 = ucs2_strsize(entry->var.VariableName, 1024); | |
| 1697 | 1641 | if (strsize1 == strsize2 && |
| 1698 | 1642 | !memcmp(variable_name, &(entry->var.VariableName), |
| 1699 | 1643 | strsize2) && |
| @@ -2131,7 +2075,7 @@ efivars_init(void) · 431 unmodified lines | ||
| 2131 | 2075 | ops.get_variable = efi.get_variable; |
| 2132 | 2076 | ops.set_variable = efi.set_variable; |
| 2133 | 2077 | ops.get_next_variable = efi.get_next_variable; |
| 2134 | − ops.query_variable_info = efi.query_variable_info; | |
| 2078 | + ops.query_variable_store = efi_query_variable_store; | |
| 2135 | 2079 | |
| 2136 | 2080 | error = register_efivars(&__efivars, &ops, efi_kobj); |
| 2137 | 2081 | if (error) |
| @@ -575,7 +575,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, · 574 unmodified lines | ||
| 575 | 575 | chip->gpio_chip.ngpio, |
| 576 | 576 | irq_base, |
| 577 | 577 | &pca953x_irq_simple_ops, |
| 578 | − NULL); | |
| 578 | + chip); | |
| 579 | 579 | if (!chip->domain) |
| 580 | 580 | return -ENODEV; |
| 581 | 581 | |
| @@ -1544,10 +1544,10 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) · 1543 unmodified lines | ||
| 1544 | 1544 | if (!fb_helper->fb) |
| 1545 | 1545 | return 0; |
| 1546 | 1546 | |
| 1547 | − drm_modeset_lock_all(dev); | |
| 1547 | + mutex_lock(&fb_helper->dev->mode_config.mutex); | |
| 1548 | 1548 | if (!drm_fb_helper_is_bound(fb_helper)) { |
| 1549 | 1549 | fb_helper->delayed_hotplug = true; |
| 1550 | − drm_modeset_unlock_all(dev); | |
| 1550 | + mutex_unlock(&fb_helper->dev->mode_config.mutex); | |
| 1551 | 1551 | return 0; |
| 1552 | 1552 | } |
| 1553 | 1553 | DRM_DEBUG_KMS("\n"); |
| @@ -1558,9 +1558,11 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) · 4 unmodified lines | ||
| 1558 | 1558 | |
| 1559 | 1559 | count = drm_fb_helper_probe_connector_modes(fb_helper, max_width, |
| 1560 | 1560 | max_height); |
| 1561 | + mutex_unlock(&fb_helper->dev->mode_config.mutex); | |
| 1562 | + | |
| 1563 | + drm_modeset_lock_all(dev); | |
| 1561 | 1564 | drm_setup_crtcs(fb_helper); |
| 1562 | 1565 | drm_modeset_unlock_all(dev); |
| 1563 | − | |
| 1564 | 1566 | drm_fb_helper_set_par(fb_helper->fbdev); |
| 1565 | 1567 | |
| 1566 | 1568 | return 0; |
| @@ -751,8 +751,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, · 750 unmodified lines | ||
| 751 | 751 | int i; |
| 752 | 752 | unsigned char misc = 0; |
| 753 | 753 | unsigned char ext_vga[6]; |
| 754 | − unsigned char ext_vga_index24; | |
| 755 | − unsigned char dac_index90 = 0; | |
| 756 | 754 | u8 bppshift; |
| 757 | 755 | |
| 758 | 756 | static unsigned char dacvalue[] = { |
| @@ -803,7 +801,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, · 44 unmodified lines | ||
| 803 | 801 | option2 = 0x0000b000; |
| 804 | 802 | break; |
| 805 | 803 | case G200_ER: |
| 806 | − dac_index90 = 0; | |
| 807 | 804 | break; |
| 808 | 805 | } |
| 809 | 806 | |
| @@ -852,10 +849,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, · 42 unmodified lines | ||
| 852 | 849 | WREG_DAC(i, dacvalue[i]); |
| 853 | 850 | } |
| 854 | 851 | |
| 855 | − if (mdev->type == G200_ER) { | |
| 856 | − WREG_DAC(0x90, dac_index90); | |
| 857 | − } | |
| 858 | − | |
| 852 | + if (mdev->type == G200_ER) | |
| 853 | + WREG_DAC(0x90, 0); | |
| 859 | 854 | |
| 860 | 855 | if (option) |
| 861 | 856 | pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option); |
| @@ -952,8 +947,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, · 90 unmodified lines | ||
| 952 | 947 | if (mdev->type == G200_WB) |
| 953 | 948 | ext_vga[1] |= 0x88; |
| 954 | 949 | |
| 955 | − ext_vga_index24 = 0x05; | |
| 956 | − | |
| 957 | 950 | /* Set pixel clocks */ |
| 958 | 951 | misc = 0x2d; |
| 959 | 952 | WREG8(MGA_MISC_OUT, misc); |
| @@ -965,7 +958,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, · 5 unmodified lines | ||
| 965 | 958 | } |
| 966 | 959 | |
| 967 | 960 | if (mdev->type == G200_ER) |
| 968 | − WREG_ECRT(24, ext_vga_index24); | |
| 961 | + WREG_ECRT(0x24, 0x5); | |
| 969 | 962 | |
| 970 | 963 | if (mdev->type == G200_EV) { |
| 971 | 964 | WREG_ECRT(6, 0); |
| @@ -248,6 +248,22 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios) · 247 unmodified lines | ||
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | +static void | |
| 252 | +nouveau_bios_shadow_platform(struct nouveau_bios *bios) | |
| 253 | +{ | |
| 254 | + struct pci_dev *pdev = nv_device(bios)->pdev; | |
| 255 | + size_t size; | |
| 256 | + | |
| 257 | + void __iomem *rom = pci_platform_rom(pdev, &size); | |
| 258 | + if (rom && size) { | |
| 259 | + bios->data = kmalloc(size, GFP_KERNEL); | |
| 260 | + if (bios->data) { | |
| 261 | + memcpy_fromio(bios->data, rom, size); | |
| 262 | + bios->size = size; | |
| 263 | + } | |
| 264 | + } | |
| 265 | +} | |
| 266 | + | |
| 251 | 267 | static int |
| 252 | 268 | nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) |
| 253 | 269 | { |
| @@ -288,6 +304,7 @@ nouveau_bios_shadow(struct nouveau_bios *bios) · 34 unmodified lines | ||
| 288 | 304 | { "PROM", nouveau_bios_shadow_prom, false, 0, 0, NULL }, |
| 289 | 305 | { "ACPI", nouveau_bios_shadow_acpi, true, 0, 0, NULL }, |
| 290 | 306 | { "PCIROM", nouveau_bios_shadow_pci, true, 0, 0, NULL }, |
| 307 | + { "PLATFORM", nouveau_bios_shadow_platform, true, 0, 0, NULL }, | |
| 291 | 308 | {} |
| 292 | 309 | }; |
| 293 | 310 | struct methods *mthd, *best; |
| @@ -479,7 +479,7 @@ nv50_display_flip_wait(void *data) · 478 unmodified lines | ||
| 479 | 479 | { |
| 480 | 480 | struct nv50_display_flip *flip = data; |
| 481 | 481 | if (nouveau_bo_rd32(flip->disp->sync, flip->chan->addr / 4) == |
| 482 | − flip->chan->data); | |
| 482 | + flip->chan->data) | |
| 483 | 483 | return true; |
| 484 | 484 | usleep_range(1, 2); |
| 485 | 485 | return false; |
| @@ -99,6 +99,29 @@ static bool radeon_read_bios(struct radeon_device *rdev) · 98 unmodified lines | ||
| 99 | 99 | return true; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | +static bool radeon_read_platform_bios(struct radeon_device *rdev) | |
| 103 | +{ | |
| 104 | + uint8_t __iomem *bios; | |
| 105 | + size_t size; | |
| 106 | + | |
| 107 | + rdev->bios = NULL; | |
| 108 | + | |
| 109 | + bios = pci_platform_rom(rdev->pdev, &size); | |
| 110 | + if (!bios) { | |
| 111 | + return false; | |
| 112 | + } | |
| 113 | + | |
| 114 | + if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { | |
| 115 | + return false; | |
| 116 | + } | |
| 117 | + rdev->bios = kmemdup(bios, size, GFP_KERNEL); | |
| 118 | + if (rdev->bios == NULL) { | |
| 119 | + return false; | |
| 120 | + } | |
| 121 | + | |
| 122 | + return true; | |
| 123 | +} | |
| 124 | + | |
| 102 | 125 | #ifdef CONFIG_ACPI |
| 103 | 126 | /* ATRM is used to get the BIOS on the discrete cards in |
| 104 | 127 | * dual-gpu systems. |
| @@ -620,6 +643,9 @@ bool radeon_get_bios(struct radeon_device *rdev) · 515 unmodified lines | ||
| 620 | 643 | if (r == false) { |
| 621 | 644 | r = radeon_read_disabled_bios(rdev); |
| 622 | 645 | } |
| 646 | + if (r == false) { | |
| 647 | + r = radeon_read_platform_bios(rdev); | |
| 648 | + } | |
| 623 | 649 | if (r == false || rdev->bios == NULL) { |
| 624 | 650 | DRM_ERROR("Unable to locate a BIOS ROM\n"); |
| 625 | 651 | rdev->bios = NULL; |
| @@ -61,6 +61,10 @@ static int udl_get_modes(struct drm_connector *connector) · 60 unmodified lines | ||
| 61 | 61 | int ret; |
| 62 | 62 | |
| 63 | 63 | edid = (struct edid *)udl_get_edid(udl); |
| 64 | + if (!edid) { | |
| 65 | + drm_mode_connector_update_edid_property(connector, NULL); | |
| 66 | + return 0; | |
| 67 | + } | |
| 64 | 68 | |
| 65 | 69 | /* |
| 66 | 70 | * We only read the main block, but if the monitor reports extension |
| @@ -416,6 +416,8 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock) · 415 unmodified lines | ||
| 416 | 416 | ret = pm_runtime_get_sync(dev); |
| 417 | 417 | if (ret < 0) { |
| 418 | 418 | dev_err(dev, "%s: can't power on device\n", __func__); |
| 419 | + pm_runtime_put_noidle(dev); | |
| 420 | + module_put(dev->driver->owner); | |
| 419 | 421 | return ret; |
| 420 | 422 | } |
| 421 | 423 | |
| @@ -465,6 +465,7 @@ static const struct x86_cpu_id intel_idle_ids[] = { · 464 unmodified lines | ||
| 465 | 465 | ICPU(0x3c, idle_cpu_hsw), |
| 466 | 466 | ICPU(0x3f, idle_cpu_hsw), |
| 467 | 467 | ICPU(0x45, idle_cpu_hsw), |
| 468 | + ICPU(0x46, idle_cpu_hsw), | |
| 468 | 469 | {} |
| 469 | 470 | }; |
| 470 | 471 | MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); |
| @@ -359,7 +359,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) · 358 unmodified lines | ||
| 359 | 359 | case 0x802: /* Intuos4 General Pen */ |
| 360 | 360 | case 0x804: /* Intuos4 Marker Pen */ |
| 361 | 361 | case 0x40802: /* Intuos4 Classic Pen */ |
| 362 | − case 0x18803: /* DTH2242 Grip Pen */ | |
| 362 | + case 0x18802: /* DTH2242 Grip Pen */ | |
| 363 | 363 | case 0x022: |
| 364 | 364 | wacom->tool[idx] = BTN_TOOL_PEN; |
| 365 | 365 | break; |
| @@ -1912,7 +1912,7 @@ static const struct wacom_features wacom_features_0xBB = · 1546 unmodified lines | ||
| 1912 | 1912 | { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, |
| 1913 | 1913 | 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 1914 | 1914 | static const struct wacom_features wacom_features_0xBC = |
| 1915 | − { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, | |
| 1915 | + { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40640, 25400, 2047, | |
| 1916 | 1916 | 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 1917 | 1917 | static const struct wacom_features wacom_features_0x26 = |
| 1918 | 1918 | { "Wacom Intuos5 touch S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, |
| @@ -2144,7 +2144,7 @@ const struct usb_device_id wacom_ids[] = { · 225 unmodified lines | ||
| 2144 | 2144 | { USB_DEVICE_WACOM(0x44) }, |
| 2145 | 2145 | { USB_DEVICE_WACOM(0x45) }, |
| 2146 | 2146 | { USB_DEVICE_WACOM(0x59) }, |
| 2147 | − { USB_DEVICE_WACOM(0x5D) }, | |
| 2147 | + { USB_DEVICE_DETAILED(0x5D, USB_CLASS_HID, 0, 0) }, | |
| 2148 | 2148 | { USB_DEVICE_WACOM(0xB0) }, |
| 2149 | 2149 | { USB_DEVICE_WACOM(0xB1) }, |
| 2150 | 2150 | { USB_DEVICE_WACOM(0xB2) }, |
| @@ -2209,7 +2209,7 @@ const struct usb_device_id wacom_ids[] = { · 58 unmodified lines | ||
| 2209 | 2209 | { USB_DEVICE_WACOM(0x47) }, |
| 2210 | 2210 | { USB_DEVICE_WACOM(0xF4) }, |
| 2211 | 2211 | { USB_DEVICE_WACOM(0xF8) }, |
| 2212 | − { USB_DEVICE_WACOM(0xF6) }, | |
| 2212 | + { USB_DEVICE_DETAILED(0xF6, USB_CLASS_HID, 0, 0) }, | |
| 2213 | 2213 | { USB_DEVICE_WACOM(0xFA) }, |
| 2214 | 2214 | { USB_DEVICE_LENOVO(0x6004) }, |
| 2215 | 2215 | { } |
| @@ -236,7 +236,8 @@ static int gic_retrigger(struct irq_data *d) · 235 unmodified lines | ||
| 236 | 236 | if (gic_arch_extn.irq_retrigger) |
| 237 | 237 | return gic_arch_extn.irq_retrigger(d); |
| 238 | 238 | |
| 239 | − return -ENXIO; | |
| 239 | + /* the genirq layer expects 0 if we can't retrigger in hardware */ | |
| 240 | + return 0; | |
| 240 | 241 | } |
| 241 | 242 | |
| 242 | 243 | #ifdef CONFIG_SMP |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | #include "dm.h" |
| 8 | 8 | #include "dm-bio-prison.h" |
| 9 | +#include "dm-bio-record.h" | |
| 9 | 10 | #include "dm-cache-metadata.h" |
| 10 | 11 | |
| 11 | 12 | #include <linux/dm-io.h> |
| @@ -201,10 +202,15 @@ struct per_bio_data { · 189 unmodified lines | ||
| 201 | 202 | unsigned req_nr:2; |
| 202 | 203 | struct dm_deferred_entry *all_io_entry; |
| 203 | 204 | |
| 204 | − /* writethrough fields */ | |
| 205 | + /* | |
| 206 | + * writethrough fields. These MUST remain at the end of this | |
| 207 | + * structure and the 'cache' member must be the first as it | |
| 208 | + * is used to determine the offsetof the writethrough fields. | |
| 209 | + */ | |
| 205 | 210 | struct cache *cache; |
| 206 | 211 | dm_cblock_t cblock; |
| 207 | 212 | bio_end_io_t *saved_bi_end_io; |
| 213 | + struct dm_bio_details bio_details; | |
| 208 | 214 | }; |
| 209 | 215 | |
| 210 | 216 | struct dm_cache_migration { |
| @@ -513,16 +519,28 @@ static void save_stats(struct cache *cache) · 302 unmodified lines | ||
| 513 | 519 | /*---------------------------------------------------------------- |
| 514 | 520 | * Per bio data |
| 515 | 521 | *--------------------------------------------------------------*/ |
| 516 | −static struct per_bio_data *get_per_bio_data(struct bio *bio) | |
| 522 | + | |
| 523 | +/* | |
| 524 | + * If using writeback, leave out struct per_bio_data's writethrough fields. | |
| 525 | + */ | |
| 526 | +#define PB_DATA_SIZE_WB (offsetof(struct per_bio_data, cache)) | |
| 527 | +#define PB_DATA_SIZE_WT (sizeof(struct per_bio_data)) | |
| 528 | + | |
| 529 | +static size_t get_per_bio_data_size(struct cache *cache) | |
| 530 | +{ | |
| 531 | + return cache->features.write_through ? PB_DATA_SIZE_WT : PB_DATA_SIZE_WB; | |
| 532 | +} | |
| 533 | + | |
| 534 | +static struct per_bio_data *get_per_bio_data(struct bio *bio, size_t data_size) | |
| 517 | 535 | { |
| 518 | − struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); | |
| 536 | + struct per_bio_data *pb = dm_per_bio_data(bio, data_size); | |
| 519 | 537 | BUG_ON(!pb); |
| 520 | 538 | return pb; |
| 521 | 539 | } |
| 522 | 540 | |
| 523 | −static struct per_bio_data *init_per_bio_data(struct bio *bio) | |
| 541 | +static struct per_bio_data *init_per_bio_data(struct bio *bio, size_t data_size) | |
| 524 | 542 | { |
| 525 | − struct per_bio_data *pb = get_per_bio_data(bio); | |
| 543 | + struct per_bio_data *pb = get_per_bio_data(bio, data_size); | |
| 526 | 544 | |
| 527 | 545 | pb->tick = false; |
| 528 | 546 | pb->req_nr = dm_bio_get_target_bio_nr(bio); |
| @@ -556,7 +574,8 @@ static void remap_to_cache(struct cache *cache, struct bio *bio, · 27 unmodified lines | ||
| 556 | 574 | static void check_if_tick_bio_needed(struct cache *cache, struct bio *bio) |
| 557 | 575 | { |
| 558 | 576 | unsigned long flags; |
| 559 | − struct per_bio_data *pb = get_per_bio_data(bio); | |
| 577 | + size_t pb_data_size = get_per_bio_data_size(cache); | |
| 578 | + struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | |
| 560 | 579 | |
| 561 | 580 | spin_lock_irqsave(&cache->lock, flags); |
| 562 | 581 | if (cache->need_tick_bio && |
| @@ -635,7 +654,7 @@ static void defer_writethrough_bio(struct cache *cache, struct bio *bio) · 72 unmodified lines | ||
| 635 | 654 | |
| 636 | 655 | static void writethrough_endio(struct bio *bio, int err) |
| 637 | 656 | { |
| 638 | − struct per_bio_data *pb = get_per_bio_data(bio); | |
| 657 | + struct per_bio_data *pb = get_per_bio_data(bio, PB_DATA_SIZE_WT); | |
| 639 | 658 | bio->bi_end_io = pb->saved_bi_end_io; |
| 640 | 659 | |
| 641 | 660 | if (err) { |
| @@ -643,6 +662,7 @@ static void writethrough_endio(struct bio *bio, int err) · 1 unmodified line | ||
| 643 | 662 | return; |
| 644 | 663 | } |
| 645 | 664 | |
| 665 | + dm_bio_restore(&pb->bio_details, bio); | |
| 646 | 666 | remap_to_cache(pb->cache, bio, pb->cblock); |
| 647 | 667 | |
| 648 | 668 | /* |
| @@ -662,11 +682,12 @@ static void writethrough_endio(struct bio *bio, int err) · 13 unmodified lines | ||
| 662 | 682 | static void remap_to_origin_then_cache(struct cache *cache, struct bio *bio, |
| 663 | 683 | dm_oblock_t oblock, dm_cblock_t cblock) |
| 664 | 684 | { |
| 665 | − struct per_bio_data *pb = get_per_bio_data(bio); | |
| 685 | + struct per_bio_data *pb = get_per_bio_data(bio, PB_DATA_SIZE_WT); | |
| 666 | 686 | |
| 667 | 687 | pb->cache = cache; |
| 668 | 688 | pb->cblock = cblock; |
| 669 | 689 | pb->saved_bi_end_io = bio->bi_end_io; |
| 690 | + dm_bio_record(&pb->bio_details, bio); | |
| 670 | 691 | bio->bi_end_io = writethrough_endio; |
| 671 | 692 | |
| 672 | 693 | remap_to_origin_clear_discard(pb->cache, bio, oblock); |
| @@ -1035,7 +1056,8 @@ static void defer_bio(struct cache *cache, struct bio *bio) · 362 unmodified lines | ||
| 1035 | 1056 | |
| 1036 | 1057 | static void process_flush_bio(struct cache *cache, struct bio *bio) |
| 1037 | 1058 | { |
| 1038 | − struct per_bio_data *pb = get_per_bio_data(bio); | |
| 1059 | + size_t pb_data_size = get_per_bio_data_size(cache); | |
| 1060 | + struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | |
| 1039 | 1061 | |
| 1040 | 1062 | BUG_ON(bio->bi_size); |
| 1041 | 1063 | if (!pb->req_nr) |
| @@ -1107,7 +1129,8 @@ static void process_bio(struct cache *cache, struct prealloc *structs, · 65 unmodified lines | ||
| 1107 | 1129 | dm_oblock_t block = get_bio_block(cache, bio); |
| 1108 | 1130 | struct dm_bio_prison_cell *cell_prealloc, *old_ocell, *new_ocell; |
| 1109 | 1131 | struct policy_result lookup_result; |
| 1110 | − struct per_bio_data *pb = get_per_bio_data(bio); | |
| 1132 | + size_t pb_data_size = get_per_bio_data_size(cache); | |
| 1133 | + struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | |
| 1111 | 1134 | bool discarded_block = is_discarded_oblock(cache, block); |
| 1112 | 1135 | bool can_migrate = discarded_block || spare_migration_bandwidth(cache); |
| 1113 | 1136 | |
| @@ -1881,7 +1904,6 @@ static int cache_create(struct cache_args *ca, struct cache **result) · 767 unmodified lines | ||
| 1881 | 1904 | |
| 1882 | 1905 | cache->ti = ca->ti; |
| 1883 | 1906 | ti->private = cache; |
| 1884 | − ti->per_bio_data_size = sizeof(struct per_bio_data); | |
| 1885 | 1907 | ti->num_flush_bios = 2; |
| 1886 | 1908 | ti->flush_supported = true; |
| 1887 | 1909 | |
| @@ -1890,6 +1912,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) · 2 unmodified lines | ||
| 1890 | 1912 | ti->discard_zeroes_data_unsupported = true; |
| 1891 | 1913 | |
| 1892 | 1914 | memcpy(&cache->features, &ca->features, sizeof(cache->features)); |
| 1915 | + ti->per_bio_data_size = get_per_bio_data_size(cache); | |
| 1893 | 1916 | |
| 1894 | 1917 | cache->callbacks.congested_fn = cache_is_congested; |
| 1895 | 1918 | dm_table_add_target_callbacks(ti->table, &cache->callbacks); |
| @@ -2092,6 +2115,7 @@ static int cache_map(struct dm_target *ti, struct bio *bio) · 196 unmodified lines | ||
| 2092 | 2115 | |
| 2093 | 2116 | int r; |
| 2094 | 2117 | dm_oblock_t block = get_bio_block(cache, bio); |
| 2118 | + size_t pb_data_size = get_per_bio_data_size(cache); | |
| 2095 | 2119 | bool can_migrate = false; |
| 2096 | 2120 | bool discarded_block; |
| 2097 | 2121 | struct dm_bio_prison_cell *cell; |
| @@ -2108,7 +2132,7 @@ static int cache_map(struct dm_target *ti, struct bio *bio) · 10 unmodified lines | ||
| 2108 | 2132 | return DM_MAPIO_REMAPPED; |
| 2109 | 2133 | } |
| 2110 | 2134 | |
| 2111 | − pb = init_per_bio_data(bio); | |
| 2135 | + pb = init_per_bio_data(bio, pb_data_size); | |
| 2112 | 2136 | |
| 2113 | 2137 | if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) { |
| 2114 | 2138 | defer_bio(cache, bio); |
| @@ -2193,7 +2217,8 @@ static int cache_end_io(struct dm_target *ti, struct bio *bio, int error) · 78 unmodified lines | ||
| 2193 | 2217 | { |
| 2194 | 2218 | struct cache *cache = ti->private; |
| 2195 | 2219 | unsigned long flags; |
| 2196 | − struct per_bio_data *pb = get_per_bio_data(bio); | |
| 2220 | + size_t pb_data_size = get_per_bio_data_size(cache); | |
| 2221 | + struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | |
| 2197 | 2222 | |
| 2198 | 2223 | if (pb->tick) { |
| 2199 | 2224 | policy_tick(cache->policy); |
| @@ -611,6 +611,7 @@ static void dec_pending(struct dm_io *io, int error) · 610 unmodified lines | ||
| 611 | 611 | queue_io(md, bio); |
| 612 | 612 | } else { |
| 613 | 613 | /* done with normal IO or empty flush */ |
| 614 | + trace_block_bio_complete(md->queue, bio, io_error); | |
| 614 | 615 | bio_endio(bio, io_error); |
| 615 | 616 | } |
| 616 | 617 | } |
| @@ -184,6 +184,8 @@ static void return_io(struct bio *return_bi) · 183 unmodified lines | ||
| 184 | 184 | return_bi = bi->bi_next; |
| 185 | 185 | bi->bi_next = NULL; |
| 186 | 186 | bi->bi_size = 0; |
| 187 | + trace_block_bio_complete(bdev_get_queue(bi->bi_bdev), | |
| 188 | + bi, 0); | |
| 187 | 189 | bio_endio(bi, 0); |
| 188 | 190 | bi = return_bi; |
| 189 | 191 | } |
| @@ -3914,6 +3916,8 @@ static void raid5_align_endio(struct bio *bi, int error) · 3724 unmodified lines | ||
| 3914 | 3916 | rdev_dec_pending(rdev, conf->mddev); |
| 3915 | 3917 | |
| 3916 | 3918 | if (!error && uptodate) { |
| 3919 | + trace_block_bio_complete(bdev_get_queue(raid_bi->bi_bdev), | |
| 3920 | + raid_bi, 0); | |
| 3917 | 3921 | bio_endio(raid_bi, 0); |
| 3918 | 3922 | if (atomic_dec_and_test(&conf->active_aligned_reads)) |
| 3919 | 3923 | wake_up(&conf->wait_for_stripe); |
| @@ -4382,6 +4386,8 @@ static void make_request(struct mddev *mddev, struct bio * bi) · 462 unmodified lines | ||
| 4382 | 4386 | if ( rw == WRITE ) |
| 4383 | 4387 | md_write_end(mddev); |
| 4384 | 4388 | |
| 4389 | + trace_block_bio_complete(bdev_get_queue(bi->bi_bdev), | |
| 4390 | + bi, 0); | |
| 4385 | 4391 | bio_endio(bi, 0); |
| 4386 | 4392 | } |
| 4387 | 4393 | } |
| @@ -4758,8 +4764,11 @@ static int retry_aligned_read(struct r5conf *conf, struct bio *raid_bio) · 370 unmodified lines | ||
| 4758 | 4764 | handled++; |
| 4759 | 4765 | } |
| 4760 | 4766 | remaining = raid5_dec_bi_active_stripes(raid_bio); |
| 4761 | − if (remaining == 0) | |
| 4767 | + if (remaining == 0) { | |
| 4768 | + trace_block_bio_complete(bdev_get_queue(raid_bio->bi_bdev), | |
| 4769 | + raid_bio, 0); | |
| 4762 | 4770 | bio_endio(raid_bio, 0); |
| 4771 | + } | |
| 4763 | 4772 | if (atomic_dec_and_test(&conf->active_aligned_reads)) |
| 4764 | 4773 | wake_up(&conf->wait_for_stripe); |
| 4765 | 4774 | return handled; |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | config VMWARE_VMCI |
| 6 | 6 | tristate "VMware VMCI Driver" |
| 7 | − depends on X86 && PCI | |
| 7 | + depends on X86 && PCI && NET | |
| 8 | 8 | help |
| 9 | 9 | This is VMware's Virtual Machine Communication Interface. It enables |
| 10 | 10 | high-speed communication between host and guest in a virtual |
| @@ -1123,33 +1123,6 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file, · 1122 unmodified lines | ||
| 1123 | 1123 | } |
| 1124 | 1124 | #endif |
| 1125 | 1125 | |
| 1126 | −static inline unsigned long get_vm_size(struct vm_area_struct *vma) | |
| 1127 | −{ | |
| 1128 | − return vma->vm_end - vma->vm_start; | |
| 1129 | −} | |
| 1130 | − | |
| 1131 | −static inline resource_size_t get_vm_offset(struct vm_area_struct *vma) | |
| 1132 | −{ | |
| 1133 | − return (resource_size_t) vma->vm_pgoff << PAGE_SHIFT; | |
| 1134 | −} | |
| 1135 | − | |
| 1136 | −/* | |
| 1137 | − * Set a new vm offset. | |
| 1138 | − * | |
| 1139 | − * Verify that the incoming offset really works as a page offset, | |
| 1140 | − * and that the offset and size fit in a resource_size_t. | |
| 1141 | − */ | |
| 1142 | −static inline int set_vm_offset(struct vm_area_struct *vma, resource_size_t off) | |
| 1143 | −{ | |
| 1144 | − pgoff_t pgoff = off >> PAGE_SHIFT; | |
| 1145 | − if (off != (resource_size_t) pgoff << PAGE_SHIFT) | |
| 1146 | − return -EINVAL; | |
| 1147 | − if (off + get_vm_size(vma) - 1 < off) | |
| 1148 | − return -EINVAL; | |
| 1149 | − vma->vm_pgoff = pgoff; | |
| 1150 | − return 0; | |
| 1151 | −} | |
| 1152 | − | |
| 1153 | 1126 | /* |
| 1154 | 1127 | * set up a mapping for shared memory segments |
| 1155 | 1128 | */ |
| @@ -1159,45 +1132,17 @@ static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma) · 3 unmodified lines | ||
| 1159 | 1132 | struct mtd_file_info *mfi = file->private_data; |
| 1160 | 1133 | struct mtd_info *mtd = mfi->mtd; |
| 1161 | 1134 | struct map_info *map = mtd->priv; |
| 1162 | − resource_size_t start, off; | |
| 1163 | − unsigned long len, vma_len; | |
| 1164 | 1135 | |
| 1165 | 1136 | /* This is broken because it assumes the MTD device is map-based |
| 1166 | 1137 | and that mtd->priv is a valid struct map_info. It should be |
| 1167 | 1138 | replaced with something that uses the mtd_get_unmapped_area() |
| 1168 | 1139 | operation properly. */ |
| 1169 | 1140 | if (0 /*mtd->type == MTD_RAM || mtd->type == MTD_ROM*/) { |
| 1170 | − off = get_vm_offset(vma); | |
| 1171 | − start = map->phys; | |
| 1172 | − len = PAGE_ALIGN((start & ~PAGE_MASK) + map->size); | |
| 1173 | − start &= PAGE_MASK; | |
| 1174 | − vma_len = get_vm_size(vma); | |
| 1175 | − | |
| 1176 | − /* Overflow in off+len? */ | |
| 1177 | − if (vma_len + off < off) | |
| 1178 | − return -EINVAL; | |
| 1179 | − /* Does it fit in the mapping? */ | |
| 1180 | − if (vma_len + off > len) | |
| 1181 | − return -EINVAL; | |
| 1182 | − | |
| 1183 | − off += start; | |
| 1184 | − /* Did that overflow? */ | |
| 1185 | − if (off < start) | |
| 1186 | − return -EINVAL; | |
| 1187 | − if (set_vm_offset(vma, off) < 0) | |
| 1188 | − return -EINVAL; | |
| 1189 | − vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; | |
| 1190 | − | |
| 1191 | 1141 | #ifdef pgprot_noncached |
| 1192 | − if (file->f_flags & O_DSYNC || off >= __pa(high_memory)) | |
| 1142 | + if (file->f_flags & O_DSYNC || map->phys >= __pa(high_memory)) | |
| 1193 | 1143 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
| 1194 | 1144 | #endif |
| 1195 | − if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | |
| 1196 | − vma->vm_end - vma->vm_start, | |
| 1197 | − vma->vm_page_prot)) | |
| 1198 | − return -EAGAIN; | |
| 1199 | − | |
| 1200 | − return 0; | |
| 1145 | + return vm_iomap_memory(vma, map->phys, map->size); | |
| 1201 | 1146 | } |
| 1202 | 1147 | return -ENOSYS; |
| 1203 | 1148 | #else |
| @@ -848,8 +848,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, · 847 unmodified lines | ||
| 848 | 848 | if (bond->dev->flags & IFF_ALLMULTI) |
| 849 | 849 | dev_set_allmulti(old_active->dev, -1); |
| 850 | 850 | |
| 851 | + netif_addr_lock_bh(bond->dev); | |
| 851 | 852 | netdev_for_each_mc_addr(ha, bond->dev) |
| 852 | 853 | dev_mc_del(old_active->dev, ha->addr); |
| 854 | + netif_addr_unlock_bh(bond->dev); | |
| 853 | 855 | } |
| 854 | 856 | |
| 855 | 857 | if (new_active) { |
| @@ -860,8 +862,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, · 4 unmodified lines | ||
| 860 | 862 | if (bond->dev->flags & IFF_ALLMULTI) |
| 861 | 863 | dev_set_allmulti(new_active->dev, 1); |
| 862 | 864 | |
| 865 | + netif_addr_lock_bh(bond->dev); | |
| 863 | 866 | netdev_for_each_mc_addr(ha, bond->dev) |
| 864 | 867 | dev_mc_add(new_active->dev, ha->addr); |
| 868 | + netif_addr_unlock_bh(bond->dev); | |
| 865 | 869 | } |
| 866 | 870 | } |
| 867 | 871 | |
| @@ -1903,11 +1907,29 @@ err_dest_symlinks: · 1035 unmodified lines | ||
| 1903 | 1907 | bond_destroy_slave_symlinks(bond_dev, slave_dev); |
| 1904 | 1908 | |
| 1905 | 1909 | err_detach: |
| 1910 | + if (!USES_PRIMARY(bond->params.mode)) { | |
| 1911 | + netif_addr_lock_bh(bond_dev); | |
| 1912 | + bond_mc_list_flush(bond_dev, slave_dev); | |
| 1913 | + netif_addr_unlock_bh(bond_dev); | |
| 1914 | + } | |
| 1915 | + bond_del_vlans_from_slave(bond, slave_dev); | |
| 1906 | 1916 | write_lock_bh(&bond->lock); |
| 1907 | 1917 | bond_detach_slave(bond, new_slave); |
| 1918 | + if (bond->primary_slave == new_slave) | |
| 1919 | + bond->primary_slave = NULL; | |
| 1908 | 1920 | write_unlock_bh(&bond->lock); |
| 1921 | + if (bond->curr_active_slave == new_slave) { | |
| 1922 | + read_lock(&bond->lock); | |
| 1923 | + write_lock_bh(&bond->curr_slave_lock); | |
| 1924 | + bond_change_active_slave(bond, NULL); | |
| 1925 | + bond_select_active_slave(bond); | |
| 1926 | + write_unlock_bh(&bond->curr_slave_lock); | |
| 1927 | + read_unlock(&bond->lock); | |
| 1928 | + } | |
| 1929 | + slave_disable_netpoll(new_slave); | |
| 1909 | 1930 | |
| 1910 | 1931 | err_close: |
| 1932 | + slave_dev->priv_flags &= ~IFF_BONDING; | |
| 1911 | 1933 | dev_close(slave_dev); |
| 1912 | 1934 | |
| 1913 | 1935 | err_unset_master: |
| @@ -3172,11 +3194,20 @@ static int bond_slave_netdev_event(unsigned long event, · 1258 unmodified lines | ||
| 3172 | 3194 | struct net_device *slave_dev) |
| 3173 | 3195 | { |
| 3174 | 3196 | struct slave *slave = bond_slave_get_rtnl(slave_dev); |
| 3175 | − struct bonding *bond = slave->bond; | |
| 3176 | − struct net_device *bond_dev = slave->bond->dev; | |
| 3197 | + struct bonding *bond; | |
| 3198 | + struct net_device *bond_dev; | |
| 3177 | 3199 | u32 old_speed; |
| 3178 | 3200 | u8 old_duplex; |
| 3179 | 3201 | |
| 3202 | + /* A netdev event can be generated while enslaving a device | |
| 3203 | + * before netdev_rx_handler_register is called in which case | |
| 3204 | + * slave will be NULL | |
| 3205 | + */ | |
| 3206 | + if (!slave) | |
| 3207 | + return NOTIFY_DONE; | |
| 3208 | + bond_dev = slave->bond->dev; | |
| 3209 | + bond = slave->bond; | |
| 3210 | + | |
| 3180 | 3211 | switch (event) { |
| 3181 | 3212 | case NETDEV_UNREGISTER: |
| 3182 | 3213 | if (bond->setup_by_slave) |
| @@ -3290,20 +3321,22 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count) · 107 unmodified lines | ||
| 3290 | 3321 | */ |
| 3291 | 3322 | static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count) |
| 3292 | 3323 | { |
| 3293 | − struct ethhdr *data = (struct ethhdr *)skb->data; | |
| 3294 | − struct iphdr *iph; | |
| 3295 | − struct ipv6hdr *ipv6h; | |
| 3324 | + const struct ethhdr *data; | |
| 3325 | + const struct iphdr *iph; | |
| 3326 | + const struct ipv6hdr *ipv6h; | |
| 3296 | 3327 | u32 v6hash; |
| 3297 | − __be32 *s, *d; | |
| 3328 | + const __be32 *s, *d; | |
| 3298 | 3329 | |
| 3299 | 3330 | if (skb->protocol == htons(ETH_P_IP) && |
| 3300 | − skb_network_header_len(skb) >= sizeof(*iph)) { | |
| 3331 | + pskb_network_may_pull(skb, sizeof(*iph))) { | |
| 3301 | 3332 | iph = ip_hdr(skb); |
| 3333 | + data = (struct ethhdr *)skb->data; | |
| 3302 | 3334 | return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ |
| 3303 | 3335 | (data->h_dest[5] ^ data->h_source[5])) % count; |
| 3304 | 3336 | } else if (skb->protocol == htons(ETH_P_IPV6) && |
| 3305 | − skb_network_header_len(skb) >= sizeof(*ipv6h)) { | |
| 3337 | + pskb_network_may_pull(skb, sizeof(*ipv6h))) { | |
| 3306 | 3338 | ipv6h = ipv6_hdr(skb); |
| 3339 | + data = (struct ethhdr *)skb->data; | |
| 3307 | 3340 | s = &ipv6h->saddr.s6_addr32[0]; |
| 3308 | 3341 | d = &ipv6h->daddr.s6_addr32[0]; |
| 3309 | 3342 | v6hash = (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]); |
| @@ -3322,33 +3355,36 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count) · 12 unmodified lines | ||
| 3322 | 3355 | static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count) |
| 3323 | 3356 | { |
| 3324 | 3357 | u32 layer4_xor = 0; |
| 3325 | − struct iphdr *iph; | |
| 3326 | − struct ipv6hdr *ipv6h; | |
| 3327 | − __be32 *s, *d; | |
| 3328 | − __be16 *layer4hdr; | |
| 3358 | + const struct iphdr *iph; | |
| 3359 | + const struct ipv6hdr *ipv6h; | |
| 3360 | + const __be32 *s, *d; | |
| 3361 | + const __be16 *l4 = NULL; | |
| 3362 | + __be16 _l4[2]; | |
| 3363 | + int noff = skb_network_offset(skb); | |
| 3364 | + int poff; | |
| 3329 | 3365 | |
| 3330 | 3366 | if (skb->protocol == htons(ETH_P_IP) && |
| 3331 | − skb_network_header_len(skb) >= sizeof(*iph)) { | |
| 3367 | + pskb_may_pull(skb, noff + sizeof(*iph))) { | |
| 3332 | 3368 | iph = ip_hdr(skb); |
| 3333 | − if (!ip_is_fragment(iph) && | |
| 3334 | − (iph->protocol == IPPROTO_TCP || | |
| 3335 | − iph->protocol == IPPROTO_UDP) && | |
| 3336 | − (skb_headlen(skb) - skb_network_offset(skb) >= | |
| 3337 | − iph->ihl * sizeof(u32) + sizeof(*layer4hdr) * 2)) { | |
| 3338 | − layer4hdr = (__be16 *)((u32 *)iph + iph->ihl); | |
| 3339 | − layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1)); | |
| 3369 | + poff = proto_ports_offset(iph->protocol); | |
| 3370 | + | |
| 3371 | + if (!ip_is_fragment(iph) && poff >= 0) { | |
| 3372 | + l4 = skb_header_pointer(skb, noff + (iph->ihl << 2) + poff, | |
| 3373 | + sizeof(_l4), &_l4); | |
| 3374 | + if (l4) | |
| 3375 | + layer4_xor = ntohs(l4[0] ^ l4[1]); | |
| 3340 | 3376 | } |
| 3341 | 3377 | return (layer4_xor ^ |
| 3342 | 3378 | ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count; |
| 3343 | 3379 | } else if (skb->protocol == htons(ETH_P_IPV6) && |
| 3344 | − skb_network_header_len(skb) >= sizeof(*ipv6h)) { | |
| 3380 | + pskb_may_pull(skb, noff + sizeof(*ipv6h))) { | |
| 3345 | 3381 | ipv6h = ipv6_hdr(skb); |
| 3346 | − if ((ipv6h->nexthdr == IPPROTO_TCP || | |
| 3347 | − ipv6h->nexthdr == IPPROTO_UDP) && | |
| 3348 | − (skb_headlen(skb) - skb_network_offset(skb) >= | |
| 3349 | − sizeof(*ipv6h) + sizeof(*layer4hdr) * 2)) { | |
| 3350 | − layer4hdr = (__be16 *)(ipv6h + 1); | |
| 3351 | − layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1)); | |
| 3382 | + poff = proto_ports_offset(ipv6h->nexthdr); | |
| 3383 | + if (poff >= 0) { | |
| 3384 | + l4 = skb_header_pointer(skb, noff + sizeof(*ipv6h) + poff, | |
| 3385 | + sizeof(_l4), &_l4); | |
| 3386 | + if (l4) | |
| 3387 | + layer4_xor = ntohs(l4[0] ^ l4[1]); | |
| 3352 | 3388 | } |
| 3353 | 3389 | s = &ipv6h->saddr.s6_addr32[0]; |
| 3354 | 3390 | d = &ipv6h->daddr.s6_addr32[0]; |
| @@ -4882,9 +4918,18 @@ static int __net_init bond_net_init(struct net *net) · 1527 unmodified lines | ||
| 4882 | 4918 | static void __net_exit bond_net_exit(struct net *net) |
| 4883 | 4919 | { |
| 4884 | 4920 | struct bond_net *bn = net_generic(net, bond_net_id); |
| 4921 | + struct bonding *bond, *tmp_bond; | |
| 4922 | + LIST_HEAD(list); | |
| 4885 | 4923 | |
| 4886 | 4924 | bond_destroy_sysfs(bn); |
| 4887 | 4925 | bond_destroy_proc_dir(bn); |
| 4926 | + | |
| 4927 | + /* Kill off any bonds created after unregistering bond rtnl ops */ | |
| 4928 | + rtnl_lock(); | |
| 4929 | + list_for_each_entry_safe(bond, tmp_bond, &bn->dev_list, bond_list) | |
| 4930 | + unregister_netdevice_queue(bond->dev, &list); | |
| 4931 | + unregister_netdevice_many(&list); | |
| 4932 | + rtnl_unlock(); | |
| 4888 | 4933 | } |
| 4889 | 4934 | |
| 4890 | 4935 | static struct pernet_operations bond_net_ops = { |
| @@ -4938,8 +4983,8 @@ static void __exit bonding_exit(void) · 47 unmodified lines | ||
| 4938 | 4983 | |
| 4939 | 4984 | bond_destroy_debugfs(); |
| 4940 | 4985 | |
| 4941 | − unregister_pernet_subsys(&bond_net_ops); | |
| 4942 | 4986 | rtnl_link_unregister(&bond_link_ops); |
| 4987 | + unregister_pernet_subsys(&bond_net_ops); | |
| 4943 | 4988 | |
| 4944 | 4989 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 4945 | 4990 | /* |
| @@ -929,6 +929,7 @@ static int mcp251x_open(struct net_device *net) · 928 unmodified lines | ||
| 929 | 929 | struct mcp251x_priv *priv = netdev_priv(net); |
| 930 | 930 | struct spi_device *spi = priv->spi; |
| 931 | 931 | struct mcp251x_platform_data *pdata = spi->dev.platform_data; |
| 932 | + unsigned long flags; | |
| 932 | 933 | int ret; |
| 933 | 934 | |
| 934 | 935 | ret = open_candev(net); |
| @@ -945,9 +946,14 @@ static int mcp251x_open(struct net_device *net) · 10 unmodified lines | ||
| 945 | 946 | priv->tx_skb = NULL; |
| 946 | 947 | priv->tx_len = 0; |
| 947 | 948 | |
| 949 | + flags = IRQF_ONESHOT; | |
| 950 | + if (pdata->irq_flags) | |
| 951 | + flags |= pdata->irq_flags; | |
| 952 | + else | |
| 953 | + flags |= IRQF_TRIGGER_FALLING; | |
| 954 | + | |
| 948 | 955 | ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, |
| 949 | − pdata->irq_flags ? pdata->irq_flags : IRQF_TRIGGER_FALLING, | |
| 950 | − DEVICE_NAME, priv); | |
| 956 | + flags, DEVICE_NAME, priv); | |
| 951 | 957 | if (ret) { |
| 952 | 958 | dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); |
| 953 | 959 | if (pdata->transceiver_enable) |
| @@ -96,8 +96,8 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) · 95 unmodified lines | ||
| 96 | 96 | struct net_device *dev; |
| 97 | 97 | struct sja1000_priv *priv; |
| 98 | 98 | struct resource res; |
| 99 | − const u32 *prop; | |
| 100 | − int err, irq, res_size, prop_size; | |
| 99 | + u32 prop; | |
| 100 | + int err, irq, res_size; | |
| 101 | 101 | void __iomem *base; |
| 102 | 102 | |
| 103 | 103 | err = of_address_to_resource(np, 0, &res); |
| @@ -138,27 +138,27 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) · 34 unmodified lines | ||
| 138 | 138 | priv->read_reg = sja1000_ofp_read_reg; |
| 139 | 139 | priv->write_reg = sja1000_ofp_write_reg; |
| 140 | 140 | |
| 141 | − prop = of_get_property(np, "nxp,external-clock-frequency", &prop_size); | |
| 142 | − if (prop && (prop_size == sizeof(u32))) | |
| 143 | − priv->can.clock.freq = *prop / 2; | |
| 141 | + err = of_property_read_u32(np, "nxp,external-clock-frequency", &prop); | |
| 142 | + if (!err) | |
| 143 | + priv->can.clock.freq = prop / 2; | |
| 144 | 144 | else |
| 145 | 145 | priv->can.clock.freq = SJA1000_OFP_CAN_CLOCK; /* default */ |
| 146 | 146 | |
| 147 | − prop = of_get_property(np, "nxp,tx-output-mode", &prop_size); | |
| 148 | − if (prop && (prop_size == sizeof(u32))) | |
| 149 | − priv->ocr |= *prop & OCR_MODE_MASK; | |
| 147 | + err = of_property_read_u32(np, "nxp,tx-output-mode", &prop); | |
| 148 | + if (!err) | |
| 149 | + priv->ocr |= prop & OCR_MODE_MASK; | |
| 150 | 150 | else |
| 151 | 151 | priv->ocr |= OCR_MODE_NORMAL; /* default */ |
| 152 | 152 | |
| 153 | − prop = of_get_property(np, "nxp,tx-output-config", &prop_size); | |
| 154 | − if (prop && (prop_size == sizeof(u32))) | |
| 155 | − priv->ocr |= (*prop << OCR_TX_SHIFT) & OCR_TX_MASK; | |
| 153 | + err = of_property_read_u32(np, "nxp,tx-output-config", &prop); | |
| 154 | + if (!err) | |
| 155 | + priv->ocr |= (prop << OCR_TX_SHIFT) & OCR_TX_MASK; | |
| 156 | 156 | else |
| 157 | 157 | priv->ocr |= OCR_TX0_PULLDOWN; /* default */ |
| 158 | 158 | |
| 159 | − prop = of_get_property(np, "nxp,clock-out-frequency", &prop_size); | |
| 160 | − if (prop && (prop_size == sizeof(u32)) && *prop) { | |
| 161 | − u32 divider = priv->can.clock.freq * 2 / *prop; | |
| 159 | + err = of_property_read_u32(np, "nxp,clock-out-frequency", &prop); | |
| 160 | + if (!err && prop) { | |
| 161 | + u32 divider = priv->can.clock.freq * 2 / prop; | |
| 162 | 162 | |
| 163 | 163 | if (divider > 1) |
| 164 | 164 | priv->cdr |= divider / 2 - 1; |
| @@ -168,8 +168,7 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) · 3 unmodified lines | ||
| 168 | 168 | priv->cdr |= CDR_CLK_OFF; /* default */ |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | − prop = of_get_property(np, "nxp,no-comparator-bypass", NULL); | |
| 172 | − if (!prop) | |
| 171 | + if (!of_property_read_bool(np, "nxp,no-comparator-bypass")) | |
| 173 | 172 | priv->cdr |= CDR_CBP; /* default */ |
| 174 | 173 | |
| 175 | 174 | priv->irq_flags = IRQF_SHARED; |
| @@ -828,7 +828,7 @@ static int ax_probe(struct platform_device *pdev) · 827 unmodified lines | ||
| 828 | 828 | struct ei_device *ei_local; |
| 829 | 829 | struct ax_device *ax; |
| 830 | 830 | struct resource *irq, *mem, *mem2; |
| 831 | − resource_size_t mem_size, mem2_size = 0; | |
| 831 | + unsigned long mem_size, mem2_size = 0; | |
| 832 | 832 | int ret = 0; |
| 833 | 833 | |
| 834 | 834 | dev = ax__alloc_ei_netdev(sizeof(struct ax_device)); |
| @@ -2615,6 +2615,9 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 2614 unmodified lines | ||
| 2615 | 2615 | } |
| 2616 | 2616 | } |
| 2617 | 2617 | |
| 2618 | + /* initialize FW coalescing state machines in RAM */ | |
| 2619 | + bnx2x_update_coalesce(bp); | |
| 2620 | + | |
| 2618 | 2621 | /* setup the leading queue */ |
| 2619 | 2622 | rc = bnx2x_setup_leading(bp); |
| 2620 | 2623 | if (rc) { |
| @@ -4737,11 +4740,11 @@ static void storm_memset_hc_disable(struct bnx2x *bp, u8 port, · 2116 unmodified lines | ||
| 4737 | 4740 | u32 enable_flag = disable ? 0 : (1 << HC_INDEX_DATA_HC_ENABLED_SHIFT); |
| 4738 | 4741 | u32 addr = BAR_CSTRORM_INTMEM + |
| 4739 | 4742 | CSTORM_STATUS_BLOCK_DATA_FLAGS_OFFSET(fw_sb_id, sb_index); |
| 4740 | − u16 flags = REG_RD16(bp, addr); | |
| 4743 | + u8 flags = REG_RD8(bp, addr); | |
| 4741 | 4744 | /* clear and set */ |
| 4742 | 4745 | flags &= ~HC_INDEX_DATA_HC_ENABLED; |
| 4743 | 4746 | flags |= enable_flag; |
| 4744 | − REG_WR16(bp, addr, flags); | |
| 4747 | + REG_WR8(bp, addr, flags); | |
| 4745 | 4748 | DP(NETIF_MSG_IFUP, |
| 4746 | 4749 | "port %x fw_sb_id %d sb_index %d disable %d\n", |
| 4747 | 4750 | port, fw_sb_id, sb_index, disable); |
| @@ -4959,7 +4959,7 @@ static void bnx2x_after_function_update(struct bnx2x *bp) · 4958 unmodified lines | ||
| 4959 | 4959 | q); |
| 4960 | 4960 | } |
| 4961 | 4961 | |
| 4962 | − if (!NO_FCOE(bp)) { | |
| 4962 | + if (!NO_FCOE(bp) && CNIC_ENABLED(bp)) { | |
| 4963 | 4963 | fp = &bp->fp[FCOE_IDX(bp)]; |
| 4964 | 4964 | queue_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj; |
| 4965 | 4965 | |
| @@ -9946,6 +9946,10 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp) · 4980 unmodified lines | ||
| 9946 | 9946 | REG_RD(bp, NIG_REG_NIG_INT_STS_CLR_0); |
| 9947 | 9947 | } |
| 9948 | 9948 | } |
| 9949 | + if (!CHIP_IS_E1x(bp)) | |
| 9950 | + /* block FW from writing to host */ | |
| 9951 | + REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_MASTER, 0); | |
| 9952 | + | |
| 9949 | 9953 | /* wait until BRB is empty */ |
| 9950 | 9954 | tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS); |
| 9951 | 9955 | while (timer_count) { |
| @@ -13450,6 +13454,7 @@ static int bnx2x_unregister_cnic(struct net_device *dev) · 3498 unmodified lines | ||
| 13450 | 13454 | RCU_INIT_POINTER(bp->cnic_ops, NULL); |
| 13451 | 13455 | mutex_unlock(&bp->cnic_mutex); |
| 13452 | 13456 | synchronize_rcu(); |
| 13457 | + bp->cnic_enabled = false; | |
| 13453 | 13458 | kfree(bp->cnic_kwq); |
| 13454 | 13459 | bp->cnic_kwq = NULL; |
| 13455 | 13460 | |
| @@ -772,8 +772,9 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter, · 771 unmodified lines | ||
| 772 | 772 | |
| 773 | 773 | if (vlan_tx_tag_present(skb)) { |
| 774 | 774 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); |
| 775 | − __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); | |
| 776 | − skb->vlan_tci = 0; | |
| 775 | + skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); | |
| 776 | + if (skb) | |
| 777 | + skb->vlan_tci = 0; | |
| 777 | 778 | } |
| 778 | 779 | |
| 779 | 780 | return skb; |
| @@ -997,6 +997,7 @@ static void fec_enet_adjust_link(struct net_device *ndev) · 996 unmodified lines | ||
| 997 | 997 | } else { |
| 998 | 998 | if (fep->link) { |
| 999 | 999 | fec_stop(ndev); |
| 1000 | + fep->link = phy_dev->link; | |
| 1000 | 1001 | status_change = 1; |
| 1001 | 1002 | } |
| 1002 | 1003 | } |
| @@ -870,7 +870,7 @@ err_unlock: · 869 unmodified lines | ||
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | static int e100_exec_cb(struct nic *nic, struct sk_buff *skb, |
| 873 | − void (*cb_prepare)(struct nic *, struct cb *, struct sk_buff *)) | |
| 873 | + int (*cb_prepare)(struct nic *, struct cb *, struct sk_buff *)) | |
| 874 | 874 | { |
| 875 | 875 | struct cb *cb; |
| 876 | 876 | unsigned long flags; |
| @@ -888,10 +888,13 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb, · 11 unmodified lines | ||
| 888 | 888 | nic->cbs_avail--; |
| 889 | 889 | cb->skb = skb; |
| 890 | 890 | |
| 891 | + err = cb_prepare(nic, cb, skb); | |
| 892 | + if (err) | |
| 893 | + goto err_unlock; | |
| 894 | + | |
| 891 | 895 | if (unlikely(!nic->cbs_avail)) |
| 892 | 896 | err = -ENOSPC; |
| 893 | 897 | |
| 894 | − cb_prepare(nic, cb, skb); | |
| 895 | 898 | |
| 896 | 899 | /* Order is important otherwise we'll be in a race with h/w: |
| 897 | 900 | * set S-bit in current first, then clear S-bit in previous. */ |
| @@ -1091,7 +1094,7 @@ static void e100_get_defaults(struct nic *nic) · 193 unmodified lines | ||
| 1091 | 1094 | nic->mii.mdio_write = mdio_write; |
| 1092 | 1095 | } |
| 1093 | 1096 | |
| 1094 | −static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |
| 1097 | +static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |
| 1095 | 1098 | { |
| 1096 | 1099 | struct config *config = &cb->u.config; |
| 1097 | 1100 | u8 *c = (u8 *)config; |
| @@ -1181,6 +1184,7 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) · 83 unmodified lines | ||
| 1181 | 1184 | netif_printk(nic, hw, KERN_DEBUG, nic->netdev, |
| 1182 | 1185 | "[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", |
| 1183 | 1186 | c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); |
| 1187 | + return 0; | |
| 1184 | 1188 | } |
| 1185 | 1189 | |
| 1186 | 1190 | /************************************************************************* |
| @@ -1331,7 +1335,7 @@ static const struct firmware *e100_request_firmware(struct nic *nic) · 144 unmodified lines | ||
| 1331 | 1335 | return fw; |
| 1332 | 1336 | } |
| 1333 | 1337 | |
| 1334 | −static void e100_setup_ucode(struct nic *nic, struct cb *cb, | |
| 1338 | +static int e100_setup_ucode(struct nic *nic, struct cb *cb, | |
| 1335 | 1339 | struct sk_buff *skb) |
| 1336 | 1340 | { |
| 1337 | 1341 | const struct firmware *fw = (void *)skb; |
| @@ -1358,6 +1362,7 @@ static void e100_setup_ucode(struct nic *nic, struct cb *cb, · 20 unmodified lines | ||
| 1358 | 1362 | cb->u.ucode[min_size] |= cpu_to_le32((BUNDLESMALL) ? 0xFFFF : 0xFF80); |
| 1359 | 1363 | |
| 1360 | 1364 | cb->command = cpu_to_le16(cb_ucode | cb_el); |
| 1365 | + return 0; | |
| 1361 | 1366 | } |
| 1362 | 1367 | |
| 1363 | 1368 | static inline int e100_load_ucode_wait(struct nic *nic) |
| @@ -1400,18 +1405,20 @@ static inline int e100_load_ucode_wait(struct nic *nic) · 36 unmodified lines | ||
| 1400 | 1405 | return err; |
| 1401 | 1406 | } |
| 1402 | 1407 | |
| 1403 | −static void e100_setup_iaaddr(struct nic *nic, struct cb *cb, | |
| 1408 | +static int e100_setup_iaaddr(struct nic *nic, struct cb *cb, | |
| 1404 | 1409 | struct sk_buff *skb) |
| 1405 | 1410 | { |
| 1406 | 1411 | cb->command = cpu_to_le16(cb_iaaddr); |
| 1407 | 1412 | memcpy(cb->u.iaaddr, nic->netdev->dev_addr, ETH_ALEN); |
| 1413 | + return 0; | |
| 1408 | 1414 | } |
| 1409 | 1415 | |
| 1410 | −static void e100_dump(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |
| 1416 | +static int e100_dump(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |
| 1411 | 1417 | { |
| 1412 | 1418 | cb->command = cpu_to_le16(cb_dump); |
| 1413 | 1419 | cb->u.dump_buffer_addr = cpu_to_le32(nic->dma_addr + |
| 1414 | 1420 | offsetof(struct mem, dump_buf)); |
| 1421 | + return 0; | |
| 1415 | 1422 | } |
| 1416 | 1423 | |
| 1417 | 1424 | static int e100_phy_check_without_mii(struct nic *nic) |
| @@ -1581,7 +1588,7 @@ static int e100_hw_init(struct nic *nic) · 163 unmodified lines | ||
| 1581 | 1588 | return 0; |
| 1582 | 1589 | } |
| 1583 | 1590 | |
| 1584 | −static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |
| 1591 | +static int e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |
| 1585 | 1592 | { |
| 1586 | 1593 | struct net_device *netdev = nic->netdev; |
| 1587 | 1594 | struct netdev_hw_addr *ha; |
| @@ -1596,6 +1603,7 @@ static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) · 8 unmodified lines | ||
| 1596 | 1603 | memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &ha->addr, |
| 1597 | 1604 | ETH_ALEN); |
| 1598 | 1605 | } |
| 1606 | + return 0; | |
| 1599 | 1607 | } |
| 1600 | 1608 | |
| 1601 | 1609 | static void e100_set_multicast_list(struct net_device *netdev) |
| @@ -1756,11 +1764,18 @@ static void e100_watchdog(unsigned long data) · 154 unmodified lines | ||
| 1756 | 1764 | round_jiffies(jiffies + E100_WATCHDOG_PERIOD)); |
| 1757 | 1765 | } |
| 1758 | 1766 | |
| 1759 | −static void e100_xmit_prepare(struct nic *nic, struct cb *cb, | |
| 1767 | +static int e100_xmit_prepare(struct nic *nic, struct cb *cb, | |
| 1760 | 1768 | struct sk_buff *skb) |
| 1761 | 1769 | { |
| 1770 | + dma_addr_t dma_addr; | |
| 1762 | 1771 | cb->command = nic->tx_command; |
| 1763 | 1772 | |
| 1773 | + dma_addr = pci_map_single(nic->pdev, | |
| 1774 | + skb->data, skb->len, PCI_DMA_TODEVICE); | |
| 1775 | + /* If we can't map the skb, have the upper layer try later */ | |
| 1776 | + if (pci_dma_mapping_error(nic->pdev, dma_addr)) | |
| 1777 | + return -ENOMEM; | |
| 1778 | + | |
| 1764 | 1779 | /* |
| 1765 | 1780 | * Use the last 4 bytes of the SKB payload packet as the CRC, used for |
| 1766 | 1781 | * testing, ie sending frames with bad CRC. |
| @@ -1777,11 +1792,10 @@ static void e100_xmit_prepare(struct nic *nic, struct cb *cb, · 10 unmodified lines | ||
| 1777 | 1792 | cb->u.tcb.tcb_byte_count = 0; |
| 1778 | 1793 | cb->u.tcb.threshold = nic->tx_threshold; |
| 1779 | 1794 | cb->u.tcb.tbd_count = 1; |
| 1780 | − cb->u.tcb.tbd.buf_addr = cpu_to_le32(pci_map_single(nic->pdev, | |
| 1781 | − skb->data, skb->len, PCI_DMA_TODEVICE)); | |
| 1782 | − /* check for mapping failure? */ | |
| 1795 | + cb->u.tcb.tbd.buf_addr = cpu_to_le32(dma_addr); | |
| 1783 | 1796 | cb->u.tcb.tbd.size = cpu_to_le16(skb->len); |
| 1784 | 1797 | skb_tx_timestamp(skb); |
| 1798 | + return 0; | |
| 1785 | 1799 | } |
| 1786 | 1800 | |
| 1787 | 1801 | static netdev_tx_t e100_xmit_frame(struct sk_buff *skb, |
| @@ -293,18 +293,10 @@ struct igb_q_vector { · 292 unmodified lines | ||
| 293 | 293 | enum e1000_ring_flags_t { |
| 294 | 294 | IGB_RING_FLAG_RX_SCTP_CSUM, |
| 295 | 295 | IGB_RING_FLAG_RX_LB_VLAN_BSWAP, |
| 296 | − IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, | |
| 297 | 296 | IGB_RING_FLAG_TX_CTX_IDX, |
| 298 | 297 | IGB_RING_FLAG_TX_DETECT_HANG |
| 299 | 298 | }; |
| 300 | 299 | |
| 301 | −#define ring_uses_build_skb(ring) \ | |
| 302 | − test_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) | |
| 303 | −#define set_ring_build_skb_enabled(ring) \ | |
| 304 | − set_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) | |
| 305 | −#define clear_ring_build_skb_enabled(ring) \ | |
| 306 | − clear_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) | |
| 307 | − | |
| 308 | 300 | #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS) |
| 309 | 301 | |
| 310 | 302 | #define IGB_RX_DESC(R, i) \ |
| @@ -3387,20 +3387,6 @@ void igb_configure_rx_ring(struct igb_adapter *adapter, · 3386 unmodified lines | ||
| 3387 | 3387 | wr32(E1000_RXDCTL(reg_idx), rxdctl); |
| 3388 | 3388 | } |
| 3389 | 3389 | |
| 3390 | −static void igb_set_rx_buffer_len(struct igb_adapter *adapter, | |
| 3391 | − struct igb_ring *rx_ring) | |
| 3392 | −{ | |
| 3393 | −#define IGB_MAX_BUILD_SKB_SIZE \ | |
| 3394 | − (SKB_WITH_OVERHEAD(IGB_RX_BUFSZ) - \ | |
| 3395 | − (NET_SKB_PAD + NET_IP_ALIGN + IGB_TS_HDR_LEN)) | |
| 3396 | − | |
| 3397 | − /* set build_skb flag */ | |
| 3398 | − if (adapter->max_frame_size <= IGB_MAX_BUILD_SKB_SIZE) | |
| 3399 | − set_ring_build_skb_enabled(rx_ring); | |
| 3400 | − else | |
| 3401 | − clear_ring_build_skb_enabled(rx_ring); | |
| 3402 | −} | |
| 3403 | − | |
| 3404 | 3390 | /** |
| 3405 | 3391 | * igb_configure_rx - Configure receive Unit after Reset |
| 3406 | 3392 | * @adapter: board private structure |
| @@ -3421,11 +3407,8 @@ static void igb_configure_rx(struct igb_adapter *adapter) · 14 unmodified lines | ||
| 3421 | 3407 | /* Setup the HW Rx Head and Tail Descriptor Pointers and |
| 3422 | 3408 | * the Base and Length of the Rx Descriptor Ring |
| 3423 | 3409 | */ |
| 3424 | − for (i = 0; i < adapter->num_rx_queues; i++) { | |
| 3425 | − struct igb_ring *rx_ring = adapter->rx_ring[i]; | |
| 3426 | − igb_set_rx_buffer_len(adapter, rx_ring); | |
| 3427 | − igb_configure_rx_ring(adapter, rx_ring); | |
| 3428 | − } | |
| 3410 | + for (i = 0; i < adapter->num_rx_queues; i++) | |
| 3411 | + igb_configure_rx_ring(adapter, adapter->rx_ring[i]); | |
| 3429 | 3412 | } |
| 3430 | 3413 | |
| 3431 | 3414 | /** |
| @@ -6238,78 +6221,6 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring, · 2806 unmodified lines | ||
| 6238 | 6221 | return igb_can_reuse_rx_page(rx_buffer, page, truesize); |
| 6239 | 6222 | } |
| 6240 | 6223 | |
| 6241 | −static struct sk_buff *igb_build_rx_buffer(struct igb_ring *rx_ring, | |
| 6242 | − union e1000_adv_rx_desc *rx_desc) | |
| 6243 | −{ | |
| 6244 | − struct igb_rx_buffer *rx_buffer; | |
| 6245 | − struct sk_buff *skb; | |
| 6246 | − struct page *page; | |
| 6247 | − void *page_addr; | |
| 6248 | − unsigned int size = le16_to_cpu(rx_desc->wb.upper.length); | |
| 6249 | −#if (PAGE_SIZE < 8192) | |
| 6250 | − unsigned int truesize = IGB_RX_BUFSZ; | |
| 6251 | −#else | |
| 6252 | − unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + | |
| 6253 | − SKB_DATA_ALIGN(NET_SKB_PAD + | |
| 6254 | − NET_IP_ALIGN + | |
| 6255 | − size); | |
| 6256 | −#endif | |
| 6257 | − | |
| 6258 | − /* If we spanned a buffer we have a huge mess so test for it */ | |
| 6259 | − BUG_ON(unlikely(!igb_test_staterr(rx_desc, E1000_RXD_STAT_EOP))); | |
| 6260 | − | |
| 6261 | − rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean]; | |
| 6262 | − page = rx_buffer->page; | |
| 6263 | − prefetchw(page); | |
| 6264 | − | |
| 6265 | − page_addr = page_address(page) + rx_buffer->page_offset; | |
| 6266 | − | |
| 6267 | − /* prefetch first cache line of first page */ | |
| 6268 | − prefetch(page_addr + NET_SKB_PAD + NET_IP_ALIGN); | |
| 6269 | −#if L1_CACHE_BYTES < 128 | |
| 6270 | − prefetch(page_addr + L1_CACHE_BYTES + NET_SKB_PAD + NET_IP_ALIGN); | |
| 6271 | −#endif | |
| 6272 | − | |
| 6273 | − /* build an skb to around the page buffer */ | |
| 6274 | − skb = build_skb(page_addr, truesize); | |
| 6275 | − if (unlikely(!skb)) { | |
| 6276 | − rx_ring->rx_stats.alloc_failed++; | |
| 6277 | − return NULL; | |
| 6278 | − } | |
| 6279 | − | |
| 6280 | − /* we are reusing so sync this buffer for CPU use */ | |
| 6281 | − dma_sync_single_range_for_cpu(rx_ring->dev, | |
| 6282 | − rx_buffer->dma, | |
| 6283 | − rx_buffer->page_offset, | |
| 6284 | − IGB_RX_BUFSZ, | |
| 6285 | − DMA_FROM_DEVICE); | |
| 6286 | − | |
| 6287 | − /* update pointers within the skb to store the data */ | |
| 6288 | − skb_reserve(skb, NET_IP_ALIGN + NET_SKB_PAD); | |
| 6289 | − __skb_put(skb, size); | |
| 6290 | − | |
| 6291 | − /* pull timestamp out of packet data */ | |
| 6292 | − if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { | |
| 6293 | − igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb); | |
| 6294 | − __skb_pull(skb, IGB_TS_HDR_LEN); | |
| 6295 | − } | |
| 6296 | − | |
| 6297 | − if (igb_can_reuse_rx_page(rx_buffer, page, truesize)) { | |
| 6298 | − /* hand second half of page back to the ring */ | |
| 6299 | − igb_reuse_rx_page(rx_ring, rx_buffer); | |
| 6300 | − } else { | |
| 6301 | − /* we are not reusing the buffer so unmap it */ | |
| 6302 | − dma_unmap_page(rx_ring->dev, rx_buffer->dma, | |
| 6303 | − PAGE_SIZE, DMA_FROM_DEVICE); | |
| 6304 | − } | |
| 6305 | − | |
| 6306 | − /* clear contents of buffer_info */ | |
| 6307 | − rx_buffer->dma = 0; | |
| 6308 | − rx_buffer->page = NULL; | |
| 6309 | − | |
| 6310 | − return skb; | |
| 6311 | −} | |
| 6312 | − | |
| 6313 | 6224 | static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring, |
| 6314 | 6225 | union e1000_adv_rx_desc *rx_desc, |
| 6315 | 6226 | struct sk_buff *skb) |
| @@ -6719,10 +6630,7 @@ static bool igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 403 unmodified lines | ||
| 6719 | 6630 | rmb(); |
| 6720 | 6631 | |
| 6721 | 6632 | /* retrieve a buffer from the ring */ |
| 6722 | − if (ring_uses_build_skb(rx_ring)) | |
| 6723 | − skb = igb_build_rx_buffer(rx_ring, rx_desc); | |
| 6724 | − else | |
| 6725 | − skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb); | |
| 6633 | + skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb); | |
| 6726 | 6634 | |
| 6727 | 6635 | /* exit if we failed to retrieve a buffer */ |
| 6728 | 6636 | if (!skb) |
| @@ -6808,14 +6716,6 @@ static bool igb_alloc_mapped_page(struct igb_ring *rx_ring, · 79 unmodified lines | ||
| 6808 | 6716 | return true; |
| 6809 | 6717 | } |
| 6810 | 6718 | |
| 6811 | −static inline unsigned int igb_rx_offset(struct igb_ring *rx_ring) | |
| 6812 | −{ | |
| 6813 | − if (ring_uses_build_skb(rx_ring)) | |
| 6814 | − return NET_SKB_PAD + NET_IP_ALIGN; | |
| 6815 | − else | |
| 6816 | − return 0; | |
| 6817 | −} | |
| 6818 | − | |
| 6819 | 6719 | /** |
| 6820 | 6720 | * igb_alloc_rx_buffers - Replace used receive buffers; packet split |
| 6821 | 6721 | * @adapter: address of board private structure |
| @@ -6841,9 +6741,7 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count) · 19 unmodified lines | ||
| 6841 | 6741 | /* Refresh the desc even if buffer_addrs didn't change |
| 6842 | 6742 | * because each write-back erases this info. |
| 6843 | 6743 | */ |
| 6844 | − rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + | |
| 6845 | − bi->page_offset + | |
| 6846 | − igb_rx_offset(rx_ring)); | |
| 6744 | + rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + bi->page_offset); | |
| 6847 | 6745 | |
| 6848 | 6746 | rx_desc++; |
| 6849 | 6747 | bi++; |
| @@ -1052,6 +1052,12 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos) · 1051 unmodified lines | ||
| 1052 | 1052 | if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7)) |
| 1053 | 1053 | return -EINVAL; |
| 1054 | 1054 | if (vlan || qos) { |
| 1055 | + if (adapter->vfinfo[vf].pf_vlan) | |
| 1056 | + err = ixgbe_set_vf_vlan(adapter, false, | |
| 1057 | + adapter->vfinfo[vf].pf_vlan, | |
| 1058 | + vf); | |
| 1059 | + if (err) | |
| 1060 | + goto out; | |
| 1055 | 1061 | err = ixgbe_set_vf_vlan(adapter, true, vlan, vf); |
| 1056 | 1062 | if (err) |
| 1057 | 1063 | goto out; |
| @@ -33,6 +33,7 @@ config MV643XX_ETH · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | config MVMDIO |
| 35 | 35 | tristate "Marvell MDIO interface support" |
| 36 | + select PHYLIB | |
| 36 | 37 | ---help--- |
| 37 | 38 | This driver supports the MDIO interface found in the network |
| 38 | 39 | interface units of the Marvell EBU SoCs (Kirkwood, Orion5x, |
| @@ -43,7 +44,6 @@ config MVMDIO · 4 unmodified lines | ||
| 43 | 44 | config MVNETA |
| 44 | 45 | tristate "Marvell Armada 370/XP network interface support" |
| 45 | 46 | depends on MACH_ARMADA_370_XP |
| 46 | − select PHYLIB | |
| 47 | 47 | select MVMDIO |
| 48 | 48 | ---help--- |
| 49 | 49 | This driver supports the network interface units in the |
| @@ -374,7 +374,6 @@ static int rxq_number = 8; · 373 unmodified lines | ||
| 374 | 374 | static int txq_number = 8; |
| 375 | 375 | |
| 376 | 376 | static int rxq_def; |
| 377 | −static int txq_def; | |
| 378 | 377 | |
| 379 | 378 | #define MVNETA_DRIVER_NAME "mvneta" |
| 380 | 379 | #define MVNETA_DRIVER_VERSION "1.0" |
| @@ -1475,7 +1474,8 @@ error: · 1094 unmodified lines | ||
| 1475 | 1474 | static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) |
| 1476 | 1475 | { |
| 1477 | 1476 | struct mvneta_port *pp = netdev_priv(dev); |
| 1478 | − struct mvneta_tx_queue *txq = &pp->txqs[txq_def]; | |
| 1477 | + u16 txq_id = skb_get_queue_mapping(skb); | |
| 1478 | + struct mvneta_tx_queue *txq = &pp->txqs[txq_id]; | |
| 1479 | 1479 | struct mvneta_tx_desc *tx_desc; |
| 1480 | 1480 | struct netdev_queue *nq; |
| 1481 | 1481 | int frags = 0; |
| @@ -1485,7 +1485,7 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) · 3 unmodified lines | ||
| 1485 | 1485 | goto out; |
| 1486 | 1486 | |
| 1487 | 1487 | frags = skb_shinfo(skb)->nr_frags + 1; |
| 1488 | − nq = netdev_get_tx_queue(dev, txq_def); | |
| 1488 | + nq = netdev_get_tx_queue(dev, txq_id); | |
| 1489 | 1489 | |
| 1490 | 1490 | /* Get a descriptor for the first part of the packet */ |
| 1491 | 1491 | tx_desc = mvneta_txq_next_desc_get(txq); |
| @@ -2679,7 +2679,7 @@ static int mvneta_probe(struct platform_device *pdev) · 1187 unmodified lines | ||
| 2679 | 2679 | return -EINVAL; |
| 2680 | 2680 | } |
| 2681 | 2681 | |
| 2682 | − dev = alloc_etherdev_mq(sizeof(struct mvneta_port), 8); | |
| 2682 | + dev = alloc_etherdev_mqs(sizeof(struct mvneta_port), txq_number, rxq_number); | |
| 2683 | 2683 | if (!dev) |
| 2684 | 2684 | return -ENOMEM; |
| 2685 | 2685 | |
| @@ -2761,16 +2761,17 @@ static int mvneta_probe(struct platform_device *pdev) · 75 unmodified lines | ||
| 2761 | 2761 | |
| 2762 | 2762 | netif_napi_add(dev, &pp->napi, mvneta_poll, pp->weight); |
| 2763 | 2763 | |
| 2764 | + dev->features = NETIF_F_SG | NETIF_F_IP_CSUM; | |
| 2765 | + dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM; | |
| 2766 | + dev->vlan_features |= NETIF_F_SG | NETIF_F_IP_CSUM; | |
| 2767 | + dev->priv_flags |= IFF_UNICAST_FLT; | |
| 2768 | + | |
| 2764 | 2769 | err = register_netdev(dev); |
| 2765 | 2770 | if (err < 0) { |
| 2766 | 2771 | dev_err(&pdev->dev, "failed to register\n"); |
| 2767 | 2772 | goto err_deinit; |
| 2768 | 2773 | } |
| 2769 | 2774 | |
| 2770 | − dev->features = NETIF_F_SG | NETIF_F_IP_CSUM; | |
| 2771 | − dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM; | |
| 2772 | − dev->priv_flags |= IFF_UNICAST_FLT; | |
| 2773 | − | |
| 2774 | 2775 | netdev_info(dev, "mac: %pM\n", dev->dev_addr); |
| 2775 | 2776 | |
| 2776 | 2777 | platform_set_drvdata(pdev, pp->dev); |
| @@ -2833,4 +2834,3 @@ module_param(rxq_number, int, S_IRUGO); · 56 unmodified lines | ||
| 2833 | 2834 | module_param(txq_number, int, S_IRUGO); |
| 2834 | 2835 | |
| 2835 | 2836 | module_param(rxq_def, int, S_IRUGO); |
| 2836 | −module_param(txq_def, int, S_IRUGO); | |
| @@ -1619,6 +1619,12 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode) · 1618 unmodified lines | ||
| 1619 | 1619 | } |
| 1620 | 1620 | } while ((adapter->ahw->linkup && ahw->has_link_events) != 1); |
| 1621 | 1621 | |
| 1622 | + /* Make sure carrier is off and queue is stopped during loopback */ | |
| 1623 | + if (netif_running(netdev)) { | |
| 1624 | + netif_carrier_off(netdev); | |
| 1625 | + netif_stop_queue(netdev); | |
| 1626 | + } | |
| 1627 | + | |
| 1622 | 1628 | ret = qlcnic_do_lb_test(adapter, mode); |
| 1623 | 1629 | |
| 1624 | 1630 | qlcnic_83xx_clear_lb_mode(adapter, mode); |
| @@ -2944,6 +2950,7 @@ static u64 *qlcnic_83xx_fill_stats(struct qlcnic_adapter *adapter, · 1319 unmodified lines | ||
| 2944 | 2950 | void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) |
| 2945 | 2951 | { |
| 2946 | 2952 | struct qlcnic_cmd_args cmd; |
| 2953 | + struct net_device *netdev = adapter->netdev; | |
| 2947 | 2954 | int ret = 0; |
| 2948 | 2955 | |
| 2949 | 2956 | qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_STATISTICS); |
| @@ -2953,7 +2960,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) · 3 unmodified lines | ||
| 2953 | 2960 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, |
| 2954 | 2961 | QLC_83XX_STAT_TX, &ret); |
| 2955 | 2962 | if (ret) { |
| 2956 | − dev_info(&adapter->pdev->dev, "Error getting MAC stats\n"); | |
| 2963 | + netdev_err(netdev, "Error getting Tx stats\n"); | |
| 2957 | 2964 | goto out; |
| 2958 | 2965 | } |
| 2959 | 2966 | /* Get MAC stats */ |
| @@ -2963,8 +2970,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) · 3 unmodified lines | ||
| 2963 | 2970 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, |
| 2964 | 2971 | QLC_83XX_STAT_MAC, &ret); |
| 2965 | 2972 | if (ret) { |
| 2966 | − dev_info(&adapter->pdev->dev, | |
| 2967 | − "Error getting Rx stats\n"); | |
| 2973 | + netdev_err(netdev, "Error getting MAC stats\n"); | |
| 2968 | 2974 | goto out; |
| 2969 | 2975 | } |
| 2970 | 2976 | /* Get Rx stats */ |
| @@ -2974,8 +2980,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) · 3 unmodified lines | ||
| 2974 | 2980 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, |
| 2975 | 2981 | QLC_83XX_STAT_RX, &ret); |
| 2976 | 2982 | if (ret) |
| 2977 | − dev_info(&adapter->pdev->dev, | |
| 2978 | − "Error getting Tx stats\n"); | |
| 2983 | + netdev_err(netdev, "Error getting Rx stats\n"); | |
| 2979 | 2984 | out: |
| 2980 | 2985 | qlcnic_free_mbx_args(&cmd); |
| 2981 | 2986 | } |
| @@ -362,8 +362,7 @@ set_flags: · 361 unmodified lines | ||
| 362 | 362 | memcpy(&first_desc->eth_addr, skb->data, ETH_ALEN); |
| 363 | 363 | } |
| 364 | 364 | opcode = TX_ETHER_PKT; |
| 365 | − if ((adapter->netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && | |
| 366 | − skb_shinfo(skb)->gso_size > 0) { | |
| 365 | + if (skb_is_gso(skb)) { | |
| 367 | 366 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
| 368 | 367 | first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
| 369 | 368 | first_desc->total_hdr_length = hdr_len; |
| @@ -198,10 +198,10 @@ beacon_err: · 197 unmodified lines | ||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | err = qlcnic_config_led(adapter, b_state, b_rate); |
| 201 | − if (!err) | |
| 201 | + if (!err) { | |
| 202 | 202 | err = len; |
| 203 | − else | |
| 204 | 203 | ahw->beacon_state = b_state; |
| 204 | + } | |
| 205 | 205 | |
| 206 | 206 | if (test_and_clear_bit(__QLCNIC_DIAG_RES_ALLOC, &adapter->state)) |
| 207 | 207 | qlcnic_diag_free_res(adapter->netdev, max_sds_rings); |
| @@ -18,7 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | */ |
| 19 | 19 | #define DRV_NAME "qlge" |
| 20 | 20 | #define DRV_STRING "QLogic 10 Gigabit PCI-E Ethernet Driver " |
| 21 | −#define DRV_VERSION "v1.00.00.31" | |
| 21 | +#define DRV_VERSION "v1.00.00.32" | |
| 22 | 22 | |
| 23 | 23 | #define WQ_ADDR_ALIGN 0x3 /* 4 byte alignment */ |
| 24 | 24 | |
| @@ -379,13 +379,13 @@ static int ql_get_settings(struct net_device *ndev, · 378 unmodified lines | ||
| 379 | 379 | |
| 380 | 380 | ecmd->supported = SUPPORTED_10000baseT_Full; |
| 381 | 381 | ecmd->advertising = ADVERTISED_10000baseT_Full; |
| 382 | − ecmd->autoneg = AUTONEG_ENABLE; | |
| 383 | 382 | ecmd->transceiver = XCVR_EXTERNAL; |
| 384 | 383 | if ((qdev->link_status & STS_LINK_TYPE_MASK) == |
| 385 | 384 | STS_LINK_TYPE_10GBASET) { |
| 386 | 385 | ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); |
| 387 | 386 | ecmd->advertising |= (ADVERTISED_TP | ADVERTISED_Autoneg); |
| 388 | 387 | ecmd->port = PORT_TP; |
| 388 | + ecmd->autoneg = AUTONEG_ENABLE; | |
| 389 | 389 | } else { |
| 390 | 390 | ecmd->supported |= SUPPORTED_FIBRE; |
| 391 | 391 | ecmd->advertising |= ADVERTISED_FIBRE; |
| @@ -1432,11 +1432,13 @@ map_error: · 1431 unmodified lines | ||
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | 1434 | /* Categorizing receive firmware frame errors */ |
| 1435 | −static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err) | |
| 1435 | +static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err, | |
| 1436 | + struct rx_ring *rx_ring) | |
| 1436 | 1437 | { |
| 1437 | 1438 | struct nic_stats *stats = &qdev->nic_stats; |
| 1438 | 1439 | |
| 1439 | 1440 | stats->rx_err_count++; |
| 1441 | + rx_ring->rx_errors++; | |
| 1440 | 1442 | |
| 1441 | 1443 | switch (rx_err & IB_MAC_IOCB_RSP_ERR_MASK) { |
| 1442 | 1444 | case IB_MAC_IOCB_RSP_ERR_CODE_ERR: |
| @@ -1472,6 +1474,12 @@ static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev, · 29 unmodified lines | ||
| 1472 | 1474 | struct bq_desc *lbq_desc = ql_get_curr_lchunk(qdev, rx_ring); |
| 1473 | 1475 | struct napi_struct *napi = &rx_ring->napi; |
| 1474 | 1476 | |
| 1477 | + /* Frame error, so drop the packet. */ | |
| 1478 | + if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | |
| 1479 | + ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | |
| 1480 | + put_page(lbq_desc->p.pg_chunk.page); | |
| 1481 | + return; | |
| 1482 | + } | |
| 1475 | 1483 | napi->dev = qdev->ndev; |
| 1476 | 1484 | |
| 1477 | 1485 | skb = napi_get_frags(napi); |
| @@ -1525,6 +1533,12 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev, · 47 unmodified lines | ||
| 1525 | 1533 | addr = lbq_desc->p.pg_chunk.va; |
| 1526 | 1534 | prefetch(addr); |
| 1527 | 1535 | |
| 1536 | + /* Frame error, so drop the packet. */ | |
| 1537 | + if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | |
| 1538 | + ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | |
| 1539 | + goto err_out; | |
| 1540 | + } | |
| 1541 | + | |
| 1528 | 1542 | /* The max framesize filter on this chip is set higher than |
| 1529 | 1543 | * MTU since FCoE uses 2k frames. |
| 1530 | 1544 | */ |
| @@ -1608,6 +1622,13 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev, · 77 unmodified lines | ||
| 1608 | 1622 | memcpy(skb_put(new_skb, length), skb->data, length); |
| 1609 | 1623 | skb = new_skb; |
| 1610 | 1624 | |
| 1625 | + /* Frame error, so drop the packet. */ | |
| 1626 | + if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | |
| 1627 | + ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | |
| 1628 | + dev_kfree_skb_any(skb); | |
| 1629 | + return; | |
| 1630 | + } | |
| 1631 | + | |
| 1611 | 1632 | /* loopback self test for ethtool */ |
| 1612 | 1633 | if (test_bit(QL_SELFTEST, &qdev->flags)) { |
| 1613 | 1634 | ql_check_lb_frame(qdev, skb); |
| @@ -1913,6 +1934,13 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev, · 299 unmodified lines | ||
| 1913 | 1934 | return; |
| 1914 | 1935 | } |
| 1915 | 1936 | |
| 1937 | + /* Frame error, so drop the packet. */ | |
| 1938 | + if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | |
| 1939 | + ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | |
| 1940 | + dev_kfree_skb_any(skb); | |
| 1941 | + return; | |
| 1942 | + } | |
| 1943 | + | |
| 1916 | 1944 | /* The max framesize filter on this chip is set higher than |
| 1917 | 1945 | * MTU since FCoE uses 2k frames. |
| 1918 | 1946 | */ |
| @@ -1994,12 +2022,6 @@ static unsigned long ql_process_mac_rx_intr(struct ql_adapter *qdev, · 75 unmodified lines | ||
| 1994 | 2022 | |
| 1995 | 2023 | QL_DUMP_IB_MAC_RSP(ib_mac_rsp); |
| 1996 | 2024 | |
| 1997 | − /* Frame error, so drop the packet. */ | |
| 1998 | − if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | |
| 1999 | − ql_categorize_rx_err(qdev, ib_mac_rsp->flags2); | |
| 2000 | − return (unsigned long)length; | |
| 2001 | − } | |
| 2002 | − | |
| 2003 | 2025 | if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) { |
| 2004 | 2026 | /* The data and headers are split into |
| 2005 | 2027 | * separate buffers. |
| @@ -149,6 +149,7 @@ void dwmac_mmc_intr_all_mask(void __iomem *ioaddr) · 148 unmodified lines | ||
| 149 | 149 | { |
| 150 | 150 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_RX_INTR_MASK); |
| 151 | 151 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_TX_INTR_MASK); |
| 152 | + writel(MMC_DEFAULT_MASK, ioaddr + MMC_RX_IPC_INTR_MASK); | |
| 152 | 153 | } |
| 153 | 154 | |
| 154 | 155 | /* This reads the MAC core counters (if actaully supported). |
| @@ -1520,7 +1520,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, · 1519 unmodified lines | ||
| 1520 | 1520 | memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); |
| 1521 | 1521 | |
| 1522 | 1522 | if (data->dual_emac) { |
| 1523 | − if (of_property_read_u32(node, "dual_emac_res_vlan", | |
| 1523 | + if (of_property_read_u32(slave_node, "dual_emac_res_vlan", | |
| 1524 | 1524 | &prop)) { |
| 1525 | 1525 | pr_err("Missing dual_emac_res_vlan in DT.\n"); |
| 1526 | 1526 | slave_data->dual_emac_res_vlan = i+1; |
| @@ -470,8 +470,10 @@ static void netvsc_send_completion(struct hv_device *device, · 469 unmodified lines | ||
| 470 | 470 | packet->trans_id; |
| 471 | 471 | |
| 472 | 472 | /* Notify the layer above us */ |
| 473 | − nvsc_packet->completion.send.send_completion( | |
| 474 | − nvsc_packet->completion.send.send_completion_ctx); | |
| 473 | + if (nvsc_packet) | |
| 474 | + nvsc_packet->completion.send.send_completion( | |
| 475 | + nvsc_packet->completion.send. | |
| 476 | + send_completion_ctx); | |
| 475 | 477 | |
| 476 | 478 | num_outstanding_sends = |
| 477 | 479 | atomic_dec_return(&net_device->num_outstanding_sends); |
| @@ -498,6 +500,7 @@ int netvsc_send(struct hv_device *device, · 20 unmodified lines | ||
| 498 | 500 | int ret = 0; |
| 499 | 501 | struct nvsp_message sendMessage; |
| 500 | 502 | struct net_device *ndev; |
| 503 | + u64 req_id; | |
| 501 | 504 | |
| 502 | 505 | net_device = get_outbound_net_device(device); |
| 503 | 506 | if (!net_device) |
| @@ -518,20 +521,24 @@ int netvsc_send(struct hv_device *device, · 14 unmodified lines | ||
| 518 | 521 | 0xFFFFFFFF; |
| 519 | 522 | sendMessage.msg.v1_msg.send_rndis_pkt.send_buf_section_size = 0; |
| 520 | 523 | |
| 524 | + if (packet->completion.send.send_completion) | |
| 525 | + req_id = (u64)packet; | |
| 526 | + else | |
| 527 | + req_id = 0; | |
| 528 | + | |
| 521 | 529 | if (packet->page_buf_cnt) { |
| 522 | 530 | ret = vmbus_sendpacket_pagebuffer(device->channel, |
| 523 | 531 | packet->page_buf, |
| 524 | 532 | packet->page_buf_cnt, |
| 525 | 533 | &sendMessage, |
| 526 | 534 | sizeof(struct nvsp_message), |
| 527 | − (unsigned long)packet); | |
| 535 | + req_id); | |
| 528 | 536 | } else { |
| 529 | 537 | ret = vmbus_sendpacket(device->channel, &sendMessage, |
| 530 | 538 | sizeof(struct nvsp_message), |
| 531 | − (unsigned long)packet, | |
| 539 | + req_id, | |
| 532 | 540 | VM_PKT_DATA_INBAND, |
| 533 | 541 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
| 534 | − | |
| 535 | 542 | } |
| 536 | 543 | |
| 537 | 544 | if (ret == 0) { |
| @@ -241,13 +241,11 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, · 240 unmodified lines | ||
| 241 | 241 | |
| 242 | 242 | if (status == 1) { |
| 243 | 243 | netif_carrier_on(net); |
| 244 | − netif_wake_queue(net); | |
| 245 | 244 | ndev_ctx = netdev_priv(net); |
| 246 | 245 | schedule_delayed_work(&ndev_ctx->dwork, 0); |
| 247 | 246 | schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20)); |
| 248 | 247 | } else { |
| 249 | 248 | netif_carrier_off(net); |
| 250 | − netif_tx_disable(net); | |
| 251 | 249 | } |
| 252 | 250 | } |
| 253 | 251 | |
| @@ -61,9 +61,6 @@ struct rndis_request { · 60 unmodified lines | ||
| 61 | 61 | |
| 62 | 62 | static void rndis_filter_send_completion(void *ctx); |
| 63 | 63 | |
| 64 | −static void rndis_filter_send_request_completion(void *ctx); | |
| 65 | − | |
| 66 | − | |
| 67 | 64 | |
| 68 | 65 | static struct rndis_device *get_rndis_device(void) |
| 69 | 66 | { |
| @@ -241,10 +238,7 @@ static int rndis_filter_send_request(struct rndis_device *dev, · 171 unmodified lines | ||
| 241 | 238 | packet->page_buf[0].len; |
| 242 | 239 | } |
| 243 | 240 | |
| 244 | − packet->completion.send.send_completion_ctx = req;/* packet; */ | |
| 245 | − packet->completion.send.send_completion = | |
| 246 | − rndis_filter_send_request_completion; | |
| 247 | − packet->completion.send.send_completion_tid = (unsigned long)dev; | |
| 241 | + packet->completion.send.send_completion = NULL; | |
| 248 | 242 | |
| 249 | 243 | ret = netvsc_send(dev->net_dev->dev, packet); |
| 250 | 244 | return ret; |
| @@ -999,9 +993,3 @@ static void rndis_filter_send_completion(void *ctx) · 748 unmodified lines | ||
| 999 | 993 | /* Pass it back to the original handler */ |
| 1000 | 994 | filter_pkt->completion(filter_pkt->completion_ctx); |
| 1001 | 995 | } |
| 1002 | − | |
| 1003 | − | |
| 1004 | −static void rndis_filter_send_request_completion(void *ctx) | |
| 1005 | −{ | |
| 1006 | − /* Noop */ | |
| 1007 | −} | |
| @@ -1594,7 +1594,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) · 1593 unmodified lines | ||
| 1594 | 1594 | |
| 1595 | 1595 | if (tun->flags & TUN_TAP_MQ && |
| 1596 | 1596 | (tun->numqueues + tun->numdisabled > 1)) |
| 1597 | − return err; | |
| 1597 | + return -EBUSY; | |
| 1598 | 1598 | } |
| 1599 | 1599 | else { |
| 1600 | 1600 | char *name; |
| @@ -134,7 +134,7 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb · 133 unmodified lines | ||
| 134 | 134 | goto error; |
| 135 | 135 | |
| 136 | 136 | if (skb) { |
| 137 | − if (skb->len <= sizeof(ETH_HLEN)) | |
| 137 | + if (skb->len <= ETH_HLEN) | |
| 138 | 138 | goto error; |
| 139 | 139 | |
| 140 | 140 | /* mapping VLANs to MBIM sessions: |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <linux/module.h> |
| 14 | 14 | #include <linux/netdevice.h> |
| 15 | 15 | #include <linux/ethtool.h> |
| 16 | +#include <linux/etherdevice.h> | |
| 16 | 17 | #include <linux/mii.h> |
| 17 | 18 | #include <linux/usb.h> |
| 18 | 19 | #include <linux/usb/cdc.h> |
| @@ -52,6 +53,96 @@ struct qmi_wwan_state { · 33 unmodified lines | ||
| 52 | 53 | struct usb_interface *data; |
| 53 | 54 | }; |
| 54 | 55 | |
| 56 | +/* default ethernet address used by the modem */ | |
| 57 | +static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3}; | |
| 58 | + | |
| 59 | +/* Make up an ethernet header if the packet doesn't have one. | |
| 60 | + * | |
| 61 | + * A firmware bug common among several devices cause them to send raw | |
| 62 | + * IP packets under some circumstances. There is no way for the | |
| 63 | + * driver/host to know when this will happen. And even when the bug | |
| 64 | + * hits, some packets will still arrive with an intact header. | |
| 65 | + * | |
| 66 | + * The supported devices are only capably of sending IPv4, IPv6 and | |
| 67 | + * ARP packets on a point-to-point link. Any packet with an ethernet | |
| 68 | + * header will have either our address or a broadcast/multicast | |
| 69 | + * address as destination. ARP packets will always have a header. | |
| 70 | + * | |
| 71 | + * This means that this function will reliably add the appropriate | |
| 72 | + * header iff necessary, provided our hardware address does not start | |
| 73 | + * with 4 or 6. | |
| 74 | + * | |
| 75 | + * Another common firmware bug results in all packets being addressed | |
| 76 | + * to 00:a0:c6:00:00:00 despite the host address being different. | |
| 77 | + * This function will also fixup such packets. | |
| 78 | + */ | |
| 79 | +static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |
| 80 | +{ | |
| 81 | + __be16 proto; | |
| 82 | + | |
| 83 | + /* usbnet rx_complete guarantees that skb->len is at least | |
| 84 | + * hard_header_len, so we can inspect the dest address without | |
| 85 | + * checking skb->len | |
| 86 | + */ | |
| 87 | + switch (skb->data[0] & 0xf0) { | |
| 88 | + case 0x40: | |
| 89 | + proto = htons(ETH_P_IP); | |
| 90 | + break; | |
| 91 | + case 0x60: | |
| 92 | + proto = htons(ETH_P_IPV6); | |
| 93 | + break; | |
| 94 | + case 0x00: | |
| 95 | + if (is_multicast_ether_addr(skb->data)) | |
| 96 | + return 1; | |
| 97 | + /* possibly bogus destination - rewrite just in case */ | |
| 98 | + skb_reset_mac_header(skb); | |
| 99 | + goto fix_dest; | |
| 100 | + default: | |
| 101 | + /* pass along other packets without modifications */ | |
| 102 | + return 1; | |
| 103 | + } | |
| 104 | + if (skb_headroom(skb) < ETH_HLEN) | |
| 105 | + return 0; | |
| 106 | + skb_push(skb, ETH_HLEN); | |
| 107 | + skb_reset_mac_header(skb); | |
| 108 | + eth_hdr(skb)->h_proto = proto; | |
| 109 | + memset(eth_hdr(skb)->h_source, 0, ETH_ALEN); | |
| 110 | +fix_dest: | |
| 111 | + memcpy(eth_hdr(skb)->h_dest, dev->net->dev_addr, ETH_ALEN); | |
| 112 | + return 1; | |
| 113 | +} | |
| 114 | + | |
| 115 | +/* very simplistic detection of IPv4 or IPv6 headers */ | |
| 116 | +static bool possibly_iphdr(const char *data) | |
| 117 | +{ | |
| 118 | + return (data[0] & 0xd0) == 0x40; | |
| 119 | +} | |
| 120 | + | |
| 121 | +/* disallow addresses which may be confused with IP headers */ | |
| 122 | +static int qmi_wwan_mac_addr(struct net_device *dev, void *p) | |
| 123 | +{ | |
| 124 | + int ret; | |
| 125 | + struct sockaddr *addr = p; | |
| 126 | + | |
| 127 | + ret = eth_prepare_mac_addr_change(dev, p); | |
| 128 | + if (ret < 0) | |
| 129 | + return ret; | |
| 130 | + if (possibly_iphdr(addr->sa_data)) | |
| 131 | + return -EADDRNOTAVAIL; | |
| 132 | + eth_commit_mac_addr_change(dev, p); | |
| 133 | + return 0; | |
| 134 | +} | |
| 135 | + | |
| 136 | +static const struct net_device_ops qmi_wwan_netdev_ops = { | |
| 137 | + .ndo_open = usbnet_open, | |
| 138 | + .ndo_stop = usbnet_stop, | |
| 139 | + .ndo_start_xmit = usbnet_start_xmit, | |
| 140 | + .ndo_tx_timeout = usbnet_tx_timeout, | |
| 141 | + .ndo_change_mtu = usbnet_change_mtu, | |
| 142 | + .ndo_set_mac_address = qmi_wwan_mac_addr, | |
| 143 | + .ndo_validate_addr = eth_validate_addr, | |
| 144 | +}; | |
| 145 | + | |
| 55 | 146 | /* using a counter to merge subdriver requests with our own into a combined state */ |
| 56 | 147 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) |
| 57 | 148 | { |
| @@ -229,6 +320,18 @@ next_desc: · 171 unmodified lines | ||
| 229 | 320 | usb_driver_release_interface(driver, info->data); |
| 230 | 321 | } |
| 231 | 322 | |
| 323 | + /* Never use the same address on both ends of the link, even | |
| 324 | + * if the buggy firmware told us to. | |
| 325 | + */ | |
| 326 | + if (!compare_ether_addr(dev->net->dev_addr, default_modem_addr)) | |
| 327 | + eth_hw_addr_random(dev->net); | |
| 328 | + | |
| 329 | + /* make MAC addr easily distinguishable from an IP header */ | |
| 330 | + if (possibly_iphdr(dev->net->dev_addr)) { | |
| 331 | + dev->net->dev_addr[0] |= 0x02; /* set local assignment bit */ | |
| 332 | + dev->net->dev_addr[0] &= 0xbf; /* clear "IP" bit */ | |
| 333 | + } | |
| 334 | + dev->net->netdev_ops = &qmi_wwan_netdev_ops; | |
| 232 | 335 | err: |
| 233 | 336 | return status; |
| 234 | 337 | } |
| @@ -307,6 +410,7 @@ static const struct driver_info qmi_wwan_info = { · 72 unmodified lines | ||
| 307 | 410 | .bind = qmi_wwan_bind, |
| 308 | 411 | .unbind = qmi_wwan_unbind, |
| 309 | 412 | .manage_power = qmi_wwan_manage_power, |
| 413 | + .rx_fixup = qmi_wwan_rx_fixup, | |
| 310 | 414 | }; |
| 311 | 415 | |
| 312 | 416 | #define HUAWEI_VENDOR_ID 0x12D1 |
| @@ -519,7 +519,7 @@ static const u32 ar9580_1p0_mac_core[][2] = { · 518 unmodified lines | ||
| 519 | 519 | {0x00008258, 0x00000000}, |
| 520 | 520 | {0x0000825c, 0x40000000}, |
| 521 | 521 | {0x00008260, 0x00080922}, |
| 522 | − {0x00008264, 0x9bc00010}, | |
| 522 | + {0x00008264, 0x9d400010}, | |
| 523 | 523 | {0x00008268, 0xffffffff}, |
| 524 | 524 | {0x0000826c, 0x0000ffff}, |
| 525 | 525 | {0x00008270, 0x00000000}, |
| @@ -143,14 +143,14 @@ channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq) · 142 unmodified lines | ||
| 143 | 143 | u32 sz, i; |
| 144 | 144 | struct channel_detector *cd; |
| 145 | 145 | |
| 146 | − cd = kmalloc(sizeof(*cd), GFP_KERNEL); | |
| 146 | + cd = kmalloc(sizeof(*cd), GFP_ATOMIC); | |
| 147 | 147 | if (cd == NULL) |
| 148 | 148 | goto fail; |
| 149 | 149 | |
| 150 | 150 | INIT_LIST_HEAD(&cd->head); |
| 151 | 151 | cd->freq = freq; |
| 152 | 152 | sz = sizeof(cd->detectors) * dpd->num_radar_types; |
| 153 | − cd->detectors = kzalloc(sz, GFP_KERNEL); | |
| 153 | + cd->detectors = kzalloc(sz, GFP_ATOMIC); | |
| 154 | 154 | if (cd->detectors == NULL) |
| 155 | 155 | goto fail; |
| 156 | 156 | |
| @@ -218,7 +218,7 @@ static bool pulse_queue_enqueue(struct pri_detector *pde, u64 ts) · 217 unmodified lines | ||
| 218 | 218 | { |
| 219 | 219 | struct pulse_elem *p = pool_get_pulse_elem(); |
| 220 | 220 | if (p == NULL) { |
| 221 | − p = kmalloc(sizeof(*p), GFP_KERNEL); | |
| 221 | + p = kmalloc(sizeof(*p), GFP_ATOMIC); | |
| 222 | 222 | if (p == NULL) { |
| 223 | 223 | DFS_POOL_STAT_INC(pulse_alloc_error); |
| 224 | 224 | return false; |
| @@ -299,7 +299,7 @@ static bool pseq_handler_create_sequences(struct pri_detector *pde, · 74 unmodified lines | ||
| 299 | 299 | ps.deadline_ts = ps.first_ts + ps.dur; |
| 300 | 300 | new_ps = pool_get_pseq_elem(); |
| 301 | 301 | if (new_ps == NULL) { |
| 302 | − new_ps = kmalloc(sizeof(*new_ps), GFP_KERNEL); | |
| 302 | + new_ps = kmalloc(sizeof(*new_ps), GFP_ATOMIC); | |
| 303 | 303 | if (new_ps == NULL) { |
| 304 | 304 | DFS_POOL_STAT_INC(pseq_alloc_error); |
| 305 | 305 | return false; |
| @@ -796,7 +796,7 @@ static int ath9k_init_firmware_version(struct ath9k_htc_priv *priv) · 795 unmodified lines | ||
| 796 | 796 | * required version. |
| 797 | 797 | */ |
| 798 | 798 | if (priv->fw_version_major != MAJOR_VERSION_REQ || |
| 799 | − priv->fw_version_minor != MINOR_VERSION_REQ) { | |
| 799 | + priv->fw_version_minor < MINOR_VERSION_REQ) { | |
| 800 | 800 | dev_err(priv->dev, "ath9k_htc: Please upgrade to FW version %d.%d\n", |
| 801 | 801 | MAJOR_VERSION_REQ, MINOR_VERSION_REQ); |
| 802 | 802 | return -EINVAL; |
| @@ -5161,7 +5161,8 @@ static void b43_nphy_pmu_spur_avoid(struct b43_wldev *dev, bool avoid) · 5160 unmodified lines | ||
| 5161 | 5161 | #endif |
| 5162 | 5162 | #ifdef CONFIG_B43_SSB |
| 5163 | 5163 | case B43_BUS_SSB: |
| 5164 | − /* FIXME */ | |
| 5164 | + ssb_pmu_spuravoid_pllupdate(&dev->dev->sdev->bus->chipco, | |
| 5165 | + avoid); | |
| 5165 | 5166 | break; |
| 5166 | 5167 | #endif |
| 5167 | 5168 | } |
| @@ -4076,10 +4076,6 @@ static const struct ieee80211_iface_limit brcmf_iface_limits[] = { · 4075 unmodified lines | ||
| 4076 | 4076 | BIT(NL80211_IFTYPE_ADHOC) | |
| 4077 | 4077 | BIT(NL80211_IFTYPE_AP) |
| 4078 | 4078 | }, |
| 4079 | − { | |
| 4080 | − .max = 1, | |
| 4081 | − .types = BIT(NL80211_IFTYPE_P2P_DEVICE) | |
| 4082 | − }, | |
| 4083 | 4079 | { |
| 4084 | 4080 | .max = 1, |
| 4085 | 4081 | .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | |
| @@ -4142,8 +4138,7 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev) · 56 unmodified lines | ||
| 4142 | 4138 | BIT(NL80211_IFTYPE_ADHOC) | |
| 4143 | 4139 | BIT(NL80211_IFTYPE_AP) | |
| 4144 | 4140 | BIT(NL80211_IFTYPE_P2P_CLIENT) | |
| 4145 | − BIT(NL80211_IFTYPE_P2P_GO) | | |
| 4146 | − BIT(NL80211_IFTYPE_P2P_DEVICE); | |
| 4141 | + BIT(NL80211_IFTYPE_P2P_GO); | |
| 4147 | 4142 | wiphy->iface_combinations = brcmf_iface_combos; |
| 4148 | 4143 | wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); |
| 4149 | 4144 | wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; |
| @@ -276,6 +276,130 @@ static void brcms_set_basic_rate(struct brcm_rateset *rs, u16 rate, bool is_br) · 275 unmodified lines | ||
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | +/** | |
| 280 | + * This function frees the WL per-device resources. | |
| 281 | + * | |
| 282 | + * This function frees resources owned by the WL device pointed to | |
| 283 | + * by the wl parameter. | |
| 284 | + * | |
| 285 | + * precondition: can both be called locked and unlocked | |
| 286 | + * | |
| 287 | + */ | |
| 288 | +static void brcms_free(struct brcms_info *wl) | |
| 289 | +{ | |
| 290 | + struct brcms_timer *t, *next; | |
| 291 | + | |
| 292 | + /* free ucode data */ | |
| 293 | + if (wl->fw.fw_cnt) | |
| 294 | + brcms_ucode_data_free(&wl->ucode); | |
| 295 | + if (wl->irq) | |
| 296 | + free_irq(wl->irq, wl); | |
| 297 | + | |
| 298 | + /* kill dpc */ | |
| 299 | + tasklet_kill(&wl->tasklet); | |
| 300 | + | |
| 301 | + if (wl->pub) { | |
| 302 | + brcms_debugfs_detach(wl->pub); | |
| 303 | + brcms_c_module_unregister(wl->pub, "linux", wl); | |
| 304 | + } | |
| 305 | + | |
| 306 | + /* free common resources */ | |
| 307 | + if (wl->wlc) { | |
| 308 | + brcms_c_detach(wl->wlc); | |
| 309 | + wl->wlc = NULL; | |
| 310 | + wl->pub = NULL; | |
| 311 | + } | |
| 312 | + | |
| 313 | + /* virtual interface deletion is deferred so we cannot spinwait */ | |
| 314 | + | |
| 315 | + /* wait for all pending callbacks to complete */ | |
| 316 | + while (atomic_read(&wl->callbacks) > 0) | |
| 317 | + schedule(); | |
| 318 | + | |
| 319 | + /* free timers */ | |
| 320 | + for (t = wl->timers; t; t = next) { | |
| 321 | + next = t->next; | |
| 322 | +#ifdef DEBUG | |
| 323 | + kfree(t->name); | |
| 324 | +#endif | |
| 325 | + kfree(t); | |
| 326 | + } | |
| 327 | +} | |
| 328 | + | |
| 329 | +/* | |
| 330 | +* called from both kernel as from this kernel module (error flow on attach) | |
| 331 | +* precondition: perimeter lock is not acquired. | |
| 332 | +*/ | |
| 333 | +static void brcms_remove(struct bcma_device *pdev) | |
| 334 | +{ | |
| 335 | + struct ieee80211_hw *hw = bcma_get_drvdata(pdev); | |
| 336 | + struct brcms_info *wl = hw->priv; | |
| 337 | + | |
| 338 | + if (wl->wlc) { | |
| 339 | + wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false); | |
| 340 | + wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); | |
| 341 | + ieee80211_unregister_hw(hw); | |
| 342 | + } | |
| 343 | + | |
| 344 | + brcms_free(wl); | |
| 345 | + | |
| 346 | + bcma_set_drvdata(pdev, NULL); | |
| 347 | + ieee80211_free_hw(hw); | |
| 348 | +} | |
| 349 | + | |
| 350 | +/* | |
| 351 | + * Precondition: Since this function is called in brcms_pci_probe() context, | |
| 352 | + * no locking is required. | |
| 353 | + */ | |
| 354 | +static void brcms_release_fw(struct brcms_info *wl) | |
| 355 | +{ | |
| 356 | + int i; | |
| 357 | + for (i = 0; i < MAX_FW_IMAGES; i++) { | |
| 358 | + release_firmware(wl->fw.fw_bin[i]); | |
| 359 | + release_firmware(wl->fw.fw_hdr[i]); | |
| 360 | + } | |
| 361 | +} | |
| 362 | + | |
| 363 | +/* | |
| 364 | + * Precondition: Since this function is called in brcms_pci_probe() context, | |
| 365 | + * no locking is required. | |
| 366 | + */ | |
| 367 | +static int brcms_request_fw(struct brcms_info *wl, struct bcma_device *pdev) | |
| 368 | +{ | |
| 369 | + int status; | |
| 370 | + struct device *device = &pdev->dev; | |
| 371 | + char fw_name[100]; | |
| 372 | + int i; | |
| 373 | + | |
| 374 | + memset(&wl->fw, 0, sizeof(struct brcms_firmware)); | |
| 375 | + for (i = 0; i < MAX_FW_IMAGES; i++) { | |
| 376 | + if (brcms_firmwares[i] == NULL) | |
| 377 | + break; | |
| 378 | + sprintf(fw_name, "%s-%d.fw", brcms_firmwares[i], | |
| 379 | + UCODE_LOADER_API_VER); | |
| 380 | + status = request_firmware(&wl->fw.fw_bin[i], fw_name, device); | |
| 381 | + if (status) { | |
| 382 | + wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | |
| 383 | + KBUILD_MODNAME, fw_name); | |
| 384 | + return status; | |
| 385 | + } | |
| 386 | + sprintf(fw_name, "%s_hdr-%d.fw", brcms_firmwares[i], | |
| 387 | + UCODE_LOADER_API_VER); | |
| 388 | + status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device); | |
| 389 | + if (status) { | |
| 390 | + wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | |
| 391 | + KBUILD_MODNAME, fw_name); | |
| 392 | + return status; | |
| 393 | + } | |
| 394 | + wl->fw.hdr_num_entries[i] = | |
| 395 | + wl->fw.fw_hdr[i]->size / (sizeof(struct firmware_hdr)); | |
| 396 | + } | |
| 397 | + wl->fw.fw_cnt = i; | |
| 398 | + status = brcms_ucode_data_init(wl, &wl->ucode); | |
| 399 | + brcms_release_fw(wl); | |
| 400 | + return status; | |
| 401 | +} | |
| 402 | + | |
| 279 | 403 | static void brcms_ops_tx(struct ieee80211_hw *hw, |
| 280 | 404 | struct ieee80211_tx_control *control, |
| 281 | 405 | struct sk_buff *skb) |
| @@ -308,6 +432,14 @@ static int brcms_ops_start(struct ieee80211_hw *hw) · 26 unmodified lines | ||
| 308 | 432 | if (!blocked) |
| 309 | 433 | wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); |
| 310 | 434 | |
| 435 | + if (!wl->ucode.bcm43xx_bomminor) { | |
| 436 | + err = brcms_request_fw(wl, wl->wlc->hw->d11core); | |
| 437 | + if (err) { | |
| 438 | + brcms_remove(wl->wlc->hw->d11core); | |
| 439 | + return -ENOENT; | |
| 440 | + } | |
| 441 | + } | |
| 442 | + | |
| 311 | 443 | spin_lock_bh(&wl->lock); |
| 312 | 444 | /* avoid acknowledging frames before a non-monitor device is added */ |
| 313 | 445 | wl->mute_tx = true; |
| @@ -856,129 +988,6 @@ void brcms_dpc(unsigned long data) · 542 unmodified lines | ||
| 856 | 988 | wake_up(&wl->tx_flush_wq); |
| 857 | 989 | } |
| 858 | 990 | |
| 859 | −/* | |
| 860 | − * Precondition: Since this function is called in brcms_pci_probe() context, | |
| 861 | − * no locking is required. | |
| 862 | − */ | |
| 863 | −static int brcms_request_fw(struct brcms_info *wl, struct bcma_device *pdev) | |
| 864 | −{ | |
| 865 | − int status; | |
| 866 | − struct device *device = &pdev->dev; | |
| 867 | − char fw_name[100]; | |
| 868 | − int i; | |
| 869 | − | |
| 870 | − memset(&wl->fw, 0, sizeof(struct brcms_firmware)); | |
| 871 | − for (i = 0; i < MAX_FW_IMAGES; i++) { | |
| 872 | − if (brcms_firmwares[i] == NULL) | |
| 873 | − break; | |
| 874 | − sprintf(fw_name, "%s-%d.fw", brcms_firmwares[i], | |
| 875 | − UCODE_LOADER_API_VER); | |
| 876 | − status = request_firmware(&wl->fw.fw_bin[i], fw_name, device); | |
| 877 | − if (status) { | |
| 878 | − wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | |
| 879 | − KBUILD_MODNAME, fw_name); | |
| 880 | − return status; | |
| 881 | − } | |
| 882 | − sprintf(fw_name, "%s_hdr-%d.fw", brcms_firmwares[i], | |
| 883 | − UCODE_LOADER_API_VER); | |
| 884 | − status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device); | |
| 885 | − if (status) { | |
| 886 | − wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | |
| 887 | − KBUILD_MODNAME, fw_name); | |
| 888 | − return status; | |
| 889 | − } | |
| 890 | − wl->fw.hdr_num_entries[i] = | |
| 891 | − wl->fw.fw_hdr[i]->size / (sizeof(struct firmware_hdr)); | |
| 892 | − } | |
| 893 | − wl->fw.fw_cnt = i; | |
| 894 | − return brcms_ucode_data_init(wl, &wl->ucode); | |
| 895 | −} | |
| 896 | − | |
| 897 | −/* | |
| 898 | − * Precondition: Since this function is called in brcms_pci_probe() context, | |
| 899 | − * no locking is required. | |
| 900 | − */ | |
| 901 | −static void brcms_release_fw(struct brcms_info *wl) | |
| 902 | −{ | |
| 903 | − int i; | |
| 904 | − for (i = 0; i < MAX_FW_IMAGES; i++) { | |
| 905 | − release_firmware(wl->fw.fw_bin[i]); | |
| 906 | − release_firmware(wl->fw.fw_hdr[i]); | |
| 907 | − } | |
| 908 | −} | |
| 909 | − | |
| 910 | −/** | |
| 911 | − * This function frees the WL per-device resources. | |
| 912 | − * | |
| 913 | − * This function frees resources owned by the WL device pointed to | |
| 914 | − * by the wl parameter. | |
| 915 | − * | |
| 916 | − * precondition: can both be called locked and unlocked | |
| 917 | − * | |
| 918 | − */ | |
| 919 | −static void brcms_free(struct brcms_info *wl) | |
| 920 | −{ | |
| 921 | − struct brcms_timer *t, *next; | |
| 922 | − | |
| 923 | − /* free ucode data */ | |
| 924 | − if (wl->fw.fw_cnt) | |
| 925 | − brcms_ucode_data_free(&wl->ucode); | |
| 926 | − if (wl->irq) | |
| 927 | − free_irq(wl->irq, wl); | |
| 928 | − | |
| 929 | − /* kill dpc */ | |
| 930 | − tasklet_kill(&wl->tasklet); | |
| 931 | − | |
| 932 | − if (wl->pub) { | |
| 933 | − brcms_debugfs_detach(wl->pub); | |
| 934 | − brcms_c_module_unregister(wl->pub, "linux", wl); | |
| 935 | − } | |
| 936 | − | |
| 937 | − /* free common resources */ | |
| 938 | − if (wl->wlc) { | |
| 939 | − brcms_c_detach(wl->wlc); | |
| 940 | − wl->wlc = NULL; | |
| 941 | − wl->pub = NULL; | |
| 942 | − } | |
| 943 | − | |
| 944 | − /* virtual interface deletion is deferred so we cannot spinwait */ | |
| 945 | − | |
| 946 | − /* wait for all pending callbacks to complete */ | |
| 947 | − while (atomic_read(&wl->callbacks) > 0) | |
| 948 | − schedule(); | |
| 949 | − | |
| 950 | − /* free timers */ | |
| 951 | − for (t = wl->timers; t; t = next) { | |
| 952 | − next = t->next; | |
| 953 | −#ifdef DEBUG | |
| 954 | − kfree(t->name); | |
| 955 | −#endif | |
| 956 | − kfree(t); | |
| 957 | − } | |
| 958 | −} | |
| 959 | − | |
| 960 | −/* | |
| 961 | −* called from both kernel as from this kernel module (error flow on attach) | |
| 962 | −* precondition: perimeter lock is not acquired. | |
| 963 | −*/ | |
| 964 | −static void brcms_remove(struct bcma_device *pdev) | |
| 965 | −{ | |
| 966 | − struct ieee80211_hw *hw = bcma_get_drvdata(pdev); | |
| 967 | − struct brcms_info *wl = hw->priv; | |
| 968 | − | |
| 969 | − if (wl->wlc) { | |
| 970 | − brcms_led_unregister(wl); | |
| 971 | − wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false); | |
| 972 | − wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); | |
| 973 | − ieee80211_unregister_hw(hw); | |
| 974 | − } | |
| 975 | − | |
| 976 | − brcms_free(wl); | |
| 977 | − | |
| 978 | − bcma_set_drvdata(pdev, NULL); | |
| 979 | − ieee80211_free_hw(hw); | |
| 980 | −} | |
| 981 | − | |
| 982 | 991 | static irqreturn_t brcms_isr(int irq, void *dev_id) |
| 983 | 992 | { |
| 984 | 993 | struct brcms_info *wl; |
| @@ -1120,18 +1129,8 @@ static struct brcms_info *brcms_attach(struct bcma_device *pdev) · 135 unmodified lines | ||
| 1120 | 1129 | spin_lock_init(&wl->lock); |
| 1121 | 1130 | spin_lock_init(&wl->isr_lock); |
| 1122 | 1131 | |
| 1123 | − /* prepare ucode */ | |
| 1124 | − if (brcms_request_fw(wl, pdev) < 0) { | |
| 1125 | − wiphy_err(wl->wiphy, "%s: Failed to find firmware usually in " | |
| 1126 | − "%s\n", KBUILD_MODNAME, "/lib/firmware/brcm"); | |
| 1127 | − brcms_release_fw(wl); | |
| 1128 | − brcms_remove(pdev); | |
| 1129 | − return NULL; | |
| 1130 | − } | |
| 1131 | − | |
| 1132 | 1132 | /* common load-time initialization */ |
| 1133 | 1133 | wl->wlc = brcms_c_attach((void *)wl, pdev, unit, false, &err); |
| 1134 | − brcms_release_fw(wl); | |
| 1135 | 1134 | if (!wl->wlc) { |
| 1136 | 1135 | wiphy_err(wl->wiphy, "%s: attach() failed with code %d\n", |
| 1137 | 1136 | KBUILD_MODNAME, err); |
| @@ -53,14 +53,15 @@ static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context) · 52 unmodified lines | ||
| 53 | 53 | return; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | − if (!pci_dev->pm_cap || !pci_dev->pme_support | |
| 57 | − || pci_check_pme_status(pci_dev)) { | |
| 58 | − if (pci_dev->pme_poll) | |
| 59 | − pci_dev->pme_poll = false; | |
| 56 | + /* Clear PME Status if set. */ | |
| 57 | + if (pci_dev->pme_support) | |
| 58 | + pci_check_pme_status(pci_dev); | |
| 60 | 59 | |
| 61 | − pci_wakeup_event(pci_dev); | |
| 62 | − pm_runtime_resume(&pci_dev->dev); | |
| 63 | − } | |
| 60 | + if (pci_dev->pme_poll) | |
| 61 | + pci_dev->pme_poll = false; | |
| 62 | + | |
| 63 | + pci_wakeup_event(pci_dev); | |
| 64 | + pm_runtime_resume(&pci_dev->dev); | |
| 64 | 65 | |
| 65 | 66 | if (pci_dev->subordinate) |
| 66 | 67 | pci_pme_wakeup_bus(pci_dev->subordinate); |
| @@ -390,9 +390,10 @@ static void pci_device_shutdown(struct device *dev) · 389 unmodified lines | ||
| 390 | 390 | |
| 391 | 391 | /* |
| 392 | 392 | * Turn off Bus Master bit on the device to tell it to not |
| 393 | − * continue to do DMA | |
| 393 | + * continue to do DMA. Don't touch devices in D3cold or unknown states. | |
| 394 | 394 | */ |
| 395 | − pci_clear_master(pci_dev); | |
| 395 | + if (pci_dev->current_state <= PCI_D3hot) | |
| 396 | + pci_clear_master(pci_dev); | |
| 396 | 397 | } |
| 397 | 398 | |
| 398 | 399 | #ifdef CONFIG_PM |
| @@ -184,14 +184,6 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = { · 183 unmodified lines | ||
| 184 | 184 | #define PCIE_PORTDRV_PM_OPS NULL |
| 185 | 185 | #endif /* !PM */ |
| 186 | 186 | |
| 187 | −/* | |
| 188 | − * PCIe port runtime suspend is broken for some chipsets, so use a | |
| 189 | − * black list to disable runtime PM for these chipsets. | |
| 190 | − */ | |
| 191 | −static const struct pci_device_id port_runtime_pm_black_list[] = { | |
| 192 | − { /* end: all zeroes */ } | |
| 193 | −}; | |
| 194 | − | |
| 195 | 187 | /* |
| 196 | 188 | * pcie_portdrv_probe - Probe PCI-Express port devices |
| 197 | 189 | * @dev: PCI-Express port device being probed |
| @@ -225,16 +217,11 @@ static int pcie_portdrv_probe(struct pci_dev *dev, · 27 unmodified lines | ||
| 225 | 217 | * it by default. |
| 226 | 218 | */ |
| 227 | 219 | dev->d3cold_allowed = false; |
| 228 | − if (!pci_match_id(port_runtime_pm_black_list, dev)) | |
| 229 | − pm_runtime_put_noidle(&dev->dev); | |
| 230 | − | |
| 231 | 220 | return 0; |
| 232 | 221 | } |
| 233 | 222 | |
| 234 | 223 | static void pcie_portdrv_remove(struct pci_dev *dev) |
| 235 | 224 | { |
| 236 | − if (!pci_match_id(port_runtime_pm_black_list, dev)) | |
| 237 | − pm_runtime_get_noresume(&dev->dev); | |
| 238 | 225 | pcie_port_device_remove(dev); |
| 239 | 226 | pci_disable_device(dev); |
| 240 | 227 | } |
| @@ -100,27 +100,6 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) · 99 unmodified lines | ||
| 100 | 100 | return min((size_t)(image - rom), size); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | −static loff_t pci_find_rom(struct pci_dev *pdev, size_t *size) | |
| 104 | −{ | |
| 105 | − struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; | |
| 106 | − loff_t start; | |
| 107 | − | |
| 108 | − /* assign the ROM an address if it doesn't have one */ | |
| 109 | − if (res->parent == NULL && pci_assign_resource(pdev, PCI_ROM_RESOURCE)) | |
| 110 | − return 0; | |
| 111 | − start = pci_resource_start(pdev, PCI_ROM_RESOURCE); | |
| 112 | − *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); | |
| 113 | − | |
| 114 | − if (*size == 0) | |
| 115 | − return 0; | |
| 116 | − | |
| 117 | − /* Enable ROM space decodes */ | |
| 118 | − if (pci_enable_rom(pdev)) | |
| 119 | − return 0; | |
| 120 | − | |
| 121 | − return start; | |
| 122 | −} | |
| 123 | − | |
| 124 | 103 | /** |
| 125 | 104 | * pci_map_rom - map a PCI ROM to kernel space |
| 126 | 105 | * @pdev: pointer to pci device struct |
| @@ -135,7 +114,7 @@ static loff_t pci_find_rom(struct pci_dev *pdev, size_t *size) · 8 unmodified lines | ||
| 135 | 114 | void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) |
| 136 | 115 | { |
| 137 | 116 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; |
| 138 | − loff_t start = 0; | |
| 117 | + loff_t start; | |
| 139 | 118 | void __iomem *rom; |
| 140 | 119 | |
| 141 | 120 | /* |
| @@ -154,21 +133,21 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) · 12 unmodified lines | ||
| 154 | 133 | return (void __iomem *)(unsigned long) |
| 155 | 134 | pci_resource_start(pdev, PCI_ROM_RESOURCE); |
| 156 | 135 | } else { |
| 157 | − start = pci_find_rom(pdev, size); | |
| 158 | − } | |
| 159 | − } | |
| 136 | + /* assign the ROM an address if it doesn't have one */ | |
| 137 | + if (res->parent == NULL && | |
| 138 | + pci_assign_resource(pdev,PCI_ROM_RESOURCE)) | |
| 139 | + return NULL; | |
| 140 | + start = pci_resource_start(pdev, PCI_ROM_RESOURCE); | |
| 141 | + *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); | |
| 142 | + if (*size == 0) | |
| 143 | + return NULL; | |
| 160 | 144 | |
| 161 | − /* | |
| 162 | − * Some devices may provide ROMs via a source other than the BAR | |
| 163 | − */ | |
| 164 | − if (!start && pdev->rom && pdev->romlen) { | |
| 165 | − *size = pdev->romlen; | |
| 166 | − return phys_to_virt(pdev->rom); | |
| 145 | + /* Enable ROM space decodes */ | |
| 146 | + if (pci_enable_rom(pdev)) | |
| 147 | + return NULL; | |
| 148 | + } | |
| 167 | 149 | } |
| 168 | 150 | |
| 169 | − if (!start) | |
| 170 | − return NULL; | |
| 171 | − | |
| 172 | 151 | rom = ioremap(start, *size); |
| 173 | 152 | if (!rom) { |
| 174 | 153 | /* restore enable if ioremap fails */ |
| @@ -202,8 +181,7 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom) · 27 unmodified lines | ||
| 202 | 181 | if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) |
| 203 | 182 | return; |
| 204 | 183 | |
| 205 | − if (!pdev->rom || !pdev->romlen) | |
| 206 | − iounmap(rom); | |
| 184 | + iounmap(rom); | |
| 207 | 185 | |
| 208 | 186 | /* Disable again before continuing, leave enabled if pci=rom */ |
| 209 | 187 | if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW))) |
| @@ -227,7 +205,24 @@ void pci_cleanup_rom(struct pci_dev *pdev) · 17 unmodified lines | ||
| 227 | 205 | } |
| 228 | 206 | } |
| 229 | 207 | |
| 208 | +/** | |
| 209 | + * pci_platform_rom - provides a pointer to any ROM image provided by the | |
| 210 | + * platform | |
| 211 | + * @pdev: pointer to pci device struct | |
| 212 | + * @size: pointer to receive size of pci window over ROM | |
| 213 | + */ | |
| 214 | +void __iomem *pci_platform_rom(struct pci_dev *pdev, size_t *size) | |
| 215 | +{ | |
| 216 | + if (pdev->rom && pdev->romlen) { | |
| 217 | + *size = pdev->romlen; | |
| 218 | + return phys_to_virt((phys_addr_t)pdev->rom); | |
| 219 | + } | |
| 220 | + | |
| 221 | + return NULL; | |
| 222 | +} | |
| 223 | + | |
| 230 | 224 | EXPORT_SYMBOL(pci_map_rom); |
| 231 | 225 | EXPORT_SYMBOL(pci_unmap_rom); |
| 232 | 226 | EXPORT_SYMBOL_GPL(pci_enable_rom); |
| 233 | 227 | EXPORT_SYMBOL_GPL(pci_disable_rom); |
| 228 | +EXPORT_SYMBOL(pci_platform_rom); | |
| @@ -134,7 +134,6 @@ static const struct key_entry hp_wmi_keymap[] = { · 133 unmodified lines | ||
| 134 | 134 | { KE_KEY, 0x2142, { KEY_MEDIA } }, |
| 135 | 135 | { KE_KEY, 0x213b, { KEY_INFO } }, |
| 136 | 136 | { KE_KEY, 0x2169, { KEY_DIRECTION } }, |
| 137 | − { KE_KEY, 0x216a, { KEY_SETUP } }, | |
| 138 | 137 | { KE_KEY, 0x231b, { KEY_HELP } }, |
| 139 | 138 | { KE_END, 0 } |
| 140 | 139 | }; |
| @@ -925,9 +924,6 @@ static int __init hp_wmi_init(void) · 784 unmodified lines | ||
| 925 | 924 | err = hp_wmi_input_setup(); |
| 926 | 925 | if (err) |
| 927 | 926 | return err; |
| 928 | − | |
| 929 | − //Enable magic for hotkeys that run on the SMBus | |
| 930 | − ec_write(0xe6,0x6e); | |
| 931 | 927 | } |
| 932 | 928 | |
| 933 | 929 | if (bios_capable) { |
| @@ -1964,9 +1964,6 @@ struct tp_nvram_state { · 1963 unmodified lines | ||
| 1964 | 1964 | /* kthread for the hotkey poller */ |
| 1965 | 1965 | static struct task_struct *tpacpi_hotkey_task; |
| 1966 | 1966 | |
| 1967 | −/* Acquired while the poller kthread is running, use to sync start/stop */ | |
| 1968 | −static struct mutex hotkey_thread_mutex; | |
| 1969 | − | |
| 1970 | 1967 | /* |
| 1971 | 1968 | * Acquire mutex to write poller control variables as an |
| 1972 | 1969 | * atomic block. |
| @@ -2462,8 +2459,6 @@ static int hotkey_kthread(void *data) · 489 unmodified lines | ||
| 2462 | 2459 | unsigned int poll_freq; |
| 2463 | 2460 | bool was_frozen; |
| 2464 | 2461 | |
| 2465 | − mutex_lock(&hotkey_thread_mutex); | |
| 2466 | − | |
| 2467 | 2462 | if (tpacpi_lifecycle == TPACPI_LIFE_EXITING) |
| 2468 | 2463 | goto exit; |
| 2469 | 2464 | |
| @@ -2523,7 +2518,6 @@ static int hotkey_kthread(void *data) · 53 unmodified lines | ||
| 2523 | 2518 | } |
| 2524 | 2519 | |
| 2525 | 2520 | exit: |
| 2526 | − mutex_unlock(&hotkey_thread_mutex); | |
| 2527 | 2521 | return 0; |
| 2528 | 2522 | } |
| 2529 | 2523 | |
| @@ -2533,9 +2527,6 @@ static void hotkey_poll_stop_sync(void) · 3 unmodified lines | ||
| 2533 | 2527 | if (tpacpi_hotkey_task) { |
| 2534 | 2528 | kthread_stop(tpacpi_hotkey_task); |
| 2535 | 2529 | tpacpi_hotkey_task = NULL; |
| 2536 | − mutex_lock(&hotkey_thread_mutex); | |
| 2537 | − /* at this point, the thread did exit */ | |
| 2538 | − mutex_unlock(&hotkey_thread_mutex); | |
| 2539 | 2530 | } |
| 2540 | 2531 | } |
| 2541 | 2532 | |
| @@ -3234,7 +3225,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) · 692 unmodified lines | ||
| 3234 | 3225 | mutex_init(&hotkey_mutex); |
| 3235 | 3226 | |
| 3236 | 3227 | #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL |
| 3237 | − mutex_init(&hotkey_thread_mutex); | |
| 3238 | 3228 | mutex_init(&hotkey_thread_data_mutex); |
| 3239 | 3229 | #endif |
| 3240 | 3230 | |
| @@ -4,7 +4,7 @@ menu "Remoteproc drivers" · 3 unmodified lines | ||
| 4 | 4 | config REMOTEPROC |
| 5 | 5 | tristate |
| 6 | 6 | depends on HAS_DMA |
| 7 | − select FW_CONFIG | |
| 7 | + select FW_LOADER | |
| 8 | 8 | select VIRTIO |
| 9 | 9 | |
| 10 | 10 | config OMAP_REMOTEPROC |
| @@ -217,7 +217,7 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) · 216 unmodified lines | ||
| 217 | 217 | * TODO: support predefined notifyids (via resource table) |
| 218 | 218 | */ |
| 219 | 219 | ret = idr_alloc(&rproc->notifyids, rvring, 0, 0, GFP_KERNEL); |
| 220 | − if (ret) { | |
| 220 | + if (ret < 0) { | |
| 221 | 221 | dev_err(dev, "idr_alloc failed: %d\n", ret); |
| 222 | 222 | dma_free_coherent(dev->parent, size, va, dma); |
| 223 | 223 | return ret; |
| @@ -366,10 +366,12 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc, · 142 unmodified lines | ||
| 366 | 366 | /* it is now safe to add the virtio device */ |
| 367 | 367 | ret = rproc_add_virtio_dev(rvdev, rsc->id); |
| 368 | 368 | if (ret) |
| 369 | − goto free_rvdev; | |
| 369 | + goto remove_rvdev; | |
| 370 | 370 | |
| 371 | 371 | return 0; |
| 372 | 372 | |
| 373 | +remove_rvdev: | |
| 374 | + list_del(&rvdev->node); | |
| 373 | 375 | free_rvdev: |
| 374 | 376 | kfree(rvdev); |
| 375 | 377 | return ret; |
| @@ -240,6 +240,8 @@ static int sproc_drv_remove(struct platform_device *pdev) · 239 unmodified lines | ||
| 240 | 240 | |
| 241 | 241 | /* Unregister as remoteproc device */ |
| 242 | 242 | rproc_del(sproc->rproc); |
| 243 | + dma_free_coherent(sproc->rproc->dev.parent, SPROC_FW_SIZE, | |
| 244 | + sproc->fw_addr, sproc->fw_dma_addr); | |
| 243 | 245 | rproc_put(sproc->rproc); |
| 244 | 246 | |
| 245 | 247 | mdev->drv_data = NULL; |
| @@ -297,10 +299,13 @@ static int sproc_probe(struct platform_device *pdev) · 51 unmodified lines | ||
| 297 | 299 | /* Register as a remoteproc device */ |
| 298 | 300 | err = rproc_add(rproc); |
| 299 | 301 | if (err) |
| 300 | − goto free_rproc; | |
| 302 | + goto free_mem; | |
| 301 | 303 | |
| 302 | 304 | return 0; |
| 303 | 305 | |
| 306 | +free_mem: | |
| 307 | + dma_free_coherent(rproc->dev.parent, SPROC_FW_SIZE, | |
| 308 | + sproc->fw_addr, sproc->fw_dma_addr); | |
| 304 | 309 | free_rproc: |
| 305 | 310 | /* Reset device data upon error */ |
| 306 | 311 | mdev->drv_data = NULL; |
| @@ -769,6 +769,7 @@ struct qeth_card { · 768 unmodified lines | ||
| 769 | 769 | unsigned long thread_start_mask; |
| 770 | 770 | unsigned long thread_allowed_mask; |
| 771 | 771 | unsigned long thread_running_mask; |
| 772 | + struct task_struct *recovery_task; | |
| 772 | 773 | spinlock_t ip_lock; |
| 773 | 774 | struct list_head ip_list; |
| 774 | 775 | struct list_head *ip_tbd_list; |
| @@ -862,6 +863,8 @@ extern struct qeth_card_list_struct qeth_core_card_list; · 87 unmodified lines | ||
| 862 | 863 | extern struct kmem_cache *qeth_core_header_cache; |
| 863 | 864 | extern struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS]; |
| 864 | 865 | |
| 866 | +void qeth_set_recovery_task(struct qeth_card *); | |
| 867 | +void qeth_clear_recovery_task(struct qeth_card *); | |
| 865 | 868 | void qeth_set_allowed_threads(struct qeth_card *, unsigned long , int); |
| 866 | 869 | int qeth_threads_running(struct qeth_card *, unsigned long); |
| 867 | 870 | int qeth_wait_for_threads(struct qeth_card *, unsigned long); |
| @@ -177,6 +177,23 @@ const char *qeth_get_cardname_short(struct qeth_card *card) · 176 unmodified lines | ||
| 177 | 177 | return "n/a"; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | +void qeth_set_recovery_task(struct qeth_card *card) | |
| 181 | +{ | |
| 182 | + card->recovery_task = current; | |
| 183 | +} | |
| 184 | +EXPORT_SYMBOL_GPL(qeth_set_recovery_task); | |
| 185 | + | |
| 186 | +void qeth_clear_recovery_task(struct qeth_card *card) | |
| 187 | +{ | |
| 188 | + card->recovery_task = NULL; | |
| 189 | +} | |
| 190 | +EXPORT_SYMBOL_GPL(qeth_clear_recovery_task); | |
| 191 | + | |
| 192 | +static bool qeth_is_recovery_task(const struct qeth_card *card) | |
| 193 | +{ | |
| 194 | + return card->recovery_task == current; | |
| 195 | +} | |
| 196 | + | |
| 180 | 197 | void qeth_set_allowed_threads(struct qeth_card *card, unsigned long threads, |
| 181 | 198 | int clear_start_mask) |
| 182 | 199 | { |
| @@ -205,6 +222,8 @@ EXPORT_SYMBOL_GPL(qeth_threads_running); · 22 unmodified lines | ||
| 205 | 222 | |
| 206 | 223 | int qeth_wait_for_threads(struct qeth_card *card, unsigned long threads) |
| 207 | 224 | { |
| 225 | + if (qeth_is_recovery_task(card)) | |
| 226 | + return 0; | |
| 208 | 227 | return wait_event_interruptible(card->wait_q, |
| 209 | 228 | qeth_threads_running(card, threads) == 0); |
| 210 | 229 | } |
| @@ -1144,6 +1144,7 @@ static int qeth_l2_recover(void *ptr) · 1143 unmodified lines | ||
| 1144 | 1144 | QETH_CARD_TEXT(card, 2, "recover2"); |
| 1145 | 1145 | dev_warn(&card->gdev->dev, |
| 1146 | 1146 | "A recovery process has been started for the device\n"); |
| 1147 | + qeth_set_recovery_task(card); | |
| 1147 | 1148 | __qeth_l2_set_offline(card->gdev, 1); |
| 1148 | 1149 | rc = __qeth_l2_set_online(card->gdev, 1); |
| 1149 | 1150 | if (!rc) |
| @@ -1154,6 +1155,7 @@ static int qeth_l2_recover(void *ptr) · 4 unmodified lines | ||
| 1154 | 1155 | dev_warn(&card->gdev->dev, "The qeth device driver " |
| 1155 | 1156 | "failed to recover an error on the device\n"); |
| 1156 | 1157 | } |
| 1158 | + qeth_clear_recovery_task(card); | |
| 1157 | 1159 | qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); |
| 1158 | 1160 | qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); |
| 1159 | 1161 | return 0; |
| @@ -3520,6 +3520,7 @@ static int qeth_l3_recover(void *ptr) · 3519 unmodified lines | ||
| 3520 | 3520 | QETH_CARD_TEXT(card, 2, "recover2"); |
| 3521 | 3521 | dev_warn(&card->gdev->dev, |
| 3522 | 3522 | "A recovery process has been started for the device\n"); |
| 3523 | + qeth_set_recovery_task(card); | |
| 3523 | 3524 | __qeth_l3_set_offline(card->gdev, 1); |
| 3524 | 3525 | rc = __qeth_l3_set_online(card->gdev, 1); |
| 3525 | 3526 | if (!rc) |
| @@ -3530,6 +3531,7 @@ static int qeth_l3_recover(void *ptr) · 4 unmodified lines | ||
| 3530 | 3531 | dev_warn(&card->gdev->dev, "The qeth device driver " |
| 3531 | 3532 | "failed to recover an error on the device\n"); |
| 3532 | 3533 | } |
| 3534 | + qeth_clear_recovery_task(card); | |
| 3533 | 3535 | qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); |
| 3534 | 3536 | qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); |
| 3535 | 3537 | return 0; |
| @@ -282,7 +282,7 @@ static irqreturn_t bbc_i2c_interrupt(int irq, void *dev_id) · 281 unmodified lines | ||
| 282 | 282 | return IRQ_HANDLED; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | −static void __init reset_one_i2c(struct bbc_i2c_bus *bp) | |
| 285 | +static void reset_one_i2c(struct bbc_i2c_bus *bp) | |
| 286 | 286 | { |
| 287 | 287 | writeb(I2C_PCF_PIN, bp->i2c_control_regs + 0x0); |
| 288 | 288 | writeb(bp->own, bp->i2c_control_regs + 0x1); |
| @@ -291,7 +291,7 @@ static void __init reset_one_i2c(struct bbc_i2c_bus *bp) · 2 unmodified lines | ||
| 291 | 291 | writeb(I2C_PCF_IDLE, bp->i2c_control_regs + 0x0); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | −static struct bbc_i2c_bus * __init attach_one_i2c(struct platform_device *op, int index) | |
| 294 | +static struct bbc_i2c_bus * attach_one_i2c(struct platform_device *op, int index) | |
| 295 | 295 | { |
| 296 | 296 | struct bbc_i2c_bus *bp; |
| 297 | 297 | struct device_node *dp; |
| @@ -1899,8 +1899,8 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev) · 1898 unmodified lines | ||
| 1899 | 1899 | sdev->allow_restart = 1; |
| 1900 | 1900 | blk_queue_rq_timeout(sdev->request_queue, 120 * HZ); |
| 1901 | 1901 | } |
| 1902 | − scsi_adjust_queue_depth(sdev, 0, shost->cmd_per_lun); | |
| 1903 | 1902 | spin_unlock_irqrestore(shost->host_lock, lock_flags); |
| 1903 | + scsi_adjust_queue_depth(sdev, 0, shost->cmd_per_lun); | |
| 1904 | 1904 | return 0; |
| 1905 | 1905 | } |
| 1906 | 1906 | |
| @@ -5148,7 +5148,7 @@ static int ipr_cancel_op(struct scsi_cmnd *scsi_cmd) · 5147 unmodified lines | ||
| 5148 | 5148 | ipr_trace; |
| 5149 | 5149 | } |
| 5150 | 5150 | |
| 5151 | − list_add_tail(&ipr_cmd->queue, &hrrq->hrrq_free_q); | |
| 5151 | + list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); | |
| 5152 | 5152 | if (!ipr_is_naca_model(res)) |
| 5153 | 5153 | res->needs_sync_complete = 1; |
| 5154 | 5154 | |
| @@ -9349,7 +9349,10 @@ static int ipr_test_msi(struct ipr_ioa_cfg *ioa_cfg, struct pci_dev *pdev) · 4194 unmodified lines | ||
| 9349 | 9349 | int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg); |
| 9350 | 9350 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
| 9351 | 9351 | |
| 9352 | − rc = request_irq(pdev->irq, ipr_test_intr, 0, IPR_NAME, ioa_cfg); | |
| 9352 | + if (ioa_cfg->intr_flag == IPR_USE_MSIX) | |
| 9353 | + rc = request_irq(ioa_cfg->vectors_info[0].vec, ipr_test_intr, 0, IPR_NAME, ioa_cfg); | |
| 9354 | + else | |
| 9355 | + rc = request_irq(pdev->irq, ipr_test_intr, 0, IPR_NAME, ioa_cfg); | |
| 9353 | 9356 | if (rc) { |
| 9354 | 9357 | dev_err(&pdev->dev, "Can not assign irq %d\n", pdev->irq); |
| 9355 | 9358 | return rc; |
| @@ -9371,7 +9374,10 @@ static int ipr_test_msi(struct ipr_ioa_cfg *ioa_cfg, struct pci_dev *pdev) · 15 unmodified lines | ||
| 9371 | 9374 | |
| 9372 | 9375 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
| 9373 | 9376 | |
| 9374 | − free_irq(pdev->irq, ioa_cfg); | |
| 9377 | + if (ioa_cfg->intr_flag == IPR_USE_MSIX) | |
| 9378 | + free_irq(ioa_cfg->vectors_info[0].vec, ioa_cfg); | |
| 9379 | + else | |
| 9380 | + free_irq(pdev->irq, ioa_cfg); | |
| 9375 | 9381 | |
| 9376 | 9382 | LEAVE; |
| 9377 | 9383 | |
| @@ -9722,6 +9728,7 @@ static void __ipr_remove(struct pci_dev *pdev) · 344 unmodified lines | ||
| 9722 | 9728 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags); |
| 9723 | 9729 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); |
| 9724 | 9730 | flush_work(&ioa_cfg->work_q); |
| 9731 | + INIT_LIST_HEAD(&ioa_cfg->used_res_q); | |
| 9725 | 9732 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); |
| 9726 | 9733 | |
| 9727 | 9734 | spin_lock(&ipr_driver_lock); |
| @@ -235,6 +235,17 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) · 234 unmodified lines | ||
| 235 | 235 | linkrate = phy->linkrate; |
| 236 | 236 | memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); |
| 237 | 237 | |
| 238 | + /* Handle vacant phy - rest of dr data is not valid so skip it */ | |
| 239 | + if (phy->phy_state == PHY_VACANT) { | |
| 240 | + memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); | |
| 241 | + phy->attached_dev_type = NO_DEVICE; | |
| 242 | + if (!test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) { | |
| 243 | + phy->phy_id = phy_id; | |
| 244 | + goto skip; | |
| 245 | + } else | |
| 246 | + goto out; | |
| 247 | + } | |
| 248 | + | |
| 238 | 249 | phy->attached_dev_type = to_dev_type(dr); |
| 239 | 250 | if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) |
| 240 | 251 | goto out; |
| @@ -272,6 +283,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) · 31 unmodified lines | ||
| 272 | 283 | phy->phy->maximum_linkrate = dr->pmax_linkrate; |
| 273 | 284 | phy->phy->negotiated_linkrate = phy->linkrate; |
| 274 | 285 | |
| 286 | + skip: | |
| 275 | 287 | if (new_phy) |
| 276 | 288 | if (sas_phy_add(phy->phy)) { |
| 277 | 289 | sas_phy_free(phy->phy); |
| @@ -388,7 +400,7 @@ int sas_ex_phy_discover(struct domain_device *dev, int single) · 110 unmodified lines | ||
| 388 | 400 | if (!disc_req) |
| 389 | 401 | return -ENOMEM; |
| 390 | 402 | |
| 391 | − disc_resp = alloc_smp_req(DISCOVER_RESP_SIZE); | |
| 403 | + disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE); | |
| 392 | 404 | if (!disc_resp) { |
| 393 | 405 | kfree(disc_req); |
| 394 | 406 | return -ENOMEM; |
| @@ -438,11 +438,12 @@ lpfc_sli4_rq_put(struct lpfc_queue *hq, struct lpfc_queue *dq, · 437 unmodified lines | ||
| 438 | 438 | struct lpfc_rqe *temp_hrqe; |
| 439 | 439 | struct lpfc_rqe *temp_drqe; |
| 440 | 440 | struct lpfc_register doorbell; |
| 441 | − int put_index = hq->host_index; | |
| 441 | + int put_index; | |
| 442 | 442 | |
| 443 | 443 | /* sanity check on queue memory */ |
| 444 | 444 | if (unlikely(!hq) || unlikely(!dq)) |
| 445 | 445 | return -ENOMEM; |
| 446 | + put_index = hq->host_index; | |
| 446 | 447 | temp_hrqe = hq->qe[hq->host_index].rqe; |
| 447 | 448 | temp_drqe = dq->qe[dq->host_index].rqe; |
| 448 | 449 | |
| @@ -1938,11 +1938,6 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) · 1937 unmodified lines | ||
| 1938 | 1938 | "Timer for the VP[%d] has stopped\n", vha->vp_idx); |
| 1939 | 1939 | } |
| 1940 | 1940 | |
| 1941 | − /* No pending activities shall be there on the vha now */ | |
| 1942 | − if (ql2xextended_error_logging & ql_dbg_user) | |
| 1943 | − msleep(random32()%10); /* Just to see if something falls on | |
| 1944 | − * the net we have placed below */ | |
| 1945 | − | |
| 1946 | 1941 | BUG_ON(atomic_read(&vha->vref_count)); |
| 1947 | 1942 | |
| 1948 | 1943 | qla2x00_free_fcports(vha); |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | * | Mailbox commands | 0x115b | 0x111a-0x111b | |
| 16 | 16 | * | | | 0x112c-0x112e | |
| 17 | 17 | * | | | 0x113a | |
| 18 | + * | | | 0x1155-0x1158 | | |
| 18 | 19 | * | Device Discovery | 0x2087 | 0x2020-0x2022, | |
| 19 | 20 | * | | | 0x2016 | |
| 20 | 21 | * | Queue Command and IO tracing | 0x3031 | 0x3006-0x300b | |
| @@ -401,7 +402,7 @@ qla2xxx_copy_atioqueues(struct qla_hw_data *ha, void *ptr, · 380 unmodified lines | ||
| 401 | 402 | void *ring; |
| 402 | 403 | } aq, *aqp; |
| 403 | 404 | |
| 404 | − if (!ha->tgt.atio_q_length) | |
| 405 | + if (!ha->tgt.atio_ring) | |
| 405 | 406 | return ptr; |
| 406 | 407 | |
| 407 | 408 | num_queues = 1; |
| @@ -863,7 +863,6 @@ typedef struct { · 862 unmodified lines | ||
| 863 | 863 | #define MBX_1 BIT_1 |
| 864 | 864 | #define MBX_0 BIT_0 |
| 865 | 865 | |
| 866 | −#define RNID_TYPE_SET_VERSION 0x9 | |
| 867 | 866 | #define RNID_TYPE_ASIC_TEMP 0xC |
| 868 | 867 | |
| 869 | 868 | /* |
| @@ -357,9 +357,6 @@ qla2x00_enable_fce_trace(scsi_qla_host_t *, dma_addr_t, uint16_t , uint16_t *, · 356 unmodified lines | ||
| 357 | 357 | extern int |
| 358 | 358 | qla2x00_disable_fce_trace(scsi_qla_host_t *, uint64_t *, uint64_t *); |
| 359 | 359 | |
| 360 | −extern int | |
| 361 | −qla2x00_set_driver_version(scsi_qla_host_t *, char *); | |
| 362 | − | |
| 363 | 360 | extern int |
| 364 | 361 | qla2x00_read_sfp(scsi_qla_host_t *, dma_addr_t, uint8_t *, |
| 365 | 362 | uint16_t, uint16_t, uint16_t, uint16_t); |
| @@ -619,8 +619,6 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha) · 618 unmodified lines | ||
| 619 | 619 | if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha)) |
| 620 | 620 | qla24xx_read_fcp_prio_cfg(vha); |
| 621 | 621 | |
| 622 | − qla2x00_set_driver_version(vha, QLA2XXX_VERSION); | |
| 623 | − | |
| 624 | 622 | return (rval); |
| 625 | 623 | } |
| 626 | 624 | |
| @@ -1399,7 +1397,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) · 772 unmodified lines | ||
| 1399 | 1397 | mq_size += ha->max_rsp_queues * |
| 1400 | 1398 | (rsp->length * sizeof(response_t)); |
| 1401 | 1399 | } |
| 1402 | − if (ha->tgt.atio_q_length) | |
| 1400 | + if (ha->tgt.atio_ring) | |
| 1403 | 1401 | mq_size += ha->tgt.atio_q_length * sizeof(request_t); |
| 1404 | 1402 | /* Allocate memory for Fibre Channel Event Buffer. */ |
| 1405 | 1403 | if (!IS_QLA25XX(ha) && !IS_QLA81XX(ha) && !IS_QLA83XX(ha)) |
| @@ -3866,64 +3866,6 @@ qla81xx_restart_mpi_firmware(scsi_qla_host_t *vha) · 3865 unmodified lines | ||
| 3866 | 3866 | return rval; |
| 3867 | 3867 | } |
| 3868 | 3868 | |
| 3869 | −int | |
| 3870 | −qla2x00_set_driver_version(scsi_qla_host_t *vha, char *version) | |
| 3871 | −{ | |
| 3872 | − int rval; | |
| 3873 | − mbx_cmd_t mc; | |
| 3874 | − mbx_cmd_t *mcp = &mc; | |
| 3875 | − int len; | |
| 3876 | − uint16_t dwlen; | |
| 3877 | − uint8_t *str; | |
| 3878 | − dma_addr_t str_dma; | |
| 3879 | − struct qla_hw_data *ha = vha->hw; | |
| 3880 | − | |
| 3881 | − if (!IS_FWI2_CAPABLE(ha) || IS_QLA82XX(ha)) | |
| 3882 | − return QLA_FUNCTION_FAILED; | |
| 3883 | − | |
| 3884 | − ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1155, | |
| 3885 | − "Entered %s.\n", __func__); | |
| 3886 | − | |
| 3887 | − str = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &str_dma); | |
| 3888 | − if (!str) { | |
| 3889 | − ql_log(ql_log_warn, vha, 0x1156, | |
| 3890 | − "Failed to allocate driver version param.\n"); | |
| 3891 | − return QLA_MEMORY_ALLOC_FAILED; | |
| 3892 | − } | |
| 3893 | − | |
| 3894 | − memcpy(str, "\x7\x3\x11\x0", 4); | |
| 3895 | − dwlen = str[0]; | |
| 3896 | − len = dwlen * sizeof(uint32_t) - 4; | |
| 3897 | − memset(str + 4, 0, len); | |
| 3898 | − if (len > strlen(version)) | |
| 3899 | − len = strlen(version); | |
| 3900 | − memcpy(str + 4, version, len); | |
| 3901 | − | |
| 3902 | − mcp->mb[0] = MBC_SET_RNID_PARAMS; | |
| 3903 | − mcp->mb[1] = RNID_TYPE_SET_VERSION << 8 | dwlen; | |
| 3904 | − mcp->mb[2] = MSW(LSD(str_dma)); | |
| 3905 | − mcp->mb[3] = LSW(LSD(str_dma)); | |
| 3906 | − mcp->mb[6] = MSW(MSD(str_dma)); | |
| 3907 | − mcp->mb[7] = LSW(MSD(str_dma)); | |
| 3908 | − mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; | |
| 3909 | − mcp->in_mb = MBX_0; | |
| 3910 | − mcp->tov = MBX_TOV_SECONDS; | |
| 3911 | − mcp->flags = 0; | |
| 3912 | − rval = qla2x00_mailbox_command(vha, mcp); | |
| 3913 | − | |
| 3914 | − if (rval != QLA_SUCCESS) { | |
| 3915 | − ql_dbg(ql_dbg_mbx, vha, 0x1157, | |
| 3916 | − "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); | |
| 3917 | − } else { | |
| 3918 | − ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1158, | |
| 3919 | − "Done %s.\n", __func__); | |
| 3920 | − } | |
| 3921 | − | |
| 3922 | − dma_pool_free(ha->s_dma_pool, str, str_dma); | |
| 3923 | − | |
| 3924 | − return rval; | |
| 3925 | −} | |
| 3926 | − | |
| 3927 | 3869 | static int |
| 3928 | 3870 | qla2x00_read_asic_temperature(scsi_qla_host_t *vha, uint16_t *temp) |
| 3929 | 3871 | { |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | /* |
| 8 | 8 | * Driver version |
| 9 | 9 | */ |
| 10 | −#define QLA2XXX_VERSION "8.04.00.08-k" | |
| 10 | +#define QLA2XXX_VERSION "8.04.00.13-k" | |
| 11 | 11 | |
| 12 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
| 13 | 13 | #define QLA_DRIVER_MINOR_VER 4 |
| @@ -4112,6 +4112,10 @@ static int st_probe(struct device *dev) · 4111 unmodified lines | ||
| 4112 | 4112 | tpnt->disk = disk; |
| 4113 | 4113 | disk->private_data = &tpnt->driver; |
| 4114 | 4114 | disk->queue = SDp->request_queue; |
| 4115 | + /* SCSI tape doesn't register this gendisk via add_disk(). Manually | |
| 4116 | + * take queue reference that release_disk() expects. */ | |
| 4117 | + if (!blk_get_queue(disk->queue)) | |
| 4118 | + goto out_put_disk; | |
| 4115 | 4119 | tpnt->driver = &st_template; |
| 4116 | 4120 | |
| 4117 | 4121 | tpnt->device = SDp; |
| @@ -4185,7 +4189,7 @@ static int st_probe(struct device *dev) · 67 unmodified lines | ||
| 4185 | 4189 | idr_preload_end(); |
| 4186 | 4190 | if (error < 0) { |
| 4187 | 4191 | pr_warn("st: idr allocation failed: %d\n", error); |
| 4188 | − goto out_put_disk; | |
| 4192 | + goto out_put_queue; | |
| 4189 | 4193 | } |
| 4190 | 4194 | tpnt->index = error; |
| 4191 | 4195 | sprintf(disk->disk_name, "st%d", tpnt->index); |
| @@ -4211,6 +4215,8 @@ out_remove_devs: · 19 unmodified lines | ||
| 4211 | 4215 | spin_lock(&st_index_lock); |
| 4212 | 4216 | idr_remove(&st_index_idr, tpnt->index); |
| 4213 | 4217 | spin_unlock(&st_index_lock); |
| 4218 | +out_put_queue: | |
| 4219 | + blk_put_queue(disk->queue); | |
| 4214 | 4220 | out_put_disk: |
| 4215 | 4221 | put_disk(disk); |
| 4216 | 4222 | kfree(tpnt); |
| @@ -670,3 +670,32 @@ u32 ssb_pmu_get_controlclock(struct ssb_chipcommon *cc) · 669 unmodified lines | ||
| 670 | 670 | return 0; |
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | + | |
| 674 | +void ssb_pmu_spuravoid_pllupdate(struct ssb_chipcommon *cc, int spuravoid) | |
| 675 | +{ | |
| 676 | + u32 pmu_ctl = 0; | |
| 677 | + | |
| 678 | + switch (cc->dev->bus->chip_id) { | |
| 679 | + case 0x4322: | |
| 680 | + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL0, 0x11100070); | |
| 681 | + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL1, 0x1014140a); | |
| 682 | + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL5, 0x88888854); | |
| 683 | + if (spuravoid == 1) | |
| 684 | + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL2, 0x05201828); | |
| 685 | + else | |
| 686 | + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL2, 0x05001828); | |
| 687 | + pmu_ctl = SSB_CHIPCO_PMU_CTL_PLL_UPD; | |
| 688 | + break; | |
| 689 | + case 43222: | |
| 690 | + /* TODO: BCM43222 requires updating PLLs too */ | |
| 691 | + return; | |
| 692 | + default: | |
| 693 | + ssb_printk(KERN_ERR PFX | |
| 694 | + "Unknown spuravoidance settings for chip 0x%04X, not changing PLL\n", | |
| 695 | + cc->dev->bus->chip_id); | |
| 696 | + return; | |
| 697 | + } | |
| 698 | + | |
| 699 | + chipco_set32(cc, SSB_CHIPCO_PMU_CTL, pmu_ctl); | |
| 700 | +} | |
| 701 | +EXPORT_SYMBOL_GPL(ssb_pmu_spuravoid_pllupdate); | |
| @@ -409,6 +409,7 @@ static inline int core_alua_state_standby( · 408 unmodified lines | ||
| 409 | 409 | case REPORT_LUNS: |
| 410 | 410 | case RECEIVE_DIAGNOSTIC: |
| 411 | 411 | case SEND_DIAGNOSTIC: |
| 412 | + return 0; | |
| 412 | 413 | case MAINTENANCE_IN: |
| 413 | 414 | switch (cdb[1] & 0x1f) { |
| 414 | 415 | case MI_REPORT_TARGET_PGS: |
| @@ -451,6 +452,7 @@ static inline int core_alua_state_unavailable( · 36 unmodified lines | ||
| 451 | 452 | switch (cdb[0]) { |
| 452 | 453 | case INQUIRY: |
| 453 | 454 | case REPORT_LUNS: |
| 455 | + return 0; | |
| 454 | 456 | case MAINTENANCE_IN: |
| 455 | 457 | switch (cdb[1] & 0x1f) { |
| 456 | 458 | case MI_REPORT_TARGET_PGS: |
| @@ -491,6 +493,7 @@ static inline int core_alua_state_transition( · 34 unmodified lines | ||
| 491 | 493 | switch (cdb[0]) { |
| 492 | 494 | case INQUIRY: |
| 493 | 495 | case REPORT_LUNS: |
| 496 | + return 0; | |
| 494 | 497 | case MAINTENANCE_IN: |
| 495 | 498 | switch (cdb[1] & 0x1f) { |
| 496 | 499 | case MI_REPORT_TARGET_PGS: |
| @@ -2643,9 +2643,9 @@ static int mxser_probe(struct pci_dev *pdev, · 2642 unmodified lines | ||
| 2643 | 2643 | mxvar_sdriver, brd->idx + i, &pdev->dev); |
| 2644 | 2644 | if (IS_ERR(tty_dev)) { |
| 2645 | 2645 | retval = PTR_ERR(tty_dev); |
| 2646 | − for (i--; i >= 0; i--) | |
| 2646 | + for (; i > 0; i--) | |
| 2647 | 2647 | tty_unregister_device(mxvar_sdriver, |
| 2648 | − brd->idx + i); | |
| 2648 | + brd->idx + i - 1); | |
| 2649 | 2649 | goto err_relbrd; |
| 2650 | 2650 | } |
| 2651 | 2651 | } |
| @@ -2751,9 +2751,9 @@ static int __init mxser_module_init(void) · 99 unmodified lines | ||
| 2751 | 2751 | tty_dev = tty_port_register_device(&brd->ports[i].port, |
| 2752 | 2752 | mxvar_sdriver, brd->idx + i, NULL); |
| 2753 | 2753 | if (IS_ERR(tty_dev)) { |
| 2754 | − for (i--; i >= 0; i--) | |
| 2754 | + for (; i > 0; i--) | |
| 2755 | 2755 | tty_unregister_device(mxvar_sdriver, |
| 2756 | − brd->idx + i); | |
| 2756 | + brd->idx + i - 1); | |
| 2757 | 2757 | for (i = 0; i < brd->info->nports; i++) |
| 2758 | 2758 | tty_port_destroy(&brd->ports[i].port); |
| 2759 | 2759 | free_irq(brd->irq, brd); |
| @@ -429,7 +429,6 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) · 428 unmodified lines | ||
| 429 | 429 | { |
| 430 | 430 | struct uart_8250_port uart; |
| 431 | 431 | int ret, line, flags = dev_id->driver_data; |
| 432 | − struct resource *res = NULL; | |
| 433 | 432 | |
| 434 | 433 | if (flags & UNKNOWN_DEV) { |
| 435 | 434 | ret = serial_pnp_guess_board(dev); |
| @@ -440,12 +439,11 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) · 4 unmodified lines | ||
| 440 | 439 | memset(&uart, 0, sizeof(uart)); |
| 441 | 440 | if (pnp_irq_valid(dev, 0)) |
| 442 | 441 | uart.port.irq = pnp_irq(dev, 0); |
| 443 | − if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) | |
| 444 | − res = pnp_get_resource(dev, IORESOURCE_IO, 2); | |
| 445 | − else if (pnp_port_valid(dev, 0)) | |
| 446 | − res = pnp_get_resource(dev, IORESOURCE_IO, 0); | |
| 447 | − if (pnp_resource_enabled(res)) { | |
| 448 | − uart.port.iobase = res->start; | |
| 442 | + if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) { | |
| 443 | + uart.port.iobase = pnp_port_start(dev, 2); | |
| 444 | + uart.port.iotype = UPIO_PORT; | |
| 445 | + } else if (pnp_port_valid(dev, 0)) { | |
| 446 | + uart.port.iobase = pnp_port_start(dev, 0); | |
| 449 | 447 | uart.port.iotype = UPIO_PORT; |
| 450 | 448 | } else if (pnp_mem_valid(dev, 0)) { |
| 451 | 449 | uart.port.mapbase = pnp_mem_start(dev, 0); |
| @@ -886,6 +886,17 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios, · 885 unmodified lines | ||
| 886 | 886 | serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR); |
| 887 | 887 | /* FIFO ENABLE, DMA MODE */ |
| 888 | 888 | |
| 889 | + up->scr |= OMAP_UART_SCR_RX_TRIG_GRANU1_MASK; | |
| 890 | + /* | |
| 891 | + * NOTE: Setting OMAP_UART_SCR_RX_TRIG_GRANU1_MASK | |
| 892 | + * sets Enables the granularity of 1 for TRIGGER RX | |
| 893 | + * level. Along with setting RX FIFO trigger level | |
| 894 | + * to 1 (as noted below, 16 characters) and TLR[3:0] | |
| 895 | + * to zero this will result RX FIFO threshold level | |
| 896 | + * to 1 character, instead of 16 as noted in comment | |
| 897 | + * below. | |
| 898 | + */ | |
| 899 | + | |
| 889 | 900 | /* Set receive FIFO threshold to 16 characters and |
| 890 | 901 | * transmit FIFO threshold to 16 spaces |
| 891 | 902 | */ |
| @@ -346,6 +346,7 @@ static long vfio_pci_ioctl(void *device_data, · 345 unmodified lines | ||
| 346 | 346 | |
| 347 | 347 | if (!(hdr.flags & VFIO_IRQ_SET_DATA_NONE)) { |
| 348 | 348 | size_t size; |
| 349 | + int max = vfio_pci_get_irq_count(vdev, hdr.index); | |
| 349 | 350 | |
| 350 | 351 | if (hdr.flags & VFIO_IRQ_SET_DATA_BOOL) |
| 351 | 352 | size = sizeof(uint8_t); |
| @@ -355,7 +356,7 @@ static long vfio_pci_ioctl(void *device_data, · 3 unmodified lines | ||
| 355 | 356 | return -EINVAL; |
| 356 | 357 | |
| 357 | 358 | if (hdr.argsz - minsz < hdr.count * size || |
| 358 | − hdr.count > vfio_pci_get_irq_count(vdev, hdr.index)) | |
| 359 | + hdr.start >= max || hdr.start + hdr.count > max) | |
| 359 | 360 | return -EINVAL; |
| 360 | 361 | |
| 361 | 362 | data = memdup_user((void __user *)(arg + minsz), |
| @@ -74,9 +74,8 @@ enum { · 73 unmodified lines | ||
| 74 | 74 | |
| 75 | 75 | struct vhost_scsi { |
| 76 | 76 | /* Protected by vhost_scsi->dev.mutex */ |
| 77 | − struct tcm_vhost_tpg *vs_tpg[VHOST_SCSI_MAX_TARGET]; | |
| 77 | + struct tcm_vhost_tpg **vs_tpg; | |
| 78 | 78 | char vs_vhost_wwpn[TRANSPORT_IQN_LEN]; |
| 79 | − bool vs_endpoint; | |
| 80 | 79 | |
| 81 | 80 | struct vhost_dev dev; |
| 82 | 81 | struct vhost_virtqueue vqs[VHOST_SCSI_MAX_VQ]; |
| @@ -579,9 +578,27 @@ static void tcm_vhost_submission_work(struct work_struct *work) · 496 unmodified lines | ||
| 579 | 578 | } |
| 580 | 579 | } |
| 581 | 580 | |
| 581 | +static void vhost_scsi_send_bad_target(struct vhost_scsi *vs, | |
| 582 | + struct vhost_virtqueue *vq, int head, unsigned out) | |
| 583 | +{ | |
| 584 | + struct virtio_scsi_cmd_resp __user *resp; | |
| 585 | + struct virtio_scsi_cmd_resp rsp; | |
| 586 | + int ret; | |
| 587 | + | |
| 588 | + memset(&rsp, 0, sizeof(rsp)); | |
| 589 | + rsp.response = VIRTIO_SCSI_S_BAD_TARGET; | |
| 590 | + resp = vq->iov[out].iov_base; | |
| 591 | + ret = __copy_to_user(resp, &rsp, sizeof(rsp)); | |
| 592 | + if (!ret) | |
| 593 | + vhost_add_used_and_signal(&vs->dev, vq, head, 0); | |
| 594 | + else | |
| 595 | + pr_err("Faulted on virtio_scsi_cmd_resp\n"); | |
| 596 | +} | |
| 597 | + | |
| 582 | 598 | static void vhost_scsi_handle_vq(struct vhost_scsi *vs, |
| 583 | 599 | struct vhost_virtqueue *vq) |
| 584 | 600 | { |
| 601 | + struct tcm_vhost_tpg **vs_tpg; | |
| 585 | 602 | struct virtio_scsi_cmd_req v_req; |
| 586 | 603 | struct tcm_vhost_tpg *tv_tpg; |
| 587 | 604 | struct tcm_vhost_cmd *tv_cmd; |
| @@ -590,8 +607,16 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, · 2 unmodified lines | ||
| 590 | 607 | int head, ret; |
| 591 | 608 | u8 target; |
| 592 | 609 | |
| 593 | − /* Must use ioctl VHOST_SCSI_SET_ENDPOINT */ | |
| 594 | − if (unlikely(!vs->vs_endpoint)) | |
| 610 | + /* | |
| 611 | + * We can handle the vq only after the endpoint is setup by calling the | |
| 612 | + * VHOST_SCSI_SET_ENDPOINT ioctl. | |
| 613 | + * | |
| 614 | + * TODO: Check that we are running from vhost_worker which acts | |
| 615 | + * as read-side critical section for vhost kind of RCU. | |
| 616 | + * See the comments in struct vhost_virtqueue in drivers/vhost/vhost.h | |
| 617 | + */ | |
| 618 | + vs_tpg = rcu_dereference_check(vq->private_data, 1); | |
| 619 | + if (!vs_tpg) | |
| 595 | 620 | return; |
| 596 | 621 | |
| 597 | 622 | mutex_lock(&vq->mutex); |
| @@ -661,23 +686,11 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, · 63 unmodified lines | ||
| 661 | 686 | |
| 662 | 687 | /* Extract the tpgt */ |
| 663 | 688 | target = v_req.lun[1]; |
| 664 | − tv_tpg = vs->vs_tpg[target]; | |
| 689 | + tv_tpg = ACCESS_ONCE(vs_tpg[target]); | |
| 665 | 690 | |
| 666 | 691 | /* Target does not exist, fail the request */ |
| 667 | 692 | if (unlikely(!tv_tpg)) { |
| 668 | − struct virtio_scsi_cmd_resp __user *resp; | |
| 669 | − struct virtio_scsi_cmd_resp rsp; | |
| 670 | − | |
| 671 | − memset(&rsp, 0, sizeof(rsp)); | |
| 672 | − rsp.response = VIRTIO_SCSI_S_BAD_TARGET; | |
| 673 | − resp = vq->iov[out].iov_base; | |
| 674 | − ret = __copy_to_user(resp, &rsp, sizeof(rsp)); | |
| 675 | − if (!ret) | |
| 676 | − vhost_add_used_and_signal(&vs->dev, | |
| 677 | − vq, head, 0); | |
| 678 | − else | |
| 679 | − pr_err("Faulted on virtio_scsi_cmd_resp\n"); | |
| 680 | − | |
| 693 | + vhost_scsi_send_bad_target(vs, vq, head, out); | |
| 681 | 694 | continue; |
| 682 | 695 | } |
| 683 | 696 | |
| @@ -690,22 +703,13 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, · 6 unmodified lines | ||
| 690 | 703 | if (IS_ERR(tv_cmd)) { |
| 691 | 704 | vq_err(vq, "vhost_scsi_allocate_cmd failed %ld\n", |
| 692 | 705 | PTR_ERR(tv_cmd)); |
| 693 | − break; | |
| 706 | + goto err_cmd; | |
| 694 | 707 | } |
| 695 | 708 | pr_debug("Allocated tv_cmd: %p exp_data_len: %d, data_direction" |
| 696 | 709 | ": %d\n", tv_cmd, exp_data_len, data_direction); |
| 697 | 710 | |
| 698 | 711 | tv_cmd->tvc_vhost = vs; |
| 699 | 712 | tv_cmd->tvc_vq = vq; |
| 700 | − | |
| 701 | − if (unlikely(vq->iov[out].iov_len != | |
| 702 | − sizeof(struct virtio_scsi_cmd_resp))) { | |
| 703 | − vq_err(vq, "Expecting virtio_scsi_cmd_resp, got %zu" | |
| 704 | − " bytes, out: %d, in: %d\n", | |
| 705 | − vq->iov[out].iov_len, out, in); | |
| 706 | − break; | |
| 707 | − } | |
| 708 | − | |
| 709 | 713 | tv_cmd->tvc_resp = vq->iov[out].iov_base; |
| 710 | 714 | |
| 711 | 715 | /* |
| @@ -725,7 +729,7 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, · 13 unmodified lines | ||
| 725 | 729 | " exceeds SCSI_MAX_VARLEN_CDB_SIZE: %d\n", |
| 726 | 730 | scsi_command_size(tv_cmd->tvc_cdb), |
| 727 | 731 | TCM_VHOST_MAX_CDB_SIZE); |
| 728 | − break; /* TODO */ | |
| 732 | + goto err_free; | |
| 729 | 733 | } |
| 730 | 734 | tv_cmd->tvc_lun = ((v_req.lun[2] << 8) | v_req.lun[3]) & 0x3FFF; |
| 731 | 735 | |
| @@ -738,7 +742,7 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, · 6 unmodified lines | ||
| 738 | 742 | data_direction == DMA_TO_DEVICE); |
| 739 | 743 | if (unlikely(ret)) { |
| 740 | 744 | vq_err(vq, "Failed to map iov to sgl\n"); |
| 741 | − break; /* TODO */ | |
| 745 | + goto err_free; | |
| 742 | 746 | } |
| 743 | 747 | } |
| 744 | 748 | |
| @@ -759,6 +763,13 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, · 14 unmodified lines | ||
| 759 | 763 | } |
| 760 | 764 | |
| 761 | 765 | mutex_unlock(&vq->mutex); |
| 766 | + return; | |
| 767 | + | |
| 768 | +err_free: | |
| 769 | + vhost_scsi_free_cmd(tv_cmd); | |
| 770 | +err_cmd: | |
| 771 | + vhost_scsi_send_bad_target(vs, vq, head, out); | |
| 772 | + mutex_unlock(&vq->mutex); | |
| 762 | 773 | } |
| 763 | 774 | |
| 764 | 775 | static void vhost_scsi_ctl_handle_kick(struct vhost_work *work) |
| @@ -780,6 +791,20 @@ static void vhost_scsi_handle_kick(struct vhost_work *work) · 15 unmodified lines | ||
| 780 | 791 | vhost_scsi_handle_vq(vs, vq); |
| 781 | 792 | } |
| 782 | 793 | |
| 794 | +static void vhost_scsi_flush_vq(struct vhost_scsi *vs, int index) | |
| 795 | +{ | |
| 796 | + vhost_poll_flush(&vs->dev.vqs[index].poll); | |
| 797 | +} | |
| 798 | + | |
| 799 | +static void vhost_scsi_flush(struct vhost_scsi *vs) | |
| 800 | +{ | |
| 801 | + int i; | |
| 802 | + | |
| 803 | + for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) | |
| 804 | + vhost_scsi_flush_vq(vs, i); | |
| 805 | + vhost_work_flush(&vs->dev, &vs->vs_completion_work); | |
| 806 | +} | |
| 807 | + | |
| 783 | 808 | /* |
| 784 | 809 | * Called from vhost_scsi_ioctl() context to walk the list of available |
| 785 | 810 | * tcm_vhost_tpg with an active struct tcm_vhost_nexus |
| @@ -790,8 +815,10 @@ static int vhost_scsi_set_endpoint( · 4 unmodified lines | ||
| 790 | 815 | { |
| 791 | 816 | struct tcm_vhost_tport *tv_tport; |
| 792 | 817 | struct tcm_vhost_tpg *tv_tpg; |
| 818 | + struct tcm_vhost_tpg **vs_tpg; | |
| 819 | + struct vhost_virtqueue *vq; | |
| 820 | + int index, ret, i, len; | |
| 793 | 821 | bool match = false; |
| 794 | − int index, ret; | |
| 795 | 822 | |
| 796 | 823 | mutex_lock(&vs->dev.mutex); |
| 797 | 824 | /* Verify that ring has been setup correctly. */ |
| @@ -803,6 +830,15 @@ static int vhost_scsi_set_endpoint( · 5 unmodified lines | ||
| 803 | 830 | } |
| 804 | 831 | } |
| 805 | 832 | |
| 833 | + len = sizeof(vs_tpg[0]) * VHOST_SCSI_MAX_TARGET; | |
| 834 | + vs_tpg = kzalloc(len, GFP_KERNEL); | |
| 835 | + if (!vs_tpg) { | |
| 836 | + mutex_unlock(&vs->dev.mutex); | |
| 837 | + return -ENOMEM; | |
| 838 | + } | |
| 839 | + if (vs->vs_tpg) | |
| 840 | + memcpy(vs_tpg, vs->vs_tpg, len); | |
| 841 | + | |
| 806 | 842 | mutex_lock(&tcm_vhost_mutex); |
| 807 | 843 | list_for_each_entry(tv_tpg, &tcm_vhost_list, tv_tpg_list) { |
| 808 | 844 | mutex_lock(&tv_tpg->tv_tpg_mutex); |
| @@ -817,14 +853,15 @@ static int vhost_scsi_set_endpoint( · 8 unmodified lines | ||
| 817 | 853 | tv_tport = tv_tpg->tport; |
| 818 | 854 | |
| 819 | 855 | if (!strcmp(tv_tport->tport_name, t->vhost_wwpn)) { |
| 820 | − if (vs->vs_tpg[tv_tpg->tport_tpgt]) { | |
| 856 | + if (vs->vs_tpg && vs->vs_tpg[tv_tpg->tport_tpgt]) { | |
| 821 | 857 | mutex_unlock(&tv_tpg->tv_tpg_mutex); |
| 822 | 858 | mutex_unlock(&tcm_vhost_mutex); |
| 823 | 859 | mutex_unlock(&vs->dev.mutex); |
| 860 | + kfree(vs_tpg); | |
| 824 | 861 | return -EEXIST; |
| 825 | 862 | } |
| 826 | 863 | tv_tpg->tv_tpg_vhost_count++; |
| 827 | − vs->vs_tpg[tv_tpg->tport_tpgt] = tv_tpg; | |
| 864 | + vs_tpg[tv_tpg->tport_tpgt] = tv_tpg; | |
| 828 | 865 | smp_mb__after_atomic_inc(); |
| 829 | 866 | match = true; |
| 830 | 867 | } |
| @@ -835,12 +872,27 @@ static int vhost_scsi_set_endpoint( · 4 unmodified lines | ||
| 835 | 872 | if (match) { |
| 836 | 873 | memcpy(vs->vs_vhost_wwpn, t->vhost_wwpn, |
| 837 | 874 | sizeof(vs->vs_vhost_wwpn)); |
| 838 | − vs->vs_endpoint = true; | |
| 875 | + for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | |
| 876 | + vq = &vs->vqs[i]; | |
| 877 | + /* Flushing the vhost_work acts as synchronize_rcu */ | |
| 878 | + mutex_lock(&vq->mutex); | |
| 879 | + rcu_assign_pointer(vq->private_data, vs_tpg); | |
| 880 | + vhost_init_used(vq); | |
| 881 | + mutex_unlock(&vq->mutex); | |
| 882 | + } | |
| 839 | 883 | ret = 0; |
| 840 | 884 | } else { |
| 841 | 885 | ret = -EEXIST; |
| 842 | 886 | } |
| 843 | 887 | |
| 888 | + /* | |
| 889 | + * Act as synchronize_rcu to make sure access to | |
| 890 | + * old vs->vs_tpg is finished. | |
| 891 | + */ | |
| 892 | + vhost_scsi_flush(vs); | |
| 893 | + kfree(vs->vs_tpg); | |
| 894 | + vs->vs_tpg = vs_tpg; | |
| 895 | + | |
| 844 | 896 | mutex_unlock(&vs->dev.mutex); |
| 845 | 897 | return ret; |
| 846 | 898 | } |
| @@ -851,6 +903,8 @@ static int vhost_scsi_clear_endpoint( · 4 unmodified lines | ||
| 851 | 903 | { |
| 852 | 904 | struct tcm_vhost_tport *tv_tport; |
| 853 | 905 | struct tcm_vhost_tpg *tv_tpg; |
| 906 | + struct vhost_virtqueue *vq; | |
| 907 | + bool match = false; | |
| 854 | 908 | int index, ret, i; |
| 855 | 909 | u8 target; |
| 856 | 910 | |
| @@ -862,9 +916,14 @@ static int vhost_scsi_clear_endpoint( · 5 unmodified lines | ||
| 862 | 916 | goto err_dev; |
| 863 | 917 | } |
| 864 | 918 | } |
| 919 | + | |
| 920 | + if (!vs->vs_tpg) { | |
| 921 | + mutex_unlock(&vs->dev.mutex); | |
| 922 | + return 0; | |
| 923 | + } | |
| 924 | + | |
| 865 | 925 | for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) { |
| 866 | 926 | target = i; |
| 867 | − | |
| 868 | 927 | tv_tpg = vs->vs_tpg[target]; |
| 869 | 928 | if (!tv_tpg) |
| 870 | 929 | continue; |
| @@ -886,10 +945,27 @@ static int vhost_scsi_clear_endpoint( · 15 unmodified lines | ||
| 886 | 945 | } |
| 887 | 946 | tv_tpg->tv_tpg_vhost_count--; |
| 888 | 947 | vs->vs_tpg[target] = NULL; |
| 889 | − vs->vs_endpoint = false; | |
| 948 | + match = true; | |
| 890 | 949 | mutex_unlock(&tv_tpg->tv_tpg_mutex); |
| 891 | 950 | } |
| 951 | + if (match) { | |
| 952 | + for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | |
| 953 | + vq = &vs->vqs[i]; | |
| 954 | + /* Flushing the vhost_work acts as synchronize_rcu */ | |
| 955 | + mutex_lock(&vq->mutex); | |
| 956 | + rcu_assign_pointer(vq->private_data, NULL); | |
| 957 | + mutex_unlock(&vq->mutex); | |
| 958 | + } | |
| 959 | + } | |
| 960 | + /* | |
| 961 | + * Act as synchronize_rcu to make sure access to | |
| 962 | + * old vs->vs_tpg is finished. | |
| 963 | + */ | |
| 964 | + vhost_scsi_flush(vs); | |
| 965 | + kfree(vs->vs_tpg); | |
| 966 | + vs->vs_tpg = NULL; | |
| 892 | 967 | mutex_unlock(&vs->dev.mutex); |
| 968 | + | |
| 893 | 969 | return 0; |
| 894 | 970 | |
| 895 | 971 | err_tpg: |
| @@ -899,6 +975,24 @@ err_dev: · 3 unmodified lines | ||
| 899 | 975 | return ret; |
| 900 | 976 | } |
| 901 | 977 | |
| 978 | +static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | |
| 979 | +{ | |
| 980 | + if (features & ~VHOST_SCSI_FEATURES) | |
| 981 | + return -EOPNOTSUPP; | |
| 982 | + | |
| 983 | + mutex_lock(&vs->dev.mutex); | |
| 984 | + if ((features & (1 << VHOST_F_LOG_ALL)) && | |
| 985 | + !vhost_log_access_ok(&vs->dev)) { | |
| 986 | + mutex_unlock(&vs->dev.mutex); | |
| 987 | + return -EFAULT; | |
| 988 | + } | |
| 989 | + vs->dev.acked_features = features; | |
| 990 | + smp_wmb(); | |
| 991 | + vhost_scsi_flush(vs); | |
| 992 | + mutex_unlock(&vs->dev.mutex); | |
| 993 | + return 0; | |
| 994 | +} | |
| 995 | + | |
| 902 | 996 | static int vhost_scsi_open(struct inode *inode, struct file *f) |
| 903 | 997 | { |
| 904 | 998 | struct vhost_scsi *s; |
| @@ -939,38 +1033,6 @@ static int vhost_scsi_release(struct inode *inode, struct file *f) · 34 unmodified lines | ||
| 939 | 1033 | return 0; |
| 940 | 1034 | } |
| 941 | 1035 | |
| 942 | −static void vhost_scsi_flush_vq(struct vhost_scsi *vs, int index) | |
| 943 | −{ | |
| 944 | − vhost_poll_flush(&vs->dev.vqs[index].poll); | |
| 945 | −} | |
| 946 | − | |
| 947 | −static void vhost_scsi_flush(struct vhost_scsi *vs) | |
| 948 | −{ | |
| 949 | − int i; | |
| 950 | − | |
| 951 | − for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) | |
| 952 | − vhost_scsi_flush_vq(vs, i); | |
| 953 | − vhost_work_flush(&vs->dev, &vs->vs_completion_work); | |
| 954 | −} | |
| 955 | − | |
| 956 | −static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | |
| 957 | −{ | |
| 958 | − if (features & ~VHOST_SCSI_FEATURES) | |
| 959 | − return -EOPNOTSUPP; | |
| 960 | − | |
| 961 | − mutex_lock(&vs->dev.mutex); | |
| 962 | − if ((features & (1 << VHOST_F_LOG_ALL)) && | |
| 963 | − !vhost_log_access_ok(&vs->dev)) { | |
| 964 | − mutex_unlock(&vs->dev.mutex); | |
| 965 | − return -EFAULT; | |
| 966 | − } | |
| 967 | − vs->dev.acked_features = features; | |
| 968 | − smp_wmb(); | |
| 969 | − vhost_scsi_flush(vs); | |
| 970 | − mutex_unlock(&vs->dev.mutex); | |
| 971 | − return 0; | |
| 972 | −} | |
| 973 | − | |
| 974 | 1036 | static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl, |
| 975 | 1037 | unsigned long arg) |
| 976 | 1038 | { |
| @@ -1373,15 +1373,12 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) · 1372 unmodified lines | ||
| 1373 | 1373 | { |
| 1374 | 1374 | struct fb_info *info = file_fb_info(file); |
| 1375 | 1375 | struct fb_ops *fb; |
| 1376 | − unsigned long off; | |
| 1376 | + unsigned long mmio_pgoff; | |
| 1377 | 1377 | unsigned long start; |
| 1378 | 1378 | u32 len; |
| 1379 | 1379 | |
| 1380 | 1380 | if (!info) |
| 1381 | 1381 | return -ENODEV; |
| 1382 | − if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) | |
| 1383 | − return -EINVAL; | |
| 1384 | − off = vma->vm_pgoff << PAGE_SHIFT; | |
| 1385 | 1382 | fb = info->fbops; |
| 1386 | 1383 | if (!fb) |
| 1387 | 1384 | return -ENODEV; |
| @@ -1393,32 +1390,24 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) · 5 unmodified lines | ||
| 1393 | 1390 | return res; |
| 1394 | 1391 | } |
| 1395 | 1392 | |
| 1396 | − /* frame buffer memory */ | |
| 1393 | + /* | |
| 1394 | + * Ugh. This can be either the frame buffer mapping, or | |
| 1395 | + * if pgoff points past it, the mmio mapping. | |
| 1396 | + */ | |
| 1397 | 1397 | start = info->fix.smem_start; |
| 1398 | − len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len); | |
| 1399 | − if (off >= len) { | |
| 1400 | − /* memory mapped io */ | |
| 1401 | − off -= len; | |
| 1402 | − if (info->var.accel_flags) { | |
| 1403 | − mutex_unlock(&info->mm_lock); | |
| 1404 | − return -EINVAL; | |
| 1405 | − } | |
| 1398 | + len = info->fix.smem_len; | |
| 1399 | + mmio_pgoff = PAGE_ALIGN((start & ~PAGE_MASK) + len) >> PAGE_SHIFT; | |
| 1400 | + if (vma->vm_pgoff >= mmio_pgoff) { | |
| 1401 | + vma->vm_pgoff -= mmio_pgoff; | |
| 1406 | 1402 | start = info->fix.mmio_start; |
| 1407 | − len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len); | |
| 1403 | + len = info->fix.mmio_len; | |
| 1408 | 1404 | } |
| 1409 | 1405 | mutex_unlock(&info->mm_lock); |
| 1410 | − start &= PAGE_MASK; | |
| 1411 | − if ((vma->vm_end - vma->vm_start + off) > len) | |
| 1412 | − return -EINVAL; | |
| 1413 | − off += start; | |
| 1414 | − vma->vm_pgoff = off >> PAGE_SHIFT; | |
| 1415 | − /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by io_remap_pfn_range()*/ | |
| 1406 | + | |
| 1416 | 1407 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); |
| 1417 | − fb_pgprotect(file, vma, off); | |
| 1418 | − if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | |
| 1419 | − vma->vm_end - vma->vm_start, vma->vm_page_prot)) | |
| 1420 | − return -EAGAIN; | |
| 1421 | − return 0; | |
| 1408 | + fb_pgprotect(file, vma, start); | |
| 1409 | + | |
| 1410 | + return vm_iomap_memory(vma, start, len); | |
| 1422 | 1411 | } |
| 1423 | 1412 | |
| 1424 | 1413 | static int |
| @@ -252,7 +252,5 @@ void mmp_unregister_path(struct mmp_path *path) · 251 unmodified lines | ||
| 252 | 252 | |
| 253 | 253 | kfree(path); |
| 254 | 254 | mutex_unlock(&disp_lock); |
| 255 | − | |
| 256 | − dev_info(path->dev, "de-register %s\n", path->name); | |
| 257 | 255 | } |
| 258 | 256 | EXPORT_SYMBOL_GPL(mmp_unregister_path); |
| @@ -117,7 +117,7 @@ config ARM_SP805_WATCHDOG · 116 unmodified lines | ||
| 117 | 117 | |
| 118 | 118 | config AT91RM9200_WATCHDOG |
| 119 | 119 | tristate "AT91RM9200 watchdog" |
| 120 | − depends on ARCH_AT91 | |
| 120 | + depends on ARCH_AT91RM9200 | |
| 121 | 121 | help |
| 122 | 122 | Watchdog timer embedded into AT91RM9200 chips. This will reboot your |
| 123 | 123 | system when the timeout is reached. |
| @@ -1316,7 +1316,7 @@ static void __xen_evtchn_do_upcall(void) · 1315 unmodified lines | ||
| 1316 | 1316 | { |
| 1317 | 1317 | int start_word_idx, start_bit_idx; |
| 1318 | 1318 | int word_idx, bit_idx; |
| 1319 | − int i; | |
| 1319 | + int i, irq; | |
| 1320 | 1320 | int cpu = get_cpu(); |
| 1321 | 1321 | struct shared_info *s = HYPERVISOR_shared_info; |
| 1322 | 1322 | struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu); |
| @@ -1324,6 +1324,8 @@ static void __xen_evtchn_do_upcall(void) · 1 unmodified line | ||
| 1324 | 1324 | |
| 1325 | 1325 | do { |
| 1326 | 1326 | xen_ulong_t pending_words; |
| 1327 | + xen_ulong_t pending_bits; | |
| 1328 | + struct irq_desc *desc; | |
| 1327 | 1329 | |
| 1328 | 1330 | vcpu_info->evtchn_upcall_pending = 0; |
| 1329 | 1331 | |
| @@ -1335,6 +1337,17 @@ static void __xen_evtchn_do_upcall(void) · 5 unmodified lines | ||
| 1335 | 1337 | * selector flag. xchg_xen_ulong must contain an |
| 1336 | 1338 | * appropriate barrier. |
| 1337 | 1339 | */ |
| 1340 | + if ((irq = per_cpu(virq_to_irq, cpu)[VIRQ_TIMER]) != -1) { | |
| 1341 | + int evtchn = evtchn_from_irq(irq); | |
| 1342 | + word_idx = evtchn / BITS_PER_LONG; | |
| 1343 | + pending_bits = evtchn % BITS_PER_LONG; | |
| 1344 | + if (active_evtchns(cpu, s, word_idx) & (1ULL << pending_bits)) { | |
| 1345 | + desc = irq_to_desc(irq); | |
| 1346 | + if (desc) | |
| 1347 | + generic_handle_irq_desc(irq, desc); | |
| 1348 | + } | |
| 1349 | + } | |
| 1350 | + | |
| 1338 | 1351 | pending_words = xchg_xen_ulong(&vcpu_info->evtchn_pending_sel, 0); |
| 1339 | 1352 | |
| 1340 | 1353 | start_word_idx = __this_cpu_read(current_word_idx); |
| @@ -1343,7 +1356,6 @@ static void __xen_evtchn_do_upcall(void) · 2 unmodified lines | ||
| 1343 | 1356 | word_idx = start_word_idx; |
| 1344 | 1357 | |
| 1345 | 1358 | for (i = 0; pending_words != 0; i++) { |
| 1346 | − xen_ulong_t pending_bits; | |
| 1347 | 1359 | xen_ulong_t words; |
| 1348 | 1360 | |
| 1349 | 1361 | words = MASK_LSBS(pending_words, word_idx); |
| @@ -1372,8 +1384,7 @@ static void __xen_evtchn_do_upcall(void) · 22 unmodified lines | ||
| 1372 | 1384 | |
| 1373 | 1385 | do { |
| 1374 | 1386 | xen_ulong_t bits; |
| 1375 | − int port, irq; | |
| 1376 | − struct irq_desc *desc; | |
| 1387 | + int port; | |
| 1377 | 1388 | |
| 1378 | 1389 | bits = MASK_LSBS(pending_bits, bit_idx); |
| 1379 | 1390 | |
| @@ -1137,6 +1137,7 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma, · 1136 unmodified lines | ||
| 1137 | 1137 | goto whole; |
| 1138 | 1138 | if (!(vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_PRIVATE)) |
| 1139 | 1139 | goto whole; |
| 1140 | + return 0; | |
| 1140 | 1141 | } |
| 1141 | 1142 | |
| 1142 | 1143 | /* Do not dump I/O mapped devices or special mappings */ |
| @@ -1428,8 +1428,6 @@ void bio_endio(struct bio *bio, int error) · 1427 unmodified lines | ||
| 1428 | 1428 | else if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) |
| 1429 | 1429 | error = -EIO; |
| 1430 | 1430 | |
| 1431 | − trace_block_bio_complete(bio, error); | |
| 1432 | − | |
| 1433 | 1431 | if (bio->bi_end_io) |
| 1434 | 1432 | bio->bi_end_io(bio, error); |
| 1435 | 1433 | } |
| @@ -317,6 +317,7 @@ static noinline int overwrite_item(struct btrfs_trans_handle *trans, · 316 unmodified lines | ||
| 317 | 317 | unsigned long src_ptr; |
| 318 | 318 | unsigned long dst_ptr; |
| 319 | 319 | int overwrite_root = 0; |
| 320 | + bool inode_item = key->type == BTRFS_INODE_ITEM_KEY; | |
| 320 | 321 | |
| 321 | 322 | if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) |
| 322 | 323 | overwrite_root = 1; |
| @@ -326,6 +327,9 @@ static noinline int overwrite_item(struct btrfs_trans_handle *trans, · 3 unmodified lines | ||
| 326 | 327 | |
| 327 | 328 | /* look for the key in the destination tree */ |
| 328 | 329 | ret = btrfs_search_slot(NULL, root, key, path, 0, 0); |
| 330 | + if (ret < 0) | |
| 331 | + return ret; | |
| 332 | + | |
| 329 | 333 | if (ret == 0) { |
| 330 | 334 | char *src_copy; |
| 331 | 335 | char *dst_copy; |
| @@ -367,6 +371,30 @@ static noinline int overwrite_item(struct btrfs_trans_handle *trans, · 35 unmodified lines | ||
| 367 | 371 | return 0; |
| 368 | 372 | } |
| 369 | 373 | |
| 374 | + /* | |
| 375 | + * We need to load the old nbytes into the inode so when we | |
| 376 | + * replay the extents we've logged we get the right nbytes. | |
| 377 | + */ | |
| 378 | + if (inode_item) { | |
| 379 | + struct btrfs_inode_item *item; | |
| 380 | + u64 nbytes; | |
| 381 | + | |
| 382 | + item = btrfs_item_ptr(path->nodes[0], path->slots[0], | |
| 383 | + struct btrfs_inode_item); | |
| 384 | + nbytes = btrfs_inode_nbytes(path->nodes[0], item); | |
| 385 | + item = btrfs_item_ptr(eb, slot, | |
| 386 | + struct btrfs_inode_item); | |
| 387 | + btrfs_set_inode_nbytes(eb, item, nbytes); | |
| 388 | + } | |
| 389 | + } else if (inode_item) { | |
| 390 | + struct btrfs_inode_item *item; | |
| 391 | + | |
| 392 | + /* | |
| 393 | + * New inode, set nbytes to 0 so that the nbytes comes out | |
| 394 | + * properly when we replay the extents. | |
| 395 | + */ | |
| 396 | + item = btrfs_item_ptr(eb, slot, struct btrfs_inode_item); | |
| 397 | + btrfs_set_inode_nbytes(eb, item, 0); | |
| 370 | 398 | } |
| 371 | 399 | insert: |
| 372 | 400 | btrfs_release_path(path); |
| @@ -486,7 +514,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, · 113 unmodified lines | ||
| 486 | 514 | int found_type; |
| 487 | 515 | u64 extent_end; |
| 488 | 516 | u64 start = key->offset; |
| 489 | − u64 saved_nbytes; | |
| 517 | + u64 nbytes = 0; | |
| 490 | 518 | struct btrfs_file_extent_item *item; |
| 491 | 519 | struct inode *inode = NULL; |
| 492 | 520 | unsigned long size; |
| @@ -496,10 +524,19 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, · 3 unmodified lines | ||
| 496 | 524 | found_type = btrfs_file_extent_type(eb, item); |
| 497 | 525 | |
| 498 | 526 | if (found_type == BTRFS_FILE_EXTENT_REG || |
| 499 | − found_type == BTRFS_FILE_EXTENT_PREALLOC) | |
| 500 | − extent_end = start + btrfs_file_extent_num_bytes(eb, item); | |
| 501 | − else if (found_type == BTRFS_FILE_EXTENT_INLINE) { | |
| 527 | + found_type == BTRFS_FILE_EXTENT_PREALLOC) { | |
| 528 | + nbytes = btrfs_file_extent_num_bytes(eb, item); | |
| 529 | + extent_end = start + nbytes; | |
| 530 | + | |
| 531 | + /* | |
| 532 | + * We don't add to the inodes nbytes if we are prealloc or a | |
| 533 | + * hole. | |
| 534 | + */ | |
| 535 | + if (btrfs_file_extent_disk_bytenr(eb, item) == 0) | |
| 536 | + nbytes = 0; | |
| 537 | + } else if (found_type == BTRFS_FILE_EXTENT_INLINE) { | |
| 502 | 538 | size = btrfs_file_extent_inline_len(eb, item); |
| 539 | + nbytes = btrfs_file_extent_ram_bytes(eb, item); | |
| 503 | 540 | extent_end = ALIGN(start + size, root->sectorsize); |
| 504 | 541 | } else { |
| 505 | 542 | ret = 0; |
| @@ -548,7 +585,6 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, · 42 unmodified lines | ||
| 548 | 585 | } |
| 549 | 586 | btrfs_release_path(path); |
| 550 | 587 | |
| 551 | − saved_nbytes = inode_get_bytes(inode); | |
| 552 | 588 | /* drop any overlapping extents */ |
| 553 | 589 | ret = btrfs_drop_extents(trans, root, inode, start, extent_end, 1); |
| 554 | 590 | BUG_ON(ret); |
| @@ -635,7 +671,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, · 80 unmodified lines | ||
| 635 | 671 | BUG_ON(ret); |
| 636 | 672 | } |
| 637 | 673 | |
| 638 | − inode_set_bytes(inode, saved_nbytes); | |
| 674 | + inode_add_bytes(inode, nbytes); | |
| 639 | 675 | ret = btrfs_update_inode(trans, root, inode); |
| 640 | 676 | out: |
| 641 | 677 | if (inode) |
| @@ -1575,14 +1575,24 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, · 1574 unmodified lines | ||
| 1575 | 1575 | } |
| 1576 | 1576 | break; |
| 1577 | 1577 | case Opt_blank_pass: |
| 1578 | − vol->password = NULL; | |
| 1579 | − break; | |
| 1580 | − case Opt_pass: | |
| 1581 | 1578 | /* passwords have to be handled differently |
| 1582 | 1579 | * to allow the character used for deliminator |
| 1583 | 1580 | * to be passed within them |
| 1584 | 1581 | */ |
| 1585 | 1582 | |
| 1583 | + /* | |
| 1584 | + * Check if this is a case where the password | |
| 1585 | + * starts with a delimiter | |
| 1586 | + */ | |
| 1587 | + tmp_end = strchr(data, '='); | |
| 1588 | + tmp_end++; | |
| 1589 | + if (!(tmp_end < end && tmp_end[1] == delim)) { | |
| 1590 | + /* No it is not. Set the password to NULL */ | |
| 1591 | + vol->password = NULL; | |
| 1592 | + break; | |
| 1593 | + } | |
| 1594 | + /* Yes it is. Drop down to Opt_pass below.*/ | |
| 1595 | + case Opt_pass: | |
| 1586 | 1596 | /* Obtain the value string */ |
| 1587 | 1597 | value = strchr(data, '='); |
| 1588 | 1598 | value++; |
| @@ -80,13 +80,6 @@ ecryptfs_miscdev_open(struct inode *inode, struct file *file) · 79 unmodified lines | ||
| 80 | 80 | int rc; |
| 81 | 81 | |
| 82 | 82 | mutex_lock(&ecryptfs_daemon_hash_mux); |
| 83 | − rc = try_module_get(THIS_MODULE); | |
| 84 | − if (rc == 0) { | |
| 85 | − rc = -EIO; | |
| 86 | − printk(KERN_ERR "%s: Error attempting to increment module use " | |
| 87 | − "count; rc = [%d]\n", __func__, rc); | |
| 88 | − goto out_unlock_daemon_list; | |
| 89 | − } | |
| 90 | 83 | rc = ecryptfs_find_daemon_by_euid(&daemon); |
| 91 | 84 | if (!rc) { |
| 92 | 85 | rc = -EINVAL; |
| @@ -96,7 +89,7 @@ ecryptfs_miscdev_open(struct inode *inode, struct file *file) · 3 unmodified lines | ||
| 96 | 89 | if (rc) { |
| 97 | 90 | printk(KERN_ERR "%s: Error attempting to spawn daemon; " |
| 98 | 91 | "rc = [%d]\n", __func__, rc); |
| 99 | − goto out_module_put_unlock_daemon_list; | |
| 92 | + goto out_unlock_daemon_list; | |
| 100 | 93 | } |
| 101 | 94 | mutex_lock(&daemon->mux); |
| 102 | 95 | if (daemon->flags & ECRYPTFS_DAEMON_MISCDEV_OPEN) { |
| @@ -108,9 +101,6 @@ ecryptfs_miscdev_open(struct inode *inode, struct file *file) · 5 unmodified lines | ||
| 108 | 101 | atomic_inc(&ecryptfs_num_miscdev_opens); |
| 109 | 102 | out_unlock_daemon: |
| 110 | 103 | mutex_unlock(&daemon->mux); |
| 111 | −out_module_put_unlock_daemon_list: | |
| 112 | − if (rc) | |
| 113 | − module_put(THIS_MODULE); | |
| 114 | 104 | out_unlock_daemon_list: |
| 115 | 105 | mutex_unlock(&ecryptfs_daemon_hash_mux); |
| 116 | 106 | return rc; |
| @@ -147,7 +137,6 @@ ecryptfs_miscdev_release(struct inode *inode, struct file *file) · 30 unmodified lines | ||
| 147 | 137 | "bug.\n", __func__, rc); |
| 148 | 138 | BUG(); |
| 149 | 139 | } |
| 150 | − module_put(THIS_MODULE); | |
| 151 | 140 | return rc; |
| 152 | 141 | } |
| 153 | 142 | |
| @@ -471,6 +460,7 @@ out_free: · 317 unmodified lines | ||
| 471 | 460 | |
| 472 | 461 | |
| 473 | 462 | static const struct file_operations ecryptfs_miscdev_fops = { |
| 463 | + .owner = THIS_MODULE, | |
| 474 | 464 | .open = ecryptfs_miscdev_open, |
| 475 | 465 | .poll = ecryptfs_miscdev_poll, |
| 476 | 466 | .read = ecryptfs_miscdev_read, |
| @@ -533,7 +533,7 @@ void hfsplus_file_truncate(struct inode *inode) · 532 unmodified lines | ||
| 533 | 533 | struct address_space *mapping = inode->i_mapping; |
| 534 | 534 | struct page *page; |
| 535 | 535 | void *fsdata; |
| 536 | − u32 size = inode->i_size; | |
| 536 | + loff_t size = inode->i_size; | |
| 537 | 537 | |
| 538 | 538 | res = pagecache_write_begin(NULL, mapping, size, 0, |
| 539 | 539 | AOP_FLAG_UNINTERRUPTIBLE, |
| @@ -110,7 +110,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) · 109 unmodified lines | ||
| 110 | 110 | * way when do_mmap_pgoff unwinds (may be important on powerpc |
| 111 | 111 | * and ia64). |
| 112 | 112 | */ |
| 113 | − vma->vm_flags |= VM_HUGETLB | VM_DONTEXPAND | VM_DONTDUMP; | |
| 113 | + vma->vm_flags |= VM_HUGETLB | VM_DONTEXPAND; | |
| 114 | 114 | vma->vm_ops = &hugetlb_vm_ops; |
| 115 | 115 | |
| 116 | 116 | if (vma->vm_pgoff & (~huge_page_mask(h) >> PAGE_SHIFT)) |
| @@ -725,7 +725,7 @@ void prune_icache_sb(struct super_block *sb, int nr_to_scan) · 724 unmodified lines | ||
| 725 | 725 | * inode to the back of the list so we don't spin on it. |
| 726 | 726 | */ |
| 727 | 727 | if (!spin_trylock(&inode->i_lock)) { |
| 728 | − list_move_tail(&inode->i_lru, &sb->s_inode_lru); | |
| 728 | + list_move(&inode->i_lru, &sb->s_inode_lru); | |
| 729 | 729 | continue; |
| 730 | 730 | } |
| 731 | 731 | |
| @@ -1690,7 +1690,7 @@ static int do_loopback(struct path *path, const char *old_name, · 1689 unmodified lines | ||
| 1690 | 1690 | |
| 1691 | 1691 | if (IS_ERR(mnt)) { |
| 1692 | 1692 | err = PTR_ERR(mnt); |
| 1693 | − goto out; | |
| 1693 | + goto out2; | |
| 1694 | 1694 | } |
| 1695 | 1695 | |
| 1696 | 1696 | err = graft_tree(mnt, path); |
| @@ -300,7 +300,7 @@ int nfs40_walk_client_list(struct nfs_client *new, · 299 unmodified lines | ||
| 300 | 300 | struct rpc_cred *cred) |
| 301 | 301 | { |
| 302 | 302 | struct nfs_net *nn = net_generic(new->cl_net, nfs_net_id); |
| 303 | − struct nfs_client *pos, *n, *prev = NULL; | |
| 303 | + struct nfs_client *pos, *prev = NULL; | |
| 304 | 304 | struct nfs4_setclientid_res clid = { |
| 305 | 305 | .clientid = new->cl_clientid, |
| 306 | 306 | .confirm = new->cl_confirm, |
| @@ -308,10 +308,23 @@ int nfs40_walk_client_list(struct nfs_client *new, · 1 unmodified line | ||
| 308 | 308 | int status = -NFS4ERR_STALE_CLIENTID; |
| 309 | 309 | |
| 310 | 310 | spin_lock(&nn->nfs_client_lock); |
| 311 | − list_for_each_entry_safe(pos, n, &nn->nfs_client_list, cl_share_link) { | |
| 311 | + list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { | |
| 312 | 312 | /* If "pos" isn't marked ready, we can't trust the |
| 313 | 313 | * remaining fields in "pos" */ |
| 314 | − if (pos->cl_cons_state < NFS_CS_READY) | |
| 314 | + if (pos->cl_cons_state > NFS_CS_READY) { | |
| 315 | + atomic_inc(&pos->cl_count); | |
| 316 | + spin_unlock(&nn->nfs_client_lock); | |
| 317 | + | |
| 318 | + if (prev) | |
| 319 | + nfs_put_client(prev); | |
| 320 | + prev = pos; | |
| 321 | + | |
| 322 | + status = nfs_wait_client_init_complete(pos); | |
| 323 | + spin_lock(&nn->nfs_client_lock); | |
| 324 | + if (status < 0) | |
| 325 | + continue; | |
| 326 | + } | |
| 327 | + if (pos->cl_cons_state != NFS_CS_READY) | |
| 315 | 328 | continue; |
| 316 | 329 | |
| 317 | 330 | if (pos->rpc_ops != new->rpc_ops) |
| @@ -423,16 +436,16 @@ int nfs41_walk_client_list(struct nfs_client *new, · 105 unmodified lines | ||
| 423 | 436 | struct rpc_cred *cred) |
| 424 | 437 | { |
| 425 | 438 | struct nfs_net *nn = net_generic(new->cl_net, nfs_net_id); |
| 426 | − struct nfs_client *pos, *n, *prev = NULL; | |
| 439 | + struct nfs_client *pos, *prev = NULL; | |
| 427 | 440 | int status = -NFS4ERR_STALE_CLIENTID; |
| 428 | 441 | |
| 429 | 442 | spin_lock(&nn->nfs_client_lock); |
| 430 | − list_for_each_entry_safe(pos, n, &nn->nfs_client_list, cl_share_link) { | |
| 443 | + list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { | |
| 431 | 444 | /* If "pos" isn't marked ready, we can't trust the |
| 432 | 445 | * remaining fields in "pos", especially the client |
| 433 | 446 | * ID and serverowner fields. Wait for CREATE_SESSION |
| 434 | 447 | * to finish. */ |
| 435 | − if (pos->cl_cons_state < NFS_CS_READY) { | |
| 448 | + if (pos->cl_cons_state > NFS_CS_READY) { | |
| 436 | 449 | atomic_inc(&pos->cl_count); |
| 437 | 450 | spin_unlock(&nn->nfs_client_lock); |
| 438 | 451 | |
| @@ -440,18 +453,17 @@ int nfs41_walk_client_list(struct nfs_client *new, · 1 unmodified line | ||
| 440 | 453 | nfs_put_client(prev); |
| 441 | 454 | prev = pos; |
| 442 | 455 | |
| 443 | − nfs4_schedule_lease_recovery(pos); | |
| 444 | 456 | status = nfs_wait_client_init_complete(pos); |
| 445 | − if (status < 0) { | |
| 446 | − nfs_put_client(pos); | |
| 447 | − spin_lock(&nn->nfs_client_lock); | |
| 448 | − continue; | |
| 457 | + if (status == 0) { | |
| 458 | + nfs4_schedule_lease_recovery(pos); | |
| 459 | + status = nfs4_wait_clnt_recover(pos); | |
| 449 | 460 | } |
| 450 | − status = pos->cl_cons_state; | |
| 451 | 461 | spin_lock(&nn->nfs_client_lock); |
| 452 | 462 | if (status < 0) |
| 453 | 463 | continue; |
| 454 | 464 | } |
| 465 | + if (pos->cl_cons_state != NFS_CS_READY) | |
| 466 | + continue; | |
| 455 | 467 | |
| 456 | 468 | if (pos->rpc_ops != new->rpc_ops) |
| 457 | 469 | continue; |
| @@ -469,17 +481,18 @@ int nfs41_walk_client_list(struct nfs_client *new, · 11 unmodified lines | ||
| 469 | 481 | continue; |
| 470 | 482 | |
| 471 | 483 | atomic_inc(&pos->cl_count); |
| 472 | − spin_unlock(&nn->nfs_client_lock); | |
| 484 | + *result = pos; | |
| 485 | + status = 0; | |
| 473 | 486 | dprintk("NFS: <-- %s using nfs_client = %p ({%d})\n", |
| 474 | 487 | __func__, pos, atomic_read(&pos->cl_count)); |
| 475 | − | |
| 476 | − *result = pos; | |
| 477 | − return 0; | |
| 488 | + break; | |
| 478 | 489 | } |
| 479 | 490 | |
| 480 | 491 | /* No matching nfs_client found. */ |
| 481 | 492 | spin_unlock(&nn->nfs_client_lock); |
| 482 | 493 | dprintk("NFS: <-- %s status = %d\n", __func__, status); |
| 494 | + if (prev) | |
| 495 | + nfs_put_client(prev); | |
| 483 | 496 | return status; |
| 484 | 497 | } |
| 485 | 498 | #endif /* CONFIG_NFS_V4_1 */ |
| @@ -1046,6 +1046,7 @@ static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata) · 1045 unmodified lines | ||
| 1046 | 1046 | /* Save the delegation */ |
| 1047 | 1047 | nfs4_stateid_copy(&stateid, &delegation->stateid); |
| 1048 | 1048 | rcu_read_unlock(); |
| 1049 | + nfs_release_seqid(opendata->o_arg.seqid); | |
| 1049 | 1050 | ret = nfs_may_open(state->inode, state->owner->so_cred, open_mode); |
| 1050 | 1051 | if (ret != 0) |
| 1051 | 1052 | goto out; |
| @@ -1886,7 +1886,13 @@ again: · 1885 unmodified lines | ||
| 1886 | 1886 | status = PTR_ERR(clnt); |
| 1887 | 1887 | break; |
| 1888 | 1888 | } |
| 1889 | − clp->cl_rpcclient = clnt; | |
| 1889 | + /* Note: this is safe because we haven't yet marked the | |
| 1890 | + * client as ready, so we are the only user of | |
| 1891 | + * clp->cl_rpcclient | |
| 1892 | + */ | |
| 1893 | + clnt = xchg(&clp->cl_rpcclient, clnt); | |
| 1894 | + rpc_shutdown_client(clnt); | |
| 1895 | + clnt = clp->cl_rpcclient; | |
| 1890 | 1896 | goto again; |
| 1891 | 1897 | |
| 1892 | 1898 | case -NFS4ERR_MINOR_VERS_MISMATCH: |
| @@ -143,6 +143,7 @@ static const char * const task_state_array[] = { · 142 unmodified lines | ||
| 143 | 143 | "x (dead)", /* 64 */ |
| 144 | 144 | "K (wakekill)", /* 128 */ |
| 145 | 145 | "W (waking)", /* 256 */ |
| 146 | + "P (parked)", /* 512 */ | |
| 146 | 147 | }; |
| 147 | 148 | |
| 148 | 149 | static inline const char *get_task_state(struct task_struct *tsk) |
| @@ -755,37 +755,8 @@ void pde_put(struct proc_dir_entry *pde) · 754 unmodified lines | ||
| 755 | 755 | free_proc_entry(pde); |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | −/* | |
| 759 | − * Remove a /proc entry and free it if it's not currently in use. | |
| 760 | − */ | |
| 761 | −void remove_proc_entry(const char *name, struct proc_dir_entry *parent) | |
| 758 | +static void entry_rundown(struct proc_dir_entry *de) | |
| 762 | 759 | { |
| 763 | − struct proc_dir_entry **p; | |
| 764 | − struct proc_dir_entry *de = NULL; | |
| 765 | − const char *fn = name; | |
| 766 | − unsigned int len; | |
| 767 | − | |
| 768 | − spin_lock(&proc_subdir_lock); | |
| 769 | − if (__xlate_proc_name(name, &parent, &fn) != 0) { | |
| 770 | − spin_unlock(&proc_subdir_lock); | |
| 771 | − return; | |
| 772 | − } | |
| 773 | − len = strlen(fn); | |
| 774 | − | |
| 775 | − for (p = &parent->subdir; *p; p=&(*p)->next ) { | |
| 776 | − if (proc_match(len, fn, *p)) { | |
| 777 | − de = *p; | |
| 778 | − *p = de->next; | |
| 779 | − de->next = NULL; | |
| 780 | − break; | |
| 781 | − } | |
| 782 | − } | |
| 783 | − spin_unlock(&proc_subdir_lock); | |
| 784 | − if (!de) { | |
| 785 | − WARN(1, "name '%s'\n", name); | |
| 786 | − return; | |
| 787 | − } | |
| 788 | − | |
| 789 | 760 | spin_lock(&de->pde_unload_lock); |
| 790 | 761 | /* |
| 791 | 762 | * Stop accepting new callers into module. If you're |
| @@ -817,6 +788,40 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent) · 25 unmodified lines | ||
| 817 | 788 | spin_lock(&de->pde_unload_lock); |
| 818 | 789 | } |
| 819 | 790 | spin_unlock(&de->pde_unload_lock); |
| 791 | +} | |
| 792 | + | |
| 793 | +/* | |
| 794 | + * Remove a /proc entry and free it if it's not currently in use. | |
| 795 | + */ | |
| 796 | +void remove_proc_entry(const char *name, struct proc_dir_entry *parent) | |
| 797 | +{ | |
| 798 | + struct proc_dir_entry **p; | |
| 799 | + struct proc_dir_entry *de = NULL; | |
| 800 | + const char *fn = name; | |
| 801 | + unsigned int len; | |
| 802 | + | |
| 803 | + spin_lock(&proc_subdir_lock); | |
| 804 | + if (__xlate_proc_name(name, &parent, &fn) != 0) { | |
| 805 | + spin_unlock(&proc_subdir_lock); | |
| 806 | + return; | |
| 807 | + } | |
| 808 | + len = strlen(fn); | |
| 809 | + | |
| 810 | + for (p = &parent->subdir; *p; p=&(*p)->next ) { | |
| 811 | + if (proc_match(len, fn, *p)) { | |
| 812 | + de = *p; | |
| 813 | + *p = de->next; | |
| 814 | + de->next = NULL; | |
| 815 | + break; | |
| 816 | + } | |
| 817 | + } | |
| 818 | + spin_unlock(&proc_subdir_lock); | |
| 819 | + if (!de) { | |
| 820 | + WARN(1, "name '%s'\n", name); | |
| 821 | + return; | |
| 822 | + } | |
| 823 | + | |
| 824 | + entry_rundown(de); | |
| 820 | 825 | |
| 821 | 826 | if (S_ISDIR(de->mode)) |
| 822 | 827 | parent->nlink--; |
| @@ -827,3 +832,57 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent) · 4 unmodified lines | ||
| 827 | 832 | pde_put(de); |
| 828 | 833 | } |
| 829 | 834 | EXPORT_SYMBOL(remove_proc_entry); |
| 835 | + | |
| 836 | +int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) | |
| 837 | +{ | |
| 838 | + struct proc_dir_entry **p; | |
| 839 | + struct proc_dir_entry *root = NULL, *de, *next; | |
| 840 | + const char *fn = name; | |
| 841 | + unsigned int len; | |
| 842 | + | |
| 843 | + spin_lock(&proc_subdir_lock); | |
| 844 | + if (__xlate_proc_name(name, &parent, &fn) != 0) { | |
| 845 | + spin_unlock(&proc_subdir_lock); | |
| 846 | + return -ENOENT; | |
| 847 | + } | |
| 848 | + len = strlen(fn); | |
| 849 | + | |
| 850 | + for (p = &parent->subdir; *p; p=&(*p)->next ) { | |
| 851 | + if (proc_match(len, fn, *p)) { | |
| 852 | + root = *p; | |
| 853 | + *p = root->next; | |
| 854 | + root->next = NULL; | |
| 855 | + break; | |
| 856 | + } | |
| 857 | + } | |
| 858 | + if (!root) { | |
| 859 | + spin_unlock(&proc_subdir_lock); | |
| 860 | + return -ENOENT; | |
| 861 | + } | |
| 862 | + de = root; | |
| 863 | + while (1) { | |
| 864 | + next = de->subdir; | |
| 865 | + if (next) { | |
| 866 | + de->subdir = next->next; | |
| 867 | + next->next = NULL; | |
| 868 | + de = next; | |
| 869 | + continue; | |
| 870 | + } | |
| 871 | + spin_unlock(&proc_subdir_lock); | |
| 872 | + | |
| 873 | + entry_rundown(de); | |
| 874 | + next = de->parent; | |
| 875 | + if (S_ISDIR(de->mode)) | |
| 876 | + next->nlink--; | |
| 877 | + de->nlink = 0; | |
| 878 | + if (de == root) | |
| 879 | + break; | |
| 880 | + pde_put(de); | |
| 881 | + | |
| 882 | + spin_lock(&proc_subdir_lock); | |
| 883 | + de = next; | |
| 884 | + } | |
| 885 | + pde_put(root); | |
| 886 | + return 0; | |
| 887 | +} | |
| 888 | +EXPORT_SYMBOL(remove_proc_subtree); | |
| @@ -99,7 +99,12 @@ struct mmu_gather { · 98 unmodified lines | ||
| 99 | 99 | unsigned int need_flush : 1, /* Did free PTEs */ |
| 100 | 100 | fast_mode : 1; /* No batching */ |
| 101 | 101 | |
| 102 | − unsigned int fullmm; | |
| 102 | + /* we are in the middle of an operation to clear | |
| 103 | + * a full mm and can make some optimizations */ | |
| 104 | + unsigned int fullmm : 1, | |
| 105 | + /* we have performed an operation which | |
| 106 | + * requires a complete flush of the tlb */ | |
| 107 | + need_flush_all : 1; | |
| 103 | 108 | |
| 104 | 109 | struct mmu_gather_batch *active; |
| 105 | 110 | struct mmu_gather_batch local; |
| @@ -954,7 +954,7 @@ static inline int atapi_cdb_len(const u16 *dev_id) · 953 unmodified lines | ||
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | 956 | |
| 957 | −static inline bool atapi_command_packet_set(const u16 *dev_id) | |
| 957 | +static inline int atapi_command_packet_set(const u16 *dev_id) | |
| 958 | 958 | { |
| 959 | 959 | return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f; |
| 960 | 960 | } |
| @@ -12,7 +12,6 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | struct blk_trace { |
| 14 | 14 | int trace_state; |
| 15 | − bool rq_based; | |
| 16 | 15 | struct rchan *rchan; |
| 17 | 16 | unsigned long __percpu *sequence; |
| 18 | 17 | unsigned char __percpu *msg_data; |
| @@ -35,6 +35,7 @@ struct cpu_vfs_cap_data { · 34 unmodified lines | ||
| 35 | 35 | #define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t)) |
| 36 | 36 | |
| 37 | 37 | |
| 38 | +struct file; | |
| 38 | 39 | struct inode; |
| 39 | 40 | struct dentry; |
| 40 | 41 | struct user_namespace; |
| @@ -211,6 +212,7 @@ extern bool capable(int cap); · 170 unmodified lines | ||
| 211 | 212 | extern bool ns_capable(struct user_namespace *ns, int cap); |
| 212 | 213 | extern bool nsown_capable(int cap); |
| 213 | 214 | extern bool inode_capable(const struct inode *inode, int cap); |
| 215 | +extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); | |
| 214 | 216 | |
| 215 | 217 | /* audit system wants to get cap info from files as well */ |
| 216 | 218 | extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps); |
| @@ -333,6 +333,7 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules, · 332 unmodified lines | ||
| 333 | 333 | unsigned long count, |
| 334 | 334 | u64 *max_size, |
| 335 | 335 | int *reset_type); |
| 336 | +typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long size); | |
| 336 | 337 | |
| 337 | 338 | /* |
| 338 | 339 | * EFI Configuration Table and GUID definitions |
| @@ -575,9 +576,15 @@ extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if pos · 236 unmodified lines | ||
| 575 | 576 | #ifdef CONFIG_X86 |
| 576 | 577 | extern void efi_late_init(void); |
| 577 | 578 | extern void efi_free_boot_services(void); |
| 579 | +extern efi_status_t efi_query_variable_store(u32 attributes, unsigned long size); | |
| 578 | 580 | #else |
| 579 | 581 | static inline void efi_late_init(void) {} |
| 580 | 582 | static inline void efi_free_boot_services(void) {} |
| 583 | + | |
| 584 | +static inline efi_status_t efi_query_variable_store(u32 attributes, unsigned long size) | |
| 585 | +{ | |
| 586 | + return EFI_SUCCESS; | |
| 587 | +} | |
| 581 | 588 | #endif |
| 582 | 589 | extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr); |
| 583 | 590 | extern u64 efi_get_iobase (void); |
| @@ -731,7 +738,7 @@ struct efivar_operations { · 147 unmodified lines | ||
| 731 | 738 | efi_get_variable_t *get_variable; |
| 732 | 739 | efi_get_next_variable_t *get_next_variable; |
| 733 | 740 | efi_set_variable_t *set_variable; |
| 734 | − efi_query_variable_info_t *query_variable_info; | |
| 741 | + efi_query_variable_store_t *query_variable_store; | |
| 735 | 742 | }; |
| 736 | 743 | |
| 737 | 744 | struct efivars { |
| @@ -89,6 +89,7 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip, · 88 unmodified lines | ||
| 89 | 89 | * that the call back has its own recursion protection. If it does |
| 90 | 90 | * not set this, then the ftrace infrastructure will add recursion |
| 91 | 91 | * protection for the caller. |
| 92 | + * STUB - The ftrace_ops is just a place holder. | |
| 92 | 93 | */ |
| 93 | 94 | enum { |
| 94 | 95 | FTRACE_OPS_FL_ENABLED = 1 << 0, |
| @@ -98,6 +99,7 @@ enum { · 3 unmodified lines | ||
| 98 | 99 | FTRACE_OPS_FL_SAVE_REGS = 1 << 4, |
| 99 | 100 | FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 5, |
| 100 | 101 | FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6, |
| 102 | + FTRACE_OPS_FL_STUB = 1 << 7, | |
| 101 | 103 | }; |
| 102 | 104 | |
| 103 | 105 | struct ftrace_ops { |
| @@ -394,7 +396,6 @@ ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf, · 290 unmodified lines | ||
| 394 | 396 | size_t cnt, loff_t *ppos); |
| 395 | 397 | ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf, |
| 396 | 398 | size_t cnt, loff_t *ppos); |
| 397 | −loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence); | |
| 398 | 399 | int ftrace_regex_release(struct inode *inode, struct file *file); |
| 399 | 400 | |
| 400 | 401 | void __init |
| @@ -567,6 +568,8 @@ static inline int · 166 unmodified lines | ||
| 567 | 568 | ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; } |
| 568 | 569 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
| 569 | 570 | |
| 571 | +loff_t ftrace_filter_lseek(struct file *file, loff_t offset, int whence); | |
| 572 | + | |
| 570 | 573 | /* totally disable ftrace - can not re-enable after this */ |
| 571 | 574 | void ftrace_kill(void); |
| 572 | 575 | |
| @@ -200,6 +200,8 @@ extern size_t vmcoreinfo_max_size; · 199 unmodified lines | ||
| 200 | 200 | |
| 201 | 201 | int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, |
| 202 | 202 | unsigned long long *crash_size, unsigned long long *crash_base); |
| 203 | +int parse_crashkernel_high(char *cmdline, unsigned long long system_ram, | |
| 204 | + unsigned long long *crash_size, unsigned long long *crash_base); | |
| 203 | 205 | int parse_crashkernel_low(char *cmdline, unsigned long long system_ram, |
| 204 | 206 | unsigned long long *crash_size, unsigned long long *crash_base); |
| 205 | 207 | int crash_shrink_memory(unsigned long new_size); |
| @@ -518,7 +518,7 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, · 517 unmodified lines | ||
| 518 | 518 | int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
| 519 | 519 | void *data, unsigned long len); |
| 520 | 520 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
| 521 | − gpa_t gpa); | |
| 521 | + gpa_t gpa, unsigned long len); | |
| 522 | 522 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); |
| 523 | 523 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); |
| 524 | 524 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); |
| @@ -71,6 +71,7 @@ struct gfn_to_hva_cache { · 70 unmodified lines | ||
| 71 | 71 | u64 generation; |
| 72 | 72 | gpa_t gpa; |
| 73 | 73 | unsigned long hva; |
| 74 | + unsigned long len; | |
| 74 | 75 | struct kvm_memory_slot *memslot; |
| 75 | 76 | }; |
| 76 | 77 | |
| @@ -398,6 +398,7 @@ enum { · 397 unmodified lines | ||
| 398 | 398 | ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */ |
| 399 | 399 | ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */ |
| 400 | 400 | ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */ |
| 401 | + ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */ | |
| 401 | 402 | |
| 402 | 403 | /* DMA mask for user DMA control: User visible values; DO NOT |
| 403 | 404 | renumber */ |
| @@ -1611,6 +1611,8 @@ int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, · 1610 unmodified lines | ||
| 1611 | 1611 | unsigned long pfn); |
| 1612 | 1612 | int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, |
| 1613 | 1613 | unsigned long pfn); |
| 1614 | +int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long len); | |
| 1615 | + | |
| 1614 | 1616 | |
| 1615 | 1617 | struct page *follow_page_mask(struct vm_area_struct *vma, |
| 1616 | 1618 | unsigned long address, unsigned int foll_flags, |
| @@ -291,6 +291,7 @@ ip_set_hash_destroy(struct ip_set *set) · 290 unmodified lines | ||
| 291 | 291 | #define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist) |
| 292 | 292 | #define type_pf_data_next TOKEN(TYPE, PF, _data_next) |
| 293 | 293 | #define type_pf_data_flags TOKEN(TYPE, PF, _data_flags) |
| 294 | +#define type_pf_data_reset_flags TOKEN(TYPE, PF, _data_reset_flags) | |
| 294 | 295 | #ifdef IP_SET_HASH_WITH_NETS |
| 295 | 296 | #define type_pf_data_match TOKEN(TYPE, PF, _data_match) |
| 296 | 297 | #else |
| @@ -385,9 +386,9 @@ type_pf_resize(struct ip_set *set, bool retried) · 88 unmodified lines | ||
| 385 | 386 | struct ip_set_hash *h = set->data; |
| 386 | 387 | struct htable *t, *orig = h->table; |
| 387 | 388 | u8 htable_bits = orig->htable_bits; |
| 388 | − const struct type_pf_elem *data; | |
| 389 | + struct type_pf_elem *data; | |
| 389 | 390 | struct hbucket *n, *m; |
| 390 | − u32 i, j; | |
| 391 | + u32 i, j, flags = 0; | |
| 391 | 392 | int ret; |
| 392 | 393 | |
| 393 | 394 | retry: |
| @@ -412,9 +413,16 @@ retry: · 18 unmodified lines | ||
| 412 | 413 | n = hbucket(orig, i); |
| 413 | 414 | for (j = 0; j < n->pos; j++) { |
| 414 | 415 | data = ahash_data(n, j); |
| 416 | +#ifdef IP_SET_HASH_WITH_NETS | |
| 417 | + flags = 0; | |
| 418 | + type_pf_data_reset_flags(data, &flags); | |
| 419 | +#endif | |
| 415 | 420 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); |
| 416 | − ret = type_pf_elem_add(m, data, AHASH_MAX(h), 0); | |
| 421 | + ret = type_pf_elem_add(m, data, AHASH_MAX(h), flags); | |
| 417 | 422 | if (ret < 0) { |
| 423 | +#ifdef IP_SET_HASH_WITH_NETS | |
| 424 | + type_pf_data_flags(data, flags); | |
| 425 | +#endif | |
| 418 | 426 | read_unlock_bh(&set->lock); |
| 419 | 427 | ahash_destroy(t); |
| 420 | 428 | if (ret == -EAGAIN) |
| @@ -836,9 +844,9 @@ type_pf_tresize(struct ip_set *set, bool retried) · 415 unmodified lines | ||
| 836 | 844 | struct ip_set_hash *h = set->data; |
| 837 | 845 | struct htable *t, *orig = h->table; |
| 838 | 846 | u8 htable_bits = orig->htable_bits; |
| 839 | − const struct type_pf_elem *data; | |
| 847 | + struct type_pf_elem *data; | |
| 840 | 848 | struct hbucket *n, *m; |
| 841 | − u32 i, j; | |
| 849 | + u32 i, j, flags = 0; | |
| 842 | 850 | int ret; |
| 843 | 851 | |
| 844 | 852 | /* Try to cleanup once */ |
| @@ -873,10 +881,17 @@ retry: · 28 unmodified lines | ||
| 873 | 881 | n = hbucket(orig, i); |
| 874 | 882 | for (j = 0; j < n->pos; j++) { |
| 875 | 883 | data = ahash_tdata(n, j); |
| 884 | +#ifdef IP_SET_HASH_WITH_NETS | |
| 885 | + flags = 0; | |
| 886 | + type_pf_data_reset_flags(data, &flags); | |
| 887 | +#endif | |
| 876 | 888 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); |
| 877 | − ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 0, | |
| 878 | − ip_set_timeout_get(type_pf_data_timeout(data))); | |
| 889 | + ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), flags, | |
| 890 | + ip_set_timeout_get(type_pf_data_timeout(data))); | |
| 879 | 891 | if (ret < 0) { |
| 892 | +#ifdef IP_SET_HASH_WITH_NETS | |
| 893 | + type_pf_data_flags(data, flags); | |
| 894 | +#endif | |
| 880 | 895 | read_unlock_bh(&set->lock); |
| 881 | 896 | ahash_destroy(t); |
| 882 | 897 | if (ret == -EAGAIN) |
| @@ -1187,6 +1202,7 @@ type_pf_gc_init(struct ip_set *set) · 304 unmodified lines | ||
| 1187 | 1202 | #undef type_pf_data_tlist |
| 1188 | 1203 | #undef type_pf_data_next |
| 1189 | 1204 | #undef type_pf_data_flags |
| 1205 | +#undef type_pf_data_reset_flags | |
| 1190 | 1206 | #undef type_pf_data_match |
| 1191 | 1207 | |
| 1192 | 1208 | #undef type_pf_elem |
| @@ -916,6 +916,7 @@ void pci_disable_rom(struct pci_dev *pdev); · 915 unmodified lines | ||
| 916 | 916 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); |
| 917 | 917 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); |
| 918 | 918 | size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size); |
| 919 | +void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size); | |
| 919 | 920 | |
| 920 | 921 | /* Power management related routines */ |
| 921 | 922 | int pci_save_state(struct pci_dev *dev); |
| @@ -93,14 +93,20 @@ do { \ · 92 unmodified lines | ||
| 93 | 93 | |
| 94 | 94 | #else /* !CONFIG_PREEMPT_COUNT */ |
| 95 | 95 | |
| 96 | −#define preempt_disable() do { } while (0) | |
| 97 | −#define sched_preempt_enable_no_resched() do { } while (0) | |
| 98 | −#define preempt_enable_no_resched() do { } while (0) | |
| 99 | −#define preempt_enable() do { } while (0) | |
| 100 | − | |
| 101 | −#define preempt_disable_notrace() do { } while (0) | |
| 102 | −#define preempt_enable_no_resched_notrace() do { } while (0) | |
| 103 | −#define preempt_enable_notrace() do { } while (0) | |
| 96 | +/* | |
| 97 | + * Even if we don't have any preemption, we need preempt disable/enable | |
| 98 | + * to be barriers, so that we don't have things like get_user/put_user | |
| 99 | + * that can cause faults and scheduling migrate into our preempt-protected | |
| 100 | + * region. | |
| 101 | + */ | |
| 102 | +#define preempt_disable() barrier() | |
| 103 | +#define sched_preempt_enable_no_resched() barrier() | |
| 104 | +#define preempt_enable_no_resched() barrier() | |
| 105 | +#define preempt_enable() barrier() | |
| 106 | + | |
| 107 | +#define preempt_disable_notrace() barrier() | |
| 108 | +#define preempt_enable_no_resched_notrace() barrier() | |
| 109 | +#define preempt_enable_notrace() barrier() | |
| 104 | 110 | |
| 105 | 111 | #endif /* CONFIG_PREEMPT_COUNT */ |
| 106 | 112 | |
| @@ -117,6 +117,7 @@ struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, · 116 unmodified lines | ||
| 117 | 117 | const struct file_operations *proc_fops, |
| 118 | 118 | void *data); |
| 119 | 119 | extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); |
| 120 | +extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent); | |
| 120 | 121 | |
| 121 | 122 | struct pid_namespace; |
| 122 | 123 | |
| @@ -202,6 +203,7 @@ static inline struct proc_dir_entry *proc_create_data(const char *name, · 79 unmodified lines | ||
| 202 | 203 | return NULL; |
| 203 | 204 | } |
| 204 | 205 | #define remove_proc_entry(name, parent) do {} while (0) |
| 206 | +#define remove_proc_subtree(name, parent) do {} while (0) | |
| 205 | 207 | |
| 206 | 208 | static inline struct proc_dir_entry *proc_symlink(const char *name, |
| 207 | 209 | struct proc_dir_entry *parent,const char *dest) {return NULL;} |
| @@ -163,9 +163,10 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) · 162 unmodified lines | ||
| 163 | 163 | #define TASK_DEAD 64 |
| 164 | 164 | #define TASK_WAKEKILL 128 |
| 165 | 165 | #define TASK_WAKING 256 |
| 166 | −#define TASK_STATE_MAX 512 | |
| 166 | +#define TASK_PARKED 512 | |
| 167 | +#define TASK_STATE_MAX 1024 | |
| 167 | 168 | |
| 168 | −#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKW" | |
| 169 | +#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKWP" | |
| 169 | 170 | |
| 170 | 171 | extern char ___assert_task_state[1 - 2*!!( |
| 171 | 172 | sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; |
| @@ -1012,6 +1012,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) · 1011 unmodified lines | ||
| 1012 | 1012 | * This hook can be used by the module to update any security state |
| 1013 | 1013 | * associated with the TUN device's security structure. |
| 1014 | 1014 | * @security pointer to the TUN devices's security structure. |
| 1015 | + * @skb_owned_by: | |
| 1016 | + * This hook sets the packet's owning sock. | |
| 1017 | + * @skb is the packet. | |
| 1018 | + * @sk the sock which owns the packet. | |
| 1015 | 1019 | * |
| 1016 | 1020 | * Security hooks for XFRM operations. |
| 1017 | 1021 | * |
| @@ -1638,6 +1642,7 @@ struct security_operations { · 620 unmodified lines | ||
| 1638 | 1642 | int (*tun_dev_attach_queue) (void *security); |
| 1639 | 1643 | int (*tun_dev_attach) (struct sock *sk, void *security); |
| 1640 | 1644 | int (*tun_dev_open) (void *security); |
| 1645 | + void (*skb_owned_by) (struct sk_buff *skb, struct sock *sk); | |
| 1641 | 1646 | #endif /* CONFIG_SECURITY_NETWORK */ |
| 1642 | 1647 | |
| 1643 | 1648 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
| @@ -2588,6 +2593,8 @@ int security_tun_dev_attach_queue(void *security); · 944 unmodified lines | ||
| 2588 | 2593 | int security_tun_dev_attach(struct sock *sk, void *security); |
| 2589 | 2594 | int security_tun_dev_open(void *security); |
| 2590 | 2595 | |
| 2596 | +void security_skb_owned_by(struct sk_buff *skb, struct sock *sk); | |
| 2597 | + | |
| 2591 | 2598 | #else /* CONFIG_SECURITY_NETWORK */ |
| 2592 | 2599 | static inline int security_unix_stream_connect(struct sock *sock, |
| 2593 | 2600 | struct sock *other, |
| @@ -2779,6 +2786,11 @@ static inline int security_tun_dev_open(void *security) · 185 unmodified lines | ||
| 2779 | 2786 | { |
| 2780 | 2787 | return 0; |
| 2781 | 2788 | } |
| 2789 | + | |
| 2790 | +static inline void security_skb_owned_by(struct sk_buff *skb, struct sock *sk) | |
| 2791 | +{ | |
| 2792 | +} | |
| 2793 | + | |
| 2782 | 2794 | #endif /* CONFIG_SECURITY_NETWORK */ |
| 2783 | 2795 | |
| 2784 | 2796 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
| @@ -16,7 +16,10 @@ · 15 unmodified lines | ||
| 16 | 16 | * In the debug case, 1 means unlocked, 0 means locked. (the values |
| 17 | 17 | * are inverted, to catch initialization bugs) |
| 18 | 18 | * |
| 19 | − * No atomicity anywhere, we are on UP. | |
| 19 | + * No atomicity anywhere, we are on UP. However, we still need | |
| 20 | + * the compiler barriers, because we do not want the compiler to | |
| 21 | + * move potentially faulting instructions (notably user accesses) | |
| 22 | + * into the locked sequence, resulting in non-atomic execution. | |
| 20 | 23 | */ |
| 21 | 24 | |
| 22 | 25 | #ifdef CONFIG_DEBUG_SPINLOCK |
| @@ -25,6 +28,7 @@ · 2 unmodified lines | ||
| 25 | 28 | static inline void arch_spin_lock(arch_spinlock_t *lock) |
| 26 | 29 | { |
| 27 | 30 | lock->slock = 0; |
| 31 | + barrier(); | |
| 28 | 32 | } |
| 29 | 33 | |
| 30 | 34 | static inline void |
| @@ -32,6 +36,7 @@ arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags) · 1 unmodified line | ||
| 32 | 36 | { |
| 33 | 37 | local_irq_save(flags); |
| 34 | 38 | lock->slock = 0; |
| 39 | + barrier(); | |
| 35 | 40 | } |
| 36 | 41 | |
| 37 | 42 | static inline int arch_spin_trylock(arch_spinlock_t *lock) |
| @@ -39,32 +44,34 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock) · 1 unmodified line | ||
| 39 | 44 | char oldval = lock->slock; |
| 40 | 45 | |
| 41 | 46 | lock->slock = 0; |
| 47 | + barrier(); | |
| 42 | 48 | |
| 43 | 49 | return oldval > 0; |
| 44 | 50 | } |
| 45 | 51 | |
| 46 | 52 | static inline void arch_spin_unlock(arch_spinlock_t *lock) |
| 47 | 53 | { |
| 54 | + barrier(); | |
| 48 | 55 | lock->slock = 1; |
| 49 | 56 | } |
| 50 | 57 | |
| 51 | 58 | /* |
| 52 | 59 | * Read-write spinlocks. No debug version. |
| 53 | 60 | */ |
| 54 | −#define arch_read_lock(lock) do { (void)(lock); } while (0) | |
| 55 | −#define arch_write_lock(lock) do { (void)(lock); } while (0) | |
| 56 | −#define arch_read_trylock(lock) ({ (void)(lock); 1; }) | |
| 57 | −#define arch_write_trylock(lock) ({ (void)(lock); 1; }) | |
| 58 | −#define arch_read_unlock(lock) do { (void)(lock); } while (0) | |
| 59 | −#define arch_write_unlock(lock) do { (void)(lock); } while (0) | |
| 61 | +#define arch_read_lock(lock) do { barrier(); (void)(lock); } while (0) | |
| 62 | +#define arch_write_lock(lock) do { barrier(); (void)(lock); } while (0) | |
| 63 | +#define arch_read_trylock(lock) ({ barrier(); (void)(lock); 1; }) | |
| 64 | +#define arch_write_trylock(lock) ({ barrier(); (void)(lock); 1; }) | |
| 65 | +#define arch_read_unlock(lock) do { barrier(); (void)(lock); } while (0) | |
| 66 | +#define arch_write_unlock(lock) do { barrier(); (void)(lock); } while (0) | |
| 60 | 67 | |
| 61 | 68 | #else /* DEBUG_SPINLOCK */ |
| 62 | 69 | #define arch_spin_is_locked(lock) ((void)(lock), 0) |
| 63 | 70 | /* for sched.c and kernel_lock.c: */ |
| 64 | −# define arch_spin_lock(lock) do { (void)(lock); } while (0) | |
| 65 | −# define arch_spin_lock_flags(lock, flags) do { (void)(lock); } while (0) | |
| 66 | −# define arch_spin_unlock(lock) do { (void)(lock); } while (0) | |
| 67 | −# define arch_spin_trylock(lock) ({ (void)(lock); 1; }) | |
| 71 | +# define arch_spin_lock(lock) do { barrier(); (void)(lock); } while (0) | |
| 72 | +# define arch_spin_lock_flags(lock, flags) do { barrier(); (void)(lock); } while (0) | |
| 73 | +# define arch_spin_unlock(lock) do { barrier(); (void)(lock); } while (0) | |
| 74 | +# define arch_spin_trylock(lock) ({ barrier(); (void)(lock); 1; }) | |
| 68 | 75 | #endif /* DEBUG_SPINLOCK */ |
| 69 | 76 | |
| 70 | 77 | #define arch_spin_is_contended(lock) (((void)(lock), 0)) |
| @@ -219,6 +219,7 @@ · 218 unmodified lines | ||
| 219 | 219 | #define SSB_CHIPCO_PMU_CTL 0x0600 /* PMU control */ |
| 220 | 220 | #define SSB_CHIPCO_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ |
| 221 | 221 | #define SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT 16 |
| 222 | +#define SSB_CHIPCO_PMU_CTL_PLL_UPD 0x00000400 | |
| 222 | 223 | #define SSB_CHIPCO_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ |
| 223 | 224 | #define SSB_CHIPCO_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ |
| 224 | 225 | #define SSB_CHIPCO_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */ |
| @@ -667,5 +668,6 @@ enum ssb_pmu_ldo_volt_id { · 442 unmodified lines | ||
| 667 | 668 | void ssb_pmu_set_ldo_voltage(struct ssb_chipcommon *cc, |
| 668 | 669 | enum ssb_pmu_ldo_volt_id id, u32 voltage); |
| 669 | 670 | void ssb_pmu_set_ldo_paref(struct ssb_chipcommon *cc, bool on); |
| 671 | +void ssb_pmu_spuravoid_pllupdate(struct ssb_chipcommon *cc, int spuravoid); | |
| 670 | 672 | |
| 671 | 673 | #endif /* LINUX_SSB_CHIPCO_H_ */ |
| @@ -25,6 +25,7 @@ extern int swiotlb_force; · 24 unmodified lines | ||
| 25 | 25 | extern void swiotlb_init(int verbose); |
| 26 | 26 | int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); |
| 27 | 27 | extern unsigned long swiotlb_nr_tbl(void); |
| 28 | +unsigned long swiotlb_size_or_default(void); | |
| 28 | 29 | extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs); |
| 29 | 30 | |
| 30 | 31 | /* |
| @@ -0,0 +1,14 @@ | ||
| 1 | +#ifndef _LINUX_UCS2_STRING_H_ | |
| 2 | +#define _LINUX_UCS2_STRING_H_ | |
| 3 | + | |
| 4 | +#include <linux/types.h> /* for size_t */ | |
| 5 | +#include <linux/stddef.h> /* for NULL */ | |
| 6 | + | |
| 7 | +typedef u16 ucs2_char_t; | |
| 8 | + | |
| 9 | +unsigned long ucs2_strnlen(const ucs2_char_t *s, size_t maxlength); | |
| 10 | +unsigned long ucs2_strlen(const ucs2_char_t *s); | |
| 11 | +unsigned long ucs2_strsize(const ucs2_char_t *data, unsigned long maxlength); | |
| 12 | +int ucs2_strncmp(const ucs2_char_t *a, const ucs2_char_t *b, size_t len); | |
| 13 | + | |
| 14 | +#endif /* _LINUX_UCS2_STRING_H_ */ | |
| @@ -199,6 +199,7 @@ extern bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev, · 198 unmodified lines | ||
| 199 | 199 | /* Device notifier */ |
| 200 | 200 | extern int register_inet6addr_notifier(struct notifier_block *nb); |
| 201 | 201 | extern int unregister_inet6addr_notifier(struct notifier_block *nb); |
| 202 | +extern int inet6addr_notifier_call_chain(unsigned long val, void *v); | |
| 202 | 203 | |
| 203 | 204 | extern void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex, |
| 204 | 205 | struct ipv6_devconf *devconf); |
| @@ -256,7 +256,8 @@ static inline __u32 irlmp_get_daddr(const struct lsap_cb *self) · 255 unmodified lines | ||
| 256 | 256 | return (self && self->lap) ? self->lap->daddr : 0; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | −extern const char *irlmp_reasons[]; | |
| 259 | +const char *irlmp_reason_str(LM_REASON reason); | |
| 260 | + | |
| 260 | 261 | extern int sysctl_discovery_timeout; |
| 261 | 262 | extern int sysctl_discovery_slots; |
| 262 | 263 | extern int sysctl_discovery; |
| @@ -130,6 +130,14 @@ struct iucv_sock { · 129 unmodified lines | ||
| 130 | 130 | enum iucv_tx_notify n); |
| 131 | 131 | }; |
| 132 | 132 | |
| 133 | +struct iucv_skb_cb { | |
| 134 | + u32 class; /* target class of message */ | |
| 135 | + u32 tag; /* tag associated with message */ | |
| 136 | + u32 offset; /* offset for skb receival */ | |
| 137 | +}; | |
| 138 | + | |
| 139 | +#define IUCV_SKB_CB(__skb) ((struct iucv_skb_cb *)&((__skb)->cb[0])) | |
| 140 | + | |
| 133 | 141 | /* iucv socket options (SOL_IUCV) */ |
| 134 | 142 | #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ |
| 135 | 143 | #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ |
| @@ -78,7 +78,7 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, · 77 unmodified lines | ||
| 78 | 78 | scm->creds.uid = INVALID_UID; |
| 79 | 79 | scm->creds.gid = INVALID_GID; |
| 80 | 80 | if (forcecreds) |
| 81 | − scm_set_cred(scm, task_tgid(current), current_euid(), current_egid()); | |
| 81 | + scm_set_cred(scm, task_tgid(current), current_uid(), current_gid()); | |
| 82 | 82 | unix_get_peersec_dgram(sock, scm); |
| 83 | 83 | if (msg->msg_controllen <= 0) |
| 84 | 84 | return 0; |
| @@ -257,6 +257,7 @@ TRACE_EVENT(block_bio_bounce, · 256 unmodified lines | ||
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * block_bio_complete - completed all work on the block operation |
| 260 | + * @q: queue holding the block operation | |
| 260 | 261 | * @bio: block operation completed |
| 261 | 262 | * @error: io error value |
| 262 | 263 | * |
| @@ -265,9 +266,9 @@ TRACE_EVENT(block_bio_bounce, · 2 unmodified lines | ||
| 265 | 266 | */ |
| 266 | 267 | TRACE_EVENT(block_bio_complete, |
| 267 | 268 | |
| 268 | − TP_PROTO(struct bio *bio, int error), | |
| 269 | + TP_PROTO(struct request_queue *q, struct bio *bio, int error), | |
| 269 | 270 | |
| 270 | − TP_ARGS(bio, error), | |
| 271 | + TP_ARGS(q, bio, error), | |
| 271 | 272 | |
| 272 | 273 | TP_STRUCT__entry( |
| 273 | 274 | __field( dev_t, dev ) |
| @@ -278,8 +279,7 @@ TRACE_EVENT(block_bio_complete, · 4 unmodified lines | ||
| 278 | 279 | ), |
| 279 | 280 | |
| 280 | 281 | TP_fast_assign( |
| 281 | − __entry->dev = bio->bi_bdev ? | |
| 282 | − bio->bi_bdev->bd_dev : 0; | |
| 282 | + __entry->dev = bio->bi_bdev->bd_dev; | |
| 283 | 283 | __entry->sector = bio->bi_sector; |
| 284 | 284 | __entry->nr_sector = bio->bi_size >> 9; |
| 285 | 285 | __entry->error = error; |
| @@ -147,7 +147,7 @@ TRACE_EVENT(sched_switch, · 146 unmodified lines | ||
| 147 | 147 | __print_flags(__entry->prev_state & (TASK_STATE_MAX-1), "|", |
| 148 | 148 | { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" }, |
| 149 | 149 | { 16, "Z" }, { 32, "X" }, { 64, "x" }, |
| 150 | − { 128, "W" }) : "R", | |
| 150 | + { 128, "K" }, { 256, "W" }, { 512, "P" }) : "R", | |
| 151 | 151 | __entry->prev_state & TASK_STATE_MAX ? "+" : "", |
| 152 | 152 | __entry->next_comm, __entry->next_pid, __entry->next_prio) |
| 153 | 153 | ); |
| @@ -95,15 +95,10 @@ · 94 unmodified lines | ||
| 95 | 95 | #ifndef _LINUX_FUSE_H |
| 96 | 96 | #define _LINUX_FUSE_H |
| 97 | 97 | |
| 98 | −#ifdef __linux__ | |
| 98 | +#ifdef __KERNEL__ | |
| 99 | 99 | #include <linux/types.h> |
| 100 | 100 | #else |
| 101 | 101 | #include <stdint.h> |
| 102 | −#define __u64 uint64_t | |
| 103 | −#define __s64 int64_t | |
| 104 | −#define __u32 uint32_t | |
| 105 | −#define __s32 int32_t | |
| 106 | −#define __u16 uint16_t | |
| 107 | 102 | #endif |
| 108 | 103 | |
| 109 | 104 | /* |
| @@ -139,42 +134,42 @@ · 29 unmodified lines | ||
| 139 | 134 | userspace works under 64bit kernels */ |
| 140 | 135 | |
| 141 | 136 | struct fuse_attr { |
| 142 | − __u64 ino; | |
| 143 | − __u64 size; | |
| 144 | − __u64 blocks; | |
| 145 | − __u64 atime; | |
| 146 | − __u64 mtime; | |
| 147 | − __u64 ctime; | |
| 148 | − __u32 atimensec; | |
| 149 | − __u32 mtimensec; | |
| 150 | − __u32 ctimensec; | |
| 151 | − __u32 mode; | |
| 152 | − __u32 nlink; | |
| 153 | − __u32 uid; | |
| 154 | − __u32 gid; | |
| 155 | − __u32 rdev; | |
| 156 | − __u32 blksize; | |
| 157 | − __u32 padding; | |
| 137 | + uint64_t ino; | |
| 138 | + uint64_t size; | |
| 139 | + uint64_t blocks; | |
| 140 | + uint64_t atime; | |
| 141 | + uint64_t mtime; | |
| 142 | + uint64_t ctime; | |
| 143 | + uint32_t atimensec; | |
| 144 | + uint32_t mtimensec; | |
| 145 | + uint32_t ctimensec; | |
| 146 | + uint32_t mode; | |
| 147 | + uint32_t nlink; | |
| 148 | + uint32_t uid; | |
| 149 | + uint32_t gid; | |
| 150 | + uint32_t rdev; | |
| 151 | + uint32_t blksize; | |
| 152 | + uint32_t padding; | |
| 158 | 153 | }; |
| 159 | 154 | |
| 160 | 155 | struct fuse_kstatfs { |
| 161 | − __u64 blocks; | |
| 162 | − __u64 bfree; | |
| 163 | − __u64 bavail; | |
| 164 | − __u64 files; | |
| 165 | − __u64 ffree; | |
| 166 | − __u32 bsize; | |
| 167 | − __u32 namelen; | |
| 168 | − __u32 frsize; | |
| 169 | − __u32 padding; | |
| 170 | − __u32 spare[6]; | |
| 156 | + uint64_t blocks; | |
| 157 | + uint64_t bfree; | |
| 158 | + uint64_t bavail; | |
| 159 | + uint64_t files; | |
| 160 | + uint64_t ffree; | |
| 161 | + uint32_t bsize; | |
| 162 | + uint32_t namelen; | |
| 163 | + uint32_t frsize; | |
| 164 | + uint32_t padding; | |
| 165 | + uint32_t spare[6]; | |
| 171 | 166 | }; |
| 172 | 167 | |
| 173 | 168 | struct fuse_file_lock { |
| 174 | − __u64 start; | |
| 175 | − __u64 end; | |
| 176 | − __u32 type; | |
| 177 | − __u32 pid; /* tgid */ | |
| 169 | + uint64_t start; | |
| 170 | + uint64_t end; | |
| 171 | + uint32_t type; | |
| 172 | + uint32_t pid; /* tgid */ | |
| 178 | 173 | }; |
| 179 | 174 | |
| 180 | 175 | /** |
| @@ -364,143 +359,143 @@ enum fuse_notify_code { · 183 unmodified lines | ||
| 364 | 359 | #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 |
| 365 | 360 | |
| 366 | 361 | struct fuse_entry_out { |
| 367 | − __u64 nodeid; /* Inode ID */ | |
| 368 | − __u64 generation; /* Inode generation: nodeid:gen must | |
| 369 | − be unique for the fs's lifetime */ | |
| 370 | − __u64 entry_valid; /* Cache timeout for the name */ | |
| 371 | − __u64 attr_valid; /* Cache timeout for the attributes */ | |
| 372 | − __u32 entry_valid_nsec; | |
| 373 | − __u32 attr_valid_nsec; | |
| 362 | + uint64_t nodeid; /* Inode ID */ | |
| 363 | + uint64_t generation; /* Inode generation: nodeid:gen must | |
| 364 | + be unique for the fs's lifetime */ | |
| 365 | + uint64_t entry_valid; /* Cache timeout for the name */ | |
| 366 | + uint64_t attr_valid; /* Cache timeout for the attributes */ | |
| 367 | + uint32_t entry_valid_nsec; | |
| 368 | + uint32_t attr_valid_nsec; | |
| 374 | 369 | struct fuse_attr attr; |
| 375 | 370 | }; |
| 376 | 371 | |
| 377 | 372 | struct fuse_forget_in { |
| 378 | − __u64 nlookup; | |
| 373 | + uint64_t nlookup; | |
| 379 | 374 | }; |
| 380 | 375 | |
| 381 | 376 | struct fuse_forget_one { |
| 382 | − __u64 nodeid; | |
| 383 | − __u64 nlookup; | |
| 377 | + uint64_t nodeid; | |
| 378 | + uint64_t nlookup; | |
| 384 | 379 | }; |
| 385 | 380 | |
| 386 | 381 | struct fuse_batch_forget_in { |
| 387 | − __u32 count; | |
| 388 | − __u32 dummy; | |
| 382 | + uint32_t count; | |
| 383 | + uint32_t dummy; | |
| 389 | 384 | }; |
| 390 | 385 | |
| 391 | 386 | struct fuse_getattr_in { |
| 392 | − __u32 getattr_flags; | |
| 393 | − __u32 dummy; | |
| 394 | − __u64 fh; | |
| 387 | + uint32_t getattr_flags; | |
| 388 | + uint32_t dummy; | |
| 389 | + uint64_t fh; | |
| 395 | 390 | }; |
| 396 | 391 | |
| 397 | 392 | #define FUSE_COMPAT_ATTR_OUT_SIZE 96 |
| 398 | 393 | |
| 399 | 394 | struct fuse_attr_out { |
| 400 | − __u64 attr_valid; /* Cache timeout for the attributes */ | |
| 401 | − __u32 attr_valid_nsec; | |
| 402 | − __u32 dummy; | |
| 395 | + uint64_t attr_valid; /* Cache timeout for the attributes */ | |
| 396 | + uint32_t attr_valid_nsec; | |
| 397 | + uint32_t dummy; | |
| 403 | 398 | struct fuse_attr attr; |
| 404 | 399 | }; |
| 405 | 400 | |
| 406 | 401 | #define FUSE_COMPAT_MKNOD_IN_SIZE 8 |
| 407 | 402 | |
| 408 | 403 | struct fuse_mknod_in { |
| 409 | − __u32 mode; | |
| 410 | − __u32 rdev; | |
| 411 | − __u32 umask; | |
| 412 | − __u32 padding; | |
| 404 | + uint32_t mode; | |
| 405 | + uint32_t rdev; | |
| 406 | + uint32_t umask; | |
| 407 | + uint32_t padding; | |
| 413 | 408 | }; |
| 414 | 409 | |
| 415 | 410 | struct fuse_mkdir_in { |
| 416 | − __u32 mode; | |
| 417 | − __u32 umask; | |
| 411 | + uint32_t mode; | |
| 412 | + uint32_t umask; | |
| 418 | 413 | }; |
| 419 | 414 | |
| 420 | 415 | struct fuse_rename_in { |
| 421 | − __u64 newdir; | |
| 416 | + uint64_t newdir; | |
| 422 | 417 | }; |
| 423 | 418 | |
| 424 | 419 | struct fuse_link_in { |
| 425 | − __u64 oldnodeid; | |
| 420 | + uint64_t oldnodeid; | |
| 426 | 421 | }; |
| 427 | 422 | |
| 428 | 423 | struct fuse_setattr_in { |
| 429 | − __u32 valid; | |
| 430 | − __u32 padding; | |
| 431 | − __u64 fh; | |
| 432 | − __u64 size; | |
| 433 | − __u64 lock_owner; | |
| 434 | − __u64 atime; | |
| 435 | − __u64 mtime; | |
| 436 | − __u64 unused2; | |
| 437 | − __u32 atimensec; | |
| 438 | − __u32 mtimensec; | |
| 439 | − __u32 unused3; | |
| 440 | − __u32 mode; | |
| 441 | − __u32 unused4; | |
| 442 | − __u32 uid; | |
| 443 | − __u32 gid; | |
| 444 | − __u32 unused5; | |
| 424 | + uint32_t valid; | |
| 425 | + uint32_t padding; | |
| 426 | + uint64_t fh; | |
| 427 | + uint64_t size; | |
| 428 | + uint64_t lock_owner; | |
| 429 | + uint64_t atime; | |
| 430 | + uint64_t mtime; | |
| 431 | + uint64_t unused2; | |
| 432 | + uint32_t atimensec; | |
| 433 | + uint32_t mtimensec; | |
| 434 | + uint32_t unused3; | |
| 435 | + uint32_t mode; | |
| 436 | + uint32_t unused4; | |
| 437 | + uint32_t uid; | |
| 438 | + uint32_t gid; | |
| 439 | + uint32_t unused5; | |
| 445 | 440 | }; |
| 446 | 441 | |
| 447 | 442 | struct fuse_open_in { |
| 448 | − __u32 flags; | |
| 449 | − __u32 unused; | |
| 443 | + uint32_t flags; | |
| 444 | + uint32_t unused; | |
| 450 | 445 | }; |
| 451 | 446 | |
| 452 | 447 | struct fuse_create_in { |
| 453 | − __u32 flags; | |
| 454 | − __u32 mode; | |
| 455 | − __u32 umask; | |
| 456 | − __u32 padding; | |
| 448 | + uint32_t flags; | |
| 449 | + uint32_t mode; | |
| 450 | + uint32_t umask; | |
| 451 | + uint32_t padding; | |
| 457 | 452 | }; |
| 458 | 453 | |
| 459 | 454 | struct fuse_open_out { |
| 460 | − __u64 fh; | |
| 461 | − __u32 open_flags; | |
| 462 | − __u32 padding; | |
| 455 | + uint64_t fh; | |
| 456 | + uint32_t open_flags; | |
| 457 | + uint32_t padding; | |
| 463 | 458 | }; |
| 464 | 459 | |
| 465 | 460 | struct fuse_release_in { |
| 466 | − __u64 fh; | |
| 467 | − __u32 flags; | |
| 468 | − __u32 release_flags; | |
| 469 | − __u64 lock_owner; | |
| 461 | + uint64_t fh; | |
| 462 | + uint32_t flags; | |
| 463 | + uint32_t release_flags; | |
| 464 | + uint64_t lock_owner; | |
| 470 | 465 | }; |
| 471 | 466 | |
| 472 | 467 | struct fuse_flush_in { |
| 473 | − __u64 fh; | |
| 474 | − __u32 unused; | |
| 475 | − __u32 padding; | |
| 476 | − __u64 lock_owner; | |
| 468 | + uint64_t fh; | |
| 469 | + uint32_t unused; | |
| 470 | + uint32_t padding; | |
| 471 | + uint64_t lock_owner; | |
| 477 | 472 | }; |
| 478 | 473 | |
| 479 | 474 | struct fuse_read_in { |
| 480 | − __u64 fh; | |
| 481 | − __u64 offset; | |
| 482 | − __u32 size; | |
| 483 | − __u32 read_flags; | |
| 484 | − __u64 lock_owner; | |
| 485 | − __u32 flags; | |
| 486 | − __u32 padding; | |
| 475 | + uint64_t fh; | |
| 476 | + uint64_t offset; | |
| 477 | + uint32_t size; | |
| 478 | + uint32_t read_flags; | |
| 479 | + uint64_t lock_owner; | |
| 480 | + uint32_t flags; | |
| 481 | + uint32_t padding; | |
| 487 | 482 | }; |
| 488 | 483 | |
| 489 | 484 | #define FUSE_COMPAT_WRITE_IN_SIZE 24 |
| 490 | 485 | |
| 491 | 486 | struct fuse_write_in { |
| 492 | − __u64 fh; | |
| 493 | − __u64 offset; | |
| 494 | − __u32 size; | |
| 495 | − __u32 write_flags; | |
| 496 | − __u64 lock_owner; | |
| 497 | − __u32 flags; | |
| 498 | − __u32 padding; | |
| 487 | + uint64_t fh; | |
| 488 | + uint64_t offset; | |
| 489 | + uint32_t size; | |
| 490 | + uint32_t write_flags; | |
| 491 | + uint64_t lock_owner; | |
| 492 | + uint32_t flags; | |
| 493 | + uint32_t padding; | |
| 499 | 494 | }; |
| 500 | 495 | |
| 501 | 496 | struct fuse_write_out { |
| 502 | − __u32 size; | |
| 503 | − __u32 padding; | |
| 497 | + uint32_t size; | |
| 498 | + uint32_t padding; | |
| 504 | 499 | }; |
| 505 | 500 | |
| 506 | 501 | #define FUSE_COMPAT_STATFS_SIZE 48 |
| @@ -510,32 +505,32 @@ struct fuse_statfs_out { · 3 unmodified lines | ||
| 510 | 505 | }; |
| 511 | 506 | |
| 512 | 507 | struct fuse_fsync_in { |
| 513 | − __u64 fh; | |
| 514 | − __u32 fsync_flags; | |
| 515 | − __u32 padding; | |
| 508 | + uint64_t fh; | |
| 509 | + uint32_t fsync_flags; | |
| 510 | + uint32_t padding; | |
| 516 | 511 | }; |
| 517 | 512 | |
| 518 | 513 | struct fuse_setxattr_in { |
| 519 | − __u32 size; | |
| 520 | − __u32 flags; | |
| 514 | + uint32_t size; | |
| 515 | + uint32_t flags; | |
| 521 | 516 | }; |
| 522 | 517 | |
| 523 | 518 | struct fuse_getxattr_in { |
| 524 | − __u32 size; | |
| 525 | − __u32 padding; | |
| 519 | + uint32_t size; | |
| 520 | + uint32_t padding; | |
| 526 | 521 | }; |
| 527 | 522 | |
| 528 | 523 | struct fuse_getxattr_out { |
| 529 | − __u32 size; | |
| 530 | − __u32 padding; | |
| 524 | + uint32_t size; | |
| 525 | + uint32_t padding; | |
| 531 | 526 | }; |
| 532 | 527 | |
| 533 | 528 | struct fuse_lk_in { |
| 534 | − __u64 fh; | |
| 535 | − __u64 owner; | |
| 529 | + uint64_t fh; | |
| 530 | + uint64_t owner; | |
| 536 | 531 | struct fuse_file_lock lk; |
| 537 | − __u32 lk_flags; | |
| 538 | − __u32 padding; | |
| 532 | + uint32_t lk_flags; | |
| 533 | + uint32_t padding; | |
| 539 | 534 | }; |
| 540 | 535 | |
| 541 | 536 | struct fuse_lk_out { |
| @@ -543,134 +538,135 @@ struct fuse_lk_out { · 1 unmodified line | ||
| 543 | 538 | }; |
| 544 | 539 | |
| 545 | 540 | struct fuse_access_in { |
| 546 | − __u32 mask; | |
| 547 | − __u32 padding; | |
| 541 | + uint32_t mask; | |
| 542 | + uint32_t padding; | |
| 548 | 543 | }; |
| 549 | 544 | |
| 550 | 545 | struct fuse_init_in { |
| 551 | − __u32 major; | |
| 552 | − __u32 minor; | |
| 553 | − __u32 max_readahead; | |
| 554 | − __u32 flags; | |
| 546 | + uint32_t major; | |
| 547 | + uint32_t minor; | |
| 548 | + uint32_t max_readahead; | |
| 549 | + uint32_t flags; | |
| 555 | 550 | }; |
| 556 | 551 | |
| 557 | 552 | struct fuse_init_out { |
| 558 | − __u32 major; | |
| 559 | − __u32 minor; | |
| 560 | − __u32 max_readahead; | |
| 561 | − __u32 flags; | |
| 562 | − __u16 max_background; | |
| 563 | − __u16 congestion_threshold; | |
| 564 | − __u32 max_write; | |
| 553 | + uint32_t major; | |
| 554 | + uint32_t minor; | |
| 555 | + uint32_t max_readahead; | |
| 556 | + uint32_t flags; | |
| 557 | + uint16_t max_background; | |
| 558 | + uint16_t congestion_threshold; | |
| 559 | + uint32_t max_write; | |
| 565 | 560 | }; |
| 566 | 561 | |
| 567 | 562 | #define CUSE_INIT_INFO_MAX 4096 |
| 568 | 563 | |
| 569 | 564 | struct cuse_init_in { |
| 570 | − __u32 major; | |
| 571 | − __u32 minor; | |
| 572 | − __u32 unused; | |
| 573 | − __u32 flags; | |
| 565 | + uint32_t major; | |
| 566 | + uint32_t minor; | |
| 567 | + uint32_t unused; | |
| 568 | + uint32_t flags; | |
| 574 | 569 | }; |
| 575 | 570 | |
| 576 | 571 | struct cuse_init_out { |
| 577 | − __u32 major; | |
| 578 | − __u32 minor; | |
| 579 | − __u32 unused; | |
| 580 | − __u32 flags; | |
| 581 | − __u32 max_read; | |
| 582 | − __u32 max_write; | |
| 583 | − __u32 dev_major; /* chardev major */ | |
| 584 | − __u32 dev_minor; /* chardev minor */ | |
| 585 | − __u32 spare[10]; | |
| 572 | + uint32_t major; | |
| 573 | + uint32_t minor; | |
| 574 | + uint32_t unused; | |
| 575 | + uint32_t flags; | |
| 576 | + uint32_t max_read; | |
| 577 | + uint32_t max_write; | |
| 578 | + uint32_t dev_major; /* chardev major */ | |
| 579 | + uint32_t dev_minor; /* chardev minor */ | |
| 580 | + uint32_t spare[10]; | |
| 586 | 581 | }; |
| 587 | 582 | |
| 588 | 583 | struct fuse_interrupt_in { |
| 589 | − __u64 unique; | |
| 584 | + uint64_t unique; | |
| 590 | 585 | }; |
| 591 | 586 | |
| 592 | 587 | struct fuse_bmap_in { |
| 593 | − __u64 block; | |
| 594 | − __u32 blocksize; | |
| 595 | − __u32 padding; | |
| 588 | + uint64_t block; | |
| 589 | + uint32_t blocksize; | |
| 590 | + uint32_t padding; | |
| 596 | 591 | }; |
| 597 | 592 | |
| 598 | 593 | struct fuse_bmap_out { |
| 599 | − __u64 block; | |
| 594 | + uint64_t block; | |
| 600 | 595 | }; |
| 601 | 596 | |
| 602 | 597 | struct fuse_ioctl_in { |
| 603 | − __u64 fh; | |
| 604 | − __u32 flags; | |
| 605 | − __u32 cmd; | |
| 606 | − __u64 arg; | |
| 607 | − __u32 in_size; | |
| 608 | − __u32 out_size; | |
| 598 | + uint64_t fh; | |
| 599 | + uint32_t flags; | |
| 600 | + uint32_t cmd; | |
| 601 | + uint64_t arg; | |
| 602 | + uint32_t in_size; | |
| 603 | + uint32_t out_size; | |
| 609 | 604 | }; |
| 610 | 605 | |
| 611 | 606 | struct fuse_ioctl_iovec { |
| 612 | − __u64 base; | |
| 613 | − __u64 len; | |
| 607 | + uint64_t base; | |
| 608 | + uint64_t len; | |
| 614 | 609 | }; |
| 615 | 610 | |
| 616 | 611 | struct fuse_ioctl_out { |
| 617 | − __s32 result; | |
| 618 | − __u32 flags; | |
| 619 | − __u32 in_iovs; | |
| 620 | − __u32 out_iovs; | |
| 612 | + int32_t result; | |
| 613 | + uint32_t flags; | |
| 614 | + uint32_t in_iovs; | |
| 615 | + uint32_t out_iovs; | |
| 621 | 616 | }; |
| 622 | 617 | |
| 623 | 618 | struct fuse_poll_in { |
| 624 | − __u64 fh; | |
| 625 | − __u64 kh; | |
| 626 | − __u32 flags; | |
| 627 | − __u32 events; | |
| 619 | + uint64_t fh; | |
| 620 | + uint64_t kh; | |
| 621 | + uint32_t flags; | |
| 622 | + uint32_t events; | |
| 628 | 623 | }; |
| 629 | 624 | |
| 630 | 625 | struct fuse_poll_out { |
| 631 | − __u32 revents; | |
| 632 | − __u32 padding; | |
| 626 | + uint32_t revents; | |
| 627 | + uint32_t padding; | |
| 633 | 628 | }; |
| 634 | 629 | |
| 635 | 630 | struct fuse_notify_poll_wakeup_out { |
| 636 | − __u64 kh; | |
| 631 | + uint64_t kh; | |
| 637 | 632 | }; |
| 638 | 633 | |
| 639 | 634 | struct fuse_fallocate_in { |
| 640 | − __u64 fh; | |
| 641 | − __u64 offset; | |
| 642 | − __u64 length; | |
| 643 | − __u32 mode; | |
| 644 | − __u32 padding; | |
| 635 | + uint64_t fh; | |
| 636 | + uint64_t offset; | |
| 637 | + uint64_t length; | |
| 638 | + uint32_t mode; | |
| 639 | + uint32_t padding; | |
| 645 | 640 | }; |
| 646 | 641 | |
| 647 | 642 | struct fuse_in_header { |
| 648 | − __u32 len; | |
| 649 | − __u32 opcode; | |
| 650 | − __u64 unique; | |
| 651 | − __u64 nodeid; | |
| 652 | − __u32 uid; | |
| 653 | − __u32 gid; | |
| 654 | − __u32 pid; | |
| 655 | − __u32 padding; | |
| 643 | + uint32_t len; | |
| 644 | + uint32_t opcode; | |
| 645 | + uint64_t unique; | |
| 646 | + uint64_t nodeid; | |
| 647 | + uint32_t uid; | |
| 648 | + uint32_t gid; | |
| 649 | + uint32_t pid; | |
| 650 | + uint32_t padding; | |
| 656 | 651 | }; |
| 657 | 652 | |
| 658 | 653 | struct fuse_out_header { |
| 659 | − __u32 len; | |
| 660 | − __s32 error; | |
| 661 | − __u64 unique; | |
| 654 | + uint32_t len; | |
| 655 | + int32_t error; | |
| 656 | + uint64_t unique; | |
| 662 | 657 | }; |
| 663 | 658 | |
| 664 | 659 | struct fuse_dirent { |
| 665 | − __u64 ino; | |
| 666 | − __u64 off; | |
| 667 | − __u32 namelen; | |
| 668 | − __u32 type; | |
| 660 | + uint64_t ino; | |
| 661 | + uint64_t off; | |
| 662 | + uint32_t namelen; | |
| 663 | + uint32_t type; | |
| 669 | 664 | char name[]; |
| 670 | 665 | }; |
| 671 | 666 | |
| 672 | 667 | #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) |
| 673 | −#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) | |
| 668 | +#define FUSE_DIRENT_ALIGN(x) \ | |
| 669 | + (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)) | |
| 674 | 670 | #define FUSE_DIRENT_SIZE(d) \ |
| 675 | 671 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) |
| 676 | 672 | |
| @@ -685,47 +681,47 @@ struct fuse_direntplus { · 8 unmodified lines | ||
| 685 | 681 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen) |
| 686 | 682 | |
| 687 | 683 | struct fuse_notify_inval_inode_out { |
| 688 | − __u64 ino; | |
| 689 | − __s64 off; | |
| 690 | − __s64 len; | |
| 684 | + uint64_t ino; | |
| 685 | + int64_t off; | |
| 686 | + int64_t len; | |
| 691 | 687 | }; |
| 692 | 688 | |
| 693 | 689 | struct fuse_notify_inval_entry_out { |
| 694 | − __u64 parent; | |
| 695 | − __u32 namelen; | |
| 696 | − __u32 padding; | |
| 690 | + uint64_t parent; | |
| 691 | + uint32_t namelen; | |
| 692 | + uint32_t padding; | |
| 697 | 693 | }; |
| 698 | 694 | |
| 699 | 695 | struct fuse_notify_delete_out { |
| 700 | − __u64 parent; | |
| 701 | − __u64 child; | |
| 702 | − __u32 namelen; | |
| 703 | − __u32 padding; | |
| 696 | + uint64_t parent; | |
| 697 | + uint64_t child; | |
| 698 | + uint32_t namelen; | |
| 699 | + uint32_t padding; | |
| 704 | 700 | }; |
| 705 | 701 | |
| 706 | 702 | struct fuse_notify_store_out { |
| 707 | − __u64 nodeid; | |
| 708 | − __u64 offset; | |
| 709 | − __u32 size; | |
| 710 | − __u32 padding; | |
| 703 | + uint64_t nodeid; | |
| 704 | + uint64_t offset; | |
| 705 | + uint32_t size; | |
| 706 | + uint32_t padding; | |
| 711 | 707 | }; |
| 712 | 708 | |
| 713 | 709 | struct fuse_notify_retrieve_out { |
| 714 | − __u64 notify_unique; | |
| 715 | − __u64 nodeid; | |
| 716 | − __u64 offset; | |
| 717 | − __u32 size; | |
| 718 | − __u32 padding; | |
| 710 | + uint64_t notify_unique; | |
| 711 | + uint64_t nodeid; | |
| 712 | + uint64_t offset; | |
| 713 | + uint32_t size; | |
| 714 | + uint32_t padding; | |
| 719 | 715 | }; |
| 720 | 716 | |
| 721 | 717 | /* Matches the size of fuse_write_in */ |
| 722 | 718 | struct fuse_notify_retrieve_in { |
| 723 | − __u64 dummy1; | |
| 724 | − __u64 offset; | |
| 725 | − __u32 size; | |
| 726 | − __u32 dummy2; | |
| 727 | − __u64 dummy3; | |
| 728 | − __u64 dummy4; | |
| 719 | + uint64_t dummy1; | |
| 720 | + uint64_t offset; | |
| 721 | + uint32_t size; | |
| 722 | + uint32_t dummy2; | |
| 723 | + uint64_t dummy3; | |
| 724 | + uint64_t dummy4; | |
| 729 | 725 | }; |
| 730 | 726 | |
| 731 | 727 | #endif /* _LINUX_FUSE_H */ |
| @@ -392,6 +392,30 @@ bool ns_capable(struct user_namespace *ns, int cap) · 391 unmodified lines | ||
| 392 | 392 | } |
| 393 | 393 | EXPORT_SYMBOL(ns_capable); |
| 394 | 394 | |
| 395 | +/** | |
| 396 | + * file_ns_capable - Determine if the file's opener had a capability in effect | |
| 397 | + * @file: The file we want to check | |
| 398 | + * @ns: The usernamespace we want the capability in | |
| 399 | + * @cap: The capability to be tested for | |
| 400 | + * | |
| 401 | + * Return true if task that opened the file had a capability in effect | |
| 402 | + * when the file was opened. | |
| 403 | + * | |
| 404 | + * This does not set PF_SUPERPRIV because the caller may not | |
| 405 | + * actually be privileged. | |
| 406 | + */ | |
| 407 | +bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap) | |
| 408 | +{ | |
| 409 | + if (WARN_ON_ONCE(!cap_valid(cap))) | |
| 410 | + return false; | |
| 411 | + | |
| 412 | + if (security_capable(file->f_cred, ns, cap) == 0) | |
| 413 | + return true; | |
| 414 | + | |
| 415 | + return false; | |
| 416 | +} | |
| 417 | +EXPORT_SYMBOL(file_ns_capable); | |
| 418 | + | |
| 395 | 419 | /** |
| 396 | 420 | * capable - Determine if the current task has a superior capability in effect |
| 397 | 421 | * @cap: The capability to be tested for |
| @@ -4737,7 +4737,8 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) · 4736 unmodified lines | ||
| 4737 | 4737 | } else { |
| 4738 | 4738 | if (arch_vma_name(mmap_event->vma)) { |
| 4739 | 4739 | name = strncpy(tmp, arch_vma_name(mmap_event->vma), |
| 4740 | − sizeof(tmp)); | |
| 4740 | + sizeof(tmp) - 1); | |
| 4741 | + tmp[sizeof(tmp) - 1] = '\0'; | |
| 4741 | 4742 | goto got_name; |
| 4742 | 4743 | } |
| 4743 | 4744 | |
| @@ -5330,7 +5331,7 @@ static void sw_perf_event_destroy(struct perf_event *event) · 586 unmodified lines | ||
| 5330 | 5331 | |
| 5331 | 5332 | static int perf_swevent_init(struct perf_event *event) |
| 5332 | 5333 | { |
| 5333 | − int event_id = event->attr.config; | |
| 5334 | + u64 event_id = event->attr.config; | |
| 5334 | 5335 | |
| 5335 | 5336 | if (event->attr.type != PERF_TYPE_SOFTWARE) |
| 5336 | 5337 | return -ENOENT; |
| @@ -5986,6 +5987,7 @@ skip_type: · 649 unmodified lines | ||
| 5986 | 5987 | if (pmu->pmu_cpu_context) |
| 5987 | 5988 | goto got_cpu_context; |
| 5988 | 5989 | |
| 5990 | + ret = -ENOMEM; | |
| 5989 | 5991 | pmu->pmu_cpu_context = alloc_percpu(struct perf_cpu_context); |
| 5990 | 5992 | if (!pmu->pmu_cpu_context) |
| 5991 | 5993 | goto free_dev; |
| @@ -16,7 +16,7 @@ struct ring_buffer { · 15 unmodified lines | ||
| 16 | 16 | int page_order; /* allocation order */ |
| 17 | 17 | #endif |
| 18 | 18 | int nr_pages; /* nr of data pages */ |
| 19 | − int writable; /* are we writable */ | |
| 19 | + int overwrite; /* can overwrite itself */ | |
| 20 | 20 | |
| 21 | 21 | atomic_t poll; /* POLL_ for wakeups */ |
| 22 | 22 | |
| @@ -18,12 +18,24 @@ · 17 unmodified lines | ||
| 18 | 18 | static bool perf_output_space(struct ring_buffer *rb, unsigned long tail, |
| 19 | 19 | unsigned long offset, unsigned long head) |
| 20 | 20 | { |
| 21 | − unsigned long mask; | |
| 21 | + unsigned long sz = perf_data_size(rb); | |
| 22 | + unsigned long mask = sz - 1; | |
| 22 | 23 | |
| 23 | − if (!rb->writable) | |
| 24 | + /* | |
| 25 | + * check if user-writable | |
| 26 | + * overwrite : over-write its own tail | |
| 27 | + * !overwrite: buffer possibly drops events. | |
| 28 | + */ | |
| 29 | + if (rb->overwrite) | |
| 24 | 30 | return true; |
| 25 | 31 | |
| 26 | − mask = perf_data_size(rb) - 1; | |
| 32 | + /* | |
| 33 | + * verify that payload is not bigger than buffer | |
| 34 | + * otherwise masking logic may fail to detect | |
| 35 | + * the "not enough space" condition | |
| 36 | + */ | |
| 37 | + if ((head - offset) > sz) | |
| 38 | + return false; | |
| 27 | 39 | |
| 28 | 40 | offset = (offset - tail) & mask; |
| 29 | 41 | head = (head - tail) & mask; |
| @@ -212,7 +224,9 @@ ring_buffer_init(struct ring_buffer *rb, long watermark, int flags) · 182 unmodified lines | ||
| 212 | 224 | rb->watermark = max_size / 2; |
| 213 | 225 | |
| 214 | 226 | if (flags & RING_BUFFER_WRITABLE) |
| 215 | − rb->writable = 1; | |
| 227 | + rb->overwrite = 0; | |
| 228 | + else | |
| 229 | + rb->overwrite = 1; | |
| 216 | 230 | |
| 217 | 231 | atomic_set(&rb->refcount, 1); |
| 218 | 232 | |
| @@ -63,6 +63,7 @@ · 62 unmodified lines | ||
| 63 | 63 | DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = |
| 64 | 64 | { |
| 65 | 65 | |
| 66 | + .lock = __RAW_SPIN_LOCK_UNLOCKED(hrtimer_bases.lock), | |
| 66 | 67 | .clock_base = |
| 67 | 68 | { |
| 68 | 69 | { |
| @@ -1642,8 +1643,6 @@ static void __cpuinit init_hrtimers_cpu(int cpu) · 1573 unmodified lines | ||
| 1642 | 1643 | struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu); |
| 1643 | 1644 | int i; |
| 1644 | 1645 | |
| 1645 | − raw_spin_lock_init(&cpu_base->lock); | |
| 1646 | − | |
| 1647 | 1646 | for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { |
| 1648 | 1647 | cpu_base->clock_base[i].cpu_base = cpu_base; |
| 1649 | 1648 | timerqueue_init_head(&cpu_base->clock_base[i].active); |
| @@ -55,7 +55,7 @@ struct resource crashk_res = { · 54 unmodified lines | ||
| 55 | 55 | .flags = IORESOURCE_BUSY | IORESOURCE_MEM |
| 56 | 56 | }; |
| 57 | 57 | struct resource crashk_low_res = { |
| 58 | − .name = "Crash kernel low", | |
| 58 | + .name = "Crash kernel", | |
| 59 | 59 | .start = 0, |
| 60 | 60 | .end = 0, |
| 61 | 61 | .flags = IORESOURCE_BUSY | IORESOURCE_MEM |
| @@ -1368,35 +1368,114 @@ static int __init parse_crashkernel_simple(char *cmdline, · 1306 unmodified lines | ||
| 1368 | 1368 | return 0; |
| 1369 | 1369 | } |
| 1370 | 1370 | |
| 1371 | +#define SUFFIX_HIGH 0 | |
| 1372 | +#define SUFFIX_LOW 1 | |
| 1373 | +#define SUFFIX_NULL 2 | |
| 1374 | +static __initdata char *suffix_tbl[] = { | |
| 1375 | + [SUFFIX_HIGH] = ",high", | |
| 1376 | + [SUFFIX_LOW] = ",low", | |
| 1377 | + [SUFFIX_NULL] = NULL, | |
| 1378 | +}; | |
| 1379 | + | |
| 1371 | 1380 | /* |
| 1372 | − * That function is the entry point for command line parsing and should be | |
| 1373 | − * called from the arch-specific code. | |
| 1381 | + * That function parses "suffix" crashkernel command lines like | |
| 1382 | + * | |
| 1383 | + * crashkernel=size,[high|low] | |
| 1384 | + * | |
| 1385 | + * It returns 0 on success and -EINVAL on failure. | |
| 1374 | 1386 | */ |
| 1387 | +static int __init parse_crashkernel_suffix(char *cmdline, | |
| 1388 | + unsigned long long *crash_size, | |
| 1389 | + unsigned long long *crash_base, | |
| 1390 | + const char *suffix) | |
| 1391 | +{ | |
| 1392 | + char *cur = cmdline; | |
| 1393 | + | |
| 1394 | + *crash_size = memparse(cmdline, &cur); | |
| 1395 | + if (cmdline == cur) { | |
| 1396 | + pr_warn("crashkernel: memory value expected\n"); | |
| 1397 | + return -EINVAL; | |
| 1398 | + } | |
| 1399 | + | |
| 1400 | + /* check with suffix */ | |
| 1401 | + if (strncmp(cur, suffix, strlen(suffix))) { | |
| 1402 | + pr_warn("crashkernel: unrecognized char\n"); | |
| 1403 | + return -EINVAL; | |
| 1404 | + } | |
| 1405 | + cur += strlen(suffix); | |
| 1406 | + if (*cur != ' ' && *cur != '\0') { | |
| 1407 | + pr_warn("crashkernel: unrecognized char\n"); | |
| 1408 | + return -EINVAL; | |
| 1409 | + } | |
| 1410 | + | |
| 1411 | + return 0; | |
| 1412 | +} | |
| 1413 | + | |
| 1414 | +static __init char *get_last_crashkernel(char *cmdline, | |
| 1415 | + const char *name, | |
| 1416 | + const char *suffix) | |
| 1417 | +{ | |
| 1418 | + char *p = cmdline, *ck_cmdline = NULL; | |
| 1419 | + | |
| 1420 | + /* find crashkernel and use the last one if there are more */ | |
| 1421 | + p = strstr(p, name); | |
| 1422 | + while (p) { | |
| 1423 | + char *end_p = strchr(p, ' '); | |
| 1424 | + char *q; | |
| 1425 | + | |
| 1426 | + if (!end_p) | |
| 1427 | + end_p = p + strlen(p); | |
| 1428 | + | |
| 1429 | + if (!suffix) { | |
| 1430 | + int i; | |
| 1431 | + | |
| 1432 | + /* skip the one with any known suffix */ | |
| 1433 | + for (i = 0; suffix_tbl[i]; i++) { | |
| 1434 | + q = end_p - strlen(suffix_tbl[i]); | |
| 1435 | + if (!strncmp(q, suffix_tbl[i], | |
| 1436 | + strlen(suffix_tbl[i]))) | |
| 1437 | + goto next; | |
| 1438 | + } | |
| 1439 | + ck_cmdline = p; | |
| 1440 | + } else { | |
| 1441 | + q = end_p - strlen(suffix); | |
| 1442 | + if (!strncmp(q, suffix, strlen(suffix))) | |
| 1443 | + ck_cmdline = p; | |
| 1444 | + } | |
| 1445 | +next: | |
| 1446 | + p = strstr(p+1, name); | |
| 1447 | + } | |
| 1448 | + | |
| 1449 | + if (!ck_cmdline) | |
| 1450 | + return NULL; | |
| 1451 | + | |
| 1452 | + return ck_cmdline; | |
| 1453 | +} | |
| 1454 | + | |
| 1375 | 1455 | static int __init __parse_crashkernel(char *cmdline, |
| 1376 | 1456 | unsigned long long system_ram, |
| 1377 | 1457 | unsigned long long *crash_size, |
| 1378 | 1458 | unsigned long long *crash_base, |
| 1379 | − const char *name) | |
| 1459 | + const char *name, | |
| 1460 | + const char *suffix) | |
| 1380 | 1461 | { |
| 1381 | − char *p = cmdline, *ck_cmdline = NULL; | |
| 1382 | 1462 | char *first_colon, *first_space; |
| 1463 | + char *ck_cmdline; | |
| 1383 | 1464 | |
| 1384 | 1465 | BUG_ON(!crash_size || !crash_base); |
| 1385 | 1466 | *crash_size = 0; |
| 1386 | 1467 | *crash_base = 0; |
| 1387 | 1468 | |
| 1388 | − /* find crashkernel and use the last one if there are more */ | |
| 1389 | − p = strstr(p, name); | |
| 1390 | − while (p) { | |
| 1391 | − ck_cmdline = p; | |
| 1392 | − p = strstr(p+1, name); | |
| 1393 | − } | |
| 1469 | + ck_cmdline = get_last_crashkernel(cmdline, name, suffix); | |
| 1394 | 1470 | |
| 1395 | 1471 | if (!ck_cmdline) |
| 1396 | 1472 | return -EINVAL; |
| 1397 | 1473 | |
| 1398 | 1474 | ck_cmdline += strlen(name); |
| 1399 | 1475 | |
| 1476 | + if (suffix) | |
| 1477 | + return parse_crashkernel_suffix(ck_cmdline, crash_size, | |
| 1478 | + crash_base, suffix); | |
| 1400 | 1479 | /* |
| 1401 | 1480 | * if the commandline contains a ':', then that's the extended |
| 1402 | 1481 | * syntax -- if not, it must be the classic syntax |
| @@ -1413,13 +1492,26 @@ static int __init __parse_crashkernel(char *cmdline, · 10 unmodified lines | ||
| 1413 | 1492 | return 0; |
| 1414 | 1493 | } |
| 1415 | 1494 | |
| 1495 | +/* | |
| 1496 | + * That function is the entry point for command line parsing and should be | |
| 1497 | + * called from the arch-specific code. | |
| 1498 | + */ | |
| 1416 | 1499 | int __init parse_crashkernel(char *cmdline, |
| 1417 | 1500 | unsigned long long system_ram, |
| 1418 | 1501 | unsigned long long *crash_size, |
| 1419 | 1502 | unsigned long long *crash_base) |
| 1420 | 1503 | { |
| 1421 | 1504 | return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, |
| 1422 | − "crashkernel="); | |
| 1505 | + "crashkernel=", NULL); | |
| 1506 | +} | |
| 1507 | + | |
| 1508 | +int __init parse_crashkernel_high(char *cmdline, | |
| 1509 | + unsigned long long system_ram, | |
| 1510 | + unsigned long long *crash_size, | |
| 1511 | + unsigned long long *crash_base) | |
| 1512 | +{ | |
| 1513 | + return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, | |
| 1514 | + "crashkernel=", suffix_tbl[SUFFIX_HIGH]); | |
| 1423 | 1515 | } |
| 1424 | 1516 | |
| 1425 | 1517 | int __init parse_crashkernel_low(char *cmdline, |
| @@ -1428,7 +1520,7 @@ int __init parse_crashkernel_low(char *cmdline, · 2 unmodified lines | ||
| 1428 | 1520 | unsigned long long *crash_base) |
| 1429 | 1521 | { |
| 1430 | 1522 | return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, |
| 1431 | − "crashkernel_low="); | |
| 1523 | + "crashkernel=", suffix_tbl[SUFFIX_LOW]); | |
| 1432 | 1524 | } |
| 1433 | 1525 | |
| 1434 | 1526 | static void update_vmcoreinfo_note(void) |
| @@ -794,16 +794,16 @@ out: · 793 unmodified lines | ||
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | #ifdef CONFIG_SYSCTL |
| 797 | −/* This should be called with kprobe_mutex locked */ | |
| 798 | 797 | static void __kprobes optimize_all_kprobes(void) |
| 799 | 798 | { |
| 800 | 799 | struct hlist_head *head; |
| 801 | 800 | struct kprobe *p; |
| 802 | 801 | unsigned int i; |
| 803 | 802 | |
| 803 | + mutex_lock(&kprobe_mutex); | |
| 804 | 804 | /* If optimization is already allowed, just return */ |
| 805 | 805 | if (kprobes_allow_optimization) |
| 806 | − return; | |
| 806 | + goto out; | |
| 807 | 807 | |
| 808 | 808 | kprobes_allow_optimization = true; |
| 809 | 809 | for (i = 0; i < KPROBE_TABLE_SIZE; i++) { |
| @@ -813,18 +813,22 @@ static void __kprobes optimize_all_kprobes(void) · 3 unmodified lines | ||
| 813 | 813 | optimize_kprobe(p); |
| 814 | 814 | } |
| 815 | 815 | printk(KERN_INFO "Kprobes globally optimized\n"); |
| 816 | +out: | |
| 817 | + mutex_unlock(&kprobe_mutex); | |
| 816 | 818 | } |
| 817 | 819 | |
| 818 | −/* This should be called with kprobe_mutex locked */ | |
| 819 | 820 | static void __kprobes unoptimize_all_kprobes(void) |
| 820 | 821 | { |
| 821 | 822 | struct hlist_head *head; |
| 822 | 823 | struct kprobe *p; |
| 823 | 824 | unsigned int i; |
| 824 | 825 | |
| 826 | + mutex_lock(&kprobe_mutex); | |
| 825 | 827 | /* If optimization is already prohibited, just return */ |
| 826 | − if (!kprobes_allow_optimization) | |
| 828 | + if (!kprobes_allow_optimization) { | |
| 829 | + mutex_unlock(&kprobe_mutex); | |
| 827 | 830 | return; |
| 831 | + } | |
| 828 | 832 | |
| 829 | 833 | kprobes_allow_optimization = false; |
| 830 | 834 | for (i = 0; i < KPROBE_TABLE_SIZE; i++) { |
| @@ -834,11 +838,14 @@ static void __kprobes unoptimize_all_kprobes(void) · 3 unmodified lines | ||
| 834 | 838 | unoptimize_kprobe(p, false); |
| 835 | 839 | } |
| 836 | 840 | } |
| 841 | + mutex_unlock(&kprobe_mutex); | |
| 842 | + | |
| 837 | 843 | /* Wait for unoptimizing completion */ |
| 838 | 844 | wait_for_kprobe_optimizer(); |
| 839 | 845 | printk(KERN_INFO "Kprobes globally unoptimized\n"); |
| 840 | 846 | } |
| 841 | 847 | |
| 848 | +static DEFINE_MUTEX(kprobe_sysctl_mutex); | |
| 842 | 849 | int sysctl_kprobes_optimization; |
| 843 | 850 | int proc_kprobes_optimization_handler(struct ctl_table *table, int write, |
| 844 | 851 | void __user *buffer, size_t *length, |
| @@ -846,7 +853,7 @@ int proc_kprobes_optimization_handler(struct ctl_table *table, int write, · 1 unmodified line | ||
| 846 | 853 | { |
| 847 | 854 | int ret; |
| 848 | 855 | |
| 849 | − mutex_lock(&kprobe_mutex); | |
| 856 | + mutex_lock(&kprobe_sysctl_mutex); | |
| 850 | 857 | sysctl_kprobes_optimization = kprobes_allow_optimization ? 1 : 0; |
| 851 | 858 | ret = proc_dointvec_minmax(table, write, buffer, length, ppos); |
| 852 | 859 | |
| @@ -854,7 +861,7 @@ int proc_kprobes_optimization_handler(struct ctl_table *table, int write, · 1 unmodified line | ||
| 854 | 861 | optimize_all_kprobes(); |
| 855 | 862 | else |
| 856 | 863 | unoptimize_all_kprobes(); |
| 857 | − mutex_unlock(&kprobe_mutex); | |
| 864 | + mutex_unlock(&kprobe_sysctl_mutex); | |
| 858 | 865 | |
| 859 | 866 | return ret; |
| 860 | 867 | } |
| @@ -124,12 +124,12 @@ void *kthread_data(struct task_struct *task) · 123 unmodified lines | ||
| 124 | 124 | |
| 125 | 125 | static void __kthread_parkme(struct kthread *self) |
| 126 | 126 | { |
| 127 | − __set_current_state(TASK_INTERRUPTIBLE); | |
| 127 | + __set_current_state(TASK_PARKED); | |
| 128 | 128 | while (test_bit(KTHREAD_SHOULD_PARK, &self->flags)) { |
| 129 | 129 | if (!test_and_set_bit(KTHREAD_IS_PARKED, &self->flags)) |
| 130 | 130 | complete(&self->parked); |
| 131 | 131 | schedule(); |
| 132 | − __set_current_state(TASK_INTERRUPTIBLE); | |
| 132 | + __set_current_state(TASK_PARKED); | |
| 133 | 133 | } |
| 134 | 134 | clear_bit(KTHREAD_IS_PARKED, &self->flags); |
| 135 | 135 | __set_current_state(TASK_RUNNING); |
| @@ -256,8 +256,13 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), · 120 unmodified lines | ||
| 256 | 256 | } |
| 257 | 257 | EXPORT_SYMBOL(kthread_create_on_node); |
| 258 | 258 | |
| 259 | −static void __kthread_bind(struct task_struct *p, unsigned int cpu) | |
| 259 | +static void __kthread_bind(struct task_struct *p, unsigned int cpu, long state) | |
| 260 | 260 | { |
| 261 | + /* Must have done schedule() in kthread() before we set_task_cpu */ | |
| 262 | + if (!wait_task_inactive(p, state)) { | |
| 263 | + WARN_ON(1); | |
| 264 | + return; | |
| 265 | + } | |
| 261 | 266 | /* It's safe because the task is inactive. */ |
| 262 | 267 | do_set_cpus_allowed(p, cpumask_of(cpu)); |
| 263 | 268 | p->flags |= PF_THREAD_BOUND; |
| @@ -274,12 +279,7 @@ static void __kthread_bind(struct task_struct *p, unsigned int cpu) · 10 unmodified lines | ||
| 274 | 279 | */ |
| 275 | 280 | void kthread_bind(struct task_struct *p, unsigned int cpu) |
| 276 | 281 | { |
| 277 | − /* Must have done schedule() in kthread() before we set_task_cpu */ | |
| 278 | − if (!wait_task_inactive(p, TASK_UNINTERRUPTIBLE)) { | |
| 279 | − WARN_ON(1); | |
| 280 | − return; | |
| 281 | − } | |
| 282 | − __kthread_bind(p, cpu); | |
| 282 | + __kthread_bind(p, cpu, TASK_UNINTERRUPTIBLE); | |
| 283 | 283 | } |
| 284 | 284 | EXPORT_SYMBOL(kthread_bind); |
| 285 | 285 | |
| @@ -324,6 +324,22 @@ static struct kthread *task_get_live_kthread(struct task_struct *k) · 38 unmodified lines | ||
| 324 | 324 | return NULL; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | +static void __kthread_unpark(struct task_struct *k, struct kthread *kthread) | |
| 328 | +{ | |
| 329 | + clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags); | |
| 330 | + /* | |
| 331 | + * We clear the IS_PARKED bit here as we don't wait | |
| 332 | + * until the task has left the park code. So if we'd | |
| 333 | + * park before that happens we'd see the IS_PARKED bit | |
| 334 | + * which might be about to be cleared. | |
| 335 | + */ | |
| 336 | + if (test_and_clear_bit(KTHREAD_IS_PARKED, &kthread->flags)) { | |
| 337 | + if (test_bit(KTHREAD_IS_PER_CPU, &kthread->flags)) | |
| 338 | + __kthread_bind(k, kthread->cpu, TASK_PARKED); | |
| 339 | + wake_up_state(k, TASK_PARKED); | |
| 340 | + } | |
| 341 | +} | |
| 342 | + | |
| 327 | 343 | /** |
| 328 | 344 | * kthread_unpark - unpark a thread created by kthread_create(). |
| 329 | 345 | * @k: thread created by kthread_create(). |
| @@ -336,20 +352,8 @@ void kthread_unpark(struct task_struct *k) · 6 unmodified lines | ||
| 336 | 352 | { |
| 337 | 353 | struct kthread *kthread = task_get_live_kthread(k); |
| 338 | 354 | |
| 339 | − if (kthread) { | |
| 340 | − clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags); | |
| 341 | − /* | |
| 342 | − * We clear the IS_PARKED bit here as we don't wait | |
| 343 | − * until the task has left the park code. So if we'd | |
| 344 | − * park before that happens we'd see the IS_PARKED bit | |
| 345 | − * which might be about to be cleared. | |
| 346 | − */ | |
| 347 | − if (test_and_clear_bit(KTHREAD_IS_PARKED, &kthread->flags)) { | |
| 348 | − if (test_bit(KTHREAD_IS_PER_CPU, &kthread->flags)) | |
| 349 | − __kthread_bind(k, kthread->cpu); | |
| 350 | − wake_up_process(k); | |
| 351 | − } | |
| 352 | − } | |
| 355 | + if (kthread) | |
| 356 | + __kthread_unpark(k, kthread); | |
| 353 | 357 | put_task_struct(k); |
| 354 | 358 | } |
| 355 | 359 | |
| @@ -407,7 +411,7 @@ int kthread_stop(struct task_struct *k) · 51 unmodified lines | ||
| 407 | 411 | trace_sched_kthread_stop(k); |
| 408 | 412 | if (kthread) { |
| 409 | 413 | set_bit(KTHREAD_SHOULD_STOP, &kthread->flags); |
| 410 | − clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags); | |
| 414 | + __kthread_unpark(k, kthread); | |
| 411 | 415 | wake_up_process(k); |
| 412 | 416 | wait_for_completion(&kthread->exited); |
| 413 | 417 | } |
| @@ -176,10 +176,36 @@ static u64 sched_clock_remote(struct sched_clock_data *scd) · 175 unmodified lines | ||
| 176 | 176 | u64 this_clock, remote_clock; |
| 177 | 177 | u64 *ptr, old_val, val; |
| 178 | 178 | |
| 179 | +#if BITS_PER_LONG != 64 | |
| 180 | +again: | |
| 181 | + /* | |
| 182 | + * Careful here: The local and the remote clock values need to | |
| 183 | + * be read out atomic as we need to compare the values and | |
| 184 | + * then update either the local or the remote side. So the | |
| 185 | + * cmpxchg64 below only protects one readout. | |
| 186 | + * | |
| 187 | + * We must reread via sched_clock_local() in the retry case on | |
| 188 | + * 32bit as an NMI could use sched_clock_local() via the | |
| 189 | + * tracer and hit between the readout of | |
| 190 | + * the low32bit and the high 32bit portion. | |
| 191 | + */ | |
| 192 | + this_clock = sched_clock_local(my_scd); | |
| 193 | + /* | |
| 194 | + * We must enforce atomic readout on 32bit, otherwise the | |
| 195 | + * update on the remote cpu can hit inbetween the readout of | |
| 196 | + * the low32bit and the high 32bit portion. | |
| 197 | + */ | |
| 198 | + remote_clock = cmpxchg64(&scd->clock, 0, 0); | |
| 199 | +#else | |
| 200 | + /* | |
| 201 | + * On 64bit the read of [my]scd->clock is atomic versus the | |
| 202 | + * update, so we can avoid the above 32bit dance. | |
| 203 | + */ | |
| 179 | 204 | sched_clock_local(my_scd); |
| 180 | 205 | again: |
| 181 | 206 | this_clock = my_scd->clock; |
| 182 | 207 | remote_clock = scd->clock; |
| 208 | +#endif | |
| 183 | 209 | |
| 184 | 210 | /* |
| 185 | 211 | * Use the opportunity that we have both locks |
| @@ -1498,8 +1498,10 @@ static void try_to_wake_up_local(struct task_struct *p) · 1497 unmodified lines | ||
| 1498 | 1498 | { |
| 1499 | 1499 | struct rq *rq = task_rq(p); |
| 1500 | 1500 | |
| 1501 | − BUG_ON(rq != this_rq()); | |
| 1502 | − BUG_ON(p == current); | |
| 1501 | + if (WARN_ON_ONCE(rq != this_rq()) || | |
| 1502 | + WARN_ON_ONCE(p == current)) | |
| 1503 | + return; | |
| 1504 | + | |
| 1503 | 1505 | lockdep_assert_held(&rq->lock); |
| 1504 | 1506 | |
| 1505 | 1507 | if (!raw_spin_trylock(&p->pi_lock)) { |
| @@ -4999,7 +5001,7 @@ static void sd_free_ctl_entry(struct ctl_table **tablep) · 3493 unmodified lines | ||
| 4999 | 5001 | } |
| 5000 | 5002 | |
| 5001 | 5003 | static int min_load_idx = 0; |
| 5002 | −static int max_load_idx = CPU_LOAD_IDX_MAX; | |
| 5004 | +static int max_load_idx = CPU_LOAD_IDX_MAX-1; | |
| 5003 | 5005 | |
| 5004 | 5006 | static void |
| 5005 | 5007 | set_table_entry(struct ctl_table *entry, |
| @@ -310,7 +310,7 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) · 309 unmodified lines | ||
| 310 | 310 | |
| 311 | 311 | t = tsk; |
| 312 | 312 | do { |
| 313 | − task_cputime(tsk, &utime, &stime); | |
| 313 | + task_cputime(t, &utime, &stime); | |
| 314 | 314 | times->utime += utime; |
| 315 | 315 | times->stime += stime; |
| 316 | 316 | times->sum_exec_runtime += task_sched_runtime(t); |
| @@ -2950,7 +2950,7 @@ do_send_specific(pid_t tgid, pid_t pid, int sig, struct siginfo *info) · 2949 unmodified lines | ||
| 2950 | 2950 | |
| 2951 | 2951 | static int do_tkill(pid_t tgid, pid_t pid, int sig) |
| 2952 | 2952 | { |
| 2953 | − struct siginfo info; | |
| 2953 | + struct siginfo info = {}; | |
| 2954 | 2954 | |
| 2955 | 2955 | info.si_signo = sig; |
| 2956 | 2956 | info.si_errno = 0; |
| @@ -185,8 +185,18 @@ __smpboot_create_thread(struct smp_hotplug_thread *ht, unsigned int cpu) · 184 unmodified lines | ||
| 185 | 185 | } |
| 186 | 186 | get_task_struct(tsk); |
| 187 | 187 | *per_cpu_ptr(ht->store, cpu) = tsk; |
| 188 | − if (ht->create) | |
| 189 | − ht->create(cpu); | |
| 188 | + if (ht->create) { | |
| 189 | + /* | |
| 190 | + * Make sure that the task has actually scheduled out | |
| 191 | + * into park position, before calling the create | |
| 192 | + * callback. At least the migration thread callback | |
| 193 | + * requires that the task is off the runqueue. | |
| 194 | + */ | |
| 195 | + if (!wait_task_inactive(tsk, TASK_PARKED)) | |
| 196 | + WARN_ON(1); | |
| 197 | + else | |
| 198 | + ht->create(cpu); | |
| 199 | + } | |
| 190 | 200 | return 0; |
| 191 | 201 | } |
| 192 | 202 | |
| @@ -324,7 +324,6 @@ void kernel_restart_prepare(char *cmd) · 323 unmodified lines | ||
| 324 | 324 | system_state = SYSTEM_RESTART; |
| 325 | 325 | usermodehelper_disable(); |
| 326 | 326 | device_shutdown(); |
| 327 | − syscore_shutdown(); | |
| 328 | 327 | } |
| 329 | 328 | |
| 330 | 329 | /** |
| @@ -370,6 +369,7 @@ void kernel_restart(char *cmd) · 39 unmodified lines | ||
| 370 | 369 | { |
| 371 | 370 | kernel_restart_prepare(cmd); |
| 372 | 371 | disable_nonboot_cpus(); |
| 372 | + syscore_shutdown(); | |
| 373 | 373 | if (!cmd) |
| 374 | 374 | printk(KERN_EMERG "Restarting system.\n"); |
| 375 | 375 | else |
| @@ -395,6 +395,7 @@ static void kernel_shutdown_prepare(enum system_states state) · 19 unmodified lines | ||
| 395 | 395 | void kernel_halt(void) |
| 396 | 396 | { |
| 397 | 397 | kernel_shutdown_prepare(SYSTEM_HALT); |
| 398 | + disable_nonboot_cpus(); | |
| 398 | 399 | syscore_shutdown(); |
| 399 | 400 | printk(KERN_EMERG "System halted.\n"); |
| 400 | 401 | kmsg_dump(KMSG_DUMP_HALT); |
| @@ -739,12 +739,6 @@ static void blk_add_trace_rq_complete(void *ignore, · 738 unmodified lines | ||
| 739 | 739 | struct request_queue *q, |
| 740 | 740 | struct request *rq) |
| 741 | 741 | { |
| 742 | − struct blk_trace *bt = q->blk_trace; | |
| 743 | − | |
| 744 | − /* if control ever passes through here, it's a request based driver */ | |
| 745 | − if (unlikely(bt && !bt->rq_based)) | |
| 746 | − bt->rq_based = true; | |
| 747 | − | |
| 748 | 742 | blk_add_trace_rq(q, rq, BLK_TA_COMPLETE); |
| 749 | 743 | } |
| 750 | 744 | |
| @@ -780,24 +774,10 @@ static void blk_add_trace_bio_bounce(void *ignore, · 29 unmodified lines | ||
| 780 | 774 | blk_add_trace_bio(q, bio, BLK_TA_BOUNCE, 0); |
| 781 | 775 | } |
| 782 | 776 | |
| 783 | −static void blk_add_trace_bio_complete(void *ignore, struct bio *bio, int error) | |
| 777 | +static void blk_add_trace_bio_complete(void *ignore, | |
| 778 | + struct request_queue *q, struct bio *bio, | |
| 779 | + int error) | |
| 784 | 780 | { |
| 785 | − struct request_queue *q; | |
| 786 | − struct blk_trace *bt; | |
| 787 | − | |
| 788 | − if (!bio->bi_bdev) | |
| 789 | − return; | |
| 790 | − | |
| 791 | − q = bdev_get_queue(bio->bi_bdev); | |
| 792 | − bt = q->blk_trace; | |
| 793 | − | |
| 794 | − /* | |
| 795 | − * Request based drivers will generate both rq and bio completions. | |
| 796 | − * Ignore bio ones. | |
| 797 | − */ | |
| 798 | − if (likely(!bt) || bt->rq_based) | |
| 799 | − return; | |
| 800 | − | |
| 801 | 781 | blk_add_trace_bio(q, bio, BLK_TA_COMPLETE, error); |
| 802 | 782 | } |
| 803 | 783 | |
| @@ -66,7 +66,7 @@ · 65 unmodified lines | ||
| 66 | 66 | |
| 67 | 67 | static struct ftrace_ops ftrace_list_end __read_mostly = { |
| 68 | 68 | .func = ftrace_stub, |
| 69 | − .flags = FTRACE_OPS_FL_RECURSION_SAFE, | |
| 69 | + .flags = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_STUB, | |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | 72 | /* ftrace_enabled is a method to turn ftrace on or off */ |
| @@ -694,7 +694,6 @@ int ftrace_profile_pages_init(struct ftrace_profile_stat *stat) · 621 unmodified lines | ||
| 694 | 694 | free_page(tmp); |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | − free_page((unsigned long)stat->pages); | |
| 698 | 697 | stat->pages = NULL; |
| 699 | 698 | stat->start = NULL; |
| 700 | 699 | |
| @@ -1053,6 +1052,19 @@ static __init void ftrace_profile_debugfs(struct dentry *d_tracer) · 352 unmodified lines | ||
| 1053 | 1052 | |
| 1054 | 1053 | static struct pid * const ftrace_swapper_pid = &init_struct_pid; |
| 1055 | 1054 | |
| 1055 | +loff_t | |
| 1056 | +ftrace_filter_lseek(struct file *file, loff_t offset, int whence) | |
| 1057 | +{ | |
| 1058 | + loff_t ret; | |
| 1059 | + | |
| 1060 | + if (file->f_mode & FMODE_READ) | |
| 1061 | + ret = seq_lseek(file, offset, whence); | |
| 1062 | + else | |
| 1063 | + file->f_pos = ret = 1; | |
| 1064 | + | |
| 1065 | + return ret; | |
| 1066 | +} | |
| 1067 | + | |
| 1056 | 1068 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 1057 | 1069 | |
| 1058 | 1070 | #ifndef CONFIG_FTRACE_MCOUNT_RECORD |
| @@ -2613,7 +2625,7 @@ static void ftrace_filter_reset(struct ftrace_hash *hash) · 1554 unmodified lines | ||
| 2613 | 2625 | * routine, you can use ftrace_filter_write() for the write |
| 2614 | 2626 | * routine if @flag has FTRACE_ITER_FILTER set, or |
| 2615 | 2627 | * ftrace_notrace_write() if @flag has FTRACE_ITER_NOTRACE set. |
| 2616 | − * ftrace_regex_lseek() should be used as the lseek routine, and | |
| 2628 | + * ftrace_filter_lseek() should be used as the lseek routine, and | |
| 2617 | 2629 | * release must call ftrace_regex_release(). |
| 2618 | 2630 | */ |
| 2619 | 2631 | int |
| @@ -2697,19 +2709,6 @@ ftrace_notrace_open(struct inode *inode, struct file *file) · 77 unmodified lines | ||
| 2697 | 2709 | inode, file); |
| 2698 | 2710 | } |
| 2699 | 2711 | |
| 2700 | −loff_t | |
| 2701 | −ftrace_regex_lseek(struct file *file, loff_t offset, int whence) | |
| 2702 | −{ | |
| 2703 | − loff_t ret; | |
| 2704 | − | |
| 2705 | − if (file->f_mode & FMODE_READ) | |
| 2706 | − ret = seq_lseek(file, offset, whence); | |
| 2707 | − else | |
| 2708 | − file->f_pos = ret = 1; | |
| 2709 | − | |
| 2710 | − return ret; | |
| 2711 | −} | |
| 2712 | − | |
| 2713 | 2712 | static int ftrace_match(char *str, char *regex, int len, int type) |
| 2714 | 2713 | { |
| 2715 | 2714 | int matched = 0; |
| @@ -3441,14 +3440,14 @@ static char ftrace_filter_buf[FTRACE_FILTER_SIZE] __initdata; · 725 unmodified lines | ||
| 3441 | 3440 | |
| 3442 | 3441 | static int __init set_ftrace_notrace(char *str) |
| 3443 | 3442 | { |
| 3444 | − strncpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE); | |
| 3443 | + strlcpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE); | |
| 3445 | 3444 | return 1; |
| 3446 | 3445 | } |
| 3447 | 3446 | __setup("ftrace_notrace=", set_ftrace_notrace); |
| 3448 | 3447 | |
| 3449 | 3448 | static int __init set_ftrace_filter(char *str) |
| 3450 | 3449 | { |
| 3451 | − strncpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE); | |
| 3450 | + strlcpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE); | |
| 3452 | 3451 | return 1; |
| 3453 | 3452 | } |
| 3454 | 3453 | __setup("ftrace_filter=", set_ftrace_filter); |
| @@ -3571,7 +3570,7 @@ static const struct file_operations ftrace_filter_fops = { · 116 unmodified lines | ||
| 3571 | 3570 | .open = ftrace_filter_open, |
| 3572 | 3571 | .read = seq_read, |
| 3573 | 3572 | .write = ftrace_filter_write, |
| 3574 | − .llseek = ftrace_regex_lseek, | |
| 3573 | + .llseek = ftrace_filter_lseek, | |
| 3575 | 3574 | .release = ftrace_regex_release, |
| 3576 | 3575 | }; |
| 3577 | 3576 | |
| @@ -3579,7 +3578,7 @@ static const struct file_operations ftrace_notrace_fops = { · 1 unmodified line | ||
| 3579 | 3578 | .open = ftrace_notrace_open, |
| 3580 | 3579 | .read = seq_read, |
| 3581 | 3580 | .write = ftrace_notrace_write, |
| 3582 | − .llseek = ftrace_regex_lseek, | |
| 3581 | + .llseek = ftrace_filter_lseek, | |
| 3583 | 3582 | .release = ftrace_regex_release, |
| 3584 | 3583 | }; |
| 3585 | 3584 | |
| @@ -3784,8 +3783,8 @@ static const struct file_operations ftrace_graph_fops = { · 198 unmodified lines | ||
| 3784 | 3783 | .open = ftrace_graph_open, |
| 3785 | 3784 | .read = seq_read, |
| 3786 | 3785 | .write = ftrace_graph_write, |
| 3786 | + .llseek = ftrace_filter_lseek, | |
| 3787 | 3787 | .release = ftrace_graph_release, |
| 3788 | − .llseek = seq_lseek, | |
| 3789 | 3788 | }; |
| 3790 | 3789 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
| 3791 | 3790 | |
| @@ -4131,7 +4130,8 @@ ftrace_ops_control_func(unsigned long ip, unsigned long parent_ip, · 339 unmodified lines | ||
| 4131 | 4130 | preempt_disable_notrace(); |
| 4132 | 4131 | trace_recursion_set(TRACE_CONTROL_BIT); |
| 4133 | 4132 | do_for_each_ftrace_op(op, ftrace_control_list) { |
| 4134 | − if (!ftrace_function_local_disabled(op) && | |
| 4133 | + if (!(op->flags & FTRACE_OPS_FL_STUB) && | |
| 4134 | + !ftrace_function_local_disabled(op) && | |
| 4135 | 4135 | ftrace_ops_test(op, ip)) |
| 4136 | 4136 | op->func(ip, parent_ip, op, regs); |
| 4137 | 4137 | } while_for_each_ftrace_op(op); |
| @@ -4439,7 +4439,7 @@ static const struct file_operations ftrace_pid_fops = { · 301 unmodified lines | ||
| 4439 | 4439 | .open = ftrace_pid_open, |
| 4440 | 4440 | .write = ftrace_pid_write, |
| 4441 | 4441 | .read = seq_read, |
| 4442 | − .llseek = seq_lseek, | |
| 4442 | + .llseek = ftrace_filter_lseek, | |
| 4443 | 4443 | .release = ftrace_pid_release, |
| 4444 | 4444 | }; |
| 4445 | 4445 | |
| @@ -4555,12 +4555,8 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, · 109 unmodified lines | ||
| 4555 | 4555 | ftrace_startup_sysctl(); |
| 4556 | 4556 | |
| 4557 | 4557 | /* we are starting ftrace again */ |
| 4558 | − if (ftrace_ops_list != &ftrace_list_end) { | |
| 4559 | − if (ftrace_ops_list->next == &ftrace_list_end) | |
| 4560 | − ftrace_trace_function = ftrace_ops_list->func; | |
| 4561 | − else | |
| 4562 | − ftrace_trace_function = ftrace_ops_list_func; | |
| 4563 | − } | |
| 4558 | + if (ftrace_ops_list != &ftrace_list_end) | |
| 4559 | + update_ftrace_function(); | |
| 4564 | 4560 | |
| 4565 | 4561 | } else { |
| 4566 | 4562 | /* stopping ftrace calls (just send to ftrace_stub) */ |
| @@ -132,7 +132,7 @@ static char *default_bootup_tracer; · 131 unmodified lines | ||
| 132 | 132 | |
| 133 | 133 | static int __init set_cmdline_ftrace(char *str) |
| 134 | 134 | { |
| 135 | − strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE); | |
| 135 | + strlcpy(bootup_tracer_buf, str, MAX_TRACER_SIZE); | |
| 136 | 136 | default_bootup_tracer = bootup_tracer_buf; |
| 137 | 137 | /* We are using ftrace early, expand it */ |
| 138 | 138 | ring_buffer_expanded = 1; |
| @@ -162,7 +162,7 @@ static char *trace_boot_options __initdata; · 23 unmodified lines | ||
| 162 | 162 | |
| 163 | 163 | static int __init set_trace_boot_options(char *str) |
| 164 | 164 | { |
| 165 | − strncpy(trace_boot_options_buf, str, MAX_TRACER_SIZE); | |
| 165 | + strlcpy(trace_boot_options_buf, str, MAX_TRACER_SIZE); | |
| 166 | 166 | trace_boot_options = trace_boot_options_buf; |
| 167 | 167 | return 0; |
| 168 | 168 | } |
| @@ -744,8 +744,11 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu) · 575 unmodified lines | ||
| 744 | 744 | return; |
| 745 | 745 | |
| 746 | 746 | WARN_ON_ONCE(!irqs_disabled()); |
| 747 | − if (WARN_ON_ONCE(!current_trace->allocated_snapshot)) | |
| 747 | + if (!current_trace->allocated_snapshot) { | |
| 748 | + /* Only the nop tracer should hit this when disabling */ | |
| 749 | + WARN_ON_ONCE(current_trace != &nop_trace); | |
| 748 | 750 | return; |
| 751 | + } | |
| 749 | 752 | |
| 750 | 753 | arch_spin_lock(&ftrace_max_lock); |
| 751 | 754 | |
| @@ -322,7 +322,7 @@ static const struct file_operations stack_trace_filter_fops = { · 321 unmodified lines | ||
| 322 | 322 | .open = stack_trace_filter_open, |
| 323 | 323 | .read = seq_read, |
| 324 | 324 | .write = ftrace_filter_write, |
| 325 | − .llseek = ftrace_regex_lseek, | |
| 325 | + .llseek = ftrace_filter_lseek, | |
| 326 | 326 | .release = ftrace_regex_release, |
| 327 | 327 | }; |
| 328 | 328 | |
| @@ -25,7 +25,8 @@ · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | static struct kmem_cache *user_ns_cachep __read_mostly; |
| 27 | 27 | |
| 28 | −static bool new_idmap_permitted(struct user_namespace *ns, int cap_setid, | |
| 28 | +static bool new_idmap_permitted(const struct file *file, | |
| 29 | + struct user_namespace *ns, int cap_setid, | |
| 29 | 30 | struct uid_gid_map *map); |
| 30 | 31 | |
| 31 | 32 | static void set_cred_user_ns(struct cred *cred, struct user_namespace *user_ns) |
| @@ -612,10 +613,10 @@ static ssize_t map_write(struct file *file, const char __user *buf, · 580 unmodified lines | ||
| 612 | 613 | if (map->nr_extents != 0) |
| 613 | 614 | goto out; |
| 614 | 615 | |
| 615 | − /* Require the appropriate privilege CAP_SETUID or CAP_SETGID | |
| 616 | − * over the user namespace in order to set the id mapping. | |
| 616 | + /* | |
| 617 | + * Adjusting namespace settings requires capabilities on the target. | |
| 617 | 618 | */ |
| 618 | − if (cap_valid(cap_setid) && !ns_capable(ns, cap_setid)) | |
| 619 | + if (cap_valid(cap_setid) && !file_ns_capable(file, ns, CAP_SYS_ADMIN)) | |
| 619 | 620 | goto out; |
| 620 | 621 | |
| 621 | 622 | /* Get a buffer */ |
| @@ -700,7 +701,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, · 78 unmodified lines | ||
| 700 | 701 | |
| 701 | 702 | ret = -EPERM; |
| 702 | 703 | /* Validate the user is allowed to use user id's mapped to. */ |
| 703 | − if (!new_idmap_permitted(ns, cap_setid, &new_map)) | |
| 704 | + if (!new_idmap_permitted(file, ns, cap_setid, &new_map)) | |
| 704 | 705 | goto out; |
| 705 | 706 | |
| 706 | 707 | /* Map the lower ids from the parent user namespace to the |
| @@ -787,7 +788,8 @@ ssize_t proc_projid_map_write(struct file *file, const char __user *buf, size_t · 80 unmodified lines | ||
| 787 | 788 | &ns->projid_map, &ns->parent->projid_map); |
| 788 | 789 | } |
| 789 | 790 | |
| 790 | −static bool new_idmap_permitted(struct user_namespace *ns, int cap_setid, | |
| 791 | +static bool new_idmap_permitted(const struct file *file, | |
| 792 | + struct user_namespace *ns, int cap_setid, | |
| 791 | 793 | struct uid_gid_map *new_map) |
| 792 | 794 | { |
| 793 | 795 | /* Allow mapping to your own filesystem ids */ |
| @@ -795,12 +797,12 @@ static bool new_idmap_permitted(struct user_namespace *ns, int cap_setid, · 1 unmodified line | ||
| 795 | 797 | u32 id = new_map->extent[0].lower_first; |
| 796 | 798 | if (cap_setid == CAP_SETUID) { |
| 797 | 799 | kuid_t uid = make_kuid(ns->parent, id); |
| 798 | − if (uid_eq(uid, current_fsuid())) | |
| 800 | + if (uid_eq(uid, file->f_cred->fsuid)) | |
| 799 | 801 | return true; |
| 800 | 802 | } |
| 801 | 803 | else if (cap_setid == CAP_SETGID) { |
| 802 | 804 | kgid_t gid = make_kgid(ns->parent, id); |
| 803 | − if (gid_eq(gid, current_fsgid())) | |
| 805 | + if (gid_eq(gid, file->f_cred->fsgid)) | |
| 804 | 806 | return true; |
| 805 | 807 | } |
| 806 | 808 | } |
| @@ -811,8 +813,10 @@ static bool new_idmap_permitted(struct user_namespace *ns, int cap_setid, · 4 unmodified lines | ||
| 811 | 813 | |
| 812 | 814 | /* Allow the specified ids if we have the appropriate capability |
| 813 | 815 | * (CAP_SETUID or CAP_SETGID) over the parent user namespace. |
| 816 | + * And the opener of the id file also had the approprpiate capability. | |
| 814 | 817 | */ |
| 815 | − if (ns_capable(ns->parent, cap_setid)) | |
| 818 | + if (ns_capable(ns->parent, cap_setid) && | |
| 819 | + file_ns_capable(file, ns->parent, cap_setid)) | |
| 816 | 820 | return true; |
| 817 | 821 | |
| 818 | 822 | return false; |
| @@ -404,4 +404,7 @@ config OID_REGISTRY · 403 unmodified lines | ||
| 404 | 404 | help |
| 405 | 405 | Enable fast lookup object identifier registry. |
| 406 | 406 | |
| 407 | +config UCS2_STRING | |
| 408 | + tristate | |
| 409 | + | |
| 407 | 410 | endmenu |
| @@ -174,3 +174,5 @@ quiet_cmd_build_OID_registry = GEN $@ · 173 unmodified lines | ||
| 174 | 174 | cmd_build_OID_registry = perl $(srctree)/$(src)/build_OID_registry $< $@ |
| 175 | 175 | |
| 176 | 176 | clean-files += oid_registry_data.c |
| 177 | + | |
| 178 | +obj-$(CONFIG_UCS2_STRING) += ucs2_string.o | |
| @@ -529,6 +529,13 @@ struct kobject *kobject_get(struct kobject *kobj) · 528 unmodified lines | ||
| 529 | 529 | return kobj; |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | +static struct kobject *kobject_get_unless_zero(struct kobject *kobj) | |
| 533 | +{ | |
| 534 | + if (!kref_get_unless_zero(&kobj->kref)) | |
| 535 | + kobj = NULL; | |
| 536 | + return kobj; | |
| 537 | +} | |
| 538 | + | |
| 532 | 539 | /* |
| 533 | 540 | * kobject_cleanup - free kobject resources. |
| 534 | 541 | * @kobj: object to cleanup |
| @@ -751,7 +758,7 @@ struct kobject *kset_find_obj(struct kset *kset, const char *name) · 216 unmodified lines | ||
| 751 | 758 | |
| 752 | 759 | list_for_each_entry(k, &kset->list, entry) { |
| 753 | 760 | if (kobject_name(k) && !strcmp(kobject_name(k), name)) { |
| 754 | − ret = kobject_get(k); | |
| 761 | + ret = kobject_get_unless_zero(k); | |
| 755 | 762 | break; |
| 756 | 763 | } |
| 757 | 764 | } |
| @@ -105,9 +105,9 @@ setup_io_tlb_npages(char *str) · 104 unmodified lines | ||
| 105 | 105 | if (!strcmp(str, "force")) |
| 106 | 106 | swiotlb_force = 1; |
| 107 | 107 | |
| 108 | − return 1; | |
| 108 | + return 0; | |
| 109 | 109 | } |
| 110 | −__setup("swiotlb=", setup_io_tlb_npages); | |
| 110 | +early_param("swiotlb", setup_io_tlb_npages); | |
| 111 | 111 | /* make io_tlb_overflow tunable too? */ |
| 112 | 112 | |
| 113 | 113 | unsigned long swiotlb_nr_tbl(void) |
| @@ -115,6 +115,18 @@ unsigned long swiotlb_nr_tbl(void) · 1 unmodified line | ||
| 115 | 115 | return io_tlb_nslabs; |
| 116 | 116 | } |
| 117 | 117 | EXPORT_SYMBOL_GPL(swiotlb_nr_tbl); |
| 118 | + | |
| 119 | +/* default to 64MB */ | |
| 120 | +#define IO_TLB_DEFAULT_SIZE (64UL<<20) | |
| 121 | +unsigned long swiotlb_size_or_default(void) | |
| 122 | +{ | |
| 123 | + unsigned long size; | |
| 124 | + | |
| 125 | + size = io_tlb_nslabs << IO_TLB_SHIFT; | |
| 126 | + | |
| 127 | + return size ? size : (IO_TLB_DEFAULT_SIZE); | |
| 128 | +} | |
| 129 | + | |
| 118 | 130 | /* Note that this doesn't work with highmem page */ |
| 119 | 131 | static dma_addr_t swiotlb_virt_to_bus(struct device *hwdev, |
| 120 | 132 | volatile void *address) |
| @@ -188,8 +200,7 @@ int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose) · 67 unmodified lines | ||
| 188 | 200 | void __init |
| 189 | 201 | swiotlb_init(int verbose) |
| 190 | 202 | { |
| 191 | − /* default to 64MB */ | |
| 192 | − size_t default_size = 64UL<<20; | |
| 203 | + size_t default_size = IO_TLB_DEFAULT_SIZE; | |
| 193 | 204 | unsigned char *vstart; |
| 194 | 205 | unsigned long bytes; |
| 195 | 206 | |
| @@ -0,0 +1,51 @@ | ||
| 1 | +#include <linux/ucs2_string.h> | |
| 2 | +#include <linux/module.h> | |
| 3 | + | |
| 4 | +/* Return the number of unicode characters in data */ | |
| 5 | +unsigned long | |
| 6 | +ucs2_strnlen(const ucs2_char_t *s, size_t maxlength) | |
| 7 | +{ | |
| 8 | + unsigned long length = 0; | |
| 9 | + | |
| 10 | + while (*s++ != 0 && length < maxlength) | |
| 11 | + length++; | |
| 12 | + return length; | |
| 13 | +} | |
| 14 | +EXPORT_SYMBOL(ucs2_strnlen); | |
| 15 | + | |
| 16 | +unsigned long | |
| 17 | +ucs2_strlen(const ucs2_char_t *s) | |
| 18 | +{ | |
| 19 | + return ucs2_strnlen(s, ~0UL); | |
| 20 | +} | |
| 21 | +EXPORT_SYMBOL(ucs2_strlen); | |
| 22 | + | |
| 23 | +/* | |
| 24 | + * Return the number of bytes is the length of this string | |
| 25 | + * Note: this is NOT the same as the number of unicode characters | |
| 26 | + */ | |
| 27 | +unsigned long | |
| 28 | +ucs2_strsize(const ucs2_char_t *data, unsigned long maxlength) | |
| 29 | +{ | |
| 30 | + return ucs2_strnlen(data, maxlength/sizeof(ucs2_char_t)) * sizeof(ucs2_char_t); | |
| 31 | +} | |
| 32 | +EXPORT_SYMBOL(ucs2_strsize); | |
| 33 | + | |
| 34 | +int | |
| 35 | +ucs2_strncmp(const ucs2_char_t *a, const ucs2_char_t *b, size_t len) | |
| 36 | +{ | |
| 37 | + while (1) { | |
| 38 | + if (len == 0) | |
| 39 | + return 0; | |
| 40 | + if (*a < *b) | |
| 41 | + return -1; | |
| 42 | + if (*a > *b) | |
| 43 | + return 1; | |
| 44 | + if (*a == 0) /* implies *b == 0 */ | |
| 45 | + return 0; | |
| 46 | + a++; | |
| 47 | + b++; | |
| 48 | + len--; | |
| 49 | + } | |
| 50 | +} | |
| 51 | +EXPORT_SYMBOL(ucs2_strncmp); | |
| @@ -2961,7 +2961,17 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, · 2960 unmodified lines | ||
| 2961 | 2961 | break; |
| 2962 | 2962 | } |
| 2963 | 2963 | |
| 2964 | − if (absent || | |
| 2964 | + /* | |
| 2965 | + * We need call hugetlb_fault for both hugepages under migration | |
| 2966 | + * (in which case hugetlb_fault waits for the migration,) and | |
| 2967 | + * hwpoisoned hugepages (in which case we need to prevent the | |
| 2968 | + * caller from accessing to them.) In order to do this, we use | |
| 2969 | + * here is_swap_pte instead of is_hugetlb_entry_migration and | |
| 2970 | + * is_hugetlb_entry_hwpoisoned. This is because it simply covers | |
| 2971 | + * both cases, and because we can't follow correct pages | |
| 2972 | + * directly from any kind of swap entries. | |
| 2973 | + */ | |
| 2974 | + if (absent || is_swap_pte(huge_ptep_get(pte)) || | |
| 2965 | 2975 | ((flags & FOLL_WRITE) && !pte_write(huge_ptep_get(pte)))) { |
| 2966 | 2976 | int ret; |
| 2967 | 2977 | |
| @@ -216,6 +216,7 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm) · 215 unmodified lines | ||
| 216 | 216 | tlb->mm = mm; |
| 217 | 217 | |
| 218 | 218 | tlb->fullmm = fullmm; |
| 219 | + tlb->need_flush_all = 0; | |
| 219 | 220 | tlb->start = -1UL; |
| 220 | 221 | tlb->end = 0; |
| 221 | 222 | tlb->need_flush = 0; |
| @@ -2392,6 +2393,53 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, · 2170 unmodified lines | ||
| 2392 | 2393 | } |
| 2393 | 2394 | EXPORT_SYMBOL(remap_pfn_range); |
| 2394 | 2395 | |
| 2396 | +/** | |
| 2397 | + * vm_iomap_memory - remap memory to userspace | |
| 2398 | + * @vma: user vma to map to | |
| 2399 | + * @start: start of area | |
| 2400 | + * @len: size of area | |
| 2401 | + * | |
| 2402 | + * This is a simplified io_remap_pfn_range() for common driver use. The | |
| 2403 | + * driver just needs to give us the physical memory range to be mapped, | |
| 2404 | + * we'll figure out the rest from the vma information. | |
| 2405 | + * | |
| 2406 | + * NOTE! Some drivers might want to tweak vma->vm_page_prot first to get | |
| 2407 | + * whatever write-combining details or similar. | |
| 2408 | + */ | |
| 2409 | +int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long len) | |
| 2410 | +{ | |
| 2411 | + unsigned long vm_len, pfn, pages; | |
| 2412 | + | |
| 2413 | + /* Check that the physical memory area passed in looks valid */ | |
| 2414 | + if (start + len < start) | |
| 2415 | + return -EINVAL; | |
| 2416 | + /* | |
| 2417 | + * You *really* shouldn't map things that aren't page-aligned, | |
| 2418 | + * but we've historically allowed it because IO memory might | |
| 2419 | + * just have smaller alignment. | |
| 2420 | + */ | |
| 2421 | + len += start & ~PAGE_MASK; | |
| 2422 | + pfn = start >> PAGE_SHIFT; | |
| 2423 | + pages = (len + ~PAGE_MASK) >> PAGE_SHIFT; | |
| 2424 | + if (pfn + pages < pfn) | |
| 2425 | + return -EINVAL; | |
| 2426 | + | |
| 2427 | + /* We start the mapping 'vm_pgoff' pages into the area */ | |
| 2428 | + if (vma->vm_pgoff > pages) | |
| 2429 | + return -EINVAL; | |
| 2430 | + pfn += vma->vm_pgoff; | |
| 2431 | + pages -= vma->vm_pgoff; | |
| 2432 | + | |
| 2433 | + /* Can we fit all of the mapping? */ | |
| 2434 | + vm_len = vma->vm_end - vma->vm_start; | |
| 2435 | + if (vm_len >> PAGE_SHIFT > pages) | |
| 2436 | + return -EINVAL; | |
| 2437 | + | |
| 2438 | + /* Ok, let it rip */ | |
| 2439 | + return io_remap_pfn_range(vma, vma->vm_start, pfn, vm_len, vma->vm_page_prot); | |
| 2440 | +} | |
| 2441 | +EXPORT_SYMBOL(vm_iomap_memory); | |
| 2442 | + | |
| 2395 | 2443 | static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, |
| 2396 | 2444 | unsigned long addr, unsigned long end, |
| 2397 | 2445 | pte_fn_t fn, void *data) |
| @@ -3188,9 +3188,9 @@ int kswapd_run(int nid) · 3187 unmodified lines | ||
| 3188 | 3188 | if (IS_ERR(pgdat->kswapd)) { |
| 3189 | 3189 | /* failure at boot is fatal */ |
| 3190 | 3190 | BUG_ON(system_state == SYSTEM_BOOTING); |
| 3191 | − pgdat->kswapd = NULL; | |
| 3192 | 3191 | pr_err("Failed to start kswapd on node %d\n", nid); |
| 3193 | 3192 | ret = PTR_ERR(pgdat->kswapd); |
| 3193 | + pgdat->kswapd = NULL; | |
| 3194 | 3194 | } |
| 3195 | 3195 | return ret; |
| 3196 | 3196 | } |
| @@ -870,8 +870,12 @@ void mrp_uninit_applicant(struct net_device *dev, struct mrp_application *appl) · 869 unmodified lines | ||
| 870 | 870 | * all pending messages before the applicant is gone. |
| 871 | 871 | */ |
| 872 | 872 | del_timer_sync(&app->join_timer); |
| 873 | + | |
| 874 | + spin_lock(&app->lock); | |
| 873 | 875 | mrp_mad_event(app, MRP_EVENT_TX); |
| 874 | 876 | mrp_pdu_queue(app); |
| 877 | + spin_unlock(&app->lock); | |
| 878 | + | |
| 875 | 879 | mrp_queue_xmit(app); |
| 876 | 880 | |
| 877 | 881 | dev_mc_del(dev, appl->group_address); |
| @@ -177,7 +177,13 @@ void batadv_mesh_free(struct net_device *soft_iface) · 176 unmodified lines | ||
| 177 | 177 | atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | −int batadv_is_my_mac(const uint8_t *addr) | |
| 180 | +/** | |
| 181 | + * batadv_is_my_mac - check if the given mac address belongs to any of the real | |
| 182 | + * interfaces in the current mesh | |
| 183 | + * @bat_priv: the bat priv with all the soft interface information | |
| 184 | + * @addr: the address to check | |
| 185 | + */ | |
| 186 | +int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr) | |
| 181 | 187 | { |
| 182 | 188 | const struct batadv_hard_iface *hard_iface; |
| 183 | 189 | |
| @@ -186,6 +192,9 @@ int batadv_is_my_mac(const uint8_t *addr) · 2 unmodified lines | ||
| 186 | 192 | if (hard_iface->if_status != BATADV_IF_ACTIVE) |
| 187 | 193 | continue; |
| 188 | 194 | |
| 195 | + if (hard_iface->soft_iface != bat_priv->soft_iface) | |
| 196 | + continue; | |
| 197 | + | |
| 189 | 198 | if (batadv_compare_eth(hard_iface->net_dev->dev_addr, addr)) { |
| 190 | 199 | rcu_read_unlock(); |
| 191 | 200 | return 1; |
| @@ -165,7 +165,7 @@ extern struct workqueue_struct *batadv_event_workqueue; · 164 unmodified lines | ||
| 165 | 165 | |
| 166 | 166 | int batadv_mesh_init(struct net_device *soft_iface); |
| 167 | 167 | void batadv_mesh_free(struct net_device *soft_iface); |
| 168 | −int batadv_is_my_mac(const uint8_t *addr); | |
| 168 | +int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr); | |
| 169 | 169 | struct batadv_hard_iface * |
| 170 | 170 | batadv_seq_print_text_primary_if_get(struct seq_file *seq); |
| 171 | 171 | int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, |
| @@ -1484,7 +1484,7 @@ void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv, · 1483 unmodified lines | ||
| 1484 | 1484 | { |
| 1485 | 1485 | struct ethhdr *ethhdr = (struct ethhdr *)skb_mac_header(skb); |
| 1486 | 1486 | |
| 1487 | − if (batadv_is_my_mac(ethhdr->h_dest)) | |
| 1487 | + if (batadv_is_my_mac(bat_priv, ethhdr->h_dest)) | |
| 1488 | 1488 | return; |
| 1489 | 1489 | |
| 1490 | 1490 | /* Set data pointer to MAC header to mimic packets from our tx path */ |
| @@ -1496,6 +1496,7 @@ void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv, · 5 unmodified lines | ||
| 1496 | 1496 | /** |
| 1497 | 1497 | * batadv_nc_skb_decode_packet - decode given skb using the decode data stored |
| 1498 | 1498 | * in nc_packet |
| 1499 | + * @bat_priv: the bat priv with all the soft interface information | |
| 1499 | 1500 | * @skb: unicast skb to decode |
| 1500 | 1501 | * @nc_packet: decode data needed to decode the skb |
| 1501 | 1502 | * |
| @@ -1503,7 +1504,7 @@ void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv, · 1 unmodified line | ||
| 1503 | 1504 | * in case of an error. |
| 1504 | 1505 | */ |
| 1505 | 1506 | static struct batadv_unicast_packet * |
| 1506 | −batadv_nc_skb_decode_packet(struct sk_buff *skb, | |
| 1507 | +batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb, | |
| 1507 | 1508 | struct batadv_nc_packet *nc_packet) |
| 1508 | 1509 | { |
| 1509 | 1510 | const int h_size = sizeof(struct batadv_unicast_packet); |
| @@ -1537,7 +1538,7 @@ batadv_nc_skb_decode_packet(struct sk_buff *skb, · 27 unmodified lines | ||
| 1537 | 1538 | /* Select the correct unicast header information based on the location |
| 1538 | 1539 | * of our mac address in the coded_packet header |
| 1539 | 1540 | */ |
| 1540 | − if (batadv_is_my_mac(coded_packet_tmp.second_dest)) { | |
| 1541 | + if (batadv_is_my_mac(bat_priv, coded_packet_tmp.second_dest)) { | |
| 1541 | 1542 | /* If we are the second destination the packet was overheard, |
| 1542 | 1543 | * so the Ethernet address must be copied to h_dest and |
| 1543 | 1544 | * pkt_type changed from PACKET_OTHERHOST to PACKET_HOST |
| @@ -1608,7 +1609,7 @@ batadv_nc_find_decoding_packet(struct batadv_priv *bat_priv, · 64 unmodified lines | ||
| 1608 | 1609 | |
| 1609 | 1610 | /* Select the correct packet id based on the location of our mac-addr */ |
| 1610 | 1611 | dest = ethhdr->h_source; |
| 1611 | − if (!batadv_is_my_mac(coded->second_dest)) { | |
| 1612 | + if (!batadv_is_my_mac(bat_priv, coded->second_dest)) { | |
| 1612 | 1613 | source = coded->second_source; |
| 1613 | 1614 | packet_id = coded->second_crc; |
| 1614 | 1615 | } else { |
| @@ -1675,12 +1676,12 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb, · 60 unmodified lines | ||
| 1675 | 1676 | ethhdr = (struct ethhdr *)skb_mac_header(skb); |
| 1676 | 1677 | |
| 1677 | 1678 | /* Verify frame is destined for us */ |
| 1678 | − if (!batadv_is_my_mac(ethhdr->h_dest) && | |
| 1679 | − !batadv_is_my_mac(coded_packet->second_dest)) | |
| 1679 | + if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest) && | |
| 1680 | + !batadv_is_my_mac(bat_priv, coded_packet->second_dest)) | |
| 1680 | 1681 | return NET_RX_DROP; |
| 1681 | 1682 | |
| 1682 | 1683 | /* Update stat counter */ |
| 1683 | − if (batadv_is_my_mac(coded_packet->second_dest)) | |
| 1684 | + if (batadv_is_my_mac(bat_priv, coded_packet->second_dest)) | |
| 1684 | 1685 | batadv_inc_counter(bat_priv, BATADV_CNT_NC_SNIFFED); |
| 1685 | 1686 | |
| 1686 | 1687 | nc_packet = batadv_nc_find_decoding_packet(bat_priv, ethhdr, |
| @@ -1698,7 +1699,7 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb, · 11 unmodified lines | ||
| 1698 | 1699 | goto free_nc_packet; |
| 1699 | 1700 | |
| 1700 | 1701 | /* Decode the packet */ |
| 1701 | − unicast_packet = batadv_nc_skb_decode_packet(skb, nc_packet); | |
| 1702 | + unicast_packet = batadv_nc_skb_decode_packet(bat_priv, skb, nc_packet); | |
| 1702 | 1703 | if (!unicast_packet) { |
| 1703 | 1704 | batadv_inc_counter(bat_priv, BATADV_CNT_NC_DECODE_FAILED); |
| 1704 | 1705 | goto free_nc_packet; |
| @@ -403,7 +403,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, · 402 unmodified lines | ||
| 403 | 403 | goto out; |
| 404 | 404 | |
| 405 | 405 | /* not for me */ |
| 406 | − if (!batadv_is_my_mac(ethhdr->h_dest)) | |
| 406 | + if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest)) | |
| 407 | 407 | goto out; |
| 408 | 408 | |
| 409 | 409 | icmp_packet = (struct batadv_icmp_packet_rr *)skb->data; |
| @@ -417,7 +417,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, · 7 unmodified lines | ||
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | /* packet for me */ |
| 420 | − if (batadv_is_my_mac(icmp_packet->dst)) | |
| 420 | + if (batadv_is_my_mac(bat_priv, icmp_packet->dst)) | |
| 421 | 421 | return batadv_recv_my_icmp_packet(bat_priv, skb, hdr_size); |
| 422 | 422 | |
| 423 | 423 | /* TTL exceeded */ |
| @@ -551,6 +551,7 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig, · 127 unmodified lines | ||
| 551 | 551 | |
| 552 | 552 | /** |
| 553 | 553 | * batadv_check_unicast_packet - Check for malformed unicast packets |
| 554 | + * @bat_priv: the bat priv with all the soft interface information | |
| 554 | 555 | * @skb: packet to check |
| 555 | 556 | * @hdr_size: size of header to pull |
| 556 | 557 | * |
| @@ -559,7 +560,8 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig, · 2 unmodified lines | ||
| 559 | 560 | * reason: -ENODATA for bad header, -EBADR for broadcast destination or source, |
| 560 | 561 | * and -EREMOTE for non-local (other host) destination. |
| 561 | 562 | */ |
| 562 | −static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size) | |
| 563 | +static int batadv_check_unicast_packet(struct batadv_priv *bat_priv, | |
| 564 | + struct sk_buff *skb, int hdr_size) | |
| 563 | 565 | { |
| 564 | 566 | struct ethhdr *ethhdr; |
| 565 | 567 | |
| @@ -578,7 +580,7 @@ static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size) · 12 unmodified lines | ||
| 578 | 580 | return -EBADR; |
| 579 | 581 | |
| 580 | 582 | /* not for me */ |
| 581 | − if (!batadv_is_my_mac(ethhdr->h_dest)) | |
| 583 | + if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest)) | |
| 582 | 584 | return -EREMOTE; |
| 583 | 585 | |
| 584 | 586 | return 0; |
| @@ -593,7 +595,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if) · 8 unmodified lines | ||
| 593 | 595 | char tt_flag; |
| 594 | 596 | size_t packet_size; |
| 595 | 597 | |
| 596 | − if (batadv_check_unicast_packet(skb, hdr_size) < 0) | |
| 598 | + if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0) | |
| 597 | 599 | return NET_RX_DROP; |
| 598 | 600 | |
| 599 | 601 | /* I could need to modify it */ |
| @@ -625,7 +627,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if) · 25 unmodified lines | ||
| 625 | 627 | case BATADV_TT_RESPONSE: |
| 626 | 628 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); |
| 627 | 629 | |
| 628 | − if (batadv_is_my_mac(tt_query->dst)) { | |
| 630 | + if (batadv_is_my_mac(bat_priv, tt_query->dst)) { | |
| 629 | 631 | /* packet needs to be linearized to access the TT |
| 630 | 632 | * changes |
| 631 | 633 | */ |
| @@ -668,14 +670,15 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if) · 36 unmodified lines | ||
| 668 | 670 | struct batadv_roam_adv_packet *roam_adv_packet; |
| 669 | 671 | struct batadv_orig_node *orig_node; |
| 670 | 672 | |
| 671 | − if (batadv_check_unicast_packet(skb, sizeof(*roam_adv_packet)) < 0) | |
| 673 | + if (batadv_check_unicast_packet(bat_priv, skb, | |
| 674 | + sizeof(*roam_adv_packet)) < 0) | |
| 672 | 675 | goto out; |
| 673 | 676 | |
| 674 | 677 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); |
| 675 | 678 | |
| 676 | 679 | roam_adv_packet = (struct batadv_roam_adv_packet *)skb->data; |
| 677 | 680 | |
| 678 | − if (!batadv_is_my_mac(roam_adv_packet->dst)) | |
| 681 | + if (!batadv_is_my_mac(bat_priv, roam_adv_packet->dst)) | |
| 679 | 682 | return batadv_route_unicast_packet(skb, recv_if); |
| 680 | 683 | |
| 681 | 684 | /* check if it is a backbone gateway. we don't accept |
| @@ -981,7 +984,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, · 299 unmodified lines | ||
| 981 | 984 | * last time) the packet had an updated information or not |
| 982 | 985 | */ |
| 983 | 986 | curr_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn); |
| 984 | − if (!batadv_is_my_mac(unicast_packet->dest)) { | |
| 987 | + if (!batadv_is_my_mac(bat_priv, unicast_packet->dest)) { | |
| 985 | 988 | orig_node = batadv_orig_hash_find(bat_priv, |
| 986 | 989 | unicast_packet->dest); |
| 987 | 990 | /* if it is not possible to find the orig_node representing the |
| @@ -1059,7 +1062,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, · 71 unmodified lines | ||
| 1059 | 1062 | hdr_size = sizeof(*unicast_4addr_packet); |
| 1060 | 1063 | |
| 1061 | 1064 | /* function returns -EREMOTE for promiscuous packets */ |
| 1062 | − check = batadv_check_unicast_packet(skb, hdr_size); | |
| 1065 | + check = batadv_check_unicast_packet(bat_priv, skb, hdr_size); | |
| 1063 | 1066 | |
| 1064 | 1067 | /* Even though the packet is not for us, we might save it to use for |
| 1065 | 1068 | * decoding a later received coded packet |
| @@ -1074,7 +1077,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, · 8 unmodified lines | ||
| 1074 | 1077 | return NET_RX_DROP; |
| 1075 | 1078 | |
| 1076 | 1079 | /* packet for me */ |
| 1077 | − if (batadv_is_my_mac(unicast_packet->dest)) { | |
| 1080 | + if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { | |
| 1078 | 1081 | if (is4addr) { |
| 1079 | 1082 | batadv_dat_inc_counter(bat_priv, |
| 1080 | 1083 | unicast_4addr_packet->subtype); |
| @@ -1111,7 +1114,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb, · 30 unmodified lines | ||
| 1111 | 1114 | struct sk_buff *new_skb = NULL; |
| 1112 | 1115 | int ret; |
| 1113 | 1116 | |
| 1114 | − if (batadv_check_unicast_packet(skb, hdr_size) < 0) | |
| 1117 | + if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0) | |
| 1115 | 1118 | return NET_RX_DROP; |
| 1116 | 1119 | |
| 1117 | 1120 | if (!batadv_check_unicast_ttvn(bat_priv, skb)) |
| @@ -1120,7 +1123,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb, · 2 unmodified lines | ||
| 1120 | 1123 | unicast_packet = (struct batadv_unicast_frag_packet *)skb->data; |
| 1121 | 1124 | |
| 1122 | 1125 | /* packet for me */ |
| 1123 | − if (batadv_is_my_mac(unicast_packet->dest)) { | |
| 1126 | + if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { | |
| 1124 | 1127 | ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb); |
| 1125 | 1128 | |
| 1126 | 1129 | if (ret == NET_RX_DROP) |
| @@ -1174,13 +1177,13 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, · 47 unmodified lines | ||
| 1174 | 1177 | goto out; |
| 1175 | 1178 | |
| 1176 | 1179 | /* ignore broadcasts sent by myself */ |
| 1177 | − if (batadv_is_my_mac(ethhdr->h_source)) | |
| 1180 | + if (batadv_is_my_mac(bat_priv, ethhdr->h_source)) | |
| 1178 | 1181 | goto out; |
| 1179 | 1182 | |
| 1180 | 1183 | bcast_packet = (struct batadv_bcast_packet *)skb->data; |
| 1181 | 1184 | |
| 1182 | 1185 | /* ignore broadcasts originated by myself */ |
| 1183 | − if (batadv_is_my_mac(bcast_packet->orig)) | |
| 1186 | + if (batadv_is_my_mac(bat_priv, bcast_packet->orig)) | |
| 1184 | 1187 | goto out; |
| 1185 | 1188 | |
| 1186 | 1189 | if (bcast_packet->header.ttl < 2) |
| @@ -1266,14 +1269,14 @@ int batadv_recv_vis_packet(struct sk_buff *skb, · 79 unmodified lines | ||
| 1266 | 1269 | ethhdr = (struct ethhdr *)skb_mac_header(skb); |
| 1267 | 1270 | |
| 1268 | 1271 | /* not for me */ |
| 1269 | − if (!batadv_is_my_mac(ethhdr->h_dest)) | |
| 1272 | + if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest)) | |
| 1270 | 1273 | return NET_RX_DROP; |
| 1271 | 1274 | |
| 1272 | 1275 | /* ignore own packets */ |
| 1273 | − if (batadv_is_my_mac(vis_packet->vis_orig)) | |
| 1276 | + if (batadv_is_my_mac(bat_priv, vis_packet->vis_orig)) | |
| 1274 | 1277 | return NET_RX_DROP; |
| 1275 | 1278 | |
| 1276 | − if (batadv_is_my_mac(vis_packet->sender_orig)) | |
| 1279 | + if (batadv_is_my_mac(bat_priv, vis_packet->sender_orig)) | |
| 1277 | 1280 | return NET_RX_DROP; |
| 1278 | 1281 | |
| 1279 | 1282 | switch (vis_packet->vis_type) { |
| @@ -1940,7 +1940,7 @@ out: · 1939 unmodified lines | ||
| 1940 | 1940 | bool batadv_send_tt_response(struct batadv_priv *bat_priv, |
| 1941 | 1941 | struct batadv_tt_query_packet *tt_request) |
| 1942 | 1942 | { |
| 1943 | − if (batadv_is_my_mac(tt_request->dst)) { | |
| 1943 | + if (batadv_is_my_mac(bat_priv, tt_request->dst)) { | |
| 1944 | 1944 | /* don't answer backbone gws! */ |
| 1945 | 1945 | if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_request->src)) |
| 1946 | 1946 | return true; |
| @@ -477,7 +477,7 @@ void batadv_receive_client_update_packet(struct batadv_priv *bat_priv, · 476 unmodified lines | ||
| 477 | 477 | |
| 478 | 478 | /* Are we the target for this VIS packet? */ |
| 479 | 479 | if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC && |
| 480 | − batadv_is_my_mac(vis_packet->target_orig)) | |
| 480 | + batadv_is_my_mac(bat_priv, vis_packet->target_orig)) | |
| 481 | 481 | are_target = 1; |
| 482 | 482 | |
| 483 | 483 | spin_lock_bh(&bat_priv->vis.hash_lock); |
| @@ -496,7 +496,7 @@ void batadv_receive_client_update_packet(struct batadv_priv *bat_priv, · 12 unmodified lines | ||
| 496 | 496 | batadv_send_list_add(bat_priv, info); |
| 497 | 497 | |
| 498 | 498 | /* ... we're not the recipient (and thus need to forward). */ |
| 499 | − } else if (!batadv_is_my_mac(packet->target_orig)) { | |
| 499 | + } else if (!batadv_is_my_mac(bat_priv, packet->target_orig)) { | |
| 500 | 500 | batadv_send_list_add(bat_priv, info); |
| 501 | 501 | } |
| 502 | 502 | |
| @@ -67,7 +67,8 @@ void br_port_carrier_check(struct net_bridge_port *p) · 66 unmodified lines | ||
| 67 | 67 | struct net_device *dev = p->dev; |
| 68 | 68 | struct net_bridge *br = p->br; |
| 69 | 69 | |
| 70 | − if (netif_running(dev) && netif_oper_up(dev)) | |
| 70 | + if (!(p->flags & BR_ADMIN_COST) && | |
| 71 | + netif_running(dev) && netif_oper_up(dev)) | |
| 71 | 72 | p->path_cost = port_cost(dev); |
| 72 | 73 | |
| 73 | 74 | if (!netif_running(br->dev)) |
| @@ -156,6 +156,7 @@ struct net_bridge_port · 155 unmodified lines | ||
| 156 | 156 | #define BR_BPDU_GUARD 0x00000002 |
| 157 | 157 | #define BR_ROOT_BLOCK 0x00000004 |
| 158 | 158 | #define BR_MULTICAST_FAST_LEAVE 0x00000008 |
| 159 | +#define BR_ADMIN_COST 0x00000010 | |
| 159 | 160 | |
| 160 | 161 | #ifdef CONFIG_BRIDGE_IGMP_SNOOPING |
| 161 | 162 | u32 multicast_startup_queries_sent; |
| @@ -288,6 +288,7 @@ int br_stp_set_path_cost(struct net_bridge_port *p, unsigned long path_cost) · 287 unmodified lines | ||
| 288 | 288 | path_cost > BR_MAX_PATH_COST) |
| 289 | 289 | return -ERANGE; |
| 290 | 290 | |
| 291 | + p->flags |= BR_ADMIN_COST; | |
| 291 | 292 | p->path_cost = path_cost; |
| 292 | 293 | br_configuration_update(p->br); |
| 293 | 294 | br_port_state_selection(p->br); |
| @@ -466,7 +466,7 @@ static int cgw_notifier(struct notifier_block *nb, · 465 unmodified lines | ||
| 466 | 466 | if (gwj->src.dev == dev || gwj->dst.dev == dev) { |
| 467 | 467 | hlist_del(&gwj->list); |
| 468 | 468 | cgw_unregister_filter(gwj); |
| 469 | − kfree(gwj); | |
| 469 | + kmem_cache_free(cgw_cache, gwj); | |
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | } |
| @@ -863,7 +863,7 @@ static void cgw_remove_all_jobs(void) · 390 unmodified lines | ||
| 863 | 863 | hlist_for_each_entry_safe(gwj, nx, &cgw_list, list) { |
| 864 | 864 | hlist_del(&gwj->list); |
| 865 | 865 | cgw_unregister_filter(gwj); |
| 866 | − kfree(gwj); | |
| 866 | + kmem_cache_free(cgw_cache, gwj); | |
| 867 | 867 | } |
| 868 | 868 | } |
| 869 | 869 | |
| @@ -919,7 +919,7 @@ static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh) · 49 unmodified lines | ||
| 919 | 919 | |
| 920 | 920 | hlist_del(&gwj->list); |
| 921 | 921 | cgw_unregister_filter(gwj); |
| 922 | − kfree(gwj); | |
| 922 | + kmem_cache_free(cgw_cache, gwj); | |
| 923 | 923 | err = 0; |
| 924 | 924 | break; |
| 925 | 925 | } |
| @@ -2146,6 +2146,9 @@ static void skb_warn_bad_offload(const struct sk_buff *skb) · 2145 unmodified lines | ||
| 2146 | 2146 | struct net_device *dev = skb->dev; |
| 2147 | 2147 | const char *driver = ""; |
| 2148 | 2148 | |
| 2149 | + if (!net_ratelimit()) | |
| 2150 | + return; | |
| 2151 | + | |
| 2149 | 2152 | if (dev && dev->dev.parent) |
| 2150 | 2153 | driver = dev_driver_string(dev->dev.parent); |
| 2151 | 2154 | |
| @@ -1046,7 +1046,7 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) · 1045 unmodified lines | ||
| 1046 | 1046 | rcu_read_lock(); |
| 1047 | 1047 | cb->seq = net->dev_base_seq; |
| 1048 | 1048 | |
| 1049 | − if (nlmsg_parse(cb->nlh, sizeof(struct rtgenmsg), tb, IFLA_MAX, | |
| 1049 | + if (nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb, IFLA_MAX, | |
| 1050 | 1050 | ifla_policy) >= 0) { |
| 1051 | 1051 | |
| 1052 | 1052 | if (tb[IFLA_EXT_MASK]) |
| @@ -1896,7 +1896,7 @@ static u16 rtnl_calcit(struct sk_buff *skb, struct nlmsghdr *nlh) · 843 unmodified lines | ||
| 1896 | 1896 | u32 ext_filter_mask = 0; |
| 1897 | 1897 | u16 min_ifinfo_dump_size = 0; |
| 1898 | 1898 | |
| 1899 | − if (nlmsg_parse(nlh, sizeof(struct rtgenmsg), tb, IFLA_MAX, | |
| 1899 | + if (nlmsg_parse(nlh, sizeof(struct ifinfomsg), tb, IFLA_MAX, | |
| 1900 | 1900 | ifla_policy) >= 0) { |
| 1901 | 1901 | if (tb[IFLA_EXT_MASK]) |
| 1902 | 1902 | ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]); |
| @@ -587,13 +587,16 @@ static void check_lifetime(struct work_struct *work) · 586 unmodified lines | ||
| 587 | 587 | { |
| 588 | 588 | unsigned long now, next, next_sec, next_sched; |
| 589 | 589 | struct in_ifaddr *ifa; |
| 590 | + struct hlist_node *n; | |
| 590 | 591 | int i; |
| 591 | 592 | |
| 592 | 593 | now = jiffies; |
| 593 | 594 | next = round_jiffies_up(now + ADDR_CHECK_FREQUENCY); |
| 594 | 595 | |
| 595 | − rcu_read_lock(); | |
| 596 | 596 | for (i = 0; i < IN4_ADDR_HSIZE; i++) { |
| 597 | + bool change_needed = false; | |
| 598 | + | |
| 599 | + rcu_read_lock(); | |
| 597 | 600 | hlist_for_each_entry_rcu(ifa, &inet_addr_lst[i], hash) { |
| 598 | 601 | unsigned long age; |
| 599 | 602 | |
| @@ -606,16 +609,7 @@ static void check_lifetime(struct work_struct *work) · 6 unmodified lines | ||
| 606 | 609 | |
| 607 | 610 | if (ifa->ifa_valid_lft != INFINITY_LIFE_TIME && |
| 608 | 611 | age >= ifa->ifa_valid_lft) { |
| 609 | − struct in_ifaddr **ifap ; | |
| 610 | − | |
| 611 | − rtnl_lock(); | |
| 612 | − for (ifap = &ifa->ifa_dev->ifa_list; | |
| 613 | − *ifap != NULL; ifap = &ifa->ifa_next) { | |
| 614 | − if (*ifap == ifa) | |
| 615 | − inet_del_ifa(ifa->ifa_dev, | |
| 616 | − ifap, 1); | |
| 617 | − } | |
| 618 | − rtnl_unlock(); | |
| 612 | + change_needed = true; | |
| 619 | 613 | } else if (ifa->ifa_preferred_lft == |
| 620 | 614 | INFINITY_LIFE_TIME) { |
| 621 | 615 | continue; |
| @@ -625,10 +619,8 @@ static void check_lifetime(struct work_struct *work) · 3 unmodified lines | ||
| 625 | 619 | next = ifa->ifa_tstamp + |
| 626 | 620 | ifa->ifa_valid_lft * HZ; |
| 627 | 621 | |
| 628 | − if (!(ifa->ifa_flags & IFA_F_DEPRECATED)) { | |
| 629 | − ifa->ifa_flags |= IFA_F_DEPRECATED; | |
| 630 | − rtmsg_ifa(RTM_NEWADDR, ifa, NULL, 0); | |
| 631 | − } | |
| 622 | + if (!(ifa->ifa_flags & IFA_F_DEPRECATED)) | |
| 623 | + change_needed = true; | |
| 632 | 624 | } else if (time_before(ifa->ifa_tstamp + |
| 633 | 625 | ifa->ifa_preferred_lft * HZ, |
| 634 | 626 | next)) { |
| @@ -636,8 +628,42 @@ static void check_lifetime(struct work_struct *work) · 1 unmodified line | ||
| 636 | 628 | ifa->ifa_preferred_lft * HZ; |
| 637 | 629 | } |
| 638 | 630 | } |
| 631 | + rcu_read_unlock(); | |
| 632 | + if (!change_needed) | |
| 633 | + continue; | |
| 634 | + rtnl_lock(); | |
| 635 | + hlist_for_each_entry_safe(ifa, n, &inet_addr_lst[i], hash) { | |
| 636 | + unsigned long age; | |
| 637 | + | |
| 638 | + if (ifa->ifa_flags & IFA_F_PERMANENT) | |
| 639 | + continue; | |
| 640 | + | |
| 641 | + /* We try to batch several events at once. */ | |
| 642 | + age = (now - ifa->ifa_tstamp + | |
| 643 | + ADDRCONF_TIMER_FUZZ_MINUS) / HZ; | |
| 644 | + | |
| 645 | + if (ifa->ifa_valid_lft != INFINITY_LIFE_TIME && | |
| 646 | + age >= ifa->ifa_valid_lft) { | |
| 647 | + struct in_ifaddr **ifap; | |
| 648 | + | |
| 649 | + for (ifap = &ifa->ifa_dev->ifa_list; | |
| 650 | + *ifap != NULL; ifap = &(*ifap)->ifa_next) { | |
| 651 | + if (*ifap == ifa) { | |
| 652 | + inet_del_ifa(ifa->ifa_dev, | |
| 653 | + ifap, 1); | |
| 654 | + break; | |
| 655 | + } | |
| 656 | + } | |
| 657 | + } else if (ifa->ifa_preferred_lft != | |
| 658 | + INFINITY_LIFE_TIME && | |
| 659 | + age >= ifa->ifa_preferred_lft && | |
| 660 | + !(ifa->ifa_flags & IFA_F_DEPRECATED)) { | |
| 661 | + ifa->ifa_flags |= IFA_F_DEPRECATED; | |
| 662 | + rtmsg_ifa(RTM_NEWADDR, ifa, NULL, 0); | |
| 663 | + } | |
| 664 | + } | |
| 665 | + rtnl_unlock(); | |
| 639 | 666 | } |
| 640 | − rcu_read_unlock(); | |
| 641 | 667 | |
| 642 | 668 | next_sec = round_jiffies_up(next); |
| 643 | 669 | next_sched = next; |
| @@ -804,6 +830,8 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh) · 160 unmodified lines | ||
| 804 | 830 | return -EEXIST; |
| 805 | 831 | ifa = ifa_existing; |
| 806 | 832 | set_ifa_lifetime(ifa, valid_lft, prefered_lft); |
| 833 | + cancel_delayed_work(&check_lifetime_work); | |
| 834 | + schedule_delayed_work(&check_lifetime_work, 0); | |
| 807 | 835 | rtmsg_ifa(RTM_NEWADDR, ifa, nlh, NETLINK_CB(skb).portid); |
| 808 | 836 | blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa); |
| 809 | 837 | } |
| @@ -139,8 +139,6 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) · 138 unmodified lines | ||
| 139 | 139 | |
| 140 | 140 | /* skb is pure payload to encrypt */ |
| 141 | 141 | |
| 142 | − err = -ENOMEM; | |
| 143 | − | |
| 144 | 142 | esp = x->data; |
| 145 | 143 | aead = esp->aead; |
| 146 | 144 | alen = crypto_aead_authsize(aead); |
| @@ -176,8 +174,10 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) · 29 unmodified lines | ||
| 176 | 174 | } |
| 177 | 175 | |
| 178 | 176 | tmp = esp_alloc_tmp(aead, nfrags + sglists, seqhilen); |
| 179 | − if (!tmp) | |
| 177 | + if (!tmp) { | |
| 178 | + err = -ENOMEM; | |
| 180 | 179 | goto error; |
| 180 | + } | |
| 181 | 181 | |
| 182 | 182 | seqhi = esp_tmp_seqhi(tmp); |
| 183 | 183 | iv = esp_tmp_iv(aead, tmp, seqhilen); |
| @@ -219,8 +219,7 @@ static void ip_expire(unsigned long arg) · 218 unmodified lines | ||
| 219 | 219 | if (!head->dev) |
| 220 | 220 | goto out_rcu_unlock; |
| 221 | 221 | |
| 222 | − /* skb dst is stale, drop it, and perform route lookup again */ | |
| 223 | − skb_dst_drop(head); | |
| 222 | + /* skb has no dst, perform route lookup again */ | |
| 224 | 223 | iph = ip_hdr(head); |
| 225 | 224 | err = ip_route_input_noref(head, iph->daddr, iph->saddr, |
| 226 | 225 | iph->tos, head->dev); |
| @@ -494,9 +493,16 @@ found: · 267 unmodified lines | ||
| 494 | 493 | qp->q.max_size = skb->len + ihl; |
| 495 | 494 | |
| 496 | 495 | if (qp->q.last_in == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) && |
| 497 | − qp->q.meat == qp->q.len) | |
| 498 | − return ip_frag_reasm(qp, prev, dev); | |
| 496 | + qp->q.meat == qp->q.len) { | |
| 497 | + unsigned long orefdst = skb->_skb_refdst; | |
| 499 | 498 | |
| 499 | + skb->_skb_refdst = 0UL; | |
| 500 | + err = ip_frag_reasm(qp, prev, dev); | |
| 501 | + skb->_skb_refdst = orefdst; | |
| 502 | + return err; | |
| 503 | + } | |
| 504 | + | |
| 505 | + skb_dst_drop(skb); | |
| 500 | 506 | inet_frag_lru_move(&qp->q); |
| 501 | 507 | return -EINPROGRESS; |
| 502 | 508 | |
| @@ -66,6 +66,12 @@ static bool rpfilter_lookup_reverse(struct flowi4 *fl4, · 65 unmodified lines | ||
| 66 | 66 | return dev_match; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | +static bool rpfilter_is_local(const struct sk_buff *skb) | |
| 70 | +{ | |
| 71 | + const struct rtable *rt = skb_rtable(skb); | |
| 72 | + return rt && (rt->rt_flags & RTCF_LOCAL); | |
| 73 | +} | |
| 74 | + | |
| 69 | 75 | static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par) |
| 70 | 76 | { |
| 71 | 77 | const struct xt_rpfilter_info *info; |
| @@ -76,7 +82,7 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par) · 4 unmodified lines | ||
| 76 | 82 | info = par->matchinfo; |
| 77 | 83 | invert = info->flags & XT_RPFILTER_INVERT; |
| 78 | 84 | |
| 79 | − if (par->in->flags & IFF_LOOPBACK) | |
| 85 | + if (rpfilter_is_local(skb)) | |
| 80 | 86 | return true ^ invert; |
| 81 | 87 | |
| 82 | 88 | iph = ip_hdr(skb); |
| @@ -348,8 +348,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, · 347 unmodified lines | ||
| 348 | 348 | * hasn't changed since we received the original syn, but I see |
| 349 | 349 | * no easy way to do this. |
| 350 | 350 | */ |
| 351 | − flowi4_init_output(&fl4, 0, sk->sk_mark, RT_CONN_FLAGS(sk), | |
| 352 | − RT_SCOPE_UNIVERSE, IPPROTO_TCP, | |
| 351 | + flowi4_init_output(&fl4, sk->sk_bound_dev_if, sk->sk_mark, | |
| 352 | + RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, IPPROTO_TCP, | |
| 353 | 353 | inet_sk_flowi_flags(sk), |
| 354 | 354 | (opt && opt->srr) ? opt->faddr : ireq->rmt_addr, |
| 355 | 355 | ireq->loc_addr, th->source, th->dest); |
| @@ -111,6 +111,7 @@ int sysctl_tcp_early_retrans __read_mostly = 3; · 110 unmodified lines | ||
| 111 | 111 | #define FLAG_SND_UNA_ADVANCED 0x400 /* Snd_una was changed (!= FLAG_DATA_ACKED) */ |
| 112 | 112 | #define FLAG_DSACKING_ACK 0x800 /* SACK blocks contained D-SACK info */ |
| 113 | 113 | #define FLAG_SACK_RENEGING 0x2000 /* snd_una advanced to a sacked seq */ |
| 114 | +#define FLAG_UPDATE_TS_RECENT 0x4000 /* tcp_replace_ts_recent() */ | |
| 114 | 115 | |
| 115 | 116 | #define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) |
| 116 | 117 | #define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED) |
| @@ -3265,6 +3266,27 @@ static void tcp_send_challenge_ack(struct sock *sk) · 3148 unmodified lines | ||
| 3265 | 3266 | } |
| 3266 | 3267 | } |
| 3267 | 3268 | |
| 3269 | +static void tcp_store_ts_recent(struct tcp_sock *tp) | |
| 3270 | +{ | |
| 3271 | + tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval; | |
| 3272 | + tp->rx_opt.ts_recent_stamp = get_seconds(); | |
| 3273 | +} | |
| 3274 | + | |
| 3275 | +static void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq) | |
| 3276 | +{ | |
| 3277 | + if (tp->rx_opt.saw_tstamp && !after(seq, tp->rcv_wup)) { | |
| 3278 | + /* PAWS bug workaround wrt. ACK frames, the PAWS discard | |
| 3279 | + * extra check below makes sure this can only happen | |
| 3280 | + * for pure ACK frames. -DaveM | |
| 3281 | + * | |
| 3282 | + * Not only, also it occurs for expired timestamps. | |
| 3283 | + */ | |
| 3284 | + | |
| 3285 | + if (tcp_paws_check(&tp->rx_opt, 0)) | |
| 3286 | + tcp_store_ts_recent(tp); | |
| 3287 | + } | |
| 3288 | +} | |
| 3289 | + | |
| 3268 | 3290 | /* This routine deals with acks during a TLP episode. |
| 3269 | 3291 | * Ref: loss detection algorithm in draft-dukkipati-tcpm-tcp-loss-probe. |
| 3270 | 3292 | */ |
| @@ -3340,6 +3362,12 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) · 69 unmodified lines | ||
| 3340 | 3362 | prior_fackets = tp->fackets_out; |
| 3341 | 3363 | prior_in_flight = tcp_packets_in_flight(tp); |
| 3342 | 3364 | |
| 3365 | + /* ts_recent update must be made after we are sure that the packet | |
| 3366 | + * is in window. | |
| 3367 | + */ | |
| 3368 | + if (flag & FLAG_UPDATE_TS_RECENT) | |
| 3369 | + tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); | |
| 3370 | + | |
| 3343 | 3371 | if (!(flag & FLAG_SLOWPATH) && after(ack, prior_snd_una)) { |
| 3344 | 3372 | /* Window is constant, pure forward advance. |
| 3345 | 3373 | * No more checks are required. |
| @@ -3636,27 +3664,6 @@ const u8 *tcp_parse_md5sig_option(const struct tcphdr *th) · 290 unmodified lines | ||
| 3636 | 3664 | EXPORT_SYMBOL(tcp_parse_md5sig_option); |
| 3637 | 3665 | #endif |
| 3638 | 3666 | |
| 3639 | −static inline void tcp_store_ts_recent(struct tcp_sock *tp) | |
| 3640 | −{ | |
| 3641 | − tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval; | |
| 3642 | − tp->rx_opt.ts_recent_stamp = get_seconds(); | |
| 3643 | −} | |
| 3644 | − | |
| 3645 | −static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq) | |
| 3646 | −{ | |
| 3647 | − if (tp->rx_opt.saw_tstamp && !after(seq, tp->rcv_wup)) { | |
| 3648 | − /* PAWS bug workaround wrt. ACK frames, the PAWS discard | |
| 3649 | − * extra check below makes sure this can only happen | |
| 3650 | − * for pure ACK frames. -DaveM | |
| 3651 | − * | |
| 3652 | − * Not only, also it occurs for expired timestamps. | |
| 3653 | − */ | |
| 3654 | − | |
| 3655 | − if (tcp_paws_check(&tp->rx_opt, 0)) | |
| 3656 | − tcp_store_ts_recent(tp); | |
| 3657 | − } | |
| 3658 | −} | |
| 3659 | − | |
| 3660 | 3667 | /* Sorry, PAWS as specified is broken wrt. pure-ACKs -DaveM |
| 3661 | 3668 | * |
| 3662 | 3669 | * It is not fatal. If this ACK does _not_ change critical state (seqs, window) |
| @@ -5250,14 +5257,9 @@ slow_path: · 1587 unmodified lines | ||
| 5250 | 5257 | return 0; |
| 5251 | 5258 | |
| 5252 | 5259 | step5: |
| 5253 | − if (tcp_ack(sk, skb, FLAG_SLOWPATH) < 0) | |
| 5260 | + if (tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT) < 0) | |
| 5254 | 5261 | goto discard; |
| 5255 | 5262 | |
| 5256 | − /* ts_recent update must be made after we are sure that the packet | |
| 5257 | − * is in window. | |
| 5258 | − */ | |
| 5259 | − tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); | |
| 5260 | − | |
| 5261 | 5263 | tcp_rcv_rtt_measure_ts(sk, skb); |
| 5262 | 5264 | |
| 5263 | 5265 | /* Process urgent data. */ |
| @@ -5666,7 +5668,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, · 402 unmodified lines | ||
| 5666 | 5668 | |
| 5667 | 5669 | /* step 5: check the ACK field */ |
| 5668 | 5670 | if (true) { |
| 5669 | − int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH) > 0; | |
| 5671 | + int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH | | |
| 5672 | + FLAG_UPDATE_TS_RECENT) > 0; | |
| 5670 | 5673 | |
| 5671 | 5674 | switch (sk->sk_state) { |
| 5672 | 5675 | case TCP_SYN_RECV: |
| @@ -5817,11 +5820,6 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, · 144 unmodified lines | ||
| 5817 | 5820 | } |
| 5818 | 5821 | } |
| 5819 | 5822 | |
| 5820 | − /* ts_recent update must be made after we are sure that the packet | |
| 5821 | − * is in window. | |
| 5822 | − */ | |
| 5823 | − tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); | |
| 5824 | − | |
| 5825 | 5823 | /* step 6: check the URG bit */ |
| 5826 | 5824 | tcp_urg(sk, skb, th); |
| 5827 | 5825 | |
| @@ -2353,8 +2353,12 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) · 2352 unmodified lines | ||
| 2353 | 2353 | */ |
| 2354 | 2354 | TCP_SKB_CB(skb)->when = tcp_time_stamp; |
| 2355 | 2355 | |
| 2356 | − /* make sure skb->data is aligned on arches that require it */ | |
| 2357 | − if (unlikely(NET_IP_ALIGN && ((unsigned long)skb->data & 3))) { | |
| 2356 | + /* make sure skb->data is aligned on arches that require it | |
| 2357 | + * and check if ack-trimming & collapsing extended the headroom | |
| 2358 | + * beyond what csum_start can cover. | |
| 2359 | + */ | |
| 2360 | + if (unlikely((NET_IP_ALIGN && ((unsigned long)skb->data & 3)) || | |
| 2361 | + skb_headroom(skb) >= 0xFFFF)) { | |
| 2358 | 2362 | struct sk_buff *nskb = __pskb_copy(skb, MAX_TCP_HEADER, |
| 2359 | 2363 | GFP_ATOMIC); |
| 2360 | 2364 | return nskb ? tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC) : |
| @@ -2666,6 +2670,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, · 305 unmodified lines | ||
| 2666 | 2670 | skb_reserve(skb, MAX_TCP_HEADER); |
| 2667 | 2671 | |
| 2668 | 2672 | skb_dst_set(skb, dst); |
| 2673 | + security_skb_owned_by(skb, sk); | |
| 2669 | 2674 | |
| 2670 | 2675 | mss = dst_metric_advmss(dst); |
| 2671 | 2676 | if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < mss) |
| @@ -169,8 +169,6 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev, · 168 unmodified lines | ||
| 169 | 169 | static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr, |
| 170 | 170 | struct net_device *dev); |
| 171 | 171 | |
| 172 | −static ATOMIC_NOTIFIER_HEAD(inet6addr_chain); | |
| 173 | − | |
| 174 | 172 | static struct ipv6_devconf ipv6_devconf __read_mostly = { |
| 175 | 173 | .forwarding = 0, |
| 176 | 174 | .hop_limit = IPV6_DEFAULT_HOPLIMIT, |
| @@ -910,7 +908,7 @@ out2: · 733 unmodified lines | ||
| 910 | 908 | rcu_read_unlock_bh(); |
| 911 | 909 | |
| 912 | 910 | if (likely(err == 0)) |
| 913 | − atomic_notifier_call_chain(&inet6addr_chain, NETDEV_UP, ifa); | |
| 911 | + inet6addr_notifier_call_chain(NETDEV_UP, ifa); | |
| 914 | 912 | else { |
| 915 | 913 | kfree(ifa); |
| 916 | 914 | ifa = ERR_PTR(err); |
| @@ -1000,7 +998,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) · 83 unmodified lines | ||
| 1000 | 998 | |
| 1001 | 999 | ipv6_ifa_notify(RTM_DELADDR, ifp); |
| 1002 | 1000 | |
| 1003 | − atomic_notifier_call_chain(&inet6addr_chain, NETDEV_DOWN, ifp); | |
| 1001 | + inet6addr_notifier_call_chain(NETDEV_DOWN, ifp); | |
| 1004 | 1002 | |
| 1005 | 1003 | /* |
| 1006 | 1004 | * Purge or update corresponding prefix |
| @@ -3087,7 +3085,7 @@ static int addrconf_ifdown(struct net_device *dev, int how) · 2080 unmodified lines | ||
| 3087 | 3085 | |
| 3088 | 3086 | if (state != INET6_IFADDR_STATE_DEAD) { |
| 3089 | 3087 | __ipv6_ifa_notify(RTM_DELADDR, ifa); |
| 3090 | − atomic_notifier_call_chain(&inet6addr_chain, NETDEV_DOWN, ifa); | |
| 3088 | + inet6addr_notifier_call_chain(NETDEV_DOWN, ifa); | |
| 3091 | 3089 | } |
| 3092 | 3090 | in6_ifa_put(ifa); |
| 3093 | 3091 | |
| @@ -5054,22 +5052,6 @@ static struct pernet_operations addrconf_ops = { · 1960 unmodified lines | ||
| 5054 | 5052 | .exit = addrconf_exit_net, |
| 5055 | 5053 | }; |
| 5056 | 5054 | |
| 5057 | −/* | |
| 5058 | − * Device notifier | |
| 5059 | − */ | |
| 5060 | − | |
| 5061 | −int register_inet6addr_notifier(struct notifier_block *nb) | |
| 5062 | −{ | |
| 5063 | − return atomic_notifier_chain_register(&inet6addr_chain, nb); | |
| 5064 | −} | |
| 5065 | −EXPORT_SYMBOL(register_inet6addr_notifier); | |
| 5066 | − | |
| 5067 | −int unregister_inet6addr_notifier(struct notifier_block *nb) | |
| 5068 | −{ | |
| 5069 | − return atomic_notifier_chain_unregister(&inet6addr_chain, nb); | |
| 5070 | −} | |
| 5071 | −EXPORT_SYMBOL(unregister_inet6addr_notifier); | |
| 5072 | − | |
| 5073 | 5055 | static struct rtnl_af_ops inet6_ops = { |
| 5074 | 5056 | .family = AF_INET6, |
| 5075 | 5057 | .fill_link_af = inet6_fill_link_af, |
| @@ -78,3 +78,22 @@ int __ipv6_addr_type(const struct in6_addr *addr) · 77 unmodified lines | ||
| 78 | 78 | } |
| 79 | 79 | EXPORT_SYMBOL(__ipv6_addr_type); |
| 80 | 80 | |
| 81 | +static ATOMIC_NOTIFIER_HEAD(inet6addr_chain); | |
| 82 | + | |
| 83 | +int register_inet6addr_notifier(struct notifier_block *nb) | |
| 84 | +{ | |
| 85 | + return atomic_notifier_chain_register(&inet6addr_chain, nb); | |
| 86 | +} | |
| 87 | +EXPORT_SYMBOL(register_inet6addr_notifier); | |
| 88 | + | |
| 89 | +int unregister_inet6addr_notifier(struct notifier_block *nb) | |
| 90 | +{ | |
| 91 | + return atomic_notifier_chain_unregister(&inet6addr_chain, nb); | |
| 92 | +} | |
| 93 | +EXPORT_SYMBOL(unregister_inet6addr_notifier); | |
| 94 | + | |
| 95 | +int inet6addr_notifier_call_chain(unsigned long val, void *v) | |
| 96 | +{ | |
| 97 | + return atomic_notifier_call_chain(&inet6addr_chain, val, v); | |
| 98 | +} | |
| 99 | +EXPORT_SYMBOL(inet6addr_notifier_call_chain); | |
| @@ -71,6 +71,12 @@ static bool rpfilter_lookup_reverse6(const struct sk_buff *skb, · 70 unmodified lines | ||
| 71 | 71 | return ret; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | +static bool rpfilter_is_local(const struct sk_buff *skb) | |
| 75 | +{ | |
| 76 | + const struct rt6_info *rt = (const void *) skb_dst(skb); | |
| 77 | + return rt && (rt->rt6i_flags & RTF_LOCAL); | |
| 78 | +} | |
| 79 | + | |
| 74 | 80 | static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par) |
| 75 | 81 | { |
| 76 | 82 | const struct xt_rpfilter_info *info = par->matchinfo; |
| @@ -78,7 +84,7 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par) · 1 unmodified line | ||
| 78 | 84 | struct ipv6hdr *iph; |
| 79 | 85 | bool invert = info->flags & XT_RPFILTER_INVERT; |
| 80 | 86 | |
| 81 | − if (par->in->flags & IFF_LOOPBACK) | |
| 87 | + if (rpfilter_is_local(skb)) | |
| 82 | 88 | return true ^ invert; |
| 83 | 89 | |
| 84 | 90 | iph = ipv6_hdr(skb); |
| @@ -342,9 +342,17 @@ found: · 341 unmodified lines | ||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | if (fq->q.last_in == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) && |
| 345 | − fq->q.meat == fq->q.len) | |
| 346 | − return ip6_frag_reasm(fq, prev, dev); | |
| 345 | + fq->q.meat == fq->q.len) { | |
| 346 | + int res; | |
| 347 | + unsigned long orefdst = skb->_skb_refdst; | |
| 348 | + | |
| 349 | + skb->_skb_refdst = 0UL; | |
| 350 | + res = ip6_frag_reasm(fq, prev, dev); | |
| 351 | + skb->_skb_refdst = orefdst; | |
| 352 | + return res; | |
| 353 | + } | |
| 347 | 354 | |
| 355 | + skb_dst_drop(skb); | |
| 348 | 356 | inet_frag_lru_move(&fq->q); |
| 349 | 357 | return -1; |
| 350 | 358 | |
| @@ -303,7 +303,8 @@ static void iriap_disconnect_indication(void *instance, void *sap, · 302 unmodified lines | ||
| 303 | 303 | { |
| 304 | 304 | struct iriap_cb *self; |
| 305 | 305 | |
| 306 | − IRDA_DEBUG(4, "%s(), reason=%s\n", __func__, irlmp_reasons[reason]); | |
| 306 | + IRDA_DEBUG(4, "%s(), reason=%s [%d]\n", __func__, | |
| 307 | + irlmp_reason_str(reason), reason); | |
| 307 | 308 | |
| 308 | 309 | self = instance; |
| 309 | 310 | |
| @@ -66,8 +66,15 @@ const char *irlmp_reasons[] = { · 65 unmodified lines | ||
| 66 | 66 | "LM_LAP_RESET", |
| 67 | 67 | "LM_INIT_DISCONNECT", |
| 68 | 68 | "ERROR, NOT USED", |
| 69 | + "UNKNOWN", | |
| 69 | 70 | }; |
| 70 | 71 | |
| 72 | +const char *irlmp_reason_str(LM_REASON reason) | |
| 73 | +{ | |
| 74 | + reason = min_t(size_t, reason, ARRAY_SIZE(irlmp_reasons) - 1); | |
| 75 | + return irlmp_reasons[reason]; | |
| 76 | +} | |
| 77 | + | |
| 71 | 78 | /* |
| 72 | 79 | * Function irlmp_init (void) |
| 73 | 80 | * |
| @@ -747,7 +754,8 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason, · 673 unmodified lines | ||
| 747 | 754 | { |
| 748 | 755 | struct lsap_cb *lsap; |
| 749 | 756 | |
| 750 | − IRDA_DEBUG(1, "%s(), reason=%s\n", __func__, irlmp_reasons[reason]); | |
| 757 | + IRDA_DEBUG(1, "%s(), reason=%s [%d]\n", __func__, | |
| 758 | + irlmp_reason_str(reason), reason); | |
| 751 | 759 | IRDA_ASSERT(self != NULL, return;); |
| 752 | 760 | IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;); |
| 753 | 761 | |
| @@ -49,12 +49,6 @@ static const u8 iprm_shutdown[8] = · 48 unmodified lines | ||
| 49 | 49 | |
| 50 | 50 | #define TRGCLS_SIZE (sizeof(((struct iucv_message *)0)->class)) |
| 51 | 51 | |
| 52 | −/* macros to set/get socket control buffer at correct offset */ | |
| 53 | −#define CB_TAG(skb) ((skb)->cb) /* iucv message tag */ | |
| 54 | −#define CB_TAG_LEN (sizeof(((struct iucv_message *) 0)->tag)) | |
| 55 | −#define CB_TRGCLS(skb) ((skb)->cb + CB_TAG_LEN) /* iucv msg target class */ | |
| 56 | −#define CB_TRGCLS_LEN (TRGCLS_SIZE) | |
| 57 | − | |
| 58 | 52 | #define __iucv_sock_wait(sk, condition, timeo, ret) \ |
| 59 | 53 | do { \ |
| 60 | 54 | DEFINE_WAIT(__wait); \ |
| @@ -1141,7 +1135,7 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock, · 1080 unmodified lines | ||
| 1141 | 1135 | |
| 1142 | 1136 | /* increment and save iucv message tag for msg_completion cbk */ |
| 1143 | 1137 | txmsg.tag = iucv->send_tag++; |
| 1144 | − memcpy(CB_TAG(skb), &txmsg.tag, CB_TAG_LEN); | |
| 1138 | + IUCV_SKB_CB(skb)->tag = txmsg.tag; | |
| 1145 | 1139 | |
| 1146 | 1140 | if (iucv->transport == AF_IUCV_TRANS_HIPER) { |
| 1147 | 1141 | atomic_inc(&iucv->msg_sent); |
| @@ -1224,7 +1218,7 @@ static int iucv_fragment_skb(struct sock *sk, struct sk_buff *skb, int len) · 76 unmodified lines | ||
| 1224 | 1218 | return -ENOMEM; |
| 1225 | 1219 | |
| 1226 | 1220 | /* copy target class to control buffer of new skb */ |
| 1227 | − memcpy(CB_TRGCLS(nskb), CB_TRGCLS(skb), CB_TRGCLS_LEN); | |
| 1221 | + IUCV_SKB_CB(nskb)->class = IUCV_SKB_CB(skb)->class; | |
| 1228 | 1222 | |
| 1229 | 1223 | /* copy data fragment */ |
| 1230 | 1224 | memcpy(nskb->data, skb->data + copied, size); |
| @@ -1256,7 +1250,7 @@ static void iucv_process_message(struct sock *sk, struct sk_buff *skb, · 25 unmodified lines | ||
| 1256 | 1250 | |
| 1257 | 1251 | /* store msg target class in the second 4 bytes of skb ctrl buffer */ |
| 1258 | 1252 | /* Note: the first 4 bytes are reserved for msg tag */ |
| 1259 | − memcpy(CB_TRGCLS(skb), &msg->class, CB_TRGCLS_LEN); | |
| 1253 | + IUCV_SKB_CB(skb)->class = msg->class; | |
| 1260 | 1254 | |
| 1261 | 1255 | /* check for special IPRM messages (e.g. iucv_sock_shutdown) */ |
| 1262 | 1256 | if ((msg->flags & IUCV_IPRMDATA) && len > 7) { |
| @@ -1292,6 +1286,7 @@ static void iucv_process_message(struct sock *sk, struct sk_buff *skb, · 29 unmodified lines | ||
| 1292 | 1286 | } |
| 1293 | 1287 | } |
| 1294 | 1288 | |
| 1289 | + IUCV_SKB_CB(skb)->offset = 0; | |
| 1295 | 1290 | if (sock_queue_rcv_skb(sk, skb)) |
| 1296 | 1291 | skb_queue_head(&iucv_sk(sk)->backlog_skb_q, skb); |
| 1297 | 1292 | } |
| @@ -1327,6 +1322,7 @@ static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock, · 29 unmodified lines | ||
| 1327 | 1322 | unsigned int copied, rlen; |
| 1328 | 1323 | struct sk_buff *skb, *rskb, *cskb; |
| 1329 | 1324 | int err = 0; |
| 1325 | + u32 offset; | |
| 1330 | 1326 | |
| 1331 | 1327 | msg->msg_namelen = 0; |
| 1332 | 1328 | |
| @@ -1348,13 +1344,14 @@ static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock, · 15 unmodified lines | ||
| 1348 | 1344 | return err; |
| 1349 | 1345 | } |
| 1350 | 1346 | |
| 1351 | − rlen = skb->len; /* real length of skb */ | |
| 1347 | + offset = IUCV_SKB_CB(skb)->offset; | |
| 1348 | + rlen = skb->len - offset; /* real length of skb */ | |
| 1352 | 1349 | copied = min_t(unsigned int, rlen, len); |
| 1353 | 1350 | if (!rlen) |
| 1354 | 1351 | sk->sk_shutdown = sk->sk_shutdown | RCV_SHUTDOWN; |
| 1355 | 1352 | |
| 1356 | 1353 | cskb = skb; |
| 1357 | − if (skb_copy_datagram_iovec(cskb, 0, msg->msg_iov, copied)) { | |
| 1354 | + if (skb_copy_datagram_iovec(cskb, offset, msg->msg_iov, copied)) { | |
| 1358 | 1355 | if (!(flags & MSG_PEEK)) |
| 1359 | 1356 | skb_queue_head(&sk->sk_receive_queue, skb); |
| 1360 | 1357 | return -EFAULT; |
| @@ -1372,7 +1369,8 @@ static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock, · 11 unmodified lines | ||
| 1372 | 1369 | * get the trgcls from the control buffer of the skb due to |
| 1373 | 1370 | * fragmentation of original iucv message. */ |
| 1374 | 1371 | err = put_cmsg(msg, SOL_IUCV, SCM_IUCV_TRGCLS, |
| 1375 | − CB_TRGCLS_LEN, CB_TRGCLS(skb)); | |
| 1372 | + sizeof(IUCV_SKB_CB(skb)->class), | |
| 1373 | + (void *)&IUCV_SKB_CB(skb)->class); | |
| 1376 | 1374 | if (err) { |
| 1377 | 1375 | if (!(flags & MSG_PEEK)) |
| 1378 | 1376 | skb_queue_head(&sk->sk_receive_queue, skb); |
| @@ -1384,9 +1382,8 @@ static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock, · 5 unmodified lines | ||
| 1384 | 1382 | |
| 1385 | 1383 | /* SOCK_STREAM: re-queue skb if it contains unreceived data */ |
| 1386 | 1384 | if (sk->sk_type == SOCK_STREAM) { |
| 1387 | − skb_pull(skb, copied); | |
| 1388 | − if (skb->len) { | |
| 1389 | − skb_queue_head(&sk->sk_receive_queue, skb); | |
| 1385 | + if (copied < rlen) { | |
| 1386 | + IUCV_SKB_CB(skb)->offset = offset + copied; | |
| 1390 | 1387 | goto done; |
| 1391 | 1388 | } |
| 1392 | 1389 | } |
| @@ -1405,6 +1402,7 @@ static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock, · 12 unmodified lines | ||
| 1405 | 1402 | spin_lock_bh(&iucv->message_q.lock); |
| 1406 | 1403 | rskb = skb_dequeue(&iucv->backlog_skb_q); |
| 1407 | 1404 | while (rskb) { |
| 1405 | + IUCV_SKB_CB(rskb)->offset = 0; | |
| 1408 | 1406 | if (sock_queue_rcv_skb(sk, rskb)) { |
| 1409 | 1407 | skb_queue_head(&iucv->backlog_skb_q, |
| 1410 | 1408 | rskb); |
| @@ -1833,7 +1831,7 @@ static void iucv_callback_txdone(struct iucv_path *path, · 422 unmodified lines | ||
| 1833 | 1831 | spin_lock_irqsave(&list->lock, flags); |
| 1834 | 1832 | |
| 1835 | 1833 | while (list_skb != (struct sk_buff *)list) { |
| 1836 | − if (!memcmp(&msg->tag, CB_TAG(list_skb), CB_TAG_LEN)) { | |
| 1834 | + if (msg->tag != IUCV_SKB_CB(list_skb)->tag) { | |
| 1837 | 1835 | this = list_skb; |
| 1838 | 1836 | break; |
| 1839 | 1837 | } |
| @@ -2094,6 +2092,7 @@ static int afiucv_hs_callback_rx(struct sock *sk, struct sk_buff *skb) · 254 unmodified lines | ||
| 2094 | 2092 | skb_pull(skb, sizeof(struct af_iucv_trans_hdr)); |
| 2095 | 2093 | skb_reset_transport_header(skb); |
| 2096 | 2094 | skb_reset_network_header(skb); |
| 2095 | + IUCV_SKB_CB(skb)->offset = 0; | |
| 2097 | 2096 | spin_lock(&iucv->message_q.lock); |
| 2098 | 2097 | if (skb_queue_empty(&iucv->backlog_skb_q)) { |
| 2099 | 2098 | if (sock_queue_rcv_skb(sk, skb)) { |
| @@ -2198,8 +2197,7 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev, · 98 unmodified lines | ||
| 2198 | 2197 | /* fall through and receive zero length data */ |
| 2199 | 2198 | case 0: |
| 2200 | 2199 | /* plain data frame */ |
| 2201 | − memcpy(CB_TRGCLS(skb), &trans_hdr->iucv_hdr.class, | |
| 2202 | − CB_TRGCLS_LEN); | |
| 2200 | + IUCV_SKB_CB(skb)->class = trans_hdr->iucv_hdr.class; | |
| 2203 | 2201 | err = afiucv_hs_callback_rx(sk, skb); |
| 2204 | 2202 | break; |
| 2205 | 2203 | default: |
| @@ -78,7 +78,7 @@ void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata) · 77 unmodified lines | ||
| 78 | 78 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_TXPOWER); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | −u32 ieee80211_idle_off(struct ieee80211_local *local) | |
| 81 | +static u32 __ieee80211_idle_off(struct ieee80211_local *local) | |
| 82 | 82 | { |
| 83 | 83 | if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE)) |
| 84 | 84 | return 0; |
| @@ -87,7 +87,7 @@ u32 ieee80211_idle_off(struct ieee80211_local *local) · 2 unmodified lines | ||
| 87 | 87 | return IEEE80211_CONF_CHANGE_IDLE; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | −static u32 ieee80211_idle_on(struct ieee80211_local *local) | |
| 90 | +static u32 __ieee80211_idle_on(struct ieee80211_local *local) | |
| 91 | 91 | { |
| 92 | 92 | if (local->hw.conf.flags & IEEE80211_CONF_IDLE) |
| 93 | 93 | return 0; |
| @@ -98,16 +98,18 @@ static u32 ieee80211_idle_on(struct ieee80211_local *local) · 4 unmodified lines | ||
| 98 | 98 | return IEEE80211_CONF_CHANGE_IDLE; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | −void ieee80211_recalc_idle(struct ieee80211_local *local) | |
| 101 | +static u32 __ieee80211_recalc_idle(struct ieee80211_local *local, | |
| 102 | + bool force_active) | |
| 102 | 103 | { |
| 103 | 104 | bool working = false, scanning, active; |
| 104 | 105 | unsigned int led_trig_start = 0, led_trig_stop = 0; |
| 105 | 106 | struct ieee80211_roc_work *roc; |
| 106 | − u32 change; | |
| 107 | 107 | |
| 108 | 108 | lockdep_assert_held(&local->mtx); |
| 109 | 109 | |
| 110 | − active = !list_empty(&local->chanctx_list) || local->monitors; | |
| 110 | + active = force_active || | |
| 111 | + !list_empty(&local->chanctx_list) || | |
| 112 | + local->monitors; | |
| 111 | 113 | |
| 112 | 114 | if (!local->ops->remain_on_channel) { |
| 113 | 115 | list_for_each_entry(roc, &local->roc_list, list) { |
| @@ -132,9 +134,18 @@ void ieee80211_recalc_idle(struct ieee80211_local *local) · 18 unmodified lines | ||
| 132 | 134 | ieee80211_mod_tpt_led_trig(local, led_trig_start, led_trig_stop); |
| 133 | 135 | |
| 134 | 136 | if (working || scanning || active) |
| 135 | − change = ieee80211_idle_off(local); | |
| 136 | − else | |
| 137 | − change = ieee80211_idle_on(local); | |
| 137 | + return __ieee80211_idle_off(local); | |
| 138 | + return __ieee80211_idle_on(local); | |
| 139 | +} | |
| 140 | + | |
| 141 | +u32 ieee80211_idle_off(struct ieee80211_local *local) | |
| 142 | +{ | |
| 143 | + return __ieee80211_recalc_idle(local, true); | |
| 144 | +} | |
| 145 | + | |
| 146 | +void ieee80211_recalc_idle(struct ieee80211_local *local) | |
| 147 | +{ | |
| 148 | + u32 change = __ieee80211_recalc_idle(local, false); | |
| 138 | 149 | if (change) |
| 139 | 150 | ieee80211_hw_config(local, change); |
| 140 | 151 | } |
| @@ -3887,8 +3887,16 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, · 3886 unmodified lines | ||
| 3887 | 3887 | /* prep auth_data so we don't go into idle on disassoc */ |
| 3888 | 3888 | ifmgd->auth_data = auth_data; |
| 3889 | 3889 | |
| 3890 | − if (ifmgd->associated) | |
| 3891 | − ieee80211_set_disassoc(sdata, 0, 0, false, NULL); | |
| 3890 | + if (ifmgd->associated) { | |
| 3891 | + u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; | |
| 3892 | + | |
| 3893 | + ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | |
| 3894 | + WLAN_REASON_UNSPECIFIED, | |
| 3895 | + false, frame_buf); | |
| 3896 | + | |
| 3897 | + __cfg80211_send_deauth(sdata->dev, frame_buf, | |
| 3898 | + sizeof(frame_buf)); | |
| 3899 | + } | |
| 3892 | 3900 | |
| 3893 | 3901 | sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); |
| 3894 | 3902 | |
| @@ -3948,8 +3956,16 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 53 unmodified lines | ||
| 3948 | 3956 | |
| 3949 | 3957 | mutex_lock(&ifmgd->mtx); |
| 3950 | 3958 | |
| 3951 | − if (ifmgd->associated) | |
| 3952 | − ieee80211_set_disassoc(sdata, 0, 0, false, NULL); | |
| 3959 | + if (ifmgd->associated) { | |
| 3960 | + u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; | |
| 3961 | + | |
| 3962 | + ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | |
| 3963 | + WLAN_REASON_UNSPECIFIED, | |
| 3964 | + false, frame_buf); | |
| 3965 | + | |
| 3966 | + __cfg80211_send_deauth(sdata->dev, frame_buf, | |
| 3967 | + sizeof(frame_buf)); | |
| 3968 | + } | |
| 3953 | 3969 | |
| 3954 | 3970 | if (ifmgd->auth_data && !ifmgd->auth_data->done) { |
| 3955 | 3971 | err = -EBUSY; |
| @@ -339,7 +339,11 @@ bitmap_ipmac_tlist(const struct ip_set *set, · 338 unmodified lines | ||
| 339 | 339 | nla_put_failure: |
| 340 | 340 | nla_nest_cancel(skb, nested); |
| 341 | 341 | ipset_nest_end(skb, atd); |
| 342 | − return -EMSGSIZE; | |
| 342 | + if (unlikely(id == first)) { | |
| 343 | + cb->args[2] = 0; | |
| 344 | + return -EMSGSIZE; | |
| 345 | + } | |
| 346 | + return 0; | |
| 343 | 347 | } |
| 344 | 348 | |
| 345 | 349 | static int |
| @@ -104,6 +104,15 @@ hash_ipportnet4_data_flags(struct hash_ipportnet4_elem *dst, u32 flags) · 103 unmodified lines | ||
| 104 | 104 | dst->nomatch = !!(flags & IPSET_FLAG_NOMATCH); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | +static inline void | |
| 108 | +hash_ipportnet4_data_reset_flags(struct hash_ipportnet4_elem *dst, u32 *flags) | |
| 109 | +{ | |
| 110 | + if (dst->nomatch) { | |
| 111 | + *flags = IPSET_FLAG_NOMATCH; | |
| 112 | + dst->nomatch = 0; | |
| 113 | + } | |
| 114 | +} | |
| 115 | + | |
| 107 | 116 | static inline int |
| 108 | 117 | hash_ipportnet4_data_match(const struct hash_ipportnet4_elem *elem) |
| 109 | 118 | { |
| @@ -414,6 +423,15 @@ hash_ipportnet6_data_flags(struct hash_ipportnet6_elem *dst, u32 flags) · 304 unmodified lines | ||
| 414 | 423 | dst->nomatch = !!(flags & IPSET_FLAG_NOMATCH); |
| 415 | 424 | } |
| 416 | 425 | |
| 426 | +static inline void | |
| 427 | +hash_ipportnet6_data_reset_flags(struct hash_ipportnet6_elem *dst, u32 *flags) | |
| 428 | +{ | |
| 429 | + if (dst->nomatch) { | |
| 430 | + *flags = IPSET_FLAG_NOMATCH; | |
| 431 | + dst->nomatch = 0; | |
| 432 | + } | |
| 433 | +} | |
| 434 | + | |
| 417 | 435 | static inline int |
| 418 | 436 | hash_ipportnet6_data_match(const struct hash_ipportnet6_elem *elem) |
| 419 | 437 | { |
| @@ -87,7 +87,16 @@ hash_net4_data_copy(struct hash_net4_elem *dst, · 86 unmodified lines | ||
| 87 | 87 | static inline void |
| 88 | 88 | hash_net4_data_flags(struct hash_net4_elem *dst, u32 flags) |
| 89 | 89 | { |
| 90 | − dst->nomatch = flags & IPSET_FLAG_NOMATCH; | |
| 90 | + dst->nomatch = !!(flags & IPSET_FLAG_NOMATCH); | |
| 91 | +} | |
| 92 | + | |
| 93 | +static inline void | |
| 94 | +hash_net4_data_reset_flags(struct hash_net4_elem *dst, u32 *flags) | |
| 95 | +{ | |
| 96 | + if (dst->nomatch) { | |
| 97 | + *flags = IPSET_FLAG_NOMATCH; | |
| 98 | + dst->nomatch = 0; | |
| 99 | + } | |
| 91 | 100 | } |
| 92 | 101 | |
| 93 | 102 | static inline int |
| @@ -308,7 +317,16 @@ hash_net6_data_copy(struct hash_net6_elem *dst, · 214 unmodified lines | ||
| 308 | 317 | static inline void |
| 309 | 318 | hash_net6_data_flags(struct hash_net6_elem *dst, u32 flags) |
| 310 | 319 | { |
| 311 | − dst->nomatch = flags & IPSET_FLAG_NOMATCH; | |
| 320 | + dst->nomatch = !!(flags & IPSET_FLAG_NOMATCH); | |
| 321 | +} | |
| 322 | + | |
| 323 | +static inline void | |
| 324 | +hash_net6_data_reset_flags(struct hash_net6_elem *dst, u32 *flags) | |
| 325 | +{ | |
| 326 | + if (dst->nomatch) { | |
| 327 | + *flags = IPSET_FLAG_NOMATCH; | |
| 328 | + dst->nomatch = 0; | |
| 329 | + } | |
| 312 | 330 | } |
| 313 | 331 | |
| 314 | 332 | static inline int |
| @@ -198,7 +198,16 @@ hash_netiface4_data_copy(struct hash_netiface4_elem *dst, · 197 unmodified lines | ||
| 198 | 198 | static inline void |
| 199 | 199 | hash_netiface4_data_flags(struct hash_netiface4_elem *dst, u32 flags) |
| 200 | 200 | { |
| 201 | − dst->nomatch = flags & IPSET_FLAG_NOMATCH; | |
| 201 | + dst->nomatch = !!(flags & IPSET_FLAG_NOMATCH); | |
| 202 | +} | |
| 203 | + | |
| 204 | +static inline void | |
| 205 | +hash_netiface4_data_reset_flags(struct hash_netiface4_elem *dst, u32 *flags) | |
| 206 | +{ | |
| 207 | + if (dst->nomatch) { | |
| 208 | + *flags = IPSET_FLAG_NOMATCH; | |
| 209 | + dst->nomatch = 0; | |
| 210 | + } | |
| 202 | 211 | } |
| 203 | 212 | |
| 204 | 213 | static inline int |
| @@ -494,7 +503,7 @@ hash_netiface6_data_copy(struct hash_netiface6_elem *dst, · 289 unmodified lines | ||
| 494 | 503 | static inline void |
| 495 | 504 | hash_netiface6_data_flags(struct hash_netiface6_elem *dst, u32 flags) |
| 496 | 505 | { |
| 497 | − dst->nomatch = flags & IPSET_FLAG_NOMATCH; | |
| 506 | + dst->nomatch = !!(flags & IPSET_FLAG_NOMATCH); | |
| 498 | 507 | } |
| 499 | 508 | |
| 500 | 509 | static inline int |
| @@ -503,6 +512,15 @@ hash_netiface6_data_match(const struct hash_netiface6_elem *elem) · 2 unmodified lines | ||
| 503 | 512 | return elem->nomatch ? -ENOTEMPTY : 1; |
| 504 | 513 | } |
| 505 | 514 | |
| 515 | +static inline void | |
| 516 | +hash_netiface6_data_reset_flags(struct hash_netiface6_elem *dst, u32 *flags) | |
| 517 | +{ | |
| 518 | + if (dst->nomatch) { | |
| 519 | + *flags = IPSET_FLAG_NOMATCH; | |
| 520 | + dst->nomatch = 0; | |
| 521 | + } | |
| 522 | +} | |
| 523 | + | |
| 506 | 524 | static inline void |
| 507 | 525 | hash_netiface6_data_zero_out(struct hash_netiface6_elem *elem) |
| 508 | 526 | { |
| @@ -104,6 +104,15 @@ hash_netport4_data_flags(struct hash_netport4_elem *dst, u32 flags) · 103 unmodified lines | ||
| 104 | 104 | dst->nomatch = !!(flags & IPSET_FLAG_NOMATCH); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | +static inline void | |
| 108 | +hash_netport4_data_reset_flags(struct hash_netport4_elem *dst, u32 *flags) | |
| 109 | +{ | |
| 110 | + if (dst->nomatch) { | |
| 111 | + *flags = IPSET_FLAG_NOMATCH; | |
| 112 | + dst->nomatch = 0; | |
| 113 | + } | |
| 114 | +} | |
| 115 | + | |
| 107 | 116 | static inline int |
| 108 | 117 | hash_netport4_data_match(const struct hash_netport4_elem *elem) |
| 109 | 118 | { |
| @@ -375,6 +384,15 @@ hash_netport6_data_flags(struct hash_netport6_elem *dst, u32 flags) · 265 unmodified lines | ||
| 375 | 384 | dst->nomatch = !!(flags & IPSET_FLAG_NOMATCH); |
| 376 | 385 | } |
| 377 | 386 | |
| 387 | +static inline void | |
| 388 | +hash_netport6_data_reset_flags(struct hash_netport6_elem *dst, u32 *flags) | |
| 389 | +{ | |
| 390 | + if (dst->nomatch) { | |
| 391 | + *flags = IPSET_FLAG_NOMATCH; | |
| 392 | + dst->nomatch = 0; | |
| 393 | + } | |
| 394 | +} | |
| 395 | + | |
| 378 | 396 | static inline int |
| 379 | 397 | hash_netport6_data_match(const struct hash_netport6_elem *elem) |
| 380 | 398 | { |
| @@ -174,9 +174,13 @@ list_set_add(struct list_set *map, u32 i, ip_set_id_t id, · 173 unmodified lines | ||
| 174 | 174 | { |
| 175 | 175 | const struct set_elem *e = list_set_elem(map, i); |
| 176 | 176 | |
| 177 | − if (i == map->size - 1 && e->id != IPSET_INVALID_ID) | |
| 178 | − /* Last element replaced: e.g. add new,before,last */ | |
| 179 | − ip_set_put_byindex(e->id); | |
| 177 | + if (e->id != IPSET_INVALID_ID) { | |
| 178 | + const struct set_elem *x = list_set_elem(map, map->size - 1); | |
| 179 | + | |
| 180 | + /* Last element replaced or pushed off */ | |
| 181 | + if (x->id != IPSET_INVALID_ID) | |
| 182 | + ip_set_put_byindex(x->id); | |
| 183 | + } | |
| 180 | 184 | if (with_timeout(map->timeout)) |
| 181 | 185 | list_elem_tadd(map, i, id, ip_set_timeout_set(timeout)); |
| 182 | 186 | else |
| @@ -1593,10 +1593,8 @@ static int sip_help_tcp(struct sk_buff *skb, unsigned int protoff, · 1592 unmodified lines | ||
| 1593 | 1593 | end += strlen("\r\n\r\n") + clen; |
| 1594 | 1594 | |
| 1595 | 1595 | msglen = origlen = end - dptr; |
| 1596 | − if (msglen > datalen) { | |
| 1597 | − nf_ct_helper_log(skb, ct, "incomplete/bad SIP message"); | |
| 1598 | − return NF_DROP; | |
| 1599 | − } | |
| 1596 | + if (msglen > datalen) | |
| 1597 | + return NF_ACCEPT; | |
| 1600 | 1598 | |
| 1601 | 1599 | ret = process_sip_msg(skb, ct, protoff, dataoff, |
| 1602 | 1600 | &dptr, &msglen); |
| @@ -468,33 +468,22 @@ EXPORT_SYMBOL_GPL(nf_nat_packet); · 467 unmodified lines | ||
| 468 | 468 | struct nf_nat_proto_clean { |
| 469 | 469 | u8 l3proto; |
| 470 | 470 | u8 l4proto; |
| 471 | − bool hash; | |
| 472 | 471 | }; |
| 473 | 472 | |
| 474 | −/* Clear NAT section of all conntracks, in case we're loaded again. */ | |
| 475 | −static int nf_nat_proto_clean(struct nf_conn *i, void *data) | |
| 473 | +/* kill conntracks with affected NAT section */ | |
| 474 | +static int nf_nat_proto_remove(struct nf_conn *i, void *data) | |
| 476 | 475 | { |
| 477 | 476 | const struct nf_nat_proto_clean *clean = data; |
| 478 | 477 | struct nf_conn_nat *nat = nfct_nat(i); |
| 479 | 478 | |
| 480 | 479 | if (!nat) |
| 481 | 480 | return 0; |
| 482 | − if (!(i->status & IPS_SRC_NAT_DONE)) | |
| 483 | − return 0; | |
| 481 | + | |
| 484 | 482 | if ((clean->l3proto && nf_ct_l3num(i) != clean->l3proto) || |
| 485 | 483 | (clean->l4proto && nf_ct_protonum(i) != clean->l4proto)) |
| 486 | 484 | return 0; |
| 487 | 485 | |
| 488 | − if (clean->hash) { | |
| 489 | − spin_lock_bh(&nf_nat_lock); | |
| 490 | − hlist_del_rcu(&nat->bysource); | |
| 491 | − spin_unlock_bh(&nf_nat_lock); | |
| 492 | − } else { | |
| 493 | − memset(nat, 0, sizeof(*nat)); | |
| 494 | − i->status &= ~(IPS_NAT_MASK | IPS_NAT_DONE_MASK | | |
| 495 | − IPS_SEQ_ADJUST); | |
| 496 | − } | |
| 497 | − return 0; | |
| 486 | + return i->status & IPS_NAT_MASK ? 1 : 0; | |
| 498 | 487 | } |
| 499 | 488 | |
| 500 | 489 | static void nf_nat_l4proto_clean(u8 l3proto, u8 l4proto) |
| @@ -506,16 +495,8 @@ static void nf_nat_l4proto_clean(u8 l3proto, u8 l4proto) · 5 unmodified lines | ||
| 506 | 495 | struct net *net; |
| 507 | 496 | |
| 508 | 497 | rtnl_lock(); |
| 509 | − /* Step 1 - remove from bysource hash */ | |
| 510 | − clean.hash = true; | |
| 511 | 498 | for_each_net(net) |
| 512 | − nf_ct_iterate_cleanup(net, nf_nat_proto_clean, &clean); | |
| 513 | − synchronize_rcu(); | |
| 514 | − | |
| 515 | − /* Step 2 - clean NAT section */ | |
| 516 | − clean.hash = false; | |
| 517 | − for_each_net(net) | |
| 518 | − nf_ct_iterate_cleanup(net, nf_nat_proto_clean, &clean); | |
| 499 | + nf_ct_iterate_cleanup(net, nf_nat_proto_remove, &clean); | |
| 519 | 500 | rtnl_unlock(); |
| 520 | 501 | } |
| 521 | 502 | |
| @@ -527,16 +508,9 @@ static void nf_nat_l3proto_clean(u8 l3proto) · 5 unmodified lines | ||
| 527 | 508 | struct net *net; |
| 528 | 509 | |
| 529 | 510 | rtnl_lock(); |
| 530 | − /* Step 1 - remove from bysource hash */ | |
| 531 | − clean.hash = true; | |
| 532 | − for_each_net(net) | |
| 533 | − nf_ct_iterate_cleanup(net, nf_nat_proto_clean, &clean); | |
| 534 | − synchronize_rcu(); | |
| 535 | 511 | |
| 536 | − /* Step 2 - clean NAT section */ | |
| 537 | − clean.hash = false; | |
| 538 | 512 | for_each_net(net) |
| 539 | − nf_ct_iterate_cleanup(net, nf_nat_proto_clean, &clean); | |
| 513 | + nf_ct_iterate_cleanup(net, nf_nat_proto_remove, &clean); | |
| 540 | 514 | rtnl_unlock(); |
| 541 | 515 | } |
| 542 | 516 | |
| @@ -774,7 +748,7 @@ static void __net_exit nf_nat_net_exit(struct net *net) · 231 unmodified lines | ||
| 774 | 748 | { |
| 775 | 749 | struct nf_nat_proto_clean clean = {}; |
| 776 | 750 | |
| 777 | − nf_ct_iterate_cleanup(net, &nf_nat_proto_clean, &clean); | |
| 751 | + nf_ct_iterate_cleanup(net, &nf_nat_proto_remove, &clean); | |
| 778 | 752 | synchronize_rcu(); |
| 779 | 753 | nf_ct_free_hashtable(net->ct.nat_bysource, net->ct.nat_htable_size); |
| 780 | 754 | } |
| @@ -1173,7 +1173,7 @@ static int nr_recvmsg(struct kiocb *iocb, struct socket *sock, · 1172 unmodified lines | ||
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | 1175 | if (sax != NULL) { |
| 1176 | − memset(sax, 0, sizeof(sax)); | |
| 1176 | + memset(sax, 0, sizeof(*sax)); | |
| 1177 | 1177 | sax->sax25_family = AF_NETROM; |
| 1178 | 1178 | skb_copy_from_linear_data_offset(skb, 7, sax->sax25_call.ax25_call, |
| 1179 | 1179 | AX25_ADDR_LEN); |
| @@ -1681,10 +1681,8 @@ struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 portid, · 1680 unmodified lines | ||
| 1681 | 1681 | return ERR_PTR(-ENOMEM); |
| 1682 | 1682 | |
| 1683 | 1683 | retval = ovs_vport_cmd_fill_info(vport, skb, portid, seq, 0, cmd); |
| 1684 | − if (retval < 0) { | |
| 1685 | − kfree_skb(skb); | |
| 1686 | − return ERR_PTR(retval); | |
| 1687 | − } | |
| 1684 | + BUG_ON(retval < 0); | |
| 1685 | + | |
| 1688 | 1686 | return skb; |
| 1689 | 1687 | } |
| 1690 | 1688 | |
| @@ -1814,25 +1812,33 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) · 123 unmodified lines | ||
| 1814 | 1812 | nla_get_u32(a[OVS_VPORT_ATTR_TYPE]) != vport->ops->type) |
| 1815 | 1813 | err = -EINVAL; |
| 1816 | 1814 | |
| 1815 | + reply = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | |
| 1816 | + if (!reply) { | |
| 1817 | + err = -ENOMEM; | |
| 1818 | + goto exit_unlock; | |
| 1819 | + } | |
| 1820 | + | |
| 1817 | 1821 | if (!err && a[OVS_VPORT_ATTR_OPTIONS]) |
| 1818 | 1822 | err = ovs_vport_set_options(vport, a[OVS_VPORT_ATTR_OPTIONS]); |
| 1819 | 1823 | if (err) |
| 1820 | − goto exit_unlock; | |
| 1824 | + goto exit_free; | |
| 1825 | + | |
| 1821 | 1826 | if (a[OVS_VPORT_ATTR_UPCALL_PID]) |
| 1822 | 1827 | vport->upcall_portid = nla_get_u32(a[OVS_VPORT_ATTR_UPCALL_PID]); |
| 1823 | 1828 | |
| 1824 | − reply = ovs_vport_cmd_build_info(vport, info->snd_portid, info->snd_seq, | |
| 1825 | − OVS_VPORT_CMD_NEW); | |
| 1826 | − if (IS_ERR(reply)) { | |
| 1827 | − netlink_set_err(sock_net(skb->sk)->genl_sock, 0, | |
| 1828 | − ovs_dp_vport_multicast_group.id, PTR_ERR(reply)); | |
| 1829 | − goto exit_unlock; | |
| 1830 | − } | |
| 1829 | + err = ovs_vport_cmd_fill_info(vport, reply, info->snd_portid, | |
| 1830 | + info->snd_seq, 0, OVS_VPORT_CMD_NEW); | |
| 1831 | + BUG_ON(err < 0); | |
| 1831 | 1832 | |
| 1832 | 1833 | ovs_unlock(); |
| 1833 | 1834 | ovs_notify(reply, info, &ovs_dp_vport_multicast_group); |
| 1834 | 1835 | return 0; |
| 1835 | 1836 | |
| 1837 | + rtnl_unlock(); | |
| 1838 | + return 0; | |
| 1839 | + | |
| 1840 | +exit_free: | |
| 1841 | + kfree_skb(reply); | |
| 1836 | 1842 | exit_unlock: |
| 1837 | 1843 | ovs_unlock(); |
| 1838 | 1844 | return err; |
| @@ -795,9 +795,9 @@ void ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow) · 794 unmodified lines | ||
| 795 | 795 | |
| 796 | 796 | void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow) |
| 797 | 797 | { |
| 798 | + BUG_ON(table->count == 0); | |
| 798 | 799 | hlist_del_rcu(&flow->hash_node[table->node_ver]); |
| 799 | 800 | table->count--; |
| 800 | − BUG_ON(table->count < 0); | |
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | /* The size of the argument for each %OVS_KEY_ATTR_* Netlink attribute. */ |
| @@ -204,7 +204,6 @@ fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f, · 203 unmodified lines | ||
| 204 | 204 | if (err < 0) |
| 205 | 205 | return err; |
| 206 | 206 | |
| 207 | − err = -EINVAL; | |
| 208 | 207 | if (tb[TCA_FW_CLASSID]) { |
| 209 | 208 | f->res.classid = nla_get_u32(tb[TCA_FW_CLASSID]); |
| 210 | 209 | tcf_bind_filter(tp, &f->res, base); |
| @@ -218,6 +217,7 @@ fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f, · 7 unmodified lines | ||
| 218 | 217 | } |
| 219 | 218 | #endif /* CONFIG_NET_CLS_IND */ |
| 220 | 219 | |
| 220 | + err = -EINVAL; | |
| 221 | 221 | if (tb[TCA_FW_MASK]) { |
| 222 | 222 | mask = nla_get_u32(tb[TCA_FW_MASK]); |
| 223 | 223 | if (mask != head->mask) |
| @@ -304,10 +304,8 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru · 303 unmodified lines | ||
| 304 | 304 | err = rpciod_up(); |
| 305 | 305 | if (err) |
| 306 | 306 | goto out_no_rpciod; |
| 307 | − err = -EINVAL; | |
| 308 | − if (!xprt) | |
| 309 | − goto out_no_xprt; | |
| 310 | 307 | |
| 308 | + err = -EINVAL; | |
| 311 | 309 | if (args->version >= program->nrvers) |
| 312 | 310 | goto out_err; |
| 313 | 311 | version = program->version[args->version]; |
| @@ -382,10 +380,9 @@ out_no_principal: · 68 unmodified lines | ||
| 382 | 380 | out_no_stats: |
| 383 | 381 | kfree(clnt); |
| 384 | 382 | out_err: |
| 385 | − xprt_put(xprt); | |
| 386 | −out_no_xprt: | |
| 387 | 383 | rpciod_down(); |
| 388 | 384 | out_no_rpciod: |
| 385 | + xprt_put(xprt); | |
| 389 | 386 | return ERR_PTR(err); |
| 390 | 387 | } |
| 391 | 388 | |
| @@ -512,7 +509,7 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args, · 120 unmodified lines | ||
| 512 | 509 | new = rpc_new_client(args, xprt); |
| 513 | 510 | if (IS_ERR(new)) { |
| 514 | 511 | err = PTR_ERR(new); |
| 515 | − goto out_put; | |
| 512 | + goto out_err; | |
| 516 | 513 | } |
| 517 | 514 | |
| 518 | 515 | atomic_inc(&clnt->cl_count); |
| @@ -525,8 +522,6 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args, · 6 unmodified lines | ||
| 525 | 522 | new->cl_chatty = clnt->cl_chatty; |
| 526 | 523 | return new; |
| 527 | 524 | |
| 528 | −out_put: | |
| 529 | − xprt_put(xprt); | |
| 530 | 525 | out_err: |
| 531 | 526 | dprintk("RPC: %s: returned error %d\n", __func__, err); |
| 532 | 527 | return ERR_PTR(err); |
| @@ -1414,7 +1414,7 @@ static void maybe_add_creds(struct sk_buff *skb, const struct socket *sock, · 1413 unmodified lines | ||
| 1414 | 1414 | !other->sk_socket || |
| 1415 | 1415 | test_bit(SOCK_PASSCRED, &other->sk_socket->flags)) { |
| 1416 | 1416 | UNIXCB(skb).pid = get_pid(task_tgid(current)); |
| 1417 | − current_euid_egid(&UNIXCB(skb).uid, &UNIXCB(skb).gid); | |
| 1417 | + current_uid_gid(&UNIXCB(skb).uid, &UNIXCB(skb).gid); | |
| 1418 | 1418 | } |
| 1419 | 1419 | } |
| 1420 | 1420 | |
| @@ -3016,6 +3016,7 @@ sub process { · 3015 unmodified lines | ||
| 3016 | 3016 | $dstat !~ /^'X'$/ && # character constants |
| 3017 | 3017 | $dstat !~ /$exceptions/ && |
| 3018 | 3018 | $dstat !~ /^\.$Ident\s*=/ && # .foo = |
| 3019 | + $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ && # stringification #foo | |
| 3019 | 3020 | $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) |
| 3020 | 3021 | $dstat !~ /^for\s*$Constant$/ && # for (...) |
| 3021 | 3022 | $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() |
| @@ -737,6 +737,11 @@ static int cap_tun_dev_open(void *security) · 736 unmodified lines | ||
| 737 | 737 | { |
| 738 | 738 | return 0; |
| 739 | 739 | } |
| 740 | + | |
| 741 | +static void cap_skb_owned_by(struct sk_buff *skb, struct sock *sk) | |
| 742 | +{ | |
| 743 | +} | |
| 744 | + | |
| 740 | 745 | #endif /* CONFIG_SECURITY_NETWORK */ |
| 741 | 746 | |
| 742 | 747 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
| @@ -1071,6 +1076,7 @@ void __init security_fixup_ops(struct security_operations *ops) · 328 unmodified lines | ||
| 1071 | 1076 | set_to_cap_if_null(ops, tun_dev_open); |
| 1072 | 1077 | set_to_cap_if_null(ops, tun_dev_attach_queue); |
| 1073 | 1078 | set_to_cap_if_null(ops, tun_dev_attach); |
| 1079 | + set_to_cap_if_null(ops, skb_owned_by); | |
| 1074 | 1080 | #endif /* CONFIG_SECURITY_NETWORK */ |
| 1075 | 1081 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
| 1076 | 1082 | set_to_cap_if_null(ops, xfrm_policy_alloc_security); |
| @@ -1290,6 +1290,11 @@ int security_tun_dev_open(void *security) · 1289 unmodified lines | ||
| 1290 | 1290 | } |
| 1291 | 1291 | EXPORT_SYMBOL(security_tun_dev_open); |
| 1292 | 1292 | |
| 1293 | +void security_skb_owned_by(struct sk_buff *skb, struct sock *sk) | |
| 1294 | +{ | |
| 1295 | + security_ops->skb_owned_by(skb, sk); | |
| 1296 | +} | |
| 1297 | + | |
| 1293 | 1298 | #endif /* CONFIG_SECURITY_NETWORK */ |
| 1294 | 1299 | |
| 1295 | 1300 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
| @@ -51,6 +51,7 @@ · 50 unmodified lines | ||
| 51 | 51 | #include <linux/tty.h> |
| 52 | 52 | #include <net/icmp.h> |
| 53 | 53 | #include <net/ip.h> /* for local_port_range[] */ |
| 54 | +#include <net/sock.h> | |
| 54 | 55 | #include <net/tcp.h> /* struct or_callable used in sock_rcv_skb */ |
| 55 | 56 | #include <net/net_namespace.h> |
| 56 | 57 | #include <net/netlabel.h> |
| @@ -4363,6 +4364,11 @@ static void selinux_inet_conn_established(struct sock *sk, struct sk_buff *skb) · 4306 unmodified lines | ||
| 4363 | 4364 | selinux_skb_peerlbl_sid(skb, family, &sksec->peer_sid); |
| 4364 | 4365 | } |
| 4365 | 4366 | |
| 4367 | +static void selinux_skb_owned_by(struct sk_buff *skb, struct sock *sk) | |
| 4368 | +{ | |
| 4369 | + skb_set_owner_w(skb, sk); | |
| 4370 | +} | |
| 4371 | + | |
| 4366 | 4372 | static int selinux_secmark_relabel_packet(u32 sid) |
| 4367 | 4373 | { |
| 4368 | 4374 | const struct task_security_struct *__tsec; |
| @@ -5664,6 +5670,7 @@ static struct security_operations selinux_ops = { · 1295 unmodified lines | ||
| 5664 | 5670 | .tun_dev_attach_queue = selinux_tun_dev_attach_queue, |
| 5665 | 5671 | .tun_dev_attach = selinux_tun_dev_attach, |
| 5666 | 5672 | .tun_dev_open = selinux_tun_dev_open, |
| 5673 | + .skb_owned_by = selinux_skb_owned_by, | |
| 5667 | 5674 | |
| 5668 | 5675 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
| 5669 | 5676 | .xfrm_policy_alloc_security = selinux_xfrm_policy_alloc, |
| @@ -3222,18 +3222,10 @@ EXPORT_SYMBOL_GPL(snd_pcm_lib_default_mmap); · 3221 unmodified lines | ||
| 3222 | 3222 | int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, |
| 3223 | 3223 | struct vm_area_struct *area) |
| 3224 | 3224 | { |
| 3225 | − long size; | |
| 3226 | − unsigned long offset; | |
| 3225 | + struct snd_pcm_runtime *runtime = substream->runtime;; | |
| 3227 | 3226 | |
| 3228 | 3227 | area->vm_page_prot = pgprot_noncached(area->vm_page_prot); |
| 3229 | − area->vm_flags |= VM_IO; | |
| 3230 | − size = area->vm_end - area->vm_start; | |
| 3231 | − offset = area->vm_pgoff << PAGE_SHIFT; | |
| 3232 | − if (io_remap_pfn_range(area, area->vm_start, | |
| 3233 | − (substream->runtime->dma_addr + offset) >> PAGE_SHIFT, | |
| 3234 | − size, area->vm_page_prot)) | |
| 3235 | − return -EAGAIN; | |
| 3236 | − return 0; | |
| 3228 | + return vm_iomap_memory(area, runtime->dma_addr, runtime->dma_bytes); | |
| 3237 | 3229 | } |
| 3238 | 3230 | |
| 3239 | 3231 | EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem); |
| @@ -584,7 +584,7 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w, · 583 unmodified lines | ||
| 584 | 584 | struct snd_kcontrol *kcontrol, int event) |
| 585 | 585 | { |
| 586 | 586 | struct snd_soc_codec *codec = w->codec; |
| 587 | − struct arizona *arizona = dev_get_drvdata(codec->dev); | |
| 587 | + struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | |
| 588 | 588 | struct regmap *regmap = codec->control_data; |
| 589 | 589 | const struct reg_default *patch = NULL; |
| 590 | 590 | int i, patch_size; |
| @@ -1083,6 +1083,8 @@ static const struct snd_soc_dapm_route wm8903_intercon[] = { · 1082 unmodified lines | ||
| 1083 | 1083 | { "ROP", NULL, "Right Speaker PGA" }, |
| 1084 | 1084 | { "RON", NULL, "Right Speaker PGA" }, |
| 1085 | 1085 | |
| 1086 | + { "Charge Pump", NULL, "CLK_DSP" }, | |
| 1087 | + | |
| 1086 | 1088 | { "Left Headphone Output PGA", NULL, "Charge Pump" }, |
| 1087 | 1089 | { "Right Headphone Output PGA", NULL, "Charge Pump" }, |
| 1088 | 1090 | { "Left Line Output PGA", NULL, "Charge Pump" }, |
| @@ -972,6 +972,7 @@ static const struct snd_soc_dai_ops samsung_i2s_dai_ops = { · 971 unmodified lines | ||
| 972 | 972 | static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) |
| 973 | 973 | { |
| 974 | 974 | struct i2s_dai *i2s; |
| 975 | + int ret; | |
| 975 | 976 | |
| 976 | 977 | i2s = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dai), GFP_KERNEL); |
| 977 | 978 | if (i2s == NULL) |
| @@ -996,15 +997,17 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) · 18 unmodified lines | ||
| 996 | 997 | i2s->i2s_dai_drv.capture.channels_max = 2; |
| 997 | 998 | i2s->i2s_dai_drv.capture.rates = SAMSUNG_I2S_RATES; |
| 998 | 999 | i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS; |
| 1000 | + dev_set_drvdata(&i2s->pdev->dev, i2s); | |
| 999 | 1001 | } else { /* Create a new platform_device for Secondary */ |
| 1000 | − i2s->pdev = platform_device_register_resndata(NULL, | |
| 1001 | − "samsung-i2s-sec", -1, NULL, 0, NULL, 0); | |
| 1002 | + i2s->pdev = platform_device_alloc("samsung-i2s-sec", -1); | |
| 1002 | 1003 | if (IS_ERR(i2s->pdev)) |
| 1003 | 1004 | return NULL; |
| 1004 | − } | |
| 1005 | 1005 | |
| 1006 | − /* Pre-assign snd_soc_dai_set_drvdata */ | |
| 1007 | − dev_set_drvdata(&i2s->pdev->dev, i2s); | |
| 1006 | + platform_set_drvdata(i2s->pdev, i2s); | |
| 1007 | + ret = platform_device_add(i2s->pdev); | |
| 1008 | + if (ret < 0) | |
| 1009 | + return NULL; | |
| 1010 | + } | |
| 1008 | 1011 | |
| 1009 | 1012 | return i2s; |
| 1010 | 1013 | } |
| @@ -1107,6 +1110,10 @@ static int samsung_i2s_probe(struct platform_device *pdev) · 96 unmodified lines | ||
| 1107 | 1110 | |
| 1108 | 1111 | if (samsung_dai_type == TYPE_SEC) { |
| 1109 | 1112 | sec_dai = dev_get_drvdata(&pdev->dev); |
| 1113 | + if (!sec_dai) { | |
| 1114 | + dev_err(&pdev->dev, "Unable to get drvdata\n"); | |
| 1115 | + return -EFAULT; | |
| 1116 | + } | |
| 1110 | 1117 | snd_soc_register_dai(&sec_dai->pdev->dev, |
| 1111 | 1118 | &sec_dai->i2s_dai_drv); |
| 1112 | 1119 | asoc_dma_platform_register(&pdev->dev); |
| @@ -211,19 +211,27 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream, · 210 unmodified lines | ||
| 211 | 211 | if (platform->driver->compr_ops && platform->driver->compr_ops->set_params) { |
| 212 | 212 | ret = platform->driver->compr_ops->set_params(cstream, params); |
| 213 | 213 | if (ret < 0) |
| 214 | − goto out; | |
| 214 | + goto err; | |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->set_params) { |
| 218 | 218 | ret = rtd->dai_link->compr_ops->set_params(cstream); |
| 219 | 219 | if (ret < 0) |
| 220 | − goto out; | |
| 220 | + goto err; | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK, |
| 224 | 224 | SND_SOC_DAPM_STREAM_START); |
| 225 | 225 | |
| 226 | −out: | |
| 226 | + /* cancel any delayed stream shutdown that is pending */ | |
| 227 | + rtd->pop_wait = 0; | |
| 228 | + mutex_unlock(&rtd->pcm_mutex); | |
| 229 | + | |
| 230 | + cancel_delayed_work_sync(&rtd->delayed_work); | |
| 231 | + | |
| 232 | + return ret; | |
| 233 | + | |
| 234 | +err: | |
| 227 | 235 | mutex_unlock(&rtd->pcm_mutex); |
| 228 | 236 | return ret; |
| 229 | 237 | } |
| @@ -2963,7 +2963,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, · 2962 unmodified lines | ||
| 2963 | 2963 | val = val << shift; |
| 2964 | 2964 | |
| 2965 | 2965 | ret = snd_soc_update_bits_locked(codec, reg, val_mask, val); |
| 2966 | − if (ret != 0) | |
| 2966 | + if (ret < 0) | |
| 2967 | 2967 | return ret; |
| 2968 | 2968 | |
| 2969 | 2969 | if (snd_soc_volsw_is_stereo(mc)) { |
| @@ -43,8 +43,6 @@ · 42 unmodified lines | ||
| 43 | 43 | static const struct snd_pcm_hardware tegra_pcm_hardware = { |
| 44 | 44 | .info = SNDRV_PCM_INFO_MMAP | |
| 45 | 45 | SNDRV_PCM_INFO_MMAP_VALID | |
| 46 | − SNDRV_PCM_INFO_PAUSE | | |
| 47 | − SNDRV_PCM_INFO_RESUME | | |
| 48 | 46 | SNDRV_PCM_INFO_INTERLEAVED, |
| 49 | 47 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
| 50 | 48 | .channels_min = 2, |
| @@ -127,26 +125,6 @@ static int tegra_pcm_hw_free(struct snd_pcm_substream *substream) · 76 unmodified lines | ||
| 127 | 125 | return 0; |
| 128 | 126 | } |
| 129 | 127 | |
| 130 | −static int tegra_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |
| 131 | −{ | |
| 132 | − switch (cmd) { | |
| 133 | − case SNDRV_PCM_TRIGGER_START: | |
| 134 | − case SNDRV_PCM_TRIGGER_RESUME: | |
| 135 | − case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | |
| 136 | − return snd_dmaengine_pcm_trigger(substream, | |
| 137 | − SNDRV_PCM_TRIGGER_START); | |
| 138 | − | |
| 139 | − case SNDRV_PCM_TRIGGER_STOP: | |
| 140 | − case SNDRV_PCM_TRIGGER_SUSPEND: | |
| 141 | − case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | |
| 142 | − return snd_dmaengine_pcm_trigger(substream, | |
| 143 | − SNDRV_PCM_TRIGGER_STOP); | |
| 144 | − default: | |
| 145 | − return -EINVAL; | |
| 146 | − } | |
| 147 | − return 0; | |
| 148 | −} | |
| 149 | − | |
| 150 | 128 | static int tegra_pcm_mmap(struct snd_pcm_substream *substream, |
| 151 | 129 | struct vm_area_struct *vma) |
| 152 | 130 | { |
| @@ -164,7 +142,7 @@ static struct snd_pcm_ops tegra_pcm_ops = { · 11 unmodified lines | ||
| 164 | 142 | .ioctl = snd_pcm_lib_ioctl, |
| 165 | 143 | .hw_params = tegra_pcm_hw_params, |
| 166 | 144 | .hw_free = tegra_pcm_hw_free, |
| 167 | − .trigger = tegra_pcm_trigger, | |
| 145 | + .trigger = snd_dmaengine_pcm_trigger, | |
| 168 | 146 | .pointer = snd_dmaengine_pcm_pointer, |
| 169 | 147 | .mmap = tegra_pcm_mmap, |
| 170 | 148 | }; |
| @@ -509,7 +509,7 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol, · 508 unmodified lines | ||
| 509 | 509 | else |
| 510 | 510 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, |
| 511 | 511 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
| 512 | − 0, cpu_to_le16(wIndex), | |
| 512 | + 0, wIndex, | |
| 513 | 513 | &tmp, sizeof(tmp), 1000); |
| 514 | 514 | up_read(&mixer->chip->shutdown_rwsem); |
| 515 | 515 | |
| @@ -540,7 +540,7 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol, · 24 unmodified lines | ||
| 540 | 540 | else |
| 541 | 541 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest, |
| 542 | 542 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
| 543 | − cpu_to_le16(wValue), cpu_to_le16(wIndex), | |
| 543 | + wValue, wIndex, | |
| 544 | 544 | NULL, 0, 1000); |
| 545 | 545 | up_read(&mixer->chip->shutdown_rwsem); |
| 546 | 546 | |
| @@ -486,7 +486,7 @@ static int snd_usb_nativeinstruments_boot_quirk(struct usb_device *dev) · 485 unmodified lines | ||
| 486 | 486 | { |
| 487 | 487 | int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
| 488 | 488 | 0xaf, USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 489 | − cpu_to_le16(1), 0, NULL, 0, 1000); | |
| 489 | + 1, 0, NULL, 0, 1000); | |
| 490 | 490 | |
| 491 | 491 | if (ret < 0) |
| 492 | 492 | return ret; |
| @@ -1421,6 +1421,7 @@ int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model) · 1420 unmodified lines | ||
| 1421 | 1421 | case 0x3C: /* HSW */ |
| 1422 | 1422 | case 0x3F: /* HSW */ |
| 1423 | 1423 | case 0x45: /* HSW */ |
| 1424 | + case 0x46: /* HSW */ | |
| 1424 | 1425 | return 1; |
| 1425 | 1426 | case 0x2E: /* Nehalem-EX Xeon - Beckton */ |
| 1426 | 1427 | case 0x2F: /* Westmere-EX Xeon - Eagleton */ |
| @@ -1515,6 +1516,7 @@ void rapl_probe(unsigned int family, unsigned int model) · 88 unmodified lines | ||
| 1515 | 1516 | case 0x3C: /* HSW */ |
| 1516 | 1517 | case 0x3F: /* HSW */ |
| 1517 | 1518 | case 0x45: /* HSW */ |
| 1519 | + case 0x46: /* HSW */ | |
| 1518 | 1520 | do_rapl = RAPL_PKG | RAPL_CORES | RAPL_GFX; |
| 1519 | 1521 | break; |
| 1520 | 1522 | case 0x2D: |
| @@ -1754,6 +1756,7 @@ int is_snb(unsigned int family, unsigned int model) · 233 unmodified lines | ||
| 1754 | 1756 | case 0x3C: /* HSW */ |
| 1755 | 1757 | case 0x3F: /* HSW */ |
| 1756 | 1758 | case 0x45: /* HSW */ |
| 1759 | + case 0x46: /* HSW */ | |
| 1757 | 1760 | return 1; |
| 1758 | 1761 | } |
| 1759 | 1762 | return 0; |
| @@ -2276,7 +2279,7 @@ int main(int argc, char **argv) · 516 unmodified lines | ||
| 2276 | 2279 | cmdline(argc, argv); |
| 2277 | 2280 | |
| 2278 | 2281 | if (verbose) |
| 2279 | − fprintf(stderr, "turbostat v3.2 February 11, 2013" | |
| 2282 | + fprintf(stderr, "turbostat v3.3 March 15, 2013" | |
| 2280 | 2283 | " - Len Brown <lenb@kernel.org>\n"); |
| 2281 | 2284 | |
| 2282 | 2285 | turbostat_init(); |
| @@ -1541,21 +1541,38 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, · 1540 unmodified lines | ||
| 1541 | 1541 | } |
| 1542 | 1542 | |
| 1543 | 1543 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
| 1544 | − gpa_t gpa) | |
| 1544 | + gpa_t gpa, unsigned long len) | |
| 1545 | 1545 | { |
| 1546 | 1546 | struct kvm_memslots *slots = kvm_memslots(kvm); |
| 1547 | 1547 | int offset = offset_in_page(gpa); |
| 1548 | − gfn_t gfn = gpa >> PAGE_SHIFT; | |
| 1548 | + gfn_t start_gfn = gpa >> PAGE_SHIFT; | |
| 1549 | + gfn_t end_gfn = (gpa + len - 1) >> PAGE_SHIFT; | |
| 1550 | + gfn_t nr_pages_needed = end_gfn - start_gfn + 1; | |
| 1551 | + gfn_t nr_pages_avail; | |
| 1549 | 1552 | |
| 1550 | 1553 | ghc->gpa = gpa; |
| 1551 | 1554 | ghc->generation = slots->generation; |
| 1552 | − ghc->memslot = gfn_to_memslot(kvm, gfn); | |
| 1553 | − ghc->hva = gfn_to_hva_many(ghc->memslot, gfn, NULL); | |
| 1554 | − if (!kvm_is_error_hva(ghc->hva)) | |
| 1555 | + ghc->len = len; | |
| 1556 | + ghc->memslot = gfn_to_memslot(kvm, start_gfn); | |
| 1557 | + ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, &nr_pages_avail); | |
| 1558 | + if (!kvm_is_error_hva(ghc->hva) && nr_pages_avail >= nr_pages_needed) { | |
| 1555 | 1559 | ghc->hva += offset; |
| 1556 | − else | |
| 1557 | − return -EFAULT; | |
| 1558 | − | |
| 1560 | + } else { | |
| 1561 | + /* | |
| 1562 | + * If the requested region crosses two memslots, we still | |
| 1563 | + * verify that the entire region is valid here. | |
| 1564 | + */ | |
| 1565 | + while (start_gfn <= end_gfn) { | |
| 1566 | + ghc->memslot = gfn_to_memslot(kvm, start_gfn); | |
| 1567 | + ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, | |
| 1568 | + &nr_pages_avail); | |
| 1569 | + if (kvm_is_error_hva(ghc->hva)) | |
| 1570 | + return -EFAULT; | |
| 1571 | + start_gfn += nr_pages_avail; | |
| 1572 | + } | |
| 1573 | + /* Use the slow path for cross page reads and writes. */ | |
| 1574 | + ghc->memslot = NULL; | |
| 1575 | + } | |
| 1559 | 1576 | return 0; |
| 1560 | 1577 | } |
| 1561 | 1578 | EXPORT_SYMBOL_GPL(kvm_gfn_to_hva_cache_init); |
| @@ -1566,8 +1583,13 @@ int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, · 4 unmodified lines | ||
| 1566 | 1583 | struct kvm_memslots *slots = kvm_memslots(kvm); |
| 1567 | 1584 | int r; |
| 1568 | 1585 | |
| 1586 | + BUG_ON(len > ghc->len); | |
| 1587 | + | |
| 1569 | 1588 | if (slots->generation != ghc->generation) |
| 1570 | − kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa); | |
| 1589 | + kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len); | |
| 1590 | + | |
| 1591 | + if (unlikely(!ghc->memslot)) | |
| 1592 | + return kvm_write_guest(kvm, ghc->gpa, data, len); | |
| 1571 | 1593 | |
| 1572 | 1594 | if (kvm_is_error_hva(ghc->hva)) |
| 1573 | 1595 | return -EFAULT; |
| @@ -1587,8 +1609,13 @@ int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, · 13 unmodified lines | ||
| 1587 | 1609 | struct kvm_memslots *slots = kvm_memslots(kvm); |
| 1588 | 1610 | int r; |
| 1589 | 1611 | |
| 1612 | + BUG_ON(len > ghc->len); | |
| 1613 | + | |
| 1590 | 1614 | if (slots->generation != ghc->generation) |
| 1591 | − kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa); | |
| 1615 | + kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len); | |
| 1616 | + | |
| 1617 | + if (unlikely(!ghc->memslot)) | |
| 1618 | + return kvm_read_guest(kvm, ghc->gpa, data, len); | |
| 1592 | 1619 | |
| 1593 | 1620 | if (kvm_is_error_hva(ghc->hva)) |
| 1594 | 1621 | return -EFAULT; |