diff options
176 files changed, 1221 insertions, 1049 deletions
diff --git a/Documentation/media/uapi/cec/cec-func-close.rst b/Documentation/media/uapi/cec/cec-func-close.rst index 8267c31b317d..895d9c2d1c04 100644 --- a/Documentation/media/uapi/cec/cec-func-close.rst +++ b/Documentation/media/uapi/cec/cec-func-close.rst | |||
@@ -33,11 +33,6 @@ Arguments | |||
33 | Description | 33 | Description |
34 | =========== | 34 | =========== |
35 | 35 | ||
36 | .. note:: | ||
37 | |||
38 | This documents the proposed CEC API. This API is not yet finalized | ||
39 | and is currently only available as a staging kernel module. | ||
40 | |||
41 | Closes the cec device. Resources associated with the file descriptor are | 36 | Closes the cec device. Resources associated with the file descriptor are |
42 | freed. The device configuration remain unchanged. | 37 | freed. The device configuration remain unchanged. |
43 | 38 | ||
diff --git a/Documentation/media/uapi/cec/cec-func-ioctl.rst b/Documentation/media/uapi/cec/cec-func-ioctl.rst index 9e8dbb118d6a..7dcfd178fb24 100644 --- a/Documentation/media/uapi/cec/cec-func-ioctl.rst +++ b/Documentation/media/uapi/cec/cec-func-ioctl.rst | |||
@@ -39,11 +39,6 @@ Arguments | |||
39 | Description | 39 | Description |
40 | =========== | 40 | =========== |
41 | 41 | ||
42 | .. note:: | ||
43 | |||
44 | This documents the proposed CEC API. This API is not yet finalized | ||
45 | and is currently only available as a staging kernel module. | ||
46 | |||
47 | The :c:func:`ioctl()` function manipulates cec device parameters. The | 42 | The :c:func:`ioctl()` function manipulates cec device parameters. The |
48 | argument ``fd`` must be an open file descriptor. | 43 | argument ``fd`` must be an open file descriptor. |
49 | 44 | ||
diff --git a/Documentation/media/uapi/cec/cec-func-open.rst b/Documentation/media/uapi/cec/cec-func-open.rst index af3f5b5c24c6..0304388cd159 100644 --- a/Documentation/media/uapi/cec/cec-func-open.rst +++ b/Documentation/media/uapi/cec/cec-func-open.rst | |||
@@ -46,11 +46,6 @@ Arguments | |||
46 | Description | 46 | Description |
47 | =========== | 47 | =========== |
48 | 48 | ||
49 | .. note:: | ||
50 | |||
51 | This documents the proposed CEC API. This API is not yet finalized | ||
52 | and is currently only available as a staging kernel module. | ||
53 | |||
54 | To open a cec device applications call :c:func:`open()` with the | 49 | To open a cec device applications call :c:func:`open()` with the |
55 | desired device name. The function has no side effects; the device | 50 | desired device name. The function has no side effects; the device |
56 | configuration remain unchanged. | 51 | configuration remain unchanged. |
diff --git a/Documentation/media/uapi/cec/cec-func-poll.rst b/Documentation/media/uapi/cec/cec-func-poll.rst index cfb73e6027a5..6a863cfda6e0 100644 --- a/Documentation/media/uapi/cec/cec-func-poll.rst +++ b/Documentation/media/uapi/cec/cec-func-poll.rst | |||
@@ -39,11 +39,6 @@ Arguments | |||
39 | Description | 39 | Description |
40 | =========== | 40 | =========== |
41 | 41 | ||
42 | .. note:: | ||
43 | |||
44 | This documents the proposed CEC API. This API is not yet finalized | ||
45 | and is currently only available as a staging kernel module. | ||
46 | |||
47 | With the :c:func:`poll()` function applications can wait for CEC | 42 | With the :c:func:`poll()` function applications can wait for CEC |
48 | events. | 43 | events. |
49 | 44 | ||
diff --git a/Documentation/media/uapi/cec/cec-intro.rst b/Documentation/media/uapi/cec/cec-intro.rst index 4a19ea5323a9..07ee2b8f89d6 100644 --- a/Documentation/media/uapi/cec/cec-intro.rst +++ b/Documentation/media/uapi/cec/cec-intro.rst | |||
@@ -3,11 +3,6 @@ | |||
3 | Introduction | 3 | Introduction |
4 | ============ | 4 | ============ |
5 | 5 | ||
6 | .. note:: | ||
7 | |||
8 | This documents the proposed CEC API. This API is not yet finalized | ||
9 | and is currently only available as a staging kernel module. | ||
10 | |||
11 | HDMI connectors provide a single pin for use by the Consumer Electronics | 6 | HDMI connectors provide a single pin for use by the Consumer Electronics |
12 | Control protocol. This protocol allows different devices connected by an | 7 | Control protocol. This protocol allows different devices connected by an |
13 | HDMI cable to communicate. The protocol for CEC version 1.4 is defined | 8 | HDMI cable to communicate. The protocol for CEC version 1.4 is defined |
@@ -31,3 +26,15 @@ control just the CEC pin. | |||
31 | Drivers that support CEC will create a CEC device node (/dev/cecX) to | 26 | Drivers that support CEC will create a CEC device node (/dev/cecX) to |
32 | give userspace access to the CEC adapter. The | 27 | give userspace access to the CEC adapter. The |
33 | :ref:`CEC_ADAP_G_CAPS` ioctl will tell userspace what it is allowed to do. | 28 | :ref:`CEC_ADAP_G_CAPS` ioctl will tell userspace what it is allowed to do. |
29 | |||
30 | In order to check the support and test it, it is suggested to download | ||
31 | the `v4l-utils <https://git.linuxtv.org/v4l-utils.git/>`_ package. It | ||
32 | provides three tools to handle CEC: | ||
33 | |||
34 | - cec-ctl: the Swiss army knife of CEC. Allows you to configure, transmit | ||
35 | and monitor CEC messages. | ||
36 | |||
37 | - cec-compliance: does a CEC compliance test of a remote CEC device to | ||
38 | determine how compliant the CEC implementation is. | ||
39 | |||
40 | - cec-follower: emulates a CEC follower. | ||
diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst index 2b0ddb14b280..a0e961f11017 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst | |||
@@ -29,11 +29,6 @@ Arguments | |||
29 | Description | 29 | Description |
30 | =========== | 30 | =========== |
31 | 31 | ||
32 | .. note:: | ||
33 | |||
34 | This documents the proposed CEC API. This API is not yet finalized | ||
35 | and is currently only available as a staging kernel module. | ||
36 | |||
37 | All cec devices must support :ref:`ioctl CEC_ADAP_G_CAPS <CEC_ADAP_G_CAPS>`. To query | 32 | All cec devices must support :ref:`ioctl CEC_ADAP_G_CAPS <CEC_ADAP_G_CAPS>`. To query |
38 | device information, applications call the ioctl with a pointer to a | 33 | device information, applications call the ioctl with a pointer to a |
39 | struct :c:type:`cec_caps`. The driver fills the structure and | 34 | struct :c:type:`cec_caps`. The driver fills the structure and |
diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst index b878637e91b3..09f09bbe28d4 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst | |||
@@ -35,11 +35,6 @@ Arguments | |||
35 | Description | 35 | Description |
36 | =========== | 36 | =========== |
37 | 37 | ||
38 | .. note:: | ||
39 | |||
40 | This documents the proposed CEC API. This API is not yet finalized | ||
41 | and is currently only available as a staging kernel module. | ||
42 | |||
43 | To query the current CEC logical addresses, applications call | 38 | To query the current CEC logical addresses, applications call |
44 | :ref:`ioctl CEC_ADAP_G_LOG_ADDRS <CEC_ADAP_G_LOG_ADDRS>` with a pointer to a | 39 | :ref:`ioctl CEC_ADAP_G_LOG_ADDRS <CEC_ADAP_G_LOG_ADDRS>` with a pointer to a |
45 | struct :c:type:`cec_log_addrs` where the driver stores the logical addresses. | 40 | struct :c:type:`cec_log_addrs` where the driver stores the logical addresses. |
diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst index 3357deb43c85..a3cdc75cec3e 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst | |||
@@ -35,11 +35,6 @@ Arguments | |||
35 | Description | 35 | Description |
36 | =========== | 36 | =========== |
37 | 37 | ||
38 | .. note:: | ||
39 | |||
40 | This documents the proposed CEC API. This API is not yet finalized | ||
41 | and is currently only available as a staging kernel module. | ||
42 | |||
43 | To query the current physical address applications call | 38 | To query the current physical address applications call |
44 | :ref:`ioctl CEC_ADAP_G_PHYS_ADDR <CEC_ADAP_G_PHYS_ADDR>` with a pointer to a __u16 where the | 39 | :ref:`ioctl CEC_ADAP_G_PHYS_ADDR <CEC_ADAP_G_PHYS_ADDR>` with a pointer to a __u16 where the |
45 | driver stores the physical address. | 40 | driver stores the physical address. |
diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst index e256c6605de7..6e589a1fae17 100644 --- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst | |||
@@ -30,11 +30,6 @@ Arguments | |||
30 | Description | 30 | Description |
31 | =========== | 31 | =========== |
32 | 32 | ||
33 | .. note:: | ||
34 | |||
35 | This documents the proposed CEC API. This API is not yet finalized | ||
36 | and is currently only available as a staging kernel module. | ||
37 | |||
38 | CEC devices can send asynchronous events. These can be retrieved by | 33 | CEC devices can send asynchronous events. These can be retrieved by |
39 | calling :c:func:`CEC_DQEVENT`. If the file descriptor is in | 34 | calling :c:func:`CEC_DQEVENT`. If the file descriptor is in |
40 | non-blocking mode and no event is pending, then it will return -1 and | 35 | non-blocking mode and no event is pending, then it will return -1 and |
diff --git a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst index 4f5818b9d277..e4ded9df0a84 100644 --- a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst +++ b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst | |||
@@ -31,11 +31,6 @@ Arguments | |||
31 | Description | 31 | Description |
32 | =========== | 32 | =========== |
33 | 33 | ||
34 | .. note:: | ||
35 | |||
36 | This documents the proposed CEC API. This API is not yet finalized | ||
37 | and is currently only available as a staging kernel module. | ||
38 | |||
39 | By default any filehandle can use :ref:`CEC_TRANSMIT`, but in order to prevent | 34 | By default any filehandle can use :ref:`CEC_TRANSMIT`, but in order to prevent |
40 | applications from stepping on each others toes it must be possible to | 35 | applications from stepping on each others toes it must be possible to |
41 | obtain exclusive access to the CEC adapter. This ioctl sets the | 36 | obtain exclusive access to the CEC adapter. This ioctl sets the |
diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst index bdf015b1d1dc..dc2adb391c0a 100644 --- a/Documentation/media/uapi/cec/cec-ioc-receive.rst +++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst | |||
@@ -34,11 +34,6 @@ Arguments | |||
34 | Description | 34 | Description |
35 | =========== | 35 | =========== |
36 | 36 | ||
37 | .. note:: | ||
38 | |||
39 | This documents the proposed CEC API. This API is not yet finalized | ||
40 | and is currently only available as a staging kernel module. | ||
41 | |||
42 | To receive a CEC message the application has to fill in the | 37 | To receive a CEC message the application has to fill in the |
43 | ``timeout`` field of struct :c:type:`cec_msg` and pass it to | 38 | ``timeout`` field of struct :c:type:`cec_msg` and pass it to |
44 | :ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>`. | 39 | :ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>`. |
diff --git a/MAINTAINERS b/MAINTAINERS index a9368bba9b37..93a41ef97f18 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -13101,7 +13101,7 @@ F: drivers/input/serio/userio.c | |||
13101 | F: include/uapi/linux/userio.h | 13101 | F: include/uapi/linux/userio.h |
13102 | 13102 | ||
13103 | VIRTIO CONSOLE DRIVER | 13103 | VIRTIO CONSOLE DRIVER |
13104 | M: Amit Shah <amit.shah@redhat.com> | 13104 | M: Amit Shah <amit@kernel.org> |
13105 | L: virtualization@lists.linux-foundation.org | 13105 | L: virtualization@lists.linux-foundation.org |
13106 | S: Maintained | 13106 | S: Maintained |
13107 | F: drivers/char/virtio_console.c | 13107 | F: drivers/char/virtio_console.c |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 10 | 2 | PATCHLEVEL = 10 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc6 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Fearless Coyote | 5 | NAME = Fearless Coyote |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -797,7 +797,7 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) | |||
797 | KBUILD_ARFLAGS := $(call ar-option,D) | 797 | KBUILD_ARFLAGS := $(call ar-option,D) |
798 | 798 | ||
799 | # check for 'asm goto' | 799 | # check for 'asm goto' |
800 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y) | 800 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) |
801 | KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO | 801 | KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO |
802 | KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO | 802 | KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO |
803 | endif | 803 | endif |
diff --git a/arch/arc/kernel/unaligned.c b/arch/arc/kernel/unaligned.c index 91ebe382147f..5f69c3bd59bb 100644 --- a/arch/arc/kernel/unaligned.c +++ b/arch/arc/kernel/unaligned.c | |||
@@ -243,7 +243,7 @@ int misaligned_fixup(unsigned long address, struct pt_regs *regs, | |||
243 | 243 | ||
244 | /* clear any remanants of delay slot */ | 244 | /* clear any remanants of delay slot */ |
245 | if (delay_mode(regs)) { | 245 | if (delay_mode(regs)) { |
246 | regs->ret = regs->bta ~1U; | 246 | regs->ret = regs->bta & ~1U; |
247 | regs->status32 &= ~STATUS_DE_MASK; | 247 | regs->status32 &= ~STATUS_DE_MASK; |
248 | } else { | 248 | } else { |
249 | regs->ret += state.instr_len; | 249 | regs->ret += state.instr_len; |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index a8ee573fe610..281f4f1fcd1f 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -164,7 +164,6 @@ config PPC | |||
164 | select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE | 164 | select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE |
165 | select HAVE_ARCH_HARDENED_USERCOPY | 165 | select HAVE_ARCH_HARDENED_USERCOPY |
166 | select HAVE_KERNEL_GZIP | 166 | select HAVE_KERNEL_GZIP |
167 | select HAVE_CC_STACKPROTECTOR | ||
168 | 167 | ||
169 | config GENERIC_CSUM | 168 | config GENERIC_CSUM |
170 | def_bool CPU_LITTLE_ENDIAN | 169 | def_bool CPU_LITTLE_ENDIAN |
@@ -484,6 +483,7 @@ config RELOCATABLE | |||
484 | bool "Build a relocatable kernel" | 483 | bool "Build a relocatable kernel" |
485 | depends on (PPC64 && !COMPILE_TEST) || (FLATMEM && (44x || FSL_BOOKE)) | 484 | depends on (PPC64 && !COMPILE_TEST) || (FLATMEM && (44x || FSL_BOOKE)) |
486 | select NONSTATIC_KERNEL | 485 | select NONSTATIC_KERNEL |
486 | select MODULE_REL_CRCS if MODVERSIONS | ||
487 | help | 487 | help |
488 | This builds a kernel image that is capable of running at the | 488 | This builds a kernel image that is capable of running at the |
489 | location the kernel is loaded at. For ppc32, there is no any | 489 | location the kernel is loaded at. For ppc32, there is no any |
diff --git a/arch/powerpc/include/asm/cpu_has_feature.h b/arch/powerpc/include/asm/cpu_has_feature.h index b312b152461b..6e834caa3720 100644 --- a/arch/powerpc/include/asm/cpu_has_feature.h +++ b/arch/powerpc/include/asm/cpu_has_feature.h | |||
@@ -23,7 +23,9 @@ static __always_inline bool cpu_has_feature(unsigned long feature) | |||
23 | { | 23 | { |
24 | int i; | 24 | int i; |
25 | 25 | ||
26 | #ifndef __clang__ /* clang can't cope with this */ | ||
26 | BUILD_BUG_ON(!__builtin_constant_p(feature)); | 27 | BUILD_BUG_ON(!__builtin_constant_p(feature)); |
28 | #endif | ||
27 | 29 | ||
28 | #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG | 30 | #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG |
29 | if (!static_key_initialized) { | 31 | if (!static_key_initialized) { |
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index a34c764ca8dd..233a7e8cc8e3 100644 --- a/arch/powerpc/include/asm/mmu.h +++ b/arch/powerpc/include/asm/mmu.h | |||
@@ -160,7 +160,9 @@ static __always_inline bool mmu_has_feature(unsigned long feature) | |||
160 | { | 160 | { |
161 | int i; | 161 | int i; |
162 | 162 | ||
163 | #ifndef __clang__ /* clang can't cope with this */ | ||
163 | BUILD_BUG_ON(!__builtin_constant_p(feature)); | 164 | BUILD_BUG_ON(!__builtin_constant_p(feature)); |
165 | #endif | ||
164 | 166 | ||
165 | #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG | 167 | #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG |
166 | if (!static_key_initialized) { | 168 | if (!static_key_initialized) { |
diff --git a/arch/powerpc/include/asm/module.h b/arch/powerpc/include/asm/module.h index cc12c61ef315..53885512b8d3 100644 --- a/arch/powerpc/include/asm/module.h +++ b/arch/powerpc/include/asm/module.h | |||
@@ -90,9 +90,5 @@ static inline int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sec | |||
90 | } | 90 | } |
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | #if defined(CONFIG_MODVERSIONS) && defined(CONFIG_PPC64) | ||
94 | #define ARCH_RELOCATES_KCRCTAB | ||
95 | #define reloc_start PHYSICAL_START | ||
96 | #endif | ||
97 | #endif /* __KERNEL__ */ | 93 | #endif /* __KERNEL__ */ |
98 | #endif /* _ASM_POWERPC_MODULE_H */ | 94 | #endif /* _ASM_POWERPC_MODULE_H */ |
diff --git a/arch/powerpc/include/asm/stackprotector.h b/arch/powerpc/include/asm/stackprotector.h deleted file mode 100644 index 6720190eabec..000000000000 --- a/arch/powerpc/include/asm/stackprotector.h +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * GCC stack protector support. | ||
3 | * | ||
4 | * Stack protector works by putting predefined pattern at the start of | ||
5 | * the stack frame and verifying that it hasn't been overwritten when | ||
6 | * returning from the function. The pattern is called stack canary | ||
7 | * and gcc expects it to be defined by a global variable called | ||
8 | * "__stack_chk_guard" on PPC. This unfortunately means that on SMP | ||
9 | * we cannot have a different canary value per task. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_STACKPROTECTOR_H | ||
13 | #define _ASM_STACKPROTECTOR_H | ||
14 | |||
15 | #include <linux/random.h> | ||
16 | #include <linux/version.h> | ||
17 | #include <asm/reg.h> | ||
18 | |||
19 | extern unsigned long __stack_chk_guard; | ||
20 | |||
21 | /* | ||
22 | * Initialize the stackprotector canary value. | ||
23 | * | ||
24 | * NOTE: this must only be called from functions that never return, | ||
25 | * and it must always be inlined. | ||
26 | */ | ||
27 | static __always_inline void boot_init_stack_canary(void) | ||
28 | { | ||
29 | unsigned long canary; | ||
30 | |||
31 | /* Try to get a semi random initial value. */ | ||
32 | get_random_bytes(&canary, sizeof(canary)); | ||
33 | canary ^= mftb(); | ||
34 | canary ^= LINUX_VERSION_CODE; | ||
35 | |||
36 | current->stack_canary = canary; | ||
37 | __stack_chk_guard = current->stack_canary; | ||
38 | } | ||
39 | |||
40 | #endif /* _ASM_STACKPROTECTOR_H */ | ||
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 23f8082d7bfa..f4c2b52e58b3 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -19,10 +19,6 @@ CFLAGS_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) | |||
19 | CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) | 19 | CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) |
20 | CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) | 20 | CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) |
21 | 21 | ||
22 | # -fstack-protector triggers protection checks in this code, | ||
23 | # but it is being used too early to link to meaningful stack_chk logic. | ||
24 | CFLAGS_prom_init.o += $(call cc-option, -fno-stack-protector) | ||
25 | |||
26 | ifdef CONFIG_FUNCTION_TRACER | 22 | ifdef CONFIG_FUNCTION_TRACER |
27 | # Do not trace early boot code | 23 | # Do not trace early boot code |
28 | CFLAGS_REMOVE_cputable.o = -mno-sched-epilog $(CC_FLAGS_FTRACE) | 24 | CFLAGS_REMOVE_cputable.o = -mno-sched-epilog $(CC_FLAGS_FTRACE) |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 0601e6a7297c..195a9fc8f81c 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -91,9 +91,6 @@ int main(void) | |||
91 | DEFINE(TI_livepatch_sp, offsetof(struct thread_info, livepatch_sp)); | 91 | DEFINE(TI_livepatch_sp, offsetof(struct thread_info, livepatch_sp)); |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
95 | DEFINE(TSK_STACK_CANARY, offsetof(struct task_struct, stack_canary)); | ||
96 | #endif | ||
97 | DEFINE(KSP, offsetof(struct thread_struct, ksp)); | 94 | DEFINE(KSP, offsetof(struct thread_struct, ksp)); |
98 | DEFINE(PT_REGS, offsetof(struct thread_struct, regs)); | 95 | DEFINE(PT_REGS, offsetof(struct thread_struct, regs)); |
99 | #ifdef CONFIG_BOOKE | 96 | #ifdef CONFIG_BOOKE |
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c index d88573bdd090..b94887165a10 100644 --- a/arch/powerpc/kernel/eeh_driver.c +++ b/arch/powerpc/kernel/eeh_driver.c | |||
@@ -545,7 +545,7 @@ static void *eeh_pe_detach_dev(void *data, void *userdata) | |||
545 | static void *__eeh_clear_pe_frozen_state(void *data, void *flag) | 545 | static void *__eeh_clear_pe_frozen_state(void *data, void *flag) |
546 | { | 546 | { |
547 | struct eeh_pe *pe = (struct eeh_pe *)data; | 547 | struct eeh_pe *pe = (struct eeh_pe *)data; |
548 | bool *clear_sw_state = flag; | 548 | bool clear_sw_state = *(bool *)flag; |
549 | int i, rc = 1; | 549 | int i, rc = 1; |
550 | 550 | ||
551 | for (i = 0; rc && i < 3; i++) | 551 | for (i = 0; rc && i < 3; i++) |
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 5742dbdbee46..3841d749a430 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -674,11 +674,7 @@ BEGIN_FTR_SECTION | |||
674 | mtspr SPRN_SPEFSCR,r0 /* restore SPEFSCR reg */ | 674 | mtspr SPRN_SPEFSCR,r0 /* restore SPEFSCR reg */ |
675 | END_FTR_SECTION_IFSET(CPU_FTR_SPE) | 675 | END_FTR_SECTION_IFSET(CPU_FTR_SPE) |
676 | #endif /* CONFIG_SPE */ | 676 | #endif /* CONFIG_SPE */ |
677 | #if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) | 677 | |
678 | lwz r0,TSK_STACK_CANARY(r2) | ||
679 | lis r4,__stack_chk_guard@ha | ||
680 | stw r0,__stack_chk_guard@l(r4) | ||
681 | #endif | ||
682 | lwz r0,_CCR(r1) | 678 | lwz r0,_CCR(r1) |
683 | mtcrf 0xFF,r0 | 679 | mtcrf 0xFF,r0 |
684 | /* r3-r12 are destroyed -- Cort */ | 680 | /* r3-r12 are destroyed -- Cort */ |
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index bb1807184bad..0b0f89685b67 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c | |||
@@ -286,14 +286,6 @@ static void dedotify_versions(struct modversion_info *vers, | |||
286 | for (end = (void *)vers + size; vers < end; vers++) | 286 | for (end = (void *)vers + size; vers < end; vers++) |
287 | if (vers->name[0] == '.') { | 287 | if (vers->name[0] == '.') { |
288 | memmove(vers->name, vers->name+1, strlen(vers->name)); | 288 | memmove(vers->name, vers->name+1, strlen(vers->name)); |
289 | #ifdef ARCH_RELOCATES_KCRCTAB | ||
290 | /* The TOC symbol has no CRC computed. To avoid CRC | ||
291 | * check failing, we must force it to the expected | ||
292 | * value (see CRC check in module.c). | ||
293 | */ | ||
294 | if (!strcmp(vers->name, "TOC.")) | ||
295 | vers->crc = -(unsigned long)reloc_start; | ||
296 | #endif | ||
297 | } | 289 | } |
298 | } | 290 | } |
299 | 291 | ||
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 04885cec24df..5dd056df0baa 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -64,12 +64,6 @@ | |||
64 | #include <linux/kprobes.h> | 64 | #include <linux/kprobes.h> |
65 | #include <linux/kdebug.h> | 65 | #include <linux/kdebug.h> |
66 | 66 | ||
67 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
68 | #include <linux/stackprotector.h> | ||
69 | unsigned long __stack_chk_guard __read_mostly; | ||
70 | EXPORT_SYMBOL(__stack_chk_guard); | ||
71 | #endif | ||
72 | |||
73 | /* Transactional Memory debug */ | 67 | /* Transactional Memory debug */ |
74 | #ifdef TM_DEBUG_SW | 68 | #ifdef TM_DEBUG_SW |
75 | #define TM_DEBUG(x...) printk(KERN_INFO x) | 69 | #define TM_DEBUG(x...) printk(KERN_INFO x) |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index ec47a939cbdd..ac83eb04a8b8 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -2834,6 +2834,9 @@ static void __init prom_find_boot_cpu(void) | |||
2834 | 2834 | ||
2835 | cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu); | 2835 | cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu); |
2836 | 2836 | ||
2837 | if (!PHANDLE_VALID(cpu_pkg)) | ||
2838 | return; | ||
2839 | |||
2837 | prom_getprop(cpu_pkg, "reg", &rval, sizeof(rval)); | 2840 | prom_getprop(cpu_pkg, "reg", &rval, sizeof(rval)); |
2838 | prom.cpu = be32_to_cpu(rval); | 2841 | prom.cpu = be32_to_cpu(rval); |
2839 | 2842 | ||
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c index cfa53ccc8baf..34f1a0dbc898 100644 --- a/arch/powerpc/mm/pgtable-radix.c +++ b/arch/powerpc/mm/pgtable-radix.c | |||
@@ -65,7 +65,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa, | |||
65 | if (!pmdp) | 65 | if (!pmdp) |
66 | return -ENOMEM; | 66 | return -ENOMEM; |
67 | if (map_page_size == PMD_SIZE) { | 67 | if (map_page_size == PMD_SIZE) { |
68 | ptep = (pte_t *)pudp; | 68 | ptep = pmdp_ptep(pmdp); |
69 | goto set_the_pte; | 69 | goto set_the_pte; |
70 | } | 70 | } |
71 | ptep = pte_alloc_kernel(pmdp, ea); | 71 | ptep = pte_alloc_kernel(pmdp, ea); |
@@ -90,7 +90,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa, | |||
90 | } | 90 | } |
91 | pmdp = pmd_offset(pudp, ea); | 91 | pmdp = pmd_offset(pudp, ea); |
92 | if (map_page_size == PMD_SIZE) { | 92 | if (map_page_size == PMD_SIZE) { |
93 | ptep = (pte_t *)pudp; | 93 | ptep = pmdp_ptep(pmdp); |
94 | goto set_the_pte; | 94 | goto set_the_pte; |
95 | } | 95 | } |
96 | if (!pmd_present(*pmdp)) { | 96 | if (!pmd_present(*pmdp)) { |
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c index 6ef688a1ef3e..7ff1b0c86a8e 100644 --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c | |||
@@ -1085,9 +1085,9 @@ static void aesni_free_simds(void) | |||
1085 | aesni_simd_skciphers[i]; i++) | 1085 | aesni_simd_skciphers[i]; i++) |
1086 | simd_skcipher_free(aesni_simd_skciphers[i]); | 1086 | simd_skcipher_free(aesni_simd_skciphers[i]); |
1087 | 1087 | ||
1088 | for (i = 0; i < ARRAY_SIZE(aesni_simd_skciphers2) && | 1088 | for (i = 0; i < ARRAY_SIZE(aesni_simd_skciphers2); i++) |
1089 | aesni_simd_skciphers2[i].simd; i++) | 1089 | if (aesni_simd_skciphers2[i].simd) |
1090 | simd_skcipher_free(aesni_simd_skciphers2[i].simd); | 1090 | simd_skcipher_free(aesni_simd_skciphers2[i].simd); |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | static int __init aesni_init(void) | 1093 | static int __init aesni_init(void) |
@@ -1168,7 +1168,7 @@ static int __init aesni_init(void) | |||
1168 | simd = simd_skcipher_create_compat(algname, drvname, basename); | 1168 | simd = simd_skcipher_create_compat(algname, drvname, basename); |
1169 | err = PTR_ERR(simd); | 1169 | err = PTR_ERR(simd); |
1170 | if (IS_ERR(simd)) | 1170 | if (IS_ERR(simd)) |
1171 | goto unregister_simds; | 1171 | continue; |
1172 | 1172 | ||
1173 | aesni_simd_skciphers2[i].simd = simd; | 1173 | aesni_simd_skciphers2[i].simd = simd; |
1174 | } | 1174 | } |
diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c index 17c3564d087a..22ef4f72cf32 100644 --- a/arch/x86/events/intel/rapl.c +++ b/arch/x86/events/intel/rapl.c | |||
@@ -161,7 +161,13 @@ static u64 rapl_timer_ms; | |||
161 | 161 | ||
162 | static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu) | 162 | static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu) |
163 | { | 163 | { |
164 | return rapl_pmus->pmus[topology_logical_package_id(cpu)]; | 164 | unsigned int pkgid = topology_logical_package_id(cpu); |
165 | |||
166 | /* | ||
167 | * The unsigned check also catches the '-1' return value for non | ||
168 | * existent mappings in the topology map. | ||
169 | */ | ||
170 | return pkgid < rapl_pmus->maxpkg ? rapl_pmus->pmus[pkgid] : NULL; | ||
165 | } | 171 | } |
166 | 172 | ||
167 | static inline u64 rapl_read_counter(struct perf_event *event) | 173 | static inline u64 rapl_read_counter(struct perf_event *event) |
@@ -402,6 +408,8 @@ static int rapl_pmu_event_init(struct perf_event *event) | |||
402 | 408 | ||
403 | /* must be done before validate_group */ | 409 | /* must be done before validate_group */ |
404 | pmu = cpu_to_rapl_pmu(event->cpu); | 410 | pmu = cpu_to_rapl_pmu(event->cpu); |
411 | if (!pmu) | ||
412 | return -EINVAL; | ||
405 | event->cpu = pmu->cpu; | 413 | event->cpu = pmu->cpu; |
406 | event->pmu_private = pmu; | 414 | event->pmu_private = pmu; |
407 | event->hw.event_base = msr; | 415 | event->hw.event_base = msr; |
@@ -585,6 +593,20 @@ static int rapl_cpu_online(unsigned int cpu) | |||
585 | struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); | 593 | struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); |
586 | int target; | 594 | int target; |
587 | 595 | ||
596 | if (!pmu) { | ||
597 | pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); | ||
598 | if (!pmu) | ||
599 | return -ENOMEM; | ||
600 | |||
601 | raw_spin_lock_init(&pmu->lock); | ||
602 | INIT_LIST_HEAD(&pmu->active_list); | ||
603 | pmu->pmu = &rapl_pmus->pmu; | ||
604 | pmu->timer_interval = ms_to_ktime(rapl_timer_ms); | ||
605 | rapl_hrtimer_init(pmu); | ||
606 | |||
607 | rapl_pmus->pmus[topology_logical_package_id(cpu)] = pmu; | ||
608 | } | ||
609 | |||
588 | /* | 610 | /* |
589 | * Check if there is an online cpu in the package which collects rapl | 611 | * Check if there is an online cpu in the package which collects rapl |
590 | * events already. | 612 | * events already. |
@@ -598,27 +620,6 @@ static int rapl_cpu_online(unsigned int cpu) | |||
598 | return 0; | 620 | return 0; |
599 | } | 621 | } |
600 | 622 | ||
601 | static int rapl_cpu_prepare(unsigned int cpu) | ||
602 | { | ||
603 | struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); | ||
604 | |||
605 | if (pmu) | ||
606 | return 0; | ||
607 | |||
608 | pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); | ||
609 | if (!pmu) | ||
610 | return -ENOMEM; | ||
611 | |||
612 | raw_spin_lock_init(&pmu->lock); | ||
613 | INIT_LIST_HEAD(&pmu->active_list); | ||
614 | pmu->pmu = &rapl_pmus->pmu; | ||
615 | pmu->timer_interval = ms_to_ktime(rapl_timer_ms); | ||
616 | pmu->cpu = -1; | ||
617 | rapl_hrtimer_init(pmu); | ||
618 | rapl_pmus->pmus[topology_logical_package_id(cpu)] = pmu; | ||
619 | return 0; | ||
620 | } | ||
621 | |||
622 | static int rapl_check_hw_unit(bool apply_quirk) | 623 | static int rapl_check_hw_unit(bool apply_quirk) |
623 | { | 624 | { |
624 | u64 msr_rapl_power_unit_bits; | 625 | u64 msr_rapl_power_unit_bits; |
@@ -803,29 +804,21 @@ static int __init rapl_pmu_init(void) | |||
803 | /* | 804 | /* |
804 | * Install callbacks. Core will call them for each online cpu. | 805 | * Install callbacks. Core will call them for each online cpu. |
805 | */ | 806 | */ |
806 | |||
807 | ret = cpuhp_setup_state(CPUHP_PERF_X86_RAPL_PREP, "perf/x86/rapl:prepare", | ||
808 | rapl_cpu_prepare, NULL); | ||
809 | if (ret) | ||
810 | goto out; | ||
811 | |||
812 | ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_RAPL_ONLINE, | 807 | ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_RAPL_ONLINE, |
813 | "perf/x86/rapl:online", | 808 | "perf/x86/rapl:online", |
814 | rapl_cpu_online, rapl_cpu_offline); | 809 | rapl_cpu_online, rapl_cpu_offline); |
815 | if (ret) | 810 | if (ret) |
816 | goto out1; | 811 | goto out; |
817 | 812 | ||
818 | ret = perf_pmu_register(&rapl_pmus->pmu, "power", -1); | 813 | ret = perf_pmu_register(&rapl_pmus->pmu, "power", -1); |
819 | if (ret) | 814 | if (ret) |
820 | goto out2; | 815 | goto out1; |
821 | 816 | ||
822 | rapl_advertise(); | 817 | rapl_advertise(); |
823 | return 0; | 818 | return 0; |
824 | 819 | ||
825 | out2: | ||
826 | cpuhp_remove_state(CPUHP_AP_PERF_X86_RAPL_ONLINE); | ||
827 | out1: | 820 | out1: |
828 | cpuhp_remove_state(CPUHP_PERF_X86_RAPL_PREP); | 821 | cpuhp_remove_state(CPUHP_AP_PERF_X86_RAPL_ONLINE); |
829 | out: | 822 | out: |
830 | pr_warn("Initialization failed (%d), disabled\n", ret); | 823 | pr_warn("Initialization failed (%d), disabled\n", ret); |
831 | cleanup_rapl_pmus(); | 824 | cleanup_rapl_pmus(); |
@@ -836,7 +829,6 @@ module_init(rapl_pmu_init); | |||
836 | static void __exit intel_rapl_exit(void) | 829 | static void __exit intel_rapl_exit(void) |
837 | { | 830 | { |
838 | cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_RAPL_ONLINE); | 831 | cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_RAPL_ONLINE); |
839 | cpuhp_remove_state_nocalls(CPUHP_PERF_X86_RAPL_PREP); | ||
840 | perf_pmu_unregister(&rapl_pmus->pmu); | 832 | perf_pmu_unregister(&rapl_pmus->pmu); |
841 | cleanup_rapl_pmus(); | 833 | cleanup_rapl_pmus(); |
842 | } | 834 | } |
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 8c4ccdc3a3f3..1ab45976474d 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c | |||
@@ -100,7 +100,13 @@ ssize_t uncore_event_show(struct kobject *kobj, | |||
100 | 100 | ||
101 | struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu) | 101 | struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu) |
102 | { | 102 | { |
103 | return pmu->boxes[topology_logical_package_id(cpu)]; | 103 | unsigned int pkgid = topology_logical_package_id(cpu); |
104 | |||
105 | /* | ||
106 | * The unsigned check also catches the '-1' return value for non | ||
107 | * existent mappings in the topology map. | ||
108 | */ | ||
109 | return pkgid < max_packages ? pmu->boxes[pkgid] : NULL; | ||
104 | } | 110 | } |
105 | 111 | ||
106 | u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event) | 112 | u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event) |
@@ -764,30 +770,6 @@ static void uncore_pmu_unregister(struct intel_uncore_pmu *pmu) | |||
764 | pmu->registered = false; | 770 | pmu->registered = false; |
765 | } | 771 | } |
766 | 772 | ||
767 | static void __uncore_exit_boxes(struct intel_uncore_type *type, int cpu) | ||
768 | { | ||
769 | struct intel_uncore_pmu *pmu = type->pmus; | ||
770 | struct intel_uncore_box *box; | ||
771 | int i, pkg; | ||
772 | |||
773 | if (pmu) { | ||
774 | pkg = topology_physical_package_id(cpu); | ||
775 | for (i = 0; i < type->num_boxes; i++, pmu++) { | ||
776 | box = pmu->boxes[pkg]; | ||
777 | if (box) | ||
778 | uncore_box_exit(box); | ||
779 | } | ||
780 | } | ||
781 | } | ||
782 | |||
783 | static void uncore_exit_boxes(void *dummy) | ||
784 | { | ||
785 | struct intel_uncore_type **types; | ||
786 | |||
787 | for (types = uncore_msr_uncores; *types; types++) | ||
788 | __uncore_exit_boxes(*types++, smp_processor_id()); | ||
789 | } | ||
790 | |||
791 | static void uncore_free_boxes(struct intel_uncore_pmu *pmu) | 773 | static void uncore_free_boxes(struct intel_uncore_pmu *pmu) |
792 | { | 774 | { |
793 | int pkg; | 775 | int pkg; |
@@ -1058,86 +1040,6 @@ static void uncore_pci_exit(void) | |||
1058 | } | 1040 | } |
1059 | } | 1041 | } |
1060 | 1042 | ||
1061 | static int uncore_cpu_dying(unsigned int cpu) | ||
1062 | { | ||
1063 | struct intel_uncore_type *type, **types = uncore_msr_uncores; | ||
1064 | struct intel_uncore_pmu *pmu; | ||
1065 | struct intel_uncore_box *box; | ||
1066 | int i, pkg; | ||
1067 | |||
1068 | pkg = topology_logical_package_id(cpu); | ||
1069 | for (; *types; types++) { | ||
1070 | type = *types; | ||
1071 | pmu = type->pmus; | ||
1072 | for (i = 0; i < type->num_boxes; i++, pmu++) { | ||
1073 | box = pmu->boxes[pkg]; | ||
1074 | if (box && atomic_dec_return(&box->refcnt) == 0) | ||
1075 | uncore_box_exit(box); | ||
1076 | } | ||
1077 | } | ||
1078 | return 0; | ||
1079 | } | ||
1080 | |||
1081 | static int first_init; | ||
1082 | |||
1083 | static int uncore_cpu_starting(unsigned int cpu) | ||
1084 | { | ||
1085 | struct intel_uncore_type *type, **types = uncore_msr_uncores; | ||
1086 | struct intel_uncore_pmu *pmu; | ||
1087 | struct intel_uncore_box *box; | ||
1088 | int i, pkg, ncpus = 1; | ||
1089 | |||
1090 | if (first_init) { | ||
1091 | /* | ||
1092 | * On init we get the number of online cpus in the package | ||
1093 | * and set refcount for all of them. | ||
1094 | */ | ||
1095 | ncpus = cpumask_weight(topology_core_cpumask(cpu)); | ||
1096 | } | ||
1097 | |||
1098 | pkg = topology_logical_package_id(cpu); | ||
1099 | for (; *types; types++) { | ||
1100 | type = *types; | ||
1101 | pmu = type->pmus; | ||
1102 | for (i = 0; i < type->num_boxes; i++, pmu++) { | ||
1103 | box = pmu->boxes[pkg]; | ||
1104 | if (!box) | ||
1105 | continue; | ||
1106 | /* The first cpu on a package activates the box */ | ||
1107 | if (atomic_add_return(ncpus, &box->refcnt) == ncpus) | ||
1108 | uncore_box_init(box); | ||
1109 | } | ||
1110 | } | ||
1111 | |||
1112 | return 0; | ||
1113 | } | ||
1114 | |||
1115 | static int uncore_cpu_prepare(unsigned int cpu) | ||
1116 | { | ||
1117 | struct intel_uncore_type *type, **types = uncore_msr_uncores; | ||
1118 | struct intel_uncore_pmu *pmu; | ||
1119 | struct intel_uncore_box *box; | ||
1120 | int i, pkg; | ||
1121 | |||
1122 | pkg = topology_logical_package_id(cpu); | ||
1123 | for (; *types; types++) { | ||
1124 | type = *types; | ||
1125 | pmu = type->pmus; | ||
1126 | for (i = 0; i < type->num_boxes; i++, pmu++) { | ||
1127 | if (pmu->boxes[pkg]) | ||
1128 | continue; | ||
1129 | /* First cpu of a package allocates the box */ | ||
1130 | box = uncore_alloc_box(type, cpu_to_node(cpu)); | ||
1131 | if (!box) | ||
1132 | return -ENOMEM; | ||
1133 | box->pmu = pmu; | ||
1134 | box->pkgid = pkg; | ||
1135 | pmu->boxes[pkg] = box; | ||
1136 | } | ||
1137 | } | ||
1138 | return 0; | ||
1139 | } | ||
1140 | |||
1141 | static void uncore_change_type_ctx(struct intel_uncore_type *type, int old_cpu, | 1043 | static void uncore_change_type_ctx(struct intel_uncore_type *type, int old_cpu, |
1142 | int new_cpu) | 1044 | int new_cpu) |
1143 | { | 1045 | { |
@@ -1177,12 +1079,14 @@ static void uncore_change_context(struct intel_uncore_type **uncores, | |||
1177 | 1079 | ||
1178 | static int uncore_event_cpu_offline(unsigned int cpu) | 1080 | static int uncore_event_cpu_offline(unsigned int cpu) |
1179 | { | 1081 | { |
1180 | int target; | 1082 | struct intel_uncore_type *type, **types = uncore_msr_uncores; |
1083 | struct intel_uncore_pmu *pmu; | ||
1084 | struct intel_uncore_box *box; | ||
1085 | int i, pkg, target; | ||
1181 | 1086 | ||
1182 | /* Check if exiting cpu is used for collecting uncore events */ | 1087 | /* Check if exiting cpu is used for collecting uncore events */ |
1183 | if (!cpumask_test_and_clear_cpu(cpu, &uncore_cpu_mask)) | 1088 | if (!cpumask_test_and_clear_cpu(cpu, &uncore_cpu_mask)) |
1184 | return 0; | 1089 | goto unref; |
1185 | |||
1186 | /* Find a new cpu to collect uncore events */ | 1090 | /* Find a new cpu to collect uncore events */ |
1187 | target = cpumask_any_but(topology_core_cpumask(cpu), cpu); | 1091 | target = cpumask_any_but(topology_core_cpumask(cpu), cpu); |
1188 | 1092 | ||
@@ -1194,12 +1098,82 @@ static int uncore_event_cpu_offline(unsigned int cpu) | |||
1194 | 1098 | ||
1195 | uncore_change_context(uncore_msr_uncores, cpu, target); | 1099 | uncore_change_context(uncore_msr_uncores, cpu, target); |
1196 | uncore_change_context(uncore_pci_uncores, cpu, target); | 1100 | uncore_change_context(uncore_pci_uncores, cpu, target); |
1101 | |||
1102 | unref: | ||
1103 | /* Clear the references */ | ||
1104 | pkg = topology_logical_package_id(cpu); | ||
1105 | for (; *types; types++) { | ||
1106 | type = *types; | ||
1107 | pmu = type->pmus; | ||
1108 | for (i = 0; i < type->num_boxes; i++, pmu++) { | ||
1109 | box = pmu->boxes[pkg]; | ||
1110 | if (box && atomic_dec_return(&box->refcnt) == 0) | ||
1111 | uncore_box_exit(box); | ||
1112 | } | ||
1113 | } | ||
1197 | return 0; | 1114 | return 0; |
1198 | } | 1115 | } |
1199 | 1116 | ||
1117 | static int allocate_boxes(struct intel_uncore_type **types, | ||
1118 | unsigned int pkg, unsigned int cpu) | ||
1119 | { | ||
1120 | struct intel_uncore_box *box, *tmp; | ||
1121 | struct intel_uncore_type *type; | ||
1122 | struct intel_uncore_pmu *pmu; | ||
1123 | LIST_HEAD(allocated); | ||
1124 | int i; | ||
1125 | |||
1126 | /* Try to allocate all required boxes */ | ||
1127 | for (; *types; types++) { | ||
1128 | type = *types; | ||
1129 | pmu = type->pmus; | ||
1130 | for (i = 0; i < type->num_boxes; i++, pmu++) { | ||
1131 | if (pmu->boxes[pkg]) | ||
1132 | continue; | ||
1133 | box = uncore_alloc_box(type, cpu_to_node(cpu)); | ||
1134 | if (!box) | ||
1135 | goto cleanup; | ||
1136 | box->pmu = pmu; | ||
1137 | box->pkgid = pkg; | ||
1138 | list_add(&box->active_list, &allocated); | ||
1139 | } | ||
1140 | } | ||
1141 | /* Install them in the pmus */ | ||
1142 | list_for_each_entry_safe(box, tmp, &allocated, active_list) { | ||
1143 | list_del_init(&box->active_list); | ||
1144 | box->pmu->boxes[pkg] = box; | ||
1145 | } | ||
1146 | return 0; | ||
1147 | |||
1148 | cleanup: | ||
1149 | list_for_each_entry_safe(box, tmp, &allocated, active_list) { | ||
1150 | list_del_init(&box->active_list); | ||
1151 | kfree(box); | ||
1152 | } | ||
1153 | return -ENOMEM; | ||
1154 | } | ||
1155 | |||
1200 | static int uncore_event_cpu_online(unsigned int cpu) | 1156 | static int uncore_event_cpu_online(unsigned int cpu) |
1201 | { | 1157 | { |
1202 | int target; | 1158 | struct intel_uncore_type *type, **types = uncore_msr_uncores; |
1159 | struct intel_uncore_pmu *pmu; | ||
1160 | struct intel_uncore_box *box; | ||
1161 | int i, ret, pkg, target; | ||
1162 | |||
1163 | pkg = topology_logical_package_id(cpu); | ||
1164 | ret = allocate_boxes(types, pkg, cpu); | ||
1165 | if (ret) | ||
1166 | return ret; | ||
1167 | |||
1168 | for (; *types; types++) { | ||
1169 | type = *types; | ||
1170 | pmu = type->pmus; | ||
1171 | for (i = 0; i < type->num_boxes; i++, pmu++) { | ||
1172 | box = pmu->boxes[pkg]; | ||
1173 | if (!box && atomic_inc_return(&box->refcnt) == 1) | ||
1174 | uncore_box_init(box); | ||
1175 | } | ||
1176 | } | ||
1203 | 1177 | ||
1204 | /* | 1178 | /* |
1205 | * Check if there is an online cpu in the package | 1179 | * Check if there is an online cpu in the package |
@@ -1389,38 +1363,16 @@ static int __init intel_uncore_init(void) | |||
1389 | if (cret && pret) | 1363 | if (cret && pret) |
1390 | return -ENODEV; | 1364 | return -ENODEV; |
1391 | 1365 | ||
1392 | /* | 1366 | /* Install hotplug callbacks to setup the targets for each package */ |
1393 | * Install callbacks. Core will call them for each online cpu. | 1367 | ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE, |
1394 | * | 1368 | "perf/x86/intel/uncore:online", |
1395 | * The first online cpu of each package allocates and takes | 1369 | uncore_event_cpu_online, |
1396 | * the refcounts for all other online cpus in that package. | 1370 | uncore_event_cpu_offline); |
1397 | * If msrs are not enabled no allocation is required and | 1371 | if (ret) |
1398 | * uncore_cpu_prepare() is not called for each online cpu. | 1372 | goto err; |
1399 | */ | ||
1400 | if (!cret) { | ||
1401 | ret = cpuhp_setup_state(CPUHP_PERF_X86_UNCORE_PREP, | ||
1402 | "perf/x86/intel/uncore:prepare", | ||
1403 | uncore_cpu_prepare, NULL); | ||
1404 | if (ret) | ||
1405 | goto err; | ||
1406 | } else { | ||
1407 | cpuhp_setup_state_nocalls(CPUHP_PERF_X86_UNCORE_PREP, | ||
1408 | "perf/x86/intel/uncore:prepare", | ||
1409 | uncore_cpu_prepare, NULL); | ||
1410 | } | ||
1411 | first_init = 1; | ||
1412 | cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_STARTING, | ||
1413 | "perf/x86/uncore:starting", | ||
1414 | uncore_cpu_starting, uncore_cpu_dying); | ||
1415 | first_init = 0; | ||
1416 | cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE, | ||
1417 | "perf/x86/uncore:online", | ||
1418 | uncore_event_cpu_online, uncore_event_cpu_offline); | ||
1419 | return 0; | 1373 | return 0; |
1420 | 1374 | ||
1421 | err: | 1375 | err: |
1422 | /* Undo box->init_box() */ | ||
1423 | on_each_cpu_mask(&uncore_cpu_mask, uncore_exit_boxes, NULL, 1); | ||
1424 | uncore_types_exit(uncore_msr_uncores); | 1376 | uncore_types_exit(uncore_msr_uncores); |
1425 | uncore_pci_exit(); | 1377 | uncore_pci_exit(); |
1426 | return ret; | 1378 | return ret; |
@@ -1429,9 +1381,7 @@ module_init(intel_uncore_init); | |||
1429 | 1381 | ||
1430 | static void __exit intel_uncore_exit(void) | 1382 | static void __exit intel_uncore_exit(void) |
1431 | { | 1383 | { |
1432 | cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_UNCORE_ONLINE); | 1384 | cpuhp_remove_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE); |
1433 | cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_UNCORE_STARTING); | ||
1434 | cpuhp_remove_state_nocalls(CPUHP_PERF_X86_UNCORE_PREP); | ||
1435 | uncore_types_exit(uncore_msr_uncores); | 1385 | uncore_types_exit(uncore_msr_uncores); |
1436 | uncore_pci_exit(); | 1386 | uncore_pci_exit(); |
1437 | } | 1387 | } |
diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h index 38711df3bcb5..2266f864b747 100644 --- a/arch/x86/include/asm/microcode.h +++ b/arch/x86/include/asm/microcode.h | |||
@@ -140,6 +140,7 @@ extern void __init load_ucode_bsp(void); | |||
140 | extern void load_ucode_ap(void); | 140 | extern void load_ucode_ap(void); |
141 | void reload_early_microcode(void); | 141 | void reload_early_microcode(void); |
142 | extern bool get_builtin_firmware(struct cpio_data *cd, const char *name); | 142 | extern bool get_builtin_firmware(struct cpio_data *cd, const char *name); |
143 | extern bool initrd_gone; | ||
143 | #else | 144 | #else |
144 | static inline int __init microcode_init(void) { return 0; }; | 145 | static inline int __init microcode_init(void) { return 0; }; |
145 | static inline void __init load_ucode_bsp(void) { } | 146 | static inline void __init load_ucode_bsp(void) { } |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 1e35dd06b090..52f352b063fd 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -2117,6 +2117,7 @@ static inline void __init check_timer(void) | |||
2117 | if (idx != -1 && irq_trigger(idx)) | 2117 | if (idx != -1 && irq_trigger(idx)) |
2118 | unmask_ioapic_irq(irq_get_chip_data(0)); | 2118 | unmask_ioapic_irq(irq_get_chip_data(0)); |
2119 | } | 2119 | } |
2120 | irq_domain_deactivate_irq(irq_data); | ||
2120 | irq_domain_activate_irq(irq_data); | 2121 | irq_domain_activate_irq(irq_data); |
2121 | if (timer_irq_works()) { | 2122 | if (timer_irq_works()) { |
2122 | if (disable_timer_pin_1 > 0) | 2123 | if (disable_timer_pin_1 > 0) |
@@ -2138,6 +2139,7 @@ static inline void __init check_timer(void) | |||
2138 | * legacy devices should be connected to IO APIC #0 | 2139 | * legacy devices should be connected to IO APIC #0 |
2139 | */ | 2140 | */ |
2140 | replace_pin_at_irq_node(data, node, apic1, pin1, apic2, pin2); | 2141 | replace_pin_at_irq_node(data, node, apic1, pin1, apic2, pin2); |
2142 | irq_domain_deactivate_irq(irq_data); | ||
2141 | irq_domain_activate_irq(irq_data); | 2143 | irq_domain_activate_irq(irq_data); |
2142 | legacy_pic->unmask(0); | 2144 | legacy_pic->unmask(0); |
2143 | if (timer_irq_works()) { | 2145 | if (timer_irq_works()) { |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 00ef43233e03..537c6647d84c 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -1373,20 +1373,15 @@ static unsigned long mce_adjust_timer_default(unsigned long interval) | |||
1373 | 1373 | ||
1374 | static unsigned long (*mce_adjust_timer)(unsigned long interval) = mce_adjust_timer_default; | 1374 | static unsigned long (*mce_adjust_timer)(unsigned long interval) = mce_adjust_timer_default; |
1375 | 1375 | ||
1376 | static void __restart_timer(struct timer_list *t, unsigned long interval) | 1376 | static void __start_timer(struct timer_list *t, unsigned long interval) |
1377 | { | 1377 | { |
1378 | unsigned long when = jiffies + interval; | 1378 | unsigned long when = jiffies + interval; |
1379 | unsigned long flags; | 1379 | unsigned long flags; |
1380 | 1380 | ||
1381 | local_irq_save(flags); | 1381 | local_irq_save(flags); |
1382 | 1382 | ||
1383 | if (timer_pending(t)) { | 1383 | if (!timer_pending(t) || time_before(when, t->expires)) |
1384 | if (time_before(when, t->expires)) | 1384 | mod_timer(t, round_jiffies(when)); |
1385 | mod_timer(t, when); | ||
1386 | } else { | ||
1387 | t->expires = round_jiffies(when); | ||
1388 | add_timer_on(t, smp_processor_id()); | ||
1389 | } | ||
1390 | 1385 | ||
1391 | local_irq_restore(flags); | 1386 | local_irq_restore(flags); |
1392 | } | 1387 | } |
@@ -1421,7 +1416,7 @@ static void mce_timer_fn(unsigned long data) | |||
1421 | 1416 | ||
1422 | done: | 1417 | done: |
1423 | __this_cpu_write(mce_next_interval, iv); | 1418 | __this_cpu_write(mce_next_interval, iv); |
1424 | __restart_timer(t, iv); | 1419 | __start_timer(t, iv); |
1425 | } | 1420 | } |
1426 | 1421 | ||
1427 | /* | 1422 | /* |
@@ -1432,7 +1427,7 @@ void mce_timer_kick(unsigned long interval) | |||
1432 | struct timer_list *t = this_cpu_ptr(&mce_timer); | 1427 | struct timer_list *t = this_cpu_ptr(&mce_timer); |
1433 | unsigned long iv = __this_cpu_read(mce_next_interval); | 1428 | unsigned long iv = __this_cpu_read(mce_next_interval); |
1434 | 1429 | ||
1435 | __restart_timer(t, interval); | 1430 | __start_timer(t, interval); |
1436 | 1431 | ||
1437 | if (interval < iv) | 1432 | if (interval < iv) |
1438 | __this_cpu_write(mce_next_interval, interval); | 1433 | __this_cpu_write(mce_next_interval, interval); |
@@ -1779,17 +1774,15 @@ static void __mcheck_cpu_clear_vendor(struct cpuinfo_x86 *c) | |||
1779 | } | 1774 | } |
1780 | } | 1775 | } |
1781 | 1776 | ||
1782 | static void mce_start_timer(unsigned int cpu, struct timer_list *t) | 1777 | static void mce_start_timer(struct timer_list *t) |
1783 | { | 1778 | { |
1784 | unsigned long iv = check_interval * HZ; | 1779 | unsigned long iv = check_interval * HZ; |
1785 | 1780 | ||
1786 | if (mca_cfg.ignore_ce || !iv) | 1781 | if (mca_cfg.ignore_ce || !iv) |
1787 | return; | 1782 | return; |
1788 | 1783 | ||
1789 | per_cpu(mce_next_interval, cpu) = iv; | 1784 | this_cpu_write(mce_next_interval, iv); |
1790 | 1785 | __start_timer(t, iv); | |
1791 | t->expires = round_jiffies(jiffies + iv); | ||
1792 | add_timer_on(t, cpu); | ||
1793 | } | 1786 | } |
1794 | 1787 | ||
1795 | static void __mcheck_cpu_setup_timer(void) | 1788 | static void __mcheck_cpu_setup_timer(void) |
@@ -1806,7 +1799,7 @@ static void __mcheck_cpu_init_timer(void) | |||
1806 | unsigned int cpu = smp_processor_id(); | 1799 | unsigned int cpu = smp_processor_id(); |
1807 | 1800 | ||
1808 | setup_pinned_timer(t, mce_timer_fn, cpu); | 1801 | setup_pinned_timer(t, mce_timer_fn, cpu); |
1809 | mce_start_timer(cpu, t); | 1802 | mce_start_timer(t); |
1810 | } | 1803 | } |
1811 | 1804 | ||
1812 | /* Handle unconfigured int18 (should never happen) */ | 1805 | /* Handle unconfigured int18 (should never happen) */ |
@@ -2566,7 +2559,7 @@ static int mce_cpu_dead(unsigned int cpu) | |||
2566 | 2559 | ||
2567 | static int mce_cpu_online(unsigned int cpu) | 2560 | static int mce_cpu_online(unsigned int cpu) |
2568 | { | 2561 | { |
2569 | struct timer_list *t = &per_cpu(mce_timer, cpu); | 2562 | struct timer_list *t = this_cpu_ptr(&mce_timer); |
2570 | int ret; | 2563 | int ret; |
2571 | 2564 | ||
2572 | mce_device_create(cpu); | 2565 | mce_device_create(cpu); |
@@ -2577,13 +2570,13 @@ static int mce_cpu_online(unsigned int cpu) | |||
2577 | return ret; | 2570 | return ret; |
2578 | } | 2571 | } |
2579 | mce_reenable_cpu(); | 2572 | mce_reenable_cpu(); |
2580 | mce_start_timer(cpu, t); | 2573 | mce_start_timer(t); |
2581 | return 0; | 2574 | return 0; |
2582 | } | 2575 | } |
2583 | 2576 | ||
2584 | static int mce_cpu_pre_down(unsigned int cpu) | 2577 | static int mce_cpu_pre_down(unsigned int cpu) |
2585 | { | 2578 | { |
2586 | struct timer_list *t = &per_cpu(mce_timer, cpu); | 2579 | struct timer_list *t = this_cpu_ptr(&mce_timer); |
2587 | 2580 | ||
2588 | mce_disable_cpu(); | 2581 | mce_disable_cpu(); |
2589 | del_timer_sync(t); | 2582 | del_timer_sync(t); |
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 6a31e2691f3a..079e81733a58 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c | |||
@@ -384,8 +384,9 @@ void load_ucode_amd_ap(unsigned int family) | |||
384 | reget: | 384 | reget: |
385 | if (!get_builtin_microcode(&cp, family)) { | 385 | if (!get_builtin_microcode(&cp, family)) { |
386 | #ifdef CONFIG_BLK_DEV_INITRD | 386 | #ifdef CONFIG_BLK_DEV_INITRD |
387 | cp = find_cpio_data(ucode_path, (void *)initrd_start, | 387 | if (!initrd_gone) |
388 | initrd_end - initrd_start, NULL); | 388 | cp = find_cpio_data(ucode_path, (void *)initrd_start, |
389 | initrd_end - initrd_start, NULL); | ||
389 | #endif | 390 | #endif |
390 | if (!(cp.data && cp.size)) { | 391 | if (!(cp.data && cp.size)) { |
391 | /* | 392 | /* |
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 2af69d27da62..73102d932760 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c | |||
@@ -46,6 +46,8 @@ | |||
46 | static struct microcode_ops *microcode_ops; | 46 | static struct microcode_ops *microcode_ops; |
47 | static bool dis_ucode_ldr = true; | 47 | static bool dis_ucode_ldr = true; |
48 | 48 | ||
49 | bool initrd_gone; | ||
50 | |||
49 | LIST_HEAD(microcode_cache); | 51 | LIST_HEAD(microcode_cache); |
50 | 52 | ||
51 | /* | 53 | /* |
@@ -190,21 +192,24 @@ void load_ucode_ap(void) | |||
190 | static int __init save_microcode_in_initrd(void) | 192 | static int __init save_microcode_in_initrd(void) |
191 | { | 193 | { |
192 | struct cpuinfo_x86 *c = &boot_cpu_data; | 194 | struct cpuinfo_x86 *c = &boot_cpu_data; |
195 | int ret = -EINVAL; | ||
193 | 196 | ||
194 | switch (c->x86_vendor) { | 197 | switch (c->x86_vendor) { |
195 | case X86_VENDOR_INTEL: | 198 | case X86_VENDOR_INTEL: |
196 | if (c->x86 >= 6) | 199 | if (c->x86 >= 6) |
197 | return save_microcode_in_initrd_intel(); | 200 | ret = save_microcode_in_initrd_intel(); |
198 | break; | 201 | break; |
199 | case X86_VENDOR_AMD: | 202 | case X86_VENDOR_AMD: |
200 | if (c->x86 >= 0x10) | 203 | if (c->x86 >= 0x10) |
201 | return save_microcode_in_initrd_amd(c->x86); | 204 | ret = save_microcode_in_initrd_amd(c->x86); |
202 | break; | 205 | break; |
203 | default: | 206 | default: |
204 | break; | 207 | break; |
205 | } | 208 | } |
206 | 209 | ||
207 | return -EINVAL; | 210 | initrd_gone = true; |
211 | |||
212 | return ret; | ||
208 | } | 213 | } |
209 | 214 | ||
210 | struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa) | 215 | struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa) |
@@ -247,9 +252,16 @@ struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa) | |||
247 | * has the virtual address of the beginning of the initrd. It also | 252 | * has the virtual address of the beginning of the initrd. It also |
248 | * possibly relocates the ramdisk. In either case, initrd_start contains | 253 | * possibly relocates the ramdisk. In either case, initrd_start contains |
249 | * the updated address so use that instead. | 254 | * the updated address so use that instead. |
255 | * | ||
256 | * initrd_gone is for the hotplug case where we've thrown out initrd | ||
257 | * already. | ||
250 | */ | 258 | */ |
251 | if (!use_pa && initrd_start) | 259 | if (!use_pa) { |
252 | start = initrd_start; | 260 | if (initrd_gone) |
261 | return (struct cpio_data){ NULL, 0, "" }; | ||
262 | if (initrd_start) | ||
263 | start = initrd_start; | ||
264 | } | ||
253 | 265 | ||
254 | return find_cpio_data(path, (void *)start, size, NULL); | 266 | return find_cpio_data(path, (void *)start, size, NULL); |
255 | #else /* !CONFIG_BLK_DEV_INITRD */ | 267 | #else /* !CONFIG_BLK_DEV_INITRD */ |
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 3f329b74e040..8325d8a09ab0 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c | |||
@@ -41,7 +41,7 @@ | |||
41 | 41 | ||
42 | static const char ucode_path[] = "kernel/x86/microcode/GenuineIntel.bin"; | 42 | static const char ucode_path[] = "kernel/x86/microcode/GenuineIntel.bin"; |
43 | 43 | ||
44 | /* Current microcode patch used in early patching */ | 44 | /* Current microcode patch used in early patching on the APs. */ |
45 | struct microcode_intel *intel_ucode_patch; | 45 | struct microcode_intel *intel_ucode_patch; |
46 | 46 | ||
47 | static inline bool cpu_signatures_match(unsigned int s1, unsigned int p1, | 47 | static inline bool cpu_signatures_match(unsigned int s1, unsigned int p1, |
@@ -607,12 +607,6 @@ int __init save_microcode_in_initrd_intel(void) | |||
607 | struct ucode_cpu_info uci; | 607 | struct ucode_cpu_info uci; |
608 | struct cpio_data cp; | 608 | struct cpio_data cp; |
609 | 609 | ||
610 | /* | ||
611 | * AP loading didn't find any microcode patch, no need to save anything. | ||
612 | */ | ||
613 | if (!intel_ucode_patch || IS_ERR(intel_ucode_patch)) | ||
614 | return 0; | ||
615 | |||
616 | if (!load_builtin_intel_microcode(&cp)) | 610 | if (!load_builtin_intel_microcode(&cp)) |
617 | cp = find_microcode_in_initrd(ucode_path, false); | 611 | cp = find_microcode_in_initrd(ucode_path, false); |
618 | 612 | ||
@@ -628,7 +622,6 @@ int __init save_microcode_in_initrd_intel(void) | |||
628 | return 0; | 622 | return 0; |
629 | } | 623 | } |
630 | 624 | ||
631 | |||
632 | /* | 625 | /* |
633 | * @res_patch, output: a pointer to the patch we found. | 626 | * @res_patch, output: a pointer to the patch we found. |
634 | */ | 627 | */ |
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c index e4e97a5355ce..de7234401275 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <asm/fpu/regset.h> | 9 | #include <asm/fpu/regset.h> |
10 | #include <asm/fpu/signal.h> | 10 | #include <asm/fpu/signal.h> |
11 | #include <asm/fpu/types.h> | 11 | #include <asm/fpu/types.h> |
12 | #include <asm/fpu/xstate.h> | ||
12 | #include <asm/traps.h> | 13 | #include <asm/traps.h> |
13 | 14 | ||
14 | #include <linux/hardirq.h> | 15 | #include <linux/hardirq.h> |
@@ -183,7 +184,8 @@ void fpstate_init(union fpregs_state *state) | |||
183 | * it will #GP. Make sure it is replaced after the memset(). | 184 | * it will #GP. Make sure it is replaced after the memset(). |
184 | */ | 185 | */ |
185 | if (static_cpu_has(X86_FEATURE_XSAVES)) | 186 | if (static_cpu_has(X86_FEATURE_XSAVES)) |
186 | state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT; | 187 | state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT | |
188 | xfeatures_mask; | ||
187 | 189 | ||
188 | if (static_cpu_has(X86_FEATURE_FXSR)) | 190 | if (static_cpu_has(X86_FEATURE_FXSR)) |
189 | fpstate_init_fxstate(&state->fxsave); | 191 | fpstate_init_fxstate(&state->fxsave); |
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 85e87b46c318..dc6ba5bda9fc 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -352,6 +352,7 @@ static int hpet_resume(struct clock_event_device *evt, int timer) | |||
352 | } else { | 352 | } else { |
353 | struct hpet_dev *hdev = EVT_TO_HPET_DEV(evt); | 353 | struct hpet_dev *hdev = EVT_TO_HPET_DEV(evt); |
354 | 354 | ||
355 | irq_domain_deactivate_irq(irq_get_irq_data(hdev->irq)); | ||
355 | irq_domain_activate_irq(irq_get_irq_data(hdev->irq)); | 356 | irq_domain_activate_irq(irq_get_irq_data(hdev->irq)); |
356 | disable_irq(hdev->irq); | 357 | disable_irq(hdev->irq); |
357 | irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu)); | 358 | irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu)); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index d153be8929a6..e52c9088660f 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3182,6 +3182,7 @@ static void fill_xsave(u8 *dest, struct kvm_vcpu *vcpu) | |||
3182 | memcpy(dest, xsave, XSAVE_HDR_OFFSET); | 3182 | memcpy(dest, xsave, XSAVE_HDR_OFFSET); |
3183 | 3183 | ||
3184 | /* Set XSTATE_BV */ | 3184 | /* Set XSTATE_BV */ |
3185 | xstate_bv &= vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FPSSE; | ||
3185 | *(u64 *)(dest + XSAVE_HDR_OFFSET) = xstate_bv; | 3186 | *(u64 *)(dest + XSAVE_HDR_OFFSET) = xstate_bv; |
3186 | 3187 | ||
3187 | /* | 3188 | /* |
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 319148bd4b05..2f25a363068c 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c | |||
@@ -269,6 +269,22 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) | |||
269 | efi_scratch.use_pgd = true; | 269 | efi_scratch.use_pgd = true; |
270 | 270 | ||
271 | /* | 271 | /* |
272 | * Certain firmware versions are way too sentimential and still believe | ||
273 | * they are exclusive and unquestionable owners of the first physical page, | ||
274 | * even though they explicitly mark it as EFI_CONVENTIONAL_MEMORY | ||
275 | * (but then write-access it later during SetVirtualAddressMap()). | ||
276 | * | ||
277 | * Create a 1:1 mapping for this page, to avoid triple faults during early | ||
278 | * boot with such firmware. We are free to hand this page to the BIOS, | ||
279 | * as trim_bios_range() will reserve the first page and isolate it away | ||
280 | * from memory allocators anyway. | ||
281 | */ | ||
282 | if (kernel_map_pages_in_pgd(pgd, 0x0, 0x0, 1, _PAGE_RW)) { | ||
283 | pr_err("Failed to create 1:1 mapping for the first page!\n"); | ||
284 | return 1; | ||
285 | } | ||
286 | |||
287 | /* | ||
272 | * When making calls to the firmware everything needs to be 1:1 | 288 | * When making calls to the firmware everything needs to be 1:1 |
273 | * mapped and addressable with 32-bit pointers. Map the kernel | 289 | * mapped and addressable with 32-bit pointers. Map the kernel |
274 | * text and allocate a new stack because we can't rely on the | 290 | * text and allocate a new stack because we can't rely on the |
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c index 848e8568fb3c..8fd4be610607 100644 --- a/arch/xtensa/kernel/setup.c +++ b/arch/xtensa/kernel/setup.c | |||
@@ -419,7 +419,7 @@ subsys_initcall(topology_init); | |||
419 | 419 | ||
420 | void cpu_reset(void) | 420 | void cpu_reset(void) |
421 | { | 421 | { |
422 | #if XCHAL_HAVE_PTP_MMU | 422 | #if XCHAL_HAVE_PTP_MMU && IS_ENABLED(CONFIG_MMU) |
423 | local_irq_disable(); | 423 | local_irq_disable(); |
424 | /* | 424 | /* |
425 | * We have full MMU: all autoload ways, ways 7, 8 and 9 of DTLB must | 425 | * We have full MMU: all autoload ways, ways 7, 8 and 9 of DTLB must |
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c index f849311e9fd4..533265f110e0 100644 --- a/crypto/algif_aead.c +++ b/crypto/algif_aead.c | |||
@@ -661,9 +661,9 @@ static int aead_recvmsg_sync(struct socket *sock, struct msghdr *msg, int flags) | |||
661 | unlock: | 661 | unlock: |
662 | list_for_each_entry_safe(rsgl, tmp, &ctx->list, list) { | 662 | list_for_each_entry_safe(rsgl, tmp, &ctx->list, list) { |
663 | af_alg_free_sg(&rsgl->sgl); | 663 | af_alg_free_sg(&rsgl->sgl); |
664 | list_del(&rsgl->list); | ||
664 | if (rsgl != &ctx->first_rsgl) | 665 | if (rsgl != &ctx->first_rsgl) |
665 | sock_kfree_s(sk, rsgl, sizeof(*rsgl)); | 666 | sock_kfree_s(sk, rsgl, sizeof(*rsgl)); |
666 | list_del(&rsgl->list); | ||
667 | } | 667 | } |
668 | INIT_LIST_HEAD(&ctx->list); | 668 | INIT_LIST_HEAD(&ctx->list); |
669 | aead_wmem_wakeup(sk); | 669 | aead_wmem_wakeup(sk); |
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 2f82b8eba360..7361d00818e2 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c | |||
@@ -2704,6 +2704,7 @@ static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc) | |||
2704 | struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); | 2704 | struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); |
2705 | struct device *dev = acpi_desc->dev; | 2705 | struct device *dev = acpi_desc->dev; |
2706 | struct acpi_nfit_flush_work flush; | 2706 | struct acpi_nfit_flush_work flush; |
2707 | int rc; | ||
2707 | 2708 | ||
2708 | /* bounce the device lock to flush acpi_nfit_add / acpi_nfit_notify */ | 2709 | /* bounce the device lock to flush acpi_nfit_add / acpi_nfit_notify */ |
2709 | device_lock(dev); | 2710 | device_lock(dev); |
@@ -2716,7 +2717,10 @@ static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc) | |||
2716 | INIT_WORK_ONSTACK(&flush.work, flush_probe); | 2717 | INIT_WORK_ONSTACK(&flush.work, flush_probe); |
2717 | COMPLETION_INITIALIZER_ONSTACK(flush.cmp); | 2718 | COMPLETION_INITIALIZER_ONSTACK(flush.cmp); |
2718 | queue_work(nfit_wq, &flush.work); | 2719 | queue_work(nfit_wq, &flush.work); |
2719 | return wait_for_completion_interruptible(&flush.cmp); | 2720 | |
2721 | rc = wait_for_completion_interruptible(&flush.cmp); | ||
2722 | cancel_work_sync(&flush.work); | ||
2723 | return rc; | ||
2720 | } | 2724 | } |
2721 | 2725 | ||
2722 | static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc, | 2726 | static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc, |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 4497d263209f..ac350c518e0c 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -558,9 +558,6 @@ static void fw_load_abort(struct firmware_priv *fw_priv) | |||
558 | struct firmware_buf *buf = fw_priv->buf; | 558 | struct firmware_buf *buf = fw_priv->buf; |
559 | 559 | ||
560 | __fw_load_abort(buf); | 560 | __fw_load_abort(buf); |
561 | |||
562 | /* avoid user action after loading abort */ | ||
563 | fw_priv->buf = NULL; | ||
564 | } | 561 | } |
565 | 562 | ||
566 | static LIST_HEAD(pending_fw_head); | 563 | static LIST_HEAD(pending_fw_head); |
@@ -713,7 +710,7 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
713 | 710 | ||
714 | mutex_lock(&fw_lock); | 711 | mutex_lock(&fw_lock); |
715 | fw_buf = fw_priv->buf; | 712 | fw_buf = fw_priv->buf; |
716 | if (!fw_buf) | 713 | if (fw_state_is_aborted(&fw_buf->fw_st)) |
717 | goto out; | 714 | goto out; |
718 | 715 | ||
719 | switch (loading) { | 716 | switch (loading) { |
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index dacb6a8418aa..fa26ffd25fa6 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -389,33 +389,33 @@ static ssize_t show_valid_zones(struct device *dev, | |||
389 | { | 389 | { |
390 | struct memory_block *mem = to_memory_block(dev); | 390 | struct memory_block *mem = to_memory_block(dev); |
391 | unsigned long start_pfn, end_pfn; | 391 | unsigned long start_pfn, end_pfn; |
392 | unsigned long valid_start, valid_end, valid_pages; | ||
392 | unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; | 393 | unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; |
393 | struct page *first_page; | ||
394 | struct zone *zone; | 394 | struct zone *zone; |
395 | int zone_shift = 0; | 395 | int zone_shift = 0; |
396 | 396 | ||
397 | start_pfn = section_nr_to_pfn(mem->start_section_nr); | 397 | start_pfn = section_nr_to_pfn(mem->start_section_nr); |
398 | end_pfn = start_pfn + nr_pages; | 398 | end_pfn = start_pfn + nr_pages; |
399 | first_page = pfn_to_page(start_pfn); | ||
400 | 399 | ||
401 | /* The block contains more than one zone can not be offlined. */ | 400 | /* The block contains more than one zone can not be offlined. */ |
402 | if (!test_pages_in_a_zone(start_pfn, end_pfn)) | 401 | if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end)) |
403 | return sprintf(buf, "none\n"); | 402 | return sprintf(buf, "none\n"); |
404 | 403 | ||
405 | zone = page_zone(first_page); | 404 | zone = page_zone(pfn_to_page(valid_start)); |
405 | valid_pages = valid_end - valid_start; | ||
406 | 406 | ||
407 | /* MMOP_ONLINE_KEEP */ | 407 | /* MMOP_ONLINE_KEEP */ |
408 | sprintf(buf, "%s", zone->name); | 408 | sprintf(buf, "%s", zone->name); |
409 | 409 | ||
410 | /* MMOP_ONLINE_KERNEL */ | 410 | /* MMOP_ONLINE_KERNEL */ |
411 | zone_can_shift(start_pfn, nr_pages, ZONE_NORMAL, &zone_shift); | 411 | zone_can_shift(valid_start, valid_pages, ZONE_NORMAL, &zone_shift); |
412 | if (zone_shift) { | 412 | if (zone_shift) { |
413 | strcat(buf, " "); | 413 | strcat(buf, " "); |
414 | strcat(buf, (zone + zone_shift)->name); | 414 | strcat(buf, (zone + zone_shift)->name); |
415 | } | 415 | } |
416 | 416 | ||
417 | /* MMOP_ONLINE_MOVABLE */ | 417 | /* MMOP_ONLINE_MOVABLE */ |
418 | zone_can_shift(start_pfn, nr_pages, ZONE_MOVABLE, &zone_shift); | 418 | zone_can_shift(valid_start, valid_pages, ZONE_MOVABLE, &zone_shift); |
419 | if (zone_shift) { | 419 | if (zone_shift) { |
420 | strcat(buf, " "); | 420 | strcat(buf, " "); |
421 | strcat(buf, (zone + zone_shift)->name); | 421 | strcat(buf, (zone + zone_shift)->name); |
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 872eac4cb1df..a14fac6a01d3 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -966,13 +966,13 @@ int __pm_runtime_idle(struct device *dev, int rpmflags) | |||
966 | unsigned long flags; | 966 | unsigned long flags; |
967 | int retval; | 967 | int retval; |
968 | 968 | ||
969 | might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); | ||
970 | |||
971 | if (rpmflags & RPM_GET_PUT) { | 969 | if (rpmflags & RPM_GET_PUT) { |
972 | if (!atomic_dec_and_test(&dev->power.usage_count)) | 970 | if (!atomic_dec_and_test(&dev->power.usage_count)) |
973 | return 0; | 971 | return 0; |
974 | } | 972 | } |
975 | 973 | ||
974 | might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); | ||
975 | |||
976 | spin_lock_irqsave(&dev->power.lock, flags); | 976 | spin_lock_irqsave(&dev->power.lock, flags); |
977 | retval = rpm_idle(dev, rpmflags); | 977 | retval = rpm_idle(dev, rpmflags); |
978 | spin_unlock_irqrestore(&dev->power.lock, flags); | 978 | spin_unlock_irqrestore(&dev->power.lock, flags); |
@@ -998,13 +998,13 @@ int __pm_runtime_suspend(struct device *dev, int rpmflags) | |||
998 | unsigned long flags; | 998 | unsigned long flags; |
999 | int retval; | 999 | int retval; |
1000 | 1000 | ||
1001 | might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); | ||
1002 | |||
1003 | if (rpmflags & RPM_GET_PUT) { | 1001 | if (rpmflags & RPM_GET_PUT) { |
1004 | if (!atomic_dec_and_test(&dev->power.usage_count)) | 1002 | if (!atomic_dec_and_test(&dev->power.usage_count)) |
1005 | return 0; | 1003 | return 0; |
1006 | } | 1004 | } |
1007 | 1005 | ||
1006 | might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); | ||
1007 | |||
1008 | spin_lock_irqsave(&dev->power.lock, flags); | 1008 | spin_lock_irqsave(&dev->power.lock, flags); |
1009 | retval = rpm_suspend(dev, rpmflags); | 1009 | retval = rpm_suspend(dev, rpmflags); |
1010 | spin_unlock_irqrestore(&dev->power.lock, flags); | 1010 | spin_unlock_irqrestore(&dev->power.lock, flags); |
@@ -1029,7 +1029,8 @@ int __pm_runtime_resume(struct device *dev, int rpmflags) | |||
1029 | unsigned long flags; | 1029 | unsigned long flags; |
1030 | int retval; | 1030 | int retval; |
1031 | 1031 | ||
1032 | might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); | 1032 | might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe && |
1033 | dev->power.runtime_status != RPM_ACTIVE); | ||
1033 | 1034 | ||
1034 | if (rpmflags & RPM_GET_PUT) | 1035 | if (rpmflags & RPM_GET_PUT) |
1035 | atomic_inc(&dev->power.usage_count); | 1036 | atomic_inc(&dev->power.usage_count); |
diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c index 4fda623e55bb..c94360671f41 100644 --- a/drivers/cpufreq/brcmstb-avs-cpufreq.c +++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c | |||
@@ -784,8 +784,19 @@ static int brcm_avs_target_index(struct cpufreq_policy *policy, | |||
784 | static int brcm_avs_suspend(struct cpufreq_policy *policy) | 784 | static int brcm_avs_suspend(struct cpufreq_policy *policy) |
785 | { | 785 | { |
786 | struct private_data *priv = policy->driver_data; | 786 | struct private_data *priv = policy->driver_data; |
787 | int ret; | ||
788 | |||
789 | ret = brcm_avs_get_pmap(priv, &priv->pmap); | ||
790 | if (ret) | ||
791 | return ret; | ||
787 | 792 | ||
788 | return brcm_avs_get_pmap(priv, &priv->pmap); | 793 | /* |
794 | * We can't use the P-state returned by brcm_avs_get_pmap(), since | ||
795 | * that's the initial P-state from when the P-map was downloaded to the | ||
796 | * AVS co-processor, not necessarily the P-state we are running at now. | ||
797 | * So, we get the current P-state explicitly. | ||
798 | */ | ||
799 | return brcm_avs_get_pstate(priv, &priv->pmap.state); | ||
789 | } | 800 | } |
790 | 801 | ||
791 | static int brcm_avs_resume(struct cpufreq_policy *policy) | 802 | static int brcm_avs_resume(struct cpufreq_policy *policy) |
@@ -954,9 +965,9 @@ static ssize_t show_brcm_avs_pmap(struct cpufreq_policy *policy, char *buf) | |||
954 | brcm_avs_parse_p1(pmap.p1, &mdiv_p0, &pdiv, &ndiv); | 965 | brcm_avs_parse_p1(pmap.p1, &mdiv_p0, &pdiv, &ndiv); |
955 | brcm_avs_parse_p2(pmap.p2, &mdiv_p1, &mdiv_p2, &mdiv_p3, &mdiv_p4); | 966 | brcm_avs_parse_p2(pmap.p2, &mdiv_p1, &mdiv_p2, &mdiv_p3, &mdiv_p4); |
956 | 967 | ||
957 | return sprintf(buf, "0x%08x 0x%08x %u %u %u %u %u %u %u\n", | 968 | return sprintf(buf, "0x%08x 0x%08x %u %u %u %u %u %u %u %u %u\n", |
958 | pmap.p1, pmap.p2, ndiv, pdiv, mdiv_p0, mdiv_p1, mdiv_p2, | 969 | pmap.p1, pmap.p2, ndiv, pdiv, mdiv_p0, mdiv_p1, mdiv_p2, |
959 | mdiv_p3, mdiv_p4); | 970 | mdiv_p3, mdiv_p4, pmap.mode, pmap.state); |
960 | } | 971 | } |
961 | 972 | ||
962 | static ssize_t show_brcm_avs_voltage(struct cpufreq_policy *policy, char *buf) | 973 | static ssize_t show_brcm_avs_voltage(struct cpufreq_policy *policy, char *buf) |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index a54d65aa776d..50bd6d987fc3 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -1235,6 +1235,25 @@ static void intel_pstate_hwp_enable(struct cpudata *cpudata) | |||
1235 | cpudata->epp_default = intel_pstate_get_epp(cpudata, 0); | 1235 | cpudata->epp_default = intel_pstate_get_epp(cpudata, 0); |
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | #define MSR_IA32_POWER_CTL_BIT_EE 19 | ||
1239 | |||
1240 | /* Disable energy efficiency optimization */ | ||
1241 | static void intel_pstate_disable_ee(int cpu) | ||
1242 | { | ||
1243 | u64 power_ctl; | ||
1244 | int ret; | ||
1245 | |||
1246 | ret = rdmsrl_on_cpu(cpu, MSR_IA32_POWER_CTL, &power_ctl); | ||
1247 | if (ret) | ||
1248 | return; | ||
1249 | |||
1250 | if (!(power_ctl & BIT(MSR_IA32_POWER_CTL_BIT_EE))) { | ||
1251 | pr_info("Disabling energy efficiency optimization\n"); | ||
1252 | power_ctl |= BIT(MSR_IA32_POWER_CTL_BIT_EE); | ||
1253 | wrmsrl_on_cpu(cpu, MSR_IA32_POWER_CTL, power_ctl); | ||
1254 | } | ||
1255 | } | ||
1256 | |||
1238 | static int atom_get_min_pstate(void) | 1257 | static int atom_get_min_pstate(void) |
1239 | { | 1258 | { |
1240 | u64 value; | 1259 | u64 value; |
@@ -1845,6 +1864,11 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = { | |||
1845 | {} | 1864 | {} |
1846 | }; | 1865 | }; |
1847 | 1866 | ||
1867 | static const struct x86_cpu_id intel_pstate_cpu_ee_disable_ids[] = { | ||
1868 | ICPU(INTEL_FAM6_KABYLAKE_DESKTOP, core_params), | ||
1869 | {} | ||
1870 | }; | ||
1871 | |||
1848 | static int intel_pstate_init_cpu(unsigned int cpunum) | 1872 | static int intel_pstate_init_cpu(unsigned int cpunum) |
1849 | { | 1873 | { |
1850 | struct cpudata *cpu; | 1874 | struct cpudata *cpu; |
@@ -1875,6 +1899,12 @@ static int intel_pstate_init_cpu(unsigned int cpunum) | |||
1875 | cpu->cpu = cpunum; | 1899 | cpu->cpu = cpunum; |
1876 | 1900 | ||
1877 | if (hwp_active) { | 1901 | if (hwp_active) { |
1902 | const struct x86_cpu_id *id; | ||
1903 | |||
1904 | id = x86_match_cpu(intel_pstate_cpu_ee_disable_ids); | ||
1905 | if (id) | ||
1906 | intel_pstate_disable_ee(cpunum); | ||
1907 | |||
1878 | intel_pstate_hwp_enable(cpu); | 1908 | intel_pstate_hwp_enable(cpu); |
1879 | pid_params.sample_rate_ms = 50; | 1909 | pid_params.sample_rate_ms = 50; |
1880 | pid_params.sample_rate_ns = 50 * NSEC_PER_MSEC; | 1910 | pid_params.sample_rate_ns = 50 * NSEC_PER_MSEC; |
diff --git a/drivers/crypto/ccp/ccp-dev-v5.c b/drivers/crypto/ccp/ccp-dev-v5.c index e2ce8190ecc9..612898b4aaad 100644 --- a/drivers/crypto/ccp/ccp-dev-v5.c +++ b/drivers/crypto/ccp/ccp-dev-v5.c | |||
@@ -959,7 +959,7 @@ static irqreturn_t ccp5_irq_handler(int irq, void *data) | |||
959 | static void ccp5_config(struct ccp_device *ccp) | 959 | static void ccp5_config(struct ccp_device *ccp) |
960 | { | 960 | { |
961 | /* Public side */ | 961 | /* Public side */ |
962 | iowrite32(0x00001249, ccp->io_regs + CMD5_REQID_CONFIG_OFFSET); | 962 | iowrite32(0x0, ccp->io_regs + CMD5_REQID_CONFIG_OFFSET); |
963 | } | 963 | } |
964 | 964 | ||
965 | static void ccp5other_config(struct ccp_device *ccp) | 965 | static void ccp5other_config(struct ccp_device *ccp) |
diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h index 830f35e6005f..649e5610a5ce 100644 --- a/drivers/crypto/ccp/ccp-dev.h +++ b/drivers/crypto/ccp/ccp-dev.h | |||
@@ -238,6 +238,7 @@ struct ccp_dma_chan { | |||
238 | struct ccp_device *ccp; | 238 | struct ccp_device *ccp; |
239 | 239 | ||
240 | spinlock_t lock; | 240 | spinlock_t lock; |
241 | struct list_head created; | ||
241 | struct list_head pending; | 242 | struct list_head pending; |
242 | struct list_head active; | 243 | struct list_head active; |
243 | struct list_head complete; | 244 | struct list_head complete; |
diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c index 6553912804f7..e5d9278f4019 100644 --- a/drivers/crypto/ccp/ccp-dmaengine.c +++ b/drivers/crypto/ccp/ccp-dmaengine.c | |||
@@ -63,6 +63,7 @@ static void ccp_free_chan_resources(struct dma_chan *dma_chan) | |||
63 | ccp_free_desc_resources(chan->ccp, &chan->complete); | 63 | ccp_free_desc_resources(chan->ccp, &chan->complete); |
64 | ccp_free_desc_resources(chan->ccp, &chan->active); | 64 | ccp_free_desc_resources(chan->ccp, &chan->active); |
65 | ccp_free_desc_resources(chan->ccp, &chan->pending); | 65 | ccp_free_desc_resources(chan->ccp, &chan->pending); |
66 | ccp_free_desc_resources(chan->ccp, &chan->created); | ||
66 | 67 | ||
67 | spin_unlock_irqrestore(&chan->lock, flags); | 68 | spin_unlock_irqrestore(&chan->lock, flags); |
68 | } | 69 | } |
@@ -273,6 +274,7 @@ static dma_cookie_t ccp_tx_submit(struct dma_async_tx_descriptor *tx_desc) | |||
273 | spin_lock_irqsave(&chan->lock, flags); | 274 | spin_lock_irqsave(&chan->lock, flags); |
274 | 275 | ||
275 | cookie = dma_cookie_assign(tx_desc); | 276 | cookie = dma_cookie_assign(tx_desc); |
277 | list_del(&desc->entry); | ||
276 | list_add_tail(&desc->entry, &chan->pending); | 278 | list_add_tail(&desc->entry, &chan->pending); |
277 | 279 | ||
278 | spin_unlock_irqrestore(&chan->lock, flags); | 280 | spin_unlock_irqrestore(&chan->lock, flags); |
@@ -426,7 +428,7 @@ static struct ccp_dma_desc *ccp_create_desc(struct dma_chan *dma_chan, | |||
426 | 428 | ||
427 | spin_lock_irqsave(&chan->lock, sflags); | 429 | spin_lock_irqsave(&chan->lock, sflags); |
428 | 430 | ||
429 | list_add_tail(&desc->entry, &chan->pending); | 431 | list_add_tail(&desc->entry, &chan->created); |
430 | 432 | ||
431 | spin_unlock_irqrestore(&chan->lock, sflags); | 433 | spin_unlock_irqrestore(&chan->lock, sflags); |
432 | 434 | ||
@@ -610,6 +612,7 @@ static int ccp_terminate_all(struct dma_chan *dma_chan) | |||
610 | /*TODO: Purge the complete list? */ | 612 | /*TODO: Purge the complete list? */ |
611 | ccp_free_desc_resources(chan->ccp, &chan->active); | 613 | ccp_free_desc_resources(chan->ccp, &chan->active); |
612 | ccp_free_desc_resources(chan->ccp, &chan->pending); | 614 | ccp_free_desc_resources(chan->ccp, &chan->pending); |
615 | ccp_free_desc_resources(chan->ccp, &chan->created); | ||
613 | 616 | ||
614 | spin_unlock_irqrestore(&chan->lock, flags); | 617 | spin_unlock_irqrestore(&chan->lock, flags); |
615 | 618 | ||
@@ -679,6 +682,7 @@ int ccp_dmaengine_register(struct ccp_device *ccp) | |||
679 | chan->ccp = ccp; | 682 | chan->ccp = ccp; |
680 | 683 | ||
681 | spin_lock_init(&chan->lock); | 684 | spin_lock_init(&chan->lock); |
685 | INIT_LIST_HEAD(&chan->created); | ||
682 | INIT_LIST_HEAD(&chan->pending); | 686 | INIT_LIST_HEAD(&chan->pending); |
683 | INIT_LIST_HEAD(&chan->active); | 687 | INIT_LIST_HEAD(&chan->active); |
684 | INIT_LIST_HEAD(&chan->complete); | 688 | INIT_LIST_HEAD(&chan->complete); |
diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c index 2ed1e24b44a8..b4b78b37f8a6 100644 --- a/drivers/crypto/chelsio/chcr_algo.c +++ b/drivers/crypto/chelsio/chcr_algo.c | |||
@@ -158,7 +158,7 @@ int chcr_handle_resp(struct crypto_async_request *req, unsigned char *input, | |||
158 | case CRYPTO_ALG_TYPE_AEAD: | 158 | case CRYPTO_ALG_TYPE_AEAD: |
159 | ctx_req.req.aead_req = (struct aead_request *)req; | 159 | ctx_req.req.aead_req = (struct aead_request *)req; |
160 | ctx_req.ctx.reqctx = aead_request_ctx(ctx_req.req.aead_req); | 160 | ctx_req.ctx.reqctx = aead_request_ctx(ctx_req.req.aead_req); |
161 | dma_unmap_sg(&u_ctx->lldi.pdev->dev, ctx_req.req.aead_req->dst, | 161 | dma_unmap_sg(&u_ctx->lldi.pdev->dev, ctx_req.ctx.reqctx->dst, |
162 | ctx_req.ctx.reqctx->dst_nents, DMA_FROM_DEVICE); | 162 | ctx_req.ctx.reqctx->dst_nents, DMA_FROM_DEVICE); |
163 | if (ctx_req.ctx.reqctx->skb) { | 163 | if (ctx_req.ctx.reqctx->skb) { |
164 | kfree_skb(ctx_req.ctx.reqctx->skb); | 164 | kfree_skb(ctx_req.ctx.reqctx->skb); |
@@ -1362,8 +1362,7 @@ static struct sk_buff *create_authenc_wr(struct aead_request *req, | |||
1362 | struct chcr_wr *chcr_req; | 1362 | struct chcr_wr *chcr_req; |
1363 | struct cpl_rx_phys_dsgl *phys_cpl; | 1363 | struct cpl_rx_phys_dsgl *phys_cpl; |
1364 | struct phys_sge_parm sg_param; | 1364 | struct phys_sge_parm sg_param; |
1365 | struct scatterlist *src, *dst; | 1365 | struct scatterlist *src; |
1366 | struct scatterlist src_sg[2], dst_sg[2]; | ||
1367 | unsigned int frags = 0, transhdr_len; | 1366 | unsigned int frags = 0, transhdr_len; |
1368 | unsigned int ivsize = crypto_aead_ivsize(tfm), dst_size = 0; | 1367 | unsigned int ivsize = crypto_aead_ivsize(tfm), dst_size = 0; |
1369 | unsigned int kctx_len = 0; | 1368 | unsigned int kctx_len = 0; |
@@ -1383,19 +1382,21 @@ static struct sk_buff *create_authenc_wr(struct aead_request *req, | |||
1383 | 1382 | ||
1384 | if (sg_nents_for_len(req->src, req->assoclen + req->cryptlen) < 0) | 1383 | if (sg_nents_for_len(req->src, req->assoclen + req->cryptlen) < 0) |
1385 | goto err; | 1384 | goto err; |
1386 | src = scatterwalk_ffwd(src_sg, req->src, req->assoclen); | 1385 | src = scatterwalk_ffwd(reqctx->srcffwd, req->src, req->assoclen); |
1387 | dst = src; | 1386 | reqctx->dst = src; |
1387 | |||
1388 | if (req->src != req->dst) { | 1388 | if (req->src != req->dst) { |
1389 | err = chcr_copy_assoc(req, aeadctx); | 1389 | err = chcr_copy_assoc(req, aeadctx); |
1390 | if (err) | 1390 | if (err) |
1391 | return ERR_PTR(err); | 1391 | return ERR_PTR(err); |
1392 | dst = scatterwalk_ffwd(dst_sg, req->dst, req->assoclen); | 1392 | reqctx->dst = scatterwalk_ffwd(reqctx->dstffwd, req->dst, |
1393 | req->assoclen); | ||
1393 | } | 1394 | } |
1394 | if (get_aead_subtype(tfm) == CRYPTO_ALG_SUB_TYPE_AEAD_NULL) { | 1395 | if (get_aead_subtype(tfm) == CRYPTO_ALG_SUB_TYPE_AEAD_NULL) { |
1395 | null = 1; | 1396 | null = 1; |
1396 | assoclen = 0; | 1397 | assoclen = 0; |
1397 | } | 1398 | } |
1398 | reqctx->dst_nents = sg_nents_for_len(dst, req->cryptlen + | 1399 | reqctx->dst_nents = sg_nents_for_len(reqctx->dst, req->cryptlen + |
1399 | (op_type ? -authsize : authsize)); | 1400 | (op_type ? -authsize : authsize)); |
1400 | if (reqctx->dst_nents <= 0) { | 1401 | if (reqctx->dst_nents <= 0) { |
1401 | pr_err("AUTHENC:Invalid Destination sg entries\n"); | 1402 | pr_err("AUTHENC:Invalid Destination sg entries\n"); |
@@ -1460,7 +1461,7 @@ static struct sk_buff *create_authenc_wr(struct aead_request *req, | |||
1460 | sg_param.obsize = req->cryptlen + (op_type ? -authsize : authsize); | 1461 | sg_param.obsize = req->cryptlen + (op_type ? -authsize : authsize); |
1461 | sg_param.qid = qid; | 1462 | sg_param.qid = qid; |
1462 | sg_param.align = 0; | 1463 | sg_param.align = 0; |
1463 | if (map_writesg_phys_cpl(&u_ctx->lldi.pdev->dev, phys_cpl, dst, | 1464 | if (map_writesg_phys_cpl(&u_ctx->lldi.pdev->dev, phys_cpl, reqctx->dst, |
1464 | &sg_param)) | 1465 | &sg_param)) |
1465 | goto dstmap_fail; | 1466 | goto dstmap_fail; |
1466 | 1467 | ||
@@ -1711,8 +1712,7 @@ static struct sk_buff *create_aead_ccm_wr(struct aead_request *req, | |||
1711 | struct chcr_wr *chcr_req; | 1712 | struct chcr_wr *chcr_req; |
1712 | struct cpl_rx_phys_dsgl *phys_cpl; | 1713 | struct cpl_rx_phys_dsgl *phys_cpl; |
1713 | struct phys_sge_parm sg_param; | 1714 | struct phys_sge_parm sg_param; |
1714 | struct scatterlist *src, *dst; | 1715 | struct scatterlist *src; |
1715 | struct scatterlist src_sg[2], dst_sg[2]; | ||
1716 | unsigned int frags = 0, transhdr_len, ivsize = AES_BLOCK_SIZE; | 1716 | unsigned int frags = 0, transhdr_len, ivsize = AES_BLOCK_SIZE; |
1717 | unsigned int dst_size = 0, kctx_len; | 1717 | unsigned int dst_size = 0, kctx_len; |
1718 | unsigned int sub_type; | 1718 | unsigned int sub_type; |
@@ -1728,17 +1728,19 @@ static struct sk_buff *create_aead_ccm_wr(struct aead_request *req, | |||
1728 | if (sg_nents_for_len(req->src, req->assoclen + req->cryptlen) < 0) | 1728 | if (sg_nents_for_len(req->src, req->assoclen + req->cryptlen) < 0) |
1729 | goto err; | 1729 | goto err; |
1730 | sub_type = get_aead_subtype(tfm); | 1730 | sub_type = get_aead_subtype(tfm); |
1731 | src = scatterwalk_ffwd(src_sg, req->src, req->assoclen); | 1731 | src = scatterwalk_ffwd(reqctx->srcffwd, req->src, req->assoclen); |
1732 | dst = src; | 1732 | reqctx->dst = src; |
1733 | |||
1733 | if (req->src != req->dst) { | 1734 | if (req->src != req->dst) { |
1734 | err = chcr_copy_assoc(req, aeadctx); | 1735 | err = chcr_copy_assoc(req, aeadctx); |
1735 | if (err) { | 1736 | if (err) { |
1736 | pr_err("AAD copy to destination buffer fails\n"); | 1737 | pr_err("AAD copy to destination buffer fails\n"); |
1737 | return ERR_PTR(err); | 1738 | return ERR_PTR(err); |
1738 | } | 1739 | } |
1739 | dst = scatterwalk_ffwd(dst_sg, req->dst, req->assoclen); | 1740 | reqctx->dst = scatterwalk_ffwd(reqctx->dstffwd, req->dst, |
1741 | req->assoclen); | ||
1740 | } | 1742 | } |
1741 | reqctx->dst_nents = sg_nents_for_len(dst, req->cryptlen + | 1743 | reqctx->dst_nents = sg_nents_for_len(reqctx->dst, req->cryptlen + |
1742 | (op_type ? -authsize : authsize)); | 1744 | (op_type ? -authsize : authsize)); |
1743 | if (reqctx->dst_nents <= 0) { | 1745 | if (reqctx->dst_nents <= 0) { |
1744 | pr_err("CCM:Invalid Destination sg entries\n"); | 1746 | pr_err("CCM:Invalid Destination sg entries\n"); |
@@ -1777,7 +1779,7 @@ static struct sk_buff *create_aead_ccm_wr(struct aead_request *req, | |||
1777 | sg_param.obsize = req->cryptlen + (op_type ? -authsize : authsize); | 1779 | sg_param.obsize = req->cryptlen + (op_type ? -authsize : authsize); |
1778 | sg_param.qid = qid; | 1780 | sg_param.qid = qid; |
1779 | sg_param.align = 0; | 1781 | sg_param.align = 0; |
1780 | if (map_writesg_phys_cpl(&u_ctx->lldi.pdev->dev, phys_cpl, dst, | 1782 | if (map_writesg_phys_cpl(&u_ctx->lldi.pdev->dev, phys_cpl, reqctx->dst, |
1781 | &sg_param)) | 1783 | &sg_param)) |
1782 | goto dstmap_fail; | 1784 | goto dstmap_fail; |
1783 | 1785 | ||
@@ -1809,8 +1811,7 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req, | |||
1809 | struct chcr_wr *chcr_req; | 1811 | struct chcr_wr *chcr_req; |
1810 | struct cpl_rx_phys_dsgl *phys_cpl; | 1812 | struct cpl_rx_phys_dsgl *phys_cpl; |
1811 | struct phys_sge_parm sg_param; | 1813 | struct phys_sge_parm sg_param; |
1812 | struct scatterlist *src, *dst; | 1814 | struct scatterlist *src; |
1813 | struct scatterlist src_sg[2], dst_sg[2]; | ||
1814 | unsigned int frags = 0, transhdr_len; | 1815 | unsigned int frags = 0, transhdr_len; |
1815 | unsigned int ivsize = AES_BLOCK_SIZE; | 1816 | unsigned int ivsize = AES_BLOCK_SIZE; |
1816 | unsigned int dst_size = 0, kctx_len; | 1817 | unsigned int dst_size = 0, kctx_len; |
@@ -1832,13 +1833,14 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req, | |||
1832 | if (sg_nents_for_len(req->src, req->assoclen + req->cryptlen) < 0) | 1833 | if (sg_nents_for_len(req->src, req->assoclen + req->cryptlen) < 0) |
1833 | goto err; | 1834 | goto err; |
1834 | 1835 | ||
1835 | src = scatterwalk_ffwd(src_sg, req->src, req->assoclen); | 1836 | src = scatterwalk_ffwd(reqctx->srcffwd, req->src, req->assoclen); |
1836 | dst = src; | 1837 | reqctx->dst = src; |
1837 | if (req->src != req->dst) { | 1838 | if (req->src != req->dst) { |
1838 | err = chcr_copy_assoc(req, aeadctx); | 1839 | err = chcr_copy_assoc(req, aeadctx); |
1839 | if (err) | 1840 | if (err) |
1840 | return ERR_PTR(err); | 1841 | return ERR_PTR(err); |
1841 | dst = scatterwalk_ffwd(dst_sg, req->dst, req->assoclen); | 1842 | reqctx->dst = scatterwalk_ffwd(reqctx->dstffwd, req->dst, |
1843 | req->assoclen); | ||
1842 | } | 1844 | } |
1843 | 1845 | ||
1844 | if (!req->cryptlen) | 1846 | if (!req->cryptlen) |
@@ -1848,7 +1850,7 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req, | |||
1848 | crypt_len = AES_BLOCK_SIZE; | 1850 | crypt_len = AES_BLOCK_SIZE; |
1849 | else | 1851 | else |
1850 | crypt_len = req->cryptlen; | 1852 | crypt_len = req->cryptlen; |
1851 | reqctx->dst_nents = sg_nents_for_len(dst, req->cryptlen + | 1853 | reqctx->dst_nents = sg_nents_for_len(reqctx->dst, req->cryptlen + |
1852 | (op_type ? -authsize : authsize)); | 1854 | (op_type ? -authsize : authsize)); |
1853 | if (reqctx->dst_nents <= 0) { | 1855 | if (reqctx->dst_nents <= 0) { |
1854 | pr_err("GCM:Invalid Destination sg entries\n"); | 1856 | pr_err("GCM:Invalid Destination sg entries\n"); |
@@ -1923,7 +1925,7 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req, | |||
1923 | sg_param.obsize = req->cryptlen + (op_type ? -authsize : authsize); | 1925 | sg_param.obsize = req->cryptlen + (op_type ? -authsize : authsize); |
1924 | sg_param.qid = qid; | 1926 | sg_param.qid = qid; |
1925 | sg_param.align = 0; | 1927 | sg_param.align = 0; |
1926 | if (map_writesg_phys_cpl(&u_ctx->lldi.pdev->dev, phys_cpl, dst, | 1928 | if (map_writesg_phys_cpl(&u_ctx->lldi.pdev->dev, phys_cpl, reqctx->dst, |
1927 | &sg_param)) | 1929 | &sg_param)) |
1928 | goto dstmap_fail; | 1930 | goto dstmap_fail; |
1929 | 1931 | ||
@@ -1937,7 +1939,8 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req, | |||
1937 | write_sg_to_skb(skb, &frags, src, req->cryptlen); | 1939 | write_sg_to_skb(skb, &frags, src, req->cryptlen); |
1938 | } else { | 1940 | } else { |
1939 | aes_gcm_empty_pld_pad(req->dst, authsize - 1); | 1941 | aes_gcm_empty_pld_pad(req->dst, authsize - 1); |
1940 | write_sg_to_skb(skb, &frags, dst, crypt_len); | 1942 | write_sg_to_skb(skb, &frags, reqctx->dst, crypt_len); |
1943 | |||
1941 | } | 1944 | } |
1942 | 1945 | ||
1943 | create_wreq(ctx, chcr_req, req, skb, kctx_len, size, 1, | 1946 | create_wreq(ctx, chcr_req, req, skb, kctx_len, size, 1, |
@@ -2189,8 +2192,8 @@ static int chcr_gcm_setkey(struct crypto_aead *aead, const u8 *key, | |||
2189 | unsigned int ck_size; | 2192 | unsigned int ck_size; |
2190 | int ret = 0, key_ctx_size = 0; | 2193 | int ret = 0, key_ctx_size = 0; |
2191 | 2194 | ||
2192 | if (get_aead_subtype(aead) == | 2195 | if (get_aead_subtype(aead) == CRYPTO_ALG_SUB_TYPE_AEAD_RFC4106 && |
2193 | CRYPTO_ALG_SUB_TYPE_AEAD_RFC4106) { | 2196 | keylen > 3) { |
2194 | keylen -= 4; /* nonce/salt is present in the last 4 bytes */ | 2197 | keylen -= 4; /* nonce/salt is present in the last 4 bytes */ |
2195 | memcpy(aeadctx->salt, key + keylen, 4); | 2198 | memcpy(aeadctx->salt, key + keylen, 4); |
2196 | } | 2199 | } |
diff --git a/drivers/crypto/chelsio/chcr_core.c b/drivers/crypto/chelsio/chcr_core.c index 918da8e6e2d8..1c65f07e1cc9 100644 --- a/drivers/crypto/chelsio/chcr_core.c +++ b/drivers/crypto/chelsio/chcr_core.c | |||
@@ -52,6 +52,7 @@ static struct cxgb4_uld_info chcr_uld_info = { | |||
52 | int assign_chcr_device(struct chcr_dev **dev) | 52 | int assign_chcr_device(struct chcr_dev **dev) |
53 | { | 53 | { |
54 | struct uld_ctx *u_ctx; | 54 | struct uld_ctx *u_ctx; |
55 | int ret = -ENXIO; | ||
55 | 56 | ||
56 | /* | 57 | /* |
57 | * Which device to use if multiple devices are available TODO | 58 | * Which device to use if multiple devices are available TODO |
@@ -59,15 +60,14 @@ int assign_chcr_device(struct chcr_dev **dev) | |||
59 | * must go to the same device to maintain the ordering. | 60 | * must go to the same device to maintain the ordering. |
60 | */ | 61 | */ |
61 | mutex_lock(&dev_mutex); /* TODO ? */ | 62 | mutex_lock(&dev_mutex); /* TODO ? */ |
62 | u_ctx = list_first_entry(&uld_ctx_list, struct uld_ctx, entry); | 63 | list_for_each_entry(u_ctx, &uld_ctx_list, entry) |
63 | if (!u_ctx) { | 64 | if (u_ctx && u_ctx->dev) { |
64 | mutex_unlock(&dev_mutex); | 65 | *dev = u_ctx->dev; |
65 | return -ENXIO; | 66 | ret = 0; |
67 | break; | ||
66 | } | 68 | } |
67 | |||
68 | *dev = u_ctx->dev; | ||
69 | mutex_unlock(&dev_mutex); | 69 | mutex_unlock(&dev_mutex); |
70 | return 0; | 70 | return ret; |
71 | } | 71 | } |
72 | 72 | ||
73 | static int chcr_dev_add(struct uld_ctx *u_ctx) | 73 | static int chcr_dev_add(struct uld_ctx *u_ctx) |
@@ -202,10 +202,8 @@ static int chcr_uld_state_change(void *handle, enum cxgb4_state state) | |||
202 | 202 | ||
203 | static int __init chcr_crypto_init(void) | 203 | static int __init chcr_crypto_init(void) |
204 | { | 204 | { |
205 | if (cxgb4_register_uld(CXGB4_ULD_CRYPTO, &chcr_uld_info)) { | 205 | if (cxgb4_register_uld(CXGB4_ULD_CRYPTO, &chcr_uld_info)) |
206 | pr_err("ULD register fail: No chcr crypto support in cxgb4"); | 206 | pr_err("ULD register fail: No chcr crypto support in cxgb4"); |
207 | return -1; | ||
208 | } | ||
209 | 207 | ||
210 | return 0; | 208 | return 0; |
211 | } | 209 | } |
diff --git a/drivers/crypto/chelsio/chcr_crypto.h b/drivers/crypto/chelsio/chcr_crypto.h index d5af7d64a763..7ec0a8f12475 100644 --- a/drivers/crypto/chelsio/chcr_crypto.h +++ b/drivers/crypto/chelsio/chcr_crypto.h | |||
@@ -158,6 +158,9 @@ struct ablk_ctx { | |||
158 | }; | 158 | }; |
159 | struct chcr_aead_reqctx { | 159 | struct chcr_aead_reqctx { |
160 | struct sk_buff *skb; | 160 | struct sk_buff *skb; |
161 | struct scatterlist *dst; | ||
162 | struct scatterlist srcffwd[2]; | ||
163 | struct scatterlist dstffwd[2]; | ||
161 | short int dst_nents; | 164 | short int dst_nents; |
162 | u16 verify; | 165 | u16 verify; |
163 | u8 iv[CHCR_MAX_CRYPTO_IV_LEN]; | 166 | u8 iv[CHCR_MAX_CRYPTO_IV_LEN]; |
diff --git a/drivers/crypto/qat/qat_c62x/adf_drv.c b/drivers/crypto/qat/qat_c62x/adf_drv.c index bc5cbc193aae..5b2d78a5b5aa 100644 --- a/drivers/crypto/qat/qat_c62x/adf_drv.c +++ b/drivers/crypto/qat/qat_c62x/adf_drv.c | |||
@@ -233,7 +233,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
233 | &hw_data->accel_capabilities_mask); | 233 | &hw_data->accel_capabilities_mask); |
234 | 234 | ||
235 | /* Find and map all the device's BARS */ | 235 | /* Find and map all the device's BARS */ |
236 | i = 0; | 236 | i = (hw_data->fuses & ADF_DEVICE_FUSECTL_MASK) ? 1 : 0; |
237 | bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); | 237 | bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); |
238 | for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask, | 238 | for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask, |
239 | ADF_PCI_MAX_BARS * 2) { | 239 | ADF_PCI_MAX_BARS * 2) { |
diff --git a/drivers/crypto/qat/qat_common/adf_accel_devices.h b/drivers/crypto/qat/qat_common/adf_accel_devices.h index e8822536530b..33f0a6251e38 100644 --- a/drivers/crypto/qat/qat_common/adf_accel_devices.h +++ b/drivers/crypto/qat/qat_common/adf_accel_devices.h | |||
@@ -69,6 +69,7 @@ | |||
69 | #define ADF_ERRSOU5 (0x3A000 + 0xD8) | 69 | #define ADF_ERRSOU5 (0x3A000 + 0xD8) |
70 | #define ADF_DEVICE_FUSECTL_OFFSET 0x40 | 70 | #define ADF_DEVICE_FUSECTL_OFFSET 0x40 |
71 | #define ADF_DEVICE_LEGFUSE_OFFSET 0x4C | 71 | #define ADF_DEVICE_LEGFUSE_OFFSET 0x4C |
72 | #define ADF_DEVICE_FUSECTL_MASK 0x80000000 | ||
72 | #define ADF_PCI_MAX_BARS 3 | 73 | #define ADF_PCI_MAX_BARS 3 |
73 | #define ADF_DEVICE_NAME_LENGTH 32 | 74 | #define ADF_DEVICE_NAME_LENGTH 32 |
74 | #define ADF_ETR_MAX_RINGS_PER_BANK 16 | 75 | #define ADF_ETR_MAX_RINGS_PER_BANK 16 |
diff --git a/drivers/crypto/qat/qat_common/qat_hal.c b/drivers/crypto/qat/qat_common/qat_hal.c index 1e480f140663..8c4fd255a601 100644 --- a/drivers/crypto/qat/qat_common/qat_hal.c +++ b/drivers/crypto/qat/qat_common/qat_hal.c | |||
@@ -456,7 +456,7 @@ static int qat_hal_init_esram(struct icp_qat_fw_loader_handle *handle) | |||
456 | unsigned int csr_val; | 456 | unsigned int csr_val; |
457 | int times = 30; | 457 | int times = 30; |
458 | 458 | ||
459 | if (handle->pci_dev->device == ADF_C3XXX_PCI_DEVICE_ID) | 459 | if (handle->pci_dev->device != ADF_DH895XCC_PCI_DEVICE_ID) |
460 | return 0; | 460 | return 0; |
461 | 461 | ||
462 | csr_val = ADF_CSR_RD(csr_addr, 0); | 462 | csr_val = ADF_CSR_RD(csr_addr, 0); |
@@ -716,7 +716,7 @@ int qat_hal_init(struct adf_accel_dev *accel_dev) | |||
716 | (void __iomem *)((uintptr_t)handle->hal_cap_ae_xfer_csr_addr_v + | 716 | (void __iomem *)((uintptr_t)handle->hal_cap_ae_xfer_csr_addr_v + |
717 | LOCAL_TO_XFER_REG_OFFSET); | 717 | LOCAL_TO_XFER_REG_OFFSET); |
718 | handle->pci_dev = pci_info->pci_dev; | 718 | handle->pci_dev = pci_info->pci_dev; |
719 | if (handle->pci_dev->device != ADF_C3XXX_PCI_DEVICE_ID) { | 719 | if (handle->pci_dev->device == ADF_DH895XCC_PCI_DEVICE_ID) { |
720 | sram_bar = | 720 | sram_bar = |
721 | &pci_info->pci_bars[hw_data->get_sram_bar_id(hw_data)]; | 721 | &pci_info->pci_bars[hw_data->get_sram_bar_id(hw_data)]; |
722 | handle->hal_sram_addr_v = sram_bar->virt_addr; | 722 | handle->hal_sram_addr_v = sram_bar->virt_addr; |
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index 921dfa047202..260c4b4b492e 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c | |||
@@ -187,6 +187,7 @@ static efi_status_t update_fdt_memmap(void *fdt, struct efi_boot_memmap *map) | |||
187 | struct exit_boot_struct { | 187 | struct exit_boot_struct { |
188 | efi_memory_desc_t *runtime_map; | 188 | efi_memory_desc_t *runtime_map; |
189 | int *runtime_entry_count; | 189 | int *runtime_entry_count; |
190 | void *new_fdt_addr; | ||
190 | }; | 191 | }; |
191 | 192 | ||
192 | static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, | 193 | static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, |
@@ -202,7 +203,7 @@ static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, | |||
202 | efi_get_virtmap(*map->map, *map->map_size, *map->desc_size, | 203 | efi_get_virtmap(*map->map, *map->map_size, *map->desc_size, |
203 | p->runtime_map, p->runtime_entry_count); | 204 | p->runtime_map, p->runtime_entry_count); |
204 | 205 | ||
205 | return EFI_SUCCESS; | 206 | return update_fdt_memmap(p->new_fdt_addr, map); |
206 | } | 207 | } |
207 | 208 | ||
208 | /* | 209 | /* |
@@ -300,22 +301,13 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, | |||
300 | 301 | ||
301 | priv.runtime_map = runtime_map; | 302 | priv.runtime_map = runtime_map; |
302 | priv.runtime_entry_count = &runtime_entry_count; | 303 | priv.runtime_entry_count = &runtime_entry_count; |
304 | priv.new_fdt_addr = (void *)*new_fdt_addr; | ||
303 | status = efi_exit_boot_services(sys_table, handle, &map, &priv, | 305 | status = efi_exit_boot_services(sys_table, handle, &map, &priv, |
304 | exit_boot_func); | 306 | exit_boot_func); |
305 | 307 | ||
306 | if (status == EFI_SUCCESS) { | 308 | if (status == EFI_SUCCESS) { |
307 | efi_set_virtual_address_map_t *svam; | 309 | efi_set_virtual_address_map_t *svam; |
308 | 310 | ||
309 | status = update_fdt_memmap((void *)*new_fdt_addr, &map); | ||
310 | if (status != EFI_SUCCESS) { | ||
311 | /* | ||
312 | * The kernel won't get far without the memory map, but | ||
313 | * may still be able to print something meaningful so | ||
314 | * return success here. | ||
315 | */ | ||
316 | return EFI_SUCCESS; | ||
317 | } | ||
318 | |||
319 | /* Install the new virtual address map */ | 311 | /* Install the new virtual address map */ |
320 | svam = sys_table->runtime->set_virtual_address_map; | 312 | svam = sys_table->runtime->set_virtual_address_map; |
321 | status = svam(runtime_entry_count * desc_size, desc_size, | 313 | status = svam(runtime_entry_count * desc_size, desc_size, |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c index e2b0b1646f99..0635829b18cf 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | |||
@@ -254,6 +254,9 @@ static void gmc_v6_0_mc_program(struct amdgpu_device *adev) | |||
254 | } | 254 | } |
255 | WREG32(mmHDP_REG_COHERENCY_FLUSH_CNTL, 0); | 255 | WREG32(mmHDP_REG_COHERENCY_FLUSH_CNTL, 0); |
256 | 256 | ||
257 | if (adev->mode_info.num_crtc) | ||
258 | amdgpu_display_set_vga_render_state(adev, false); | ||
259 | |||
257 | gmc_v6_0_mc_stop(adev, &save); | 260 | gmc_v6_0_mc_stop(adev, &save); |
258 | 261 | ||
259 | if (gmc_v6_0_wait_for_idle((void *)adev)) { | 262 | if (gmc_v6_0_wait_for_idle((void *)adev)) { |
@@ -283,7 +286,6 @@ static void gmc_v6_0_mc_program(struct amdgpu_device *adev) | |||
283 | dev_warn(adev->dev, "Wait for MC idle timedout !\n"); | 286 | dev_warn(adev->dev, "Wait for MC idle timedout !\n"); |
284 | } | 287 | } |
285 | gmc_v6_0_mc_resume(adev, &save); | 288 | gmc_v6_0_mc_resume(adev, &save); |
286 | amdgpu_display_set_vga_render_state(adev, false); | ||
287 | } | 289 | } |
288 | 290 | ||
289 | static int gmc_v6_0_mc_init(struct amdgpu_device *adev) | 291 | static int gmc_v6_0_mc_init(struct amdgpu_device *adev) |
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 50f5cf7b69d1..fdfb1ec17e66 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c | |||
@@ -2032,13 +2032,16 @@ static void complete_crtc_signaling(struct drm_device *dev, | |||
2032 | } | 2032 | } |
2033 | 2033 | ||
2034 | for_each_crtc_in_state(state, crtc, crtc_state, i) { | 2034 | for_each_crtc_in_state(state, crtc, crtc_state, i) { |
2035 | struct drm_pending_vblank_event *event = crtc_state->event; | ||
2035 | /* | 2036 | /* |
2036 | * TEST_ONLY and PAGE_FLIP_EVENT are mutually | 2037 | * Free the allocated event. drm_atomic_helper_setup_commit |
2037 | * exclusive, if they weren't, this code should be | 2038 | * can allocate an event too, so only free it if it's ours |
2038 | * called on success for TEST_ONLY too. | 2039 | * to prevent a double free in drm_atomic_state_clear. |
2039 | */ | 2040 | */ |
2040 | if (crtc_state->event) | 2041 | if (event && (event->base.fence || event->base.file_priv)) { |
2041 | drm_event_cancel_free(dev, &crtc_state->event->base); | 2042 | drm_event_cancel_free(dev, &event->base); |
2043 | crtc_state->event = NULL; | ||
2044 | } | ||
2042 | } | 2045 | } |
2043 | 2046 | ||
2044 | if (!fence_state) | 2047 | if (!fence_state) |
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 34f757bcabae..4594477dee00 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c | |||
@@ -1666,9 +1666,6 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev, | |||
1666 | 1666 | ||
1667 | funcs = plane->helper_private; | 1667 | funcs = plane->helper_private; |
1668 | 1668 | ||
1669 | if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc)) | ||
1670 | continue; | ||
1671 | |||
1672 | if (funcs->prepare_fb) { | 1669 | if (funcs->prepare_fb) { |
1673 | ret = funcs->prepare_fb(plane, plane_state); | 1670 | ret = funcs->prepare_fb(plane, plane_state); |
1674 | if (ret) | 1671 | if (ret) |
@@ -1685,9 +1682,6 @@ fail: | |||
1685 | if (j >= i) | 1682 | if (j >= i) |
1686 | continue; | 1683 | continue; |
1687 | 1684 | ||
1688 | if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc)) | ||
1689 | continue; | ||
1690 | |||
1691 | funcs = plane->helper_private; | 1685 | funcs = plane->helper_private; |
1692 | 1686 | ||
1693 | if (funcs->cleanup_fb) | 1687 | if (funcs->cleanup_fb) |
@@ -1954,9 +1948,6 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev, | |||
1954 | for_each_plane_in_state(old_state, plane, plane_state, i) { | 1948 | for_each_plane_in_state(old_state, plane, plane_state, i) { |
1955 | const struct drm_plane_helper_funcs *funcs; | 1949 | const struct drm_plane_helper_funcs *funcs; |
1956 | 1950 | ||
1957 | if (!drm_atomic_helper_framebuffer_changed(dev, old_state, plane_state->crtc)) | ||
1958 | continue; | ||
1959 | |||
1960 | funcs = plane->helper_private; | 1951 | funcs = plane->helper_private; |
1961 | 1952 | ||
1962 | if (funcs->cleanup_fb) | 1953 | if (funcs->cleanup_fb) |
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 5a4526289392..7a7019ac9388 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c | |||
@@ -225,6 +225,7 @@ int drm_connector_init(struct drm_device *dev, | |||
225 | 225 | ||
226 | INIT_LIST_HEAD(&connector->probed_modes); | 226 | INIT_LIST_HEAD(&connector->probed_modes); |
227 | INIT_LIST_HEAD(&connector->modes); | 227 | INIT_LIST_HEAD(&connector->modes); |
228 | mutex_init(&connector->mutex); | ||
228 | connector->edid_blob_ptr = NULL; | 229 | connector->edid_blob_ptr = NULL; |
229 | connector->status = connector_status_unknown; | 230 | connector->status = connector_status_unknown; |
230 | 231 | ||
@@ -359,6 +360,8 @@ void drm_connector_cleanup(struct drm_connector *connector) | |||
359 | connector->funcs->atomic_destroy_state(connector, | 360 | connector->funcs->atomic_destroy_state(connector, |
360 | connector->state); | 361 | connector->state); |
361 | 362 | ||
363 | mutex_destroy(&connector->mutex); | ||
364 | |||
362 | memset(connector, 0, sizeof(*connector)); | 365 | memset(connector, 0, sizeof(*connector)); |
363 | } | 366 | } |
364 | EXPORT_SYMBOL(drm_connector_cleanup); | 367 | EXPORT_SYMBOL(drm_connector_cleanup); |
@@ -374,14 +377,18 @@ EXPORT_SYMBOL(drm_connector_cleanup); | |||
374 | */ | 377 | */ |
375 | int drm_connector_register(struct drm_connector *connector) | 378 | int drm_connector_register(struct drm_connector *connector) |
376 | { | 379 | { |
377 | int ret; | 380 | int ret = 0; |
378 | 381 | ||
379 | if (connector->registered) | 382 | if (!connector->dev->registered) |
380 | return 0; | 383 | return 0; |
381 | 384 | ||
385 | mutex_lock(&connector->mutex); | ||
386 | if (connector->registered) | ||
387 | goto unlock; | ||
388 | |||
382 | ret = drm_sysfs_connector_add(connector); | 389 | ret = drm_sysfs_connector_add(connector); |
383 | if (ret) | 390 | if (ret) |
384 | return ret; | 391 | goto unlock; |
385 | 392 | ||
386 | ret = drm_debugfs_connector_add(connector); | 393 | ret = drm_debugfs_connector_add(connector); |
387 | if (ret) { | 394 | if (ret) { |
@@ -397,12 +404,14 @@ int drm_connector_register(struct drm_connector *connector) | |||
397 | drm_mode_object_register(connector->dev, &connector->base); | 404 | drm_mode_object_register(connector->dev, &connector->base); |
398 | 405 | ||
399 | connector->registered = true; | 406 | connector->registered = true; |
400 | return 0; | 407 | goto unlock; |
401 | 408 | ||
402 | err_debugfs: | 409 | err_debugfs: |
403 | drm_debugfs_connector_remove(connector); | 410 | drm_debugfs_connector_remove(connector); |
404 | err_sysfs: | 411 | err_sysfs: |
405 | drm_sysfs_connector_remove(connector); | 412 | drm_sysfs_connector_remove(connector); |
413 | unlock: | ||
414 | mutex_unlock(&connector->mutex); | ||
406 | return ret; | 415 | return ret; |
407 | } | 416 | } |
408 | EXPORT_SYMBOL(drm_connector_register); | 417 | EXPORT_SYMBOL(drm_connector_register); |
@@ -415,8 +424,11 @@ EXPORT_SYMBOL(drm_connector_register); | |||
415 | */ | 424 | */ |
416 | void drm_connector_unregister(struct drm_connector *connector) | 425 | void drm_connector_unregister(struct drm_connector *connector) |
417 | { | 426 | { |
418 | if (!connector->registered) | 427 | mutex_lock(&connector->mutex); |
428 | if (!connector->registered) { | ||
429 | mutex_unlock(&connector->mutex); | ||
419 | return; | 430 | return; |
431 | } | ||
420 | 432 | ||
421 | if (connector->funcs->early_unregister) | 433 | if (connector->funcs->early_unregister) |
422 | connector->funcs->early_unregister(connector); | 434 | connector->funcs->early_unregister(connector); |
@@ -425,6 +437,7 @@ void drm_connector_unregister(struct drm_connector *connector) | |||
425 | drm_debugfs_connector_remove(connector); | 437 | drm_debugfs_connector_remove(connector); |
426 | 438 | ||
427 | connector->registered = false; | 439 | connector->registered = false; |
440 | mutex_unlock(&connector->mutex); | ||
428 | } | 441 | } |
429 | EXPORT_SYMBOL(drm_connector_unregister); | 442 | EXPORT_SYMBOL(drm_connector_unregister); |
430 | 443 | ||
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index a525751b4559..6594b4088f11 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -745,6 +745,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags) | |||
745 | if (ret) | 745 | if (ret) |
746 | goto err_minors; | 746 | goto err_minors; |
747 | 747 | ||
748 | dev->registered = true; | ||
749 | |||
748 | if (dev->driver->load) { | 750 | if (dev->driver->load) { |
749 | ret = dev->driver->load(dev, flags); | 751 | ret = dev->driver->load(dev, flags); |
750 | if (ret) | 752 | if (ret) |
@@ -785,6 +787,8 @@ void drm_dev_unregister(struct drm_device *dev) | |||
785 | 787 | ||
786 | drm_lastclose(dev); | 788 | drm_lastclose(dev); |
787 | 789 | ||
790 | dev->registered = false; | ||
791 | |||
788 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 792 | if (drm_core_check_feature(dev, DRIVER_MODESET)) |
789 | drm_modeset_unregister_all(dev); | 793 | drm_modeset_unregister_all(dev); |
790 | 794 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 69bc3b0c4390..8493e19b563a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1012,6 +1012,8 @@ struct intel_fbc { | |||
1012 | struct work_struct underrun_work; | 1012 | struct work_struct underrun_work; |
1013 | 1013 | ||
1014 | struct intel_fbc_state_cache { | 1014 | struct intel_fbc_state_cache { |
1015 | struct i915_vma *vma; | ||
1016 | |||
1015 | struct { | 1017 | struct { |
1016 | unsigned int mode_flags; | 1018 | unsigned int mode_flags; |
1017 | uint32_t hsw_bdw_pixel_rate; | 1019 | uint32_t hsw_bdw_pixel_rate; |
@@ -1025,15 +1027,14 @@ struct intel_fbc { | |||
1025 | } plane; | 1027 | } plane; |
1026 | 1028 | ||
1027 | struct { | 1029 | struct { |
1028 | u64 ilk_ggtt_offset; | ||
1029 | uint32_t pixel_format; | 1030 | uint32_t pixel_format; |
1030 | unsigned int stride; | 1031 | unsigned int stride; |
1031 | int fence_reg; | ||
1032 | unsigned int tiling_mode; | ||
1033 | } fb; | 1032 | } fb; |
1034 | } state_cache; | 1033 | } state_cache; |
1035 | 1034 | ||
1036 | struct intel_fbc_reg_params { | 1035 | struct intel_fbc_reg_params { |
1036 | struct i915_vma *vma; | ||
1037 | |||
1037 | struct { | 1038 | struct { |
1038 | enum pipe pipe; | 1039 | enum pipe pipe; |
1039 | enum plane plane; | 1040 | enum plane plane; |
@@ -1041,10 +1042,8 @@ struct intel_fbc { | |||
1041 | } crtc; | 1042 | } crtc; |
1042 | 1043 | ||
1043 | struct { | 1044 | struct { |
1044 | u64 ggtt_offset; | ||
1045 | uint32_t pixel_format; | 1045 | uint32_t pixel_format; |
1046 | unsigned int stride; | 1046 | unsigned int stride; |
1047 | int fence_reg; | ||
1048 | } fb; | 1047 | } fb; |
1049 | 1048 | ||
1050 | int cfb_size; | 1049 | int cfb_size; |
@@ -3168,13 +3167,6 @@ i915_gem_object_to_ggtt(struct drm_i915_gem_object *obj, | |||
3168 | return i915_gem_obj_to_vma(obj, &to_i915(obj->base.dev)->ggtt.base, view); | 3167 | return i915_gem_obj_to_vma(obj, &to_i915(obj->base.dev)->ggtt.base, view); |
3169 | } | 3168 | } |
3170 | 3169 | ||
3171 | static inline unsigned long | ||
3172 | i915_gem_object_ggtt_offset(struct drm_i915_gem_object *o, | ||
3173 | const struct i915_ggtt_view *view) | ||
3174 | { | ||
3175 | return i915_ggtt_offset(i915_gem_object_to_ggtt(o, view)); | ||
3176 | } | ||
3177 | |||
3178 | /* i915_gem_fence_reg.c */ | 3170 | /* i915_gem_fence_reg.c */ |
3179 | int __must_check i915_vma_get_fence(struct i915_vma *vma); | 3171 | int __must_check i915_vma_get_fence(struct i915_vma *vma); |
3180 | int __must_check i915_vma_put_fence(struct i915_vma *vma); | 3172 | int __must_check i915_vma_put_fence(struct i915_vma *vma); |
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c index dbe9fb41ae53..8d3e515f27ba 100644 --- a/drivers/gpu/drm/i915/intel_atomic_plane.c +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c | |||
@@ -85,6 +85,8 @@ intel_plane_duplicate_state(struct drm_plane *plane) | |||
85 | 85 | ||
86 | __drm_atomic_helper_plane_duplicate_state(plane, state); | 86 | __drm_atomic_helper_plane_duplicate_state(plane, state); |
87 | 87 | ||
88 | intel_state->vma = NULL; | ||
89 | |||
88 | return state; | 90 | return state; |
89 | } | 91 | } |
90 | 92 | ||
@@ -100,6 +102,24 @@ void | |||
100 | intel_plane_destroy_state(struct drm_plane *plane, | 102 | intel_plane_destroy_state(struct drm_plane *plane, |
101 | struct drm_plane_state *state) | 103 | struct drm_plane_state *state) |
102 | { | 104 | { |
105 | struct i915_vma *vma; | ||
106 | |||
107 | vma = fetch_and_zero(&to_intel_plane_state(state)->vma); | ||
108 | |||
109 | /* | ||
110 | * FIXME: Normally intel_cleanup_plane_fb handles destruction of vma. | ||
111 | * We currently don't clear all planes during driver unload, so we have | ||
112 | * to be able to unpin vma here for now. | ||
113 | * | ||
114 | * Normally this can only happen during unload when kmscon is disabled | ||
115 | * and userspace doesn't attempt to set a framebuffer at all. | ||
116 | */ | ||
117 | if (vma) { | ||
118 | mutex_lock(&plane->dev->struct_mutex); | ||
119 | intel_unpin_fb_vma(vma); | ||
120 | mutex_unlock(&plane->dev->struct_mutex); | ||
121 | } | ||
122 | |||
103 | drm_atomic_helper_plane_destroy_state(plane, state); | 123 | drm_atomic_helper_plane_destroy_state(plane, state); |
104 | } | 124 | } |
105 | 125 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index f0b9aa7a0483..f1e4a21d4664 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2235,27 +2235,22 @@ intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, unsigned int rotation) | |||
2235 | i915_vma_pin_fence(vma); | 2235 | i915_vma_pin_fence(vma); |
2236 | } | 2236 | } |
2237 | 2237 | ||
2238 | i915_vma_get(vma); | ||
2238 | err: | 2239 | err: |
2239 | intel_runtime_pm_put(dev_priv); | 2240 | intel_runtime_pm_put(dev_priv); |
2240 | return vma; | 2241 | return vma; |
2241 | } | 2242 | } |
2242 | 2243 | ||
2243 | void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation) | 2244 | void intel_unpin_fb_vma(struct i915_vma *vma) |
2244 | { | 2245 | { |
2245 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | 2246 | lockdep_assert_held(&vma->vm->dev->struct_mutex); |
2246 | struct i915_ggtt_view view; | ||
2247 | struct i915_vma *vma; | ||
2248 | |||
2249 | WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex)); | ||
2250 | |||
2251 | intel_fill_fb_ggtt_view(&view, fb, rotation); | ||
2252 | vma = i915_gem_object_to_ggtt(obj, &view); | ||
2253 | 2247 | ||
2254 | if (WARN_ON_ONCE(!vma)) | 2248 | if (WARN_ON_ONCE(!vma)) |
2255 | return; | 2249 | return; |
2256 | 2250 | ||
2257 | i915_vma_unpin_fence(vma); | 2251 | i915_vma_unpin_fence(vma); |
2258 | i915_gem_object_unpin_from_display_plane(vma); | 2252 | i915_gem_object_unpin_from_display_plane(vma); |
2253 | i915_vma_put(vma); | ||
2259 | } | 2254 | } |
2260 | 2255 | ||
2261 | static int intel_fb_pitch(const struct drm_framebuffer *fb, int plane, | 2256 | static int intel_fb_pitch(const struct drm_framebuffer *fb, int plane, |
@@ -2750,7 +2745,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, | |||
2750 | struct drm_device *dev = intel_crtc->base.dev; | 2745 | struct drm_device *dev = intel_crtc->base.dev; |
2751 | struct drm_i915_private *dev_priv = to_i915(dev); | 2746 | struct drm_i915_private *dev_priv = to_i915(dev); |
2752 | struct drm_crtc *c; | 2747 | struct drm_crtc *c; |
2753 | struct intel_crtc *i; | ||
2754 | struct drm_i915_gem_object *obj; | 2748 | struct drm_i915_gem_object *obj; |
2755 | struct drm_plane *primary = intel_crtc->base.primary; | 2749 | struct drm_plane *primary = intel_crtc->base.primary; |
2756 | struct drm_plane_state *plane_state = primary->state; | 2750 | struct drm_plane_state *plane_state = primary->state; |
@@ -2775,20 +2769,20 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, | |||
2775 | * an fb with another CRTC instead | 2769 | * an fb with another CRTC instead |
2776 | */ | 2770 | */ |
2777 | for_each_crtc(dev, c) { | 2771 | for_each_crtc(dev, c) { |
2778 | i = to_intel_crtc(c); | 2772 | struct intel_plane_state *state; |
2779 | 2773 | ||
2780 | if (c == &intel_crtc->base) | 2774 | if (c == &intel_crtc->base) |
2781 | continue; | 2775 | continue; |
2782 | 2776 | ||
2783 | if (!i->active) | 2777 | if (!to_intel_crtc(c)->active) |
2784 | continue; | 2778 | continue; |
2785 | 2779 | ||
2786 | fb = c->primary->fb; | 2780 | state = to_intel_plane_state(c->primary->state); |
2787 | if (!fb) | 2781 | if (!state->vma) |
2788 | continue; | 2782 | continue; |
2789 | 2783 | ||
2790 | obj = intel_fb_obj(fb); | 2784 | if (intel_plane_ggtt_offset(state) == plane_config->base) { |
2791 | if (i915_gem_object_ggtt_offset(obj, NULL) == plane_config->base) { | 2785 | fb = c->primary->fb; |
2792 | drm_framebuffer_reference(fb); | 2786 | drm_framebuffer_reference(fb); |
2793 | goto valid_fb; | 2787 | goto valid_fb; |
2794 | } | 2788 | } |
@@ -2809,6 +2803,19 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, | |||
2809 | return; | 2803 | return; |
2810 | 2804 | ||
2811 | valid_fb: | 2805 | valid_fb: |
2806 | mutex_lock(&dev->struct_mutex); | ||
2807 | intel_state->vma = | ||
2808 | intel_pin_and_fence_fb_obj(fb, primary->state->rotation); | ||
2809 | mutex_unlock(&dev->struct_mutex); | ||
2810 | if (IS_ERR(intel_state->vma)) { | ||
2811 | DRM_ERROR("failed to pin boot fb on pipe %d: %li\n", | ||
2812 | intel_crtc->pipe, PTR_ERR(intel_state->vma)); | ||
2813 | |||
2814 | intel_state->vma = NULL; | ||
2815 | drm_framebuffer_unreference(fb); | ||
2816 | return; | ||
2817 | } | ||
2818 | |||
2812 | plane_state->src_x = 0; | 2819 | plane_state->src_x = 0; |
2813 | plane_state->src_y = 0; | 2820 | plane_state->src_y = 0; |
2814 | plane_state->src_w = fb->width << 16; | 2821 | plane_state->src_w = fb->width << 16; |
@@ -3104,13 +3111,13 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, | |||
3104 | I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); | 3111 | I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); |
3105 | if (INTEL_GEN(dev_priv) >= 4) { | 3112 | if (INTEL_GEN(dev_priv) >= 4) { |
3106 | I915_WRITE(DSPSURF(plane), | 3113 | I915_WRITE(DSPSURF(plane), |
3107 | intel_fb_gtt_offset(fb, rotation) + | 3114 | intel_plane_ggtt_offset(plane_state) + |
3108 | intel_crtc->dspaddr_offset); | 3115 | intel_crtc->dspaddr_offset); |
3109 | I915_WRITE(DSPTILEOFF(plane), (y << 16) | x); | 3116 | I915_WRITE(DSPTILEOFF(plane), (y << 16) | x); |
3110 | I915_WRITE(DSPLINOFF(plane), linear_offset); | 3117 | I915_WRITE(DSPLINOFF(plane), linear_offset); |
3111 | } else { | 3118 | } else { |
3112 | I915_WRITE(DSPADDR(plane), | 3119 | I915_WRITE(DSPADDR(plane), |
3113 | intel_fb_gtt_offset(fb, rotation) + | 3120 | intel_plane_ggtt_offset(plane_state) + |
3114 | intel_crtc->dspaddr_offset); | 3121 | intel_crtc->dspaddr_offset); |
3115 | } | 3122 | } |
3116 | POSTING_READ(reg); | 3123 | POSTING_READ(reg); |
@@ -3207,7 +3214,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, | |||
3207 | 3214 | ||
3208 | I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); | 3215 | I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); |
3209 | I915_WRITE(DSPSURF(plane), | 3216 | I915_WRITE(DSPSURF(plane), |
3210 | intel_fb_gtt_offset(fb, rotation) + | 3217 | intel_plane_ggtt_offset(plane_state) + |
3211 | intel_crtc->dspaddr_offset); | 3218 | intel_crtc->dspaddr_offset); |
3212 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) { | 3219 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) { |
3213 | I915_WRITE(DSPOFFSET(plane), (y << 16) | x); | 3220 | I915_WRITE(DSPOFFSET(plane), (y << 16) | x); |
@@ -3230,23 +3237,6 @@ u32 intel_fb_stride_alignment(const struct drm_i915_private *dev_priv, | |||
3230 | } | 3237 | } |
3231 | } | 3238 | } |
3232 | 3239 | ||
3233 | u32 intel_fb_gtt_offset(struct drm_framebuffer *fb, | ||
3234 | unsigned int rotation) | ||
3235 | { | ||
3236 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | ||
3237 | struct i915_ggtt_view view; | ||
3238 | struct i915_vma *vma; | ||
3239 | |||
3240 | intel_fill_fb_ggtt_view(&view, fb, rotation); | ||
3241 | |||
3242 | vma = i915_gem_object_to_ggtt(obj, &view); | ||
3243 | if (WARN(!vma, "ggtt vma for display object not found! (view=%u)\n", | ||
3244 | view.type)) | ||
3245 | return -1; | ||
3246 | |||
3247 | return i915_ggtt_offset(vma); | ||
3248 | } | ||
3249 | |||
3250 | static void skl_detach_scaler(struct intel_crtc *intel_crtc, int id) | 3240 | static void skl_detach_scaler(struct intel_crtc *intel_crtc, int id) |
3251 | { | 3241 | { |
3252 | struct drm_device *dev = intel_crtc->base.dev; | 3242 | struct drm_device *dev = intel_crtc->base.dev; |
@@ -3441,7 +3431,7 @@ static void skylake_update_primary_plane(struct drm_plane *plane, | |||
3441 | } | 3431 | } |
3442 | 3432 | ||
3443 | I915_WRITE(PLANE_SURF(pipe, 0), | 3433 | I915_WRITE(PLANE_SURF(pipe, 0), |
3444 | intel_fb_gtt_offset(fb, rotation) + surf_addr); | 3434 | intel_plane_ggtt_offset(plane_state) + surf_addr); |
3445 | 3435 | ||
3446 | POSTING_READ(PLANE_SURF(pipe, 0)); | 3436 | POSTING_READ(PLANE_SURF(pipe, 0)); |
3447 | } | 3437 | } |
@@ -11536,7 +11526,7 @@ static void intel_unpin_work_fn(struct work_struct *__work) | |||
11536 | flush_work(&work->mmio_work); | 11526 | flush_work(&work->mmio_work); |
11537 | 11527 | ||
11538 | mutex_lock(&dev->struct_mutex); | 11528 | mutex_lock(&dev->struct_mutex); |
11539 | intel_unpin_fb_obj(work->old_fb, primary->state->rotation); | 11529 | intel_unpin_fb_vma(work->old_vma); |
11540 | i915_gem_object_put(work->pending_flip_obj); | 11530 | i915_gem_object_put(work->pending_flip_obj); |
11541 | mutex_unlock(&dev->struct_mutex); | 11531 | mutex_unlock(&dev->struct_mutex); |
11542 | 11532 | ||
@@ -12246,8 +12236,10 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, | |||
12246 | goto cleanup_pending; | 12236 | goto cleanup_pending; |
12247 | } | 12237 | } |
12248 | 12238 | ||
12249 | work->gtt_offset = intel_fb_gtt_offset(fb, primary->state->rotation); | 12239 | work->old_vma = to_intel_plane_state(primary->state)->vma; |
12250 | work->gtt_offset += intel_crtc->dspaddr_offset; | 12240 | to_intel_plane_state(primary->state)->vma = vma; |
12241 | |||
12242 | work->gtt_offset = i915_ggtt_offset(vma) + intel_crtc->dspaddr_offset; | ||
12251 | work->rotation = crtc->primary->state->rotation; | 12243 | work->rotation = crtc->primary->state->rotation; |
12252 | 12244 | ||
12253 | /* | 12245 | /* |
@@ -12301,7 +12293,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, | |||
12301 | cleanup_request: | 12293 | cleanup_request: |
12302 | i915_add_request_no_flush(request); | 12294 | i915_add_request_no_flush(request); |
12303 | cleanup_unpin: | 12295 | cleanup_unpin: |
12304 | intel_unpin_fb_obj(fb, crtc->primary->state->rotation); | 12296 | to_intel_plane_state(primary->state)->vma = work->old_vma; |
12297 | intel_unpin_fb_vma(vma); | ||
12305 | cleanup_pending: | 12298 | cleanup_pending: |
12306 | atomic_dec(&intel_crtc->unpin_work_count); | 12299 | atomic_dec(&intel_crtc->unpin_work_count); |
12307 | unlock: | 12300 | unlock: |
@@ -14794,6 +14787,8 @@ intel_prepare_plane_fb(struct drm_plane *plane, | |||
14794 | DRM_DEBUG_KMS("failed to pin object\n"); | 14787 | DRM_DEBUG_KMS("failed to pin object\n"); |
14795 | return PTR_ERR(vma); | 14788 | return PTR_ERR(vma); |
14796 | } | 14789 | } |
14790 | |||
14791 | to_intel_plane_state(new_state)->vma = vma; | ||
14797 | } | 14792 | } |
14798 | 14793 | ||
14799 | return 0; | 14794 | return 0; |
@@ -14812,19 +14807,12 @@ void | |||
14812 | intel_cleanup_plane_fb(struct drm_plane *plane, | 14807 | intel_cleanup_plane_fb(struct drm_plane *plane, |
14813 | struct drm_plane_state *old_state) | 14808 | struct drm_plane_state *old_state) |
14814 | { | 14809 | { |
14815 | struct drm_i915_private *dev_priv = to_i915(plane->dev); | 14810 | struct i915_vma *vma; |
14816 | struct intel_plane_state *old_intel_state; | ||
14817 | struct drm_i915_gem_object *old_obj = intel_fb_obj(old_state->fb); | ||
14818 | struct drm_i915_gem_object *obj = intel_fb_obj(plane->state->fb); | ||
14819 | |||
14820 | old_intel_state = to_intel_plane_state(old_state); | ||
14821 | |||
14822 | if (!obj && !old_obj) | ||
14823 | return; | ||
14824 | 14811 | ||
14825 | if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR || | 14812 | /* Should only be called after a successful intel_prepare_plane_fb()! */ |
14826 | !INTEL_INFO(dev_priv)->cursor_needs_physical)) | 14813 | vma = fetch_and_zero(&to_intel_plane_state(old_state)->vma); |
14827 | intel_unpin_fb_obj(old_state->fb, old_state->rotation); | 14814 | if (vma) |
14815 | intel_unpin_fb_vma(vma); | ||
14828 | } | 14816 | } |
14829 | 14817 | ||
14830 | int | 14818 | int |
@@ -15166,7 +15154,7 @@ intel_update_cursor_plane(struct drm_plane *plane, | |||
15166 | if (!obj) | 15154 | if (!obj) |
15167 | addr = 0; | 15155 | addr = 0; |
15168 | else if (!INTEL_INFO(dev_priv)->cursor_needs_physical) | 15156 | else if (!INTEL_INFO(dev_priv)->cursor_needs_physical) |
15169 | addr = i915_gem_object_ggtt_offset(obj, NULL); | 15157 | addr = intel_plane_ggtt_offset(state); |
15170 | else | 15158 | else |
15171 | addr = obj->phys_handle->busaddr; | 15159 | addr = obj->phys_handle->busaddr; |
15172 | 15160 | ||
@@ -17066,41 +17054,12 @@ void intel_display_resume(struct drm_device *dev) | |||
17066 | void intel_modeset_gem_init(struct drm_device *dev) | 17054 | void intel_modeset_gem_init(struct drm_device *dev) |
17067 | { | 17055 | { |
17068 | struct drm_i915_private *dev_priv = to_i915(dev); | 17056 | struct drm_i915_private *dev_priv = to_i915(dev); |
17069 | struct drm_crtc *c; | ||
17070 | struct drm_i915_gem_object *obj; | ||
17071 | 17057 | ||
17072 | intel_init_gt_powersave(dev_priv); | 17058 | intel_init_gt_powersave(dev_priv); |
17073 | 17059 | ||
17074 | intel_modeset_init_hw(dev); | 17060 | intel_modeset_init_hw(dev); |
17075 | 17061 | ||
17076 | intel_setup_overlay(dev_priv); | 17062 | intel_setup_overlay(dev_priv); |
17077 | |||
17078 | /* | ||
17079 | * Make sure any fbs we allocated at startup are properly | ||
17080 | * pinned & fenced. When we do the allocation it's too early | ||
17081 | * for this. | ||
17082 | */ | ||
17083 | for_each_crtc(dev, c) { | ||
17084 | struct i915_vma *vma; | ||
17085 | |||
17086 | obj = intel_fb_obj(c->primary->fb); | ||
17087 | if (obj == NULL) | ||
17088 | continue; | ||
17089 | |||
17090 | mutex_lock(&dev->struct_mutex); | ||
17091 | vma = intel_pin_and_fence_fb_obj(c->primary->fb, | ||
17092 | c->primary->state->rotation); | ||
17093 | mutex_unlock(&dev->struct_mutex); | ||
17094 | if (IS_ERR(vma)) { | ||
17095 | DRM_ERROR("failed to pin boot fb on pipe %d\n", | ||
17096 | to_intel_crtc(c)->pipe); | ||
17097 | drm_framebuffer_unreference(c->primary->fb); | ||
17098 | c->primary->fb = NULL; | ||
17099 | c->primary->crtc = c->primary->state->crtc = NULL; | ||
17100 | update_state_fb(c->primary); | ||
17101 | c->state->plane_mask &= ~(1 << drm_plane_index(c->primary)); | ||
17102 | } | ||
17103 | } | ||
17104 | } | 17063 | } |
17105 | 17064 | ||
17106 | int intel_connector_register(struct drm_connector *connector) | 17065 | int intel_connector_register(struct drm_connector *connector) |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index cd72ae171eeb..03a2112004f9 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -377,6 +377,7 @@ struct intel_atomic_state { | |||
377 | struct intel_plane_state { | 377 | struct intel_plane_state { |
378 | struct drm_plane_state base; | 378 | struct drm_plane_state base; |
379 | struct drm_rect clip; | 379 | struct drm_rect clip; |
380 | struct i915_vma *vma; | ||
380 | 381 | ||
381 | struct { | 382 | struct { |
382 | u32 offset; | 383 | u32 offset; |
@@ -1046,6 +1047,7 @@ struct intel_flip_work { | |||
1046 | struct work_struct mmio_work; | 1047 | struct work_struct mmio_work; |
1047 | 1048 | ||
1048 | struct drm_crtc *crtc; | 1049 | struct drm_crtc *crtc; |
1050 | struct i915_vma *old_vma; | ||
1049 | struct drm_framebuffer *old_fb; | 1051 | struct drm_framebuffer *old_fb; |
1050 | struct drm_i915_gem_object *pending_flip_obj; | 1052 | struct drm_i915_gem_object *pending_flip_obj; |
1051 | struct drm_pending_vblank_event *event; | 1053 | struct drm_pending_vblank_event *event; |
@@ -1273,7 +1275,7 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, | |||
1273 | struct drm_modeset_acquire_ctx *ctx); | 1275 | struct drm_modeset_acquire_ctx *ctx); |
1274 | struct i915_vma * | 1276 | struct i915_vma * |
1275 | intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, unsigned int rotation); | 1277 | intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, unsigned int rotation); |
1276 | void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation); | 1278 | void intel_unpin_fb_vma(struct i915_vma *vma); |
1277 | struct drm_framebuffer * | 1279 | struct drm_framebuffer * |
1278 | __intel_framebuffer_create(struct drm_device *dev, | 1280 | __intel_framebuffer_create(struct drm_device *dev, |
1279 | struct drm_mode_fb_cmd2 *mode_cmd, | 1281 | struct drm_mode_fb_cmd2 *mode_cmd, |
@@ -1362,7 +1364,10 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode, | |||
1362 | int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state); | 1364 | int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state); |
1363 | int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state); | 1365 | int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state); |
1364 | 1366 | ||
1365 | u32 intel_fb_gtt_offset(struct drm_framebuffer *fb, unsigned int rotation); | 1367 | static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state) |
1368 | { | ||
1369 | return i915_ggtt_offset(state->vma); | ||
1370 | } | ||
1366 | 1371 | ||
1367 | u32 skl_plane_ctl_format(uint32_t pixel_format); | 1372 | u32 skl_plane_ctl_format(uint32_t pixel_format); |
1368 | u32 skl_plane_ctl_tiling(uint64_t fb_modifier); | 1373 | u32 skl_plane_ctl_tiling(uint64_t fb_modifier); |
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c index 62f215b12eb5..f3a1d6a5cabe 100644 --- a/drivers/gpu/drm/i915/intel_fbc.c +++ b/drivers/gpu/drm/i915/intel_fbc.c | |||
@@ -173,7 +173,7 @@ static void i8xx_fbc_activate(struct drm_i915_private *dev_priv) | |||
173 | if (IS_I945GM(dev_priv)) | 173 | if (IS_I945GM(dev_priv)) |
174 | fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */ | 174 | fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */ |
175 | fbc_ctl |= (cfb_pitch & 0xff) << FBC_CTL_STRIDE_SHIFT; | 175 | fbc_ctl |= (cfb_pitch & 0xff) << FBC_CTL_STRIDE_SHIFT; |
176 | fbc_ctl |= params->fb.fence_reg; | 176 | fbc_ctl |= params->vma->fence->id; |
177 | I915_WRITE(FBC_CONTROL, fbc_ctl); | 177 | I915_WRITE(FBC_CONTROL, fbc_ctl); |
178 | } | 178 | } |
179 | 179 | ||
@@ -193,8 +193,8 @@ static void g4x_fbc_activate(struct drm_i915_private *dev_priv) | |||
193 | else | 193 | else |
194 | dpfc_ctl |= DPFC_CTL_LIMIT_1X; | 194 | dpfc_ctl |= DPFC_CTL_LIMIT_1X; |
195 | 195 | ||
196 | if (params->fb.fence_reg != I915_FENCE_REG_NONE) { | 196 | if (params->vma->fence) { |
197 | dpfc_ctl |= DPFC_CTL_FENCE_EN | params->fb.fence_reg; | 197 | dpfc_ctl |= DPFC_CTL_FENCE_EN | params->vma->fence->id; |
198 | I915_WRITE(DPFC_FENCE_YOFF, params->crtc.fence_y_offset); | 198 | I915_WRITE(DPFC_FENCE_YOFF, params->crtc.fence_y_offset); |
199 | } else { | 199 | } else { |
200 | I915_WRITE(DPFC_FENCE_YOFF, 0); | 200 | I915_WRITE(DPFC_FENCE_YOFF, 0); |
@@ -251,13 +251,14 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv) | |||
251 | break; | 251 | break; |
252 | } | 252 | } |
253 | 253 | ||
254 | if (params->fb.fence_reg != I915_FENCE_REG_NONE) { | 254 | if (params->vma->fence) { |
255 | dpfc_ctl |= DPFC_CTL_FENCE_EN; | 255 | dpfc_ctl |= DPFC_CTL_FENCE_EN; |
256 | if (IS_GEN5(dev_priv)) | 256 | if (IS_GEN5(dev_priv)) |
257 | dpfc_ctl |= params->fb.fence_reg; | 257 | dpfc_ctl |= params->vma->fence->id; |
258 | if (IS_GEN6(dev_priv)) { | 258 | if (IS_GEN6(dev_priv)) { |
259 | I915_WRITE(SNB_DPFC_CTL_SA, | 259 | I915_WRITE(SNB_DPFC_CTL_SA, |
260 | SNB_CPU_FENCE_ENABLE | params->fb.fence_reg); | 260 | SNB_CPU_FENCE_ENABLE | |
261 | params->vma->fence->id); | ||
261 | I915_WRITE(DPFC_CPU_FENCE_OFFSET, | 262 | I915_WRITE(DPFC_CPU_FENCE_OFFSET, |
262 | params->crtc.fence_y_offset); | 263 | params->crtc.fence_y_offset); |
263 | } | 264 | } |
@@ -269,7 +270,8 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv) | |||
269 | } | 270 | } |
270 | 271 | ||
271 | I915_WRITE(ILK_DPFC_FENCE_YOFF, params->crtc.fence_y_offset); | 272 | I915_WRITE(ILK_DPFC_FENCE_YOFF, params->crtc.fence_y_offset); |
272 | I915_WRITE(ILK_FBC_RT_BASE, params->fb.ggtt_offset | ILK_FBC_RT_VALID); | 273 | I915_WRITE(ILK_FBC_RT_BASE, |
274 | i915_ggtt_offset(params->vma) | ILK_FBC_RT_VALID); | ||
273 | /* enable it... */ | 275 | /* enable it... */ |
274 | I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN); | 276 | I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN); |
275 | 277 | ||
@@ -319,10 +321,11 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv) | |||
319 | break; | 321 | break; |
320 | } | 322 | } |
321 | 323 | ||
322 | if (params->fb.fence_reg != I915_FENCE_REG_NONE) { | 324 | if (params->vma->fence) { |
323 | dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN; | 325 | dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN; |
324 | I915_WRITE(SNB_DPFC_CTL_SA, | 326 | I915_WRITE(SNB_DPFC_CTL_SA, |
325 | SNB_CPU_FENCE_ENABLE | params->fb.fence_reg); | 327 | SNB_CPU_FENCE_ENABLE | |
328 | params->vma->fence->id); | ||
326 | I915_WRITE(DPFC_CPU_FENCE_OFFSET, params->crtc.fence_y_offset); | 329 | I915_WRITE(DPFC_CPU_FENCE_OFFSET, params->crtc.fence_y_offset); |
327 | } else { | 330 | } else { |
328 | I915_WRITE(SNB_DPFC_CTL_SA,0); | 331 | I915_WRITE(SNB_DPFC_CTL_SA,0); |
@@ -727,14 +730,6 @@ static bool intel_fbc_hw_tracking_covers_screen(struct intel_crtc *crtc) | |||
727 | return effective_w <= max_w && effective_h <= max_h; | 730 | return effective_w <= max_w && effective_h <= max_h; |
728 | } | 731 | } |
729 | 732 | ||
730 | /* XXX replace me when we have VMA tracking for intel_plane_state */ | ||
731 | static int get_fence_id(struct drm_framebuffer *fb) | ||
732 | { | ||
733 | struct i915_vma *vma = i915_gem_object_to_ggtt(intel_fb_obj(fb), NULL); | ||
734 | |||
735 | return vma && vma->fence ? vma->fence->id : I915_FENCE_REG_NONE; | ||
736 | } | ||
737 | |||
738 | static void intel_fbc_update_state_cache(struct intel_crtc *crtc, | 733 | static void intel_fbc_update_state_cache(struct intel_crtc *crtc, |
739 | struct intel_crtc_state *crtc_state, | 734 | struct intel_crtc_state *crtc_state, |
740 | struct intel_plane_state *plane_state) | 735 | struct intel_plane_state *plane_state) |
@@ -743,7 +738,8 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, | |||
743 | struct intel_fbc *fbc = &dev_priv->fbc; | 738 | struct intel_fbc *fbc = &dev_priv->fbc; |
744 | struct intel_fbc_state_cache *cache = &fbc->state_cache; | 739 | struct intel_fbc_state_cache *cache = &fbc->state_cache; |
745 | struct drm_framebuffer *fb = plane_state->base.fb; | 740 | struct drm_framebuffer *fb = plane_state->base.fb; |
746 | struct drm_i915_gem_object *obj; | 741 | |
742 | cache->vma = NULL; | ||
747 | 743 | ||
748 | cache->crtc.mode_flags = crtc_state->base.adjusted_mode.flags; | 744 | cache->crtc.mode_flags = crtc_state->base.adjusted_mode.flags; |
749 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) | 745 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) |
@@ -758,16 +754,10 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, | |||
758 | if (!cache->plane.visible) | 754 | if (!cache->plane.visible) |
759 | return; | 755 | return; |
760 | 756 | ||
761 | obj = intel_fb_obj(fb); | ||
762 | |||
763 | /* FIXME: We lack the proper locking here, so only run this on the | ||
764 | * platforms that need. */ | ||
765 | if (IS_GEN(dev_priv, 5, 6)) | ||
766 | cache->fb.ilk_ggtt_offset = i915_gem_object_ggtt_offset(obj, NULL); | ||
767 | cache->fb.pixel_format = fb->pixel_format; | 757 | cache->fb.pixel_format = fb->pixel_format; |
768 | cache->fb.stride = fb->pitches[0]; | 758 | cache->fb.stride = fb->pitches[0]; |
769 | cache->fb.fence_reg = get_fence_id(fb); | 759 | |
770 | cache->fb.tiling_mode = i915_gem_object_get_tiling(obj); | 760 | cache->vma = plane_state->vma; |
771 | } | 761 | } |
772 | 762 | ||
773 | static bool intel_fbc_can_activate(struct intel_crtc *crtc) | 763 | static bool intel_fbc_can_activate(struct intel_crtc *crtc) |
@@ -784,7 +774,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) | |||
784 | return false; | 774 | return false; |
785 | } | 775 | } |
786 | 776 | ||
787 | if (!cache->plane.visible) { | 777 | if (!cache->vma) { |
788 | fbc->no_fbc_reason = "primary plane not visible"; | 778 | fbc->no_fbc_reason = "primary plane not visible"; |
789 | return false; | 779 | return false; |
790 | } | 780 | } |
@@ -807,8 +797,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) | |||
807 | * so have no fence associated with it) due to aperture constaints | 797 | * so have no fence associated with it) due to aperture constaints |
808 | * at the time of pinning. | 798 | * at the time of pinning. |
809 | */ | 799 | */ |
810 | if (cache->fb.tiling_mode != I915_TILING_X || | 800 | if (!cache->vma->fence) { |
811 | cache->fb.fence_reg == I915_FENCE_REG_NONE) { | ||
812 | fbc->no_fbc_reason = "framebuffer not tiled or fenced"; | 801 | fbc->no_fbc_reason = "framebuffer not tiled or fenced"; |
813 | return false; | 802 | return false; |
814 | } | 803 | } |
@@ -888,17 +877,16 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc, | |||
888 | * zero. */ | 877 | * zero. */ |
889 | memset(params, 0, sizeof(*params)); | 878 | memset(params, 0, sizeof(*params)); |
890 | 879 | ||
880 | params->vma = cache->vma; | ||
881 | |||
891 | params->crtc.pipe = crtc->pipe; | 882 | params->crtc.pipe = crtc->pipe; |
892 | params->crtc.plane = crtc->plane; | 883 | params->crtc.plane = crtc->plane; |
893 | params->crtc.fence_y_offset = get_crtc_fence_y_offset(crtc); | 884 | params->crtc.fence_y_offset = get_crtc_fence_y_offset(crtc); |
894 | 885 | ||
895 | params->fb.pixel_format = cache->fb.pixel_format; | 886 | params->fb.pixel_format = cache->fb.pixel_format; |
896 | params->fb.stride = cache->fb.stride; | 887 | params->fb.stride = cache->fb.stride; |
897 | params->fb.fence_reg = cache->fb.fence_reg; | ||
898 | 888 | ||
899 | params->cfb_size = intel_fbc_calculate_cfb_size(dev_priv, cache); | 889 | params->cfb_size = intel_fbc_calculate_cfb_size(dev_priv, cache); |
900 | |||
901 | params->fb.ggtt_offset = cache->fb.ilk_ggtt_offset; | ||
902 | } | 890 | } |
903 | 891 | ||
904 | static bool intel_fbc_reg_params_equal(struct intel_fbc_reg_params *params1, | 892 | static bool intel_fbc_reg_params_equal(struct intel_fbc_reg_params *params1, |
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 8cf2d80f2254..f4a8c4fc57c4 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c | |||
@@ -284,7 +284,7 @@ static int intelfb_create(struct drm_fb_helper *helper, | |||
284 | out_destroy_fbi: | 284 | out_destroy_fbi: |
285 | drm_fb_helper_release_fbi(helper); | 285 | drm_fb_helper_release_fbi(helper); |
286 | out_unpin: | 286 | out_unpin: |
287 | intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0); | 287 | intel_unpin_fb_vma(vma); |
288 | out_unlock: | 288 | out_unlock: |
289 | mutex_unlock(&dev->struct_mutex); | 289 | mutex_unlock(&dev->struct_mutex); |
290 | return ret; | 290 | return ret; |
@@ -549,7 +549,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev) | |||
549 | 549 | ||
550 | if (ifbdev->fb) { | 550 | if (ifbdev->fb) { |
551 | mutex_lock(&ifbdev->helper.dev->struct_mutex); | 551 | mutex_lock(&ifbdev->helper.dev->struct_mutex); |
552 | intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0); | 552 | intel_unpin_fb_vma(ifbdev->vma); |
553 | mutex_unlock(&ifbdev->helper.dev->struct_mutex); | 553 | mutex_unlock(&ifbdev->helper.dev->struct_mutex); |
554 | 554 | ||
555 | drm_framebuffer_remove(&ifbdev->fb->base); | 555 | drm_framebuffer_remove(&ifbdev->fb->base); |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 8f131a08d440..242a73e66d82 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -273,7 +273,7 @@ skl_update_plane(struct drm_plane *drm_plane, | |||
273 | 273 | ||
274 | I915_WRITE(PLANE_CTL(pipe, plane), plane_ctl); | 274 | I915_WRITE(PLANE_CTL(pipe, plane), plane_ctl); |
275 | I915_WRITE(PLANE_SURF(pipe, plane), | 275 | I915_WRITE(PLANE_SURF(pipe, plane), |
276 | intel_fb_gtt_offset(fb, rotation) + surf_addr); | 276 | intel_plane_ggtt_offset(plane_state) + surf_addr); |
277 | POSTING_READ(PLANE_SURF(pipe, plane)); | 277 | POSTING_READ(PLANE_SURF(pipe, plane)); |
278 | } | 278 | } |
279 | 279 | ||
@@ -458,7 +458,7 @@ vlv_update_plane(struct drm_plane *dplane, | |||
458 | I915_WRITE(SPSIZE(pipe, plane), (crtc_h << 16) | crtc_w); | 458 | I915_WRITE(SPSIZE(pipe, plane), (crtc_h << 16) | crtc_w); |
459 | I915_WRITE(SPCNTR(pipe, plane), sprctl); | 459 | I915_WRITE(SPCNTR(pipe, plane), sprctl); |
460 | I915_WRITE(SPSURF(pipe, plane), | 460 | I915_WRITE(SPSURF(pipe, plane), |
461 | intel_fb_gtt_offset(fb, rotation) + sprsurf_offset); | 461 | intel_plane_ggtt_offset(plane_state) + sprsurf_offset); |
462 | POSTING_READ(SPSURF(pipe, plane)); | 462 | POSTING_READ(SPSURF(pipe, plane)); |
463 | } | 463 | } |
464 | 464 | ||
@@ -594,7 +594,7 @@ ivb_update_plane(struct drm_plane *plane, | |||
594 | I915_WRITE(SPRSCALE(pipe), sprscale); | 594 | I915_WRITE(SPRSCALE(pipe), sprscale); |
595 | I915_WRITE(SPRCTL(pipe), sprctl); | 595 | I915_WRITE(SPRCTL(pipe), sprctl); |
596 | I915_WRITE(SPRSURF(pipe), | 596 | I915_WRITE(SPRSURF(pipe), |
597 | intel_fb_gtt_offset(fb, rotation) + sprsurf_offset); | 597 | intel_plane_ggtt_offset(plane_state) + sprsurf_offset); |
598 | POSTING_READ(SPRSURF(pipe)); | 598 | POSTING_READ(SPRSURF(pipe)); |
599 | } | 599 | } |
600 | 600 | ||
@@ -721,7 +721,7 @@ ilk_update_plane(struct drm_plane *plane, | |||
721 | I915_WRITE(DVSSCALE(pipe), dvsscale); | 721 | I915_WRITE(DVSSCALE(pipe), dvsscale); |
722 | I915_WRITE(DVSCNTR(pipe), dvscntr); | 722 | I915_WRITE(DVSCNTR(pipe), dvscntr); |
723 | I915_WRITE(DVSSURF(pipe), | 723 | I915_WRITE(DVSSURF(pipe), |
724 | intel_fb_gtt_offset(fb, rotation) + dvssurf_offset); | 724 | intel_plane_ggtt_offset(plane_state) + dvssurf_offset); |
725 | POSTING_READ(DVSSURF(pipe)); | 725 | POSTING_READ(DVSSURF(pipe)); |
726 | } | 726 | } |
727 | 727 | ||
diff --git a/drivers/gpu/drm/nouveau/dispnv04/hw.c b/drivers/gpu/drm/nouveau/dispnv04/hw.c index 74856a8b8f35..e64f52464ecf 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/hw.c +++ b/drivers/gpu/drm/nouveau/dispnv04/hw.c | |||
@@ -222,6 +222,7 @@ nouveau_hw_get_clock(struct drm_device *dev, enum nvbios_pll_type plltype) | |||
222 | uint32_t mpllP; | 222 | uint32_t mpllP; |
223 | 223 | ||
224 | pci_read_config_dword(pci_get_bus_and_slot(0, 3), 0x6c, &mpllP); | 224 | pci_read_config_dword(pci_get_bus_and_slot(0, 3), 0x6c, &mpllP); |
225 | mpllP = (mpllP >> 8) & 0xf; | ||
225 | if (!mpllP) | 226 | if (!mpllP) |
226 | mpllP = 4; | 227 | mpllP = 4; |
227 | 228 | ||
@@ -232,7 +233,7 @@ nouveau_hw_get_clock(struct drm_device *dev, enum nvbios_pll_type plltype) | |||
232 | uint32_t clock; | 233 | uint32_t clock; |
233 | 234 | ||
234 | pci_read_config_dword(pci_get_bus_and_slot(0, 5), 0x4c, &clock); | 235 | pci_read_config_dword(pci_get_bus_and_slot(0, 5), 0x4c, &clock); |
235 | return clock; | 236 | return clock / 1000; |
236 | } | 237 | } |
237 | 238 | ||
238 | ret = nouveau_hw_get_pllvals(dev, plltype, &pllvals); | 239 | ret = nouveau_hw_get_pllvals(dev, plltype, &pllvals); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.h b/drivers/gpu/drm/nouveau/nouveau_fence.h index ccdce1b4eec4..d5e58a38f160 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.h +++ b/drivers/gpu/drm/nouveau/nouveau_fence.h | |||
@@ -99,6 +99,7 @@ struct nv84_fence_priv { | |||
99 | struct nouveau_bo *bo; | 99 | struct nouveau_bo *bo; |
100 | struct nouveau_bo *bo_gart; | 100 | struct nouveau_bo *bo_gart; |
101 | u32 *suspend; | 101 | u32 *suspend; |
102 | struct mutex mutex; | ||
102 | }; | 103 | }; |
103 | 104 | ||
104 | int nv84_fence_context_new(struct nouveau_channel *); | 105 | int nv84_fence_context_new(struct nouveau_channel *); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_led.h b/drivers/gpu/drm/nouveau/nouveau_led.h index 187ecdb82002..21a5775028cc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_led.h +++ b/drivers/gpu/drm/nouveau/nouveau_led.h | |||
@@ -42,7 +42,7 @@ nouveau_led(struct drm_device *dev) | |||
42 | } | 42 | } |
43 | 43 | ||
44 | /* nouveau_led.c */ | 44 | /* nouveau_led.c */ |
45 | #if IS_ENABLED(CONFIG_LEDS_CLASS) | 45 | #if IS_REACHABLE(CONFIG_LEDS_CLASS) |
46 | int nouveau_led_init(struct drm_device *dev); | 46 | int nouveau_led_init(struct drm_device *dev); |
47 | void nouveau_led_suspend(struct drm_device *dev); | 47 | void nouveau_led_suspend(struct drm_device *dev); |
48 | void nouveau_led_resume(struct drm_device *dev); | 48 | void nouveau_led_resume(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_usif.c b/drivers/gpu/drm/nouveau/nouveau_usif.c index 08f9c6fa0f7f..1fba38622744 100644 --- a/drivers/gpu/drm/nouveau/nouveau_usif.c +++ b/drivers/gpu/drm/nouveau/nouveau_usif.c | |||
@@ -313,7 +313,8 @@ usif_ioctl(struct drm_file *filp, void __user *user, u32 argc) | |||
313 | if (!(ret = nvif_unpack(-ENOSYS, &data, &size, argv->v0, 0, 0, true))) { | 313 | if (!(ret = nvif_unpack(-ENOSYS, &data, &size, argv->v0, 0, 0, true))) { |
314 | /* block access to objects not created via this interface */ | 314 | /* block access to objects not created via this interface */ |
315 | owner = argv->v0.owner; | 315 | owner = argv->v0.owner; |
316 | if (argv->v0.object == 0ULL) | 316 | if (argv->v0.object == 0ULL && |
317 | argv->v0.type != NVIF_IOCTL_V0_DEL) | ||
317 | argv->v0.owner = NVDRM_OBJECT_ANY; /* except client */ | 318 | argv->v0.owner = NVDRM_OBJECT_ANY; /* except client */ |
318 | else | 319 | else |
319 | argv->v0.owner = NVDRM_OBJECT_USIF; | 320 | argv->v0.owner = NVDRM_OBJECT_USIF; |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 2c2c64507661..32097fd615fd 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -4052,6 +4052,11 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state) | |||
4052 | } | 4052 | } |
4053 | } | 4053 | } |
4054 | 4054 | ||
4055 | for_each_crtc_in_state(state, crtc, crtc_state, i) { | ||
4056 | if (crtc->state->event) | ||
4057 | drm_crtc_vblank_get(crtc); | ||
4058 | } | ||
4059 | |||
4055 | /* Update plane(s). */ | 4060 | /* Update plane(s). */ |
4056 | for_each_plane_in_state(state, plane, plane_state, i) { | 4061 | for_each_plane_in_state(state, plane, plane_state, i) { |
4057 | struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state); | 4062 | struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state); |
@@ -4101,6 +4106,7 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state) | |||
4101 | drm_crtc_send_vblank_event(crtc, crtc->state->event); | 4106 | drm_crtc_send_vblank_event(crtc, crtc->state->event); |
4102 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 4107 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
4103 | crtc->state->event = NULL; | 4108 | crtc->state->event = NULL; |
4109 | drm_crtc_vblank_put(crtc); | ||
4104 | } | 4110 | } |
4105 | } | 4111 | } |
4106 | 4112 | ||
diff --git a/drivers/gpu/drm/nouveau/nv84_fence.c b/drivers/gpu/drm/nouveau/nv84_fence.c index 52b87ae83e7b..f0b322bec7df 100644 --- a/drivers/gpu/drm/nouveau/nv84_fence.c +++ b/drivers/gpu/drm/nouveau/nv84_fence.c | |||
@@ -107,8 +107,10 @@ nv84_fence_context_del(struct nouveau_channel *chan) | |||
107 | struct nv84_fence_chan *fctx = chan->fence; | 107 | struct nv84_fence_chan *fctx = chan->fence; |
108 | 108 | ||
109 | nouveau_bo_wr32(priv->bo, chan->chid * 16 / 4, fctx->base.sequence); | 109 | nouveau_bo_wr32(priv->bo, chan->chid * 16 / 4, fctx->base.sequence); |
110 | mutex_lock(&priv->mutex); | ||
110 | nouveau_bo_vma_del(priv->bo, &fctx->vma_gart); | 111 | nouveau_bo_vma_del(priv->bo, &fctx->vma_gart); |
111 | nouveau_bo_vma_del(priv->bo, &fctx->vma); | 112 | nouveau_bo_vma_del(priv->bo, &fctx->vma); |
113 | mutex_unlock(&priv->mutex); | ||
112 | nouveau_fence_context_del(&fctx->base); | 114 | nouveau_fence_context_del(&fctx->base); |
113 | chan->fence = NULL; | 115 | chan->fence = NULL; |
114 | nouveau_fence_context_free(&fctx->base); | 116 | nouveau_fence_context_free(&fctx->base); |
@@ -134,11 +136,13 @@ nv84_fence_context_new(struct nouveau_channel *chan) | |||
134 | fctx->base.sync32 = nv84_fence_sync32; | 136 | fctx->base.sync32 = nv84_fence_sync32; |
135 | fctx->base.sequence = nv84_fence_read(chan); | 137 | fctx->base.sequence = nv84_fence_read(chan); |
136 | 138 | ||
139 | mutex_lock(&priv->mutex); | ||
137 | ret = nouveau_bo_vma_add(priv->bo, cli->vm, &fctx->vma); | 140 | ret = nouveau_bo_vma_add(priv->bo, cli->vm, &fctx->vma); |
138 | if (ret == 0) { | 141 | if (ret == 0) { |
139 | ret = nouveau_bo_vma_add(priv->bo_gart, cli->vm, | 142 | ret = nouveau_bo_vma_add(priv->bo_gart, cli->vm, |
140 | &fctx->vma_gart); | 143 | &fctx->vma_gart); |
141 | } | 144 | } |
145 | mutex_unlock(&priv->mutex); | ||
142 | 146 | ||
143 | if (ret) | 147 | if (ret) |
144 | nv84_fence_context_del(chan); | 148 | nv84_fence_context_del(chan); |
@@ -212,6 +216,8 @@ nv84_fence_create(struct nouveau_drm *drm) | |||
212 | priv->base.context_base = dma_fence_context_alloc(priv->base.contexts); | 216 | priv->base.context_base = dma_fence_context_alloc(priv->base.contexts); |
213 | priv->base.uevent = true; | 217 | priv->base.uevent = true; |
214 | 218 | ||
219 | mutex_init(&priv->mutex); | ||
220 | |||
215 | /* Use VRAM if there is any ; otherwise fallback to system memory */ | 221 | /* Use VRAM if there is any ; otherwise fallback to system memory */ |
216 | domain = drm->device.info.ram_size != 0 ? TTM_PL_FLAG_VRAM : | 222 | domain = drm->device.info.ram_size != 0 ? TTM_PL_FLAG_VRAM : |
217 | /* | 223 | /* |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c index 6f0436df0219..f8f2f16c22a2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c | |||
@@ -59,7 +59,7 @@ gt215_hda_eld(NV50_DISP_MTHD_V1) | |||
59 | ); | 59 | ); |
60 | } | 60 | } |
61 | for (i = 0; i < size; i++) | 61 | for (i = 0; i < size; i++) |
62 | nvkm_wr32(device, 0x61c440 + soff, (i << 8) | args->v0.data[0]); | 62 | nvkm_wr32(device, 0x61c440 + soff, (i << 8) | args->v0.data[i]); |
63 | for (; i < 0x60; i++) | 63 | for (; i < 0x60; i++) |
64 | nvkm_wr32(device, 0x61c440 + soff, (i << 8)); | 64 | nvkm_wr32(device, 0x61c440 + soff, (i << 8)); |
65 | nvkm_mask(device, 0x61c448 + soff, 0x80000003, 0x80000003); | 65 | nvkm_mask(device, 0x61c448 + soff, 0x80000003, 0x80000003); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c index 567466f93cd5..0db8efbf1c2e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c | |||
@@ -433,8 +433,6 @@ nv50_disp_dptmds_war(struct nvkm_device *device) | |||
433 | case 0x94: | 433 | case 0x94: |
434 | case 0x96: | 434 | case 0x96: |
435 | case 0x98: | 435 | case 0x98: |
436 | case 0xaa: | ||
437 | case 0xac: | ||
438 | return true; | 436 | return true; |
439 | default: | 437 | default: |
440 | break; | 438 | break; |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index e0c143b865f3..30bd4a6a9d46 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -97,9 +97,10 @@ | |||
97 | * 2.46.0 - Add PFP_SYNC_ME support on evergreen | 97 | * 2.46.0 - Add PFP_SYNC_ME support on evergreen |
98 | * 2.47.0 - Add UVD_NO_OP register support | 98 | * 2.47.0 - Add UVD_NO_OP register support |
99 | * 2.48.0 - TA_CS_BC_BASE_ADDR allowed on SI | 99 | * 2.48.0 - TA_CS_BC_BASE_ADDR allowed on SI |
100 | * 2.49.0 - DRM_RADEON_GEM_INFO ioctl returns correct vram_size/visible values | ||
100 | */ | 101 | */ |
101 | #define KMS_DRIVER_MAJOR 2 | 102 | #define KMS_DRIVER_MAJOR 2 |
102 | #define KMS_DRIVER_MINOR 48 | 103 | #define KMS_DRIVER_MINOR 49 |
103 | #define KMS_DRIVER_PATCHLEVEL 0 | 104 | #define KMS_DRIVER_PATCHLEVEL 0 |
104 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); | 105 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); |
105 | int radeon_driver_unload_kms(struct drm_device *dev); | 106 | int radeon_driver_unload_kms(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index 0bcffd8a7bd3..96683f5b2b1b 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -220,8 +220,8 @@ int radeon_gem_info_ioctl(struct drm_device *dev, void *data, | |||
220 | 220 | ||
221 | man = &rdev->mman.bdev.man[TTM_PL_VRAM]; | 221 | man = &rdev->mman.bdev.man[TTM_PL_VRAM]; |
222 | 222 | ||
223 | args->vram_size = rdev->mc.real_vram_size; | 223 | args->vram_size = (u64)man->size << PAGE_SHIFT; |
224 | args->vram_visible = (u64)man->size << PAGE_SHIFT; | 224 | args->vram_visible = rdev->mc.visible_vram_size; |
225 | args->vram_visible -= rdev->vram_pin_size; | 225 | args->vram_visible -= rdev->vram_pin_size; |
226 | args->gart_size = rdev->mc.gtt_size; | 226 | args->gart_size = rdev->mc.gtt_size; |
227 | args->gart_size -= rdev->gart_pin_size; | 227 | args->gart_size -= rdev->gart_pin_size; |
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index cd49cb17eb7f..308dbda700eb 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c | |||
@@ -383,6 +383,7 @@ int hv_ringbuffer_read(struct vmbus_channel *channel, | |||
383 | return ret; | 383 | return ret; |
384 | } | 384 | } |
385 | 385 | ||
386 | init_cached_read_index(channel); | ||
386 | next_read_location = hv_get_next_read_location(inring_info); | 387 | next_read_location = hv_get_next_read_location(inring_info); |
387 | next_read_location = hv_copyfrom_ringbuffer(inring_info, &desc, | 388 | next_read_location = hv_copyfrom_ringbuffer(inring_info, &desc, |
388 | sizeof(desc), | 389 | sizeof(desc), |
diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index 2bbf0c521beb..7d61b566e148 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c | |||
@@ -775,7 +775,7 @@ static int palmas_adc_wakeup_reset(struct palmas_gpadc *adc) | |||
775 | 775 | ||
776 | static int palmas_gpadc_suspend(struct device *dev) | 776 | static int palmas_gpadc_suspend(struct device *dev) |
777 | { | 777 | { |
778 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 778 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
779 | struct palmas_gpadc *adc = iio_priv(indio_dev); | 779 | struct palmas_gpadc *adc = iio_priv(indio_dev); |
780 | int wakeup = adc->wakeup1_enable || adc->wakeup2_enable; | 780 | int wakeup = adc->wakeup1_enable || adc->wakeup2_enable; |
781 | int ret; | 781 | int ret; |
@@ -798,7 +798,7 @@ static int palmas_gpadc_suspend(struct device *dev) | |||
798 | 798 | ||
799 | static int palmas_gpadc_resume(struct device *dev) | 799 | static int palmas_gpadc_resume(struct device *dev) |
800 | { | 800 | { |
801 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 801 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
802 | struct palmas_gpadc *adc = iio_priv(indio_dev); | 802 | struct palmas_gpadc *adc = iio_priv(indio_dev); |
803 | int wakeup = adc->wakeup1_enable || adc->wakeup2_enable; | 803 | int wakeup = adc->wakeup1_enable || adc->wakeup2_enable; |
804 | int ret; | 804 | int ret; |
diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c index 9a081465c42f..6bb23a49e81e 100644 --- a/drivers/iio/health/afe4403.c +++ b/drivers/iio/health/afe4403.c | |||
@@ -422,7 +422,7 @@ MODULE_DEVICE_TABLE(of, afe4403_of_match); | |||
422 | 422 | ||
423 | static int __maybe_unused afe4403_suspend(struct device *dev) | 423 | static int __maybe_unused afe4403_suspend(struct device *dev) |
424 | { | 424 | { |
425 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 425 | struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev)); |
426 | struct afe4403_data *afe = iio_priv(indio_dev); | 426 | struct afe4403_data *afe = iio_priv(indio_dev); |
427 | int ret; | 427 | int ret; |
428 | 428 | ||
@@ -443,7 +443,7 @@ static int __maybe_unused afe4403_suspend(struct device *dev) | |||
443 | 443 | ||
444 | static int __maybe_unused afe4403_resume(struct device *dev) | 444 | static int __maybe_unused afe4403_resume(struct device *dev) |
445 | { | 445 | { |
446 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 446 | struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev)); |
447 | struct afe4403_data *afe = iio_priv(indio_dev); | 447 | struct afe4403_data *afe = iio_priv(indio_dev); |
448 | int ret; | 448 | int ret; |
449 | 449 | ||
diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c index 45266404f7e3..964f5231a831 100644 --- a/drivers/iio/health/afe4404.c +++ b/drivers/iio/health/afe4404.c | |||
@@ -428,7 +428,7 @@ MODULE_DEVICE_TABLE(of, afe4404_of_match); | |||
428 | 428 | ||
429 | static int __maybe_unused afe4404_suspend(struct device *dev) | 429 | static int __maybe_unused afe4404_suspend(struct device *dev) |
430 | { | 430 | { |
431 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 431 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
432 | struct afe4404_data *afe = iio_priv(indio_dev); | 432 | struct afe4404_data *afe = iio_priv(indio_dev); |
433 | int ret; | 433 | int ret; |
434 | 434 | ||
@@ -449,7 +449,7 @@ static int __maybe_unused afe4404_suspend(struct device *dev) | |||
449 | 449 | ||
450 | static int __maybe_unused afe4404_resume(struct device *dev) | 450 | static int __maybe_unused afe4404_resume(struct device *dev) |
451 | { | 451 | { |
452 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 452 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
453 | struct afe4404_data *afe = iio_priv(indio_dev); | 453 | struct afe4404_data *afe = iio_priv(indio_dev); |
454 | int ret; | 454 | int ret; |
455 | 455 | ||
diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c index 90ab8a2d2846..183c14329d6e 100644 --- a/drivers/iio/health/max30100.c +++ b/drivers/iio/health/max30100.c | |||
@@ -238,7 +238,7 @@ static irqreturn_t max30100_interrupt_handler(int irq, void *private) | |||
238 | 238 | ||
239 | mutex_lock(&data->lock); | 239 | mutex_lock(&data->lock); |
240 | 240 | ||
241 | while (cnt || (cnt = max30100_fifo_count(data) > 0)) { | 241 | while (cnt || (cnt = max30100_fifo_count(data)) > 0) { |
242 | ret = max30100_read_measurement(data); | 242 | ret = max30100_read_measurement(data); |
243 | if (ret) | 243 | if (ret) |
244 | break; | 244 | break; |
diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c index 9c47bc98f3ac..2a22ad920333 100644 --- a/drivers/iio/humidity/dht11.c +++ b/drivers/iio/humidity/dht11.c | |||
@@ -71,7 +71,8 @@ | |||
71 | * a) select an implementation using busy loop polling on those systems | 71 | * a) select an implementation using busy loop polling on those systems |
72 | * b) use the checksum to do some probabilistic decoding | 72 | * b) use the checksum to do some probabilistic decoding |
73 | */ | 73 | */ |
74 | #define DHT11_START_TRANSMISSION 18 /* ms */ | 74 | #define DHT11_START_TRANSMISSION_MIN 18000 /* us */ |
75 | #define DHT11_START_TRANSMISSION_MAX 20000 /* us */ | ||
75 | #define DHT11_MIN_TIMERES 34000 /* ns */ | 76 | #define DHT11_MIN_TIMERES 34000 /* ns */ |
76 | #define DHT11_THRESHOLD 49000 /* ns */ | 77 | #define DHT11_THRESHOLD 49000 /* ns */ |
77 | #define DHT11_AMBIG_LOW 23000 /* ns */ | 78 | #define DHT11_AMBIG_LOW 23000 /* ns */ |
@@ -228,7 +229,8 @@ static int dht11_read_raw(struct iio_dev *iio_dev, | |||
228 | ret = gpio_direction_output(dht11->gpio, 0); | 229 | ret = gpio_direction_output(dht11->gpio, 0); |
229 | if (ret) | 230 | if (ret) |
230 | goto err; | 231 | goto err; |
231 | msleep(DHT11_START_TRANSMISSION); | 232 | usleep_range(DHT11_START_TRANSMISSION_MIN, |
233 | DHT11_START_TRANSMISSION_MAX); | ||
232 | ret = gpio_direction_input(dht11->gpio); | 234 | ret = gpio_direction_input(dht11->gpio); |
233 | if (ret) | 235 | if (ret) |
234 | goto err; | 236 | goto err; |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 7c6c57216bf2..8a9f742d8ed7 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -1534,18 +1534,18 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string | |||
1534 | return PTR_ERR(key); | 1534 | return PTR_ERR(key); |
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | rcu_read_lock(); | 1537 | down_read(&key->sem); |
1538 | 1538 | ||
1539 | ukp = user_key_payload(key); | 1539 | ukp = user_key_payload(key); |
1540 | if (!ukp) { | 1540 | if (!ukp) { |
1541 | rcu_read_unlock(); | 1541 | up_read(&key->sem); |
1542 | key_put(key); | 1542 | key_put(key); |
1543 | kzfree(new_key_string); | 1543 | kzfree(new_key_string); |
1544 | return -EKEYREVOKED; | 1544 | return -EKEYREVOKED; |
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | if (cc->key_size != ukp->datalen) { | 1547 | if (cc->key_size != ukp->datalen) { |
1548 | rcu_read_unlock(); | 1548 | up_read(&key->sem); |
1549 | key_put(key); | 1549 | key_put(key); |
1550 | kzfree(new_key_string); | 1550 | kzfree(new_key_string); |
1551 | return -EINVAL; | 1551 | return -EINVAL; |
@@ -1553,7 +1553,7 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string | |||
1553 | 1553 | ||
1554 | memcpy(cc->key, ukp->data, cc->key_size); | 1554 | memcpy(cc->key, ukp->data, cc->key_size); |
1555 | 1555 | ||
1556 | rcu_read_unlock(); | 1556 | up_read(&key->sem); |
1557 | key_put(key); | 1557 | key_put(key); |
1558 | 1558 | ||
1559 | /* clear the flag since following operations may invalidate previously valid key */ | 1559 | /* clear the flag since following operations may invalidate previously valid key */ |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 6400cffb986d..3570bcb7a4a4 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -427,7 +427,7 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes) | |||
427 | unsigned long flags; | 427 | unsigned long flags; |
428 | struct priority_group *pg; | 428 | struct priority_group *pg; |
429 | struct pgpath *pgpath; | 429 | struct pgpath *pgpath; |
430 | bool bypassed = true; | 430 | unsigned bypassed = 1; |
431 | 431 | ||
432 | if (!atomic_read(&m->nr_valid_paths)) { | 432 | if (!atomic_read(&m->nr_valid_paths)) { |
433 | clear_bit(MPATHF_QUEUE_IO, &m->flags); | 433 | clear_bit(MPATHF_QUEUE_IO, &m->flags); |
@@ -466,7 +466,7 @@ check_current_pg: | |||
466 | */ | 466 | */ |
467 | do { | 467 | do { |
468 | list_for_each_entry(pg, &m->priority_groups, list) { | 468 | list_for_each_entry(pg, &m->priority_groups, list) { |
469 | if (pg->bypassed == bypassed) | 469 | if (pg->bypassed == !!bypassed) |
470 | continue; | 470 | continue; |
471 | pgpath = choose_path_in_pg(m, pg, nr_bytes); | 471 | pgpath = choose_path_in_pg(m, pg, nr_bytes); |
472 | if (!IS_ERR_OR_NULL(pgpath)) { | 472 | if (!IS_ERR_OR_NULL(pgpath)) { |
diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 9d7275fb541a..6e702fc69a83 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c | |||
@@ -779,6 +779,10 @@ static void dm_old_request_fn(struct request_queue *q) | |||
779 | int srcu_idx; | 779 | int srcu_idx; |
780 | struct dm_table *map = dm_get_live_table(md, &srcu_idx); | 780 | struct dm_table *map = dm_get_live_table(md, &srcu_idx); |
781 | 781 | ||
782 | if (unlikely(!map)) { | ||
783 | dm_put_live_table(md, srcu_idx); | ||
784 | return; | ||
785 | } | ||
782 | ti = dm_table_find_target(map, pos); | 786 | ti = dm_table_find_target(map, pos); |
783 | dm_put_live_table(md, srcu_idx); | 787 | dm_put_live_table(md, srcu_idx); |
784 | } | 788 | } |
diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c index ebb5e391b800..87a6b65ed3af 100644 --- a/drivers/media/cec/cec-adap.c +++ b/drivers/media/cec/cec-adap.c | |||
@@ -1206,7 +1206,7 @@ static int cec_config_thread_func(void *arg) | |||
1206 | las->log_addr[i] = CEC_LOG_ADDR_INVALID; | 1206 | las->log_addr[i] = CEC_LOG_ADDR_INVALID; |
1207 | if (last_la == CEC_LOG_ADDR_INVALID || | 1207 | if (last_la == CEC_LOG_ADDR_INVALID || |
1208 | last_la == CEC_LOG_ADDR_UNREGISTERED || | 1208 | last_la == CEC_LOG_ADDR_UNREGISTERED || |
1209 | !(last_la & type2mask[type])) | 1209 | !((1 << last_la) & type2mask[type])) |
1210 | last_la = la_list[0]; | 1210 | last_la = la_list[0]; |
1211 | 1211 | ||
1212 | err = cec_config_log_addr(adap, i, last_la); | 1212 | err = cec_config_log_addr(adap, i, last_la); |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 23909804ffb8..0def99590d16 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -2733,7 +2733,8 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) | |||
2733 | if (intmask & SDHCI_INT_RETUNE) | 2733 | if (intmask & SDHCI_INT_RETUNE) |
2734 | mmc_retune_needed(host->mmc); | 2734 | mmc_retune_needed(host->mmc); |
2735 | 2735 | ||
2736 | if (intmask & SDHCI_INT_CARD_INT) { | 2736 | if ((intmask & SDHCI_INT_CARD_INT) && |
2737 | (host->ier & SDHCI_INT_CARD_INT)) { | ||
2737 | sdhci_enable_sdio_irq_nolock(host, false); | 2738 | sdhci_enable_sdio_irq_nolock(host, false); |
2738 | host->thread_isr |= SDHCI_INT_CARD_INT; | 2739 | host->thread_isr |= SDHCI_INT_CARD_INT; |
2739 | result = IRQ_WAKE_THREAD; | 2740 | result = IRQ_WAKE_THREAD; |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h index 87226685f742..8fa18fc17cd2 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | |||
@@ -1014,9 +1014,7 @@ | |||
1014 | 1014 | ||
1015 | static inline void dsaf_write_reg(void __iomem *base, u32 reg, u32 value) | 1015 | static inline void dsaf_write_reg(void __iomem *base, u32 reg, u32 value) |
1016 | { | 1016 | { |
1017 | u8 __iomem *reg_addr = ACCESS_ONCE(base); | 1017 | writel(value, base + reg); |
1018 | |||
1019 | writel(value, reg_addr + reg); | ||
1020 | } | 1018 | } |
1021 | 1019 | ||
1022 | #define dsaf_write_dev(a, reg, value) \ | 1020 | #define dsaf_write_dev(a, reg, value) \ |
@@ -1024,9 +1022,7 @@ static inline void dsaf_write_reg(void __iomem *base, u32 reg, u32 value) | |||
1024 | 1022 | ||
1025 | static inline u32 dsaf_read_reg(u8 __iomem *base, u32 reg) | 1023 | static inline u32 dsaf_read_reg(u8 __iomem *base, u32 reg) |
1026 | { | 1024 | { |
1027 | u8 __iomem *reg_addr = ACCESS_ONCE(base); | 1025 | return readl(base + reg); |
1028 | |||
1029 | return readl(reg_addr + reg); | ||
1030 | } | 1026 | } |
1031 | 1027 | ||
1032 | static inline void dsaf_write_syscon(struct regmap *base, u32 reg, u32 value) | 1028 | static inline void dsaf_write_syscon(struct regmap *base, u32 reg, u32 value) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index ca730d4abbb4..c4d714fcc7da 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
@@ -1113,7 +1113,7 @@ static int mlx4_en_set_ringparam(struct net_device *dev, | |||
1113 | memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile)); | 1113 | memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile)); |
1114 | new_prof.tx_ring_size = tx_size; | 1114 | new_prof.tx_ring_size = tx_size; |
1115 | new_prof.rx_ring_size = rx_size; | 1115 | new_prof.rx_ring_size = rx_size; |
1116 | err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof); | 1116 | err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof, true); |
1117 | if (err) | 1117 | if (err) |
1118 | goto out; | 1118 | goto out; |
1119 | 1119 | ||
@@ -1788,7 +1788,7 @@ static int mlx4_en_set_channels(struct net_device *dev, | |||
1788 | new_prof.tx_ring_num[TX_XDP] = xdp_count; | 1788 | new_prof.tx_ring_num[TX_XDP] = xdp_count; |
1789 | new_prof.rx_ring_num = channel->rx_count; | 1789 | new_prof.rx_ring_num = channel->rx_count; |
1790 | 1790 | ||
1791 | err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof); | 1791 | err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof, true); |
1792 | if (err) | 1792 | if (err) |
1793 | goto out; | 1793 | goto out; |
1794 | 1794 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 60a021c34881..748e9f65c386 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -2048,6 +2048,8 @@ static void mlx4_en_free_resources(struct mlx4_en_priv *priv) | |||
2048 | if (priv->tx_cq[t] && priv->tx_cq[t][i]) | 2048 | if (priv->tx_cq[t] && priv->tx_cq[t][i]) |
2049 | mlx4_en_destroy_cq(priv, &priv->tx_cq[t][i]); | 2049 | mlx4_en_destroy_cq(priv, &priv->tx_cq[t][i]); |
2050 | } | 2050 | } |
2051 | kfree(priv->tx_ring[t]); | ||
2052 | kfree(priv->tx_cq[t]); | ||
2051 | } | 2053 | } |
2052 | 2054 | ||
2053 | for (i = 0; i < priv->rx_ring_num; i++) { | 2055 | for (i = 0; i < priv->rx_ring_num; i++) { |
@@ -2190,9 +2192,11 @@ static void mlx4_en_update_priv(struct mlx4_en_priv *dst, | |||
2190 | 2192 | ||
2191 | int mlx4_en_try_alloc_resources(struct mlx4_en_priv *priv, | 2193 | int mlx4_en_try_alloc_resources(struct mlx4_en_priv *priv, |
2192 | struct mlx4_en_priv *tmp, | 2194 | struct mlx4_en_priv *tmp, |
2193 | struct mlx4_en_port_profile *prof) | 2195 | struct mlx4_en_port_profile *prof, |
2196 | bool carry_xdp_prog) | ||
2194 | { | 2197 | { |
2195 | int t; | 2198 | struct bpf_prog *xdp_prog; |
2199 | int i, t; | ||
2196 | 2200 | ||
2197 | mlx4_en_copy_priv(tmp, priv, prof); | 2201 | mlx4_en_copy_priv(tmp, priv, prof); |
2198 | 2202 | ||
@@ -2206,6 +2210,23 @@ int mlx4_en_try_alloc_resources(struct mlx4_en_priv *priv, | |||
2206 | } | 2210 | } |
2207 | return -ENOMEM; | 2211 | return -ENOMEM; |
2208 | } | 2212 | } |
2213 | |||
2214 | /* All rx_rings has the same xdp_prog. Pick the first one. */ | ||
2215 | xdp_prog = rcu_dereference_protected( | ||
2216 | priv->rx_ring[0]->xdp_prog, | ||
2217 | lockdep_is_held(&priv->mdev->state_lock)); | ||
2218 | |||
2219 | if (xdp_prog && carry_xdp_prog) { | ||
2220 | xdp_prog = bpf_prog_add(xdp_prog, tmp->rx_ring_num); | ||
2221 | if (IS_ERR(xdp_prog)) { | ||
2222 | mlx4_en_free_resources(tmp); | ||
2223 | return PTR_ERR(xdp_prog); | ||
2224 | } | ||
2225 | for (i = 0; i < tmp->rx_ring_num; i++) | ||
2226 | rcu_assign_pointer(tmp->rx_ring[i]->xdp_prog, | ||
2227 | xdp_prog); | ||
2228 | } | ||
2229 | |||
2209 | return 0; | 2230 | return 0; |
2210 | } | 2231 | } |
2211 | 2232 | ||
@@ -2220,7 +2241,6 @@ void mlx4_en_destroy_netdev(struct net_device *dev) | |||
2220 | { | 2241 | { |
2221 | struct mlx4_en_priv *priv = netdev_priv(dev); | 2242 | struct mlx4_en_priv *priv = netdev_priv(dev); |
2222 | struct mlx4_en_dev *mdev = priv->mdev; | 2243 | struct mlx4_en_dev *mdev = priv->mdev; |
2223 | int t; | ||
2224 | 2244 | ||
2225 | en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port); | 2245 | en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port); |
2226 | 2246 | ||
@@ -2254,11 +2274,6 @@ void mlx4_en_destroy_netdev(struct net_device *dev) | |||
2254 | mlx4_en_free_resources(priv); | 2274 | mlx4_en_free_resources(priv); |
2255 | mutex_unlock(&mdev->state_lock); | 2275 | mutex_unlock(&mdev->state_lock); |
2256 | 2276 | ||
2257 | for (t = 0; t < MLX4_EN_NUM_TX_TYPES; t++) { | ||
2258 | kfree(priv->tx_ring[t]); | ||
2259 | kfree(priv->tx_cq[t]); | ||
2260 | } | ||
2261 | |||
2262 | free_netdev(dev); | 2277 | free_netdev(dev); |
2263 | } | 2278 | } |
2264 | 2279 | ||
@@ -2761,7 +2776,7 @@ static int mlx4_xdp_set(struct net_device *dev, struct bpf_prog *prog) | |||
2761 | en_warn(priv, "Reducing the number of TX rings, to not exceed the max total rings number.\n"); | 2776 | en_warn(priv, "Reducing the number of TX rings, to not exceed the max total rings number.\n"); |
2762 | } | 2777 | } |
2763 | 2778 | ||
2764 | err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof); | 2779 | err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof, false); |
2765 | if (err) { | 2780 | if (err) { |
2766 | if (prog) | 2781 | if (prog) |
2767 | bpf_prog_sub(prog, priv->rx_ring_num - 1); | 2782 | bpf_prog_sub(prog, priv->rx_ring_num - 1); |
@@ -3505,7 +3520,7 @@ int mlx4_en_reset_config(struct net_device *dev, | |||
3505 | memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile)); | 3520 | memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile)); |
3506 | memcpy(&new_prof.hwtstamp_config, &ts_config, sizeof(ts_config)); | 3521 | memcpy(&new_prof.hwtstamp_config, &ts_config, sizeof(ts_config)); |
3507 | 3522 | ||
3508 | err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof); | 3523 | err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof, true); |
3509 | if (err) | 3524 | if (err) |
3510 | goto out; | 3525 | goto out; |
3511 | 3526 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index f15ddba3659a..d85e6446f9d9 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c | |||
@@ -515,8 +515,11 @@ void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv) | |||
515 | return; | 515 | return; |
516 | 516 | ||
517 | for (ring = 0; ring < priv->rx_ring_num; ring++) { | 517 | for (ring = 0; ring < priv->rx_ring_num; ring++) { |
518 | if (mlx4_en_is_ring_empty(priv->rx_ring[ring])) | 518 | if (mlx4_en_is_ring_empty(priv->rx_ring[ring])) { |
519 | local_bh_disable(); | ||
519 | napi_reschedule(&priv->rx_cq[ring]->napi); | 520 | napi_reschedule(&priv->rx_cq[ring]->napi); |
521 | local_bh_enable(); | ||
522 | } | ||
520 | } | 523 | } |
521 | } | 524 | } |
522 | 525 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index ba1c6cd0cc79..cec59bc264c9 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -679,7 +679,8 @@ void mlx4_en_set_stats_bitmap(struct mlx4_dev *dev, | |||
679 | 679 | ||
680 | int mlx4_en_try_alloc_resources(struct mlx4_en_priv *priv, | 680 | int mlx4_en_try_alloc_resources(struct mlx4_en_priv *priv, |
681 | struct mlx4_en_priv *tmp, | 681 | struct mlx4_en_priv *tmp, |
682 | struct mlx4_en_port_profile *prof); | 682 | struct mlx4_en_port_profile *prof, |
683 | bool carry_xdp_prog); | ||
683 | void mlx4_en_safe_replace_resources(struct mlx4_en_priv *priv, | 684 | void mlx4_en_safe_replace_resources(struct mlx4_en_priv *priv, |
684 | struct mlx4_en_priv *tmp); | 685 | struct mlx4_en_priv *tmp); |
685 | 686 | ||
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 5cfdb1a1b4c1..fd6ebbefd919 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
@@ -1254,6 +1254,9 @@ void netvsc_channel_cb(void *context) | |||
1254 | netvsc_channel_idle(net_device, q_idx)) | 1254 | netvsc_channel_idle(net_device, q_idx)) |
1255 | return; | 1255 | return; |
1256 | 1256 | ||
1257 | /* commit_rd_index() -> hv_signal_on_read() needs this. */ | ||
1258 | init_cached_read_index(channel); | ||
1259 | |||
1257 | while ((desc = get_next_pkt_raw(channel)) != NULL) { | 1260 | while ((desc = get_next_pkt_raw(channel)) != NULL) { |
1258 | netvsc_process_raw_pkt(device, channel, net_device, | 1261 | netvsc_process_raw_pkt(device, channel, net_device, |
1259 | ndev, desc->trans_id, desc); | 1262 | ndev, desc->trans_id, desc); |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 402618565838..c27011bbe30c 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -681,7 +681,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, | |||
681 | size_t linear; | 681 | size_t linear; |
682 | 682 | ||
683 | if (q->flags & IFF_VNET_HDR) { | 683 | if (q->flags & IFF_VNET_HDR) { |
684 | vnet_hdr_len = q->vnet_hdr_sz; | 684 | vnet_hdr_len = READ_ONCE(q->vnet_hdr_sz); |
685 | 685 | ||
686 | err = -EINVAL; | 686 | err = -EINVAL; |
687 | if (len < vnet_hdr_len) | 687 | if (len < vnet_hdr_len) |
@@ -820,7 +820,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, | |||
820 | 820 | ||
821 | if (q->flags & IFF_VNET_HDR) { | 821 | if (q->flags & IFF_VNET_HDR) { |
822 | struct virtio_net_hdr vnet_hdr; | 822 | struct virtio_net_hdr vnet_hdr; |
823 | vnet_hdr_len = q->vnet_hdr_sz; | 823 | vnet_hdr_len = READ_ONCE(q->vnet_hdr_sz); |
824 | if (iov_iter_count(iter) < vnet_hdr_len) | 824 | if (iov_iter_count(iter) < vnet_hdr_len) |
825 | return -EINVAL; | 825 | return -EINVAL; |
826 | 826 | ||
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 92b08383cafa..0d8f4d3847f6 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -920,6 +920,11 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
920 | return -EIO; | 920 | return -EIO; |
921 | } | 921 | } |
922 | 922 | ||
923 | if (!try_module_get(d->driver->owner)) { | ||
924 | dev_err(&dev->dev, "failed to get the device driver module\n"); | ||
925 | return -EIO; | ||
926 | } | ||
927 | |||
923 | get_device(d); | 928 | get_device(d); |
924 | 929 | ||
925 | /* Assume that if there is no driver, that it doesn't | 930 | /* Assume that if there is no driver, that it doesn't |
@@ -977,6 +982,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
977 | error: | 982 | error: |
978 | phy_detach(phydev); | 983 | phy_detach(phydev); |
979 | put_device(d); | 984 | put_device(d); |
985 | module_put(d->driver->owner); | ||
980 | if (ndev_owner != bus->owner) | 986 | if (ndev_owner != bus->owner) |
981 | module_put(bus->owner); | 987 | module_put(bus->owner); |
982 | return err; | 988 | return err; |
@@ -1059,6 +1065,7 @@ void phy_detach(struct phy_device *phydev) | |||
1059 | bus = phydev->mdio.bus; | 1065 | bus = phydev->mdio.bus; |
1060 | 1066 | ||
1061 | put_device(&phydev->mdio.dev); | 1067 | put_device(&phydev->mdio.dev); |
1068 | module_put(phydev->mdio.dev.driver->owner); | ||
1062 | if (ndev_owner != bus->owner) | 1069 | if (ndev_owner != bus->owner) |
1063 | module_put(bus->owner); | 1070 | module_put(bus->owner); |
1064 | } | 1071 | } |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 8a7d6b905362..30863e378925 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1207,9 +1207,11 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
1207 | } | 1207 | } |
1208 | 1208 | ||
1209 | if (tun->flags & IFF_VNET_HDR) { | 1209 | if (tun->flags & IFF_VNET_HDR) { |
1210 | if (len < tun->vnet_hdr_sz) | 1210 | int vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz); |
1211 | |||
1212 | if (len < vnet_hdr_sz) | ||
1211 | return -EINVAL; | 1213 | return -EINVAL; |
1212 | len -= tun->vnet_hdr_sz; | 1214 | len -= vnet_hdr_sz; |
1213 | 1215 | ||
1214 | if (!copy_from_iter_full(&gso, sizeof(gso), from)) | 1216 | if (!copy_from_iter_full(&gso, sizeof(gso), from)) |
1215 | return -EFAULT; | 1217 | return -EFAULT; |
@@ -1220,7 +1222,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
1220 | 1222 | ||
1221 | if (tun16_to_cpu(tun, gso.hdr_len) > len) | 1223 | if (tun16_to_cpu(tun, gso.hdr_len) > len) |
1222 | return -EINVAL; | 1224 | return -EINVAL; |
1223 | iov_iter_advance(from, tun->vnet_hdr_sz - sizeof(gso)); | 1225 | iov_iter_advance(from, vnet_hdr_sz - sizeof(gso)); |
1224 | } | 1226 | } |
1225 | 1227 | ||
1226 | if ((tun->flags & TUN_TYPE_MASK) == IFF_TAP) { | 1228 | if ((tun->flags & TUN_TYPE_MASK) == IFF_TAP) { |
@@ -1371,7 +1373,7 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1371 | vlan_hlen = VLAN_HLEN; | 1373 | vlan_hlen = VLAN_HLEN; |
1372 | 1374 | ||
1373 | if (tun->flags & IFF_VNET_HDR) | 1375 | if (tun->flags & IFF_VNET_HDR) |
1374 | vnet_hdr_sz = tun->vnet_hdr_sz; | 1376 | vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz); |
1375 | 1377 | ||
1376 | total = skb->len + vlan_hlen + vnet_hdr_sz; | 1378 | total = skb->len + vlan_hlen + vnet_hdr_sz; |
1377 | 1379 | ||
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index 3daa41bdd4ea..0acc9b640419 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c | |||
@@ -776,7 +776,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
776 | struct net_device *netdev; | 776 | struct net_device *netdev; |
777 | struct catc *catc; | 777 | struct catc *catc; |
778 | u8 broadcast[ETH_ALEN]; | 778 | u8 broadcast[ETH_ALEN]; |
779 | int i, pktsz; | 779 | int pktsz, ret; |
780 | 780 | ||
781 | if (usb_set_interface(usbdev, | 781 | if (usb_set_interface(usbdev, |
782 | intf->altsetting->desc.bInterfaceNumber, 1)) { | 782 | intf->altsetting->desc.bInterfaceNumber, 1)) { |
@@ -811,12 +811,8 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
811 | if ((!catc->ctrl_urb) || (!catc->tx_urb) || | 811 | if ((!catc->ctrl_urb) || (!catc->tx_urb) || |
812 | (!catc->rx_urb) || (!catc->irq_urb)) { | 812 | (!catc->rx_urb) || (!catc->irq_urb)) { |
813 | dev_err(&intf->dev, "No free urbs available.\n"); | 813 | dev_err(&intf->dev, "No free urbs available.\n"); |
814 | usb_free_urb(catc->ctrl_urb); | 814 | ret = -ENOMEM; |
815 | usb_free_urb(catc->tx_urb); | 815 | goto fail_free; |
816 | usb_free_urb(catc->rx_urb); | ||
817 | usb_free_urb(catc->irq_urb); | ||
818 | free_netdev(netdev); | ||
819 | return -ENOMEM; | ||
820 | } | 816 | } |
821 | 817 | ||
822 | /* The F5U011 has the same vendor/product as the netmate but a device version of 0x130 */ | 818 | /* The F5U011 has the same vendor/product as the netmate but a device version of 0x130 */ |
@@ -844,15 +840,24 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
844 | catc->irq_buf, 2, catc_irq_done, catc, 1); | 840 | catc->irq_buf, 2, catc_irq_done, catc, 1); |
845 | 841 | ||
846 | if (!catc->is_f5u011) { | 842 | if (!catc->is_f5u011) { |
843 | u32 *buf; | ||
844 | int i; | ||
845 | |||
847 | dev_dbg(dev, "Checking memory size\n"); | 846 | dev_dbg(dev, "Checking memory size\n"); |
848 | 847 | ||
849 | i = 0x12345678; | 848 | buf = kmalloc(4, GFP_KERNEL); |
850 | catc_write_mem(catc, 0x7a80, &i, 4); | 849 | if (!buf) { |
851 | i = 0x87654321; | 850 | ret = -ENOMEM; |
852 | catc_write_mem(catc, 0xfa80, &i, 4); | 851 | goto fail_free; |
853 | catc_read_mem(catc, 0x7a80, &i, 4); | 852 | } |
853 | |||
854 | *buf = 0x12345678; | ||
855 | catc_write_mem(catc, 0x7a80, buf, 4); | ||
856 | *buf = 0x87654321; | ||
857 | catc_write_mem(catc, 0xfa80, buf, 4); | ||
858 | catc_read_mem(catc, 0x7a80, buf, 4); | ||
854 | 859 | ||
855 | switch (i) { | 860 | switch (*buf) { |
856 | case 0x12345678: | 861 | case 0x12345678: |
857 | catc_set_reg(catc, TxBufCount, 8); | 862 | catc_set_reg(catc, TxBufCount, 8); |
858 | catc_set_reg(catc, RxBufCount, 32); | 863 | catc_set_reg(catc, RxBufCount, 32); |
@@ -867,6 +872,8 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
867 | dev_dbg(dev, "32k Memory\n"); | 872 | dev_dbg(dev, "32k Memory\n"); |
868 | break; | 873 | break; |
869 | } | 874 | } |
875 | |||
876 | kfree(buf); | ||
870 | 877 | ||
871 | dev_dbg(dev, "Getting MAC from SEEROM.\n"); | 878 | dev_dbg(dev, "Getting MAC from SEEROM.\n"); |
872 | 879 | ||
@@ -913,16 +920,21 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
913 | usb_set_intfdata(intf, catc); | 920 | usb_set_intfdata(intf, catc); |
914 | 921 | ||
915 | SET_NETDEV_DEV(netdev, &intf->dev); | 922 | SET_NETDEV_DEV(netdev, &intf->dev); |
916 | if (register_netdev(netdev) != 0) { | 923 | ret = register_netdev(netdev); |
917 | usb_set_intfdata(intf, NULL); | 924 | if (ret) |
918 | usb_free_urb(catc->ctrl_urb); | 925 | goto fail_clear_intfdata; |
919 | usb_free_urb(catc->tx_urb); | 926 | |
920 | usb_free_urb(catc->rx_urb); | ||
921 | usb_free_urb(catc->irq_urb); | ||
922 | free_netdev(netdev); | ||
923 | return -EIO; | ||
924 | } | ||
925 | return 0; | 927 | return 0; |
928 | |||
929 | fail_clear_intfdata: | ||
930 | usb_set_intfdata(intf, NULL); | ||
931 | fail_free: | ||
932 | usb_free_urb(catc->ctrl_urb); | ||
933 | usb_free_urb(catc->tx_urb); | ||
934 | usb_free_urb(catc->rx_urb); | ||
935 | usb_free_urb(catc->irq_urb); | ||
936 | free_netdev(netdev); | ||
937 | return ret; | ||
926 | } | 938 | } |
927 | 939 | ||
928 | static void catc_disconnect(struct usb_interface *intf) | 940 | static void catc_disconnect(struct usb_interface *intf) |
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index 24e803fe9a53..36674484c6fb 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c | |||
@@ -126,40 +126,61 @@ static void async_ctrl_callback(struct urb *urb) | |||
126 | 126 | ||
127 | static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data) | 127 | static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data) |
128 | { | 128 | { |
129 | u8 *buf; | ||
129 | int ret; | 130 | int ret; |
130 | 131 | ||
132 | buf = kmalloc(size, GFP_NOIO); | ||
133 | if (!buf) | ||
134 | return -ENOMEM; | ||
135 | |||
131 | ret = usb_control_msg(pegasus->usb, usb_rcvctrlpipe(pegasus->usb, 0), | 136 | ret = usb_control_msg(pegasus->usb, usb_rcvctrlpipe(pegasus->usb, 0), |
132 | PEGASUS_REQ_GET_REGS, PEGASUS_REQT_READ, 0, | 137 | PEGASUS_REQ_GET_REGS, PEGASUS_REQT_READ, 0, |
133 | indx, data, size, 1000); | 138 | indx, buf, size, 1000); |
134 | if (ret < 0) | 139 | if (ret < 0) |
135 | netif_dbg(pegasus, drv, pegasus->net, | 140 | netif_dbg(pegasus, drv, pegasus->net, |
136 | "%s returned %d\n", __func__, ret); | 141 | "%s returned %d\n", __func__, ret); |
142 | else if (ret <= size) | ||
143 | memcpy(data, buf, ret); | ||
144 | kfree(buf); | ||
137 | return ret; | 145 | return ret; |
138 | } | 146 | } |
139 | 147 | ||
140 | static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data) | 148 | static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size, |
149 | const void *data) | ||
141 | { | 150 | { |
151 | u8 *buf; | ||
142 | int ret; | 152 | int ret; |
143 | 153 | ||
154 | buf = kmemdup(data, size, GFP_NOIO); | ||
155 | if (!buf) | ||
156 | return -ENOMEM; | ||
157 | |||
144 | ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0), | 158 | ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0), |
145 | PEGASUS_REQ_SET_REGS, PEGASUS_REQT_WRITE, 0, | 159 | PEGASUS_REQ_SET_REGS, PEGASUS_REQT_WRITE, 0, |
146 | indx, data, size, 100); | 160 | indx, buf, size, 100); |
147 | if (ret < 0) | 161 | if (ret < 0) |
148 | netif_dbg(pegasus, drv, pegasus->net, | 162 | netif_dbg(pegasus, drv, pegasus->net, |
149 | "%s returned %d\n", __func__, ret); | 163 | "%s returned %d\n", __func__, ret); |
164 | kfree(buf); | ||
150 | return ret; | 165 | return ret; |
151 | } | 166 | } |
152 | 167 | ||
153 | static int set_register(pegasus_t *pegasus, __u16 indx, __u8 data) | 168 | static int set_register(pegasus_t *pegasus, __u16 indx, __u8 data) |
154 | { | 169 | { |
170 | u8 *buf; | ||
155 | int ret; | 171 | int ret; |
156 | 172 | ||
173 | buf = kmemdup(&data, 1, GFP_NOIO); | ||
174 | if (!buf) | ||
175 | return -ENOMEM; | ||
176 | |||
157 | ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0), | 177 | ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0), |
158 | PEGASUS_REQ_SET_REG, PEGASUS_REQT_WRITE, data, | 178 | PEGASUS_REQ_SET_REG, PEGASUS_REQT_WRITE, data, |
159 | indx, &data, 1, 1000); | 179 | indx, buf, 1, 1000); |
160 | if (ret < 0) | 180 | if (ret < 0) |
161 | netif_dbg(pegasus, drv, pegasus->net, | 181 | netif_dbg(pegasus, drv, pegasus->net, |
162 | "%s returned %d\n", __func__, ret); | 182 | "%s returned %d\n", __func__, ret); |
183 | kfree(buf); | ||
163 | return ret; | 184 | return ret; |
164 | } | 185 | } |
165 | 186 | ||
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index 95b7bd0d7abc..c81c79110cef 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -155,16 +155,36 @@ static const char driver_name [] = "rtl8150"; | |||
155 | */ | 155 | */ |
156 | static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data) | 156 | static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data) |
157 | { | 157 | { |
158 | return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), | 158 | void *buf; |
159 | RTL8150_REQ_GET_REGS, RTL8150_REQT_READ, | 159 | int ret; |
160 | indx, 0, data, size, 500); | 160 | |
161 | buf = kmalloc(size, GFP_NOIO); | ||
162 | if (!buf) | ||
163 | return -ENOMEM; | ||
164 | |||
165 | ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), | ||
166 | RTL8150_REQ_GET_REGS, RTL8150_REQT_READ, | ||
167 | indx, 0, buf, size, 500); | ||
168 | if (ret > 0 && ret <= size) | ||
169 | memcpy(data, buf, ret); | ||
170 | kfree(buf); | ||
171 | return ret; | ||
161 | } | 172 | } |
162 | 173 | ||
163 | static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data) | 174 | static int set_registers(rtl8150_t * dev, u16 indx, u16 size, const void *data) |
164 | { | 175 | { |
165 | return usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), | 176 | void *buf; |
166 | RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE, | 177 | int ret; |
167 | indx, 0, data, size, 500); | 178 | |
179 | buf = kmemdup(data, size, GFP_NOIO); | ||
180 | if (!buf) | ||
181 | return -ENOMEM; | ||
182 | |||
183 | ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), | ||
184 | RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE, | ||
185 | indx, 0, buf, size, 500); | ||
186 | kfree(buf); | ||
187 | return ret; | ||
168 | } | 188 | } |
169 | 189 | ||
170 | static void async_set_reg_cb(struct urb *urb) | 190 | static void async_set_reg_cb(struct urb *urb) |
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c index efedd918d10a..bcbb0c60f1f1 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c | |||
@@ -92,7 +92,7 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw) | |||
92 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 92 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
93 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 93 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
94 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 94 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
95 | char *fw_name = "rtlwifi/rtl8192cfwU.bin"; | 95 | char *fw_name; |
96 | 96 | ||
97 | rtl8192ce_bt_reg_init(hw); | 97 | rtl8192ce_bt_reg_init(hw); |
98 | 98 | ||
@@ -161,8 +161,13 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw) | |||
161 | } | 161 | } |
162 | 162 | ||
163 | /* request fw */ | 163 | /* request fw */ |
164 | if (IS_81XXC_VENDOR_UMC_B_CUT(rtlhal->version)) | 164 | if (IS_VENDOR_UMC_A_CUT(rtlhal->version) && |
165 | !IS_92C_SERIAL(rtlhal->version)) | ||
166 | fw_name = "rtlwifi/rtl8192cfwU.bin"; | ||
167 | else if (IS_81XXC_VENDOR_UMC_B_CUT(rtlhal->version)) | ||
165 | fw_name = "rtlwifi/rtl8192cfwU_B.bin"; | 168 | fw_name = "rtlwifi/rtl8192cfwU_B.bin"; |
169 | else | ||
170 | fw_name = "rtlwifi/rtl8192cfw.bin"; | ||
166 | 171 | ||
167 | rtlpriv->max_fw_size = 0x4000; | 172 | rtlpriv->max_fw_size = 0x4000; |
168 | pr_info("Using firmware %s\n", fw_name); | 173 | pr_info("Using firmware %s\n", fw_name); |
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index a518cb1b59d4..ce3e8dfa10ad 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c | |||
@@ -52,17 +52,17 @@ static void namespace_blk_release(struct device *dev) | |||
52 | kfree(nsblk); | 52 | kfree(nsblk); |
53 | } | 53 | } |
54 | 54 | ||
55 | static struct device_type namespace_io_device_type = { | 55 | static const struct device_type namespace_io_device_type = { |
56 | .name = "nd_namespace_io", | 56 | .name = "nd_namespace_io", |
57 | .release = namespace_io_release, | 57 | .release = namespace_io_release, |
58 | }; | 58 | }; |
59 | 59 | ||
60 | static struct device_type namespace_pmem_device_type = { | 60 | static const struct device_type namespace_pmem_device_type = { |
61 | .name = "nd_namespace_pmem", | 61 | .name = "nd_namespace_pmem", |
62 | .release = namespace_pmem_release, | 62 | .release = namespace_pmem_release, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static struct device_type namespace_blk_device_type = { | 65 | static const struct device_type namespace_blk_device_type = { |
66 | .name = "nd_namespace_blk", | 66 | .name = "nd_namespace_blk", |
67 | .release = namespace_blk_release, | 67 | .release = namespace_blk_release, |
68 | }; | 68 | }; |
@@ -962,8 +962,8 @@ static ssize_t __size_store(struct device *dev, unsigned long long val) | |||
962 | struct nvdimm_drvdata *ndd; | 962 | struct nvdimm_drvdata *ndd; |
963 | struct nd_label_id label_id; | 963 | struct nd_label_id label_id; |
964 | u32 flags = 0, remainder; | 964 | u32 flags = 0, remainder; |
965 | int rc, i, id = -1; | ||
965 | u8 *uuid = NULL; | 966 | u8 *uuid = NULL; |
966 | int rc, i; | ||
967 | 967 | ||
968 | if (dev->driver || ndns->claim) | 968 | if (dev->driver || ndns->claim) |
969 | return -EBUSY; | 969 | return -EBUSY; |
@@ -972,11 +972,13 @@ static ssize_t __size_store(struct device *dev, unsigned long long val) | |||
972 | struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev); | 972 | struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev); |
973 | 973 | ||
974 | uuid = nspm->uuid; | 974 | uuid = nspm->uuid; |
975 | id = nspm->id; | ||
975 | } else if (is_namespace_blk(dev)) { | 976 | } else if (is_namespace_blk(dev)) { |
976 | struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev); | 977 | struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev); |
977 | 978 | ||
978 | uuid = nsblk->uuid; | 979 | uuid = nsblk->uuid; |
979 | flags = NSLABEL_FLAG_LOCAL; | 980 | flags = NSLABEL_FLAG_LOCAL; |
981 | id = nsblk->id; | ||
980 | } | 982 | } |
981 | 983 | ||
982 | /* | 984 | /* |
@@ -1039,10 +1041,11 @@ static ssize_t __size_store(struct device *dev, unsigned long long val) | |||
1039 | 1041 | ||
1040 | /* | 1042 | /* |
1041 | * Try to delete the namespace if we deleted all of its | 1043 | * Try to delete the namespace if we deleted all of its |
1042 | * allocation, this is not the seed device for the region, and | 1044 | * allocation, this is not the seed or 0th device for the |
1043 | * it is not actively claimed by a btt instance. | 1045 | * region, and it is not actively claimed by a btt, pfn, or dax |
1046 | * instance. | ||
1044 | */ | 1047 | */ |
1045 | if (val == 0 && nd_region->ns_seed != dev && !ndns->claim) | 1048 | if (val == 0 && id != 0 && nd_region->ns_seed != dev && !ndns->claim) |
1046 | nd_device_unregister(dev, ND_ASYNC); | 1049 | nd_device_unregister(dev, ND_ASYNC); |
1047 | 1050 | ||
1048 | return rc; | 1051 | return rc; |
diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c index a2ac9e641aa9..6c033c9a2f06 100644 --- a/drivers/nvdimm/pfn_devs.c +++ b/drivers/nvdimm/pfn_devs.c | |||
@@ -627,15 +627,12 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn) | |||
627 | size = resource_size(&nsio->res); | 627 | size = resource_size(&nsio->res); |
628 | npfns = (size - start_pad - end_trunc - SZ_8K) / SZ_4K; | 628 | npfns = (size - start_pad - end_trunc - SZ_8K) / SZ_4K; |
629 | if (nd_pfn->mode == PFN_MODE_PMEM) { | 629 | if (nd_pfn->mode == PFN_MODE_PMEM) { |
630 | unsigned long memmap_size; | ||
631 | |||
632 | /* | 630 | /* |
633 | * vmemmap_populate_hugepages() allocates the memmap array in | 631 | * vmemmap_populate_hugepages() allocates the memmap array in |
634 | * HPAGE_SIZE chunks. | 632 | * HPAGE_SIZE chunks. |
635 | */ | 633 | */ |
636 | memmap_size = ALIGN(64 * npfns, HPAGE_SIZE); | 634 | offset = ALIGN(start + SZ_8K + 64 * npfns + dax_label_reserve, |
637 | offset = ALIGN(start + SZ_8K + memmap_size + dax_label_reserve, | 635 | max(nd_pfn->align, HPAGE_SIZE)) - start; |
638 | nd_pfn->align) - start; | ||
639 | } else if (nd_pfn->mode == PFN_MODE_RAM) | 636 | } else if (nd_pfn->mode == PFN_MODE_RAM) |
640 | offset = ALIGN(start + SZ_8K + dax_label_reserve, | 637 | offset = ALIGN(start + SZ_8K + dax_label_reserve, |
641 | nd_pfn->align) - start; | 638 | nd_pfn->align) - start; |
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 17ac1dce3286..3dd8bcbb3011 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c | |||
@@ -532,25 +532,32 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev) | |||
532 | link = kzalloc(sizeof(*link), GFP_KERNEL); | 532 | link = kzalloc(sizeof(*link), GFP_KERNEL); |
533 | if (!link) | 533 | if (!link) |
534 | return NULL; | 534 | return NULL; |
535 | |||
535 | INIT_LIST_HEAD(&link->sibling); | 536 | INIT_LIST_HEAD(&link->sibling); |
536 | INIT_LIST_HEAD(&link->children); | 537 | INIT_LIST_HEAD(&link->children); |
537 | INIT_LIST_HEAD(&link->link); | 538 | INIT_LIST_HEAD(&link->link); |
538 | link->pdev = pdev; | 539 | link->pdev = pdev; |
539 | if (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) { | 540 | |
541 | /* | ||
542 | * Root Ports and PCI/PCI-X to PCIe Bridges are roots of PCIe | ||
543 | * hierarchies. | ||
544 | */ | ||
545 | if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT || | ||
546 | pci_pcie_type(pdev) == PCI_EXP_TYPE_PCIE_BRIDGE) { | ||
547 | link->root = link; | ||
548 | } else { | ||
540 | struct pcie_link_state *parent; | 549 | struct pcie_link_state *parent; |
550 | |||
541 | parent = pdev->bus->parent->self->link_state; | 551 | parent = pdev->bus->parent->self->link_state; |
542 | if (!parent) { | 552 | if (!parent) { |
543 | kfree(link); | 553 | kfree(link); |
544 | return NULL; | 554 | return NULL; |
545 | } | 555 | } |
556 | |||
546 | link->parent = parent; | 557 | link->parent = parent; |
558 | link->root = link->parent->root; | ||
547 | list_add(&link->link, &parent->children); | 559 | list_add(&link->link, &parent->children); |
548 | } | 560 | } |
549 | /* Setup a pointer to the root port link */ | ||
550 | if (!link->parent) | ||
551 | link->root = link; | ||
552 | else | ||
553 | link->root = link->parent->root; | ||
554 | 561 | ||
555 | list_add(&link->sibling, &link_list); | 562 | list_add(&link->sibling, &link_list); |
556 | pdev->link_state = link; | 563 | pdev->link_state = link; |
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index e6a512ebeae2..a3ade9e4ef47 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c | |||
@@ -272,7 +272,7 @@ static const struct regulator_desc axp806_regulators[] = { | |||
272 | 64, AXP806_DCDCD_V_CTRL, 0x3f, AXP806_PWR_OUT_CTRL1, | 272 | 64, AXP806_DCDCD_V_CTRL, 0x3f, AXP806_PWR_OUT_CTRL1, |
273 | BIT(3)), | 273 | BIT(3)), |
274 | AXP_DESC(AXP806, DCDCE, "dcdce", "vine", 1100, 3400, 100, | 274 | AXP_DESC(AXP806, DCDCE, "dcdce", "vine", 1100, 3400, 100, |
275 | AXP806_DCDCB_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(4)), | 275 | AXP806_DCDCE_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(4)), |
276 | AXP_DESC(AXP806, ALDO1, "aldo1", "aldoin", 700, 3300, 100, | 276 | AXP_DESC(AXP806, ALDO1, "aldo1", "aldoin", 700, 3300, 100, |
277 | AXP806_ALDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(5)), | 277 | AXP806_ALDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(5)), |
278 | AXP_DESC(AXP806, ALDO2, "aldo2", "aldoin", 700, 3400, 100, | 278 | AXP_DESC(AXP806, ALDO2, "aldo2", "aldoin", 700, 3400, 100, |
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index a43b0e8a438d..988a7472c2ab 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c | |||
@@ -30,9 +30,6 @@ | |||
30 | #include <linux/of_gpio.h> | 30 | #include <linux/of_gpio.h> |
31 | #include <linux/regulator/of_regulator.h> | 31 | #include <linux/regulator/of_regulator.h> |
32 | #include <linux/regulator/machine.h> | 32 | #include <linux/regulator/machine.h> |
33 | #include <linux/acpi.h> | ||
34 | #include <linux/property.h> | ||
35 | #include <linux/gpio/consumer.h> | ||
36 | 33 | ||
37 | struct fixed_voltage_data { | 34 | struct fixed_voltage_data { |
38 | struct regulator_desc desc; | 35 | struct regulator_desc desc; |
@@ -97,44 +94,6 @@ of_get_fixed_voltage_config(struct device *dev, | |||
97 | return config; | 94 | return config; |
98 | } | 95 | } |
99 | 96 | ||
100 | /** | ||
101 | * acpi_get_fixed_voltage_config - extract fixed_voltage_config structure info | ||
102 | * @dev: device requesting for fixed_voltage_config | ||
103 | * @desc: regulator description | ||
104 | * | ||
105 | * Populates fixed_voltage_config structure by extracting data through ACPI | ||
106 | * interface, returns a pointer to the populated structure of NULL if memory | ||
107 | * alloc fails. | ||
108 | */ | ||
109 | static struct fixed_voltage_config * | ||
110 | acpi_get_fixed_voltage_config(struct device *dev, | ||
111 | const struct regulator_desc *desc) | ||
112 | { | ||
113 | struct fixed_voltage_config *config; | ||
114 | const char *supply_name; | ||
115 | struct gpio_desc *gpiod; | ||
116 | int ret; | ||
117 | |||
118 | config = devm_kzalloc(dev, sizeof(*config), GFP_KERNEL); | ||
119 | if (!config) | ||
120 | return ERR_PTR(-ENOMEM); | ||
121 | |||
122 | ret = device_property_read_string(dev, "supply-name", &supply_name); | ||
123 | if (!ret) | ||
124 | config->supply_name = supply_name; | ||
125 | |||
126 | gpiod = gpiod_get(dev, "gpio", GPIOD_ASIS); | ||
127 | if (IS_ERR(gpiod)) | ||
128 | return ERR_PTR(-ENODEV); | ||
129 | |||
130 | config->gpio = desc_to_gpio(gpiod); | ||
131 | config->enable_high = device_property_read_bool(dev, | ||
132 | "enable-active-high"); | ||
133 | gpiod_put(gpiod); | ||
134 | |||
135 | return config; | ||
136 | } | ||
137 | |||
138 | static struct regulator_ops fixed_voltage_ops = { | 97 | static struct regulator_ops fixed_voltage_ops = { |
139 | }; | 98 | }; |
140 | 99 | ||
@@ -155,11 +114,6 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) | |||
155 | &drvdata->desc); | 114 | &drvdata->desc); |
156 | if (IS_ERR(config)) | 115 | if (IS_ERR(config)) |
157 | return PTR_ERR(config); | 116 | return PTR_ERR(config); |
158 | } else if (ACPI_HANDLE(&pdev->dev)) { | ||
159 | config = acpi_get_fixed_voltage_config(&pdev->dev, | ||
160 | &drvdata->desc); | ||
161 | if (IS_ERR(config)) | ||
162 | return PTR_ERR(config); | ||
163 | } else { | 117 | } else { |
164 | config = dev_get_platdata(&pdev->dev); | 118 | config = dev_get_platdata(&pdev->dev); |
165 | } | 119 | } |
diff --git a/drivers/regulator/twl6030-regulator.c b/drivers/regulator/twl6030-regulator.c index 4864b9d742c0..716191046a70 100644 --- a/drivers/regulator/twl6030-regulator.c +++ b/drivers/regulator/twl6030-regulator.c | |||
@@ -452,7 +452,7 @@ static int twl6030smps_map_voltage(struct regulator_dev *rdev, int min_uV, | |||
452 | vsel = 62; | 452 | vsel = 62; |
453 | else if ((min_uV > 1800000) && (min_uV <= 1900000)) | 453 | else if ((min_uV > 1800000) && (min_uV <= 1900000)) |
454 | vsel = 61; | 454 | vsel = 61; |
455 | else if ((min_uV > 1350000) && (min_uV <= 1800000)) | 455 | else if ((min_uV > 1500000) && (min_uV <= 1800000)) |
456 | vsel = 60; | 456 | vsel = 60; |
457 | else if ((min_uV > 1350000) && (min_uV <= 1500000)) | 457 | else if ((min_uV > 1350000) && (min_uV <= 1500000)) |
458 | vsel = 59; | 458 | vsel = 59; |
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index ec91bd07f00a..c680d7641311 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -534,7 +534,9 @@ static int virtscsi_queuecommand(struct virtio_scsi *vscsi, | |||
534 | { | 534 | { |
535 | struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev); | 535 | struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev); |
536 | struct virtio_scsi_cmd *cmd = scsi_cmd_priv(sc); | 536 | struct virtio_scsi_cmd *cmd = scsi_cmd_priv(sc); |
537 | unsigned long flags; | ||
537 | int req_size; | 538 | int req_size; |
539 | int ret; | ||
538 | 540 | ||
539 | BUG_ON(scsi_sg_count(sc) > shost->sg_tablesize); | 541 | BUG_ON(scsi_sg_count(sc) > shost->sg_tablesize); |
540 | 542 | ||
@@ -562,8 +564,15 @@ static int virtscsi_queuecommand(struct virtio_scsi *vscsi, | |||
562 | req_size = sizeof(cmd->req.cmd); | 564 | req_size = sizeof(cmd->req.cmd); |
563 | } | 565 | } |
564 | 566 | ||
565 | if (virtscsi_kick_cmd(req_vq, cmd, req_size, sizeof(cmd->resp.cmd)) != 0) | 567 | ret = virtscsi_kick_cmd(req_vq, cmd, req_size, sizeof(cmd->resp.cmd)); |
568 | if (ret == -EIO) { | ||
569 | cmd->resp.cmd.response = VIRTIO_SCSI_S_BAD_TARGET; | ||
570 | spin_lock_irqsave(&req_vq->vq_lock, flags); | ||
571 | virtscsi_complete_cmd(vscsi, cmd); | ||
572 | spin_unlock_irqrestore(&req_vq->vq_lock, flags); | ||
573 | } else if (ret != 0) { | ||
566 | return SCSI_MLQUEUE_HOST_BUSY; | 574 | return SCSI_MLQUEUE_HOST_BUSY; |
575 | } | ||
567 | return 0; | 576 | return 0; |
568 | } | 577 | } |
569 | 578 | ||
diff --git a/drivers/staging/greybus/timesync_platform.c b/drivers/staging/greybus/timesync_platform.c index 113f3d6c4b3a..27f75b17679b 100644 --- a/drivers/staging/greybus/timesync_platform.c +++ b/drivers/staging/greybus/timesync_platform.c | |||
@@ -45,12 +45,18 @@ u32 gb_timesync_platform_get_clock_rate(void) | |||
45 | 45 | ||
46 | int gb_timesync_platform_lock_bus(struct gb_timesync_svc *pdata) | 46 | int gb_timesync_platform_lock_bus(struct gb_timesync_svc *pdata) |
47 | { | 47 | { |
48 | if (!arche_platform_change_state_cb) | ||
49 | return 0; | ||
50 | |||
48 | return arche_platform_change_state_cb(ARCHE_PLATFORM_STATE_TIME_SYNC, | 51 | return arche_platform_change_state_cb(ARCHE_PLATFORM_STATE_TIME_SYNC, |
49 | pdata); | 52 | pdata); |
50 | } | 53 | } |
51 | 54 | ||
52 | void gb_timesync_platform_unlock_bus(void) | 55 | void gb_timesync_platform_unlock_bus(void) |
53 | { | 56 | { |
57 | if (!arche_platform_change_state_cb) | ||
58 | return; | ||
59 | |||
54 | arche_platform_change_state_cb(ARCHE_PLATFORM_STATE_ACTIVE, NULL); | 60 | arche_platform_change_state_cb(ARCHE_PLATFORM_STATE_ACTIVE, NULL); |
55 | } | 61 | } |
56 | 62 | ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index d2e50a27140c..24f9f98968a5 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -37,6 +37,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
37 | /* CBM - Flash disk */ | 37 | /* CBM - Flash disk */ |
38 | { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME }, | 38 | { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME }, |
39 | 39 | ||
40 | /* WORLDE easy key (easykey.25) MIDI controller */ | ||
41 | { USB_DEVICE(0x0218, 0x0401), .driver_info = | ||
42 | USB_QUIRK_CONFIG_INTF_STRINGS }, | ||
43 | |||
40 | /* HP 5300/5370C scanner */ | 44 | /* HP 5300/5370C scanner */ |
41 | { USB_DEVICE(0x03f0, 0x0701), .driver_info = | 45 | { USB_DEVICE(0x03f0, 0x0701), .driver_info = |
42 | USB_QUIRK_STRING_FETCH_255 }, | 46 | USB_QUIRK_STRING_FETCH_255 }, |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 5490fc51638e..fd80c1b9c823 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -2269,6 +2269,8 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, | |||
2269 | if (len < sizeof(*d) || h->interface >= ffs->interfaces_count) | 2269 | if (len < sizeof(*d) || h->interface >= ffs->interfaces_count) |
2270 | return -EINVAL; | 2270 | return -EINVAL; |
2271 | length = le32_to_cpu(d->dwSize); | 2271 | length = le32_to_cpu(d->dwSize); |
2272 | if (len < length) | ||
2273 | return -EINVAL; | ||
2272 | type = le32_to_cpu(d->dwPropertyDataType); | 2274 | type = le32_to_cpu(d->dwPropertyDataType); |
2273 | if (type < USB_EXT_PROP_UNICODE || | 2275 | if (type < USB_EXT_PROP_UNICODE || |
2274 | type > USB_EXT_PROP_UNICODE_MULTI) { | 2276 | type > USB_EXT_PROP_UNICODE_MULTI) { |
@@ -2277,6 +2279,11 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, | |||
2277 | return -EINVAL; | 2279 | return -EINVAL; |
2278 | } | 2280 | } |
2279 | pnl = le16_to_cpu(d->wPropertyNameLength); | 2281 | pnl = le16_to_cpu(d->wPropertyNameLength); |
2282 | if (length < 14 + pnl) { | ||
2283 | pr_vdebug("invalid os descriptor length: %d pnl:%d (descriptor %d)\n", | ||
2284 | length, pnl, type); | ||
2285 | return -EINVAL; | ||
2286 | } | ||
2280 | pdl = le32_to_cpu(*(u32 *)((u8 *)data + 10 + pnl)); | 2287 | pdl = le32_to_cpu(*(u32 *)((u8 *)data + 10 + pnl)); |
2281 | if (length != 14 + pnl + pdl) { | 2288 | if (length != 14 + pnl + pdl) { |
2282 | pr_vdebug("invalid os descriptor length: %d pnl:%d pdl:%d (descriptor %d)\n", | 2289 | pr_vdebug("invalid os descriptor length: %d pnl:%d pdl:%d (descriptor %d)\n", |
@@ -2363,6 +2370,9 @@ static int __ffs_data_got_descs(struct ffs_data *ffs, | |||
2363 | } | 2370 | } |
2364 | } | 2371 | } |
2365 | if (flags & (1 << i)) { | 2372 | if (flags & (1 << i)) { |
2373 | if (len < 4) { | ||
2374 | goto error; | ||
2375 | } | ||
2366 | os_descs_count = get_unaligned_le32(data); | 2376 | os_descs_count = get_unaligned_le32(data); |
2367 | data += 4; | 2377 | data += 4; |
2368 | len -= 4; | 2378 | len -= 4; |
@@ -2435,7 +2445,8 @@ static int __ffs_data_got_strings(struct ffs_data *ffs, | |||
2435 | 2445 | ||
2436 | ENTER(); | 2446 | ENTER(); |
2437 | 2447 | ||
2438 | if (unlikely(get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC || | 2448 | if (unlikely(len < 16 || |
2449 | get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC || | ||
2439 | get_unaligned_le32(data + 4) != len)) | 2450 | get_unaligned_le32(data + 4) != len)) |
2440 | goto error; | 2451 | goto error; |
2441 | str_count = get_unaligned_le32(data + 8); | 2452 | str_count = get_unaligned_le32(data + 8); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fca288bbc800..772f15821242 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -594,11 +594,11 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
594 | | MUSB_PORT_STAT_RESUME; | 594 | | MUSB_PORT_STAT_RESUME; |
595 | musb->rh_timer = jiffies | 595 | musb->rh_timer = jiffies |
596 | + msecs_to_jiffies(USB_RESUME_TIMEOUT); | 596 | + msecs_to_jiffies(USB_RESUME_TIMEOUT); |
597 | musb->need_finish_resume = 1; | ||
598 | |||
599 | musb->xceiv->otg->state = OTG_STATE_A_HOST; | 597 | musb->xceiv->otg->state = OTG_STATE_A_HOST; |
600 | musb->is_active = 1; | 598 | musb->is_active = 1; |
601 | musb_host_resume_root_hub(musb); | 599 | musb_host_resume_root_hub(musb); |
600 | schedule_delayed_work(&musb->finish_resume_work, | ||
601 | msecs_to_jiffies(USB_RESUME_TIMEOUT)); | ||
602 | break; | 602 | break; |
603 | case OTG_STATE_B_WAIT_ACON: | 603 | case OTG_STATE_B_WAIT_ACON: |
604 | musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; | 604 | musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; |
@@ -1925,6 +1925,14 @@ static void musb_pm_runtime_check_session(struct musb *musb) | |||
1925 | static void musb_irq_work(struct work_struct *data) | 1925 | static void musb_irq_work(struct work_struct *data) |
1926 | { | 1926 | { |
1927 | struct musb *musb = container_of(data, struct musb, irq_work.work); | 1927 | struct musb *musb = container_of(data, struct musb, irq_work.work); |
1928 | int error; | ||
1929 | |||
1930 | error = pm_runtime_get_sync(musb->controller); | ||
1931 | if (error < 0) { | ||
1932 | dev_err(musb->controller, "Could not enable: %i\n", error); | ||
1933 | |||
1934 | return; | ||
1935 | } | ||
1928 | 1936 | ||
1929 | musb_pm_runtime_check_session(musb); | 1937 | musb_pm_runtime_check_session(musb); |
1930 | 1938 | ||
@@ -1932,6 +1940,9 @@ static void musb_irq_work(struct work_struct *data) | |||
1932 | musb->xceiv_old_state = musb->xceiv->otg->state; | 1940 | musb->xceiv_old_state = musb->xceiv->otg->state; |
1933 | sysfs_notify(&musb->controller->kobj, NULL, "mode"); | 1941 | sysfs_notify(&musb->controller->kobj, NULL, "mode"); |
1934 | } | 1942 | } |
1943 | |||
1944 | pm_runtime_mark_last_busy(musb->controller); | ||
1945 | pm_runtime_put_autosuspend(musb->controller); | ||
1935 | } | 1946 | } |
1936 | 1947 | ||
1937 | static void musb_recover_from_babble(struct musb *musb) | 1948 | static void musb_recover_from_babble(struct musb *musb) |
@@ -2710,11 +2721,6 @@ static int musb_resume(struct device *dev) | |||
2710 | mask = MUSB_DEVCTL_BDEVICE | MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV; | 2721 | mask = MUSB_DEVCTL_BDEVICE | MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV; |
2711 | if ((devctl & mask) != (musb->context.devctl & mask)) | 2722 | if ((devctl & mask) != (musb->context.devctl & mask)) |
2712 | musb->port1_status = 0; | 2723 | musb->port1_status = 0; |
2713 | if (musb->need_finish_resume) { | ||
2714 | musb->need_finish_resume = 0; | ||
2715 | schedule_delayed_work(&musb->finish_resume_work, | ||
2716 | msecs_to_jiffies(USB_RESUME_TIMEOUT)); | ||
2717 | } | ||
2718 | 2724 | ||
2719 | /* | 2725 | /* |
2720 | * The USB HUB code expects the device to be in RPM_ACTIVE once it came | 2726 | * The USB HUB code expects the device to be in RPM_ACTIVE once it came |
@@ -2766,12 +2772,6 @@ static int musb_runtime_resume(struct device *dev) | |||
2766 | 2772 | ||
2767 | musb_restore_context(musb); | 2773 | musb_restore_context(musb); |
2768 | 2774 | ||
2769 | if (musb->need_finish_resume) { | ||
2770 | musb->need_finish_resume = 0; | ||
2771 | schedule_delayed_work(&musb->finish_resume_work, | ||
2772 | msecs_to_jiffies(USB_RESUME_TIMEOUT)); | ||
2773 | } | ||
2774 | |||
2775 | spin_lock_irqsave(&musb->lock, flags); | 2775 | spin_lock_irqsave(&musb->lock, flags); |
2776 | error = musb_run_resume_work(musb); | 2776 | error = musb_run_resume_work(musb); |
2777 | if (error) | 2777 | if (error) |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index ade902ea1221..ce5a18c98c6d 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -410,7 +410,6 @@ struct musb { | |||
410 | 410 | ||
411 | /* is_suspended means USB B_PERIPHERAL suspend */ | 411 | /* is_suspended means USB B_PERIPHERAL suspend */ |
412 | unsigned is_suspended:1; | 412 | unsigned is_suspended:1; |
413 | unsigned need_finish_resume :1; | ||
414 | 413 | ||
415 | /* may_wakeup means remote wakeup is enabled */ | 414 | /* may_wakeup means remote wakeup is enabled */ |
416 | unsigned may_wakeup:1; | 415 | unsigned may_wakeup:1; |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 7ce31a4c7e7f..42cc72e54c05 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -2007,6 +2007,7 @@ static const struct usb_device_id option_ids[] = { | |||
2007 | { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD200, 0xff, 0xff, 0xff) }, | 2007 | { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD200, 0xff, 0xff, 0xff) }, |
2008 | { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_6802, 0xff, 0xff, 0xff) }, | 2008 | { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_6802, 0xff, 0xff, 0xff) }, |
2009 | { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD300, 0xff, 0xff, 0xff) }, | 2009 | { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD300, 0xff, 0xff, 0xff) }, |
2010 | { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x421d, 0xff, 0xff, 0xff) }, /* HP lt2523 (Novatel E371) */ | ||
2010 | { } /* Terminating entry */ | 2011 | { } /* Terminating entry */ |
2011 | }; | 2012 | }; |
2012 | MODULE_DEVICE_TABLE(usb, option_ids); | 2013 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 46fca6b75846..1db4b61bdf7b 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -49,6 +49,7 @@ static const struct usb_device_id id_table[] = { | |||
49 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 49 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
50 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | 50 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
51 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | 51 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
52 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID2) }, | ||
52 | { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) }, | 53 | { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) }, |
53 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, | 54 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, |
54 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID_UCSGT) }, | 55 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID_UCSGT) }, |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index e3b7af8adfb7..09d9be88209e 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define ATEN_VENDOR_ID 0x0557 | 27 | #define ATEN_VENDOR_ID 0x0557 |
28 | #define ATEN_VENDOR_ID2 0x0547 | 28 | #define ATEN_VENDOR_ID2 0x0547 |
29 | #define ATEN_PRODUCT_ID 0x2008 | 29 | #define ATEN_PRODUCT_ID 0x2008 |
30 | #define ATEN_PRODUCT_ID2 0x2118 | ||
30 | 31 | ||
31 | #define IODATA_VENDOR_ID 0x04bb | 32 | #define IODATA_VENDOR_ID 0x04bb |
32 | #define IODATA_PRODUCT_ID 0x0a03 | 33 | #define IODATA_PRODUCT_ID 0x0a03 |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 1bc6089b9008..696458db7e3c 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -124,6 +124,7 @@ static const struct usb_device_id id_table[] = { | |||
124 | {USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */ | 124 | {USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */ |
125 | {USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */ | 125 | {USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */ |
126 | {USB_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */ | 126 | {USB_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */ |
127 | {USB_DEVICE(0x413c, 0x81a6)}, /* Dell DW5570 QDL (MC8805) */ | ||
127 | {USB_DEVICE(0x1199, 0x68a4)}, /* Sierra Wireless QDL */ | 128 | {USB_DEVICE(0x1199, 0x68a4)}, /* Sierra Wireless QDL */ |
128 | {USB_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */ | 129 | {USB_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */ |
129 | {USB_DEVICE(0x1199, 0x68a8)}, /* Sierra Wireless QDL */ | 130 | {USB_DEVICE(0x1199, 0x68a8)}, /* Sierra Wireless QDL */ |
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index 128d10282d16..7690e5bf3cf1 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c | |||
@@ -1123,12 +1123,11 @@ static long tce_iommu_ioctl(void *iommu_data, | |||
1123 | mutex_lock(&container->lock); | 1123 | mutex_lock(&container->lock); |
1124 | 1124 | ||
1125 | ret = tce_iommu_create_default_window(container); | 1125 | ret = tce_iommu_create_default_window(container); |
1126 | if (ret) | 1126 | if (!ret) |
1127 | return ret; | 1127 | ret = tce_iommu_create_window(container, |
1128 | 1128 | create.page_shift, | |
1129 | ret = tce_iommu_create_window(container, create.page_shift, | 1129 | create.window_size, create.levels, |
1130 | create.window_size, create.levels, | 1130 | &create.start_addr); |
1131 | &create.start_addr); | ||
1132 | 1131 | ||
1133 | mutex_unlock(&container->lock); | 1132 | mutex_unlock(&container->lock); |
1134 | 1133 | ||
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 9f118388a5b7..4269e621e254 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -130,14 +130,14 @@ static long vhost_get_vring_endian(struct vhost_virtqueue *vq, u32 idx, | |||
130 | 130 | ||
131 | static void vhost_init_is_le(struct vhost_virtqueue *vq) | 131 | static void vhost_init_is_le(struct vhost_virtqueue *vq) |
132 | { | 132 | { |
133 | if (vhost_has_feature(vq, VIRTIO_F_VERSION_1)) | 133 | vq->is_le = vhost_has_feature(vq, VIRTIO_F_VERSION_1) |
134 | vq->is_le = true; | 134 | || virtio_legacy_is_little_endian(); |
135 | } | 135 | } |
136 | #endif /* CONFIG_VHOST_CROSS_ENDIAN_LEGACY */ | 136 | #endif /* CONFIG_VHOST_CROSS_ENDIAN_LEGACY */ |
137 | 137 | ||
138 | static void vhost_reset_is_le(struct vhost_virtqueue *vq) | 138 | static void vhost_reset_is_le(struct vhost_virtqueue *vq) |
139 | { | 139 | { |
140 | vq->is_le = virtio_legacy_is_little_endian(); | 140 | vhost_init_is_le(vq); |
141 | } | 141 | } |
142 | 142 | ||
143 | struct vhost_flush_struct { | 143 | struct vhost_flush_struct { |
@@ -1714,10 +1714,8 @@ int vhost_vq_init_access(struct vhost_virtqueue *vq) | |||
1714 | int r; | 1714 | int r; |
1715 | bool is_le = vq->is_le; | 1715 | bool is_le = vq->is_le; |
1716 | 1716 | ||
1717 | if (!vq->private_data) { | 1717 | if (!vq->private_data) |
1718 | vhost_reset_is_le(vq); | ||
1719 | return 0; | 1718 | return 0; |
1720 | } | ||
1721 | 1719 | ||
1722 | vhost_init_is_le(vq); | 1720 | vhost_init_is_le(vq); |
1723 | 1721 | ||
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 7e38ed79c3fc..409aeaa49246 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -159,13 +159,6 @@ static bool vring_use_dma_api(struct virtio_device *vdev) | |||
159 | if (xen_domain()) | 159 | if (xen_domain()) |
160 | return true; | 160 | return true; |
161 | 161 | ||
162 | /* | ||
163 | * On ARM-based machines, the DMA ops will do the right thing, | ||
164 | * so always use them with legacy devices. | ||
165 | */ | ||
166 | if (IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_ARM64)) | ||
167 | return !virtio_has_feature(vdev, VIRTIO_F_VERSION_1); | ||
168 | |||
169 | return false; | 162 | return false; |
170 | } | 163 | } |
171 | 164 | ||
@@ -1031,6 +1031,11 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, | |||
1031 | struct blk_dax_ctl dax = { 0 }; | 1031 | struct blk_dax_ctl dax = { 0 }; |
1032 | ssize_t map_len; | 1032 | ssize_t map_len; |
1033 | 1033 | ||
1034 | if (fatal_signal_pending(current)) { | ||
1035 | ret = -EINTR; | ||
1036 | break; | ||
1037 | } | ||
1038 | |||
1034 | dax.sector = dax_iomap_sector(iomap, pos); | 1039 | dax.sector = dax_iomap_sector(iomap, pos); |
1035 | dax.size = (length + offset + PAGE_SIZE - 1) & PAGE_MASK; | 1040 | dax.size = (length + offset + PAGE_SIZE - 1) & PAGE_MASK; |
1036 | map_len = dax_map_atomic(iomap->bdev, &dax); | 1041 | map_len = dax_map_atomic(iomap->bdev, &dax); |
diff --git a/fs/iomap.c b/fs/iomap.c index 354a123f170e..a51cb4c07d4d 100644 --- a/fs/iomap.c +++ b/fs/iomap.c | |||
@@ -114,6 +114,9 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags, | |||
114 | 114 | ||
115 | BUG_ON(pos + len > iomap->offset + iomap->length); | 115 | BUG_ON(pos + len > iomap->offset + iomap->length); |
116 | 116 | ||
117 | if (fatal_signal_pending(current)) | ||
118 | return -EINTR; | ||
119 | |||
117 | page = grab_cache_page_write_begin(inode->i_mapping, index, flags); | 120 | page = grab_cache_page_write_begin(inode->i_mapping, index, flags); |
118 | if (!page) | 121 | if (!page) |
119 | return -ENOMEM; | 122 | return -ENOMEM; |
diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c index 596205d939a1..1fc07a9c70e9 100644 --- a/fs/nfsd/nfs4layouts.c +++ b/fs/nfsd/nfs4layouts.c | |||
@@ -223,10 +223,11 @@ nfsd4_alloc_layout_stateid(struct nfsd4_compound_state *cstate, | |||
223 | struct nfs4_layout_stateid *ls; | 223 | struct nfs4_layout_stateid *ls; |
224 | struct nfs4_stid *stp; | 224 | struct nfs4_stid *stp; |
225 | 225 | ||
226 | stp = nfs4_alloc_stid(cstate->clp, nfs4_layout_stateid_cache); | 226 | stp = nfs4_alloc_stid(cstate->clp, nfs4_layout_stateid_cache, |
227 | nfsd4_free_layout_stateid); | ||
227 | if (!stp) | 228 | if (!stp) |
228 | return NULL; | 229 | return NULL; |
229 | stp->sc_free = nfsd4_free_layout_stateid; | 230 | |
230 | get_nfs4_file(fp); | 231 | get_nfs4_file(fp); |
231 | stp->sc_file = fp; | 232 | stp->sc_file = fp; |
232 | 233 | ||
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 4b4beaaa4eaa..a0dee8ae9f97 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -633,8 +633,8 @@ out: | |||
633 | return co; | 633 | return co; |
634 | } | 634 | } |
635 | 635 | ||
636 | struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, | 636 | struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_cache *slab, |
637 | struct kmem_cache *slab) | 637 | void (*sc_free)(struct nfs4_stid *)) |
638 | { | 638 | { |
639 | struct nfs4_stid *stid; | 639 | struct nfs4_stid *stid; |
640 | int new_id; | 640 | int new_id; |
@@ -650,6 +650,8 @@ struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, | |||
650 | idr_preload_end(); | 650 | idr_preload_end(); |
651 | if (new_id < 0) | 651 | if (new_id < 0) |
652 | goto out_free; | 652 | goto out_free; |
653 | |||
654 | stid->sc_free = sc_free; | ||
653 | stid->sc_client = cl; | 655 | stid->sc_client = cl; |
654 | stid->sc_stateid.si_opaque.so_id = new_id; | 656 | stid->sc_stateid.si_opaque.so_id = new_id; |
655 | stid->sc_stateid.si_opaque.so_clid = cl->cl_clientid; | 657 | stid->sc_stateid.si_opaque.so_clid = cl->cl_clientid; |
@@ -675,15 +677,12 @@ out_free: | |||
675 | static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp) | 677 | static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp) |
676 | { | 678 | { |
677 | struct nfs4_stid *stid; | 679 | struct nfs4_stid *stid; |
678 | struct nfs4_ol_stateid *stp; | ||
679 | 680 | ||
680 | stid = nfs4_alloc_stid(clp, stateid_slab); | 681 | stid = nfs4_alloc_stid(clp, stateid_slab, nfs4_free_ol_stateid); |
681 | if (!stid) | 682 | if (!stid) |
682 | return NULL; | 683 | return NULL; |
683 | 684 | ||
684 | stp = openlockstateid(stid); | 685 | return openlockstateid(stid); |
685 | stp->st_stid.sc_free = nfs4_free_ol_stateid; | ||
686 | return stp; | ||
687 | } | 686 | } |
688 | 687 | ||
689 | static void nfs4_free_deleg(struct nfs4_stid *stid) | 688 | static void nfs4_free_deleg(struct nfs4_stid *stid) |
@@ -781,11 +780,10 @@ alloc_init_deleg(struct nfs4_client *clp, struct svc_fh *current_fh, | |||
781 | goto out_dec; | 780 | goto out_dec; |
782 | if (delegation_blocked(¤t_fh->fh_handle)) | 781 | if (delegation_blocked(¤t_fh->fh_handle)) |
783 | goto out_dec; | 782 | goto out_dec; |
784 | dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab)); | 783 | dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab, nfs4_free_deleg)); |
785 | if (dp == NULL) | 784 | if (dp == NULL) |
786 | goto out_dec; | 785 | goto out_dec; |
787 | 786 | ||
788 | dp->dl_stid.sc_free = nfs4_free_deleg; | ||
789 | /* | 787 | /* |
790 | * delegation seqid's are never incremented. The 4.1 special | 788 | * delegation seqid's are never incremented. The 4.1 special |
791 | * meaning of seqid 0 isn't meaningful, really, but let's avoid | 789 | * meaning of seqid 0 isn't meaningful, really, but let's avoid |
@@ -5580,7 +5578,6 @@ init_lock_stateid(struct nfs4_ol_stateid *stp, struct nfs4_lockowner *lo, | |||
5580 | stp->st_stateowner = nfs4_get_stateowner(&lo->lo_owner); | 5578 | stp->st_stateowner = nfs4_get_stateowner(&lo->lo_owner); |
5581 | get_nfs4_file(fp); | 5579 | get_nfs4_file(fp); |
5582 | stp->st_stid.sc_file = fp; | 5580 | stp->st_stid.sc_file = fp; |
5583 | stp->st_stid.sc_free = nfs4_free_lock_stateid; | ||
5584 | stp->st_access_bmap = 0; | 5581 | stp->st_access_bmap = 0; |
5585 | stp->st_deny_bmap = open_stp->st_deny_bmap; | 5582 | stp->st_deny_bmap = open_stp->st_deny_bmap; |
5586 | stp->st_openstp = open_stp; | 5583 | stp->st_openstp = open_stp; |
@@ -5623,7 +5620,7 @@ find_or_create_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fi, | |||
5623 | lst = find_lock_stateid(lo, fi); | 5620 | lst = find_lock_stateid(lo, fi); |
5624 | if (lst == NULL) { | 5621 | if (lst == NULL) { |
5625 | spin_unlock(&clp->cl_lock); | 5622 | spin_unlock(&clp->cl_lock); |
5626 | ns = nfs4_alloc_stid(clp, stateid_slab); | 5623 | ns = nfs4_alloc_stid(clp, stateid_slab, nfs4_free_lock_stateid); |
5627 | if (ns == NULL) | 5624 | if (ns == NULL) |
5628 | return NULL; | 5625 | return NULL; |
5629 | 5626 | ||
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index c9399366f9df..4516e8b7d776 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
@@ -603,8 +603,8 @@ extern __be32 nfs4_preprocess_stateid_op(struct svc_rqst *rqstp, | |||
603 | __be32 nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, | 603 | __be32 nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, |
604 | stateid_t *stateid, unsigned char typemask, | 604 | stateid_t *stateid, unsigned char typemask, |
605 | struct nfs4_stid **s, struct nfsd_net *nn); | 605 | struct nfs4_stid **s, struct nfsd_net *nn); |
606 | struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, | 606 | struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_cache *slab, |
607 | struct kmem_cache *slab); | 607 | void (*sc_free)(struct nfs4_stid *)); |
608 | void nfs4_unhash_stid(struct nfs4_stid *s); | 608 | void nfs4_unhash_stid(struct nfs4_stid *s); |
609 | void nfs4_put_stid(struct nfs4_stid *s); | 609 | void nfs4_put_stid(struct nfs4_stid *s); |
610 | void nfs4_inc_and_copy_stateid(stateid_t *dst, struct nfs4_stid *stid); | 610 | void nfs4_inc_and_copy_stateid(stateid_t *dst, struct nfs4_stid *stid); |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 26c6fdb4bf67..ca13236dbb1f 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -332,37 +332,6 @@ nfsd_sanitize_attrs(struct inode *inode, struct iattr *iap) | |||
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | static __be32 | ||
336 | nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp, | ||
337 | struct iattr *iap) | ||
338 | { | ||
339 | struct inode *inode = d_inode(fhp->fh_dentry); | ||
340 | int host_err; | ||
341 | |||
342 | if (iap->ia_size < inode->i_size) { | ||
343 | __be32 err; | ||
344 | |||
345 | err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry, | ||
346 | NFSD_MAY_TRUNC | NFSD_MAY_OWNER_OVERRIDE); | ||
347 | if (err) | ||
348 | return err; | ||
349 | } | ||
350 | |||
351 | host_err = get_write_access(inode); | ||
352 | if (host_err) | ||
353 | goto out_nfserrno; | ||
354 | |||
355 | host_err = locks_verify_truncate(inode, NULL, iap->ia_size); | ||
356 | if (host_err) | ||
357 | goto out_put_write_access; | ||
358 | return 0; | ||
359 | |||
360 | out_put_write_access: | ||
361 | put_write_access(inode); | ||
362 | out_nfserrno: | ||
363 | return nfserrno(host_err); | ||
364 | } | ||
365 | |||
366 | /* | 335 | /* |
367 | * Set various file attributes. After this call fhp needs an fh_put. | 336 | * Set various file attributes. After this call fhp needs an fh_put. |
368 | */ | 337 | */ |
@@ -377,7 +346,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
377 | __be32 err; | 346 | __be32 err; |
378 | int host_err; | 347 | int host_err; |
379 | bool get_write_count; | 348 | bool get_write_count; |
380 | int size_change = 0; | ||
381 | 349 | ||
382 | if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) | 350 | if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) |
383 | accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE; | 351 | accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE; |
@@ -390,11 +358,11 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
390 | /* Get inode */ | 358 | /* Get inode */ |
391 | err = fh_verify(rqstp, fhp, ftype, accmode); | 359 | err = fh_verify(rqstp, fhp, ftype, accmode); |
392 | if (err) | 360 | if (err) |
393 | goto out; | 361 | return err; |
394 | if (get_write_count) { | 362 | if (get_write_count) { |
395 | host_err = fh_want_write(fhp); | 363 | host_err = fh_want_write(fhp); |
396 | if (host_err) | 364 | if (host_err) |
397 | return nfserrno(host_err); | 365 | goto out_host_err; |
398 | } | 366 | } |
399 | 367 | ||
400 | dentry = fhp->fh_dentry; | 368 | dentry = fhp->fh_dentry; |
@@ -405,50 +373,59 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
405 | iap->ia_valid &= ~ATTR_MODE; | 373 | iap->ia_valid &= ~ATTR_MODE; |
406 | 374 | ||
407 | if (!iap->ia_valid) | 375 | if (!iap->ia_valid) |
408 | goto out; | 376 | return 0; |
409 | 377 | ||
410 | nfsd_sanitize_attrs(inode, iap); | 378 | nfsd_sanitize_attrs(inode, iap); |
411 | 379 | ||
380 | if (check_guard && guardtime != inode->i_ctime.tv_sec) | ||
381 | return nfserr_notsync; | ||
382 | |||
412 | /* | 383 | /* |
413 | * The size case is special, it changes the file in addition to the | 384 | * The size case is special, it changes the file in addition to the |
414 | * attributes. | 385 | * attributes, and file systems don't expect it to be mixed with |
386 | * "random" attribute changes. We thus split out the size change | ||
387 | * into a separate call for vfs_truncate, and do the rest as a | ||
388 | * a separate setattr call. | ||
415 | */ | 389 | */ |
416 | if (iap->ia_valid & ATTR_SIZE) { | 390 | if (iap->ia_valid & ATTR_SIZE) { |
417 | err = nfsd_get_write_access(rqstp, fhp, iap); | 391 | struct path path = { |
418 | if (err) | 392 | .mnt = fhp->fh_export->ex_path.mnt, |
419 | goto out; | 393 | .dentry = dentry, |
420 | size_change = 1; | 394 | }; |
395 | bool implicit_mtime = false; | ||
421 | 396 | ||
422 | /* | 397 | /* |
423 | * RFC5661, Section 18.30.4: | 398 | * vfs_truncate implicity updates the mtime IFF the file size |
424 | * Changing the size of a file with SETATTR indirectly | 399 | * actually changes. Avoid the additional seattr call below if |
425 | * changes the time_modify and change attributes. | 400 | * the only other attribute that the client sends is the mtime. |
426 | * | ||
427 | * (and similar for the older RFCs) | ||
428 | */ | 401 | */ |
429 | if (iap->ia_size != i_size_read(inode)) | 402 | if (iap->ia_size != i_size_read(inode) && |
430 | iap->ia_valid |= ATTR_MTIME; | 403 | ((iap->ia_valid & ~(ATTR_SIZE | ATTR_MTIME)) == 0)) |
431 | } | 404 | implicit_mtime = true; |
432 | 405 | ||
433 | iap->ia_valid |= ATTR_CTIME; | 406 | host_err = vfs_truncate(&path, iap->ia_size); |
407 | if (host_err) | ||
408 | goto out_host_err; | ||
434 | 409 | ||
435 | if (check_guard && guardtime != inode->i_ctime.tv_sec) { | 410 | iap->ia_valid &= ~ATTR_SIZE; |
436 | err = nfserr_notsync; | 411 | if (implicit_mtime) |
437 | goto out_put_write_access; | 412 | iap->ia_valid &= ~ATTR_MTIME; |
413 | if (!iap->ia_valid) | ||
414 | goto done; | ||
438 | } | 415 | } |
439 | 416 | ||
417 | iap->ia_valid |= ATTR_CTIME; | ||
418 | |||
440 | fh_lock(fhp); | 419 | fh_lock(fhp); |
441 | host_err = notify_change(dentry, iap, NULL); | 420 | host_err = notify_change(dentry, iap, NULL); |
442 | fh_unlock(fhp); | 421 | fh_unlock(fhp); |
443 | err = nfserrno(host_err); | 422 | if (host_err) |
423 | goto out_host_err; | ||
444 | 424 | ||
445 | out_put_write_access: | 425 | done: |
446 | if (size_change) | 426 | host_err = commit_metadata(fhp); |
447 | put_write_access(inode); | 427 | out_host_err: |
448 | if (!err) | 428 | return nfserrno(host_err); |
449 | err = nfserrno(commit_metadata(fhp)); | ||
450 | out: | ||
451 | return err; | ||
452 | } | 429 | } |
453 | 430 | ||
454 | #if defined(CONFIG_NFSD_V4) | 431 | #if defined(CONFIG_NFSD_V4) |
diff --git a/fs/proc/page.c b/fs/proc/page.c index a2066e6dee90..2726536489b1 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c | |||
@@ -173,7 +173,8 @@ u64 stable_page_flags(struct page *page) | |||
173 | u |= kpf_copy_bit(k, KPF_ACTIVE, PG_active); | 173 | u |= kpf_copy_bit(k, KPF_ACTIVE, PG_active); |
174 | u |= kpf_copy_bit(k, KPF_RECLAIM, PG_reclaim); | 174 | u |= kpf_copy_bit(k, KPF_RECLAIM, PG_reclaim); |
175 | 175 | ||
176 | u |= kpf_copy_bit(k, KPF_SWAPCACHE, PG_swapcache); | 176 | if (PageSwapCache(page)) |
177 | u |= 1 << KPF_SWAPCACHE; | ||
177 | u |= kpf_copy_bit(k, KPF_SWAPBACKED, PG_swapbacked); | 178 | u |= kpf_copy_bit(k, KPF_SWAPBACKED, PG_swapbacked); |
178 | 179 | ||
179 | u |= kpf_copy_bit(k, KPF_UNEVICTABLE, PG_unevictable); | 180 | u |= kpf_copy_bit(k, KPF_UNEVICTABLE, PG_unevictable); |
diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h index 63554e9f6e0c..719db1968d81 100644 --- a/include/asm-generic/export.h +++ b/include/asm-generic/export.h | |||
@@ -9,18 +9,15 @@ | |||
9 | #ifndef KSYM_ALIGN | 9 | #ifndef KSYM_ALIGN |
10 | #define KSYM_ALIGN 8 | 10 | #define KSYM_ALIGN 8 |
11 | #endif | 11 | #endif |
12 | #ifndef KCRC_ALIGN | ||
13 | #define KCRC_ALIGN 8 | ||
14 | #endif | ||
15 | #else | 12 | #else |
16 | #define __put .long | 13 | #define __put .long |
17 | #ifndef KSYM_ALIGN | 14 | #ifndef KSYM_ALIGN |
18 | #define KSYM_ALIGN 4 | 15 | #define KSYM_ALIGN 4 |
19 | #endif | 16 | #endif |
17 | #endif | ||
20 | #ifndef KCRC_ALIGN | 18 | #ifndef KCRC_ALIGN |
21 | #define KCRC_ALIGN 4 | 19 | #define KCRC_ALIGN 4 |
22 | #endif | 20 | #endif |
23 | #endif | ||
24 | 21 | ||
25 | #ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX | 22 | #ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX |
26 | #define KSYM(name) _##name | 23 | #define KSYM(name) _##name |
@@ -52,7 +49,11 @@ KSYM(__kstrtab_\name): | |||
52 | .section ___kcrctab\sec+\name,"a" | 49 | .section ___kcrctab\sec+\name,"a" |
53 | .balign KCRC_ALIGN | 50 | .balign KCRC_ALIGN |
54 | KSYM(__kcrctab_\name): | 51 | KSYM(__kcrctab_\name): |
55 | __put KSYM(__crc_\name) | 52 | #if defined(CONFIG_MODULE_REL_CRCS) |
53 | .long KSYM(__crc_\name) - . | ||
54 | #else | ||
55 | .long KSYM(__crc_\name) | ||
56 | #endif | ||
56 | .weak KSYM(__crc_\name) | 57 | .weak KSYM(__crc_\name) |
57 | .previous | 58 | .previous |
58 | #endif | 59 | #endif |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 192016e2b518..9c4ee144b5f6 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -517,6 +517,7 @@ struct drm_device { | |||
517 | struct drm_minor *control; /**< Control node */ | 517 | struct drm_minor *control; /**< Control node */ |
518 | struct drm_minor *primary; /**< Primary node */ | 518 | struct drm_minor *primary; /**< Primary node */ |
519 | struct drm_minor *render; /**< Render node */ | 519 | struct drm_minor *render; /**< Render node */ |
520 | bool registered; | ||
520 | 521 | ||
521 | /* currently active master for this device. Protected by master_mutex */ | 522 | /* currently active master for this device. Protected by master_mutex */ |
522 | struct drm_master *master; | 523 | struct drm_master *master; |
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index a9b95246e26e..045a97cbeba2 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h | |||
@@ -381,6 +381,8 @@ struct drm_connector_funcs { | |||
381 | * core drm connector interfaces. Everything added from this callback | 381 | * core drm connector interfaces. Everything added from this callback |
382 | * should be unregistered in the early_unregister callback. | 382 | * should be unregistered in the early_unregister callback. |
383 | * | 383 | * |
384 | * This is called while holding drm_connector->mutex. | ||
385 | * | ||
384 | * Returns: | 386 | * Returns: |
385 | * | 387 | * |
386 | * 0 on success, or a negative error code on failure. | 388 | * 0 on success, or a negative error code on failure. |
@@ -395,6 +397,8 @@ struct drm_connector_funcs { | |||
395 | * late_register(). It is called from drm_connector_unregister(), | 397 | * late_register(). It is called from drm_connector_unregister(), |
396 | * early in the driver unload sequence to disable userspace access | 398 | * early in the driver unload sequence to disable userspace access |
397 | * before data structures are torndown. | 399 | * before data structures are torndown. |
400 | * | ||
401 | * This is called while holding drm_connector->mutex. | ||
398 | */ | 402 | */ |
399 | void (*early_unregister)(struct drm_connector *connector); | 403 | void (*early_unregister)(struct drm_connector *connector); |
400 | 404 | ||
@@ -559,7 +563,6 @@ struct drm_cmdline_mode { | |||
559 | * @interlace_allowed: can this connector handle interlaced modes? | 563 | * @interlace_allowed: can this connector handle interlaced modes? |
560 | * @doublescan_allowed: can this connector handle doublescan? | 564 | * @doublescan_allowed: can this connector handle doublescan? |
561 | * @stereo_allowed: can this connector handle stereo modes? | 565 | * @stereo_allowed: can this connector handle stereo modes? |
562 | * @registered: is this connector exposed (registered) with userspace? | ||
563 | * @modes: modes available on this connector (from fill_modes() + user) | 566 | * @modes: modes available on this connector (from fill_modes() + user) |
564 | * @status: one of the drm_connector_status enums (connected, not, or unknown) | 567 | * @status: one of the drm_connector_status enums (connected, not, or unknown) |
565 | * @probed_modes: list of modes derived directly from the display | 568 | * @probed_modes: list of modes derived directly from the display |
@@ -608,6 +611,13 @@ struct drm_connector { | |||
608 | char *name; | 611 | char *name; |
609 | 612 | ||
610 | /** | 613 | /** |
614 | * @mutex: Lock for general connector state, but currently only protects | ||
615 | * @registered. Most of the connector state is still protected by the | ||
616 | * mutex in &drm_mode_config. | ||
617 | */ | ||
618 | struct mutex mutex; | ||
619 | |||
620 | /** | ||
611 | * @index: Compacted connector index, which matches the position inside | 621 | * @index: Compacted connector index, which matches the position inside |
612 | * the mode_config.list for drivers not supporting hot-add/removing. Can | 622 | * the mode_config.list for drivers not supporting hot-add/removing. Can |
613 | * be used as an array index. It is invariant over the lifetime of the | 623 | * be used as an array index. It is invariant over the lifetime of the |
@@ -620,6 +630,10 @@ struct drm_connector { | |||
620 | bool interlace_allowed; | 630 | bool interlace_allowed; |
621 | bool doublescan_allowed; | 631 | bool doublescan_allowed; |
622 | bool stereo_allowed; | 632 | bool stereo_allowed; |
633 | /** | ||
634 | * @registered: Is this connector exposed (registered) with userspace? | ||
635 | * Protected by @mutex. | ||
636 | */ | ||
623 | bool registered; | 637 | bool registered; |
624 | struct list_head modes; /* list of modes on this connector */ | 638 | struct list_head modes; /* list of modes on this connector */ |
625 | 639 | ||
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index d936a0021839..921acaaa1601 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
@@ -8,9 +8,7 @@ enum cpuhp_state { | |||
8 | CPUHP_CREATE_THREADS, | 8 | CPUHP_CREATE_THREADS, |
9 | CPUHP_PERF_PREPARE, | 9 | CPUHP_PERF_PREPARE, |
10 | CPUHP_PERF_X86_PREPARE, | 10 | CPUHP_PERF_X86_PREPARE, |
11 | CPUHP_PERF_X86_UNCORE_PREP, | ||
12 | CPUHP_PERF_X86_AMD_UNCORE_PREP, | 11 | CPUHP_PERF_X86_AMD_UNCORE_PREP, |
13 | CPUHP_PERF_X86_RAPL_PREP, | ||
14 | CPUHP_PERF_BFIN, | 12 | CPUHP_PERF_BFIN, |
15 | CPUHP_PERF_POWER, | 13 | CPUHP_PERF_POWER, |
16 | CPUHP_PERF_SUPERH, | 14 | CPUHP_PERF_SUPERH, |
@@ -86,7 +84,6 @@ enum cpuhp_state { | |||
86 | CPUHP_AP_IRQ_ARMADA_XP_STARTING, | 84 | CPUHP_AP_IRQ_ARMADA_XP_STARTING, |
87 | CPUHP_AP_IRQ_BCM2836_STARTING, | 85 | CPUHP_AP_IRQ_BCM2836_STARTING, |
88 | CPUHP_AP_ARM_MVEBU_COHERENCY, | 86 | CPUHP_AP_ARM_MVEBU_COHERENCY, |
89 | CPUHP_AP_PERF_X86_UNCORE_STARTING, | ||
90 | CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING, | 87 | CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING, |
91 | CPUHP_AP_PERF_X86_STARTING, | 88 | CPUHP_AP_PERF_X86_STARTING, |
92 | CPUHP_AP_PERF_X86_AMD_IBS_STARTING, | 89 | CPUHP_AP_PERF_X86_AMD_IBS_STARTING, |
diff --git a/include/linux/export.h b/include/linux/export.h index 2a0f61fbc731..1a1dfdb2a5c6 100644 --- a/include/linux/export.h +++ b/include/linux/export.h | |||
@@ -43,12 +43,19 @@ extern struct module __this_module; | |||
43 | #ifdef CONFIG_MODVERSIONS | 43 | #ifdef CONFIG_MODVERSIONS |
44 | /* Mark the CRC weak since genksyms apparently decides not to | 44 | /* Mark the CRC weak since genksyms apparently decides not to |
45 | * generate a checksums for some symbols */ | 45 | * generate a checksums for some symbols */ |
46 | #if defined(CONFIG_MODULE_REL_CRCS) | ||
46 | #define __CRC_SYMBOL(sym, sec) \ | 47 | #define __CRC_SYMBOL(sym, sec) \ |
47 | extern __visible void *__crc_##sym __attribute__((weak)); \ | 48 | asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \ |
48 | static const unsigned long __kcrctab_##sym \ | 49 | " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ |
49 | __used \ | 50 | " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " - . \n" \ |
50 | __attribute__((section("___kcrctab" sec "+" #sym), used)) \ | 51 | " .previous \n"); |
51 | = (unsigned long) &__crc_##sym; | 52 | #else |
53 | #define __CRC_SYMBOL(sym, sec) \ | ||
54 | asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \ | ||
55 | " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ | ||
56 | " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ | ||
57 | " .previous \n"); | ||
58 | #endif | ||
52 | #else | 59 | #else |
53 | #define __CRC_SYMBOL(sym, sec) | 60 | #define __CRC_SYMBOL(sym, sec) |
54 | #endif | 61 | #endif |
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 42fe43fb0c80..183efde54269 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h | |||
@@ -128,6 +128,7 @@ struct hv_ring_buffer_info { | |||
128 | u32 ring_data_startoffset; | 128 | u32 ring_data_startoffset; |
129 | u32 priv_write_index; | 129 | u32 priv_write_index; |
130 | u32 priv_read_index; | 130 | u32 priv_read_index; |
131 | u32 cached_read_index; | ||
131 | }; | 132 | }; |
132 | 133 | ||
133 | /* | 134 | /* |
@@ -180,6 +181,19 @@ static inline u32 hv_get_bytes_to_write(struct hv_ring_buffer_info *rbi) | |||
180 | return write; | 181 | return write; |
181 | } | 182 | } |
182 | 183 | ||
184 | static inline u32 hv_get_cached_bytes_to_write( | ||
185 | const struct hv_ring_buffer_info *rbi) | ||
186 | { | ||
187 | u32 read_loc, write_loc, dsize, write; | ||
188 | |||
189 | dsize = rbi->ring_datasize; | ||
190 | read_loc = rbi->cached_read_index; | ||
191 | write_loc = rbi->ring_buffer->write_index; | ||
192 | |||
193 | write = write_loc >= read_loc ? dsize - (write_loc - read_loc) : | ||
194 | read_loc - write_loc; | ||
195 | return write; | ||
196 | } | ||
183 | /* | 197 | /* |
184 | * VMBUS version is 32 bit entity broken up into | 198 | * VMBUS version is 32 bit entity broken up into |
185 | * two 16 bit quantities: major_number. minor_number. | 199 | * two 16 bit quantities: major_number. minor_number. |
@@ -1488,7 +1502,7 @@ hv_get_ring_buffer(struct hv_ring_buffer_info *ring_info) | |||
1488 | 1502 | ||
1489 | static inline void hv_signal_on_read(struct vmbus_channel *channel) | 1503 | static inline void hv_signal_on_read(struct vmbus_channel *channel) |
1490 | { | 1504 | { |
1491 | u32 cur_write_sz; | 1505 | u32 cur_write_sz, cached_write_sz; |
1492 | u32 pending_sz; | 1506 | u32 pending_sz; |
1493 | struct hv_ring_buffer_info *rbi = &channel->inbound; | 1507 | struct hv_ring_buffer_info *rbi = &channel->inbound; |
1494 | 1508 | ||
@@ -1512,12 +1526,24 @@ static inline void hv_signal_on_read(struct vmbus_channel *channel) | |||
1512 | 1526 | ||
1513 | cur_write_sz = hv_get_bytes_to_write(rbi); | 1527 | cur_write_sz = hv_get_bytes_to_write(rbi); |
1514 | 1528 | ||
1515 | if (cur_write_sz >= pending_sz) | 1529 | if (cur_write_sz < pending_sz) |
1530 | return; | ||
1531 | |||
1532 | cached_write_sz = hv_get_cached_bytes_to_write(rbi); | ||
1533 | if (cached_write_sz < pending_sz) | ||
1516 | vmbus_setevent(channel); | 1534 | vmbus_setevent(channel); |
1517 | 1535 | ||
1518 | return; | 1536 | return; |
1519 | } | 1537 | } |
1520 | 1538 | ||
1539 | static inline void | ||
1540 | init_cached_read_index(struct vmbus_channel *channel) | ||
1541 | { | ||
1542 | struct hv_ring_buffer_info *rbi = &channel->inbound; | ||
1543 | |||
1544 | rbi->cached_read_index = rbi->ring_buffer->read_index; | ||
1545 | } | ||
1546 | |||
1521 | /* | 1547 | /* |
1522 | * An API to support in-place processing of incoming VMBUS packets. | 1548 | * An API to support in-place processing of incoming VMBUS packets. |
1523 | */ | 1549 | */ |
@@ -1569,6 +1595,8 @@ static inline void put_pkt_raw(struct vmbus_channel *channel, | |||
1569 | * This call commits the read index and potentially signals the host. | 1595 | * This call commits the read index and potentially signals the host. |
1570 | * Here is the pattern for using the "in-place" consumption APIs: | 1596 | * Here is the pattern for using the "in-place" consumption APIs: |
1571 | * | 1597 | * |
1598 | * init_cached_read_index(); | ||
1599 | * | ||
1572 | * while (get_next_pkt_raw() { | 1600 | * while (get_next_pkt_raw() { |
1573 | * process the packet "in-place"; | 1601 | * process the packet "in-place"; |
1574 | * put_pkt_raw(); | 1602 | * put_pkt_raw(); |
diff --git a/include/linux/irq.h b/include/linux/irq.h index e79875574b39..39e3254e5769 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -184,6 +184,7 @@ struct irq_data { | |||
184 | * | 184 | * |
185 | * IRQD_TRIGGER_MASK - Mask for the trigger type bits | 185 | * IRQD_TRIGGER_MASK - Mask for the trigger type bits |
186 | * IRQD_SETAFFINITY_PENDING - Affinity setting is pending | 186 | * IRQD_SETAFFINITY_PENDING - Affinity setting is pending |
187 | * IRQD_ACTIVATED - Interrupt has already been activated | ||
187 | * IRQD_NO_BALANCING - Balancing disabled for this IRQ | 188 | * IRQD_NO_BALANCING - Balancing disabled for this IRQ |
188 | * IRQD_PER_CPU - Interrupt is per cpu | 189 | * IRQD_PER_CPU - Interrupt is per cpu |
189 | * IRQD_AFFINITY_SET - Interrupt affinity was set | 190 | * IRQD_AFFINITY_SET - Interrupt affinity was set |
@@ -202,6 +203,7 @@ struct irq_data { | |||
202 | enum { | 203 | enum { |
203 | IRQD_TRIGGER_MASK = 0xf, | 204 | IRQD_TRIGGER_MASK = 0xf, |
204 | IRQD_SETAFFINITY_PENDING = (1 << 8), | 205 | IRQD_SETAFFINITY_PENDING = (1 << 8), |
206 | IRQD_ACTIVATED = (1 << 9), | ||
205 | IRQD_NO_BALANCING = (1 << 10), | 207 | IRQD_NO_BALANCING = (1 << 10), |
206 | IRQD_PER_CPU = (1 << 11), | 208 | IRQD_PER_CPU = (1 << 11), |
207 | IRQD_AFFINITY_SET = (1 << 12), | 209 | IRQD_AFFINITY_SET = (1 << 12), |
@@ -312,6 +314,21 @@ static inline bool irqd_affinity_is_managed(struct irq_data *d) | |||
312 | return __irqd_to_state(d) & IRQD_AFFINITY_MANAGED; | 314 | return __irqd_to_state(d) & IRQD_AFFINITY_MANAGED; |
313 | } | 315 | } |
314 | 316 | ||
317 | static inline bool irqd_is_activated(struct irq_data *d) | ||
318 | { | ||
319 | return __irqd_to_state(d) & IRQD_ACTIVATED; | ||
320 | } | ||
321 | |||
322 | static inline void irqd_set_activated(struct irq_data *d) | ||
323 | { | ||
324 | __irqd_to_state(d) |= IRQD_ACTIVATED; | ||
325 | } | ||
326 | |||
327 | static inline void irqd_clr_activated(struct irq_data *d) | ||
328 | { | ||
329 | __irqd_to_state(d) &= ~IRQD_ACTIVATED; | ||
330 | } | ||
331 | |||
315 | #undef __irqd_to_state | 332 | #undef __irqd_to_state |
316 | 333 | ||
317 | static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) | 334 | static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) |
diff --git a/include/linux/log2.h b/include/linux/log2.h index fd7ff3d91e6a..ef3d4f67118c 100644 --- a/include/linux/log2.h +++ b/include/linux/log2.h | |||
@@ -203,6 +203,17 @@ unsigned long __rounddown_pow_of_two(unsigned long n) | |||
203 | * ... and so on. | 203 | * ... and so on. |
204 | */ | 204 | */ |
205 | 205 | ||
206 | #define order_base_2(n) ilog2(roundup_pow_of_two(n)) | 206 | static inline __attribute_const__ |
207 | int __order_base_2(unsigned long n) | ||
208 | { | ||
209 | return n > 1 ? ilog2(n - 1) + 1 : 0; | ||
210 | } | ||
207 | 211 | ||
212 | #define order_base_2(n) \ | ||
213 | ( \ | ||
214 | __builtin_constant_p(n) ? ( \ | ||
215 | ((n) == 0 || (n) == 1) ? 0 : \ | ||
216 | ilog2((n) - 1) + 1) : \ | ||
217 | __order_base_2(n) \ | ||
218 | ) | ||
208 | #endif /* _LINUX_LOG2_H */ | 219 | #endif /* _LINUX_LOG2_H */ |
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index c1784c0b4f35..134a2f69c21a 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h | |||
@@ -85,7 +85,8 @@ extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); | |||
85 | extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); | 85 | extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); |
86 | /* VM interface that may be used by firmware interface */ | 86 | /* VM interface that may be used by firmware interface */ |
87 | extern int online_pages(unsigned long, unsigned long, int); | 87 | extern int online_pages(unsigned long, unsigned long, int); |
88 | extern int test_pages_in_a_zone(unsigned long, unsigned long); | 88 | extern int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, |
89 | unsigned long *valid_start, unsigned long *valid_end); | ||
89 | extern void __offline_isolated_pages(unsigned long, unsigned long); | 90 | extern void __offline_isolated_pages(unsigned long, unsigned long); |
90 | 91 | ||
91 | typedef void (*online_page_callback_t)(struct page *page); | 92 | typedef void (*online_page_callback_t)(struct page *page); |
diff --git a/include/linux/module.h b/include/linux/module.h index 7c84273d60b9..cc7cba219b20 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -346,7 +346,7 @@ struct module { | |||
346 | 346 | ||
347 | /* Exported symbols */ | 347 | /* Exported symbols */ |
348 | const struct kernel_symbol *syms; | 348 | const struct kernel_symbol *syms; |
349 | const unsigned long *crcs; | 349 | const s32 *crcs; |
350 | unsigned int num_syms; | 350 | unsigned int num_syms; |
351 | 351 | ||
352 | /* Kernel parameters. */ | 352 | /* Kernel parameters. */ |
@@ -359,18 +359,18 @@ struct module { | |||
359 | /* GPL-only exported symbols. */ | 359 | /* GPL-only exported symbols. */ |
360 | unsigned int num_gpl_syms; | 360 | unsigned int num_gpl_syms; |
361 | const struct kernel_symbol *gpl_syms; | 361 | const struct kernel_symbol *gpl_syms; |
362 | const unsigned long *gpl_crcs; | 362 | const s32 *gpl_crcs; |
363 | 363 | ||
364 | #ifdef CONFIG_UNUSED_SYMBOLS | 364 | #ifdef CONFIG_UNUSED_SYMBOLS |
365 | /* unused exported symbols. */ | 365 | /* unused exported symbols. */ |
366 | const struct kernel_symbol *unused_syms; | 366 | const struct kernel_symbol *unused_syms; |
367 | const unsigned long *unused_crcs; | 367 | const s32 *unused_crcs; |
368 | unsigned int num_unused_syms; | 368 | unsigned int num_unused_syms; |
369 | 369 | ||
370 | /* GPL-only, unused exported symbols. */ | 370 | /* GPL-only, unused exported symbols. */ |
371 | unsigned int num_unused_gpl_syms; | 371 | unsigned int num_unused_gpl_syms; |
372 | const struct kernel_symbol *unused_gpl_syms; | 372 | const struct kernel_symbol *unused_gpl_syms; |
373 | const unsigned long *unused_gpl_crcs; | 373 | const s32 *unused_gpl_crcs; |
374 | #endif | 374 | #endif |
375 | 375 | ||
376 | #ifdef CONFIG_MODULE_SIG | 376 | #ifdef CONFIG_MODULE_SIG |
@@ -382,7 +382,7 @@ struct module { | |||
382 | 382 | ||
383 | /* symbols that will be GPL-only in the near future. */ | 383 | /* symbols that will be GPL-only in the near future. */ |
384 | const struct kernel_symbol *gpl_future_syms; | 384 | const struct kernel_symbol *gpl_future_syms; |
385 | const unsigned long *gpl_future_crcs; | 385 | const s32 *gpl_future_crcs; |
386 | unsigned int num_gpl_future_syms; | 386 | unsigned int num_gpl_future_syms; |
387 | 387 | ||
388 | /* Exception table */ | 388 | /* Exception table */ |
@@ -523,7 +523,7 @@ struct module *find_module(const char *name); | |||
523 | 523 | ||
524 | struct symsearch { | 524 | struct symsearch { |
525 | const struct kernel_symbol *start, *stop; | 525 | const struct kernel_symbol *start, *stop; |
526 | const unsigned long *crcs; | 526 | const s32 *crcs; |
527 | enum { | 527 | enum { |
528 | NOT_GPL_ONLY, | 528 | NOT_GPL_ONLY, |
529 | GPL_ONLY, | 529 | GPL_ONLY, |
@@ -539,7 +539,7 @@ struct symsearch { | |||
539 | */ | 539 | */ |
540 | const struct kernel_symbol *find_symbol(const char *name, | 540 | const struct kernel_symbol *find_symbol(const char *name, |
541 | struct module **owner, | 541 | struct module **owner, |
542 | const unsigned long **crc, | 542 | const s32 **crc, |
543 | bool gplok, | 543 | bool gplok, |
544 | bool warn); | 544 | bool warn); |
545 | 545 | ||
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h index 3ebb168b9afc..a34b141f125f 100644 --- a/include/net/cipso_ipv4.h +++ b/include/net/cipso_ipv4.h | |||
@@ -309,6 +309,10 @@ static inline int cipso_v4_validate(const struct sk_buff *skb, | |||
309 | } | 309 | } |
310 | 310 | ||
311 | for (opt_iter = 6; opt_iter < opt_len;) { | 311 | for (opt_iter = 6; opt_iter < opt_len;) { |
312 | if (opt_iter + 1 == opt_len) { | ||
313 | err_offset = opt_iter; | ||
314 | goto out; | ||
315 | } | ||
312 | tag_len = opt[opt_iter + 1]; | 316 | tag_len = opt[opt_iter + 1]; |
313 | if ((tag_len == 0) || (tag_len > (opt_len - opt_iter))) { | 317 | if ((tag_len == 0) || (tag_len > (opt_len - opt_iter))) { |
314 | err_offset = opt_iter + 1; | 318 | err_offset = opt_iter + 1; |
diff --git a/include/net/sock.h b/include/net/sock.h index 6f83e78eaa5a..9ccefa5c5487 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -2035,7 +2035,9 @@ void sk_reset_timer(struct sock *sk, struct timer_list *timer, | |||
2035 | void sk_stop_timer(struct sock *sk, struct timer_list *timer); | 2035 | void sk_stop_timer(struct sock *sk, struct timer_list *timer); |
2036 | 2036 | ||
2037 | int __sk_queue_drop_skb(struct sock *sk, struct sk_buff *skb, | 2037 | int __sk_queue_drop_skb(struct sock *sk, struct sk_buff *skb, |
2038 | unsigned int flags); | 2038 | unsigned int flags, |
2039 | void (*destructor)(struct sock *sk, | ||
2040 | struct sk_buff *skb)); | ||
2039 | int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); | 2041 | int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); |
2040 | int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); | 2042 | int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); |
2041 | 2043 | ||
diff --git a/include/uapi/linux/seg6.h b/include/uapi/linux/seg6.h index 33496595064c..61df8d392f41 100644 --- a/include/uapi/linux/seg6.h +++ b/include/uapi/linux/seg6.h | |||
@@ -25,14 +25,12 @@ struct ipv6_sr_hdr { | |||
25 | __u8 type; | 25 | __u8 type; |
26 | __u8 segments_left; | 26 | __u8 segments_left; |
27 | __u8 first_segment; | 27 | __u8 first_segment; |
28 | __u8 flag_1; | 28 | __u8 flags; |
29 | __u8 flag_2; | 29 | __u16 reserved; |
30 | __u8 reserved; | ||
31 | 30 | ||
32 | struct in6_addr segments[0]; | 31 | struct in6_addr segments[0]; |
33 | }; | 32 | }; |
34 | 33 | ||
35 | #define SR6_FLAG1_CLEANUP (1 << 7) | ||
36 | #define SR6_FLAG1_PROTECTED (1 << 6) | 34 | #define SR6_FLAG1_PROTECTED (1 << 6) |
37 | #define SR6_FLAG1_OAM (1 << 5) | 35 | #define SR6_FLAG1_OAM (1 << 5) |
38 | #define SR6_FLAG1_ALERT (1 << 4) | 36 | #define SR6_FLAG1_ALERT (1 << 4) |
@@ -44,8 +42,7 @@ struct ipv6_sr_hdr { | |||
44 | #define SR6_TLV_PADDING 4 | 42 | #define SR6_TLV_PADDING 4 |
45 | #define SR6_TLV_HMAC 5 | 43 | #define SR6_TLV_HMAC 5 |
46 | 44 | ||
47 | #define sr_has_cleanup(srh) ((srh)->flag_1 & SR6_FLAG1_CLEANUP) | 45 | #define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC) |
48 | #define sr_has_hmac(srh) ((srh)->flag_1 & SR6_FLAG1_HMAC) | ||
49 | 46 | ||
50 | struct sr6_tlv { | 47 | struct sr6_tlv { |
51 | __u8 type; | 48 | __u8 type; |
diff --git a/init/Kconfig b/init/Kconfig index e1a937348a3e..4dd8bd232a1d 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -1987,6 +1987,10 @@ config MODVERSIONS | |||
1987 | make them incompatible with the kernel you are running. If | 1987 | make them incompatible with the kernel you are running. If |
1988 | unsure, say N. | 1988 | unsure, say N. |
1989 | 1989 | ||
1990 | config MODULE_REL_CRCS | ||
1991 | bool | ||
1992 | depends on MODVERSIONS | ||
1993 | |||
1990 | config MODULE_SRCVERSION_ALL | 1994 | config MODULE_SRCVERSION_ALL |
1991 | bool "Source checksum for all modules" | 1995 | bool "Source checksum for all modules" |
1992 | help | 1996 | help |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 110b38a58493..e5aaa806702d 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -1469,7 +1469,6 @@ ctx_group_list(struct perf_event *event, struct perf_event_context *ctx) | |||
1469 | static void | 1469 | static void |
1470 | list_add_event(struct perf_event *event, struct perf_event_context *ctx) | 1470 | list_add_event(struct perf_event *event, struct perf_event_context *ctx) |
1471 | { | 1471 | { |
1472 | |||
1473 | lockdep_assert_held(&ctx->lock); | 1472 | lockdep_assert_held(&ctx->lock); |
1474 | 1473 | ||
1475 | WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT); | 1474 | WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT); |
@@ -1624,6 +1623,8 @@ static void perf_group_attach(struct perf_event *event) | |||
1624 | { | 1623 | { |
1625 | struct perf_event *group_leader = event->group_leader, *pos; | 1624 | struct perf_event *group_leader = event->group_leader, *pos; |
1626 | 1625 | ||
1626 | lockdep_assert_held(&event->ctx->lock); | ||
1627 | |||
1627 | /* | 1628 | /* |
1628 | * We can have double attach due to group movement in perf_event_open. | 1629 | * We can have double attach due to group movement in perf_event_open. |
1629 | */ | 1630 | */ |
@@ -1697,6 +1698,8 @@ static void perf_group_detach(struct perf_event *event) | |||
1697 | struct perf_event *sibling, *tmp; | 1698 | struct perf_event *sibling, *tmp; |
1698 | struct list_head *list = NULL; | 1699 | struct list_head *list = NULL; |
1699 | 1700 | ||
1701 | lockdep_assert_held(&event->ctx->lock); | ||
1702 | |||
1700 | /* | 1703 | /* |
1701 | * We can have double detach due to exit/hot-unplug + close. | 1704 | * We can have double detach due to exit/hot-unplug + close. |
1702 | */ | 1705 | */ |
@@ -1895,9 +1898,29 @@ __perf_remove_from_context(struct perf_event *event, | |||
1895 | */ | 1898 | */ |
1896 | static void perf_remove_from_context(struct perf_event *event, unsigned long flags) | 1899 | static void perf_remove_from_context(struct perf_event *event, unsigned long flags) |
1897 | { | 1900 | { |
1898 | lockdep_assert_held(&event->ctx->mutex); | 1901 | struct perf_event_context *ctx = event->ctx; |
1902 | |||
1903 | lockdep_assert_held(&ctx->mutex); | ||
1899 | 1904 | ||
1900 | event_function_call(event, __perf_remove_from_context, (void *)flags); | 1905 | event_function_call(event, __perf_remove_from_context, (void *)flags); |
1906 | |||
1907 | /* | ||
1908 | * The above event_function_call() can NO-OP when it hits | ||
1909 | * TASK_TOMBSTONE. In that case we must already have been detached | ||
1910 | * from the context (by perf_event_exit_event()) but the grouping | ||
1911 | * might still be in-tact. | ||
1912 | */ | ||
1913 | WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT); | ||
1914 | if ((flags & DETACH_GROUP) && | ||
1915 | (event->attach_state & PERF_ATTACH_GROUP)) { | ||
1916 | /* | ||
1917 | * Since in that case we cannot possibly be scheduled, simply | ||
1918 | * detach now. | ||
1919 | */ | ||
1920 | raw_spin_lock_irq(&ctx->lock); | ||
1921 | perf_group_detach(event); | ||
1922 | raw_spin_unlock_irq(&ctx->lock); | ||
1923 | } | ||
1901 | } | 1924 | } |
1902 | 1925 | ||
1903 | /* | 1926 | /* |
@@ -6609,6 +6632,27 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) | |||
6609 | char *buf = NULL; | 6632 | char *buf = NULL; |
6610 | char *name; | 6633 | char *name; |
6611 | 6634 | ||
6635 | if (vma->vm_flags & VM_READ) | ||
6636 | prot |= PROT_READ; | ||
6637 | if (vma->vm_flags & VM_WRITE) | ||
6638 | prot |= PROT_WRITE; | ||
6639 | if (vma->vm_flags & VM_EXEC) | ||
6640 | prot |= PROT_EXEC; | ||
6641 | |||
6642 | if (vma->vm_flags & VM_MAYSHARE) | ||
6643 | flags = MAP_SHARED; | ||
6644 | else | ||
6645 | flags = MAP_PRIVATE; | ||
6646 | |||
6647 | if (vma->vm_flags & VM_DENYWRITE) | ||
6648 | flags |= MAP_DENYWRITE; | ||
6649 | if (vma->vm_flags & VM_MAYEXEC) | ||
6650 | flags |= MAP_EXECUTABLE; | ||
6651 | if (vma->vm_flags & VM_LOCKED) | ||
6652 | flags |= MAP_LOCKED; | ||
6653 | if (vma->vm_flags & VM_HUGETLB) | ||
6654 | flags |= MAP_HUGETLB; | ||
6655 | |||
6612 | if (file) { | 6656 | if (file) { |
6613 | struct inode *inode; | 6657 | struct inode *inode; |
6614 | dev_t dev; | 6658 | dev_t dev; |
@@ -6635,27 +6679,6 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) | |||
6635 | maj = MAJOR(dev); | 6679 | maj = MAJOR(dev); |
6636 | min = MINOR(dev); | 6680 | min = MINOR(dev); |
6637 | 6681 | ||
6638 | if (vma->vm_flags & VM_READ) | ||
6639 | prot |= PROT_READ; | ||
6640 | if (vma->vm_flags & VM_WRITE) | ||
6641 | prot |= PROT_WRITE; | ||
6642 | if (vma->vm_flags & VM_EXEC) | ||
6643 | prot |= PROT_EXEC; | ||
6644 | |||
6645 | if (vma->vm_flags & VM_MAYSHARE) | ||
6646 | flags = MAP_SHARED; | ||
6647 | else | ||
6648 | flags = MAP_PRIVATE; | ||
6649 | |||
6650 | if (vma->vm_flags & VM_DENYWRITE) | ||
6651 | flags |= MAP_DENYWRITE; | ||
6652 | if (vma->vm_flags & VM_MAYEXEC) | ||
6653 | flags |= MAP_EXECUTABLE; | ||
6654 | if (vma->vm_flags & VM_LOCKED) | ||
6655 | flags |= MAP_LOCKED; | ||
6656 | if (vma->vm_flags & VM_HUGETLB) | ||
6657 | flags |= MAP_HUGETLB; | ||
6658 | |||
6659 | goto got_name; | 6682 | goto got_name; |
6660 | } else { | 6683 | } else { |
6661 | if (vma->vm_ops && vma->vm_ops->name) { | 6684 | if (vma->vm_ops && vma->vm_ops->name) { |
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 8c0a0ae43521..b59e6768c5e9 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c | |||
@@ -1346,6 +1346,30 @@ void irq_domain_free_irqs_parent(struct irq_domain *domain, | |||
1346 | } | 1346 | } |
1347 | EXPORT_SYMBOL_GPL(irq_domain_free_irqs_parent); | 1347 | EXPORT_SYMBOL_GPL(irq_domain_free_irqs_parent); |
1348 | 1348 | ||
1349 | static void __irq_domain_activate_irq(struct irq_data *irq_data) | ||
1350 | { | ||
1351 | if (irq_data && irq_data->domain) { | ||
1352 | struct irq_domain *domain = irq_data->domain; | ||
1353 | |||
1354 | if (irq_data->parent_data) | ||
1355 | __irq_domain_activate_irq(irq_data->parent_data); | ||
1356 | if (domain->ops->activate) | ||
1357 | domain->ops->activate(domain, irq_data); | ||
1358 | } | ||
1359 | } | ||
1360 | |||
1361 | static void __irq_domain_deactivate_irq(struct irq_data *irq_data) | ||
1362 | { | ||
1363 | if (irq_data && irq_data->domain) { | ||
1364 | struct irq_domain *domain = irq_data->domain; | ||
1365 | |||
1366 | if (domain->ops->deactivate) | ||
1367 | domain->ops->deactivate(domain, irq_data); | ||
1368 | if (irq_data->parent_data) | ||
1369 | __irq_domain_deactivate_irq(irq_data->parent_data); | ||
1370 | } | ||
1371 | } | ||
1372 | |||
1349 | /** | 1373 | /** |
1350 | * irq_domain_activate_irq - Call domain_ops->activate recursively to activate | 1374 | * irq_domain_activate_irq - Call domain_ops->activate recursively to activate |
1351 | * interrupt | 1375 | * interrupt |
@@ -1356,13 +1380,9 @@ EXPORT_SYMBOL_GPL(irq_domain_free_irqs_parent); | |||
1356 | */ | 1380 | */ |
1357 | void irq_domain_activate_irq(struct irq_data *irq_data) | 1381 | void irq_domain_activate_irq(struct irq_data *irq_data) |
1358 | { | 1382 | { |
1359 | if (irq_data && irq_data->domain) { | 1383 | if (!irqd_is_activated(irq_data)) { |
1360 | struct irq_domain *domain = irq_data->domain; | 1384 | __irq_domain_activate_irq(irq_data); |
1361 | 1385 | irqd_set_activated(irq_data); | |
1362 | if (irq_data->parent_data) | ||
1363 | irq_domain_activate_irq(irq_data->parent_data); | ||
1364 | if (domain->ops->activate) | ||
1365 | domain->ops->activate(domain, irq_data); | ||
1366 | } | 1386 | } |
1367 | } | 1387 | } |
1368 | 1388 | ||
@@ -1376,13 +1396,9 @@ void irq_domain_activate_irq(struct irq_data *irq_data) | |||
1376 | */ | 1396 | */ |
1377 | void irq_domain_deactivate_irq(struct irq_data *irq_data) | 1397 | void irq_domain_deactivate_irq(struct irq_data *irq_data) |
1378 | { | 1398 | { |
1379 | if (irq_data && irq_data->domain) { | 1399 | if (irqd_is_activated(irq_data)) { |
1380 | struct irq_domain *domain = irq_data->domain; | 1400 | __irq_domain_deactivate_irq(irq_data); |
1381 | 1401 | irqd_clr_activated(irq_data); | |
1382 | if (domain->ops->deactivate) | ||
1383 | domain->ops->deactivate(domain, irq_data); | ||
1384 | if (irq_data->parent_data) | ||
1385 | irq_domain_deactivate_irq(irq_data->parent_data); | ||
1386 | } | 1402 | } |
1387 | } | 1403 | } |
1388 | 1404 | ||
diff --git a/kernel/module.c b/kernel/module.c index 38d4270925d4..3d8f126208e3 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -389,16 +389,16 @@ extern const struct kernel_symbol __start___ksymtab_gpl[]; | |||
389 | extern const struct kernel_symbol __stop___ksymtab_gpl[]; | 389 | extern const struct kernel_symbol __stop___ksymtab_gpl[]; |
390 | extern const struct kernel_symbol __start___ksymtab_gpl_future[]; | 390 | extern const struct kernel_symbol __start___ksymtab_gpl_future[]; |
391 | extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; | 391 | extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; |
392 | extern const unsigned long __start___kcrctab[]; | 392 | extern const s32 __start___kcrctab[]; |
393 | extern const unsigned long __start___kcrctab_gpl[]; | 393 | extern const s32 __start___kcrctab_gpl[]; |
394 | extern const unsigned long __start___kcrctab_gpl_future[]; | 394 | extern const s32 __start___kcrctab_gpl_future[]; |
395 | #ifdef CONFIG_UNUSED_SYMBOLS | 395 | #ifdef CONFIG_UNUSED_SYMBOLS |
396 | extern const struct kernel_symbol __start___ksymtab_unused[]; | 396 | extern const struct kernel_symbol __start___ksymtab_unused[]; |
397 | extern const struct kernel_symbol __stop___ksymtab_unused[]; | 397 | extern const struct kernel_symbol __stop___ksymtab_unused[]; |
398 | extern const struct kernel_symbol __start___ksymtab_unused_gpl[]; | 398 | extern const struct kernel_symbol __start___ksymtab_unused_gpl[]; |
399 | extern const struct kernel_symbol __stop___ksymtab_unused_gpl[]; | 399 | extern const struct kernel_symbol __stop___ksymtab_unused_gpl[]; |
400 | extern const unsigned long __start___kcrctab_unused[]; | 400 | extern const s32 __start___kcrctab_unused[]; |
401 | extern const unsigned long __start___kcrctab_unused_gpl[]; | 401 | extern const s32 __start___kcrctab_unused_gpl[]; |
402 | #endif | 402 | #endif |
403 | 403 | ||
404 | #ifndef CONFIG_MODVERSIONS | 404 | #ifndef CONFIG_MODVERSIONS |
@@ -497,7 +497,7 @@ struct find_symbol_arg { | |||
497 | 497 | ||
498 | /* Output */ | 498 | /* Output */ |
499 | struct module *owner; | 499 | struct module *owner; |
500 | const unsigned long *crc; | 500 | const s32 *crc; |
501 | const struct kernel_symbol *sym; | 501 | const struct kernel_symbol *sym; |
502 | }; | 502 | }; |
503 | 503 | ||
@@ -563,7 +563,7 @@ static bool find_symbol_in_section(const struct symsearch *syms, | |||
563 | * (optional) module which owns it. Needs preempt disabled or module_mutex. */ | 563 | * (optional) module which owns it. Needs preempt disabled or module_mutex. */ |
564 | const struct kernel_symbol *find_symbol(const char *name, | 564 | const struct kernel_symbol *find_symbol(const char *name, |
565 | struct module **owner, | 565 | struct module **owner, |
566 | const unsigned long **crc, | 566 | const s32 **crc, |
567 | bool gplok, | 567 | bool gplok, |
568 | bool warn) | 568 | bool warn) |
569 | { | 569 | { |
@@ -1249,23 +1249,17 @@ static int try_to_force_load(struct module *mod, const char *reason) | |||
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | #ifdef CONFIG_MODVERSIONS | 1251 | #ifdef CONFIG_MODVERSIONS |
1252 | /* If the arch applies (non-zero) relocations to kernel kcrctab, unapply it. */ | 1252 | |
1253 | static unsigned long maybe_relocated(unsigned long crc, | 1253 | static u32 resolve_rel_crc(const s32 *crc) |
1254 | const struct module *crc_owner) | ||
1255 | { | 1254 | { |
1256 | #ifdef ARCH_RELOCATES_KCRCTAB | 1255 | return *(u32 *)((void *)crc + *crc); |
1257 | if (crc_owner == NULL) | ||
1258 | return crc - (unsigned long)reloc_start; | ||
1259 | #endif | ||
1260 | return crc; | ||
1261 | } | 1256 | } |
1262 | 1257 | ||
1263 | static int check_version(Elf_Shdr *sechdrs, | 1258 | static int check_version(Elf_Shdr *sechdrs, |
1264 | unsigned int versindex, | 1259 | unsigned int versindex, |
1265 | const char *symname, | 1260 | const char *symname, |
1266 | struct module *mod, | 1261 | struct module *mod, |
1267 | const unsigned long *crc, | 1262 | const s32 *crc) |
1268 | const struct module *crc_owner) | ||
1269 | { | 1263 | { |
1270 | unsigned int i, num_versions; | 1264 | unsigned int i, num_versions; |
1271 | struct modversion_info *versions; | 1265 | struct modversion_info *versions; |
@@ -1283,13 +1277,19 @@ static int check_version(Elf_Shdr *sechdrs, | |||
1283 | / sizeof(struct modversion_info); | 1277 | / sizeof(struct modversion_info); |
1284 | 1278 | ||
1285 | for (i = 0; i < num_versions; i++) { | 1279 | for (i = 0; i < num_versions; i++) { |
1280 | u32 crcval; | ||
1281 | |||
1286 | if (strcmp(versions[i].name, symname) != 0) | 1282 | if (strcmp(versions[i].name, symname) != 0) |
1287 | continue; | 1283 | continue; |
1288 | 1284 | ||
1289 | if (versions[i].crc == maybe_relocated(*crc, crc_owner)) | 1285 | if (IS_ENABLED(CONFIG_MODULE_REL_CRCS)) |
1286 | crcval = resolve_rel_crc(crc); | ||
1287 | else | ||
1288 | crcval = *crc; | ||
1289 | if (versions[i].crc == crcval) | ||
1290 | return 1; | 1290 | return 1; |
1291 | pr_debug("Found checksum %lX vs module %lX\n", | 1291 | pr_debug("Found checksum %X vs module %lX\n", |
1292 | maybe_relocated(*crc, crc_owner), versions[i].crc); | 1292 | crcval, versions[i].crc); |
1293 | goto bad_version; | 1293 | goto bad_version; |
1294 | } | 1294 | } |
1295 | 1295 | ||
@@ -1307,7 +1307,7 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, | |||
1307 | unsigned int versindex, | 1307 | unsigned int versindex, |
1308 | struct module *mod) | 1308 | struct module *mod) |
1309 | { | 1309 | { |
1310 | const unsigned long *crc; | 1310 | const s32 *crc; |
1311 | 1311 | ||
1312 | /* | 1312 | /* |
1313 | * Since this should be found in kernel (which can't be removed), no | 1313 | * Since this should be found in kernel (which can't be removed), no |
@@ -1321,8 +1321,7 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, | |||
1321 | } | 1321 | } |
1322 | preempt_enable(); | 1322 | preempt_enable(); |
1323 | return check_version(sechdrs, versindex, | 1323 | return check_version(sechdrs, versindex, |
1324 | VMLINUX_SYMBOL_STR(module_layout), mod, crc, | 1324 | VMLINUX_SYMBOL_STR(module_layout), mod, crc); |
1325 | NULL); | ||
1326 | } | 1325 | } |
1327 | 1326 | ||
1328 | /* First part is kernel version, which we ignore if module has crcs. */ | 1327 | /* First part is kernel version, which we ignore if module has crcs. */ |
@@ -1340,8 +1339,7 @@ static inline int check_version(Elf_Shdr *sechdrs, | |||
1340 | unsigned int versindex, | 1339 | unsigned int versindex, |
1341 | const char *symname, | 1340 | const char *symname, |
1342 | struct module *mod, | 1341 | struct module *mod, |
1343 | const unsigned long *crc, | 1342 | const s32 *crc) |
1344 | const struct module *crc_owner) | ||
1345 | { | 1343 | { |
1346 | return 1; | 1344 | return 1; |
1347 | } | 1345 | } |
@@ -1368,7 +1366,7 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod, | |||
1368 | { | 1366 | { |
1369 | struct module *owner; | 1367 | struct module *owner; |
1370 | const struct kernel_symbol *sym; | 1368 | const struct kernel_symbol *sym; |
1371 | const unsigned long *crc; | 1369 | const s32 *crc; |
1372 | int err; | 1370 | int err; |
1373 | 1371 | ||
1374 | /* | 1372 | /* |
@@ -1383,8 +1381,7 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod, | |||
1383 | if (!sym) | 1381 | if (!sym) |
1384 | goto unlock; | 1382 | goto unlock; |
1385 | 1383 | ||
1386 | if (!check_version(info->sechdrs, info->index.vers, name, mod, crc, | 1384 | if (!check_version(info->sechdrs, info->index.vers, name, mod, crc)) { |
1387 | owner)) { | ||
1388 | sym = ERR_PTR(-EINVAL); | 1385 | sym = ERR_PTR(-EINVAL); |
1389 | goto getname; | 1386 | goto getname; |
1390 | } | 1387 | } |
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index a133ecd741e4..7ad9e53ad174 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
@@ -1372,7 +1372,7 @@ kprobe_trace_selftest_target(int a1, int a2, int a3, int a4, int a5, int a6) | |||
1372 | return a1 + a2 + a3 + a4 + a5 + a6; | 1372 | return a1 + a2 + a3 + a4 + a5 + a6; |
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | static struct __init trace_event_file * | 1375 | static __init struct trace_event_file * |
1376 | find_trace_probe_file(struct trace_kprobe *tk, struct trace_array *tr) | 1376 | find_trace_probe_file(struct trace_kprobe *tk, struct trace_array *tr) |
1377 | { | 1377 | { |
1378 | struct trace_event_file *file; | 1378 | struct trace_event_file *file; |
diff --git a/mm/filemap.c b/mm/filemap.c index b772a33ef640..3f9afded581b 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1791,6 +1791,11 @@ static ssize_t do_generic_file_read(struct file *filp, loff_t *ppos, | |||
1791 | 1791 | ||
1792 | cond_resched(); | 1792 | cond_resched(); |
1793 | find_page: | 1793 | find_page: |
1794 | if (fatal_signal_pending(current)) { | ||
1795 | error = -EINTR; | ||
1796 | goto out; | ||
1797 | } | ||
1798 | |||
1794 | page = find_get_page(mapping, index); | 1799 | page = find_get_page(mapping, index); |
1795 | if (!page) { | 1800 | if (!page) { |
1796 | page_cache_sync_readahead(mapping, | 1801 | page_cache_sync_readahead(mapping, |
diff --git a/mm/kasan/report.c b/mm/kasan/report.c index b82b3e215157..f479365530b6 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/ftrace.h> | ||
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
17 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
18 | #include <linux/printk.h> | 19 | #include <linux/printk.h> |
@@ -300,6 +301,8 @@ void kasan_report(unsigned long addr, size_t size, | |||
300 | if (likely(!kasan_report_enabled())) | 301 | if (likely(!kasan_report_enabled())) |
301 | return; | 302 | return; |
302 | 303 | ||
304 | disable_trace_on_warning(); | ||
305 | |||
303 | info.access_addr = (void *)addr; | 306 | info.access_addr = (void *)addr; |
304 | info.access_size = size; | 307 | info.access_size = size; |
305 | info.is_write = is_write; | 308 | info.is_write = is_write; |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index ca2723d47338..b8c11e063ff0 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -1483,17 +1483,20 @@ bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) | |||
1483 | } | 1483 | } |
1484 | 1484 | ||
1485 | /* | 1485 | /* |
1486 | * Confirm all pages in a range [start, end) is belongs to the same zone. | 1486 | * Confirm all pages in a range [start, end) belong to the same zone. |
1487 | * When true, return its valid [start, end). | ||
1487 | */ | 1488 | */ |
1488 | int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) | 1489 | int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, |
1490 | unsigned long *valid_start, unsigned long *valid_end) | ||
1489 | { | 1491 | { |
1490 | unsigned long pfn, sec_end_pfn; | 1492 | unsigned long pfn, sec_end_pfn; |
1493 | unsigned long start, end; | ||
1491 | struct zone *zone = NULL; | 1494 | struct zone *zone = NULL; |
1492 | struct page *page; | 1495 | struct page *page; |
1493 | int i; | 1496 | int i; |
1494 | for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn); | 1497 | for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn + 1); |
1495 | pfn < end_pfn; | 1498 | pfn < end_pfn; |
1496 | pfn = sec_end_pfn + 1, sec_end_pfn += PAGES_PER_SECTION) { | 1499 | pfn = sec_end_pfn, sec_end_pfn += PAGES_PER_SECTION) { |
1497 | /* Make sure the memory section is present first */ | 1500 | /* Make sure the memory section is present first */ |
1498 | if (!present_section_nr(pfn_to_section_nr(pfn))) | 1501 | if (!present_section_nr(pfn_to_section_nr(pfn))) |
1499 | continue; | 1502 | continue; |
@@ -1509,10 +1512,20 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) | |||
1509 | page = pfn_to_page(pfn + i); | 1512 | page = pfn_to_page(pfn + i); |
1510 | if (zone && page_zone(page) != zone) | 1513 | if (zone && page_zone(page) != zone) |
1511 | return 0; | 1514 | return 0; |
1515 | if (!zone) | ||
1516 | start = pfn + i; | ||
1512 | zone = page_zone(page); | 1517 | zone = page_zone(page); |
1518 | end = pfn + MAX_ORDER_NR_PAGES; | ||
1513 | } | 1519 | } |
1514 | } | 1520 | } |
1515 | return 1; | 1521 | |
1522 | if (zone) { | ||
1523 | *valid_start = start; | ||
1524 | *valid_end = end; | ||
1525 | return 1; | ||
1526 | } else { | ||
1527 | return 0; | ||
1528 | } | ||
1516 | } | 1529 | } |
1517 | 1530 | ||
1518 | /* | 1531 | /* |
@@ -1839,6 +1852,7 @@ static int __ref __offline_pages(unsigned long start_pfn, | |||
1839 | long offlined_pages; | 1852 | long offlined_pages; |
1840 | int ret, drain, retry_max, node; | 1853 | int ret, drain, retry_max, node; |
1841 | unsigned long flags; | 1854 | unsigned long flags; |
1855 | unsigned long valid_start, valid_end; | ||
1842 | struct zone *zone; | 1856 | struct zone *zone; |
1843 | struct memory_notify arg; | 1857 | struct memory_notify arg; |
1844 | 1858 | ||
@@ -1849,10 +1863,10 @@ static int __ref __offline_pages(unsigned long start_pfn, | |||
1849 | return -EINVAL; | 1863 | return -EINVAL; |
1850 | /* This makes hotplug much easier...and readable. | 1864 | /* This makes hotplug much easier...and readable. |
1851 | we assume this for now. .*/ | 1865 | we assume this for now. .*/ |
1852 | if (!test_pages_in_a_zone(start_pfn, end_pfn)) | 1866 | if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end)) |
1853 | return -EINVAL; | 1867 | return -EINVAL; |
1854 | 1868 | ||
1855 | zone = page_zone(pfn_to_page(start_pfn)); | 1869 | zone = page_zone(pfn_to_page(valid_start)); |
1856 | node = zone_to_nid(zone); | 1870 | node = zone_to_nid(zone); |
1857 | nr_pages = end_pfn - start_pfn; | 1871 | nr_pages = end_pfn - start_pfn; |
1858 | 1872 | ||
diff --git a/mm/shmem.c b/mm/shmem.c index bb53285a1d99..3a7587a0314d 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -415,6 +415,7 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, | |||
415 | struct shrink_control *sc, unsigned long nr_to_split) | 415 | struct shrink_control *sc, unsigned long nr_to_split) |
416 | { | 416 | { |
417 | LIST_HEAD(list), *pos, *next; | 417 | LIST_HEAD(list), *pos, *next; |
418 | LIST_HEAD(to_remove); | ||
418 | struct inode *inode; | 419 | struct inode *inode; |
419 | struct shmem_inode_info *info; | 420 | struct shmem_inode_info *info; |
420 | struct page *page; | 421 | struct page *page; |
@@ -441,9 +442,8 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, | |||
441 | /* Check if there's anything to gain */ | 442 | /* Check if there's anything to gain */ |
442 | if (round_up(inode->i_size, PAGE_SIZE) == | 443 | if (round_up(inode->i_size, PAGE_SIZE) == |
443 | round_up(inode->i_size, HPAGE_PMD_SIZE)) { | 444 | round_up(inode->i_size, HPAGE_PMD_SIZE)) { |
444 | list_del_init(&info->shrinklist); | 445 | list_move(&info->shrinklist, &to_remove); |
445 | removed++; | 446 | removed++; |
446 | iput(inode); | ||
447 | goto next; | 447 | goto next; |
448 | } | 448 | } |
449 | 449 | ||
@@ -454,6 +454,13 @@ next: | |||
454 | } | 454 | } |
455 | spin_unlock(&sbinfo->shrinklist_lock); | 455 | spin_unlock(&sbinfo->shrinklist_lock); |
456 | 456 | ||
457 | list_for_each_safe(pos, next, &to_remove) { | ||
458 | info = list_entry(pos, struct shmem_inode_info, shrinklist); | ||
459 | inode = &info->vfs_inode; | ||
460 | list_del_init(&info->shrinklist); | ||
461 | iput(inode); | ||
462 | } | ||
463 | |||
457 | list_for_each_safe(pos, next, &list) { | 464 | list_for_each_safe(pos, next, &list) { |
458 | int ret; | 465 | int ret; |
459 | 466 | ||
diff --git a/mm/zswap.c b/mm/zswap.c index 067a0d62f318..cabf09e0128b 100644 --- a/mm/zswap.c +++ b/mm/zswap.c | |||
@@ -78,7 +78,13 @@ static u64 zswap_duplicate_entry; | |||
78 | 78 | ||
79 | /* Enable/disable zswap (disabled by default) */ | 79 | /* Enable/disable zswap (disabled by default) */ |
80 | static bool zswap_enabled; | 80 | static bool zswap_enabled; |
81 | module_param_named(enabled, zswap_enabled, bool, 0644); | 81 | static int zswap_enabled_param_set(const char *, |
82 | const struct kernel_param *); | ||
83 | static struct kernel_param_ops zswap_enabled_param_ops = { | ||
84 | .set = zswap_enabled_param_set, | ||
85 | .get = param_get_bool, | ||
86 | }; | ||
87 | module_param_cb(enabled, &zswap_enabled_param_ops, &zswap_enabled, 0644); | ||
82 | 88 | ||
83 | /* Crypto compressor to use */ | 89 | /* Crypto compressor to use */ |
84 | #define ZSWAP_COMPRESSOR_DEFAULT "lzo" | 90 | #define ZSWAP_COMPRESSOR_DEFAULT "lzo" |
@@ -176,6 +182,9 @@ static atomic_t zswap_pools_count = ATOMIC_INIT(0); | |||
176 | /* used by param callback function */ | 182 | /* used by param callback function */ |
177 | static bool zswap_init_started; | 183 | static bool zswap_init_started; |
178 | 184 | ||
185 | /* fatal error during init */ | ||
186 | static bool zswap_init_failed; | ||
187 | |||
179 | /********************************* | 188 | /********************************* |
180 | * helpers and fwd declarations | 189 | * helpers and fwd declarations |
181 | **********************************/ | 190 | **********************************/ |
@@ -624,6 +633,11 @@ static int __zswap_param_set(const char *val, const struct kernel_param *kp, | |||
624 | char *s = strstrip((char *)val); | 633 | char *s = strstrip((char *)val); |
625 | int ret; | 634 | int ret; |
626 | 635 | ||
636 | if (zswap_init_failed) { | ||
637 | pr_err("can't set param, initialization failed\n"); | ||
638 | return -ENODEV; | ||
639 | } | ||
640 | |||
627 | /* no change required */ | 641 | /* no change required */ |
628 | if (!strcmp(s, *(char **)kp->arg)) | 642 | if (!strcmp(s, *(char **)kp->arg)) |
629 | return 0; | 643 | return 0; |
@@ -703,6 +717,17 @@ static int zswap_zpool_param_set(const char *val, | |||
703 | return __zswap_param_set(val, kp, NULL, zswap_compressor); | 717 | return __zswap_param_set(val, kp, NULL, zswap_compressor); |
704 | } | 718 | } |
705 | 719 | ||
720 | static int zswap_enabled_param_set(const char *val, | ||
721 | const struct kernel_param *kp) | ||
722 | { | ||
723 | if (zswap_init_failed) { | ||
724 | pr_err("can't enable, initialization failed\n"); | ||
725 | return -ENODEV; | ||
726 | } | ||
727 | |||
728 | return param_set_bool(val, kp); | ||
729 | } | ||
730 | |||
706 | /********************************* | 731 | /********************************* |
707 | * writeback code | 732 | * writeback code |
708 | **********************************/ | 733 | **********************************/ |
@@ -1201,6 +1226,9 @@ hp_fail: | |||
1201 | dstmem_fail: | 1226 | dstmem_fail: |
1202 | zswap_entry_cache_destroy(); | 1227 | zswap_entry_cache_destroy(); |
1203 | cache_fail: | 1228 | cache_fail: |
1229 | /* if built-in, we aren't unloaded on failure; don't allow use */ | ||
1230 | zswap_init_failed = true; | ||
1231 | zswap_enabled = false; | ||
1204 | return -ENOMEM; | 1232 | return -ENOMEM; |
1205 | } | 1233 | } |
1206 | /* must be late so crypto has time to come up */ | 1234 | /* must be late so crypto has time to come up */ |
diff --git a/net/core/datagram.c b/net/core/datagram.c index 662bea587165..ea633342ab0d 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -332,7 +332,9 @@ void __skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb, int len) | |||
332 | EXPORT_SYMBOL(__skb_free_datagram_locked); | 332 | EXPORT_SYMBOL(__skb_free_datagram_locked); |
333 | 333 | ||
334 | int __sk_queue_drop_skb(struct sock *sk, struct sk_buff *skb, | 334 | int __sk_queue_drop_skb(struct sock *sk, struct sk_buff *skb, |
335 | unsigned int flags) | 335 | unsigned int flags, |
336 | void (*destructor)(struct sock *sk, | ||
337 | struct sk_buff *skb)) | ||
336 | { | 338 | { |
337 | int err = 0; | 339 | int err = 0; |
338 | 340 | ||
@@ -342,6 +344,8 @@ int __sk_queue_drop_skb(struct sock *sk, struct sk_buff *skb, | |||
342 | if (skb == skb_peek(&sk->sk_receive_queue)) { | 344 | if (skb == skb_peek(&sk->sk_receive_queue)) { |
343 | __skb_unlink(skb, &sk->sk_receive_queue); | 345 | __skb_unlink(skb, &sk->sk_receive_queue); |
344 | atomic_dec(&skb->users); | 346 | atomic_dec(&skb->users); |
347 | if (destructor) | ||
348 | destructor(sk, skb); | ||
345 | err = 0; | 349 | err = 0; |
346 | } | 350 | } |
347 | spin_unlock_bh(&sk->sk_receive_queue.lock); | 351 | spin_unlock_bh(&sk->sk_receive_queue.lock); |
@@ -375,7 +379,7 @@ EXPORT_SYMBOL(__sk_queue_drop_skb); | |||
375 | 379 | ||
376 | int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags) | 380 | int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags) |
377 | { | 381 | { |
378 | int err = __sk_queue_drop_skb(sk, skb, flags); | 382 | int err = __sk_queue_drop_skb(sk, skb, flags, NULL); |
379 | 383 | ||
380 | kfree_skb(skb); | 384 | kfree_skb(skb); |
381 | sk_mem_reclaim_partial(sk); | 385 | sk_mem_reclaim_partial(sk); |
diff --git a/net/core/dev.c b/net/core/dev.c index 3e1a60102e64..0921609dfa81 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1695,24 +1695,19 @@ EXPORT_SYMBOL_GPL(net_dec_egress_queue); | |||
1695 | 1695 | ||
1696 | static struct static_key netstamp_needed __read_mostly; | 1696 | static struct static_key netstamp_needed __read_mostly; |
1697 | #ifdef HAVE_JUMP_LABEL | 1697 | #ifdef HAVE_JUMP_LABEL |
1698 | /* We are not allowed to call static_key_slow_dec() from irq context | ||
1699 | * If net_disable_timestamp() is called from irq context, defer the | ||
1700 | * static_key_slow_dec() calls. | ||
1701 | */ | ||
1702 | static atomic_t netstamp_needed_deferred; | 1698 | static atomic_t netstamp_needed_deferred; |
1703 | #endif | 1699 | static void netstamp_clear(struct work_struct *work) |
1704 | |||
1705 | void net_enable_timestamp(void) | ||
1706 | { | 1700 | { |
1707 | #ifdef HAVE_JUMP_LABEL | ||
1708 | int deferred = atomic_xchg(&netstamp_needed_deferred, 0); | 1701 | int deferred = atomic_xchg(&netstamp_needed_deferred, 0); |
1709 | 1702 | ||
1710 | if (deferred) { | 1703 | while (deferred--) |
1711 | while (--deferred) | 1704 | static_key_slow_dec(&netstamp_needed); |
1712 | static_key_slow_dec(&netstamp_needed); | 1705 | } |
1713 | return; | 1706 | static DECLARE_WORK(netstamp_work, netstamp_clear); |
1714 | } | ||
1715 | #endif | 1707 | #endif |
1708 | |||
1709 | void net_enable_timestamp(void) | ||
1710 | { | ||
1716 | static_key_slow_inc(&netstamp_needed); | 1711 | static_key_slow_inc(&netstamp_needed); |
1717 | } | 1712 | } |
1718 | EXPORT_SYMBOL(net_enable_timestamp); | 1713 | EXPORT_SYMBOL(net_enable_timestamp); |
@@ -1720,12 +1715,12 @@ EXPORT_SYMBOL(net_enable_timestamp); | |||
1720 | void net_disable_timestamp(void) | 1715 | void net_disable_timestamp(void) |
1721 | { | 1716 | { |
1722 | #ifdef HAVE_JUMP_LABEL | 1717 | #ifdef HAVE_JUMP_LABEL |
1723 | if (in_interrupt()) { | 1718 | /* net_disable_timestamp() can be called from non process context */ |
1724 | atomic_inc(&netstamp_needed_deferred); | 1719 | atomic_inc(&netstamp_needed_deferred); |
1725 | return; | 1720 | schedule_work(&netstamp_work); |
1726 | } | 1721 | #else |
1727 | #endif | ||
1728 | static_key_slow_dec(&netstamp_needed); | 1722 | static_key_slow_dec(&netstamp_needed); |
1723 | #endif | ||
1729 | } | 1724 | } |
1730 | EXPORT_SYMBOL(net_disable_timestamp); | 1725 | EXPORT_SYMBOL(net_disable_timestamp); |
1731 | 1726 | ||
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index d5f412b3093d..be7bab1adcde 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -1404,9 +1404,12 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) | |||
1404 | if (regs.len > reglen) | 1404 | if (regs.len > reglen) |
1405 | regs.len = reglen; | 1405 | regs.len = reglen; |
1406 | 1406 | ||
1407 | regbuf = vzalloc(reglen); | 1407 | regbuf = NULL; |
1408 | if (reglen && !regbuf) | 1408 | if (reglen) { |
1409 | return -ENOMEM; | 1409 | regbuf = vzalloc(reglen); |
1410 | if (!regbuf) | ||
1411 | return -ENOMEM; | ||
1412 | } | ||
1410 | 1413 | ||
1411 | ops->get_regs(dev, ®s, regbuf); | 1414 | ops->get_regs(dev, ®s, regbuf); |
1412 | 1415 | ||
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index 72d6f056d863..ae206163c273 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c | |||
@@ -1587,6 +1587,10 @@ int cipso_v4_validate(const struct sk_buff *skb, unsigned char **option) | |||
1587 | goto validate_return_locked; | 1587 | goto validate_return_locked; |
1588 | } | 1588 | } |
1589 | 1589 | ||
1590 | if (opt_iter + 1 == opt_len) { | ||
1591 | err_offset = opt_iter; | ||
1592 | goto validate_return_locked; | ||
1593 | } | ||
1590 | tag_len = tag[1]; | 1594 | tag_len = tag[1]; |
1591 | if (tag_len > (opt_len - opt_iter)) { | 1595 | if (tag_len > (opt_len - opt_iter)) { |
1592 | err_offset = opt_iter + 1; | 1596 | err_offset = opt_iter + 1; |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 8a4409dd390a..ce1386a67e24 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -1243,7 +1243,14 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) | |||
1243 | pktinfo->ipi_ifindex = 0; | 1243 | pktinfo->ipi_ifindex = 0; |
1244 | pktinfo->ipi_spec_dst.s_addr = 0; | 1244 | pktinfo->ipi_spec_dst.s_addr = 0; |
1245 | } | 1245 | } |
1246 | skb_dst_drop(skb); | 1246 | /* We need to keep the dst for __ip_options_echo() |
1247 | * We could restrict the test to opt.ts_needtime || opt.srr, | ||
1248 | * but the following is good enough as IP options are not often used. | ||
1249 | */ | ||
1250 | if (unlikely(IPCB(skb)->opt.optlen)) | ||
1251 | skb_dst_force(skb); | ||
1252 | else | ||
1253 | skb_dst_drop(skb); | ||
1247 | } | 1254 | } |
1248 | 1255 | ||
1249 | int ip_setsockopt(struct sock *sk, int level, | 1256 | int ip_setsockopt(struct sock *sk, int level, |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index b751abc56935..d44a6989e76d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -773,6 +773,12 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, | |||
773 | ret = -EAGAIN; | 773 | ret = -EAGAIN; |
774 | break; | 774 | break; |
775 | } | 775 | } |
776 | /* if __tcp_splice_read() got nothing while we have | ||
777 | * an skb in receive queue, we do not want to loop. | ||
778 | * This might happen with URG data. | ||
779 | */ | ||
780 | if (!skb_queue_empty(&sk->sk_receive_queue)) | ||
781 | break; | ||
776 | sk_wait_data(sk, &timeo, NULL); | 782 | sk_wait_data(sk, &timeo, NULL); |
777 | if (signal_pending(current)) { | 783 | if (signal_pending(current)) { |
778 | ret = sock_intr_errno(timeo); | 784 | ret = sock_intr_errno(timeo); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 4a1ba04565d1..ea6e4cff9faf 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1490,7 +1490,7 @@ try_again: | |||
1490 | return err; | 1490 | return err; |
1491 | 1491 | ||
1492 | csum_copy_err: | 1492 | csum_copy_err: |
1493 | if (!__sk_queue_drop_skb(sk, skb, flags)) { | 1493 | if (!__sk_queue_drop_skb(sk, skb, flags, udp_skb_destructor)) { |
1494 | UDP_INC_STATS(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); | 1494 | UDP_INC_STATS(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); |
1495 | UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite); | 1495 | UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite); |
1496 | } | 1496 | } |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 156ed578d3c0..a69ae7d4e6f8 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -3393,9 +3393,15 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, | |||
3393 | } | 3393 | } |
3394 | 3394 | ||
3395 | if (idev) { | 3395 | if (idev) { |
3396 | if (idev->if_flags & IF_READY) | 3396 | if (idev->if_flags & IF_READY) { |
3397 | /* device is already configured. */ | 3397 | /* device is already configured - |
3398 | * but resend MLD reports, we might | ||
3399 | * have roamed and need to update | ||
3400 | * multicast snooping switches | ||
3401 | */ | ||
3402 | ipv6_mc_up(idev); | ||
3398 | break; | 3403 | break; |
3404 | } | ||
3399 | idev->if_flags |= IF_READY; | 3405 | idev->if_flags |= IF_READY; |
3400 | } | 3406 | } |
3401 | 3407 | ||
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index e4198502fd98..275cac628a95 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c | |||
@@ -327,7 +327,6 @@ static int ipv6_srh_rcv(struct sk_buff *skb) | |||
327 | struct ipv6_sr_hdr *hdr; | 327 | struct ipv6_sr_hdr *hdr; |
328 | struct inet6_dev *idev; | 328 | struct inet6_dev *idev; |
329 | struct in6_addr *addr; | 329 | struct in6_addr *addr; |
330 | bool cleanup = false; | ||
331 | int accept_seg6; | 330 | int accept_seg6; |
332 | 331 | ||
333 | hdr = (struct ipv6_sr_hdr *)skb_transport_header(skb); | 332 | hdr = (struct ipv6_sr_hdr *)skb_transport_header(skb); |
@@ -351,11 +350,7 @@ static int ipv6_srh_rcv(struct sk_buff *skb) | |||
351 | #endif | 350 | #endif |
352 | 351 | ||
353 | looped_back: | 352 | looped_back: |
354 | if (hdr->segments_left > 0) { | 353 | if (hdr->segments_left == 0) { |
355 | if (hdr->nexthdr != NEXTHDR_IPV6 && hdr->segments_left == 1 && | ||
356 | sr_has_cleanup(hdr)) | ||
357 | cleanup = true; | ||
358 | } else { | ||
359 | if (hdr->nexthdr == NEXTHDR_IPV6) { | 354 | if (hdr->nexthdr == NEXTHDR_IPV6) { |
360 | int offset = (hdr->hdrlen + 1) << 3; | 355 | int offset = (hdr->hdrlen + 1) << 3; |
361 | 356 | ||
@@ -418,21 +413,6 @@ looped_back: | |||
418 | 413 | ||
419 | ipv6_hdr(skb)->daddr = *addr; | 414 | ipv6_hdr(skb)->daddr = *addr; |
420 | 415 | ||
421 | if (cleanup) { | ||
422 | int srhlen = (hdr->hdrlen + 1) << 3; | ||
423 | int nh = hdr->nexthdr; | ||
424 | |||
425 | skb_pull_rcsum(skb, sizeof(struct ipv6hdr) + srhlen); | ||
426 | memmove(skb_network_header(skb) + srhlen, | ||
427 | skb_network_header(skb), | ||
428 | (unsigned char *)hdr - skb_network_header(skb)); | ||
429 | skb->network_header += srhlen; | ||
430 | ipv6_hdr(skb)->nexthdr = nh; | ||
431 | ipv6_hdr(skb)->payload_len = htons(skb->len - | ||
432 | sizeof(struct ipv6hdr)); | ||
433 | skb_push_rcsum(skb, sizeof(struct ipv6hdr)); | ||
434 | } | ||
435 | |||
436 | skb_dst_drop(skb); | 416 | skb_dst_drop(skb); |
437 | 417 | ||
438 | ip6_route_input(skb); | 418 | ip6_route_input(skb); |
@@ -453,13 +433,8 @@ looped_back: | |||
453 | } | 433 | } |
454 | ipv6_hdr(skb)->hop_limit--; | 434 | ipv6_hdr(skb)->hop_limit--; |
455 | 435 | ||
456 | /* be sure that srh is still present before reinjecting */ | 436 | skb_pull(skb, sizeof(struct ipv6hdr)); |
457 | if (!cleanup) { | 437 | goto looped_back; |
458 | skb_pull(skb, sizeof(struct ipv6hdr)); | ||
459 | goto looped_back; | ||
460 | } | ||
461 | skb_set_transport_header(skb, sizeof(struct ipv6hdr)); | ||
462 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); | ||
463 | } | 438 | } |
464 | 439 | ||
465 | dst_input(skb); | 440 | dst_input(skb); |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 51b9835b3176..6fcb7cb49bb2 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -367,35 +367,37 @@ static void ip6gre_tunnel_uninit(struct net_device *dev) | |||
367 | 367 | ||
368 | 368 | ||
369 | static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 369 | static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
370 | u8 type, u8 code, int offset, __be32 info) | 370 | u8 type, u8 code, int offset, __be32 info) |
371 | { | 371 | { |
372 | const struct ipv6hdr *ipv6h = (const struct ipv6hdr *)skb->data; | 372 | const struct gre_base_hdr *greh; |
373 | __be16 *p = (__be16 *)(skb->data + offset); | 373 | const struct ipv6hdr *ipv6h; |
374 | int grehlen = offset + 4; | 374 | int grehlen = sizeof(*greh); |
375 | struct ip6_tnl *t; | 375 | struct ip6_tnl *t; |
376 | int key_off = 0; | ||
376 | __be16 flags; | 377 | __be16 flags; |
378 | __be32 key; | ||
377 | 379 | ||
378 | flags = p[0]; | 380 | if (!pskb_may_pull(skb, offset + grehlen)) |
379 | if (flags&(GRE_CSUM|GRE_KEY|GRE_SEQ|GRE_ROUTING|GRE_VERSION)) { | 381 | return; |
380 | if (flags&(GRE_VERSION|GRE_ROUTING)) | 382 | greh = (const struct gre_base_hdr *)(skb->data + offset); |
381 | return; | 383 | flags = greh->flags; |
382 | if (flags&GRE_KEY) { | 384 | if (flags & (GRE_VERSION | GRE_ROUTING)) |
383 | grehlen += 4; | 385 | return; |
384 | if (flags&GRE_CSUM) | 386 | if (flags & GRE_CSUM) |
385 | grehlen += 4; | 387 | grehlen += 4; |
386 | } | 388 | if (flags & GRE_KEY) { |
389 | key_off = grehlen + offset; | ||
390 | grehlen += 4; | ||
387 | } | 391 | } |
388 | 392 | ||
389 | /* If only 8 bytes returned, keyed message will be dropped here */ | 393 | if (!pskb_may_pull(skb, offset + grehlen)) |
390 | if (!pskb_may_pull(skb, grehlen)) | ||
391 | return; | 394 | return; |
392 | ipv6h = (const struct ipv6hdr *)skb->data; | 395 | ipv6h = (const struct ipv6hdr *)skb->data; |
393 | p = (__be16 *)(skb->data + offset); | 396 | greh = (const struct gre_base_hdr *)(skb->data + offset); |
397 | key = key_off ? *(__be32 *)(skb->data + key_off) : 0; | ||
394 | 398 | ||
395 | t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr, | 399 | t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr, |
396 | flags & GRE_KEY ? | 400 | key, greh->protocol); |
397 | *(((__be32 *)p) + (grehlen / 4) - 1) : 0, | ||
398 | p[1]); | ||
399 | if (!t) | 401 | if (!t) |
400 | return; | 402 | return; |
401 | 403 | ||
diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c index b274f1d95e03..f950cb53d5e3 100644 --- a/net/ipv6/seg6_hmac.c +++ b/net/ipv6/seg6_hmac.c | |||
@@ -174,7 +174,7 @@ int seg6_hmac_compute(struct seg6_hmac_info *hinfo, struct ipv6_sr_hdr *hdr, | |||
174 | * hash function (RadioGatun) with up to 1216 bits | 174 | * hash function (RadioGatun) with up to 1216 bits |
175 | */ | 175 | */ |
176 | 176 | ||
177 | /* saddr(16) + first_seg(1) + cleanup(1) + keyid(4) + seglist(16n) */ | 177 | /* saddr(16) + first_seg(1) + flags(1) + keyid(4) + seglist(16n) */ |
178 | plen = 16 + 1 + 1 + 4 + (hdr->first_segment + 1) * 16; | 178 | plen = 16 + 1 + 1 + 4 + (hdr->first_segment + 1) * 16; |
179 | 179 | ||
180 | /* this limit allows for 14 segments */ | 180 | /* this limit allows for 14 segments */ |
@@ -186,7 +186,7 @@ int seg6_hmac_compute(struct seg6_hmac_info *hinfo, struct ipv6_sr_hdr *hdr, | |||
186 | * | 186 | * |
187 | * 1. Source IPv6 address (128 bits) | 187 | * 1. Source IPv6 address (128 bits) |
188 | * 2. first_segment value (8 bits) | 188 | * 2. first_segment value (8 bits) |
189 | * 3. cleanup flag (8 bits: highest bit is cleanup value, others are 0) | 189 | * 3. Flags (8 bits) |
190 | * 4. HMAC Key ID (32 bits) | 190 | * 4. HMAC Key ID (32 bits) |
191 | * 5. All segments in the segments list (n * 128 bits) | 191 | * 5. All segments in the segments list (n * 128 bits) |
192 | */ | 192 | */ |
@@ -202,8 +202,8 @@ int seg6_hmac_compute(struct seg6_hmac_info *hinfo, struct ipv6_sr_hdr *hdr, | |||
202 | /* first_segment value */ | 202 | /* first_segment value */ |
203 | *off++ = hdr->first_segment; | 203 | *off++ = hdr->first_segment; |
204 | 204 | ||
205 | /* cleanup flag */ | 205 | /* flags */ |
206 | *off++ = !!(sr_has_cleanup(hdr)) << 7; | 206 | *off++ = hdr->flags; |
207 | 207 | ||
208 | /* HMAC Key ID */ | 208 | /* HMAC Key ID */ |
209 | memcpy(off, &hmackeyid, 4); | 209 | memcpy(off, &hmackeyid, 4); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 6b9fc63fd4d2..b5d27212db2f 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -996,6 +996,16 @@ drop: | |||
996 | return 0; /* don't send reset */ | 996 | return 0; /* don't send reset */ |
997 | } | 997 | } |
998 | 998 | ||
999 | static void tcp_v6_restore_cb(struct sk_buff *skb) | ||
1000 | { | ||
1001 | /* We need to move header back to the beginning if xfrm6_policy_check() | ||
1002 | * and tcp_v6_fill_cb() are going to be called again. | ||
1003 | * ip6_datagram_recv_specific_ctl() also expects IP6CB to be there. | ||
1004 | */ | ||
1005 | memmove(IP6CB(skb), &TCP_SKB_CB(skb)->header.h6, | ||
1006 | sizeof(struct inet6_skb_parm)); | ||
1007 | } | ||
1008 | |||
999 | static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, | 1009 | static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, |
1000 | struct request_sock *req, | 1010 | struct request_sock *req, |
1001 | struct dst_entry *dst, | 1011 | struct dst_entry *dst, |
@@ -1184,8 +1194,10 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff * | |||
1184 | sk_gfp_mask(sk, GFP_ATOMIC)); | 1194 | sk_gfp_mask(sk, GFP_ATOMIC)); |
1185 | consume_skb(ireq->pktopts); | 1195 | consume_skb(ireq->pktopts); |
1186 | ireq->pktopts = NULL; | 1196 | ireq->pktopts = NULL; |
1187 | if (newnp->pktoptions) | 1197 | if (newnp->pktoptions) { |
1198 | tcp_v6_restore_cb(newnp->pktoptions); | ||
1188 | skb_set_owner_r(newnp->pktoptions, newsk); | 1199 | skb_set_owner_r(newnp->pktoptions, newsk); |
1200 | } | ||
1189 | } | 1201 | } |
1190 | } | 1202 | } |
1191 | 1203 | ||
@@ -1200,16 +1212,6 @@ out: | |||
1200 | return NULL; | 1212 | return NULL; |
1201 | } | 1213 | } |
1202 | 1214 | ||
1203 | static void tcp_v6_restore_cb(struct sk_buff *skb) | ||
1204 | { | ||
1205 | /* We need to move header back to the beginning if xfrm6_policy_check() | ||
1206 | * and tcp_v6_fill_cb() are going to be called again. | ||
1207 | * ip6_datagram_recv_specific_ctl() also expects IP6CB to be there. | ||
1208 | */ | ||
1209 | memmove(IP6CB(skb), &TCP_SKB_CB(skb)->header.h6, | ||
1210 | sizeof(struct inet6_skb_parm)); | ||
1211 | } | ||
1212 | |||
1213 | /* The socket must have it's spinlock held when we get | 1215 | /* The socket must have it's spinlock held when we get |
1214 | * here, unless it is a TCP_LISTEN socket. | 1216 | * here, unless it is a TCP_LISTEN socket. |
1215 | * | 1217 | * |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 51346fa70298..df71ba05f41d 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -454,7 +454,7 @@ try_again: | |||
454 | return err; | 454 | return err; |
455 | 455 | ||
456 | csum_copy_err: | 456 | csum_copy_err: |
457 | if (!__sk_queue_drop_skb(sk, skb, flags)) { | 457 | if (!__sk_queue_drop_skb(sk, skb, flags, udp_skb_destructor)) { |
458 | if (is_udp4) { | 458 | if (is_udp4) { |
459 | UDP_INC_STATS(sock_net(sk), | 459 | UDP_INC_STATS(sock_net(sk), |
460 | UDP_MIB_CSUMERRORS, is_udplite); | 460 | UDP_MIB_CSUMERRORS, is_udplite); |
diff --git a/net/mac80211/fils_aead.c b/net/mac80211/fils_aead.c index ecfdd97758a3..5c3af5eb4052 100644 --- a/net/mac80211/fils_aead.c +++ b/net/mac80211/fils_aead.c | |||
@@ -124,7 +124,7 @@ static int aes_siv_encrypt(const u8 *key, size_t key_len, | |||
124 | 124 | ||
125 | /* CTR */ | 125 | /* CTR */ |
126 | 126 | ||
127 | tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); | 127 | tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC); |
128 | if (IS_ERR(tfm2)) { | 128 | if (IS_ERR(tfm2)) { |
129 | kfree(tmp); | 129 | kfree(tmp); |
130 | return PTR_ERR(tfm2); | 130 | return PTR_ERR(tfm2); |
@@ -183,7 +183,7 @@ static int aes_siv_decrypt(const u8 *key, size_t key_len, | |||
183 | 183 | ||
184 | /* CTR */ | 184 | /* CTR */ |
185 | 185 | ||
186 | tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); | 186 | tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC); |
187 | if (IS_ERR(tfm2)) | 187 | if (IS_ERR(tfm2)) |
188 | return PTR_ERR(tfm2); | 188 | return PTR_ERR(tfm2); |
189 | /* K2 for CTR */ | 189 | /* K2 for CTR */ |
@@ -272,7 +272,7 @@ int fils_encrypt_assoc_req(struct sk_buff *skb, | |||
272 | crypt_len = skb->data + skb->len - encr; | 272 | crypt_len = skb->data + skb->len - encr; |
273 | skb_put(skb, AES_BLOCK_SIZE); | 273 | skb_put(skb, AES_BLOCK_SIZE); |
274 | return aes_siv_encrypt(assoc_data->fils_kek, assoc_data->fils_kek_len, | 274 | return aes_siv_encrypt(assoc_data->fils_kek, assoc_data->fils_kek_len, |
275 | encr, crypt_len, 1, addr, len, encr); | 275 | encr, crypt_len, 5, addr, len, encr); |
276 | } | 276 | } |
277 | 277 | ||
278 | int fils_decrypt_assoc_resp(struct ieee80211_sub_if_data *sdata, | 278 | int fils_decrypt_assoc_resp(struct ieee80211_sub_if_data *sdata, |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 9c23172feba0..c28b0af9c1f2 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -335,7 +335,7 @@ int mesh_add_vendor_ies(struct ieee80211_sub_if_data *sdata, | |||
335 | /* fast-forward to vendor IEs */ | 335 | /* fast-forward to vendor IEs */ |
336 | offset = ieee80211_ie_split_vendor(ifmsh->ie, ifmsh->ie_len, 0); | 336 | offset = ieee80211_ie_split_vendor(ifmsh->ie, ifmsh->ie_len, 0); |
337 | 337 | ||
338 | if (offset) { | 338 | if (offset < ifmsh->ie_len) { |
339 | len = ifmsh->ie_len - offset; | 339 | len = ifmsh->ie_len - offset; |
340 | data = ifmsh->ie + offset; | 340 | data = ifmsh->ie + offset; |
341 | if (skb_tailroom(skb) < len) | 341 | if (skb_tailroom(skb) < len) |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index a4609a0be76d..a8b4252fe084 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -239,7 +239,7 @@ static struct sctp_transport *sctp_addr_id2transport(struct sock *sk, | |||
239 | union sctp_addr *laddr = (union sctp_addr *)addr; | 239 | union sctp_addr *laddr = (union sctp_addr *)addr; |
240 | struct sctp_transport *transport; | 240 | struct sctp_transport *transport; |
241 | 241 | ||
242 | if (sctp_verify_addr(sk, laddr, af->sockaddr_len)) | 242 | if (!af || sctp_verify_addr(sk, laddr, af->sockaddr_len)) |
243 | return NULL; | 243 | return NULL; |
244 | 244 | ||
245 | addr_asoc = sctp_endpoint_lookup_assoc(sctp_sk(sk)->ep, | 245 | addr_asoc = sctp_endpoint_lookup_assoc(sctp_sk(sk)->ep, |
@@ -7540,7 +7540,8 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, | |||
7540 | */ | 7540 | */ |
7541 | release_sock(sk); | 7541 | release_sock(sk); |
7542 | current_timeo = schedule_timeout(current_timeo); | 7542 | current_timeo = schedule_timeout(current_timeo); |
7543 | BUG_ON(sk != asoc->base.sk); | 7543 | if (sk != asoc->base.sk) |
7544 | goto do_error; | ||
7544 | lock_sock(sk); | 7545 | lock_sock(sk); |
7545 | 7546 | ||
7546 | *timeo_p = current_timeo; | 7547 | *timeo_p = current_timeo; |
diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rpc_xdr.c index dc6fb79a361f..25d9a9cf7b66 100644 --- a/net/sunrpc/auth_gss/gss_rpc_xdr.c +++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c | |||
@@ -260,7 +260,7 @@ static int gssx_dec_option_array(struct xdr_stream *xdr, | |||
260 | if (!oa->data) | 260 | if (!oa->data) |
261 | return -ENOMEM; | 261 | return -ENOMEM; |
262 | 262 | ||
263 | creds = kmalloc(sizeof(struct svc_cred), GFP_KERNEL); | 263 | creds = kzalloc(sizeof(struct svc_cred), GFP_KERNEL); |
264 | if (!creds) { | 264 | if (!creds) { |
265 | kfree(oa->data); | 265 | kfree(oa->data); |
266 | return -ENOMEM; | 266 | return -ENOMEM; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 63dfa60a29ef..3aee94b0c6c5 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -5921,6 +5921,7 @@ do { \ | |||
5921 | break; | 5921 | break; |
5922 | } | 5922 | } |
5923 | cfg->ht_opmode = ht_opmode; | 5923 | cfg->ht_opmode = ht_opmode; |
5924 | mask |= (1 << (NL80211_MESHCONF_HT_OPMODE - 1)); | ||
5924 | } | 5925 | } |
5925 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPactivePathToRootTimeout, | 5926 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPactivePathToRootTimeout, |
5926 | 1, 65535, mask, | 5927 | 1, 65535, mask, |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index eadcd4d359d9..d883116ebaa4 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -164,6 +164,7 @@ cmd_gensymtypes_c = \ | |||
164 | $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ | 164 | $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ |
165 | $(GENKSYMS) $(if $(1), -T $(2)) \ | 165 | $(GENKSYMS) $(if $(1), -T $(2)) \ |
166 | $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \ | 166 | $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \ |
167 | $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \ | ||
167 | $(if $(KBUILD_PRESERVE),-p) \ | 168 | $(if $(KBUILD_PRESERVE),-p) \ |
168 | -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) | 169 | -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) |
169 | 170 | ||
@@ -337,6 +338,7 @@ cmd_gensymtypes_S = \ | |||
337 | $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \ | 338 | $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \ |
338 | $(GENKSYMS) $(if $(1), -T $(2)) \ | 339 | $(GENKSYMS) $(if $(1), -T $(2)) \ |
339 | $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \ | 340 | $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \ |
341 | $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \ | ||
340 | $(if $(KBUILD_PRESERVE),-p) \ | 342 | $(if $(KBUILD_PRESERVE),-p) \ |
341 | -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) | 343 | -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) |
342 | 344 | ||
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index 06121ce524a7..c9235d8340f1 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c | |||
@@ -44,7 +44,7 @@ char *cur_filename, *source_file; | |||
44 | int in_source_file; | 44 | int in_source_file; |
45 | 45 | ||
46 | static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, | 46 | static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, |
47 | flag_preserve, flag_warnings; | 47 | flag_preserve, flag_warnings, flag_rel_crcs; |
48 | static const char *mod_prefix = ""; | 48 | static const char *mod_prefix = ""; |
49 | 49 | ||
50 | static int errors; | 50 | static int errors; |
@@ -693,7 +693,10 @@ void export_symbol(const char *name) | |||
693 | fputs(">\n", debugfile); | 693 | fputs(">\n", debugfile); |
694 | 694 | ||
695 | /* Used as a linker script. */ | 695 | /* Used as a linker script. */ |
696 | printf("%s__crc_%s = 0x%08lx ;\n", mod_prefix, name, crc); | 696 | printf(!flag_rel_crcs ? "%s__crc_%s = 0x%08lx;\n" : |
697 | "SECTIONS { .rodata : ALIGN(4) { " | ||
698 | "%s__crc_%s = .; LONG(0x%08lx); } }\n", | ||
699 | mod_prefix, name, crc); | ||
697 | } | 700 | } |
698 | } | 701 | } |
699 | 702 | ||
@@ -730,7 +733,7 @@ void error_with_pos(const char *fmt, ...) | |||
730 | 733 | ||
731 | static void genksyms_usage(void) | 734 | static void genksyms_usage(void) |
732 | { | 735 | { |
733 | fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n" | 736 | fputs("Usage:\n" "genksyms [-adDTwqhVR] > /path/to/.tmp_obj.ver\n" "\n" |
734 | #ifdef __GNU_LIBRARY__ | 737 | #ifdef __GNU_LIBRARY__ |
735 | " -s, --symbol-prefix Select symbol prefix\n" | 738 | " -s, --symbol-prefix Select symbol prefix\n" |
736 | " -d, --debug Increment the debug level (repeatable)\n" | 739 | " -d, --debug Increment the debug level (repeatable)\n" |
@@ -742,6 +745,7 @@ static void genksyms_usage(void) | |||
742 | " -q, --quiet Disable warnings (default)\n" | 745 | " -q, --quiet Disable warnings (default)\n" |
743 | " -h, --help Print this message\n" | 746 | " -h, --help Print this message\n" |
744 | " -V, --version Print the release version\n" | 747 | " -V, --version Print the release version\n" |
748 | " -R, --relative-crc Emit section relative symbol CRCs\n" | ||
745 | #else /* __GNU_LIBRARY__ */ | 749 | #else /* __GNU_LIBRARY__ */ |
746 | " -s Select symbol prefix\n" | 750 | " -s Select symbol prefix\n" |
747 | " -d Increment the debug level (repeatable)\n" | 751 | " -d Increment the debug level (repeatable)\n" |
@@ -753,6 +757,7 @@ static void genksyms_usage(void) | |||
753 | " -q Disable warnings (default)\n" | 757 | " -q Disable warnings (default)\n" |
754 | " -h Print this message\n" | 758 | " -h Print this message\n" |
755 | " -V Print the release version\n" | 759 | " -V Print the release version\n" |
760 | " -R Emit section relative symbol CRCs\n" | ||
756 | #endif /* __GNU_LIBRARY__ */ | 761 | #endif /* __GNU_LIBRARY__ */ |
757 | , stderr); | 762 | , stderr); |
758 | } | 763 | } |
@@ -774,13 +779,14 @@ int main(int argc, char **argv) | |||
774 | {"preserve", 0, 0, 'p'}, | 779 | {"preserve", 0, 0, 'p'}, |
775 | {"version", 0, 0, 'V'}, | 780 | {"version", 0, 0, 'V'}, |
776 | {"help", 0, 0, 'h'}, | 781 | {"help", 0, 0, 'h'}, |
782 | {"relative-crc", 0, 0, 'R'}, | ||
777 | {0, 0, 0, 0} | 783 | {0, 0, 0, 0} |
778 | }; | 784 | }; |
779 | 785 | ||
780 | while ((o = getopt_long(argc, argv, "s:dwqVDr:T:ph", | 786 | while ((o = getopt_long(argc, argv, "s:dwqVDr:T:phR", |
781 | &long_opts[0], NULL)) != EOF) | 787 | &long_opts[0], NULL)) != EOF) |
782 | #else /* __GNU_LIBRARY__ */ | 788 | #else /* __GNU_LIBRARY__ */ |
783 | while ((o = getopt(argc, argv, "s:dwqVDr:T:ph")) != EOF) | 789 | while ((o = getopt(argc, argv, "s:dwqVDr:T:phR")) != EOF) |
784 | #endif /* __GNU_LIBRARY__ */ | 790 | #endif /* __GNU_LIBRARY__ */ |
785 | switch (o) { | 791 | switch (o) { |
786 | case 's': | 792 | case 's': |
@@ -823,6 +829,9 @@ int main(int argc, char **argv) | |||
823 | case 'h': | 829 | case 'h': |
824 | genksyms_usage(); | 830 | genksyms_usage(); |
825 | return 0; | 831 | return 0; |
832 | case 'R': | ||
833 | flag_rel_crcs = 1; | ||
834 | break; | ||
826 | default: | 835 | default: |
827 | genksyms_usage(); | 836 | genksyms_usage(); |
828 | return 1; | 837 | return 1; |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 299b92ca1ae0..5d554419170b 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -219,6 +219,10 @@ static int symbol_valid(struct sym_entry *s) | |||
219 | "_SDA2_BASE_", /* ppc */ | 219 | "_SDA2_BASE_", /* ppc */ |
220 | NULL }; | 220 | NULL }; |
221 | 221 | ||
222 | static char *special_prefixes[] = { | ||
223 | "__crc_", /* modversions */ | ||
224 | NULL }; | ||
225 | |||
222 | static char *special_suffixes[] = { | 226 | static char *special_suffixes[] = { |
223 | "_veneer", /* arm */ | 227 | "_veneer", /* arm */ |
224 | "_from_arm", /* arm */ | 228 | "_from_arm", /* arm */ |
@@ -259,6 +263,14 @@ static int symbol_valid(struct sym_entry *s) | |||
259 | if (strcmp(sym_name, special_symbols[i]) == 0) | 263 | if (strcmp(sym_name, special_symbols[i]) == 0) |
260 | return 0; | 264 | return 0; |
261 | 265 | ||
266 | for (i = 0; special_prefixes[i]; i++) { | ||
267 | int l = strlen(special_prefixes[i]); | ||
268 | |||
269 | if (l <= strlen(sym_name) && | ||
270 | strncmp(sym_name, special_prefixes[i], l) == 0) | ||
271 | return 0; | ||
272 | } | ||
273 | |||
262 | for (i = 0; special_suffixes[i]; i++) { | 274 | for (i = 0; special_suffixes[i]; i++) { |
263 | int l = strlen(sym_name) - strlen(special_suffixes[i]); | 275 | int l = strlen(sym_name) - strlen(special_suffixes[i]); |
264 | 276 | ||
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 29c89a6bad3d..4dedd0d3d3a7 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -621,6 +621,16 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
621 | if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { | 621 | if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { |
622 | is_crc = true; | 622 | is_crc = true; |
623 | crc = (unsigned int) sym->st_value; | 623 | crc = (unsigned int) sym->st_value; |
624 | if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS) { | ||
625 | unsigned int *crcp; | ||
626 | |||
627 | /* symbol points to the CRC in the ELF object */ | ||
628 | crcp = (void *)info->hdr + sym->st_value + | ||
629 | info->sechdrs[sym->st_shndx].sh_offset - | ||
630 | (info->hdr->e_type != ET_REL ? | ||
631 | info->sechdrs[sym->st_shndx].sh_addr : 0); | ||
632 | crc = *crcp; | ||
633 | } | ||
624 | sym_update_crc(symname + strlen(CRC_PFX), mod, crc, | 634 | sym_update_crc(symname + strlen(CRC_PFX), mod, crc, |
625 | export); | 635 | export); |
626 | } | 636 | } |
diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c index 5e0dea2cdc01..039636ffb6c8 100644 --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c | |||
@@ -150,9 +150,9 @@ int arch_decode_instruction(struct elf *elf, struct section *sec, | |||
150 | *type = INSN_RETURN; | 150 | *type = INSN_RETURN; |
151 | break; | 151 | break; |
152 | 152 | ||
153 | case 0xc5: /* iret */ | ||
154 | case 0xca: /* retf */ | 153 | case 0xca: /* retf */ |
155 | case 0xcb: /* retf */ | 154 | case 0xcb: /* retf */ |
155 | case 0xcf: /* iret */ | ||
156 | *type = INSN_CONTEXT_SWITCH; | 156 | *type = INSN_CONTEXT_SWITCH; |
157 | break; | 157 | break; |
158 | 158 | ||