5412 lines
184 KiB
Diff
5412 lines
184 KiB
Diff
diff --git a/Documentation/arm64/tagged-address-abi.rst b/Documentation/arm64/tagged-address-abi.rst
|
|
index 4a9d9c794ee5d..7d255249094d0 100644
|
|
--- a/Documentation/arm64/tagged-address-abi.rst
|
|
+++ b/Documentation/arm64/tagged-address-abi.rst
|
|
@@ -45,14 +45,24 @@ how the user addresses are used by the kernel:
|
|
|
|
1. User addresses not accessed by the kernel but used for address space
|
|
management (e.g. ``mprotect()``, ``madvise()``). The use of valid
|
|
- tagged pointers in this context is allowed with the exception of
|
|
- ``brk()``, ``mmap()`` and the ``new_address`` argument to
|
|
- ``mremap()`` as these have the potential to alias with existing
|
|
- user addresses.
|
|
-
|
|
- NOTE: This behaviour changed in v5.6 and so some earlier kernels may
|
|
- incorrectly accept valid tagged pointers for the ``brk()``,
|
|
- ``mmap()`` and ``mremap()`` system calls.
|
|
+ tagged pointers in this context is allowed with these exceptions:
|
|
+
|
|
+ - ``brk()``, ``mmap()`` and the ``new_address`` argument to
|
|
+ ``mremap()`` as these have the potential to alias with existing
|
|
+ user addresses.
|
|
+
|
|
+ NOTE: This behaviour changed in v5.6 and so some earlier kernels may
|
|
+ incorrectly accept valid tagged pointers for the ``brk()``,
|
|
+ ``mmap()`` and ``mremap()`` system calls.
|
|
+
|
|
+ - The ``range.start``, ``start`` and ``dst`` arguments to the
|
|
+ ``UFFDIO_*`` ``ioctl()``s used on a file descriptor obtained from
|
|
+ ``userfaultfd()``, as fault addresses subsequently obtained by reading
|
|
+ the file descriptor will be untagged, which may otherwise confuse
|
|
+ tag-unaware programs.
|
|
+
|
|
+ NOTE: This behaviour changed in v5.14 and so some earlier kernels may
|
|
+ incorrectly accept valid tagged pointers for this system call.
|
|
|
|
2. User addresses accessed by the kernel (e.g. ``write()``). This ABI
|
|
relaxation is disabled by default and the application thread needs to
|
|
diff --git a/Documentation/driver-api/early-userspace/early_userspace_support.rst b/Documentation/driver-api/early-userspace/early_userspace_support.rst
|
|
index 8a58c61932ff5..61bdeac1bae54 100644
|
|
--- a/Documentation/driver-api/early-userspace/early_userspace_support.rst
|
|
+++ b/Documentation/driver-api/early-userspace/early_userspace_support.rst
|
|
@@ -69,17 +69,17 @@ early userspace image can be built by an unprivileged user.
|
|
|
|
As a technical note, when directories and files are specified, the
|
|
entire CONFIG_INITRAMFS_SOURCE is passed to
|
|
-usr/gen_initramfs_list.sh. This means that CONFIG_INITRAMFS_SOURCE
|
|
+usr/gen_initramfs.sh. This means that CONFIG_INITRAMFS_SOURCE
|
|
can really be interpreted as any legal argument to
|
|
-gen_initramfs_list.sh. If a directory is specified as an argument then
|
|
+gen_initramfs.sh. If a directory is specified as an argument then
|
|
the contents are scanned, uid/gid translation is performed, and
|
|
usr/gen_init_cpio file directives are output. If a directory is
|
|
-specified as an argument to usr/gen_initramfs_list.sh then the
|
|
+specified as an argument to usr/gen_initramfs.sh then the
|
|
contents of the file are simply copied to the output. All of the output
|
|
directives from directory scanning and file contents copying are
|
|
processed by usr/gen_init_cpio.
|
|
|
|
-See also 'usr/gen_initramfs_list.sh -h'.
|
|
+See also 'usr/gen_initramfs.sh -h'.
|
|
|
|
Where's this all leading?
|
|
=========================
|
|
diff --git a/Documentation/filesystems/ramfs-rootfs-initramfs.rst b/Documentation/filesystems/ramfs-rootfs-initramfs.rst
|
|
index 4598b0d90b607..164960631925d 100644
|
|
--- a/Documentation/filesystems/ramfs-rootfs-initramfs.rst
|
|
+++ b/Documentation/filesystems/ramfs-rootfs-initramfs.rst
|
|
@@ -170,7 +170,7 @@ Documentation/driver-api/early-userspace/early_userspace_support.rst for more de
|
|
The kernel does not depend on external cpio tools. If you specify a
|
|
directory instead of a configuration file, the kernel's build infrastructure
|
|
creates a configuration file from that directory (usr/Makefile calls
|
|
-usr/gen_initramfs_list.sh), and proceeds to package up that directory
|
|
+usr/gen_initramfs.sh), and proceeds to package up that directory
|
|
using the config file (by feeding it to usr/gen_init_cpio, which is created
|
|
from usr/gen_init_cpio.c). The kernel's build-time cpio creation code is
|
|
entirely self-contained, and the kernel's boot-time extractor is also
|
|
diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst
|
|
index 4abcfff15e384..4822a058a81d7 100644
|
|
--- a/Documentation/networking/ip-sysctl.rst
|
|
+++ b/Documentation/networking/ip-sysctl.rst
|
|
@@ -751,7 +751,7 @@ tcp_fastopen_blackhole_timeout_sec - INTEGER
|
|
initial value when the blackhole issue goes away.
|
|
0 to disable the blackhole detection.
|
|
|
|
- By default, it is set to 1hr.
|
|
+ By default, it is set to 0 (feature is disabled).
|
|
|
|
tcp_fastopen_key - list of comma separated 32-digit hexadecimal INTEGERs
|
|
The list consists of a primary key and an optional backup key. The
|
|
diff --git a/Documentation/trace/histogram.rst b/Documentation/trace/histogram.rst
|
|
index b71e09f745c3d..f99be8062bc82 100644
|
|
--- a/Documentation/trace/histogram.rst
|
|
+++ b/Documentation/trace/histogram.rst
|
|
@@ -191,7 +191,7 @@ Documentation written by Tom Zanussi
|
|
with the event, in nanoseconds. May be
|
|
modified by .usecs to have timestamps
|
|
interpreted as microseconds.
|
|
- cpu int the cpu on which the event occurred.
|
|
+ common_cpu int the cpu on which the event occurred.
|
|
====================== ==== =======================================
|
|
|
|
Extended error information
|
|
diff --git a/Makefile b/Makefile
|
|
index aab88519cb0ed..eb01d3028b020 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -1,7 +1,7 @@
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
VERSION = 5
|
|
PATCHLEVEL = 10
|
|
-SUBLEVEL = 53
|
|
+SUBLEVEL = 54
|
|
EXTRAVERSION =
|
|
NAME = Dare mighty things
|
|
|
|
diff --git a/arch/nds32/mm/mmap.c b/arch/nds32/mm/mmap.c
|
|
index c206b31ce07ac..1bdf5e7d1b438 100644
|
|
--- a/arch/nds32/mm/mmap.c
|
|
+++ b/arch/nds32/mm/mmap.c
|
|
@@ -59,7 +59,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
|
|
|
|
vma = find_vma(mm, addr);
|
|
if (TASK_SIZE - len >= addr &&
|
|
- (!vma || addr + len <= vma->vm_start))
|
|
+ (!vma || addr + len <= vm_start_gap(vma)))
|
|
return addr;
|
|
}
|
|
|
|
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
|
|
index 2325b7a6e95f8..bd7350a608d4b 100644
|
|
--- a/arch/powerpc/kvm/book3s_hv.c
|
|
+++ b/arch/powerpc/kvm/book3s_hv.c
|
|
@@ -2366,8 +2366,10 @@ static int kvmppc_core_vcpu_create_hv(struct kvm_vcpu *vcpu)
|
|
HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP | HFSCR_PREFIX;
|
|
if (cpu_has_feature(CPU_FTR_HVMODE)) {
|
|
vcpu->arch.hfscr &= mfspr(SPRN_HFSCR);
|
|
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
|
|
if (cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST))
|
|
vcpu->arch.hfscr |= HFSCR_TM;
|
|
+#endif
|
|
}
|
|
if (cpu_has_feature(CPU_FTR_TM_COMP))
|
|
vcpu->arch.hfscr |= HFSCR_TM;
|
|
diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c
|
|
index 065738819db9b..a5f1ae892ba68 100644
|
|
--- a/arch/powerpc/kvm/book3s_hv_nested.c
|
|
+++ b/arch/powerpc/kvm/book3s_hv_nested.c
|
|
@@ -232,6 +232,9 @@ long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu)
|
|
if (vcpu->kvm->arch.l1_ptcr == 0)
|
|
return H_NOT_AVAILABLE;
|
|
|
|
+ if (MSR_TM_TRANSACTIONAL(vcpu->arch.shregs.msr))
|
|
+ return H_BAD_MODE;
|
|
+
|
|
/* copy parameters in */
|
|
hv_ptr = kvmppc_get_gpr(vcpu, 4);
|
|
regs_ptr = kvmppc_get_gpr(vcpu, 5);
|
|
@@ -254,6 +257,23 @@ long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu)
|
|
if (l2_hv.vcpu_token >= NR_CPUS)
|
|
return H_PARAMETER;
|
|
|
|
+ /*
|
|
+ * L1 must have set up a suspended state to enter the L2 in a
|
|
+ * transactional state, and only in that case. These have to be
|
|
+ * filtered out here to prevent causing a TM Bad Thing in the
|
|
+ * host HRFID. We could synthesize a TM Bad Thing back to the L1
|
|
+ * here but there doesn't seem like much point.
|
|
+ */
|
|
+ if (MSR_TM_SUSPENDED(vcpu->arch.shregs.msr)) {
|
|
+ if (!MSR_TM_ACTIVE(l2_regs.msr))
|
|
+ return H_BAD_MODE;
|
|
+ } else {
|
|
+ if (l2_regs.msr & MSR_TS_MASK)
|
|
+ return H_BAD_MODE;
|
|
+ if (WARN_ON_ONCE(vcpu->arch.shregs.msr & MSR_TS_MASK))
|
|
+ return H_BAD_MODE;
|
|
+ }
|
|
+
|
|
/* translate lpid */
|
|
l2 = kvmhv_get_nested(vcpu->kvm, l2_hv.lpid, true);
|
|
if (!l2)
|
|
diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c
|
|
index c5e677508d3b2..0f847f1e5ddd0 100644
|
|
--- a/arch/powerpc/kvm/book3s_rtas.c
|
|
+++ b/arch/powerpc/kvm/book3s_rtas.c
|
|
@@ -242,6 +242,17 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu)
|
|
* value so we can restore it on the way out.
|
|
*/
|
|
orig_rets = args.rets;
|
|
+ if (be32_to_cpu(args.nargs) >= ARRAY_SIZE(args.args)) {
|
|
+ /*
|
|
+ * Don't overflow our args array: ensure there is room for
|
|
+ * at least rets[0] (even if the call specifies 0 nret).
|
|
+ *
|
|
+ * Each handler must then check for the correct nargs and nret
|
|
+ * values, but they may always return failure in rets[0].
|
|
+ */
|
|
+ rc = -EINVAL;
|
|
+ goto fail;
|
|
+ }
|
|
args.rets = &args.args[be32_to_cpu(args.nargs)];
|
|
|
|
mutex_lock(&vcpu->kvm->arch.rtas_token_lock);
|
|
@@ -269,9 +280,17 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu)
|
|
fail:
|
|
/*
|
|
* We only get here if the guest has called RTAS with a bogus
|
|
- * args pointer. That means we can't get to the args, and so we
|
|
- * can't fail the RTAS call. So fail right out to userspace,
|
|
- * which should kill the guest.
|
|
+ * args pointer or nargs/nret values that would overflow the
|
|
+ * array. That means we can't get to the args, and so we can't
|
|
+ * fail the RTAS call. So fail right out to userspace, which
|
|
+ * should kill the guest.
|
|
+ *
|
|
+ * SLOF should actually pass the hcall return value from the
|
|
+ * rtas handler call in r3, so enter_rtas could be modified to
|
|
+ * return a failure indication in r3 and we could return such
|
|
+ * errors to the guest rather than failing to host userspace.
|
|
+ * However old guests that don't test for failure could then
|
|
+ * continue silently after errors, so for now we won't do this.
|
|
*/
|
|
return rc;
|
|
}
|
|
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
|
|
index 32fa0fa3d4ff5..543db9157f3b1 100644
|
|
--- a/arch/powerpc/kvm/powerpc.c
|
|
+++ b/arch/powerpc/kvm/powerpc.c
|
|
@@ -2041,9 +2041,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
|
|
{
|
|
struct kvm_enable_cap cap;
|
|
r = -EFAULT;
|
|
- vcpu_load(vcpu);
|
|
if (copy_from_user(&cap, argp, sizeof(cap)))
|
|
goto out;
|
|
+ vcpu_load(vcpu);
|
|
r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap);
|
|
vcpu_put(vcpu);
|
|
break;
|
|
@@ -2067,9 +2067,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
|
|
case KVM_DIRTY_TLB: {
|
|
struct kvm_dirty_tlb dirty;
|
|
r = -EFAULT;
|
|
- vcpu_load(vcpu);
|
|
if (copy_from_user(&dirty, argp, sizeof(dirty)))
|
|
goto out;
|
|
+ vcpu_load(vcpu);
|
|
r = kvm_vcpu_ioctl_dirty_tlb(vcpu, &dirty);
|
|
vcpu_put(vcpu);
|
|
break;
|
|
diff --git a/arch/s390/boot/text_dma.S b/arch/s390/boot/text_dma.S
|
|
index f7c77cd518f2b..5ff5fee028016 100644
|
|
--- a/arch/s390/boot/text_dma.S
|
|
+++ b/arch/s390/boot/text_dma.S
|
|
@@ -9,16 +9,6 @@
|
|
#include <asm/errno.h>
|
|
#include <asm/sigp.h>
|
|
|
|
-#ifdef CC_USING_EXPOLINE
|
|
- .pushsection .dma.text.__s390_indirect_jump_r14,"axG"
|
|
-__dma__s390_indirect_jump_r14:
|
|
- larl %r1,0f
|
|
- ex 0,0(%r1)
|
|
- j .
|
|
-0: br %r14
|
|
- .popsection
|
|
-#endif
|
|
-
|
|
.section .dma.text,"ax"
|
|
/*
|
|
* Simplified version of expoline thunk. The normal thunks can not be used here,
|
|
@@ -27,11 +17,10 @@ __dma__s390_indirect_jump_r14:
|
|
* affects a few functions that are not performance-relevant.
|
|
*/
|
|
.macro BR_EX_DMA_r14
|
|
-#ifdef CC_USING_EXPOLINE
|
|
- jg __dma__s390_indirect_jump_r14
|
|
-#else
|
|
- br %r14
|
|
-#endif
|
|
+ larl %r1,0f
|
|
+ ex 0,0(%r1)
|
|
+ j .
|
|
+0: br %r14
|
|
.endm
|
|
|
|
/*
|
|
diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h
|
|
index 68d362f8d6c17..c72c179a5aae9 100644
|
|
--- a/arch/s390/include/asm/ftrace.h
|
|
+++ b/arch/s390/include/asm/ftrace.h
|
|
@@ -27,6 +27,7 @@ void ftrace_caller(void);
|
|
|
|
extern char ftrace_graph_caller_end;
|
|
extern unsigned long ftrace_plt;
|
|
+extern void *ftrace_func;
|
|
|
|
struct dyn_arch_ftrace { };
|
|
|
|
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
|
|
index b388e87a08bf9..923ecccae3061 100644
|
|
--- a/arch/s390/kernel/ftrace.c
|
|
+++ b/arch/s390/kernel/ftrace.c
|
|
@@ -57,6 +57,7 @@
|
|
* > brasl %r0,ftrace_caller # offset 0
|
|
*/
|
|
|
|
+void *ftrace_func __read_mostly = ftrace_stub;
|
|
unsigned long ftrace_plt;
|
|
|
|
static inline void ftrace_generate_orig_insn(struct ftrace_insn *insn)
|
|
@@ -120,6 +121,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
|
|
|
|
int ftrace_update_ftrace_func(ftrace_func_t func)
|
|
{
|
|
+ ftrace_func = func;
|
|
return 0;
|
|
}
|
|
|
|
diff --git a/arch/s390/kernel/mcount.S b/arch/s390/kernel/mcount.S
|
|
index 7458dcfd64642..be9e85e7558ae 100644
|
|
--- a/arch/s390/kernel/mcount.S
|
|
+++ b/arch/s390/kernel/mcount.S
|
|
@@ -67,13 +67,13 @@ ENTRY(ftrace_caller)
|
|
#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
|
|
aghik %r2,%r0,-MCOUNT_INSN_SIZE
|
|
lgrl %r4,function_trace_op
|
|
- lgrl %r1,ftrace_trace_function
|
|
+ lgrl %r1,ftrace_func
|
|
#else
|
|
lgr %r2,%r0
|
|
aghi %r2,-MCOUNT_INSN_SIZE
|
|
larl %r4,function_trace_op
|
|
lg %r4,0(%r4)
|
|
- larl %r1,ftrace_trace_function
|
|
+ larl %r1,ftrace_func
|
|
lg %r1,0(%r1)
|
|
#endif
|
|
lgr %r3,%r14
|
|
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
|
|
index 0a41827928769..fc44dce59536e 100644
|
|
--- a/arch/s390/net/bpf_jit_comp.c
|
|
+++ b/arch/s390/net/bpf_jit_comp.c
|
|
@@ -112,7 +112,7 @@ static inline void reg_set_seen(struct bpf_jit *jit, u32 b1)
|
|
{
|
|
u32 r1 = reg2hex[b1];
|
|
|
|
- if (!jit->seen_reg[r1] && r1 >= 6 && r1 <= 15)
|
|
+ if (r1 >= 6 && r1 <= 15 && !jit->seen_reg[r1])
|
|
jit->seen_reg[r1] = 1;
|
|
}
|
|
|
|
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
|
|
index 7a3fbf3b796e6..41b0dc37720e0 100644
|
|
--- a/arch/x86/kvm/cpuid.c
|
|
+++ b/arch/x86/kvm/cpuid.c
|
|
@@ -684,7 +684,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
|
|
|
|
edx.split.num_counters_fixed = min(cap.num_counters_fixed, MAX_FIXED_COUNTERS);
|
|
edx.split.bit_width_fixed = cap.bit_width_fixed;
|
|
- edx.split.anythread_deprecated = 1;
|
|
+ if (cap.version)
|
|
+ edx.split.anythread_deprecated = 1;
|
|
edx.split.reserved1 = 0;
|
|
edx.split.reserved2 = 0;
|
|
|
|
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
|
|
index edf1558c11052..b5ea34c340ccc 100644
|
|
--- a/drivers/acpi/Kconfig
|
|
+++ b/drivers/acpi/Kconfig
|
|
@@ -359,7 +359,7 @@ config ACPI_TABLE_UPGRADE
|
|
config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD
|
|
bool "Override ACPI tables from built-in initrd"
|
|
depends on ACPI_TABLE_UPGRADE
|
|
- depends on INITRAMFS_SOURCE!="" && INITRAMFS_COMPRESSION=""
|
|
+ depends on INITRAMFS_SOURCE!="" && INITRAMFS_COMPRESSION_NONE
|
|
help
|
|
This option provides functionality to override arbitrary ACPI tables
|
|
from built-in uncompressed initrd.
|
|
diff --git a/drivers/base/core.c b/drivers/base/core.c
|
|
index 8b3c3fcf35a96..1157f9aea9c04 100644
|
|
--- a/drivers/base/core.c
|
|
+++ b/drivers/base/core.c
|
|
@@ -449,8 +449,10 @@ static void devlink_remove_symlinks(struct device *dev,
|
|
return;
|
|
}
|
|
|
|
- snprintf(buf, len, "supplier:%s:%s", dev_bus_name(sup), dev_name(sup));
|
|
- sysfs_remove_link(&con->kobj, buf);
|
|
+ if (device_is_registered(con)) {
|
|
+ snprintf(buf, len, "supplier:%s:%s", dev_bus_name(sup), dev_name(sup));
|
|
+ sysfs_remove_link(&con->kobj, buf);
|
|
+ }
|
|
snprintf(buf, len, "consumer:%s:%s", dev_bus_name(con), dev_name(con));
|
|
sysfs_remove_link(&sup->kobj, buf);
|
|
kfree(buf);
|
|
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
|
|
index f84128abade31..340b1df365f72 100644
|
|
--- a/drivers/block/rbd.c
|
|
+++ b/drivers/block/rbd.c
|
|
@@ -4147,8 +4147,6 @@ again:
|
|
|
|
static bool rbd_quiesce_lock(struct rbd_device *rbd_dev)
|
|
{
|
|
- bool need_wait;
|
|
-
|
|
dout("%s rbd_dev %p\n", __func__, rbd_dev);
|
|
lockdep_assert_held_write(&rbd_dev->lock_rwsem);
|
|
|
|
@@ -4160,11 +4158,11 @@ static bool rbd_quiesce_lock(struct rbd_device *rbd_dev)
|
|
*/
|
|
rbd_dev->lock_state = RBD_LOCK_STATE_RELEASING;
|
|
rbd_assert(!completion_done(&rbd_dev->releasing_wait));
|
|
- need_wait = !list_empty(&rbd_dev->running_list);
|
|
- downgrade_write(&rbd_dev->lock_rwsem);
|
|
- if (need_wait)
|
|
- wait_for_completion(&rbd_dev->releasing_wait);
|
|
- up_read(&rbd_dev->lock_rwsem);
|
|
+ if (list_empty(&rbd_dev->running_list))
|
|
+ return true;
|
|
+
|
|
+ up_write(&rbd_dev->lock_rwsem);
|
|
+ wait_for_completion(&rbd_dev->releasing_wait);
|
|
|
|
down_write(&rbd_dev->lock_rwsem);
|
|
if (rbd_dev->lock_state != RBD_LOCK_STATE_RELEASING)
|
|
@@ -4250,15 +4248,11 @@ static void rbd_handle_acquired_lock(struct rbd_device *rbd_dev, u8 struct_v,
|
|
if (!rbd_cid_equal(&cid, &rbd_empty_cid)) {
|
|
down_write(&rbd_dev->lock_rwsem);
|
|
if (rbd_cid_equal(&cid, &rbd_dev->owner_cid)) {
|
|
- /*
|
|
- * we already know that the remote client is
|
|
- * the owner
|
|
- */
|
|
- up_write(&rbd_dev->lock_rwsem);
|
|
- return;
|
|
+ dout("%s rbd_dev %p cid %llu-%llu == owner_cid\n",
|
|
+ __func__, rbd_dev, cid.gid, cid.handle);
|
|
+ } else {
|
|
+ rbd_set_owner_cid(rbd_dev, &cid);
|
|
}
|
|
-
|
|
- rbd_set_owner_cid(rbd_dev, &cid);
|
|
downgrade_write(&rbd_dev->lock_rwsem);
|
|
} else {
|
|
down_read(&rbd_dev->lock_rwsem);
|
|
@@ -4283,14 +4277,12 @@ static void rbd_handle_released_lock(struct rbd_device *rbd_dev, u8 struct_v,
|
|
if (!rbd_cid_equal(&cid, &rbd_empty_cid)) {
|
|
down_write(&rbd_dev->lock_rwsem);
|
|
if (!rbd_cid_equal(&cid, &rbd_dev->owner_cid)) {
|
|
- dout("%s rbd_dev %p unexpected owner, cid %llu-%llu != owner_cid %llu-%llu\n",
|
|
+ dout("%s rbd_dev %p cid %llu-%llu != owner_cid %llu-%llu\n",
|
|
__func__, rbd_dev, cid.gid, cid.handle,
|
|
rbd_dev->owner_cid.gid, rbd_dev->owner_cid.handle);
|
|
- up_write(&rbd_dev->lock_rwsem);
|
|
- return;
|
|
+ } else {
|
|
+ rbd_set_owner_cid(rbd_dev, &rbd_empty_cid);
|
|
}
|
|
-
|
|
- rbd_set_owner_cid(rbd_dev, &rbd_empty_cid);
|
|
downgrade_write(&rbd_dev->lock_rwsem);
|
|
} else {
|
|
down_read(&rbd_dev->lock_rwsem);
|
|
diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
|
|
index d86ce1a06b75c..614dd287cb4ff 100644
|
|
--- a/drivers/bus/mhi/core/main.c
|
|
+++ b/drivers/bus/mhi/core/main.c
|
|
@@ -706,11 +706,18 @@ static void mhi_process_cmd_completion(struct mhi_controller *mhi_cntrl,
|
|
cmd_pkt = mhi_to_virtual(mhi_ring, ptr);
|
|
|
|
chan = MHI_TRE_GET_CMD_CHID(cmd_pkt);
|
|
- mhi_chan = &mhi_cntrl->mhi_chan[chan];
|
|
- write_lock_bh(&mhi_chan->lock);
|
|
- mhi_chan->ccs = MHI_TRE_GET_EV_CODE(tre);
|
|
- complete(&mhi_chan->completion);
|
|
- write_unlock_bh(&mhi_chan->lock);
|
|
+
|
|
+ if (chan < mhi_cntrl->max_chan &&
|
|
+ mhi_cntrl->mhi_chan[chan].configured) {
|
|
+ mhi_chan = &mhi_cntrl->mhi_chan[chan];
|
|
+ write_lock_bh(&mhi_chan->lock);
|
|
+ mhi_chan->ccs = MHI_TRE_GET_EV_CODE(tre);
|
|
+ complete(&mhi_chan->completion);
|
|
+ write_unlock_bh(&mhi_chan->lock);
|
|
+ } else {
|
|
+ dev_err(&mhi_cntrl->mhi_dev->dev,
|
|
+ "Completion packet for invalid channel ID: %d\n", chan);
|
|
+ }
|
|
|
|
mhi_del_ring_element(mhi_cntrl, mhi_ring);
|
|
}
|
|
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
|
|
index 4b7ee3fa9224f..847f33ffc4aed 100644
|
|
--- a/drivers/firmware/efi/efi.c
|
|
+++ b/drivers/firmware/efi/efi.c
|
|
@@ -896,6 +896,7 @@ static int __init efi_memreserve_map_root(void)
|
|
static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size)
|
|
{
|
|
struct resource *res, *parent;
|
|
+ int ret;
|
|
|
|
res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
|
|
if (!res)
|
|
@@ -908,7 +909,17 @@ static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size)
|
|
|
|
/* we expect a conflict with a 'System RAM' region */
|
|
parent = request_resource_conflict(&iomem_resource, res);
|
|
- return parent ? request_resource(parent, res) : 0;
|
|
+ ret = parent ? request_resource(parent, res) : 0;
|
|
+
|
|
+ /*
|
|
+ * Given that efi_mem_reserve_iomem() can be called at any
|
|
+ * time, only call memblock_reserve() if the architecture
|
|
+ * keeps the infrastructure around.
|
|
+ */
|
|
+ if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK) && !ret)
|
|
+ memblock_reserve(addr, size);
|
|
+
|
|
+ return ret;
|
|
}
|
|
|
|
int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
|
|
diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
|
|
index c1955d320fecd..8f665678e9e39 100644
|
|
--- a/drivers/firmware/efi/tpm.c
|
|
+++ b/drivers/firmware/efi/tpm.c
|
|
@@ -62,9 +62,11 @@ int __init efi_tpm_eventlog_init(void)
|
|
tbl_size = sizeof(*log_tbl) + log_tbl->size;
|
|
memblock_reserve(efi.tpm_log, tbl_size);
|
|
|
|
- if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR ||
|
|
- log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
|
|
- pr_warn(FW_BUG "TPM Final Events table missing or invalid\n");
|
|
+ if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) {
|
|
+ pr_info("TPM Final Events table not present\n");
|
|
+ goto out;
|
|
+ } else if (log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
|
|
+ pr_warn(FW_BUG "TPM Final Events table invalid\n");
|
|
goto out;
|
|
}
|
|
|
|
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
|
|
index fc8da5fed779b..0e3ff5c3766ed 100644
|
|
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
|
|
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
|
|
@@ -3137,6 +3137,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_3[] =
|
|
SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER7_SELECT, 0xf0f001ff, 0x00000000),
|
|
SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER8_SELECT, 0xf0f001ff, 0x00000000),
|
|
SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER9_SELECT, 0xf0f001ff, 0x00000000),
|
|
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSX_DEBUG_1, 0x00010000, 0x00010020),
|
|
SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000),
|
|
SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffbfffff, 0x00a00000)
|
|
};
|
|
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
|
|
index ae647be4a49fb..4606cc938b36d 100644
|
|
--- a/drivers/gpu/drm/drm_ioctl.c
|
|
+++ b/drivers/gpu/drm/drm_ioctl.c
|
|
@@ -827,6 +827,9 @@ long drm_ioctl(struct file *filp,
|
|
if (drm_dev_is_unplugged(dev))
|
|
return -ENODEV;
|
|
|
|
+ if (DRM_IOCTL_TYPE(cmd) != DRM_IOCTL_BASE)
|
|
+ return -ENOTTY;
|
|
+
|
|
is_driver_ioctl = nr >= DRM_COMMAND_BASE && nr < DRM_COMMAND_END;
|
|
|
|
if (is_driver_ioctl) {
|
|
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
|
|
index eb342a7599438..0b1ea29dcffac 100644
|
|
--- a/drivers/gpu/drm/i915/gvt/handlers.c
|
|
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
|
|
@@ -1728,6 +1728,21 @@ static int elsp_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
|
|
if (drm_WARN_ON(&i915->drm, !engine))
|
|
return -EINVAL;
|
|
|
|
+ /*
|
|
+ * Due to d3_entered is used to indicate skipping PPGTT invalidation on
|
|
+ * vGPU reset, it's set on D0->D3 on PCI config write, and cleared after
|
|
+ * vGPU reset if in resuming.
|
|
+ * In S0ix exit, the device power state also transite from D3 to D0 as
|
|
+ * S3 resume, but no vGPU reset (triggered by QEMU devic model). After
|
|
+ * S0ix exit, all engines continue to work. However the d3_entered
|
|
+ * remains set which will break next vGPU reset logic (miss the expected
|
|
+ * PPGTT invalidation).
|
|
+ * Engines can only work in D0. Thus the 1st elsp write gives GVT a
|
|
+ * chance to clear d3_entered.
|
|
+ */
|
|
+ if (vgpu->d3_entered)
|
|
+ vgpu->d3_entered = false;
|
|
+
|
|
execlist = &vgpu->submission.execlist[engine->id];
|
|
|
|
execlist->elsp_dwords.data[3 - execlist->elsp_dwords.index] = data;
|
|
diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
|
|
index 5e9ccefb88f62..bbdd086be7f59 100644
|
|
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
|
|
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
|
|
@@ -447,7 +447,6 @@ static int rpi_touchscreen_remove(struct i2c_client *i2c)
|
|
drm_panel_remove(&ts->base);
|
|
|
|
mipi_dsi_device_unregister(ts->dsi);
|
|
- kfree(ts->dsi);
|
|
|
|
return 0;
|
|
}
|
|
diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c
|
|
index f9f94f47d76b6..e1a8c611d01b4 100644
|
|
--- a/drivers/media/pci/ngene/ngene-core.c
|
|
+++ b/drivers/media/pci/ngene/ngene-core.c
|
|
@@ -385,7 +385,7 @@ static int ngene_command_config_free_buf(struct ngene *dev, u8 *config)
|
|
|
|
com.cmd.hdr.Opcode = CMD_CONFIGURE_FREE_BUFFER;
|
|
com.cmd.hdr.Length = 6;
|
|
- memcpy(&com.cmd.ConfigureBuffers.config, config, 6);
|
|
+ memcpy(&com.cmd.ConfigureFreeBuffers.config, config, 6);
|
|
com.in_len = 6;
|
|
com.out_len = 0;
|
|
|
|
diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h
|
|
index 84f04e0e0cb9a..3d296f1998a1a 100644
|
|
--- a/drivers/media/pci/ngene/ngene.h
|
|
+++ b/drivers/media/pci/ngene/ngene.h
|
|
@@ -407,12 +407,14 @@ enum _BUFFER_CONFIGS {
|
|
|
|
struct FW_CONFIGURE_FREE_BUFFERS {
|
|
struct FW_HEADER hdr;
|
|
- u8 UVI1_BufferLength;
|
|
- u8 UVI2_BufferLength;
|
|
- u8 TVO_BufferLength;
|
|
- u8 AUD1_BufferLength;
|
|
- u8 AUD2_BufferLength;
|
|
- u8 TVA_BufferLength;
|
|
+ struct {
|
|
+ u8 UVI1_BufferLength;
|
|
+ u8 UVI2_BufferLength;
|
|
+ u8 TVO_BufferLength;
|
|
+ u8 AUD1_BufferLength;
|
|
+ u8 AUD2_BufferLength;
|
|
+ u8 TVA_BufferLength;
|
|
+ } __packed config;
|
|
} __attribute__ ((__packed__));
|
|
|
|
struct FW_CONFIGURE_UART {
|
|
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
|
|
index 7a6f01ace78ac..305ffad131a29 100644
|
|
--- a/drivers/misc/eeprom/at24.c
|
|
+++ b/drivers/misc/eeprom/at24.c
|
|
@@ -714,23 +714,20 @@ static int at24_probe(struct i2c_client *client)
|
|
}
|
|
|
|
/*
|
|
- * If the 'label' property is not present for the AT24 EEPROM,
|
|
- * then nvmem_config.id is initialised to NVMEM_DEVID_AUTO,
|
|
- * and this will append the 'devid' to the name of the NVMEM
|
|
- * device. This is purely legacy and the AT24 driver has always
|
|
- * defaulted to this. However, if the 'label' property is
|
|
- * present then this means that the name is specified by the
|
|
- * firmware and this name should be used verbatim and so it is
|
|
- * not necessary to append the 'devid'.
|
|
+ * We initialize nvmem_config.id to NVMEM_DEVID_AUTO even if the
|
|
+ * label property is set as some platform can have multiple eeproms
|
|
+ * with same label and we can not register each of those with same
|
|
+ * label. Failing to register those eeproms trigger cascade failure
|
|
+ * on such platform.
|
|
*/
|
|
+ nvmem_config.id = NVMEM_DEVID_AUTO;
|
|
+
|
|
if (device_property_present(dev, "label")) {
|
|
- nvmem_config.id = NVMEM_DEVID_NONE;
|
|
err = device_property_read_string(dev, "label",
|
|
&nvmem_config.name);
|
|
if (err)
|
|
return err;
|
|
} else {
|
|
- nvmem_config.id = NVMEM_DEVID_AUTO;
|
|
nvmem_config.name = dev_name(dev);
|
|
}
|
|
|
|
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
|
|
index fa59e6f4801c1..58112999a69ab 100644
|
|
--- a/drivers/mmc/core/host.c
|
|
+++ b/drivers/mmc/core/host.c
|
|
@@ -74,7 +74,8 @@ static void mmc_host_classdev_release(struct device *dev)
|
|
{
|
|
struct mmc_host *host = cls_dev_to_mmc_host(dev);
|
|
wakeup_source_unregister(host->ws);
|
|
- ida_simple_remove(&mmc_host_ida, host->index);
|
|
+ if (of_alias_get_id(host->parent->of_node, "mmc") < 0)
|
|
+ ida_simple_remove(&mmc_host_ida, host->index);
|
|
kfree(host);
|
|
}
|
|
|
|
@@ -436,7 +437,7 @@ static int mmc_first_nonreserved_index(void)
|
|
*/
|
|
struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
|
|
{
|
|
- int err;
|
|
+ int index;
|
|
struct mmc_host *host;
|
|
int alias_id, min_idx, max_idx;
|
|
|
|
@@ -449,20 +450,19 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
|
|
|
|
alias_id = of_alias_get_id(dev->of_node, "mmc");
|
|
if (alias_id >= 0) {
|
|
- min_idx = alias_id;
|
|
- max_idx = alias_id + 1;
|
|
+ index = alias_id;
|
|
} else {
|
|
min_idx = mmc_first_nonreserved_index();
|
|
max_idx = 0;
|
|
- }
|
|
|
|
- err = ida_simple_get(&mmc_host_ida, min_idx, max_idx, GFP_KERNEL);
|
|
- if (err < 0) {
|
|
- kfree(host);
|
|
- return NULL;
|
|
+ index = ida_simple_get(&mmc_host_ida, min_idx, max_idx, GFP_KERNEL);
|
|
+ if (index < 0) {
|
|
+ kfree(host);
|
|
+ return NULL;
|
|
+ }
|
|
}
|
|
|
|
- host->index = err;
|
|
+ host->index = index;
|
|
|
|
dev_set_name(&host->class_dev, "mmc%d", host->index);
|
|
host->ws = wakeup_source_register(NULL, dev_name(&host->class_dev));
|
|
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
|
|
index 345a3f61c723c..018af1e38eb9b 100644
|
|
--- a/drivers/net/bonding/bond_main.c
|
|
+++ b/drivers/net/bonding/bond_main.c
|
|
@@ -385,24 +385,85 @@ static int bond_vlan_rx_kill_vid(struct net_device *bond_dev,
|
|
static int bond_ipsec_add_sa(struct xfrm_state *xs)
|
|
{
|
|
struct net_device *bond_dev = xs->xso.dev;
|
|
+ struct bond_ipsec *ipsec;
|
|
struct bonding *bond;
|
|
struct slave *slave;
|
|
+ int err;
|
|
|
|
if (!bond_dev)
|
|
return -EINVAL;
|
|
|
|
+ rcu_read_lock();
|
|
bond = netdev_priv(bond_dev);
|
|
slave = rcu_dereference(bond->curr_active_slave);
|
|
- xs->xso.real_dev = slave->dev;
|
|
- bond->xs = xs;
|
|
+ if (!slave) {
|
|
+ rcu_read_unlock();
|
|
+ return -ENODEV;
|
|
+ }
|
|
|
|
- if (!(slave->dev->xfrmdev_ops
|
|
- && slave->dev->xfrmdev_ops->xdo_dev_state_add)) {
|
|
+ if (!slave->dev->xfrmdev_ops ||
|
|
+ !slave->dev->xfrmdev_ops->xdo_dev_state_add ||
|
|
+ netif_is_bond_master(slave->dev)) {
|
|
slave_warn(bond_dev, slave->dev, "Slave does not support ipsec offload\n");
|
|
+ rcu_read_unlock();
|
|
return -EINVAL;
|
|
}
|
|
|
|
- return slave->dev->xfrmdev_ops->xdo_dev_state_add(xs);
|
|
+ ipsec = kmalloc(sizeof(*ipsec), GFP_ATOMIC);
|
|
+ if (!ipsec) {
|
|
+ rcu_read_unlock();
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+ xs->xso.real_dev = slave->dev;
|
|
+
|
|
+ err = slave->dev->xfrmdev_ops->xdo_dev_state_add(xs);
|
|
+ if (!err) {
|
|
+ ipsec->xs = xs;
|
|
+ INIT_LIST_HEAD(&ipsec->list);
|
|
+ spin_lock_bh(&bond->ipsec_lock);
|
|
+ list_add(&ipsec->list, &bond->ipsec_list);
|
|
+ spin_unlock_bh(&bond->ipsec_lock);
|
|
+ } else {
|
|
+ kfree(ipsec);
|
|
+ }
|
|
+ rcu_read_unlock();
|
|
+ return err;
|
|
+}
|
|
+
|
|
+static void bond_ipsec_add_sa_all(struct bonding *bond)
|
|
+{
|
|
+ struct net_device *bond_dev = bond->dev;
|
|
+ struct bond_ipsec *ipsec;
|
|
+ struct slave *slave;
|
|
+
|
|
+ rcu_read_lock();
|
|
+ slave = rcu_dereference(bond->curr_active_slave);
|
|
+ if (!slave)
|
|
+ goto out;
|
|
+
|
|
+ if (!slave->dev->xfrmdev_ops ||
|
|
+ !slave->dev->xfrmdev_ops->xdo_dev_state_add ||
|
|
+ netif_is_bond_master(slave->dev)) {
|
|
+ spin_lock_bh(&bond->ipsec_lock);
|
|
+ if (!list_empty(&bond->ipsec_list))
|
|
+ slave_warn(bond_dev, slave->dev,
|
|
+ "%s: no slave xdo_dev_state_add\n",
|
|
+ __func__);
|
|
+ spin_unlock_bh(&bond->ipsec_lock);
|
|
+ goto out;
|
|
+ }
|
|
+
|
|
+ spin_lock_bh(&bond->ipsec_lock);
|
|
+ list_for_each_entry(ipsec, &bond->ipsec_list, list) {
|
|
+ ipsec->xs->xso.real_dev = slave->dev;
|
|
+ if (slave->dev->xfrmdev_ops->xdo_dev_state_add(ipsec->xs)) {
|
|
+ slave_warn(bond_dev, slave->dev, "%s: failed to add SA\n", __func__);
|
|
+ ipsec->xs->xso.real_dev = NULL;
|
|
+ }
|
|
+ }
|
|
+ spin_unlock_bh(&bond->ipsec_lock);
|
|
+out:
|
|
+ rcu_read_unlock();
|
|
}
|
|
|
|
/**
|
|
@@ -412,27 +473,77 @@ static int bond_ipsec_add_sa(struct xfrm_state *xs)
|
|
static void bond_ipsec_del_sa(struct xfrm_state *xs)
|
|
{
|
|
struct net_device *bond_dev = xs->xso.dev;
|
|
+ struct bond_ipsec *ipsec;
|
|
struct bonding *bond;
|
|
struct slave *slave;
|
|
|
|
if (!bond_dev)
|
|
return;
|
|
|
|
+ rcu_read_lock();
|
|
bond = netdev_priv(bond_dev);
|
|
slave = rcu_dereference(bond->curr_active_slave);
|
|
|
|
if (!slave)
|
|
- return;
|
|
+ goto out;
|
|
|
|
- xs->xso.real_dev = slave->dev;
|
|
+ if (!xs->xso.real_dev)
|
|
+ goto out;
|
|
+
|
|
+ WARN_ON(xs->xso.real_dev != slave->dev);
|
|
|
|
- if (!(slave->dev->xfrmdev_ops
|
|
- && slave->dev->xfrmdev_ops->xdo_dev_state_delete)) {
|
|
+ if (!slave->dev->xfrmdev_ops ||
|
|
+ !slave->dev->xfrmdev_ops->xdo_dev_state_delete ||
|
|
+ netif_is_bond_master(slave->dev)) {
|
|
slave_warn(bond_dev, slave->dev, "%s: no slave xdo_dev_state_delete\n", __func__);
|
|
- return;
|
|
+ goto out;
|
|
}
|
|
|
|
slave->dev->xfrmdev_ops->xdo_dev_state_delete(xs);
|
|
+out:
|
|
+ spin_lock_bh(&bond->ipsec_lock);
|
|
+ list_for_each_entry(ipsec, &bond->ipsec_list, list) {
|
|
+ if (ipsec->xs == xs) {
|
|
+ list_del(&ipsec->list);
|
|
+ kfree(ipsec);
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ spin_unlock_bh(&bond->ipsec_lock);
|
|
+ rcu_read_unlock();
|
|
+}
|
|
+
|
|
+static void bond_ipsec_del_sa_all(struct bonding *bond)
|
|
+{
|
|
+ struct net_device *bond_dev = bond->dev;
|
|
+ struct bond_ipsec *ipsec;
|
|
+ struct slave *slave;
|
|
+
|
|
+ rcu_read_lock();
|
|
+ slave = rcu_dereference(bond->curr_active_slave);
|
|
+ if (!slave) {
|
|
+ rcu_read_unlock();
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ spin_lock_bh(&bond->ipsec_lock);
|
|
+ list_for_each_entry(ipsec, &bond->ipsec_list, list) {
|
|
+ if (!ipsec->xs->xso.real_dev)
|
|
+ continue;
|
|
+
|
|
+ if (!slave->dev->xfrmdev_ops ||
|
|
+ !slave->dev->xfrmdev_ops->xdo_dev_state_delete ||
|
|
+ netif_is_bond_master(slave->dev)) {
|
|
+ slave_warn(bond_dev, slave->dev,
|
|
+ "%s: no slave xdo_dev_state_delete\n",
|
|
+ __func__);
|
|
+ } else {
|
|
+ slave->dev->xfrmdev_ops->xdo_dev_state_delete(ipsec->xs);
|
|
+ }
|
|
+ ipsec->xs->xso.real_dev = NULL;
|
|
+ }
|
|
+ spin_unlock_bh(&bond->ipsec_lock);
|
|
+ rcu_read_unlock();
|
|
}
|
|
|
|
/**
|
|
@@ -443,21 +554,37 @@ static void bond_ipsec_del_sa(struct xfrm_state *xs)
|
|
static bool bond_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs)
|
|
{
|
|
struct net_device *bond_dev = xs->xso.dev;
|
|
- struct bonding *bond = netdev_priv(bond_dev);
|
|
- struct slave *curr_active = rcu_dereference(bond->curr_active_slave);
|
|
- struct net_device *slave_dev = curr_active->dev;
|
|
+ struct net_device *real_dev;
|
|
+ struct slave *curr_active;
|
|
+ struct bonding *bond;
|
|
+ int err;
|
|
|
|
- if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)
|
|
- return true;
|
|
+ bond = netdev_priv(bond_dev);
|
|
+ rcu_read_lock();
|
|
+ curr_active = rcu_dereference(bond->curr_active_slave);
|
|
+ real_dev = curr_active->dev;
|
|
|
|
- if (!(slave_dev->xfrmdev_ops
|
|
- && slave_dev->xfrmdev_ops->xdo_dev_offload_ok)) {
|
|
- slave_warn(bond_dev, slave_dev, "%s: no slave xdo_dev_offload_ok\n", __func__);
|
|
- return false;
|
|
+ if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
|
|
+ err = false;
|
|
+ goto out;
|
|
+ }
|
|
+
|
|
+ if (!xs->xso.real_dev) {
|
|
+ err = false;
|
|
+ goto out;
|
|
+ }
|
|
+
|
|
+ if (!real_dev->xfrmdev_ops ||
|
|
+ !real_dev->xfrmdev_ops->xdo_dev_offload_ok ||
|
|
+ netif_is_bond_master(real_dev)) {
|
|
+ err = false;
|
|
+ goto out;
|
|
}
|
|
|
|
- xs->xso.real_dev = slave_dev;
|
|
- return slave_dev->xfrmdev_ops->xdo_dev_offload_ok(skb, xs);
|
|
+ err = real_dev->xfrmdev_ops->xdo_dev_offload_ok(skb, xs);
|
|
+out:
|
|
+ rcu_read_unlock();
|
|
+ return err;
|
|
}
|
|
|
|
static const struct xfrmdev_ops bond_xfrmdev_ops = {
|
|
@@ -974,8 +1101,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
|
|
return;
|
|
|
|
#ifdef CONFIG_XFRM_OFFLOAD
|
|
- if (old_active && bond->xs)
|
|
- bond_ipsec_del_sa(bond->xs);
|
|
+ bond_ipsec_del_sa_all(bond);
|
|
#endif /* CONFIG_XFRM_OFFLOAD */
|
|
|
|
if (new_active) {
|
|
@@ -1051,10 +1177,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
|
|
}
|
|
|
|
#ifdef CONFIG_XFRM_OFFLOAD
|
|
- if (new_active && bond->xs) {
|
|
- xfrm_dev_state_flush(dev_net(bond->dev), bond->dev, true);
|
|
- bond_ipsec_add_sa(bond->xs);
|
|
- }
|
|
+ bond_ipsec_add_sa_all(bond);
|
|
#endif /* CONFIG_XFRM_OFFLOAD */
|
|
|
|
/* resend IGMP joins since active slave has changed or
|
|
@@ -3293,6 +3416,9 @@ static int bond_master_netdev_event(unsigned long event,
|
|
return bond_event_changename(event_bond);
|
|
case NETDEV_UNREGISTER:
|
|
bond_remove_proc_entry(event_bond);
|
|
+#ifdef CONFIG_XFRM_OFFLOAD
|
|
+ xfrm_dev_state_flush(dev_net(bond_dev), bond_dev, true);
|
|
+#endif /* CONFIG_XFRM_OFFLOAD */
|
|
break;
|
|
case NETDEV_REGISTER:
|
|
bond_create_proc_entry(event_bond);
|
|
@@ -4726,7 +4852,8 @@ void bond_setup(struct net_device *bond_dev)
|
|
#ifdef CONFIG_XFRM_OFFLOAD
|
|
/* set up xfrm device ops (only supported in active-backup right now) */
|
|
bond_dev->xfrmdev_ops = &bond_xfrmdev_ops;
|
|
- bond->xs = NULL;
|
|
+ INIT_LIST_HEAD(&bond->ipsec_list);
|
|
+ spin_lock_init(&bond->ipsec_lock);
|
|
#endif /* CONFIG_XFRM_OFFLOAD */
|
|
|
|
/* don't acquire bond device's netif_tx_lock when transmitting */
|
|
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
|
|
index 429ce8638c2b3..184cbc93328c2 100644
|
|
--- a/drivers/net/dsa/mv88e6xxx/chip.c
|
|
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
|
|
@@ -3433,6 +3433,11 @@ static const struct mv88e6xxx_ops mv88e6141_ops = {
|
|
.serdes_irq_enable = mv88e6390_serdes_irq_enable,
|
|
.serdes_irq_status = mv88e6390_serdes_irq_status,
|
|
.gpio_ops = &mv88e6352_gpio_ops,
|
|
+ .serdes_get_sset_count = mv88e6390_serdes_get_sset_count,
|
|
+ .serdes_get_strings = mv88e6390_serdes_get_strings,
|
|
+ .serdes_get_stats = mv88e6390_serdes_get_stats,
|
|
+ .serdes_get_regs_len = mv88e6390_serdes_get_regs_len,
|
|
+ .serdes_get_regs = mv88e6390_serdes_get_regs,
|
|
.phylink_validate = mv88e6341_phylink_validate,
|
|
};
|
|
|
|
@@ -4205,6 +4210,11 @@ static const struct mv88e6xxx_ops mv88e6341_ops = {
|
|
.gpio_ops = &mv88e6352_gpio_ops,
|
|
.avb_ops = &mv88e6390_avb_ops,
|
|
.ptp_ops = &mv88e6352_ptp_ops,
|
|
+ .serdes_get_sset_count = mv88e6390_serdes_get_sset_count,
|
|
+ .serdes_get_strings = mv88e6390_serdes_get_strings,
|
|
+ .serdes_get_stats = mv88e6390_serdes_get_stats,
|
|
+ .serdes_get_regs_len = mv88e6390_serdes_get_regs_len,
|
|
+ .serdes_get_regs = mv88e6390_serdes_get_regs,
|
|
.phylink_validate = mv88e6341_phylink_validate,
|
|
};
|
|
|
|
diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c
|
|
index 9c07b4f3d3454..6920e62c864df 100644
|
|
--- a/drivers/net/dsa/mv88e6xxx/serdes.c
|
|
+++ b/drivers/net/dsa/mv88e6xxx/serdes.c
|
|
@@ -590,7 +590,7 @@ static struct mv88e6390_serdes_hw_stat mv88e6390_serdes_hw_stats[] = {
|
|
|
|
int mv88e6390_serdes_get_sset_count(struct mv88e6xxx_chip *chip, int port)
|
|
{
|
|
- if (mv88e6390_serdes_get_lane(chip, port) == 0)
|
|
+ if (mv88e6xxx_serdes_get_lane(chip, port) == 0)
|
|
return 0;
|
|
|
|
return ARRAY_SIZE(mv88e6390_serdes_hw_stats);
|
|
@@ -602,7 +602,7 @@ int mv88e6390_serdes_get_strings(struct mv88e6xxx_chip *chip,
|
|
struct mv88e6390_serdes_hw_stat *stat;
|
|
int i;
|
|
|
|
- if (mv88e6390_serdes_get_lane(chip, port) == 0)
|
|
+ if (mv88e6xxx_serdes_get_lane(chip, port) == 0)
|
|
return 0;
|
|
|
|
for (i = 0; i < ARRAY_SIZE(mv88e6390_serdes_hw_stats); i++) {
|
|
@@ -638,7 +638,7 @@ int mv88e6390_serdes_get_stats(struct mv88e6xxx_chip *chip, int port,
|
|
int lane;
|
|
int i;
|
|
|
|
- lane = mv88e6390_serdes_get_lane(chip, port);
|
|
+ lane = mv88e6xxx_serdes_get_lane(chip, port);
|
|
if (lane == 0)
|
|
return 0;
|
|
|
|
diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
|
|
index 82852c57cc0e4..82b918d361173 100644
|
|
--- a/drivers/net/dsa/sja1105/sja1105_main.c
|
|
+++ b/drivers/net/dsa/sja1105/sja1105_main.c
|
|
@@ -350,6 +350,12 @@ static int sja1105_init_static_vlan(struct sja1105_private *priv)
|
|
if (dsa_is_cpu_port(ds, port))
|
|
v->pvid = true;
|
|
list_add(&v->list, &priv->dsa_8021q_vlans);
|
|
+
|
|
+ v = kmemdup(v, sizeof(*v), GFP_KERNEL);
|
|
+ if (!v)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ list_add(&v->list, &priv->bridge_vlans);
|
|
}
|
|
|
|
((struct sja1105_vlan_lookup_entry *)table->entries)[0] = pvid;
|
|
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
|
|
index db1b89f570794..8f169508a90a9 100644
|
|
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
|
|
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
|
|
@@ -1633,11 +1633,16 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
|
|
|
|
if ((tpa_info->flags2 & RX_CMP_FLAGS2_META_FORMAT_VLAN) &&
|
|
(skb->dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX)) {
|
|
- u16 vlan_proto = tpa_info->metadata >>
|
|
- RX_CMP_FLAGS2_METADATA_TPID_SFT;
|
|
+ __be16 vlan_proto = htons(tpa_info->metadata >>
|
|
+ RX_CMP_FLAGS2_METADATA_TPID_SFT);
|
|
u16 vtag = tpa_info->metadata & RX_CMP_FLAGS2_METADATA_TCI_MASK;
|
|
|
|
- __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag);
|
|
+ if (eth_type_vlan(vlan_proto)) {
|
|
+ __vlan_hwaccel_put_tag(skb, vlan_proto, vtag);
|
|
+ } else {
|
|
+ dev_kfree_skb(skb);
|
|
+ return NULL;
|
|
+ }
|
|
}
|
|
|
|
skb_checksum_none_assert(skb);
|
|
@@ -1858,9 +1863,15 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
|
|
(skb->dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX)) {
|
|
u32 meta_data = le32_to_cpu(rxcmp1->rx_cmp_meta_data);
|
|
u16 vtag = meta_data & RX_CMP_FLAGS2_METADATA_TCI_MASK;
|
|
- u16 vlan_proto = meta_data >> RX_CMP_FLAGS2_METADATA_TPID_SFT;
|
|
+ __be16 vlan_proto = htons(meta_data >>
|
|
+ RX_CMP_FLAGS2_METADATA_TPID_SFT);
|
|
|
|
- __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag);
|
|
+ if (eth_type_vlan(vlan_proto)) {
|
|
+ __vlan_hwaccel_put_tag(skb, vlan_proto, vtag);
|
|
+ } else {
|
|
+ dev_kfree_skb(skb);
|
|
+ goto next_rx;
|
|
+ }
|
|
}
|
|
|
|
skb_checksum_none_assert(skb);
|
|
@@ -9830,6 +9841,12 @@ int bnxt_half_open_nic(struct bnxt *bp)
|
|
{
|
|
int rc = 0;
|
|
|
|
+ if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) {
|
|
+ netdev_err(bp->dev, "A previous firmware reset has not completed, aborting half open\n");
|
|
+ rc = -ENODEV;
|
|
+ goto half_open_err;
|
|
+ }
|
|
+
|
|
rc = bnxt_alloc_mem(bp, false);
|
|
if (rc) {
|
|
netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc);
|
|
@@ -11480,6 +11497,10 @@ static void bnxt_fw_reset_task(struct work_struct *work)
|
|
}
|
|
bp->fw_reset_timestamp = jiffies;
|
|
rtnl_lock();
|
|
+ if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) {
|
|
+ rtnl_unlock();
|
|
+ goto fw_reset_abort;
|
|
+ }
|
|
bnxt_fw_reset_close(bp);
|
|
if (bp->fw_cap & BNXT_FW_CAP_ERR_RECOVER_RELOAD) {
|
|
bp->fw_reset_state = BNXT_FW_RESET_STATE_POLL_FW_DOWN;
|
|
@@ -12901,7 +12922,8 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
|
|
if (netif_running(netdev))
|
|
bnxt_close(netdev);
|
|
|
|
- pci_disable_device(pdev);
|
|
+ if (pci_is_enabled(pdev))
|
|
+ pci_disable_device(pdev);
|
|
bnxt_free_ctx_mem(bp);
|
|
kfree(bp->ctx);
|
|
bp->ctx = NULL;
|
|
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
|
|
index 64dbbb04b0434..abf169001bf33 100644
|
|
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
|
|
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
|
|
@@ -479,15 +479,16 @@ struct bnxt_en_dev *bnxt_ulp_probe(struct net_device *dev)
|
|
if (!edev)
|
|
return ERR_PTR(-ENOMEM);
|
|
edev->en_ops = &bnxt_en_ops_tbl;
|
|
- if (bp->flags & BNXT_FLAG_ROCEV1_CAP)
|
|
- edev->flags |= BNXT_EN_FLAG_ROCEV1_CAP;
|
|
- if (bp->flags & BNXT_FLAG_ROCEV2_CAP)
|
|
- edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP;
|
|
edev->net = dev;
|
|
edev->pdev = bp->pdev;
|
|
edev->l2_db_size = bp->db_size;
|
|
edev->l2_db_size_nc = bp->db_size;
|
|
bp->edev = edev;
|
|
}
|
|
+ edev->flags &= ~BNXT_EN_FLAG_ROCE_CAP;
|
|
+ if (bp->flags & BNXT_FLAG_ROCEV1_CAP)
|
|
+ edev->flags |= BNXT_EN_FLAG_ROCEV1_CAP;
|
|
+ if (bp->flags & BNXT_FLAG_ROCEV2_CAP)
|
|
+ edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP;
|
|
return bp->edev;
|
|
}
|
|
diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
|
|
index 4cddd628d41b2..9ed3d1ab2ca58 100644
|
|
--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
|
|
+++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
|
|
@@ -420,7 +420,7 @@ static int cn23xx_pf_setup_global_input_regs(struct octeon_device *oct)
|
|
* bits 32:47 indicate the PVF num.
|
|
*/
|
|
for (q_no = 0; q_no < ern; q_no++) {
|
|
- reg_val = oct->pcie_port << CN23XX_PKT_INPUT_CTL_MAC_NUM_POS;
|
|
+ reg_val = (u64)oct->pcie_port << CN23XX_PKT_INPUT_CTL_MAC_NUM_POS;
|
|
|
|
/* for VF assigned queues. */
|
|
if (q_no < oct->sriov_info.pf_srn) {
|
|
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
|
|
index 8be525c5e2e4a..6698afad43796 100644
|
|
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
|
|
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
|
|
@@ -2643,6 +2643,9 @@ static void detach_ulds(struct adapter *adap)
|
|
{
|
|
unsigned int i;
|
|
|
|
+ if (!is_uld(adap))
|
|
+ return;
|
|
+
|
|
mutex_lock(&uld_mutex);
|
|
list_del(&adap->list_node);
|
|
|
|
@@ -7145,10 +7148,13 @@ static void remove_one(struct pci_dev *pdev)
|
|
*/
|
|
destroy_workqueue(adapter->workq);
|
|
|
|
- if (is_uld(adapter)) {
|
|
- detach_ulds(adapter);
|
|
- t4_uld_clean_up(adapter);
|
|
- }
|
|
+ detach_ulds(adapter);
|
|
+
|
|
+ for_each_port(adapter, i)
|
|
+ if (adapter->port[i]->reg_state == NETREG_REGISTERED)
|
|
+ unregister_netdev(adapter->port[i]);
|
|
+
|
|
+ t4_uld_clean_up(adapter);
|
|
|
|
adap_free_hma_mem(adapter);
|
|
|
|
@@ -7156,10 +7162,6 @@ static void remove_one(struct pci_dev *pdev)
|
|
|
|
cxgb4_free_mps_ref_entries(adapter);
|
|
|
|
- for_each_port(adapter, i)
|
|
- if (adapter->port[i]->reg_state == NETREG_REGISTERED)
|
|
- unregister_netdev(adapter->port[i]);
|
|
-
|
|
debugfs_remove_recursive(adapter->debugfs_root);
|
|
|
|
if (!is_t4(adapter->params.chip))
|
|
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
|
|
index 743af9e654aa7..17faac715882d 100644
|
|
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
|
|
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
|
|
@@ -581,6 +581,9 @@ void t4_uld_clean_up(struct adapter *adap)
|
|
{
|
|
unsigned int i;
|
|
|
|
+ if (!is_uld(adap))
|
|
+ return;
|
|
+
|
|
mutex_lock(&uld_mutex);
|
|
for (i = 0; i < CXGB4_ULD_MAX; i++) {
|
|
if (!adap->uld[i].handle)
|
|
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
|
|
index 3a74e4645ce65..0b714b606ba19 100644
|
|
--- a/drivers/net/ethernet/google/gve/gve_main.c
|
|
+++ b/drivers/net/ethernet/google/gve/gve_main.c
|
|
@@ -1340,13 +1340,16 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
|
|
err = register_netdev(dev);
|
|
if (err)
|
|
- goto abort_with_wq;
|
|
+ goto abort_with_gve_init;
|
|
|
|
dev_info(&pdev->dev, "GVE version %s\n", gve_version_str);
|
|
gve_clear_probe_in_progress(priv);
|
|
queue_work(priv->gve_wq, &priv->service_task);
|
|
return 0;
|
|
|
|
+abort_with_gve_init:
|
|
+ gve_teardown_priv_resources(priv);
|
|
+
|
|
abort_with_wq:
|
|
destroy_workqueue(priv->gve_wq);
|
|
|
|
diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
|
|
index 12f6c2442a7ad..e53512f6878af 100644
|
|
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
|
|
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
|
|
@@ -131,7 +131,7 @@
|
|
/* buf unit size is cache_line_size, which is 64, so the shift is 6 */
|
|
#define PPE_BUF_SIZE_SHIFT 6
|
|
#define PPE_TX_BUF_HOLD BIT(31)
|
|
-#define CACHE_LINE_MASK 0x3F
|
|
+#define SOC_CACHE_LINE_MASK 0x3F
|
|
#else
|
|
#define PPE_CFG_QOS_VMID_GRP_SHIFT 8
|
|
#define PPE_CFG_RX_CTRL_ALIGN_SHIFT 11
|
|
@@ -531,8 +531,8 @@ hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
|
|
#if defined(CONFIG_HI13X1_GMAC)
|
|
desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV
|
|
| TX_RELEASE_TO_PPE | priv->port << TX_POOL_SHIFT);
|
|
- desc->data_offset = (__force u32)cpu_to_be32(phys & CACHE_LINE_MASK);
|
|
- desc->send_addr = (__force u32)cpu_to_be32(phys & ~CACHE_LINE_MASK);
|
|
+ desc->data_offset = (__force u32)cpu_to_be32(phys & SOC_CACHE_LINE_MASK);
|
|
+ desc->send_addr = (__force u32)cpu_to_be32(phys & ~SOC_CACHE_LINE_MASK);
|
|
#else
|
|
desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV);
|
|
desc->send_addr = (__force u32)cpu_to_be32(phys);
|
|
diff --git a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
|
|
index 98a9f5e3fe864..98f55fbe6c3d6 100644
|
|
--- a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
|
|
+++ b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
|
|
@@ -134,7 +134,8 @@ struct hclge_mbx_vf_to_pf_cmd {
|
|
u8 mbx_need_resp;
|
|
u8 rsv1[1];
|
|
u8 msg_len;
|
|
- u8 rsv2[3];
|
|
+ u8 rsv2;
|
|
+ u16 match_id;
|
|
struct hclge_vf_to_pf_msg msg;
|
|
};
|
|
|
|
@@ -144,7 +145,8 @@ struct hclge_mbx_pf_to_vf_cmd {
|
|
u8 dest_vfid;
|
|
u8 rsv[3];
|
|
u8 msg_len;
|
|
- u8 rsv1[3];
|
|
+ u8 rsv1;
|
|
+ u16 match_id;
|
|
struct hclge_pf_to_vf_msg msg;
|
|
};
|
|
|
|
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
|
|
index 2c2d53f5c56e1..61f6f0287cbe1 100644
|
|
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
|
|
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
|
|
@@ -47,6 +47,7 @@ static int hclge_gen_resp_to_vf(struct hclge_vport *vport,
|
|
|
|
resp_pf_to_vf->dest_vfid = vf_to_pf_req->mbx_src_vfid;
|
|
resp_pf_to_vf->msg_len = vf_to_pf_req->msg_len;
|
|
+ resp_pf_to_vf->match_id = vf_to_pf_req->match_id;
|
|
|
|
resp_pf_to_vf->msg.code = HCLGE_MBX_PF_VF_RESP;
|
|
resp_pf_to_vf->msg.vf_mbx_msg_code = vf_to_pf_req->msg.code;
|
|
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
|
|
index ac6980acb6f02..d3010d5ab3665 100644
|
|
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
|
|
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
|
|
@@ -2518,6 +2518,16 @@ static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev)
|
|
|
|
static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev)
|
|
{
|
|
+ struct hnae3_handle *nic = &hdev->nic;
|
|
+ int ret;
|
|
+
|
|
+ ret = hclgevf_en_hw_strip_rxvtag(nic, true);
|
|
+ if (ret) {
|
|
+ dev_err(&hdev->pdev->dev,
|
|
+ "failed to enable rx vlan offload, ret = %d\n", ret);
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
return hclgevf_set_vlan_filter(&hdev->nic, htons(ETH_P_8021Q), 0,
|
|
false);
|
|
}
|
|
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
|
|
index b3ad95ac3d859..361b8d0bd78d7 100644
|
|
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
|
|
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
|
|
@@ -7657,6 +7657,7 @@ err_flashmap:
|
|
err_ioremap:
|
|
free_netdev(netdev);
|
|
err_alloc_etherdev:
|
|
+ pci_disable_pcie_error_reporting(pdev);
|
|
pci_release_mem_regions(pdev);
|
|
err_pci_reg:
|
|
err_dma:
|
|
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
|
|
index 9e3103fae723c..caedf24c24c1f 100644
|
|
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
|
|
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
|
|
@@ -2227,6 +2227,7 @@ err_sw_init:
|
|
err_ioremap:
|
|
free_netdev(netdev);
|
|
err_alloc_netdev:
|
|
+ pci_disable_pcie_error_reporting(pdev);
|
|
pci_release_mem_regions(pdev);
|
|
err_pci_reg:
|
|
err_dma:
|
|
diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
|
|
index ebd08543791bd..f3caf5eab8d4a 100644
|
|
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
|
|
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
|
|
@@ -3759,6 +3759,7 @@ static int iavf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
err_ioremap:
|
|
free_netdev(netdev);
|
|
err_alloc_etherdev:
|
|
+ pci_disable_pcie_error_reporting(pdev);
|
|
pci_release_regions(pdev);
|
|
err_pci_reg:
|
|
err_dma:
|
|
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
|
|
index 4b9b5148c916b..e24fb122c03a2 100644
|
|
--- a/drivers/net/ethernet/intel/igb/igb_main.c
|
|
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
|
|
@@ -931,6 +931,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
|
|
**/
|
|
static int igb_request_msix(struct igb_adapter *adapter)
|
|
{
|
|
+ unsigned int num_q_vectors = adapter->num_q_vectors;
|
|
struct net_device *netdev = adapter->netdev;
|
|
int i, err = 0, vector = 0, free_vector = 0;
|
|
|
|
@@ -939,7 +940,13 @@ static int igb_request_msix(struct igb_adapter *adapter)
|
|
if (err)
|
|
goto err_out;
|
|
|
|
- for (i = 0; i < adapter->num_q_vectors; i++) {
|
|
+ if (num_q_vectors > MAX_Q_VECTORS) {
|
|
+ num_q_vectors = MAX_Q_VECTORS;
|
|
+ dev_warn(&adapter->pdev->dev,
|
|
+ "The number of queue vectors (%d) is higher than max allowed (%d)\n",
|
|
+ adapter->num_q_vectors, MAX_Q_VECTORS);
|
|
+ }
|
|
+ for (i = 0; i < num_q_vectors; i++) {
|
|
struct igb_q_vector *q_vector = adapter->q_vector[i];
|
|
|
|
vector++;
|
|
@@ -1678,14 +1685,15 @@ static bool is_any_txtime_enabled(struct igb_adapter *adapter)
|
|
**/
|
|
static void igb_config_tx_modes(struct igb_adapter *adapter, int queue)
|
|
{
|
|
- struct igb_ring *ring = adapter->tx_ring[queue];
|
|
struct net_device *netdev = adapter->netdev;
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
+ struct igb_ring *ring;
|
|
u32 tqavcc, tqavctrl;
|
|
u16 value;
|
|
|
|
WARN_ON(hw->mac.type != e1000_i210);
|
|
WARN_ON(queue < 0 || queue > 1);
|
|
+ ring = adapter->tx_ring[queue];
|
|
|
|
/* If any of the Qav features is enabled, configure queues as SR and
|
|
* with HIGH PRIO. If none is, then configure them with LOW PRIO and
|
|
@@ -3616,6 +3624,7 @@ err_sw_init:
|
|
err_ioremap:
|
|
free_netdev(netdev);
|
|
err_alloc_etherdev:
|
|
+ pci_disable_pcie_error_reporting(pdev);
|
|
pci_release_mem_regions(pdev);
|
|
err_pci_reg:
|
|
err_dma:
|
|
@@ -4836,6 +4845,8 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring)
|
|
DMA_TO_DEVICE);
|
|
}
|
|
|
|
+ tx_buffer->next_to_watch = NULL;
|
|
+
|
|
/* move us one more past the eop_desc for start of next pkt */
|
|
tx_buffer++;
|
|
i++;
|
|
diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h
|
|
index 6dca67d9c25d8..a97bf7a5f1d67 100644
|
|
--- a/drivers/net/ethernet/intel/igc/igc.h
|
|
+++ b/drivers/net/ethernet/intel/igc/igc.h
|
|
@@ -532,7 +532,7 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data)
|
|
if (hw->phy.ops.read_reg)
|
|
return hw->phy.ops.read_reg(hw, offset, data);
|
|
|
|
- return 0;
|
|
+ return -EOPNOTSUPP;
|
|
}
|
|
|
|
void igc_reinit_locked(struct igc_adapter *);
|
|
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
|
|
index 7b822cdcc6c58..b9fe2785f5735 100644
|
|
--- a/drivers/net/ethernet/intel/igc/igc_main.c
|
|
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
|
|
@@ -207,6 +207,8 @@ static void igc_clean_tx_ring(struct igc_ring *tx_ring)
|
|
DMA_TO_DEVICE);
|
|
}
|
|
|
|
+ tx_buffer->next_to_watch = NULL;
|
|
+
|
|
/* move us one more past the eop_desc for start of next pkt */
|
|
tx_buffer++;
|
|
i++;
|
|
@@ -5221,6 +5223,7 @@ err_sw_init:
|
|
err_ioremap:
|
|
free_netdev(netdev);
|
|
err_alloc_etherdev:
|
|
+ pci_disable_pcie_error_reporting(pdev);
|
|
pci_release_mem_regions(pdev);
|
|
err_pci_reg:
|
|
err_dma:
|
|
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
|
|
index 1bfba87f1ff60..37439b76fcb5e 100644
|
|
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
|
|
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
|
|
@@ -1825,7 +1825,8 @@ static void ixgbe_dma_sync_frag(struct ixgbe_ring *rx_ring,
|
|
struct sk_buff *skb)
|
|
{
|
|
if (ring_uses_build_skb(rx_ring)) {
|
|
- unsigned long offset = (unsigned long)(skb->data) & ~PAGE_MASK;
|
|
+ unsigned long mask = (unsigned long)ixgbe_rx_pg_size(rx_ring) - 1;
|
|
+ unsigned long offset = (unsigned long)(skb->data) & mask;
|
|
|
|
dma_sync_single_range_for_cpu(rx_ring->dev,
|
|
IXGBE_CB(skb)->dma,
|
|
@@ -11081,6 +11082,7 @@ err_ioremap:
|
|
disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state);
|
|
free_netdev(netdev);
|
|
err_alloc_etherdev:
|
|
+ pci_disable_pcie_error_reporting(pdev);
|
|
pci_release_mem_regions(pdev);
|
|
err_pci_reg:
|
|
err_dma:
|
|
diff --git a/drivers/net/ethernet/intel/ixgbevf/ipsec.c b/drivers/net/ethernet/intel/ixgbevf/ipsec.c
|
|
index caaea2c920a6e..e3e4676af9e45 100644
|
|
--- a/drivers/net/ethernet/intel/ixgbevf/ipsec.c
|
|
+++ b/drivers/net/ethernet/intel/ixgbevf/ipsec.c
|
|
@@ -211,7 +211,7 @@ struct xfrm_state *ixgbevf_ipsec_find_rx_state(struct ixgbevf_ipsec *ipsec,
|
|
static int ixgbevf_ipsec_parse_proto_keys(struct xfrm_state *xs,
|
|
u32 *mykey, u32 *mysalt)
|
|
{
|
|
- struct net_device *dev = xs->xso.dev;
|
|
+ struct net_device *dev = xs->xso.real_dev;
|
|
unsigned char *key_data;
|
|
char *alg_name = NULL;
|
|
int key_len;
|
|
@@ -260,12 +260,15 @@ static int ixgbevf_ipsec_parse_proto_keys(struct xfrm_state *xs,
|
|
**/
|
|
static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs)
|
|
{
|
|
- struct net_device *dev = xs->xso.dev;
|
|
- struct ixgbevf_adapter *adapter = netdev_priv(dev);
|
|
- struct ixgbevf_ipsec *ipsec = adapter->ipsec;
|
|
+ struct net_device *dev = xs->xso.real_dev;
|
|
+ struct ixgbevf_adapter *adapter;
|
|
+ struct ixgbevf_ipsec *ipsec;
|
|
u16 sa_idx;
|
|
int ret;
|
|
|
|
+ adapter = netdev_priv(dev);
|
|
+ ipsec = adapter->ipsec;
|
|
+
|
|
if (xs->id.proto != IPPROTO_ESP && xs->id.proto != IPPROTO_AH) {
|
|
netdev_err(dev, "Unsupported protocol 0x%04x for IPsec offload\n",
|
|
xs->id.proto);
|
|
@@ -383,11 +386,14 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs)
|
|
**/
|
|
static void ixgbevf_ipsec_del_sa(struct xfrm_state *xs)
|
|
{
|
|
- struct net_device *dev = xs->xso.dev;
|
|
- struct ixgbevf_adapter *adapter = netdev_priv(dev);
|
|
- struct ixgbevf_ipsec *ipsec = adapter->ipsec;
|
|
+ struct net_device *dev = xs->xso.real_dev;
|
|
+ struct ixgbevf_adapter *adapter;
|
|
+ struct ixgbevf_ipsec *ipsec;
|
|
u16 sa_idx;
|
|
|
|
+ adapter = netdev_priv(dev);
|
|
+ ipsec = adapter->ipsec;
|
|
+
|
|
if (xs->xso.flags & XFRM_OFFLOAD_INBOUND) {
|
|
sa_idx = xs->xso.offload_handle - IXGBE_IPSEC_BASE_RX_INDEX;
|
|
|
|
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
|
|
index 9010aabd97826..e690a1b09e98b 100644
|
|
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
|
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
|
@@ -5160,7 +5160,8 @@ static int r8169_mdio_register(struct rtl8169_private *tp)
|
|
new_bus->priv = tp;
|
|
new_bus->parent = &pdev->dev;
|
|
new_bus->irq[0] = PHY_IGNORE_INTERRUPT;
|
|
- snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x", pci_dev_id(pdev));
|
|
+ snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x-%x",
|
|
+ pci_domain_nr(pdev->bus), pci_dev_id(pdev));
|
|
|
|
new_bus->read = r8169_mdio_read_reg;
|
|
new_bus->write = r8169_mdio_write_reg;
|
|
diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c
|
|
index a4a626e9cd9a1..0a8799a208cf4 100644
|
|
--- a/drivers/net/ethernet/sfc/efx_channels.c
|
|
+++ b/drivers/net/ethernet/sfc/efx_channels.c
|
|
@@ -889,18 +889,20 @@ int efx_set_channels(struct efx_nic *efx)
|
|
if (efx_channel_is_xdp_tx(channel)) {
|
|
efx_for_each_channel_tx_queue(tx_queue, channel) {
|
|
tx_queue->queue = next_queue++;
|
|
- netif_dbg(efx, drv, efx->net_dev, "Channel %u TXQ %u is XDP %u, HW %u\n",
|
|
- channel->channel, tx_queue->label,
|
|
- xdp_queue_number, tx_queue->queue);
|
|
+
|
|
/* We may have a few left-over XDP TX
|
|
* queues owing to xdp_tx_queue_count
|
|
* not dividing evenly by EFX_MAX_TXQ_PER_CHANNEL.
|
|
* We still allocate and probe those
|
|
* TXQs, but never use them.
|
|
*/
|
|
- if (xdp_queue_number < efx->xdp_tx_queue_count)
|
|
+ if (xdp_queue_number < efx->xdp_tx_queue_count) {
|
|
+ netif_dbg(efx, drv, efx->net_dev, "Channel %u TXQ %u is XDP %u, HW %u\n",
|
|
+ channel->channel, tx_queue->label,
|
|
+ xdp_queue_number, tx_queue->queue);
|
|
efx->xdp_tx_queues[xdp_queue_number] = tx_queue;
|
|
- xdp_queue_number++;
|
|
+ xdp_queue_number++;
|
|
+ }
|
|
}
|
|
} else {
|
|
efx_for_each_channel_tx_queue(tx_queue, channel) {
|
|
@@ -912,6 +914,7 @@ int efx_set_channels(struct efx_nic *efx)
|
|
}
|
|
}
|
|
}
|
|
+ WARN_ON(xdp_queue_number != efx->xdp_tx_queue_count);
|
|
|
|
rc = netif_set_real_num_tx_queues(efx->net_dev, efx->n_tx_channels);
|
|
if (rc)
|
|
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
|
|
index ff95400594fc1..53be8fc1d125f 100644
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
|
|
@@ -399,6 +399,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
|
|
struct device_node *np = pdev->dev.of_node;
|
|
struct plat_stmmacenet_data *plat;
|
|
struct stmmac_dma_cfg *dma_cfg;
|
|
+ int phy_mode;
|
|
int rc;
|
|
|
|
plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
|
|
@@ -413,10 +414,11 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
|
|
*mac = NULL;
|
|
}
|
|
|
|
- plat->phy_interface = device_get_phy_mode(&pdev->dev);
|
|
- if (plat->phy_interface < 0)
|
|
- return ERR_PTR(plat->phy_interface);
|
|
+ phy_mode = device_get_phy_mode(&pdev->dev);
|
|
+ if (phy_mode < 0)
|
|
+ return ERR_PTR(phy_mode);
|
|
|
|
+ plat->phy_interface = phy_mode;
|
|
plat->interface = stmmac_of_get_mac_mode(np);
|
|
if (plat->interface < 0)
|
|
plat->interface = plat->phy_interface;
|
|
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
|
|
index fbfcbd0dcfcbc..5b3aff2c279f7 100644
|
|
--- a/drivers/net/usb/hso.c
|
|
+++ b/drivers/net/usb/hso.c
|
|
@@ -2496,7 +2496,7 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
|
|
hso_net_init);
|
|
if (!net) {
|
|
dev_err(&interface->dev, "Unable to create ethernet device\n");
|
|
- goto exit;
|
|
+ goto err_hso_dev;
|
|
}
|
|
|
|
hso_net = netdev_priv(net);
|
|
@@ -2509,13 +2509,13 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
|
|
USB_DIR_IN);
|
|
if (!hso_net->in_endp) {
|
|
dev_err(&interface->dev, "Can't find BULK IN endpoint\n");
|
|
- goto exit;
|
|
+ goto err_net;
|
|
}
|
|
hso_net->out_endp = hso_get_ep(interface, USB_ENDPOINT_XFER_BULK,
|
|
USB_DIR_OUT);
|
|
if (!hso_net->out_endp) {
|
|
dev_err(&interface->dev, "Can't find BULK OUT endpoint\n");
|
|
- goto exit;
|
|
+ goto err_net;
|
|
}
|
|
SET_NETDEV_DEV(net, &interface->dev);
|
|
SET_NETDEV_DEVTYPE(net, &hso_type);
|
|
@@ -2524,18 +2524,18 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
|
|
for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
|
|
hso_net->mux_bulk_rx_urb_pool[i] = usb_alloc_urb(0, GFP_KERNEL);
|
|
if (!hso_net->mux_bulk_rx_urb_pool[i])
|
|
- goto exit;
|
|
+ goto err_mux_bulk_rx;
|
|
hso_net->mux_bulk_rx_buf_pool[i] = kzalloc(MUX_BULK_RX_BUF_SIZE,
|
|
GFP_KERNEL);
|
|
if (!hso_net->mux_bulk_rx_buf_pool[i])
|
|
- goto exit;
|
|
+ goto err_mux_bulk_rx;
|
|
}
|
|
hso_net->mux_bulk_tx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
|
if (!hso_net->mux_bulk_tx_urb)
|
|
- goto exit;
|
|
+ goto err_mux_bulk_rx;
|
|
hso_net->mux_bulk_tx_buf = kzalloc(MUX_BULK_TX_BUF_SIZE, GFP_KERNEL);
|
|
if (!hso_net->mux_bulk_tx_buf)
|
|
- goto exit;
|
|
+ goto err_free_tx_urb;
|
|
|
|
add_net_device(hso_dev);
|
|
|
|
@@ -2543,7 +2543,7 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
|
|
result = register_netdev(net);
|
|
if (result) {
|
|
dev_err(&interface->dev, "Failed to register device\n");
|
|
- goto exit;
|
|
+ goto err_free_tx_buf;
|
|
}
|
|
|
|
hso_log_port(hso_dev);
|
|
@@ -2551,8 +2551,21 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
|
|
hso_create_rfkill(hso_dev, interface);
|
|
|
|
return hso_dev;
|
|
-exit:
|
|
- hso_free_net_device(hso_dev, true);
|
|
+
|
|
+err_free_tx_buf:
|
|
+ remove_net_device(hso_dev);
|
|
+ kfree(hso_net->mux_bulk_tx_buf);
|
|
+err_free_tx_urb:
|
|
+ usb_free_urb(hso_net->mux_bulk_tx_urb);
|
|
+err_mux_bulk_rx:
|
|
+ for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
|
|
+ usb_free_urb(hso_net->mux_bulk_rx_urb_pool[i]);
|
|
+ kfree(hso_net->mux_bulk_rx_buf_pool[i]);
|
|
+ }
|
|
+err_net:
|
|
+ free_netdev(net);
|
|
+err_hso_dev:
|
|
+ kfree(hso_dev);
|
|
return NULL;
|
|
}
|
|
|
|
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
|
|
index f520a71a361fc..ff5a16b17133d 100644
|
|
--- a/drivers/nvme/host/core.c
|
|
+++ b/drivers/nvme/host/core.c
|
|
@@ -751,7 +751,10 @@ static inline blk_status_t nvme_setup_write_zeroes(struct nvme_ns *ns,
|
|
cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req)));
|
|
cmnd->write_zeroes.length =
|
|
cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);
|
|
- cmnd->write_zeroes.control = 0;
|
|
+ if (nvme_ns_has_pi(ns))
|
|
+ cmnd->write_zeroes.control = cpu_to_le16(NVME_RW_PRINFO_PRACT);
|
|
+ else
|
|
+ cmnd->write_zeroes.control = 0;
|
|
return BLK_STS_OK;
|
|
}
|
|
|
|
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
|
|
index 3f05df98697d3..fb48a88d1acb5 100644
|
|
--- a/drivers/nvme/host/pci.c
|
|
+++ b/drivers/nvme/host/pci.c
|
|
@@ -2596,7 +2596,9 @@ static void nvme_reset_work(struct work_struct *work)
|
|
bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL);
|
|
int result;
|
|
|
|
- if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING)) {
|
|
+ if (dev->ctrl.state != NVME_CTRL_RESETTING) {
|
|
+ dev_warn(dev->ctrl.device, "ctrl state %d is not RESETTING\n",
|
|
+ dev->ctrl.state);
|
|
result = -ENODEV;
|
|
goto out;
|
|
}
|
|
@@ -3003,7 +3005,6 @@ static void nvme_remove(struct pci_dev *pdev)
|
|
if (!pci_device_is_present(pdev)) {
|
|
nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD);
|
|
nvme_dev_disable(dev, true);
|
|
- nvme_dev_remove_admin(dev);
|
|
}
|
|
|
|
flush_work(&dev->ctrl.reset_work);
|
|
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
|
|
index 41bcdfac03d80..bb1122e257dd4 100644
|
|
--- a/drivers/pci/quirks.c
|
|
+++ b/drivers/pci/quirks.c
|
|
@@ -5264,7 +5264,8 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0422, quirk_no_ext_tags);
|
|
static void quirk_amd_harvest_no_ats(struct pci_dev *pdev)
|
|
{
|
|
if ((pdev->device == 0x7312 && pdev->revision != 0x00) ||
|
|
- (pdev->device == 0x7340 && pdev->revision != 0xc5))
|
|
+ (pdev->device == 0x7340 && pdev->revision != 0xc5) ||
|
|
+ (pdev->device == 0x7341 && pdev->revision != 0x00))
|
|
return;
|
|
|
|
pci_info(pdev, "disabling ATS\n");
|
|
@@ -5279,6 +5280,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_amd_harvest_no_ats);
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7312, quirk_amd_harvest_no_ats);
|
|
/* AMD Navi14 dGPU */
|
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7340, quirk_amd_harvest_no_ats);
|
|
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7341, quirk_amd_harvest_no_ats);
|
|
#endif /* CONFIG_PCI_ATS */
|
|
|
|
/* Freescale PCIe doesn't support MSI in RC mode */
|
|
diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c
|
|
index 5123d948efd6f..9eeb59cb81b68 100644
|
|
--- a/drivers/pwm/pwm-sprd.c
|
|
+++ b/drivers/pwm/pwm-sprd.c
|
|
@@ -180,13 +180,10 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
|
|
}
|
|
}
|
|
|
|
- if (state->period != cstate->period ||
|
|
- state->duty_cycle != cstate->duty_cycle) {
|
|
- ret = sprd_pwm_config(spc, pwm, state->duty_cycle,
|
|
- state->period);
|
|
- if (ret)
|
|
- return ret;
|
|
- }
|
|
+ ret = sprd_pwm_config(spc, pwm, state->duty_cycle,
|
|
+ state->period);
|
|
+ if (ret)
|
|
+ return ret;
|
|
|
|
sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_ENABLE, 1);
|
|
} else if (cstate->enabled) {
|
|
diff --git a/drivers/regulator/hi6421-regulator.c b/drivers/regulator/hi6421-regulator.c
|
|
index dc631c1a46b4c..d144a4bdb76da 100644
|
|
--- a/drivers/regulator/hi6421-regulator.c
|
|
+++ b/drivers/regulator/hi6421-regulator.c
|
|
@@ -366,9 +366,8 @@ static struct hi6421_regulator_info
|
|
|
|
static int hi6421_regulator_enable(struct regulator_dev *rdev)
|
|
{
|
|
- struct hi6421_regulator_pdata *pdata;
|
|
+ struct hi6421_regulator_pdata *pdata = rdev_get_drvdata(rdev);
|
|
|
|
- pdata = dev_get_drvdata(rdev->dev.parent);
|
|
/* hi6421 spec requires regulator enablement must be serialized:
|
|
* - Because when BUCK, LDO switching from off to on, it will have
|
|
* a huge instantaneous current; so you can not turn on two or
|
|
@@ -385,9 +384,10 @@ static int hi6421_regulator_enable(struct regulator_dev *rdev)
|
|
|
|
static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev)
|
|
{
|
|
- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev);
|
|
- u32 reg_val;
|
|
+ struct hi6421_regulator_info *info;
|
|
+ unsigned int reg_val;
|
|
|
|
+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
|
|
regmap_read(rdev->regmap, rdev->desc->enable_reg, ®_val);
|
|
if (reg_val & info->mode_mask)
|
|
return REGULATOR_MODE_IDLE;
|
|
@@ -397,9 +397,10 @@ static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev)
|
|
|
|
static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev)
|
|
{
|
|
- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev);
|
|
- u32 reg_val;
|
|
+ struct hi6421_regulator_info *info;
|
|
+ unsigned int reg_val;
|
|
|
|
+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
|
|
regmap_read(rdev->regmap, rdev->desc->enable_reg, ®_val);
|
|
if (reg_val & info->mode_mask)
|
|
return REGULATOR_MODE_STANDBY;
|
|
@@ -410,9 +411,10 @@ static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev)
|
|
static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev,
|
|
unsigned int mode)
|
|
{
|
|
- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev);
|
|
- u32 new_mode;
|
|
+ struct hi6421_regulator_info *info;
|
|
+ unsigned int new_mode;
|
|
|
|
+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
|
|
switch (mode) {
|
|
case REGULATOR_MODE_NORMAL:
|
|
new_mode = 0;
|
|
@@ -434,9 +436,10 @@ static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev,
|
|
static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev,
|
|
unsigned int mode)
|
|
{
|
|
- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev);
|
|
- u32 new_mode;
|
|
+ struct hi6421_regulator_info *info;
|
|
+ unsigned int new_mode;
|
|
|
|
+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
|
|
switch (mode) {
|
|
case REGULATOR_MODE_NORMAL:
|
|
new_mode = 0;
|
|
@@ -459,7 +462,9 @@ static unsigned int
|
|
hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev,
|
|
int input_uV, int output_uV, int load_uA)
|
|
{
|
|
- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev);
|
|
+ struct hi6421_regulator_info *info;
|
|
+
|
|
+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
|
|
|
|
if (load_uA > info->eco_microamp)
|
|
return REGULATOR_MODE_NORMAL;
|
|
@@ -543,14 +548,13 @@ static int hi6421_regulator_probe(struct platform_device *pdev)
|
|
if (!pdata)
|
|
return -ENOMEM;
|
|
mutex_init(&pdata->lock);
|
|
- platform_set_drvdata(pdev, pdata);
|
|
|
|
for (i = 0; i < ARRAY_SIZE(hi6421_regulator_info); i++) {
|
|
/* assign per-regulator data */
|
|
info = &hi6421_regulator_info[i];
|
|
|
|
config.dev = pdev->dev.parent;
|
|
- config.driver_data = info;
|
|
+ config.driver_data = pdata;
|
|
config.regmap = pmic->regmap;
|
|
|
|
rdev = devm_regulator_register(&pdev->dev, &info->desc,
|
|
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
|
|
index 2171dab3e5dc8..ac07a9ef35780 100644
|
|
--- a/drivers/scsi/scsi_transport_iscsi.c
|
|
+++ b/drivers/scsi/scsi_transport_iscsi.c
|
|
@@ -440,39 +440,10 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
|
|
struct device *dev = container_of(kobj, struct device, kobj);
|
|
struct iscsi_iface *iface = iscsi_dev_to_iface(dev);
|
|
struct iscsi_transport *t = iface->transport;
|
|
- int param;
|
|
- int param_type;
|
|
+ int param = -1;
|
|
|
|
if (attr == &dev_attr_iface_enabled.attr)
|
|
param = ISCSI_NET_PARAM_IFACE_ENABLE;
|
|
- else if (attr == &dev_attr_iface_vlan_id.attr)
|
|
- param = ISCSI_NET_PARAM_VLAN_ID;
|
|
- else if (attr == &dev_attr_iface_vlan_priority.attr)
|
|
- param = ISCSI_NET_PARAM_VLAN_PRIORITY;
|
|
- else if (attr == &dev_attr_iface_vlan_enabled.attr)
|
|
- param = ISCSI_NET_PARAM_VLAN_ENABLED;
|
|
- else if (attr == &dev_attr_iface_mtu.attr)
|
|
- param = ISCSI_NET_PARAM_MTU;
|
|
- else if (attr == &dev_attr_iface_port.attr)
|
|
- param = ISCSI_NET_PARAM_PORT;
|
|
- else if (attr == &dev_attr_iface_ipaddress_state.attr)
|
|
- param = ISCSI_NET_PARAM_IPADDR_STATE;
|
|
- else if (attr == &dev_attr_iface_delayed_ack_en.attr)
|
|
- param = ISCSI_NET_PARAM_DELAYED_ACK_EN;
|
|
- else if (attr == &dev_attr_iface_tcp_nagle_disable.attr)
|
|
- param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE;
|
|
- else if (attr == &dev_attr_iface_tcp_wsf_disable.attr)
|
|
- param = ISCSI_NET_PARAM_TCP_WSF_DISABLE;
|
|
- else if (attr == &dev_attr_iface_tcp_wsf.attr)
|
|
- param = ISCSI_NET_PARAM_TCP_WSF;
|
|
- else if (attr == &dev_attr_iface_tcp_timer_scale.attr)
|
|
- param = ISCSI_NET_PARAM_TCP_TIMER_SCALE;
|
|
- else if (attr == &dev_attr_iface_tcp_timestamp_en.attr)
|
|
- param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN;
|
|
- else if (attr == &dev_attr_iface_cache_id.attr)
|
|
- param = ISCSI_NET_PARAM_CACHE_ID;
|
|
- else if (attr == &dev_attr_iface_redirect_en.attr)
|
|
- param = ISCSI_NET_PARAM_REDIRECT_EN;
|
|
else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr)
|
|
param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO;
|
|
else if (attr == &dev_attr_iface_header_digest.attr)
|
|
@@ -509,6 +480,38 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
|
|
param = ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN;
|
|
else if (attr == &dev_attr_iface_initiator_name.attr)
|
|
param = ISCSI_IFACE_PARAM_INITIATOR_NAME;
|
|
+
|
|
+ if (param != -1)
|
|
+ return t->attr_is_visible(ISCSI_IFACE_PARAM, param);
|
|
+
|
|
+ if (attr == &dev_attr_iface_vlan_id.attr)
|
|
+ param = ISCSI_NET_PARAM_VLAN_ID;
|
|
+ else if (attr == &dev_attr_iface_vlan_priority.attr)
|
|
+ param = ISCSI_NET_PARAM_VLAN_PRIORITY;
|
|
+ else if (attr == &dev_attr_iface_vlan_enabled.attr)
|
|
+ param = ISCSI_NET_PARAM_VLAN_ENABLED;
|
|
+ else if (attr == &dev_attr_iface_mtu.attr)
|
|
+ param = ISCSI_NET_PARAM_MTU;
|
|
+ else if (attr == &dev_attr_iface_port.attr)
|
|
+ param = ISCSI_NET_PARAM_PORT;
|
|
+ else if (attr == &dev_attr_iface_ipaddress_state.attr)
|
|
+ param = ISCSI_NET_PARAM_IPADDR_STATE;
|
|
+ else if (attr == &dev_attr_iface_delayed_ack_en.attr)
|
|
+ param = ISCSI_NET_PARAM_DELAYED_ACK_EN;
|
|
+ else if (attr == &dev_attr_iface_tcp_nagle_disable.attr)
|
|
+ param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE;
|
|
+ else if (attr == &dev_attr_iface_tcp_wsf_disable.attr)
|
|
+ param = ISCSI_NET_PARAM_TCP_WSF_DISABLE;
|
|
+ else if (attr == &dev_attr_iface_tcp_wsf.attr)
|
|
+ param = ISCSI_NET_PARAM_TCP_WSF;
|
|
+ else if (attr == &dev_attr_iface_tcp_timer_scale.attr)
|
|
+ param = ISCSI_NET_PARAM_TCP_TIMER_SCALE;
|
|
+ else if (attr == &dev_attr_iface_tcp_timestamp_en.attr)
|
|
+ param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN;
|
|
+ else if (attr == &dev_attr_iface_cache_id.attr)
|
|
+ param = ISCSI_NET_PARAM_CACHE_ID;
|
|
+ else if (attr == &dev_attr_iface_redirect_en.attr)
|
|
+ param = ISCSI_NET_PARAM_REDIRECT_EN;
|
|
else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
|
|
if (attr == &dev_attr_ipv4_iface_ipaddress.attr)
|
|
param = ISCSI_NET_PARAM_IPV4_ADDR;
|
|
@@ -599,32 +602,7 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
|
|
return 0;
|
|
}
|
|
|
|
- switch (param) {
|
|
- case ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO:
|
|
- case ISCSI_IFACE_PARAM_HDRDGST_EN:
|
|
- case ISCSI_IFACE_PARAM_DATADGST_EN:
|
|
- case ISCSI_IFACE_PARAM_IMM_DATA_EN:
|
|
- case ISCSI_IFACE_PARAM_INITIAL_R2T_EN:
|
|
- case ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN:
|
|
- case ISCSI_IFACE_PARAM_PDU_INORDER_EN:
|
|
- case ISCSI_IFACE_PARAM_ERL:
|
|
- case ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH:
|
|
- case ISCSI_IFACE_PARAM_FIRST_BURST:
|
|
- case ISCSI_IFACE_PARAM_MAX_R2T:
|
|
- case ISCSI_IFACE_PARAM_MAX_BURST:
|
|
- case ISCSI_IFACE_PARAM_CHAP_AUTH_EN:
|
|
- case ISCSI_IFACE_PARAM_BIDI_CHAP_EN:
|
|
- case ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL:
|
|
- case ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN:
|
|
- case ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN:
|
|
- case ISCSI_IFACE_PARAM_INITIATOR_NAME:
|
|
- param_type = ISCSI_IFACE_PARAM;
|
|
- break;
|
|
- default:
|
|
- param_type = ISCSI_NET_PARAM;
|
|
- }
|
|
-
|
|
- return t->attr_is_visible(param_type, param);
|
|
+ return t->attr_is_visible(ISCSI_NET_PARAM, param);
|
|
}
|
|
|
|
static struct attribute *iscsi_iface_attrs[] = {
|
|
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
|
|
index 29ee555a42f90..33c32e9317675 100644
|
|
--- a/drivers/spi/spi-bcm2835.c
|
|
+++ b/drivers/spi/spi-bcm2835.c
|
|
@@ -84,6 +84,7 @@ MODULE_PARM_DESC(polling_limit_us,
|
|
* struct bcm2835_spi - BCM2835 SPI controller
|
|
* @regs: base address of register map
|
|
* @clk: core clock, divided to calculate serial clock
|
|
+ * @clk_hz: core clock cached speed
|
|
* @irq: interrupt, signals TX FIFO empty or RX FIFO ¾ full
|
|
* @tfr: SPI transfer currently processed
|
|
* @ctlr: SPI controller reverse lookup
|
|
@@ -124,6 +125,7 @@ MODULE_PARM_DESC(polling_limit_us,
|
|
struct bcm2835_spi {
|
|
void __iomem *regs;
|
|
struct clk *clk;
|
|
+ unsigned long clk_hz;
|
|
int irq;
|
|
struct spi_transfer *tfr;
|
|
struct spi_controller *ctlr;
|
|
@@ -1082,19 +1084,18 @@ static int bcm2835_spi_transfer_one(struct spi_controller *ctlr,
|
|
struct spi_transfer *tfr)
|
|
{
|
|
struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
|
|
- unsigned long spi_hz, clk_hz, cdiv;
|
|
+ unsigned long spi_hz, cdiv;
|
|
unsigned long hz_per_byte, byte_limit;
|
|
u32 cs = bs->prepare_cs[spi->chip_select];
|
|
|
|
/* set clock */
|
|
spi_hz = tfr->speed_hz;
|
|
- clk_hz = clk_get_rate(bs->clk);
|
|
|
|
- if (spi_hz >= clk_hz / 2) {
|
|
+ if (spi_hz >= bs->clk_hz / 2) {
|
|
cdiv = 2; /* clk_hz/2 is the fastest we can go */
|
|
} else if (spi_hz) {
|
|
/* CDIV must be a multiple of two */
|
|
- cdiv = DIV_ROUND_UP(clk_hz, spi_hz);
|
|
+ cdiv = DIV_ROUND_UP(bs->clk_hz, spi_hz);
|
|
cdiv += (cdiv % 2);
|
|
|
|
if (cdiv >= 65536)
|
|
@@ -1102,7 +1103,7 @@ static int bcm2835_spi_transfer_one(struct spi_controller *ctlr,
|
|
} else {
|
|
cdiv = 0; /* 0 is the slowest we can go */
|
|
}
|
|
- tfr->effective_speed_hz = cdiv ? (clk_hz / cdiv) : (clk_hz / 65536);
|
|
+ tfr->effective_speed_hz = cdiv ? (bs->clk_hz / cdiv) : (bs->clk_hz / 65536);
|
|
bcm2835_wr(bs, BCM2835_SPI_CLK, cdiv);
|
|
|
|
/* handle all the 3-wire mode */
|
|
@@ -1318,6 +1319,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
|
|
return bs->irq ? bs->irq : -ENODEV;
|
|
|
|
clk_prepare_enable(bs->clk);
|
|
+ bs->clk_hz = clk_get_rate(bs->clk);
|
|
|
|
err = bcm2835_dma_init(ctlr, &pdev->dev, bs);
|
|
if (err)
|
|
diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
|
|
index a3afd1b9ac567..ceb16e70d235a 100644
|
|
--- a/drivers/spi/spi-cadence.c
|
|
+++ b/drivers/spi/spi-cadence.c
|
|
@@ -517,6 +517,12 @@ static int cdns_spi_probe(struct platform_device *pdev)
|
|
goto clk_dis_apb;
|
|
}
|
|
|
|
+ pm_runtime_use_autosuspend(&pdev->dev);
|
|
+ pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
|
|
+ pm_runtime_get_noresume(&pdev->dev);
|
|
+ pm_runtime_set_active(&pdev->dev);
|
|
+ pm_runtime_enable(&pdev->dev);
|
|
+
|
|
ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs);
|
|
if (ret < 0)
|
|
master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS;
|
|
@@ -531,11 +537,6 @@ static int cdns_spi_probe(struct platform_device *pdev)
|
|
/* SPI controller initializations */
|
|
cdns_spi_init_hw(xspi);
|
|
|
|
- pm_runtime_set_active(&pdev->dev);
|
|
- pm_runtime_enable(&pdev->dev);
|
|
- pm_runtime_use_autosuspend(&pdev->dev);
|
|
- pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
|
|
-
|
|
irq = platform_get_irq(pdev, 0);
|
|
if (irq <= 0) {
|
|
ret = -ENXIO;
|
|
@@ -566,6 +567,9 @@ static int cdns_spi_probe(struct platform_device *pdev)
|
|
|
|
master->bits_per_word_mask = SPI_BPW_MASK(8);
|
|
|
|
+ pm_runtime_mark_last_busy(&pdev->dev);
|
|
+ pm_runtime_put_autosuspend(&pdev->dev);
|
|
+
|
|
ret = spi_register_master(master);
|
|
if (ret) {
|
|
dev_err(&pdev->dev, "spi_register_master failed\n");
|
|
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
|
|
index 831a38920fa98..c8b750d8ac35f 100644
|
|
--- a/drivers/spi/spi-imx.c
|
|
+++ b/drivers/spi/spi-imx.c
|
|
@@ -66,8 +66,7 @@ struct spi_imx_data;
|
|
struct spi_imx_devtype_data {
|
|
void (*intctrl)(struct spi_imx_data *, int);
|
|
int (*prepare_message)(struct spi_imx_data *, struct spi_message *);
|
|
- int (*prepare_transfer)(struct spi_imx_data *, struct spi_device *,
|
|
- struct spi_transfer *);
|
|
+ int (*prepare_transfer)(struct spi_imx_data *, struct spi_device *);
|
|
void (*trigger)(struct spi_imx_data *);
|
|
int (*rx_available)(struct spi_imx_data *);
|
|
void (*reset)(struct spi_imx_data *);
|
|
@@ -572,11 +571,10 @@ static int mx51_ecspi_prepare_message(struct spi_imx_data *spi_imx,
|
|
}
|
|
|
|
static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
|
|
- struct spi_device *spi,
|
|
- struct spi_transfer *t)
|
|
+ struct spi_device *spi)
|
|
{
|
|
u32 ctrl = readl(spi_imx->base + MX51_ECSPI_CTRL);
|
|
- u32 clk = t->speed_hz, delay;
|
|
+ u32 clk, delay;
|
|
|
|
/* Clear BL field and set the right value */
|
|
ctrl &= ~MX51_ECSPI_CTRL_BL_MASK;
|
|
@@ -590,7 +588,7 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
|
|
/* set clock speed */
|
|
ctrl &= ~(0xf << MX51_ECSPI_CTRL_POSTDIV_OFFSET |
|
|
0xf << MX51_ECSPI_CTRL_PREDIV_OFFSET);
|
|
- ctrl |= mx51_ecspi_clkdiv(spi_imx, t->speed_hz, &clk);
|
|
+ ctrl |= mx51_ecspi_clkdiv(spi_imx, spi_imx->spi_bus_clk, &clk);
|
|
spi_imx->spi_bus_clk = clk;
|
|
|
|
if (spi_imx->usedma)
|
|
@@ -702,13 +700,12 @@ static int mx31_prepare_message(struct spi_imx_data *spi_imx,
|
|
}
|
|
|
|
static int mx31_prepare_transfer(struct spi_imx_data *spi_imx,
|
|
- struct spi_device *spi,
|
|
- struct spi_transfer *t)
|
|
+ struct spi_device *spi)
|
|
{
|
|
unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER;
|
|
unsigned int clk;
|
|
|
|
- reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, t->speed_hz, &clk) <<
|
|
+ reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, spi_imx->spi_bus_clk, &clk) <<
|
|
MX31_CSPICTRL_DR_SHIFT;
|
|
spi_imx->spi_bus_clk = clk;
|
|
|
|
@@ -807,14 +804,13 @@ static int mx21_prepare_message(struct spi_imx_data *spi_imx,
|
|
}
|
|
|
|
static int mx21_prepare_transfer(struct spi_imx_data *spi_imx,
|
|
- struct spi_device *spi,
|
|
- struct spi_transfer *t)
|
|
+ struct spi_device *spi)
|
|
{
|
|
unsigned int reg = MX21_CSPICTRL_ENABLE | MX21_CSPICTRL_MASTER;
|
|
unsigned int max = is_imx27_cspi(spi_imx) ? 16 : 18;
|
|
unsigned int clk;
|
|
|
|
- reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, t->speed_hz, max, &clk)
|
|
+ reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, spi_imx->spi_bus_clk, max, &clk)
|
|
<< MX21_CSPICTRL_DR_SHIFT;
|
|
spi_imx->spi_bus_clk = clk;
|
|
|
|
@@ -883,13 +879,12 @@ static int mx1_prepare_message(struct spi_imx_data *spi_imx,
|
|
}
|
|
|
|
static int mx1_prepare_transfer(struct spi_imx_data *spi_imx,
|
|
- struct spi_device *spi,
|
|
- struct spi_transfer *t)
|
|
+ struct spi_device *spi)
|
|
{
|
|
unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER;
|
|
unsigned int clk;
|
|
|
|
- reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, t->speed_hz, &clk) <<
|
|
+ reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, spi_imx->spi_bus_clk, &clk) <<
|
|
MX1_CSPICTRL_DR_SHIFT;
|
|
spi_imx->spi_bus_clk = clk;
|
|
|
|
@@ -1195,6 +1190,16 @@ static int spi_imx_setupxfer(struct spi_device *spi,
|
|
if (!t)
|
|
return 0;
|
|
|
|
+ if (!t->speed_hz) {
|
|
+ if (!spi->max_speed_hz) {
|
|
+ dev_err(&spi->dev, "no speed_hz provided!\n");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ dev_dbg(&spi->dev, "using spi->max_speed_hz!\n");
|
|
+ spi_imx->spi_bus_clk = spi->max_speed_hz;
|
|
+ } else
|
|
+ spi_imx->spi_bus_clk = t->speed_hz;
|
|
+
|
|
spi_imx->bits_per_word = t->bits_per_word;
|
|
|
|
/*
|
|
@@ -1236,7 +1241,7 @@ static int spi_imx_setupxfer(struct spi_device *spi,
|
|
spi_imx->slave_burst = t->len;
|
|
}
|
|
|
|
- spi_imx->devtype_data->prepare_transfer(spi_imx, spi, t);
|
|
+ spi_imx->devtype_data->prepare_transfer(spi_imx, spi);
|
|
|
|
return 0;
|
|
}
|
|
diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
|
|
index 5d643051bf3de..8f2d112f0b5d4 100644
|
|
--- a/drivers/spi/spi-mt65xx.c
|
|
+++ b/drivers/spi/spi-mt65xx.c
|
|
@@ -434,13 +434,23 @@ static int mtk_spi_fifo_transfer(struct spi_master *master,
|
|
mtk_spi_setup_packet(master);
|
|
|
|
cnt = xfer->len / 4;
|
|
- iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt);
|
|
+ if (xfer->tx_buf)
|
|
+ iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt);
|
|
+
|
|
+ if (xfer->rx_buf)
|
|
+ ioread32_rep(mdata->base + SPI_RX_DATA_REG, xfer->rx_buf, cnt);
|
|
|
|
remainder = xfer->len % 4;
|
|
if (remainder > 0) {
|
|
reg_val = 0;
|
|
- memcpy(®_val, xfer->tx_buf + (cnt * 4), remainder);
|
|
- writel(reg_val, mdata->base + SPI_TX_DATA_REG);
|
|
+ if (xfer->tx_buf) {
|
|
+ memcpy(®_val, xfer->tx_buf + (cnt * 4), remainder);
|
|
+ writel(reg_val, mdata->base + SPI_TX_DATA_REG);
|
|
+ }
|
|
+ if (xfer->rx_buf) {
|
|
+ reg_val = readl(mdata->base + SPI_RX_DATA_REG);
|
|
+ memcpy(xfer->rx_buf + (cnt * 4), ®_val, remainder);
|
|
+ }
|
|
}
|
|
|
|
mtk_spi_enable_transfer(master);
|
|
diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
|
|
index 0318f02d62123..8f91f8705eeea 100644
|
|
--- a/drivers/spi/spi-stm32.c
|
|
+++ b/drivers/spi/spi-stm32.c
|
|
@@ -1946,6 +1946,7 @@ static int stm32_spi_probe(struct platform_device *pdev)
|
|
master->can_dma = stm32_spi_can_dma;
|
|
|
|
pm_runtime_set_active(&pdev->dev);
|
|
+ pm_runtime_get_noresume(&pdev->dev);
|
|
pm_runtime_enable(&pdev->dev);
|
|
|
|
ret = spi_register_master(master);
|
|
@@ -1967,6 +1968,8 @@ static int stm32_spi_probe(struct platform_device *pdev)
|
|
|
|
err_pm_disable:
|
|
pm_runtime_disable(&pdev->dev);
|
|
+ pm_runtime_put_noidle(&pdev->dev);
|
|
+ pm_runtime_set_suspended(&pdev->dev);
|
|
err_dma_release:
|
|
if (spi->dma_tx)
|
|
dma_release_channel(spi->dma_tx);
|
|
@@ -1983,9 +1986,14 @@ static int stm32_spi_remove(struct platform_device *pdev)
|
|
struct spi_master *master = platform_get_drvdata(pdev);
|
|
struct stm32_spi *spi = spi_master_get_devdata(master);
|
|
|
|
+ pm_runtime_get_sync(&pdev->dev);
|
|
+
|
|
spi_unregister_master(master);
|
|
spi->cfg->disable(spi);
|
|
|
|
+ pm_runtime_disable(&pdev->dev);
|
|
+ pm_runtime_put_noidle(&pdev->dev);
|
|
+ pm_runtime_set_suspended(&pdev->dev);
|
|
if (master->dma_tx)
|
|
dma_release_channel(master->dma_tx);
|
|
if (master->dma_rx)
|
|
@@ -1993,7 +2001,6 @@ static int stm32_spi_remove(struct platform_device *pdev)
|
|
|
|
clk_disable_unprepare(spi->clk);
|
|
|
|
- pm_runtime_disable(&pdev->dev);
|
|
|
|
pinctrl_pm_select_sleep_state(&pdev->dev);
|
|
|
|
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
|
|
index 6e8b8d30938f6..eaf8551ebc612 100644
|
|
--- a/drivers/target/target_core_sbc.c
|
|
+++ b/drivers/target/target_core_sbc.c
|
|
@@ -25,7 +25,7 @@
|
|
#include "target_core_alua.h"
|
|
|
|
static sense_reason_t
|
|
-sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char *, u32, bool);
|
|
+sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char, u32, bool);
|
|
static sense_reason_t sbc_execute_unmap(struct se_cmd *cmd);
|
|
|
|
static sense_reason_t
|
|
@@ -279,14 +279,14 @@ static inline unsigned long long transport_lba_64_ext(unsigned char *cdb)
|
|
}
|
|
|
|
static sense_reason_t
|
|
-sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *ops)
|
|
+sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *ops)
|
|
{
|
|
struct se_device *dev = cmd->se_dev;
|
|
sector_t end_lba = dev->transport->get_blocks(dev) + 1;
|
|
unsigned int sectors = sbc_get_write_same_sectors(cmd);
|
|
sense_reason_t ret;
|
|
|
|
- if ((flags[0] & 0x04) || (flags[0] & 0x02)) {
|
|
+ if ((flags & 0x04) || (flags & 0x02)) {
|
|
pr_err("WRITE_SAME PBDATA and LBDATA"
|
|
" bits not supported for Block Discard"
|
|
" Emulation\n");
|
|
@@ -308,7 +308,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
|
|
}
|
|
|
|
/* We always have ANC_SUP == 0 so setting ANCHOR is always an error */
|
|
- if (flags[0] & 0x10) {
|
|
+ if (flags & 0x10) {
|
|
pr_warn("WRITE SAME with ANCHOR not supported\n");
|
|
return TCM_INVALID_CDB_FIELD;
|
|
}
|
|
@@ -316,7 +316,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
|
|
* Special case for WRITE_SAME w/ UNMAP=1 that ends up getting
|
|
* translated into block discard requests within backend code.
|
|
*/
|
|
- if (flags[0] & 0x08) {
|
|
+ if (flags & 0x08) {
|
|
if (!ops->execute_unmap)
|
|
return TCM_UNSUPPORTED_SCSI_OPCODE;
|
|
|
|
@@ -331,7 +331,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
|
|
if (!ops->execute_write_same)
|
|
return TCM_UNSUPPORTED_SCSI_OPCODE;
|
|
|
|
- ret = sbc_check_prot(dev, cmd, &cmd->t_task_cdb[0], sectors, true);
|
|
+ ret = sbc_check_prot(dev, cmd, flags >> 5, sectors, true);
|
|
if (ret)
|
|
return ret;
|
|
|
|
@@ -686,10 +686,9 @@ sbc_set_prot_op_checks(u8 protect, bool fabric_prot, enum target_prot_type prot_
|
|
}
|
|
|
|
static sense_reason_t
|
|
-sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb,
|
|
+sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char protect,
|
|
u32 sectors, bool is_write)
|
|
{
|
|
- u8 protect = cdb[1] >> 5;
|
|
int sp_ops = cmd->se_sess->sup_prot_ops;
|
|
int pi_prot_type = dev->dev_attrib.pi_prot_type;
|
|
bool fabric_prot = false;
|
|
@@ -737,7 +736,7 @@ sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb,
|
|
fallthrough;
|
|
default:
|
|
pr_err("Unable to determine pi_prot_type for CDB: 0x%02x "
|
|
- "PROTECT: 0x%02x\n", cdb[0], protect);
|
|
+ "PROTECT: 0x%02x\n", cmd->t_task_cdb[0], protect);
|
|
return TCM_INVALID_CDB_FIELD;
|
|
}
|
|
|
|
@@ -812,7 +811,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
|
|
if (sbc_check_dpofua(dev, cmd, cdb))
|
|
return TCM_INVALID_CDB_FIELD;
|
|
|
|
- ret = sbc_check_prot(dev, cmd, cdb, sectors, false);
|
|
+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false);
|
|
if (ret)
|
|
return ret;
|
|
|
|
@@ -826,7 +825,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
|
|
if (sbc_check_dpofua(dev, cmd, cdb))
|
|
return TCM_INVALID_CDB_FIELD;
|
|
|
|
- ret = sbc_check_prot(dev, cmd, cdb, sectors, false);
|
|
+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false);
|
|
if (ret)
|
|
return ret;
|
|
|
|
@@ -840,7 +839,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
|
|
if (sbc_check_dpofua(dev, cmd, cdb))
|
|
return TCM_INVALID_CDB_FIELD;
|
|
|
|
- ret = sbc_check_prot(dev, cmd, cdb, sectors, false);
|
|
+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false);
|
|
if (ret)
|
|
return ret;
|
|
|
|
@@ -861,7 +860,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
|
|
if (sbc_check_dpofua(dev, cmd, cdb))
|
|
return TCM_INVALID_CDB_FIELD;
|
|
|
|
- ret = sbc_check_prot(dev, cmd, cdb, sectors, true);
|
|
+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true);
|
|
if (ret)
|
|
return ret;
|
|
|
|
@@ -875,7 +874,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
|
|
if (sbc_check_dpofua(dev, cmd, cdb))
|
|
return TCM_INVALID_CDB_FIELD;
|
|
|
|
- ret = sbc_check_prot(dev, cmd, cdb, sectors, true);
|
|
+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true);
|
|
if (ret)
|
|
return ret;
|
|
|
|
@@ -890,7 +889,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
|
|
if (sbc_check_dpofua(dev, cmd, cdb))
|
|
return TCM_INVALID_CDB_FIELD;
|
|
|
|
- ret = sbc_check_prot(dev, cmd, cdb, sectors, true);
|
|
+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true);
|
|
if (ret)
|
|
return ret;
|
|
|
|
@@ -949,7 +948,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
|
|
size = sbc_get_size(cmd, 1);
|
|
cmd->t_task_lba = get_unaligned_be64(&cdb[12]);
|
|
|
|
- ret = sbc_setup_write_same(cmd, &cdb[10], ops);
|
|
+ ret = sbc_setup_write_same(cmd, cdb[10], ops);
|
|
if (ret)
|
|
return ret;
|
|
break;
|
|
@@ -1048,7 +1047,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
|
|
size = sbc_get_size(cmd, 1);
|
|
cmd->t_task_lba = get_unaligned_be64(&cdb[2]);
|
|
|
|
- ret = sbc_setup_write_same(cmd, &cdb[1], ops);
|
|
+ ret = sbc_setup_write_same(cmd, cdb[1], ops);
|
|
if (ret)
|
|
return ret;
|
|
break;
|
|
@@ -1066,7 +1065,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
|
|
* Follow sbcr26 with WRITE_SAME (10) and check for the existence
|
|
* of byte 1 bit 3 UNMAP instead of original reserved field
|
|
*/
|
|
- ret = sbc_setup_write_same(cmd, &cdb[1], ops);
|
|
+ ret = sbc_setup_write_same(cmd, cdb[1], ops);
|
|
if (ret)
|
|
return ret;
|
|
break;
|
|
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
|
|
index 357730e8f52f2..95a9bae72f135 100644
|
|
--- a/drivers/usb/core/hub.c
|
|
+++ b/drivers/usb/core/hub.c
|
|
@@ -47,6 +47,7 @@
|
|
|
|
#define USB_TP_TRANSMISSION_DELAY 40 /* ns */
|
|
#define USB_TP_TRANSMISSION_DELAY_MAX 65535 /* ns */
|
|
+#define USB_PING_RESPONSE_TIME 400 /* ns */
|
|
|
|
/* Protect struct usb_device->state and ->children members
|
|
* Note: Both are also protected by ->dev.sem, except that ->state can
|
|
@@ -181,8 +182,9 @@ int usb_device_supports_lpm(struct usb_device *udev)
|
|
}
|
|
|
|
/*
|
|
- * Set the Maximum Exit Latency (MEL) for the host to initiate a transition from
|
|
- * either U1 or U2.
|
|
+ * Set the Maximum Exit Latency (MEL) for the host to wakup up the path from
|
|
+ * U1/U2, send a PING to the device and receive a PING_RESPONSE.
|
|
+ * See USB 3.1 section C.1.5.2
|
|
*/
|
|
static void usb_set_lpm_mel(struct usb_device *udev,
|
|
struct usb3_lpm_parameters *udev_lpm_params,
|
|
@@ -192,35 +194,37 @@ static void usb_set_lpm_mel(struct usb_device *udev,
|
|
unsigned int hub_exit_latency)
|
|
{
|
|
unsigned int total_mel;
|
|
- unsigned int device_mel;
|
|
- unsigned int hub_mel;
|
|
|
|
/*
|
|
- * Calculate the time it takes to transition all links from the roothub
|
|
- * to the parent hub into U0. The parent hub must then decode the
|
|
- * packet (hub header decode latency) to figure out which port it was
|
|
- * bound for.
|
|
- *
|
|
- * The Hub Header decode latency is expressed in 0.1us intervals (0x1
|
|
- * means 0.1us). Multiply that by 100 to get nanoseconds.
|
|
+ * tMEL1. time to transition path from host to device into U0.
|
|
+ * MEL for parent already contains the delay up to parent, so only add
|
|
+ * the exit latency for the last link (pick the slower exit latency),
|
|
+ * and the hub header decode latency. See USB 3.1 section C 2.2.1
|
|
+ * Store MEL in nanoseconds
|
|
*/
|
|
total_mel = hub_lpm_params->mel +
|
|
- (hub->descriptor->u.ss.bHubHdrDecLat * 100);
|
|
+ max(udev_exit_latency, hub_exit_latency) * 1000 +
|
|
+ hub->descriptor->u.ss.bHubHdrDecLat * 100;
|
|
|
|
/*
|
|
- * How long will it take to transition the downstream hub's port into
|
|
- * U0? The greater of either the hub exit latency or the device exit
|
|
- * latency.
|
|
- *
|
|
- * The BOS U1/U2 exit latencies are expressed in 1us intervals.
|
|
- * Multiply that by 1000 to get nanoseconds.
|
|
+ * tMEL2. Time to submit PING packet. Sum of tTPTransmissionDelay for
|
|
+ * each link + wHubDelay for each hub. Add only for last link.
|
|
+ * tMEL4, the time for PING_RESPONSE to traverse upstream is similar.
|
|
+ * Multiply by 2 to include it as well.
|
|
*/
|
|
- device_mel = udev_exit_latency * 1000;
|
|
- hub_mel = hub_exit_latency * 1000;
|
|
- if (device_mel > hub_mel)
|
|
- total_mel += device_mel;
|
|
- else
|
|
- total_mel += hub_mel;
|
|
+ total_mel += (__le16_to_cpu(hub->descriptor->u.ss.wHubDelay) +
|
|
+ USB_TP_TRANSMISSION_DELAY) * 2;
|
|
+
|
|
+ /*
|
|
+ * tMEL3, tPingResponse. Time taken by device to generate PING_RESPONSE
|
|
+ * after receiving PING. Also add 2100ns as stated in USB 3.1 C 1.5.2.4
|
|
+ * to cover the delay if the PING_RESPONSE is queued behind a Max Packet
|
|
+ * Size DP.
|
|
+ * Note these delays should be added only once for the entire path, so
|
|
+ * add them to the MEL of the device connected to the roothub.
|
|
+ */
|
|
+ if (!hub->hdev->parent)
|
|
+ total_mel += USB_PING_RESPONSE_TIME + 2100;
|
|
|
|
udev_lpm_params->mel = total_mel;
|
|
}
|
|
@@ -4040,6 +4044,47 @@ static int usb_set_lpm_timeout(struct usb_device *udev,
|
|
return 0;
|
|
}
|
|
|
|
+/*
|
|
+ * Don't allow device intiated U1/U2 if the system exit latency + one bus
|
|
+ * interval is greater than the minimum service interval of any active
|
|
+ * periodic endpoint. See USB 3.2 section 9.4.9
|
|
+ */
|
|
+static bool usb_device_may_initiate_lpm(struct usb_device *udev,
|
|
+ enum usb3_link_state state)
|
|
+{
|
|
+ unsigned int sel; /* us */
|
|
+ int i, j;
|
|
+
|
|
+ if (state == USB3_LPM_U1)
|
|
+ sel = DIV_ROUND_UP(udev->u1_params.sel, 1000);
|
|
+ else if (state == USB3_LPM_U2)
|
|
+ sel = DIV_ROUND_UP(udev->u2_params.sel, 1000);
|
|
+ else
|
|
+ return false;
|
|
+
|
|
+ for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
|
|
+ struct usb_interface *intf;
|
|
+ struct usb_endpoint_descriptor *desc;
|
|
+ unsigned int interval;
|
|
+
|
|
+ intf = udev->actconfig->interface[i];
|
|
+ if (!intf)
|
|
+ continue;
|
|
+
|
|
+ for (j = 0; j < intf->cur_altsetting->desc.bNumEndpoints; j++) {
|
|
+ desc = &intf->cur_altsetting->endpoint[j].desc;
|
|
+
|
|
+ if (usb_endpoint_xfer_int(desc) ||
|
|
+ usb_endpoint_xfer_isoc(desc)) {
|
|
+ interval = (1 << (desc->bInterval - 1)) * 125;
|
|
+ if (sel + 125 > interval)
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ return true;
|
|
+}
|
|
+
|
|
/*
|
|
* Enable the hub-initiated U1/U2 idle timeouts, and enable device-initiated
|
|
* U1/U2 entry.
|
|
@@ -4112,20 +4157,23 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev,
|
|
* U1/U2_ENABLE
|
|
*/
|
|
if (udev->actconfig &&
|
|
- usb_set_device_initiated_lpm(udev, state, true) == 0) {
|
|
- if (state == USB3_LPM_U1)
|
|
- udev->usb3_lpm_u1_enabled = 1;
|
|
- else if (state == USB3_LPM_U2)
|
|
- udev->usb3_lpm_u2_enabled = 1;
|
|
- } else {
|
|
- /* Don't request U1/U2 entry if the device
|
|
- * cannot transition to U1/U2.
|
|
- */
|
|
- usb_set_lpm_timeout(udev, state, 0);
|
|
- hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state);
|
|
+ usb_device_may_initiate_lpm(udev, state)) {
|
|
+ if (usb_set_device_initiated_lpm(udev, state, true)) {
|
|
+ /*
|
|
+ * Request to enable device initiated U1/U2 failed,
|
|
+ * better to turn off lpm in this case.
|
|
+ */
|
|
+ usb_set_lpm_timeout(udev, state, 0);
|
|
+ hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state);
|
|
+ return;
|
|
+ }
|
|
}
|
|
-}
|
|
|
|
+ if (state == USB3_LPM_U1)
|
|
+ udev->usb3_lpm_u1_enabled = 1;
|
|
+ else if (state == USB3_LPM_U2)
|
|
+ udev->usb3_lpm_u2_enabled = 1;
|
|
+}
|
|
/*
|
|
* Disable the hub-initiated U1/U2 idle timeouts, and disable device-initiated
|
|
* U1/U2 entry.
|
|
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
|
|
index 21e7522655ac9..a54a735b63843 100644
|
|
--- a/drivers/usb/core/quirks.c
|
|
+++ b/drivers/usb/core/quirks.c
|
|
@@ -502,10 +502,6 @@ static const struct usb_device_id usb_quirk_list[] = {
|
|
/* DJI CineSSD */
|
|
{ USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
|
|
|
|
- /* Fibocom L850-GL LTE Modem */
|
|
- { USB_DEVICE(0x2cb7, 0x0007), .driver_info =
|
|
- USB_QUIRK_IGNORE_REMOTE_WAKEUP },
|
|
-
|
|
/* INTEL VALUE SSD */
|
|
{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
|
|
|
|
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
|
|
index d2f623d83bf78..b06286f132c6f 100644
|
|
--- a/drivers/usb/dwc2/gadget.c
|
|
+++ b/drivers/usb/dwc2/gadget.c
|
|
@@ -2749,12 +2749,14 @@ static void dwc2_hsotg_complete_in(struct dwc2_hsotg *hsotg,
|
|
return;
|
|
}
|
|
|
|
- /* Zlp for all endpoints, for ep0 only in DATA IN stage */
|
|
+ /* Zlp for all endpoints in non DDMA, for ep0 only in DATA IN stage */
|
|
if (hs_ep->send_zlp) {
|
|
- dwc2_hsotg_program_zlp(hsotg, hs_ep);
|
|
hs_ep->send_zlp = 0;
|
|
- /* transfer will be completed on next complete interrupt */
|
|
- return;
|
|
+ if (!using_desc_dma(hsotg)) {
|
|
+ dwc2_hsotg_program_zlp(hsotg, hs_ep);
|
|
+ /* transfer will be completed on next complete interrupt */
|
|
+ return;
|
|
+ }
|
|
}
|
|
|
|
if (hs_ep->index == 0 && hsotg->ep0_state == DWC2_EP0_DATA_IN) {
|
|
@@ -3900,9 +3902,27 @@ static void dwc2_hsotg_ep_stop_xfr(struct dwc2_hsotg *hsotg,
|
|
__func__);
|
|
}
|
|
} else {
|
|
+ /* Mask GINTSTS_GOUTNAKEFF interrupt */
|
|
+ dwc2_hsotg_disable_gsint(hsotg, GINTSTS_GOUTNAKEFF);
|
|
+
|
|
if (!(dwc2_readl(hsotg, GINTSTS) & GINTSTS_GOUTNAKEFF))
|
|
dwc2_set_bit(hsotg, DCTL, DCTL_SGOUTNAK);
|
|
|
|
+ if (!using_dma(hsotg)) {
|
|
+ /* Wait for GINTSTS_RXFLVL interrupt */
|
|
+ if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS,
|
|
+ GINTSTS_RXFLVL, 100)) {
|
|
+ dev_warn(hsotg->dev, "%s: timeout GINTSTS.RXFLVL\n",
|
|
+ __func__);
|
|
+ } else {
|
|
+ /*
|
|
+ * Pop GLOBAL OUT NAK status packet from RxFIFO
|
|
+ * to assert GOUTNAKEFF interrupt
|
|
+ */
|
|
+ dwc2_readl(hsotg, GRXSTSP);
|
|
+ }
|
|
+ }
|
|
+
|
|
/* Wait for global nak to take effect */
|
|
if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS,
|
|
GINTSTS_GOUTNAKEFF, 100))
|
|
@@ -4348,6 +4368,9 @@ static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now)
|
|
epctl = dwc2_readl(hs, epreg);
|
|
|
|
if (value) {
|
|
+ /* Unmask GOUTNAKEFF interrupt */
|
|
+ dwc2_hsotg_en_gsint(hs, GINTSTS_GOUTNAKEFF);
|
|
+
|
|
if (!(dwc2_readl(hs, GINTSTS) & GINTSTS_GOUTNAKEFF))
|
|
dwc2_set_bit(hs, DCTL, DCTL_SGOUTNAK);
|
|
// STALL bit will be set in GOUTNAKEFF interrupt handler
|
|
diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
|
|
index 2319c9737c2bd..f3f112b08c9b1 100644
|
|
--- a/drivers/usb/gadget/udc/tegra-xudc.c
|
|
+++ b/drivers/usb/gadget/udc/tegra-xudc.c
|
|
@@ -3861,6 +3861,7 @@ static int tegra_xudc_probe(struct platform_device *pdev)
|
|
return 0;
|
|
|
|
free_eps:
|
|
+ pm_runtime_disable(&pdev->dev);
|
|
tegra_xudc_free_eps(xudc);
|
|
free_event_ring:
|
|
tegra_xudc_free_event_ring(xudc);
|
|
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
|
|
index b5db2b2d0901a..6793fd99c1cb4 100644
|
|
--- a/drivers/usb/host/ehci-hcd.c
|
|
+++ b/drivers/usb/host/ehci-hcd.c
|
|
@@ -703,7 +703,8 @@ EXPORT_SYMBOL_GPL(ehci_setup);
|
|
static irqreturn_t ehci_irq (struct usb_hcd *hcd)
|
|
{
|
|
struct ehci_hcd *ehci = hcd_to_ehci (hcd);
|
|
- u32 status, masked_status, pcd_status = 0, cmd;
|
|
+ u32 status, current_status, masked_status, pcd_status = 0;
|
|
+ u32 cmd;
|
|
int bh;
|
|
unsigned long flags;
|
|
|
|
@@ -715,19 +716,22 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
|
|
*/
|
|
spin_lock_irqsave(&ehci->lock, flags);
|
|
|
|
- status = ehci_readl(ehci, &ehci->regs->status);
|
|
+ status = 0;
|
|
+ current_status = ehci_readl(ehci, &ehci->regs->status);
|
|
+restart:
|
|
|
|
/* e.g. cardbus physical eject */
|
|
- if (status == ~(u32) 0) {
|
|
+ if (current_status == ~(u32) 0) {
|
|
ehci_dbg (ehci, "device removed\n");
|
|
goto dead;
|
|
}
|
|
+ status |= current_status;
|
|
|
|
/*
|
|
* We don't use STS_FLR, but some controllers don't like it to
|
|
* remain on, so mask it out along with the other status bits.
|
|
*/
|
|
- masked_status = status & (INTR_MASK | STS_FLR);
|
|
+ masked_status = current_status & (INTR_MASK | STS_FLR);
|
|
|
|
/* Shared IRQ? */
|
|
if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) {
|
|
@@ -737,6 +741,12 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
|
|
|
|
/* clear (just) interrupts */
|
|
ehci_writel(ehci, masked_status, &ehci->regs->status);
|
|
+
|
|
+ /* For edge interrupts, don't race with an interrupt bit being raised */
|
|
+ current_status = ehci_readl(ehci, &ehci->regs->status);
|
|
+ if (current_status & INTR_MASK)
|
|
+ goto restart;
|
|
+
|
|
cmd = ehci_readl(ehci, &ehci->regs->command);
|
|
bh = 0;
|
|
|
|
diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
|
|
index ebb8180b52ab1..c86d413226eb9 100644
|
|
--- a/drivers/usb/host/max3421-hcd.c
|
|
+++ b/drivers/usb/host/max3421-hcd.c
|
|
@@ -153,8 +153,6 @@ struct max3421_hcd {
|
|
*/
|
|
struct urb *curr_urb;
|
|
enum scheduling_pass sched_pass;
|
|
- struct usb_device *loaded_dev; /* dev that's loaded into the chip */
|
|
- int loaded_epnum; /* epnum whose toggles are loaded */
|
|
int urb_done; /* > 0 -> no errors, < 0: errno */
|
|
size_t curr_len;
|
|
u8 hien;
|
|
@@ -492,39 +490,17 @@ max3421_set_speed(struct usb_hcd *hcd, struct usb_device *dev)
|
|
* Caller must NOT hold HCD spinlock.
|
|
*/
|
|
static void
|
|
-max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum,
|
|
- int force_toggles)
|
|
+max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum)
|
|
{
|
|
- struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
|
|
- int old_epnum, same_ep, rcvtog, sndtog;
|
|
- struct usb_device *old_dev;
|
|
+ int rcvtog, sndtog;
|
|
u8 hctl;
|
|
|
|
- old_dev = max3421_hcd->loaded_dev;
|
|
- old_epnum = max3421_hcd->loaded_epnum;
|
|
-
|
|
- same_ep = (dev == old_dev && epnum == old_epnum);
|
|
- if (same_ep && !force_toggles)
|
|
- return;
|
|
-
|
|
- if (old_dev && !same_ep) {
|
|
- /* save the old end-points toggles: */
|
|
- u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL);
|
|
-
|
|
- rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1;
|
|
- sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1;
|
|
-
|
|
- /* no locking: HCD (i.e., we) own toggles, don't we? */
|
|
- usb_settoggle(old_dev, old_epnum, 0, rcvtog);
|
|
- usb_settoggle(old_dev, old_epnum, 1, sndtog);
|
|
- }
|
|
/* setup new endpoint's toggle bits: */
|
|
rcvtog = usb_gettoggle(dev, epnum, 0);
|
|
sndtog = usb_gettoggle(dev, epnum, 1);
|
|
hctl = (BIT(rcvtog + MAX3421_HCTL_RCVTOG0_BIT) |
|
|
BIT(sndtog + MAX3421_HCTL_SNDTOG0_BIT));
|
|
|
|
- max3421_hcd->loaded_epnum = epnum;
|
|
spi_wr8(hcd, MAX3421_REG_HCTL, hctl);
|
|
|
|
/*
|
|
@@ -532,7 +508,6 @@ max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum,
|
|
* address-assignment so it's best to just always load the
|
|
* address whenever the end-point changed/was forced.
|
|
*/
|
|
- max3421_hcd->loaded_dev = dev;
|
|
spi_wr8(hcd, MAX3421_REG_PERADDR, dev->devnum);
|
|
}
|
|
|
|
@@ -667,7 +642,7 @@ max3421_select_and_start_urb(struct usb_hcd *hcd)
|
|
struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
|
|
struct urb *urb, *curr_urb = NULL;
|
|
struct max3421_ep *max3421_ep;
|
|
- int epnum, force_toggles = 0;
|
|
+ int epnum;
|
|
struct usb_host_endpoint *ep;
|
|
struct list_head *pos;
|
|
unsigned long flags;
|
|
@@ -777,7 +752,6 @@ done:
|
|
usb_settoggle(urb->dev, epnum, 0, 1);
|
|
usb_settoggle(urb->dev, epnum, 1, 1);
|
|
max3421_ep->pkt_state = PKT_STATE_SETUP;
|
|
- force_toggles = 1;
|
|
} else
|
|
max3421_ep->pkt_state = PKT_STATE_TRANSFER;
|
|
}
|
|
@@ -785,7 +759,7 @@ done:
|
|
spin_unlock_irqrestore(&max3421_hcd->lock, flags);
|
|
|
|
max3421_ep->last_active = max3421_hcd->frame_number;
|
|
- max3421_set_address(hcd, urb->dev, epnum, force_toggles);
|
|
+ max3421_set_address(hcd, urb->dev, epnum);
|
|
max3421_set_speed(hcd, urb->dev);
|
|
max3421_next_transfer(hcd, 0);
|
|
return 1;
|
|
@@ -1380,6 +1354,16 @@ max3421_urb_done(struct usb_hcd *hcd)
|
|
status = 0;
|
|
urb = max3421_hcd->curr_urb;
|
|
if (urb) {
|
|
+ /* save the old end-points toggles: */
|
|
+ u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL);
|
|
+ int rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1;
|
|
+ int sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1;
|
|
+ int epnum = usb_endpoint_num(&urb->ep->desc);
|
|
+
|
|
+ /* no locking: HCD (i.e., we) own toggles, don't we? */
|
|
+ usb_settoggle(urb->dev, epnum, 0, rcvtog);
|
|
+ usb_settoggle(urb->dev, epnum, 1, sndtog);
|
|
+
|
|
max3421_hcd->curr_urb = NULL;
|
|
spin_lock_irqsave(&max3421_hcd->lock, flags);
|
|
usb_hcd_unlink_urb_from_ep(hcd, urb);
|
|
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
|
|
index 74c497fd34762..8466527eb2462 100644
|
|
--- a/drivers/usb/host/xhci-hub.c
|
|
+++ b/drivers/usb/host/xhci-hub.c
|
|
@@ -1552,11 +1552,12 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
|
|
* Inform the usbcore about resume-in-progress by returning
|
|
* a non-zero value even if there are no status changes.
|
|
*/
|
|
+ spin_lock_irqsave(&xhci->lock, flags);
|
|
+
|
|
status = bus_state->resuming_ports;
|
|
|
|
mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC;
|
|
|
|
- spin_lock_irqsave(&xhci->lock, flags);
|
|
/* For each port, did anything change? If so, set that bit in buf. */
|
|
for (i = 0; i < max_ports; i++) {
|
|
temp = readl(ports[i]->addr);
|
|
diff --git a/drivers/usb/host/xhci-pci-renesas.c b/drivers/usb/host/xhci-pci-renesas.c
|
|
index 431213cdf9e0e..f97ac9f52bf4d 100644
|
|
--- a/drivers/usb/host/xhci-pci-renesas.c
|
|
+++ b/drivers/usb/host/xhci-pci-renesas.c
|
|
@@ -207,8 +207,7 @@ static int renesas_check_rom_state(struct pci_dev *pdev)
|
|
return 0;
|
|
|
|
case RENESAS_ROM_STATUS_NO_RESULT: /* No result yet */
|
|
- dev_dbg(&pdev->dev, "Unknown ROM status ...\n");
|
|
- break;
|
|
+ return 0;
|
|
|
|
case RENESAS_ROM_STATUS_ERROR: /* Error State */
|
|
default: /* All other states are marked as "Reserved states" */
|
|
@@ -225,12 +224,13 @@ static int renesas_fw_check_running(struct pci_dev *pdev)
|
|
u8 fw_state;
|
|
int err;
|
|
|
|
- /*
|
|
- * Only if device has ROM and loaded FW we can skip loading and
|
|
- * return success. Otherwise (even unknown state), attempt to load FW.
|
|
- */
|
|
- if (renesas_check_rom(pdev) && !renesas_check_rom_state(pdev))
|
|
- return 0;
|
|
+ /* Check if device has ROM and loaded, if so skip everything */
|
|
+ err = renesas_check_rom(pdev);
|
|
+ if (err) { /* we have rom */
|
|
+ err = renesas_check_rom_state(pdev);
|
|
+ if (!err)
|
|
+ return err;
|
|
+ }
|
|
|
|
/*
|
|
* Test if the device is actually needing the firmware. As most
|
|
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
|
|
index 7bc18cf8042cc..119d1a8fbb194 100644
|
|
--- a/drivers/usb/host/xhci-pci.c
|
|
+++ b/drivers/usb/host/xhci-pci.c
|
|
@@ -631,7 +631,14 @@ static const struct pci_device_id pci_ids[] = {
|
|
{ /* end: all zeroes */ }
|
|
};
|
|
MODULE_DEVICE_TABLE(pci, pci_ids);
|
|
+
|
|
+/*
|
|
+ * Without CONFIG_USB_XHCI_PCI_RENESAS renesas_xhci_check_request_fw() won't
|
|
+ * load firmware, so don't encumber the xhci-pci driver with it.
|
|
+ */
|
|
+#if IS_ENABLED(CONFIG_USB_XHCI_PCI_RENESAS)
|
|
MODULE_FIRMWARE("renesas_usb_fw.mem");
|
|
+#endif
|
|
|
|
/* pci driver glue; this is a "new style" PCI driver module */
|
|
static struct pci_driver xhci_pci_driver = {
|
|
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
|
|
index 054840a69eb4a..53059ee957ad5 100644
|
|
--- a/drivers/usb/host/xhci-ring.c
|
|
+++ b/drivers/usb/host/xhci-ring.c
|
|
@@ -446,6 +446,26 @@ void xhci_ring_doorbell_for_active_rings(struct xhci_hcd *xhci,
|
|
ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
|
|
}
|
|
|
|
+static struct xhci_virt_ep *xhci_get_virt_ep(struct xhci_hcd *xhci,
|
|
+ unsigned int slot_id,
|
|
+ unsigned int ep_index)
|
|
+{
|
|
+ if (slot_id == 0 || slot_id >= MAX_HC_SLOTS) {
|
|
+ xhci_warn(xhci, "Invalid slot_id %u\n", slot_id);
|
|
+ return NULL;
|
|
+ }
|
|
+ if (ep_index >= EP_CTX_PER_DEV) {
|
|
+ xhci_warn(xhci, "Invalid endpoint index %u\n", ep_index);
|
|
+ return NULL;
|
|
+ }
|
|
+ if (!xhci->devs[slot_id]) {
|
|
+ xhci_warn(xhci, "No xhci virt device for slot_id %u\n", slot_id);
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
+ return &xhci->devs[slot_id]->eps[ep_index];
|
|
+}
|
|
+
|
|
/* Get the right ring for the given slot_id, ep_index and stream_id.
|
|
* If the endpoint supports streams, boundary check the URB's stream ID.
|
|
* If the endpoint doesn't support streams, return the singular endpoint ring.
|
|
@@ -456,7 +476,10 @@ struct xhci_ring *xhci_triad_to_transfer_ring(struct xhci_hcd *xhci,
|
|
{
|
|
struct xhci_virt_ep *ep;
|
|
|
|
- ep = &xhci->devs[slot_id]->eps[ep_index];
|
|
+ ep = xhci_get_virt_ep(xhci, slot_id, ep_index);
|
|
+ if (!ep)
|
|
+ return NULL;
|
|
+
|
|
/* Common case: no streams */
|
|
if (!(ep->ep_state & EP_HAS_STREAMS))
|
|
return ep->ring;
|
|
@@ -747,11 +770,14 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,
|
|
memset(&deq_state, 0, sizeof(deq_state));
|
|
ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3]));
|
|
|
|
+ ep = xhci_get_virt_ep(xhci, slot_id, ep_index);
|
|
+ if (!ep)
|
|
+ return;
|
|
+
|
|
vdev = xhci->devs[slot_id];
|
|
ep_ctx = xhci_get_ep_ctx(xhci, vdev->out_ctx, ep_index);
|
|
trace_xhci_handle_cmd_stop_ep(ep_ctx);
|
|
|
|
- ep = &xhci->devs[slot_id]->eps[ep_index];
|
|
last_unlinked_td = list_last_entry(&ep->cancelled_td_list,
|
|
struct xhci_td, cancelled_td_list);
|
|
|
|
@@ -1076,9 +1102,11 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id,
|
|
|
|
ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3]));
|
|
stream_id = TRB_TO_STREAM_ID(le32_to_cpu(trb->generic.field[2]));
|
|
- dev = xhci->devs[slot_id];
|
|
- ep = &dev->eps[ep_index];
|
|
+ ep = xhci_get_virt_ep(xhci, slot_id, ep_index);
|
|
+ if (!ep)
|
|
+ return;
|
|
|
|
+ dev = xhci->devs[slot_id];
|
|
ep_ring = xhci_stream_id_to_ring(dev, ep_index, stream_id);
|
|
if (!ep_ring) {
|
|
xhci_warn(xhci, "WARN Set TR deq ptr command for freed stream ID %u\n",
|
|
@@ -1151,9 +1179,9 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id,
|
|
}
|
|
|
|
cleanup:
|
|
- dev->eps[ep_index].ep_state &= ~SET_DEQ_PENDING;
|
|
- dev->eps[ep_index].queued_deq_seg = NULL;
|
|
- dev->eps[ep_index].queued_deq_ptr = NULL;
|
|
+ ep->ep_state &= ~SET_DEQ_PENDING;
|
|
+ ep->queued_deq_seg = NULL;
|
|
+ ep->queued_deq_ptr = NULL;
|
|
/* Restart any rings with pending URBs */
|
|
ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
|
|
}
|
|
@@ -1162,10 +1190,15 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id,
|
|
union xhci_trb *trb, u32 cmd_comp_code)
|
|
{
|
|
struct xhci_virt_device *vdev;
|
|
+ struct xhci_virt_ep *ep;
|
|
struct xhci_ep_ctx *ep_ctx;
|
|
unsigned int ep_index;
|
|
|
|
ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3]));
|
|
+ ep = xhci_get_virt_ep(xhci, slot_id, ep_index);
|
|
+ if (!ep)
|
|
+ return;
|
|
+
|
|
vdev = xhci->devs[slot_id];
|
|
ep_ctx = xhci_get_ep_ctx(xhci, vdev->out_ctx, ep_index);
|
|
trace_xhci_handle_cmd_reset_ep(ep_ctx);
|
|
@@ -1195,7 +1228,7 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id,
|
|
xhci_ring_cmd_db(xhci);
|
|
} else {
|
|
/* Clear our internal halted state */
|
|
- xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED;
|
|
+ ep->ep_state &= ~EP_HALTED;
|
|
}
|
|
|
|
/* if this was a soft reset, then restart */
|
|
@@ -2364,14 +2397,13 @@ static int handle_tx_event(struct xhci_hcd *xhci,
|
|
trb_comp_code = GET_COMP_CODE(le32_to_cpu(event->transfer_len));
|
|
ep_trb_dma = le64_to_cpu(event->buffer);
|
|
|
|
- xdev = xhci->devs[slot_id];
|
|
- if (!xdev) {
|
|
- xhci_err(xhci, "ERROR Transfer event pointed to bad slot %u\n",
|
|
- slot_id);
|
|
+ ep = xhci_get_virt_ep(xhci, slot_id, ep_index);
|
|
+ if (!ep) {
|
|
+ xhci_err(xhci, "ERROR Invalid Transfer event\n");
|
|
goto err_out;
|
|
}
|
|
|
|
- ep = &xdev->eps[ep_index];
|
|
+ xdev = xhci->devs[slot_id];
|
|
ep_ring = xhci_dma_to_transfer_ring(ep, ep_trb_dma);
|
|
ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index);
|
|
|
|
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
|
|
index d01241f1daf3b..c1865a121100c 100644
|
|
--- a/drivers/usb/host/xhci.h
|
|
+++ b/drivers/usb/host/xhci.h
|
|
@@ -993,6 +993,7 @@ struct xhci_interval_bw_table {
|
|
unsigned int ss_bw_out;
|
|
};
|
|
|
|
+#define EP_CTX_PER_DEV 31
|
|
|
|
struct xhci_virt_device {
|
|
struct usb_device *udev;
|
|
@@ -1007,7 +1008,7 @@ struct xhci_virt_device {
|
|
struct xhci_container_ctx *out_ctx;
|
|
/* Used for addressing devices and configuration changes */
|
|
struct xhci_container_ctx *in_ctx;
|
|
- struct xhci_virt_ep eps[31];
|
|
+ struct xhci_virt_ep eps[EP_CTX_PER_DEV];
|
|
u8 fake_port;
|
|
u8 real_port;
|
|
struct xhci_interval_bw_table *bw_table;
|
|
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
|
|
index e6fa137018082..02f49d7c869ee 100644
|
|
--- a/drivers/usb/renesas_usbhs/fifo.c
|
|
+++ b/drivers/usb/renesas_usbhs/fifo.c
|
|
@@ -101,6 +101,8 @@ static struct dma_chan *usbhsf_dma_chan_get(struct usbhs_fifo *fifo,
|
|
#define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1)
|
|
#define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0)
|
|
static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map);
|
|
+static void usbhsf_tx_irq_ctrl(struct usbhs_pipe *pipe, int enable);
|
|
+static void usbhsf_rx_irq_ctrl(struct usbhs_pipe *pipe, int enable);
|
|
struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt)
|
|
{
|
|
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
|
|
@@ -123,6 +125,11 @@ struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt)
|
|
if (chan) {
|
|
dmaengine_terminate_all(chan);
|
|
usbhsf_dma_unmap(pkt);
|
|
+ } else {
|
|
+ if (usbhs_pipe_is_dir_in(pipe))
|
|
+ usbhsf_rx_irq_ctrl(pipe, 0);
|
|
+ else
|
|
+ usbhsf_tx_irq_ctrl(pipe, 0);
|
|
}
|
|
|
|
usbhs_pipe_clear_without_sequence(pipe, 0, 0);
|
|
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
|
|
index 28a728f883bc5..329fc25f78a44 100644
|
|
--- a/drivers/usb/serial/cp210x.c
|
|
+++ b/drivers/usb/serial/cp210x.c
|
|
@@ -159,6 +159,7 @@ static const struct usb_device_id id_table[] = {
|
|
{ USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */
|
|
{ USB_DEVICE(0x10C4, 0x89FB) }, /* Qivicon ZigBee USB Radio Stick */
|
|
{ USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
|
|
+ { USB_DEVICE(0x10C4, 0x8A5B) }, /* CEL EM3588 ZigBee USB Stick */
|
|
{ USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */
|
|
{ USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */
|
|
{ USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
|
|
@@ -206,8 +207,8 @@ static const struct usb_device_id id_table[] = {
|
|
{ USB_DEVICE(0x1901, 0x0194) }, /* GE Healthcare Remote Alarm Box */
|
|
{ USB_DEVICE(0x1901, 0x0195) }, /* GE B850/B650/B450 CP2104 DP UART interface */
|
|
{ USB_DEVICE(0x1901, 0x0196) }, /* GE B850 CP2105 DP UART interface */
|
|
- { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 Display serial interface */
|
|
- { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 M.2 Key E serial interface */
|
|
+ { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 M.2 Key E serial interface */
|
|
+ { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 Display serial interface */
|
|
{ USB_DEVICE(0x199B, 0xBA30) }, /* LORD WSDA-200-USB */
|
|
{ USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */
|
|
{ USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
|
|
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
|
|
index 61d94641ddc08..39333f2cba04e 100644
|
|
--- a/drivers/usb/serial/option.c
|
|
+++ b/drivers/usb/serial/option.c
|
|
@@ -238,6 +238,7 @@ static void option_instat_callback(struct urb *urb);
|
|
#define QUECTEL_PRODUCT_UC15 0x9090
|
|
/* These u-blox products use Qualcomm's vendor ID */
|
|
#define UBLOX_PRODUCT_R410M 0x90b2
|
|
+#define UBLOX_PRODUCT_R6XX 0x90fa
|
|
/* These Yuga products use Qualcomm's vendor ID */
|
|
#define YUGA_PRODUCT_CLM920_NC5 0x9625
|
|
|
|
@@ -1101,6 +1102,8 @@ static const struct usb_device_id option_ids[] = {
|
|
/* u-blox products using Qualcomm vendor ID */
|
|
{ USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M),
|
|
.driver_info = RSVD(1) | RSVD(3) },
|
|
+ { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R6XX),
|
|
+ .driver_info = RSVD(3) },
|
|
/* Quectel products using Quectel vendor ID */
|
|
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff),
|
|
.driver_info = NUMEP2 },
|
|
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
|
|
index f9677a5ec31b2..c35a6db993f1b 100644
|
|
--- a/drivers/usb/storage/unusual_uas.h
|
|
+++ b/drivers/usb/storage/unusual_uas.h
|
|
@@ -45,6 +45,13 @@ UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999,
|
|
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
|
|
US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME),
|
|
|
|
+/* Reported-by: Julian Sikorski <belegdol@gmail.com> */
|
|
+UNUSUAL_DEV(0x059f, 0x1061, 0x0000, 0x9999,
|
|
+ "LaCie",
|
|
+ "Rugged USB3-FW",
|
|
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
|
|
+ US_FL_IGNORE_UAS),
|
|
+
|
|
/*
|
|
* Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI
|
|
* commands in UAS mode. Observed with the 1.28 firmware; are there others?
|
|
diff --git a/drivers/usb/typec/stusb160x.c b/drivers/usb/typec/stusb160x.c
|
|
index 6eaeba9b096e1..3d3848e7c2c2f 100644
|
|
--- a/drivers/usb/typec/stusb160x.c
|
|
+++ b/drivers/usb/typec/stusb160x.c
|
|
@@ -739,10 +739,6 @@ static int stusb160x_probe(struct i2c_client *client)
|
|
typec_set_pwr_opmode(chip->port, chip->pwr_opmode);
|
|
|
|
if (client->irq) {
|
|
- ret = stusb160x_irq_init(chip, client->irq);
|
|
- if (ret)
|
|
- goto port_unregister;
|
|
-
|
|
chip->role_sw = fwnode_usb_role_switch_get(fwnode);
|
|
if (IS_ERR(chip->role_sw)) {
|
|
ret = PTR_ERR(chip->role_sw);
|
|
@@ -752,6 +748,10 @@ static int stusb160x_probe(struct i2c_client *client)
|
|
ret);
|
|
goto port_unregister;
|
|
}
|
|
+
|
|
+ ret = stusb160x_irq_init(chip, client->irq);
|
|
+ if (ret)
|
|
+ goto role_sw_put;
|
|
} else {
|
|
/*
|
|
* If Source or Dual power role, need to enable VDD supply
|
|
@@ -775,6 +775,9 @@ static int stusb160x_probe(struct i2c_client *client)
|
|
|
|
return 0;
|
|
|
|
+role_sw_put:
|
|
+ if (chip->role_sw)
|
|
+ usb_role_switch_put(chip->role_sw);
|
|
port_unregister:
|
|
typec_unregister_port(chip->port);
|
|
all_reg_disable:
|
|
diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
|
|
index a4e9e6e07e939..2a528b70478c6 100644
|
|
--- a/fs/afs/cmservice.c
|
|
+++ b/fs/afs/cmservice.c
|
|
@@ -29,16 +29,11 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *);
|
|
|
|
static int afs_deliver_yfs_cb_callback(struct afs_call *);
|
|
|
|
-#define CM_NAME(name) \
|
|
- char afs_SRXCB##name##_name[] __tracepoint_string = \
|
|
- "CB." #name
|
|
-
|
|
/*
|
|
* CB.CallBack operation type
|
|
*/
|
|
-static CM_NAME(CallBack);
|
|
static const struct afs_call_type afs_SRXCBCallBack = {
|
|
- .name = afs_SRXCBCallBack_name,
|
|
+ .name = "CB.CallBack",
|
|
.deliver = afs_deliver_cb_callback,
|
|
.destructor = afs_cm_destructor,
|
|
.work = SRXAFSCB_CallBack,
|
|
@@ -47,9 +42,8 @@ static const struct afs_call_type afs_SRXCBCallBack = {
|
|
/*
|
|
* CB.InitCallBackState operation type
|
|
*/
|
|
-static CM_NAME(InitCallBackState);
|
|
static const struct afs_call_type afs_SRXCBInitCallBackState = {
|
|
- .name = afs_SRXCBInitCallBackState_name,
|
|
+ .name = "CB.InitCallBackState",
|
|
.deliver = afs_deliver_cb_init_call_back_state,
|
|
.destructor = afs_cm_destructor,
|
|
.work = SRXAFSCB_InitCallBackState,
|
|
@@ -58,9 +52,8 @@ static const struct afs_call_type afs_SRXCBInitCallBackState = {
|
|
/*
|
|
* CB.InitCallBackState3 operation type
|
|
*/
|
|
-static CM_NAME(InitCallBackState3);
|
|
static const struct afs_call_type afs_SRXCBInitCallBackState3 = {
|
|
- .name = afs_SRXCBInitCallBackState3_name,
|
|
+ .name = "CB.InitCallBackState3",
|
|
.deliver = afs_deliver_cb_init_call_back_state3,
|
|
.destructor = afs_cm_destructor,
|
|
.work = SRXAFSCB_InitCallBackState,
|
|
@@ -69,9 +62,8 @@ static const struct afs_call_type afs_SRXCBInitCallBackState3 = {
|
|
/*
|
|
* CB.Probe operation type
|
|
*/
|
|
-static CM_NAME(Probe);
|
|
static const struct afs_call_type afs_SRXCBProbe = {
|
|
- .name = afs_SRXCBProbe_name,
|
|
+ .name = "CB.Probe",
|
|
.deliver = afs_deliver_cb_probe,
|
|
.destructor = afs_cm_destructor,
|
|
.work = SRXAFSCB_Probe,
|
|
@@ -80,9 +72,8 @@ static const struct afs_call_type afs_SRXCBProbe = {
|
|
/*
|
|
* CB.ProbeUuid operation type
|
|
*/
|
|
-static CM_NAME(ProbeUuid);
|
|
static const struct afs_call_type afs_SRXCBProbeUuid = {
|
|
- .name = afs_SRXCBProbeUuid_name,
|
|
+ .name = "CB.ProbeUuid",
|
|
.deliver = afs_deliver_cb_probe_uuid,
|
|
.destructor = afs_cm_destructor,
|
|
.work = SRXAFSCB_ProbeUuid,
|
|
@@ -91,9 +82,8 @@ static const struct afs_call_type afs_SRXCBProbeUuid = {
|
|
/*
|
|
* CB.TellMeAboutYourself operation type
|
|
*/
|
|
-static CM_NAME(TellMeAboutYourself);
|
|
static const struct afs_call_type afs_SRXCBTellMeAboutYourself = {
|
|
- .name = afs_SRXCBTellMeAboutYourself_name,
|
|
+ .name = "CB.TellMeAboutYourself",
|
|
.deliver = afs_deliver_cb_tell_me_about_yourself,
|
|
.destructor = afs_cm_destructor,
|
|
.work = SRXAFSCB_TellMeAboutYourself,
|
|
@@ -102,9 +92,8 @@ static const struct afs_call_type afs_SRXCBTellMeAboutYourself = {
|
|
/*
|
|
* YFS CB.CallBack operation type
|
|
*/
|
|
-static CM_NAME(YFS_CallBack);
|
|
static const struct afs_call_type afs_SRXYFSCB_CallBack = {
|
|
- .name = afs_SRXCBYFS_CallBack_name,
|
|
+ .name = "YFSCB.CallBack",
|
|
.deliver = afs_deliver_yfs_cb_callback,
|
|
.destructor = afs_cm_destructor,
|
|
.work = SRXAFSCB_CallBack,
|
|
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
|
|
index 73ebe0c5fdbc9..c346c46020e5e 100644
|
|
--- a/fs/btrfs/extent-tree.c
|
|
+++ b/fs/btrfs/extent-tree.c
|
|
@@ -5883,6 +5883,9 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range)
|
|
mutex_lock(&fs_info->fs_devices->device_list_mutex);
|
|
devices = &fs_info->fs_devices->devices;
|
|
list_for_each_entry(device, devices, dev_list) {
|
|
+ if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state))
|
|
+ continue;
|
|
+
|
|
ret = btrfs_trim_free_extents(device, &group_trimmed);
|
|
if (ret) {
|
|
dev_failed++;
|
|
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
|
|
index d560752b764d8..6b00f1d7c8e77 100644
|
|
--- a/fs/ceph/mds_client.c
|
|
+++ b/fs/ceph/mds_client.c
|
|
@@ -4401,7 +4401,7 @@ bool check_session_state(struct ceph_mds_session *s)
|
|
break;
|
|
case CEPH_MDS_SESSION_CLOSING:
|
|
/* Should never reach this when we're unmounting */
|
|
- WARN_ON_ONCE(true);
|
|
+ WARN_ON_ONCE(s->s_ttl);
|
|
fallthrough;
|
|
case CEPH_MDS_SESSION_NEW:
|
|
case CEPH_MDS_SESSION_RESTARTING:
|
|
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
|
|
index f6ceb79a995d0..b0b06eb86edfb 100644
|
|
--- a/fs/cifs/smb2ops.c
|
|
+++ b/fs/cifs/smb2ops.c
|
|
@@ -3466,7 +3466,7 @@ static int smb3_simple_fallocate_write_range(unsigned int xid,
|
|
char *buf)
|
|
{
|
|
struct cifs_io_parms io_parms = {0};
|
|
- int nbytes;
|
|
+ int rc, nbytes;
|
|
struct kvec iov[2];
|
|
|
|
io_parms.netfid = cfile->fid.netfid;
|
|
@@ -3474,13 +3474,25 @@ static int smb3_simple_fallocate_write_range(unsigned int xid,
|
|
io_parms.tcon = tcon;
|
|
io_parms.persistent_fid = cfile->fid.persistent_fid;
|
|
io_parms.volatile_fid = cfile->fid.volatile_fid;
|
|
- io_parms.offset = off;
|
|
- io_parms.length = len;
|
|
|
|
- /* iov[0] is reserved for smb header */
|
|
- iov[1].iov_base = buf;
|
|
- iov[1].iov_len = io_parms.length;
|
|
- return SMB2_write(xid, &io_parms, &nbytes, iov, 1);
|
|
+ while (len) {
|
|
+ io_parms.offset = off;
|
|
+ io_parms.length = len;
|
|
+ if (io_parms.length > SMB2_MAX_BUFFER_SIZE)
|
|
+ io_parms.length = SMB2_MAX_BUFFER_SIZE;
|
|
+ /* iov[0] is reserved for smb header */
|
|
+ iov[1].iov_base = buf;
|
|
+ iov[1].iov_len = io_parms.length;
|
|
+ rc = SMB2_write(xid, &io_parms, &nbytes, iov, 1);
|
|
+ if (rc)
|
|
+ break;
|
|
+ if (nbytes > len)
|
|
+ return -EINVAL;
|
|
+ buf += nbytes;
|
|
+ off += nbytes;
|
|
+ len -= nbytes;
|
|
+ }
|
|
+ return rc;
|
|
}
|
|
|
|
static int smb3_simple_fallocate_range(unsigned int xid,
|
|
@@ -3504,11 +3516,6 @@ static int smb3_simple_fallocate_range(unsigned int xid,
|
|
(char **)&out_data, &out_data_len);
|
|
if (rc)
|
|
goto out;
|
|
- /*
|
|
- * It is already all allocated
|
|
- */
|
|
- if (out_data_len == 0)
|
|
- goto out;
|
|
|
|
buf = kzalloc(1024 * 1024, GFP_KERNEL);
|
|
if (buf == NULL) {
|
|
@@ -3631,6 +3638,24 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
|
|
goto out;
|
|
}
|
|
|
|
+ if (keep_size == true) {
|
|
+ /*
|
|
+ * We can not preallocate pages beyond the end of the file
|
|
+ * in SMB2
|
|
+ */
|
|
+ if (off >= i_size_read(inode)) {
|
|
+ rc = 0;
|
|
+ goto out;
|
|
+ }
|
|
+ /*
|
|
+ * For fallocates that are partially beyond the end of file,
|
|
+ * clamp len so we only fallocate up to the end of file.
|
|
+ */
|
|
+ if (off + len > i_size_read(inode)) {
|
|
+ len = i_size_read(inode) - off;
|
|
+ }
|
|
+ }
|
|
+
|
|
if ((keep_size == true) || (i_size_read(inode) >= off + len)) {
|
|
/*
|
|
* At this point, we are trying to fallocate an internal
|
|
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
|
|
index b7c24d152604d..5fc9ccab907c3 100644
|
|
--- a/fs/hugetlbfs/inode.c
|
|
+++ b/fs/hugetlbfs/inode.c
|
|
@@ -77,7 +77,7 @@ enum hugetlb_param {
|
|
static const struct fs_parameter_spec hugetlb_fs_parameters[] = {
|
|
fsparam_u32 ("gid", Opt_gid),
|
|
fsparam_string("min_size", Opt_min_size),
|
|
- fsparam_u32 ("mode", Opt_mode),
|
|
+ fsparam_u32oct("mode", Opt_mode),
|
|
fsparam_string("nr_inodes", Opt_nr_inodes),
|
|
fsparam_string("pagesize", Opt_pagesize),
|
|
fsparam_string("size", Opt_size),
|
|
diff --git a/fs/io_uring.c b/fs/io_uring.c
|
|
index 42153106b7bc9..07f08c424d17b 100644
|
|
--- a/fs/io_uring.c
|
|
+++ b/fs/io_uring.c
|
|
@@ -4916,6 +4916,7 @@ static int io_connect(struct io_kiocb *req, bool force_nonblock,
|
|
struct io_poll_table {
|
|
struct poll_table_struct pt;
|
|
struct io_kiocb *req;
|
|
+ int nr_entries;
|
|
int error;
|
|
};
|
|
|
|
@@ -5098,11 +5099,11 @@ static void __io_queue_proc(struct io_poll_iocb *poll, struct io_poll_table *pt,
|
|
struct io_kiocb *req = pt->req;
|
|
|
|
/*
|
|
- * If poll->head is already set, it's because the file being polled
|
|
- * uses multiple waitqueues for poll handling (eg one for read, one
|
|
- * for write). Setup a separate io_poll_iocb if this happens.
|
|
+ * The file being polled uses multiple waitqueues for poll handling
|
|
+ * (e.g. one for read, one for write). Setup a separate io_poll_iocb
|
|
+ * if this happens.
|
|
*/
|
|
- if (unlikely(poll->head)) {
|
|
+ if (unlikely(pt->nr_entries)) {
|
|
struct io_poll_iocb *poll_one = poll;
|
|
|
|
/* already have a 2nd entry, fail a third attempt */
|
|
@@ -5124,7 +5125,7 @@ static void __io_queue_proc(struct io_poll_iocb *poll, struct io_poll_table *pt,
|
|
*poll_ptr = poll;
|
|
}
|
|
|
|
- pt->error = 0;
|
|
+ pt->nr_entries++;
|
|
poll->head = head;
|
|
|
|
if (poll->events & EPOLLEXCLUSIVE)
|
|
@@ -5210,11 +5211,16 @@ static __poll_t __io_arm_poll_handler(struct io_kiocb *req,
|
|
|
|
ipt->pt._key = mask;
|
|
ipt->req = req;
|
|
- ipt->error = -EINVAL;
|
|
+ ipt->error = 0;
|
|
+ ipt->nr_entries = 0;
|
|
|
|
mask = vfs_poll(req->file, &ipt->pt) & poll->events;
|
|
+ if (unlikely(!ipt->nr_entries) && !ipt->error)
|
|
+ ipt->error = -EINVAL;
|
|
|
|
spin_lock_irq(&ctx->completion_lock);
|
|
+ if (ipt->error)
|
|
+ io_poll_remove_double(req);
|
|
if (likely(poll->head)) {
|
|
spin_lock(&poll->head->lock);
|
|
if (unlikely(list_empty(&poll->wait.entry))) {
|
|
diff --git a/fs/proc/base.c b/fs/proc/base.c
|
|
index df9b17dd92cb3..5d52aea8d7e7d 100644
|
|
--- a/fs/proc/base.c
|
|
+++ b/fs/proc/base.c
|
|
@@ -855,7 +855,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
|
|
flags = FOLL_FORCE | (write ? FOLL_WRITE : 0);
|
|
|
|
while (count > 0) {
|
|
- int this_len = min_t(int, count, PAGE_SIZE);
|
|
+ size_t this_len = min_t(size_t, count, PAGE_SIZE);
|
|
|
|
if (write && copy_from_user(page, buf, this_len)) {
|
|
copied = -EFAULT;
|
|
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
|
|
index 000b457ad0876..3d181b1a6d567 100644
|
|
--- a/fs/userfaultfd.c
|
|
+++ b/fs/userfaultfd.c
|
|
@@ -1228,23 +1228,21 @@ static __always_inline void wake_userfault(struct userfaultfd_ctx *ctx,
|
|
}
|
|
|
|
static __always_inline int validate_range(struct mm_struct *mm,
|
|
- __u64 *start, __u64 len)
|
|
+ __u64 start, __u64 len)
|
|
{
|
|
__u64 task_size = mm->task_size;
|
|
|
|
- *start = untagged_addr(*start);
|
|
-
|
|
- if (*start & ~PAGE_MASK)
|
|
+ if (start & ~PAGE_MASK)
|
|
return -EINVAL;
|
|
if (len & ~PAGE_MASK)
|
|
return -EINVAL;
|
|
if (!len)
|
|
return -EINVAL;
|
|
- if (*start < mmap_min_addr)
|
|
+ if (start < mmap_min_addr)
|
|
return -EINVAL;
|
|
- if (*start >= task_size)
|
|
+ if (start >= task_size)
|
|
return -EINVAL;
|
|
- if (len > task_size - *start)
|
|
+ if (len > task_size - start)
|
|
return -EINVAL;
|
|
return 0;
|
|
}
|
|
@@ -1290,7 +1288,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
|
|
if (uffdio_register.mode & UFFDIO_REGISTER_MODE_WP)
|
|
vm_flags |= VM_UFFD_WP;
|
|
|
|
- ret = validate_range(mm, &uffdio_register.range.start,
|
|
+ ret = validate_range(mm, uffdio_register.range.start,
|
|
uffdio_register.range.len);
|
|
if (ret)
|
|
goto out;
|
|
@@ -1490,7 +1488,7 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx,
|
|
if (copy_from_user(&uffdio_unregister, buf, sizeof(uffdio_unregister)))
|
|
goto out;
|
|
|
|
- ret = validate_range(mm, &uffdio_unregister.start,
|
|
+ ret = validate_range(mm, uffdio_unregister.start,
|
|
uffdio_unregister.len);
|
|
if (ret)
|
|
goto out;
|
|
@@ -1639,7 +1637,7 @@ static int userfaultfd_wake(struct userfaultfd_ctx *ctx,
|
|
if (copy_from_user(&uffdio_wake, buf, sizeof(uffdio_wake)))
|
|
goto out;
|
|
|
|
- ret = validate_range(ctx->mm, &uffdio_wake.start, uffdio_wake.len);
|
|
+ ret = validate_range(ctx->mm, uffdio_wake.start, uffdio_wake.len);
|
|
if (ret)
|
|
goto out;
|
|
|
|
@@ -1679,7 +1677,7 @@ static int userfaultfd_copy(struct userfaultfd_ctx *ctx,
|
|
sizeof(uffdio_copy)-sizeof(__s64)))
|
|
goto out;
|
|
|
|
- ret = validate_range(ctx->mm, &uffdio_copy.dst, uffdio_copy.len);
|
|
+ ret = validate_range(ctx->mm, uffdio_copy.dst, uffdio_copy.len);
|
|
if (ret)
|
|
goto out;
|
|
/*
|
|
@@ -1736,7 +1734,7 @@ static int userfaultfd_zeropage(struct userfaultfd_ctx *ctx,
|
|
sizeof(uffdio_zeropage)-sizeof(__s64)))
|
|
goto out;
|
|
|
|
- ret = validate_range(ctx->mm, &uffdio_zeropage.range.start,
|
|
+ ret = validate_range(ctx->mm, uffdio_zeropage.range.start,
|
|
uffdio_zeropage.range.len);
|
|
if (ret)
|
|
goto out;
|
|
@@ -1786,7 +1784,7 @@ static int userfaultfd_writeprotect(struct userfaultfd_ctx *ctx,
|
|
sizeof(struct uffdio_writeprotect)))
|
|
return -EFAULT;
|
|
|
|
- ret = validate_range(ctx->mm, &uffdio_wp.range.start,
|
|
+ ret = validate_range(ctx->mm, uffdio_wp.range.start,
|
|
uffdio_wp.range.len);
|
|
if (ret)
|
|
return ret;
|
|
diff --git a/include/drm/drm_ioctl.h b/include/drm/drm_ioctl.h
|
|
index 10100a4bbe2ad..afb27cb6a7bd8 100644
|
|
--- a/include/drm/drm_ioctl.h
|
|
+++ b/include/drm/drm_ioctl.h
|
|
@@ -68,6 +68,7 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
|
|
unsigned long arg);
|
|
|
|
#define DRM_IOCTL_NR(n) _IOC_NR(n)
|
|
+#define DRM_IOCTL_TYPE(n) _IOC_TYPE(n)
|
|
#define DRM_MAJOR 226
|
|
|
|
/**
|
|
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
|
|
index ef131255cedce..1a8d25f2e0412 100644
|
|
--- a/include/linux/memblock.h
|
|
+++ b/include/linux/memblock.h
|
|
@@ -207,7 +207,7 @@ static inline void __next_physmem_range(u64 *idx, struct memblock_type *type,
|
|
*/
|
|
#define for_each_mem_range(i, p_start, p_end) \
|
|
__for_each_mem_range(i, &memblock.memory, NULL, NUMA_NO_NODE, \
|
|
- MEMBLOCK_NONE, p_start, p_end, NULL)
|
|
+ MEMBLOCK_HOTPLUG, p_start, p_end, NULL)
|
|
|
|
/**
|
|
* for_each_mem_range_rev - reverse iterate through memblock areas from
|
|
@@ -218,7 +218,7 @@ static inline void __next_physmem_range(u64 *idx, struct memblock_type *type,
|
|
*/
|
|
#define for_each_mem_range_rev(i, p_start, p_end) \
|
|
__for_each_mem_range_rev(i, &memblock.memory, NULL, NUMA_NO_NODE, \
|
|
- MEMBLOCK_NONE, p_start, p_end, NULL)
|
|
+ MEMBLOCK_HOTPLUG, p_start, p_end, NULL)
|
|
|
|
/**
|
|
* for_each_reserved_mem_range - iterate over all reserved memblock areas
|
|
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
|
|
index a828cf99c5215..2d01b2bbb7465 100644
|
|
--- a/include/linux/skbuff.h
|
|
+++ b/include/linux/skbuff.h
|
|
@@ -4150,6 +4150,9 @@ enum skb_ext_id {
|
|
#endif
|
|
#if IS_ENABLED(CONFIG_MPTCP)
|
|
SKB_EXT_MPTCP,
|
|
+#endif
|
|
+#if IS_ENABLED(CONFIG_KCOV)
|
|
+ SKB_EXT_KCOV_HANDLE,
|
|
#endif
|
|
SKB_EXT_NUM, /* must be last */
|
|
};
|
|
@@ -4605,5 +4608,35 @@ static inline void skb_reset_redirect(struct sk_buff *skb)
|
|
#endif
|
|
}
|
|
|
|
+#ifdef CONFIG_KCOV
|
|
+static inline void skb_set_kcov_handle(struct sk_buff *skb,
|
|
+ const u64 kcov_handle)
|
|
+{
|
|
+ /* Do not allocate skb extensions only to set kcov_handle to zero
|
|
+ * (as it is zero by default). However, if the extensions are
|
|
+ * already allocated, update kcov_handle anyway since
|
|
+ * skb_set_kcov_handle can be called to zero a previously set
|
|
+ * value.
|
|
+ */
|
|
+ if (skb_has_extensions(skb) || kcov_handle) {
|
|
+ u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
|
|
+
|
|
+ if (kcov_handle_ptr)
|
|
+ *kcov_handle_ptr = kcov_handle;
|
|
+ }
|
|
+}
|
|
+
|
|
+static inline u64 skb_get_kcov_handle(struct sk_buff *skb)
|
|
+{
|
|
+ u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
|
|
+
|
|
+ return kcov_handle ? *kcov_handle : 0;
|
|
+}
|
|
+#else
|
|
+static inline void skb_set_kcov_handle(struct sk_buff *skb,
|
|
+ const u64 kcov_handle) { }
|
|
+static inline u64 skb_get_kcov_handle(struct sk_buff *skb) { return 0; }
|
|
+#endif /* CONFIG_KCOV */
|
|
+
|
|
#endif /* __KERNEL__ */
|
|
#endif /* _LINUX_SKBUFF_H */
|
|
diff --git a/include/net/bonding.h b/include/net/bonding.h
|
|
index adc3da7769700..67d676059aa0d 100644
|
|
--- a/include/net/bonding.h
|
|
+++ b/include/net/bonding.h
|
|
@@ -199,6 +199,11 @@ struct bond_up_slave {
|
|
*/
|
|
#define BOND_LINK_NOCHANGE -1
|
|
|
|
+struct bond_ipsec {
|
|
+ struct list_head list;
|
|
+ struct xfrm_state *xs;
|
|
+};
|
|
+
|
|
/*
|
|
* Here are the locking policies for the two bonding locks:
|
|
* Get rcu_read_lock when reading or RTNL when writing slave list.
|
|
@@ -247,7 +252,9 @@ struct bonding {
|
|
#endif /* CONFIG_DEBUG_FS */
|
|
struct rtnl_link_stats64 bond_stats;
|
|
#ifdef CONFIG_XFRM_OFFLOAD
|
|
- struct xfrm_state *xs;
|
|
+ struct list_head ipsec_list;
|
|
+ /* protecting ipsec_list */
|
|
+ spinlock_t ipsec_lock;
|
|
#endif /* CONFIG_XFRM_OFFLOAD */
|
|
};
|
|
|
|
diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h
|
|
index 4eef374d4413e..5deb9f490f6f6 100644
|
|
--- a/include/trace/events/afs.h
|
|
+++ b/include/trace/events/afs.h
|
|
@@ -174,6 +174,34 @@ enum afs_vl_operation {
|
|
afs_VL_GetCapabilities = 65537, /* AFS Get VL server capabilities */
|
|
};
|
|
|
|
+enum afs_cm_operation {
|
|
+ afs_CB_CallBack = 204, /* AFS break callback promises */
|
|
+ afs_CB_InitCallBackState = 205, /* AFS initialise callback state */
|
|
+ afs_CB_Probe = 206, /* AFS probe client */
|
|
+ afs_CB_GetLock = 207, /* AFS get contents of CM lock table */
|
|
+ afs_CB_GetCE = 208, /* AFS get cache file description */
|
|
+ afs_CB_GetXStatsVersion = 209, /* AFS get version of extended statistics */
|
|
+ afs_CB_GetXStats = 210, /* AFS get contents of extended statistics data */
|
|
+ afs_CB_InitCallBackState3 = 213, /* AFS initialise callback state, version 3 */
|
|
+ afs_CB_ProbeUuid = 214, /* AFS check the client hasn't rebooted */
|
|
+};
|
|
+
|
|
+enum yfs_cm_operation {
|
|
+ yfs_CB_Probe = 206, /* YFS probe client */
|
|
+ yfs_CB_GetLock = 207, /* YFS get contents of CM lock table */
|
|
+ yfs_CB_XStatsVersion = 209, /* YFS get version of extended statistics */
|
|
+ yfs_CB_GetXStats = 210, /* YFS get contents of extended statistics data */
|
|
+ yfs_CB_InitCallBackState3 = 213, /* YFS initialise callback state, version 3 */
|
|
+ yfs_CB_ProbeUuid = 214, /* YFS check the client hasn't rebooted */
|
|
+ yfs_CB_GetServerPrefs = 215,
|
|
+ yfs_CB_GetCellServDV = 216,
|
|
+ yfs_CB_GetLocalCell = 217,
|
|
+ yfs_CB_GetCacheConfig = 218,
|
|
+ yfs_CB_GetCellByNum = 65537,
|
|
+ yfs_CB_TellMeAboutYourself = 65538, /* get client capabilities */
|
|
+ yfs_CB_CallBack = 64204,
|
|
+};
|
|
+
|
|
enum afs_edit_dir_op {
|
|
afs_edit_dir_create,
|
|
afs_edit_dir_create_error,
|
|
@@ -435,6 +463,32 @@ enum afs_cb_break_reason {
|
|
EM(afs_YFSVL_GetCellName, "YFSVL.GetCellName") \
|
|
E_(afs_VL_GetCapabilities, "VL.GetCapabilities")
|
|
|
|
+#define afs_cm_operations \
|
|
+ EM(afs_CB_CallBack, "CB.CallBack") \
|
|
+ EM(afs_CB_InitCallBackState, "CB.InitCallBackState") \
|
|
+ EM(afs_CB_Probe, "CB.Probe") \
|
|
+ EM(afs_CB_GetLock, "CB.GetLock") \
|
|
+ EM(afs_CB_GetCE, "CB.GetCE") \
|
|
+ EM(afs_CB_GetXStatsVersion, "CB.GetXStatsVersion") \
|
|
+ EM(afs_CB_GetXStats, "CB.GetXStats") \
|
|
+ EM(afs_CB_InitCallBackState3, "CB.InitCallBackState3") \
|
|
+ E_(afs_CB_ProbeUuid, "CB.ProbeUuid")
|
|
+
|
|
+#define yfs_cm_operations \
|
|
+ EM(yfs_CB_Probe, "YFSCB.Probe") \
|
|
+ EM(yfs_CB_GetLock, "YFSCB.GetLock") \
|
|
+ EM(yfs_CB_XStatsVersion, "YFSCB.XStatsVersion") \
|
|
+ EM(yfs_CB_GetXStats, "YFSCB.GetXStats") \
|
|
+ EM(yfs_CB_InitCallBackState3, "YFSCB.InitCallBackState3") \
|
|
+ EM(yfs_CB_ProbeUuid, "YFSCB.ProbeUuid") \
|
|
+ EM(yfs_CB_GetServerPrefs, "YFSCB.GetServerPrefs") \
|
|
+ EM(yfs_CB_GetCellServDV, "YFSCB.GetCellServDV") \
|
|
+ EM(yfs_CB_GetLocalCell, "YFSCB.GetLocalCell") \
|
|
+ EM(yfs_CB_GetCacheConfig, "YFSCB.GetCacheConfig") \
|
|
+ EM(yfs_CB_GetCellByNum, "YFSCB.GetCellByNum") \
|
|
+ EM(yfs_CB_TellMeAboutYourself, "YFSCB.TellMeAboutYourself") \
|
|
+ E_(yfs_CB_CallBack, "YFSCB.CallBack")
|
|
+
|
|
#define afs_edit_dir_ops \
|
|
EM(afs_edit_dir_create, "create") \
|
|
EM(afs_edit_dir_create_error, "c_fail") \
|
|
@@ -567,6 +621,8 @@ afs_server_traces;
|
|
afs_cell_traces;
|
|
afs_fs_operations;
|
|
afs_vl_operations;
|
|
+afs_cm_operations;
|
|
+yfs_cm_operations;
|
|
afs_edit_dir_ops;
|
|
afs_edit_dir_reasons;
|
|
afs_eproto_causes;
|
|
@@ -647,20 +703,21 @@ TRACE_EVENT(afs_cb_call,
|
|
|
|
TP_STRUCT__entry(
|
|
__field(unsigned int, call )
|
|
- __field(const char *, name )
|
|
__field(u32, op )
|
|
+ __field(u16, service_id )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->call = call->debug_id;
|
|
- __entry->name = call->type->name;
|
|
__entry->op = call->operation_ID;
|
|
+ __entry->service_id = call->service_id;
|
|
),
|
|
|
|
- TP_printk("c=%08x %s o=%u",
|
|
+ TP_printk("c=%08x %s",
|
|
__entry->call,
|
|
- __entry->name,
|
|
- __entry->op)
|
|
+ __entry->service_id == 2501 ?
|
|
+ __print_symbolic(__entry->op, yfs_cm_operations) :
|
|
+ __print_symbolic(__entry->op, afs_cm_operations))
|
|
);
|
|
|
|
TRACE_EVENT(afs_call,
|
|
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
|
|
index 1f8bf2b39d506..36bc34fce623c 100644
|
|
--- a/kernel/bpf/verifier.c
|
|
+++ b/kernel/bpf/verifier.c
|
|
@@ -3356,6 +3356,8 @@ continue_func:
|
|
if (tail_call_reachable)
|
|
for (j = 0; j < frame; j++)
|
|
subprog[ret_prog[j]].tail_call_reachable = true;
|
|
+ if (subprog[0].tail_call_reachable)
|
|
+ env->prog->aux->tail_call_reachable = true;
|
|
|
|
/* end of for() loop means the last insn of the 'subprog'
|
|
* was reached. Doesn't matter whether it was JA or EXIT
|
|
diff --git a/kernel/dma/ops_helpers.c b/kernel/dma/ops_helpers.c
|
|
index 910ae69cae777..af4a6ef48ce04 100644
|
|
--- a/kernel/dma/ops_helpers.c
|
|
+++ b/kernel/dma/ops_helpers.c
|
|
@@ -5,6 +5,13 @@
|
|
*/
|
|
#include <linux/dma-map-ops.h>
|
|
|
|
+static struct page *dma_common_vaddr_to_page(void *cpu_addr)
|
|
+{
|
|
+ if (is_vmalloc_addr(cpu_addr))
|
|
+ return vmalloc_to_page(cpu_addr);
|
|
+ return virt_to_page(cpu_addr);
|
|
+}
|
|
+
|
|
/*
|
|
* Create scatter-list for the already allocated DMA buffer.
|
|
*/
|
|
@@ -12,7 +19,7 @@ int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
|
|
void *cpu_addr, dma_addr_t dma_addr, size_t size,
|
|
unsigned long attrs)
|
|
{
|
|
- struct page *page = virt_to_page(cpu_addr);
|
|
+ struct page *page = dma_common_vaddr_to_page(cpu_addr);
|
|
int ret;
|
|
|
|
ret = sg_alloc_table(sgt, 1, GFP_KERNEL);
|
|
@@ -32,6 +39,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
|
|
unsigned long user_count = vma_pages(vma);
|
|
unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
|
|
unsigned long off = vma->vm_pgoff;
|
|
+ struct page *page = dma_common_vaddr_to_page(cpu_addr);
|
|
int ret = -ENXIO;
|
|
|
|
vma->vm_page_prot = dma_pgprot(dev, vma->vm_page_prot, attrs);
|
|
@@ -43,7 +51,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
|
|
return -ENXIO;
|
|
|
|
return remap_pfn_range(vma, vma->vm_start,
|
|
- page_to_pfn(virt_to_page(cpu_addr)) + vma->vm_pgoff,
|
|
+ page_to_pfn(page) + vma->vm_pgoff,
|
|
user_count << PAGE_SHIFT, vma->vm_page_prot);
|
|
#else
|
|
return -ENXIO;
|
|
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
|
|
index 9abe15255bc4e..08c033b802569 100644
|
|
--- a/kernel/time/posix-cpu-timers.c
|
|
+++ b/kernel/time/posix-cpu-timers.c
|
|
@@ -991,6 +991,11 @@ static void posix_cpu_timer_rearm(struct k_itimer *timer)
|
|
if (!p)
|
|
goto out;
|
|
|
|
+ /* Protect timer list r/w in arm_timer() */
|
|
+ sighand = lock_task_sighand(p, &flags);
|
|
+ if (unlikely(sighand == NULL))
|
|
+ goto out;
|
|
+
|
|
/*
|
|
* Fetch the current sample and update the timer's expiry time.
|
|
*/
|
|
@@ -1001,11 +1006,6 @@ static void posix_cpu_timer_rearm(struct k_itimer *timer)
|
|
|
|
bump_cpu_timer(timer, now);
|
|
|
|
- /* Protect timer list r/w in arm_timer() */
|
|
- sighand = lock_task_sighand(p, &flags);
|
|
- if (unlikely(sighand == NULL))
|
|
- goto out;
|
|
-
|
|
/*
|
|
* Now re-arm for the new expiry time.
|
|
*/
|
|
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
|
|
index c3ad64fb9d8bd..aa96b8a4e508f 100644
|
|
--- a/kernel/time/timer.c
|
|
+++ b/kernel/time/timer.c
|
|
@@ -207,6 +207,7 @@ struct timer_base {
|
|
unsigned int cpu;
|
|
bool next_expiry_recalc;
|
|
bool is_idle;
|
|
+ bool timers_pending;
|
|
DECLARE_BITMAP(pending_map, WHEEL_SIZE);
|
|
struct hlist_head vectors[WHEEL_SIZE];
|
|
} ____cacheline_aligned;
|
|
@@ -595,6 +596,7 @@ static void enqueue_timer(struct timer_base *base, struct timer_list *timer,
|
|
* can reevaluate the wheel:
|
|
*/
|
|
base->next_expiry = bucket_expiry;
|
|
+ base->timers_pending = true;
|
|
base->next_expiry_recalc = false;
|
|
trigger_dyntick_cpu(base, timer);
|
|
}
|
|
@@ -1575,6 +1577,7 @@ static unsigned long __next_timer_interrupt(struct timer_base *base)
|
|
}
|
|
|
|
base->next_expiry_recalc = false;
|
|
+ base->timers_pending = !(next == base->clk + NEXT_TIMER_MAX_DELTA);
|
|
|
|
return next;
|
|
}
|
|
@@ -1626,7 +1629,6 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
|
|
struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
|
|
u64 expires = KTIME_MAX;
|
|
unsigned long nextevt;
|
|
- bool is_max_delta;
|
|
|
|
/*
|
|
* Pretend that there is no timer pending if the cpu is offline.
|
|
@@ -1639,7 +1641,6 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
|
|
if (base->next_expiry_recalc)
|
|
base->next_expiry = __next_timer_interrupt(base);
|
|
nextevt = base->next_expiry;
|
|
- is_max_delta = (nextevt == base->clk + NEXT_TIMER_MAX_DELTA);
|
|
|
|
/*
|
|
* We have a fresh next event. Check whether we can forward the
|
|
@@ -1657,7 +1658,7 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
|
|
expires = basem;
|
|
base->is_idle = false;
|
|
} else {
|
|
- if (!is_max_delta)
|
|
+ if (base->timers_pending)
|
|
expires = basem + (u64)(nextevt - basej) * TICK_NSEC;
|
|
/*
|
|
* If we expect to sleep more than a tick, mark the base idle.
|
|
@@ -1940,6 +1941,7 @@ int timers_prepare_cpu(unsigned int cpu)
|
|
base = per_cpu_ptr(&timer_bases[b], cpu);
|
|
base->clk = jiffies;
|
|
base->next_expiry = base->clk + NEXT_TIMER_MAX_DELTA;
|
|
+ base->timers_pending = false;
|
|
base->is_idle = false;
|
|
}
|
|
return 0;
|
|
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
|
|
index b12e5f4721ca7..39d4d9b25d1a1 100644
|
|
--- a/kernel/trace/ring_buffer.c
|
|
+++ b/kernel/trace/ring_buffer.c
|
|
@@ -3649,10 +3649,30 @@ static bool rb_per_cpu_empty(struct ring_buffer_per_cpu *cpu_buffer)
|
|
if (unlikely(!head))
|
|
return true;
|
|
|
|
- return reader->read == rb_page_commit(reader) &&
|
|
- (commit == reader ||
|
|
- (commit == head &&
|
|
- head->read == rb_page_commit(commit)));
|
|
+ /* Reader should exhaust content in reader page */
|
|
+ if (reader->read != rb_page_commit(reader))
|
|
+ return false;
|
|
+
|
|
+ /*
|
|
+ * If writers are committing on the reader page, knowing all
|
|
+ * committed content has been read, the ring buffer is empty.
|
|
+ */
|
|
+ if (commit == reader)
|
|
+ return true;
|
|
+
|
|
+ /*
|
|
+ * If writers are committing on a page other than reader page
|
|
+ * and head page, there should always be content to read.
|
|
+ */
|
|
+ if (commit != head)
|
|
+ return false;
|
|
+
|
|
+ /*
|
|
+ * Writers are committing on the head page, we just need
|
|
+ * to care about there're committed data, and the reader will
|
|
+ * swap reader page with head page when it is to read data.
|
|
+ */
|
|
+ return rb_page_commit(commit) == 0;
|
|
}
|
|
|
|
/**
|
|
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
|
|
index ee84891bacfac..625034c44d5f3 100644
|
|
--- a/kernel/trace/trace.c
|
|
+++ b/kernel/trace/trace.c
|
|
@@ -5241,6 +5241,10 @@ static const char readme_msg[] =
|
|
"\t [:name=histname1]\n"
|
|
"\t [:<handler>.<action>]\n"
|
|
"\t [if <filter>]\n\n"
|
|
+ "\t Note, special fields can be used as well:\n"
|
|
+ "\t common_timestamp - to record current timestamp\n"
|
|
+ "\t common_cpu - to record the CPU the event happened on\n"
|
|
+ "\n"
|
|
"\t When a matching event is hit, an entry is added to a hash\n"
|
|
"\t table using the key(s) and value(s) named, and the value of a\n"
|
|
"\t sum called 'hitcount' is incremented. Keys and values\n"
|
|
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
|
|
index 49d886b328dc1..379eade0c0837 100644
|
|
--- a/kernel/trace/trace_events_hist.c
|
|
+++ b/kernel/trace/trace_events_hist.c
|
|
@@ -1095,7 +1095,7 @@ static const char *hist_field_name(struct hist_field *field,
|
|
field->flags & HIST_FIELD_FL_ALIAS)
|
|
field_name = hist_field_name(field->operands[0], ++level);
|
|
else if (field->flags & HIST_FIELD_FL_CPU)
|
|
- field_name = "cpu";
|
|
+ field_name = "common_cpu";
|
|
else if (field->flags & HIST_FIELD_FL_EXPR ||
|
|
field->flags & HIST_FIELD_FL_VAR_REF) {
|
|
if (field->system) {
|
|
@@ -1975,14 +1975,24 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
|
|
hist_data->enable_timestamps = true;
|
|
if (*flags & HIST_FIELD_FL_TIMESTAMP_USECS)
|
|
hist_data->attrs->ts_in_usecs = true;
|
|
- } else if (strcmp(field_name, "cpu") == 0)
|
|
+ } else if (strcmp(field_name, "common_cpu") == 0)
|
|
*flags |= HIST_FIELD_FL_CPU;
|
|
else {
|
|
field = trace_find_event_field(file->event_call, field_name);
|
|
if (!field || !field->size) {
|
|
- hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, errpos(field_name));
|
|
- field = ERR_PTR(-EINVAL);
|
|
- goto out;
|
|
+ /*
|
|
+ * For backward compatibility, if field_name
|
|
+ * was "cpu", then we treat this the same as
|
|
+ * common_cpu.
|
|
+ */
|
|
+ if (strcmp(field_name, "cpu") == 0) {
|
|
+ *flags |= HIST_FIELD_FL_CPU;
|
|
+ } else {
|
|
+ hist_err(tr, HIST_ERR_FIELD_NOT_FOUND,
|
|
+ errpos(field_name));
|
|
+ field = ERR_PTR(-EINVAL);
|
|
+ goto out;
|
|
+ }
|
|
}
|
|
}
|
|
out:
|
|
@@ -5057,7 +5067,7 @@ static void hist_field_print(struct seq_file *m, struct hist_field *hist_field)
|
|
seq_printf(m, "%s=", hist_field->var.name);
|
|
|
|
if (hist_field->flags & HIST_FIELD_FL_CPU)
|
|
- seq_puts(m, "cpu");
|
|
+ seq_puts(m, "common_cpu");
|
|
else if (field_name) {
|
|
if (hist_field->flags & HIST_FIELD_FL_VAR_REF ||
|
|
hist_field->flags & HIST_FIELD_FL_ALIAS)
|
|
diff --git a/kernel/trace/trace_synth.h b/kernel/trace/trace_synth.h
|
|
index 6e146b959dcd0..4007fe95cf42c 100644
|
|
--- a/kernel/trace/trace_synth.h
|
|
+++ b/kernel/trace/trace_synth.h
|
|
@@ -14,10 +14,10 @@ struct synth_field {
|
|
char *name;
|
|
size_t size;
|
|
unsigned int offset;
|
|
+ unsigned int field_pos;
|
|
bool is_signed;
|
|
bool is_string;
|
|
bool is_dynamic;
|
|
- bool field_pos;
|
|
};
|
|
|
|
struct synth_event {
|
|
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
|
|
index f8b161edca5ea..1f490638b2dcc 100644
|
|
--- a/kernel/tracepoint.c
|
|
+++ b/kernel/tracepoint.c
|
|
@@ -320,8 +320,8 @@ static int tracepoint_add_func(struct tracepoint *tp,
|
|
* a pointer to it. This array is referenced by __DO_TRACE from
|
|
* include/linux/tracepoint.h using rcu_dereference_sched().
|
|
*/
|
|
- rcu_assign_pointer(tp->funcs, tp_funcs);
|
|
tracepoint_update_call(tp, tp_funcs, false);
|
|
+ rcu_assign_pointer(tp->funcs, tp_funcs);
|
|
static_key_enable(&tp->key);
|
|
|
|
release_probes(old);
|
|
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
|
|
index 5b7f88a2876db..ffccc13d685bd 100644
|
|
--- a/lib/Kconfig.debug
|
|
+++ b/lib/Kconfig.debug
|
|
@@ -1869,6 +1869,7 @@ config KCOV
|
|
depends on CC_HAS_SANCOV_TRACE_PC || GCC_PLUGINS
|
|
select DEBUG_FS
|
|
select GCC_PLUGIN_SANCOV if !CC_HAS_SANCOV_TRACE_PC
|
|
+ select SKB_EXTENSIONS
|
|
help
|
|
KCOV exposes kernel code coverage information in a form suitable
|
|
for coverage-guided fuzzing (randomized testing).
|
|
diff --git a/mm/memblock.c b/mm/memblock.c
|
|
index 10bd7d1ef0f49..c337df03b6a17 100644
|
|
--- a/mm/memblock.c
|
|
+++ b/mm/memblock.c
|
|
@@ -940,7 +940,8 @@ static bool should_skip_region(struct memblock_type *type,
|
|
return true;
|
|
|
|
/* skip hotpluggable memory regions if needed */
|
|
- if (movable_node_is_enabled() && memblock_is_hotpluggable(m))
|
|
+ if (movable_node_is_enabled() && memblock_is_hotpluggable(m) &&
|
|
+ !(flags & MEMBLOCK_HOTPLUG))
|
|
return true;
|
|
|
|
/* if we want mirror memory skip non-mirror memory regions */
|
|
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
|
|
index 8b796c499cbb2..e7cbd1b4a5e51 100644
|
|
--- a/net/bpf/test_run.c
|
|
+++ b/net/bpf/test_run.c
|
|
@@ -627,6 +627,9 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,
|
|
void *data;
|
|
int ret;
|
|
|
|
+ if (prog->expected_attach_type == BPF_XDP_DEVMAP ||
|
|
+ prog->expected_attach_type == BPF_XDP_CPUMAP)
|
|
+ return -EINVAL;
|
|
if (kattr->test.ctx_in || kattr->test.ctx_out)
|
|
return -EINVAL;
|
|
|
|
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
|
|
index 3ad0a1df67128..9d26c5e9da058 100644
|
|
--- a/net/caif/caif_socket.c
|
|
+++ b/net/caif/caif_socket.c
|
|
@@ -539,7 +539,8 @@ static int caif_seqpkt_sendmsg(struct socket *sock, struct msghdr *msg,
|
|
goto err;
|
|
|
|
ret = -EINVAL;
|
|
- if (unlikely(msg->msg_iter.iov->iov_base == NULL))
|
|
+ if (unlikely(msg->msg_iter.nr_segs == 0) ||
|
|
+ unlikely(msg->msg_iter.iov->iov_base == NULL))
|
|
goto err;
|
|
noblock = msg->msg_flags & MSG_DONTWAIT;
|
|
|
|
diff --git a/net/core/dev.c b/net/core/dev.c
|
|
index 2fdf30eefc596..b9d19fbb15890 100644
|
|
--- a/net/core/dev.c
|
|
+++ b/net/core/dev.c
|
|
@@ -5870,6 +5870,19 @@ static struct list_head *gro_list_prepare(struct napi_struct *napi,
|
|
diffs = memcmp(skb_mac_header(p),
|
|
skb_mac_header(skb),
|
|
maclen);
|
|
+
|
|
+ diffs |= skb_get_nfct(p) ^ skb_get_nfct(skb);
|
|
+#if IS_ENABLED(CONFIG_SKB_EXTENSIONS) && IS_ENABLED(CONFIG_NET_TC_SKB_EXT)
|
|
+ if (!diffs) {
|
|
+ struct tc_skb_ext *skb_ext = skb_ext_find(skb, TC_SKB_EXT);
|
|
+ struct tc_skb_ext *p_ext = skb_ext_find(p, TC_SKB_EXT);
|
|
+
|
|
+ diffs |= (!!p_ext) ^ (!!skb_ext);
|
|
+ if (!diffs && unlikely(skb_ext))
|
|
+ diffs |= p_ext->chain ^ skb_ext->chain;
|
|
+ }
|
|
+#endif
|
|
+
|
|
NAPI_GRO_CB(p)->same_flow = !diffs;
|
|
}
|
|
|
|
@@ -6149,6 +6162,7 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
|
|
skb_shinfo(skb)->gso_type = 0;
|
|
skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
|
|
skb_ext_reset(skb);
|
|
+ nf_reset_ct(skb);
|
|
|
|
napi->skb = skb;
|
|
}
|
|
@@ -9351,14 +9365,17 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
|
|
struct net_device *dev;
|
|
int err, fd;
|
|
|
|
+ rtnl_lock();
|
|
dev = dev_get_by_index(net, attr->link_create.target_ifindex);
|
|
- if (!dev)
|
|
+ if (!dev) {
|
|
+ rtnl_unlock();
|
|
return -EINVAL;
|
|
+ }
|
|
|
|
link = kzalloc(sizeof(*link), GFP_USER);
|
|
if (!link) {
|
|
err = -ENOMEM;
|
|
- goto out_put_dev;
|
|
+ goto unlock;
|
|
}
|
|
|
|
bpf_link_init(&link->link, BPF_LINK_TYPE_XDP, &bpf_xdp_link_lops, prog);
|
|
@@ -9368,14 +9385,14 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
|
|
err = bpf_link_prime(&link->link, &link_primer);
|
|
if (err) {
|
|
kfree(link);
|
|
- goto out_put_dev;
|
|
+ goto unlock;
|
|
}
|
|
|
|
- rtnl_lock();
|
|
err = dev_xdp_attach_link(dev, NULL, link);
|
|
rtnl_unlock();
|
|
|
|
if (err) {
|
|
+ link->dev = NULL;
|
|
bpf_link_cleanup(&link_primer);
|
|
goto out_put_dev;
|
|
}
|
|
@@ -9385,6 +9402,9 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
|
|
dev_put(dev);
|
|
return fd;
|
|
|
|
+unlock:
|
|
+ rtnl_unlock();
|
|
+
|
|
out_put_dev:
|
|
dev_put(dev);
|
|
return err;
|
|
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
|
|
index 1301ea694b940..2d27aae6d36ff 100644
|
|
--- a/net/core/skbuff.c
|
|
+++ b/net/core/skbuff.c
|
|
@@ -249,6 +249,9 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
|
|
|
|
fclones->skb2.fclone = SKB_FCLONE_CLONE;
|
|
}
|
|
+
|
|
+ skb_set_kcov_handle(skb, kcov_common_handle());
|
|
+
|
|
out:
|
|
return skb;
|
|
nodata:
|
|
@@ -282,6 +285,8 @@ static struct sk_buff *__build_skb_around(struct sk_buff *skb,
|
|
memset(shinfo, 0, offsetof(struct skb_shared_info, dataref));
|
|
atomic_set(&shinfo->dataref, 1);
|
|
|
|
+ skb_set_kcov_handle(skb, kcov_common_handle());
|
|
+
|
|
return skb;
|
|
}
|
|
|
|
@@ -654,6 +659,7 @@ fastpath:
|
|
|
|
void skb_release_head_state(struct sk_buff *skb)
|
|
{
|
|
+ nf_reset_ct(skb);
|
|
skb_dst_drop(skb);
|
|
if (skb->destructor) {
|
|
WARN_ON(in_irq());
|
|
@@ -4248,6 +4254,9 @@ static const u8 skb_ext_type_len[] = {
|
|
#if IS_ENABLED(CONFIG_MPTCP)
|
|
[SKB_EXT_MPTCP] = SKB_EXT_CHUNKSIZEOF(struct mptcp_ext),
|
|
#endif
|
|
+#if IS_ENABLED(CONFIG_KCOV)
|
|
+ [SKB_EXT_KCOV_HANDLE] = SKB_EXT_CHUNKSIZEOF(u64),
|
|
+#endif
|
|
};
|
|
|
|
static __always_inline unsigned int skb_ext_total_length(void)
|
|
@@ -4264,6 +4273,9 @@ static __always_inline unsigned int skb_ext_total_length(void)
|
|
#endif
|
|
#if IS_ENABLED(CONFIG_MPTCP)
|
|
skb_ext_type_len[SKB_EXT_MPTCP] +
|
|
+#endif
|
|
+#if IS_ENABLED(CONFIG_KCOV)
|
|
+ skb_ext_type_len[SKB_EXT_KCOV_HANDLE] +
|
|
#endif
|
|
0;
|
|
}
|
|
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
|
|
index 923a1d0f84ca3..c4c224a5b9de7 100644
|
|
--- a/net/core/skmsg.c
|
|
+++ b/net/core/skmsg.c
|
|
@@ -433,10 +433,8 @@ static int sk_psock_skb_ingress_enqueue(struct sk_buff *skb,
|
|
if (skb_linearize(skb))
|
|
return -EAGAIN;
|
|
num_sge = skb_to_sgvec(skb, msg->sg.data, 0, skb->len);
|
|
- if (unlikely(num_sge < 0)) {
|
|
- kfree(msg);
|
|
+ if (unlikely(num_sge < 0))
|
|
return num_sge;
|
|
- }
|
|
|
|
copied = skb->len;
|
|
msg->sg.start = 0;
|
|
@@ -455,6 +453,7 @@ static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb)
|
|
{
|
|
struct sock *sk = psock->sk;
|
|
struct sk_msg *msg;
|
|
+ int err;
|
|
|
|
/* If we are receiving on the same sock skb->sk is already assigned,
|
|
* skip memory accounting and owner transition seeing it already set
|
|
@@ -473,7 +472,10 @@ static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb)
|
|
* into user buffers.
|
|
*/
|
|
skb_set_owner_r(skb, sk);
|
|
- return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg);
|
|
+ err = sk_psock_skb_ingress_enqueue(skb, psock, sk, msg);
|
|
+ if (err < 0)
|
|
+ kfree(msg);
|
|
+ return err;
|
|
}
|
|
|
|
/* Puts an skb on the ingress queue of the socket already assigned to the
|
|
@@ -484,12 +486,16 @@ static int sk_psock_skb_ingress_self(struct sk_psock *psock, struct sk_buff *skb
|
|
{
|
|
struct sk_msg *msg = kzalloc(sizeof(*msg), __GFP_NOWARN | GFP_ATOMIC);
|
|
struct sock *sk = psock->sk;
|
|
+ int err;
|
|
|
|
if (unlikely(!msg))
|
|
return -EAGAIN;
|
|
sk_msg_init(msg);
|
|
skb_set_owner_r(skb, sk);
|
|
- return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg);
|
|
+ err = sk_psock_skb_ingress_enqueue(skb, psock, sk, msg);
|
|
+ if (err < 0)
|
|
+ kfree(msg);
|
|
+ return err;
|
|
}
|
|
|
|
static int sk_psock_handle_skb(struct sk_psock *psock, struct sk_buff *skb,
|
|
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
|
|
index 5dbd45dc35ad3..dc92a67baea39 100644
|
|
--- a/net/decnet/af_decnet.c
|
|
+++ b/net/decnet/af_decnet.c
|
|
@@ -816,7 +816,7 @@ static int dn_auto_bind(struct socket *sock)
|
|
static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
|
|
{
|
|
struct dn_scp *scp = DN_SK(sk);
|
|
- DEFINE_WAIT(wait);
|
|
+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
|
|
int err;
|
|
|
|
if (scp->state != DN_CR)
|
|
@@ -826,11 +826,11 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
|
|
scp->segsize_loc = dst_metric_advmss(__sk_dst_get(sk));
|
|
dn_send_conn_conf(sk, allocation);
|
|
|
|
- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
|
|
+ add_wait_queue(sk_sleep(sk), &wait);
|
|
for(;;) {
|
|
release_sock(sk);
|
|
if (scp->state == DN_CC)
|
|
- *timeo = schedule_timeout(*timeo);
|
|
+ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo);
|
|
lock_sock(sk);
|
|
err = 0;
|
|
if (scp->state == DN_RUN)
|
|
@@ -844,9 +844,8 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
|
|
err = -EAGAIN;
|
|
if (!*timeo)
|
|
break;
|
|
- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
|
|
}
|
|
- finish_wait(sk_sleep(sk), &wait);
|
|
+ remove_wait_queue(sk_sleep(sk), &wait);
|
|
if (err == 0) {
|
|
sk->sk_socket->state = SS_CONNECTED;
|
|
} else if (scp->state != DN_CC) {
|
|
@@ -858,7 +857,7 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
|
|
static int dn_wait_run(struct sock *sk, long *timeo)
|
|
{
|
|
struct dn_scp *scp = DN_SK(sk);
|
|
- DEFINE_WAIT(wait);
|
|
+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
|
|
int err = 0;
|
|
|
|
if (scp->state == DN_RUN)
|
|
@@ -867,11 +866,11 @@ static int dn_wait_run(struct sock *sk, long *timeo)
|
|
if (!*timeo)
|
|
return -EALREADY;
|
|
|
|
- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
|
|
+ add_wait_queue(sk_sleep(sk), &wait);
|
|
for(;;) {
|
|
release_sock(sk);
|
|
if (scp->state == DN_CI || scp->state == DN_CC)
|
|
- *timeo = schedule_timeout(*timeo);
|
|
+ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo);
|
|
lock_sock(sk);
|
|
err = 0;
|
|
if (scp->state == DN_RUN)
|
|
@@ -885,9 +884,8 @@ static int dn_wait_run(struct sock *sk, long *timeo)
|
|
err = -ETIMEDOUT;
|
|
if (!*timeo)
|
|
break;
|
|
- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
|
|
}
|
|
- finish_wait(sk_sleep(sk), &wait);
|
|
+ remove_wait_queue(sk_sleep(sk), &wait);
|
|
out:
|
|
if (err == 0) {
|
|
sk->sk_socket->state = SS_CONNECTED;
|
|
@@ -1032,16 +1030,16 @@ static void dn_user_copy(struct sk_buff *skb, struct optdata_dn *opt)
|
|
|
|
static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo)
|
|
{
|
|
- DEFINE_WAIT(wait);
|
|
+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
|
|
struct sk_buff *skb = NULL;
|
|
int err = 0;
|
|
|
|
- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
|
|
+ add_wait_queue(sk_sleep(sk), &wait);
|
|
for(;;) {
|
|
release_sock(sk);
|
|
skb = skb_dequeue(&sk->sk_receive_queue);
|
|
if (skb == NULL) {
|
|
- *timeo = schedule_timeout(*timeo);
|
|
+ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo);
|
|
skb = skb_dequeue(&sk->sk_receive_queue);
|
|
}
|
|
lock_sock(sk);
|
|
@@ -1056,9 +1054,8 @@ static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo)
|
|
err = -EAGAIN;
|
|
if (!*timeo)
|
|
break;
|
|
- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
|
|
}
|
|
- finish_wait(sk_sleep(sk), &wait);
|
|
+ remove_wait_queue(sk_sleep(sk), &wait);
|
|
|
|
return skb == NULL ? ERR_PTR(err) : skb;
|
|
}
|
|
diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
|
|
index bc7d2a586e183..f91ae827d47f5 100644
|
|
--- a/net/ipv4/tcp_bpf.c
|
|
+++ b/net/ipv4/tcp_bpf.c
|
|
@@ -588,7 +588,7 @@ static int __init tcp_bpf_v4_build_proto(void)
|
|
tcp_bpf_rebuild_protos(tcp_bpf_prots[TCP_BPF_IPV4], &tcp_prot);
|
|
return 0;
|
|
}
|
|
-core_initcall(tcp_bpf_v4_build_proto);
|
|
+late_initcall(tcp_bpf_v4_build_proto);
|
|
|
|
static int tcp_bpf_assert_proto_ops(struct proto *ops)
|
|
{
|
|
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
|
|
index af2814c9342af..d49709ba8e165 100644
|
|
--- a/net/ipv4/tcp_fastopen.c
|
|
+++ b/net/ipv4/tcp_fastopen.c
|
|
@@ -507,8 +507,18 @@ void tcp_fastopen_active_disable(struct sock *sk)
|
|
{
|
|
struct net *net = sock_net(sk);
|
|
|
|
+ if (!sock_net(sk)->ipv4.sysctl_tcp_fastopen_blackhole_timeout)
|
|
+ return;
|
|
+
|
|
+ /* Paired with READ_ONCE() in tcp_fastopen_active_should_disable() */
|
|
+ WRITE_ONCE(net->ipv4.tfo_active_disable_stamp, jiffies);
|
|
+
|
|
+ /* Paired with smp_rmb() in tcp_fastopen_active_should_disable().
|
|
+ * We want net->ipv4.tfo_active_disable_stamp to be updated first.
|
|
+ */
|
|
+ smp_mb__before_atomic();
|
|
atomic_inc(&net->ipv4.tfo_active_disable_times);
|
|
- net->ipv4.tfo_active_disable_stamp = jiffies;
|
|
+
|
|
NET_INC_STATS(net, LINUX_MIB_TCPFASTOPENBLACKHOLE);
|
|
}
|
|
|
|
@@ -519,17 +529,27 @@ void tcp_fastopen_active_disable(struct sock *sk)
|
|
bool tcp_fastopen_active_should_disable(struct sock *sk)
|
|
{
|
|
unsigned int tfo_bh_timeout = sock_net(sk)->ipv4.sysctl_tcp_fastopen_blackhole_timeout;
|
|
- int tfo_da_times = atomic_read(&sock_net(sk)->ipv4.tfo_active_disable_times);
|
|
unsigned long timeout;
|
|
+ int tfo_da_times;
|
|
int multiplier;
|
|
|
|
+ if (!tfo_bh_timeout)
|
|
+ return false;
|
|
+
|
|
+ tfo_da_times = atomic_read(&sock_net(sk)->ipv4.tfo_active_disable_times);
|
|
if (!tfo_da_times)
|
|
return false;
|
|
|
|
+ /* Paired with smp_mb__before_atomic() in tcp_fastopen_active_disable() */
|
|
+ smp_rmb();
|
|
+
|
|
/* Limit timout to max: 2^6 * initial timeout */
|
|
multiplier = 1 << min(tfo_da_times - 1, 6);
|
|
- timeout = multiplier * tfo_bh_timeout * HZ;
|
|
- if (time_before(jiffies, sock_net(sk)->ipv4.tfo_active_disable_stamp + timeout))
|
|
+
|
|
+ /* Paired with the WRITE_ONCE() in tcp_fastopen_active_disable(). */
|
|
+ timeout = READ_ONCE(sock_net(sk)->ipv4.tfo_active_disable_stamp) +
|
|
+ multiplier * tfo_bh_timeout * HZ;
|
|
+ if (time_before(jiffies, timeout))
|
|
return true;
|
|
|
|
/* Mark check bit so we can check for successful active TFO
|
|
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
|
|
index 5212db9ea157e..04e259a04443c 100644
|
|
--- a/net/ipv4/tcp_ipv4.c
|
|
+++ b/net/ipv4/tcp_ipv4.c
|
|
@@ -2913,7 +2913,7 @@ static int __net_init tcp_sk_init(struct net *net)
|
|
net->ipv4.sysctl_tcp_comp_sack_nr = 44;
|
|
net->ipv4.sysctl_tcp_fastopen = TFO_CLIENT_ENABLE;
|
|
spin_lock_init(&net->ipv4.tcp_fastopen_ctx_lock);
|
|
- net->ipv4.sysctl_tcp_fastopen_blackhole_timeout = 60 * 60;
|
|
+ net->ipv4.sysctl_tcp_fastopen_blackhole_timeout = 0;
|
|
atomic_set(&net->ipv4.tfo_active_disable_times, 0);
|
|
|
|
/* Reno is always built in */
|
|
diff --git a/net/ipv4/udp_bpf.c b/net/ipv4/udp_bpf.c
|
|
index 7a94791efc1ab..69c9663f9ee7d 100644
|
|
--- a/net/ipv4/udp_bpf.c
|
|
+++ b/net/ipv4/udp_bpf.c
|
|
@@ -39,7 +39,7 @@ static int __init udp_bpf_v4_build_proto(void)
|
|
udp_bpf_rebuild_protos(&udp_bpf_prots[UDP_BPF_IPV4], &udp_prot);
|
|
return 0;
|
|
}
|
|
-core_initcall(udp_bpf_v4_build_proto);
|
|
+late_initcall(udp_bpf_v4_build_proto);
|
|
|
|
struct proto *udp_bpf_get_proto(struct sock *sk, struct sk_psock *psock)
|
|
{
|
|
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
|
|
index e889655ca0e20..341d0c7acc8bf 100644
|
|
--- a/net/ipv6/ip6_output.c
|
|
+++ b/net/ipv6/ip6_output.c
|
|
@@ -478,7 +478,9 @@ int ip6_forward(struct sk_buff *skb)
|
|
if (skb_warn_if_lro(skb))
|
|
goto drop;
|
|
|
|
- if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
|
|
+ if (!net->ipv6.devconf_all->disable_policy &&
|
|
+ !idev->cnf.disable_policy &&
|
|
+ !xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
|
|
__IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS);
|
|
goto drop;
|
|
}
|
|
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
|
|
index ccff4738313c1..62db3c98424bd 100644
|
|
--- a/net/ipv6/route.c
|
|
+++ b/net/ipv6/route.c
|
|
@@ -3640,7 +3640,7 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg,
|
|
err = PTR_ERR(rt->fib6_metrics);
|
|
/* Do not leave garbage there. */
|
|
rt->fib6_metrics = (struct dst_metrics *)&dst_default_metrics;
|
|
- goto out;
|
|
+ goto out_free;
|
|
}
|
|
|
|
if (cfg->fc_flags & RTF_ADDRCONF)
|
|
diff --git a/net/mptcp/syncookies.c b/net/mptcp/syncookies.c
|
|
index abe0fd0997467..37127781aee98 100644
|
|
--- a/net/mptcp/syncookies.c
|
|
+++ b/net/mptcp/syncookies.c
|
|
@@ -37,7 +37,21 @@ static spinlock_t join_entry_locks[COOKIE_JOIN_SLOTS] __cacheline_aligned_in_smp
|
|
|
|
static u32 mptcp_join_entry_hash(struct sk_buff *skb, struct net *net)
|
|
{
|
|
- u32 i = skb_get_hash(skb) ^ net_hash_mix(net);
|
|
+ static u32 mptcp_join_hash_secret __read_mostly;
|
|
+ struct tcphdr *th = tcp_hdr(skb);
|
|
+ u32 seq, i;
|
|
+
|
|
+ net_get_random_once(&mptcp_join_hash_secret,
|
|
+ sizeof(mptcp_join_hash_secret));
|
|
+
|
|
+ if (th->syn)
|
|
+ seq = TCP_SKB_CB(skb)->seq;
|
|
+ else
|
|
+ seq = TCP_SKB_CB(skb)->seq - 1;
|
|
+
|
|
+ i = jhash_3words(seq, net_hash_mix(net),
|
|
+ (__force __u32)th->source << 16 | (__force __u32)th->dest,
|
|
+ mptcp_join_hash_secret);
|
|
|
|
return i % ARRAY_SIZE(join_entries);
|
|
}
|
|
diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c
|
|
index 9115f8a7dd45b..a8da88db7893f 100644
|
|
--- a/net/netrom/nr_timer.c
|
|
+++ b/net/netrom/nr_timer.c
|
|
@@ -121,11 +121,9 @@ static void nr_heartbeat_expiry(struct timer_list *t)
|
|
is accepted() it isn't 'dead' so doesn't get removed. */
|
|
if (sock_flag(sk, SOCK_DESTROY) ||
|
|
(sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_DEAD))) {
|
|
- sock_hold(sk);
|
|
bh_unlock_sock(sk);
|
|
nr_destroy_socket(sk);
|
|
- sock_put(sk);
|
|
- return;
|
|
+ goto out;
|
|
}
|
|
break;
|
|
|
|
@@ -146,6 +144,8 @@ static void nr_heartbeat_expiry(struct timer_list *t)
|
|
|
|
nr_start_heartbeat(sk);
|
|
bh_unlock_sock(sk);
|
|
+out:
|
|
+ sock_put(sk);
|
|
}
|
|
|
|
static void nr_t2timer_expiry(struct timer_list *t)
|
|
@@ -159,6 +159,7 @@ static void nr_t2timer_expiry(struct timer_list *t)
|
|
nr_enquiry_response(sk);
|
|
}
|
|
bh_unlock_sock(sk);
|
|
+ sock_put(sk);
|
|
}
|
|
|
|
static void nr_t4timer_expiry(struct timer_list *t)
|
|
@@ -169,6 +170,7 @@ static void nr_t4timer_expiry(struct timer_list *t)
|
|
bh_lock_sock(sk);
|
|
nr_sk(sk)->condition &= ~NR_COND_PEER_RX_BUSY;
|
|
bh_unlock_sock(sk);
|
|
+ sock_put(sk);
|
|
}
|
|
|
|
static void nr_idletimer_expiry(struct timer_list *t)
|
|
@@ -197,6 +199,7 @@ static void nr_idletimer_expiry(struct timer_list *t)
|
|
sock_set_flag(sk, SOCK_DEAD);
|
|
}
|
|
bh_unlock_sock(sk);
|
|
+ sock_put(sk);
|
|
}
|
|
|
|
static void nr_t1timer_expiry(struct timer_list *t)
|
|
@@ -209,8 +212,7 @@ static void nr_t1timer_expiry(struct timer_list *t)
|
|
case NR_STATE_1:
|
|
if (nr->n2count == nr->n2) {
|
|
nr_disconnect(sk, ETIMEDOUT);
|
|
- bh_unlock_sock(sk);
|
|
- return;
|
|
+ goto out;
|
|
} else {
|
|
nr->n2count++;
|
|
nr_write_internal(sk, NR_CONNREQ);
|
|
@@ -220,8 +222,7 @@ static void nr_t1timer_expiry(struct timer_list *t)
|
|
case NR_STATE_2:
|
|
if (nr->n2count == nr->n2) {
|
|
nr_disconnect(sk, ETIMEDOUT);
|
|
- bh_unlock_sock(sk);
|
|
- return;
|
|
+ goto out;
|
|
} else {
|
|
nr->n2count++;
|
|
nr_write_internal(sk, NR_DISCREQ);
|
|
@@ -231,8 +232,7 @@ static void nr_t1timer_expiry(struct timer_list *t)
|
|
case NR_STATE_3:
|
|
if (nr->n2count == nr->n2) {
|
|
nr_disconnect(sk, ETIMEDOUT);
|
|
- bh_unlock_sock(sk);
|
|
- return;
|
|
+ goto out;
|
|
} else {
|
|
nr->n2count++;
|
|
nr_requeue_frames(sk);
|
|
@@ -241,5 +241,7 @@ static void nr_t1timer_expiry(struct timer_list *t)
|
|
}
|
|
|
|
nr_start_t1timer(sk);
|
|
+out:
|
|
bh_unlock_sock(sk);
|
|
+ sock_put(sk);
|
|
}
|
|
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c
|
|
index 81a1c67335be6..8d17a543cc9fe 100644
|
|
--- a/net/sched/act_skbmod.c
|
|
+++ b/net/sched/act_skbmod.c
|
|
@@ -6,6 +6,7 @@
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
+#include <linux/if_arp.h>
|
|
#include <linux/init.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/skbuff.h>
|
|
@@ -33,6 +34,13 @@ static int tcf_skbmod_act(struct sk_buff *skb, const struct tc_action *a,
|
|
tcf_lastuse_update(&d->tcf_tm);
|
|
bstats_cpu_update(this_cpu_ptr(d->common.cpu_bstats), skb);
|
|
|
|
+ action = READ_ONCE(d->tcf_action);
|
|
+ if (unlikely(action == TC_ACT_SHOT))
|
|
+ goto drop;
|
|
+
|
|
+ if (!skb->dev || skb->dev->type != ARPHRD_ETHER)
|
|
+ return action;
|
|
+
|
|
/* XXX: if you are going to edit more fields beyond ethernet header
|
|
* (example when you add IP header replacement or vlan swap)
|
|
* then MAX_EDIT_LEN needs to change appropriately
|
|
@@ -41,10 +49,6 @@ static int tcf_skbmod_act(struct sk_buff *skb, const struct tc_action *a,
|
|
if (unlikely(err)) /* best policy is to drop on the floor */
|
|
goto drop;
|
|
|
|
- action = READ_ONCE(d->tcf_action);
|
|
- if (unlikely(action == TC_ACT_SHOT))
|
|
- goto drop;
|
|
-
|
|
p = rcu_dereference_bh(d->skbmod_p);
|
|
flags = p->flags;
|
|
if (flags & SKBMOD_F_DMAC)
|
|
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
|
|
index 30090794b7912..31ac76a9189ee 100644
|
|
--- a/net/sched/cls_api.c
|
|
+++ b/net/sched/cls_api.c
|
|
@@ -2905,7 +2905,7 @@ replay:
|
|
break;
|
|
case RTM_GETCHAIN:
|
|
err = tc_chain_notify(chain, skb, n->nlmsg_seq,
|
|
- n->nlmsg_seq, n->nlmsg_type, true);
|
|
+ n->nlmsg_flags, n->nlmsg_type, true);
|
|
if (err < 0)
|
|
NL_SET_ERR_MSG(extack, "Failed to send chain notify message");
|
|
break;
|
|
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
|
|
index 5b274534264c2..e9a8a2c86bbdd 100644
|
|
--- a/net/sched/cls_tcindex.c
|
|
+++ b/net/sched/cls_tcindex.c
|
|
@@ -278,6 +278,8 @@ static int tcindex_filter_result_init(struct tcindex_filter_result *r,
|
|
TCA_TCINDEX_POLICE);
|
|
}
|
|
|
|
+static void tcindex_free_perfect_hash(struct tcindex_data *cp);
|
|
+
|
|
static void tcindex_partial_destroy_work(struct work_struct *work)
|
|
{
|
|
struct tcindex_data *p = container_of(to_rcu_work(work),
|
|
@@ -285,7 +287,8 @@ static void tcindex_partial_destroy_work(struct work_struct *work)
|
|
rwork);
|
|
|
|
rtnl_lock();
|
|
- kfree(p->perfect);
|
|
+ if (p->perfect)
|
|
+ tcindex_free_perfect_hash(p);
|
|
kfree(p);
|
|
rtnl_unlock();
|
|
}
|
|
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
|
|
index 6f8319b828b0d..fe74c5f956303 100644
|
|
--- a/net/sctp/auth.c
|
|
+++ b/net/sctp/auth.c
|
|
@@ -860,6 +860,8 @@ int sctp_auth_set_key(struct sctp_endpoint *ep,
|
|
if (replace) {
|
|
list_del_init(&shkey->key_list);
|
|
sctp_auth_shkey_release(shkey);
|
|
+ if (asoc && asoc->active_key_id == auth_key->sca_keynumber)
|
|
+ sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL);
|
|
}
|
|
list_add(&cur_key->key_list, sh_keys);
|
|
|
|
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
|
|
index 3ac6b21ecf2c1..e872bc50bbe61 100644
|
|
--- a/net/sctp/socket.c
|
|
+++ b/net/sctp/socket.c
|
|
@@ -4471,6 +4471,10 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
|
|
}
|
|
|
|
if (optlen > 0) {
|
|
+ /* Trim it to the biggest size sctp sockopt may need if necessary */
|
|
+ optlen = min_t(unsigned int, optlen,
|
|
+ PAGE_ALIGN(USHRT_MAX +
|
|
+ sizeof(__u16) * sizeof(struct sctp_reset_streams)));
|
|
kopt = memdup_sockptr(optval, optlen);
|
|
if (IS_ERR(kopt))
|
|
return PTR_ERR(kopt);
|
|
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
|
|
index 50c14cc861e69..6d1759b9ccb2f 100644
|
|
--- a/sound/core/pcm_native.c
|
|
+++ b/sound/core/pcm_native.c
|
|
@@ -246,12 +246,18 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream)
|
|
if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP))
|
|
return false;
|
|
|
|
- if (substream->ops->mmap ||
|
|
- (substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV &&
|
|
- substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV_UC))
|
|
+ if (substream->ops->mmap)
|
|
return true;
|
|
|
|
- return dma_can_mmap(substream->dma_buffer.dev.dev);
|
|
+ switch (substream->dma_buffer.dev.type) {
|
|
+ case SNDRV_DMA_TYPE_UNKNOWN:
|
|
+ return false;
|
|
+ case SNDRV_DMA_TYPE_CONTINUOUS:
|
|
+ case SNDRV_DMA_TYPE_VMALLOC:
|
|
+ return true;
|
|
+ default:
|
|
+ return dma_can_mmap(substream->dma_buffer.dev.dev);
|
|
+ }
|
|
}
|
|
|
|
static int constrain_mask_params(struct snd_pcm_substream *substream,
|
|
@@ -3062,9 +3068,14 @@ static int snd_pcm_ioctl_sync_ptr_compat(struct snd_pcm_substream *substream,
|
|
boundary = 0x7fffffff;
|
|
snd_pcm_stream_lock_irq(substream);
|
|
/* FIXME: we should consider the boundary for the sync from app */
|
|
- if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL))
|
|
- control->appl_ptr = scontrol.appl_ptr;
|
|
- else
|
|
+ if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) {
|
|
+ err = pcm_lib_apply_appl_ptr(substream,
|
|
+ scontrol.appl_ptr);
|
|
+ if (err < 0) {
|
|
+ snd_pcm_stream_unlock_irq(substream);
|
|
+ return err;
|
|
+ }
|
|
+ } else
|
|
scontrol.appl_ptr = control->appl_ptr % boundary;
|
|
if (!(sflags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN))
|
|
control->avail_min = scontrol.avail_min;
|
|
diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c
|
|
index fe49e9a97f0ec..61e1de6d7be0a 100644
|
|
--- a/sound/hda/intel-dsp-config.c
|
|
+++ b/sound/hda/intel-dsp-config.c
|
|
@@ -318,6 +318,10 @@ static const struct config_entry config_table[] = {
|
|
.flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC,
|
|
.device = 0x4b55,
|
|
},
|
|
+ {
|
|
+ .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC,
|
|
+ .device = 0x4b58,
|
|
+ },
|
|
#endif
|
|
|
|
};
|
|
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
|
|
index dbcd9ab2c2b76..6a4051bce3a3b 100644
|
|
--- a/sound/isa/sb/sb16_csp.c
|
|
+++ b/sound/isa/sb/sb16_csp.c
|
|
@@ -814,6 +814,7 @@ static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channel
|
|
mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1);
|
|
snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7);
|
|
snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7);
|
|
+ spin_unlock_irqrestore(&p->chip->mixer_lock, flags);
|
|
|
|
spin_lock(&p->chip->reg_lock);
|
|
set_mode_register(p->chip, 0xc0); /* c0 = STOP */
|
|
@@ -853,6 +854,7 @@ static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channel
|
|
spin_unlock(&p->chip->reg_lock);
|
|
|
|
/* restore PCM volume */
|
|
+ spin_lock_irqsave(&p->chip->mixer_lock, flags);
|
|
snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL);
|
|
snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR);
|
|
spin_unlock_irqrestore(&p->chip->mixer_lock, flags);
|
|
@@ -878,6 +880,7 @@ static int snd_sb_csp_stop(struct snd_sb_csp * p)
|
|
mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1);
|
|
snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7);
|
|
snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7);
|
|
+ spin_unlock_irqrestore(&p->chip->mixer_lock, flags);
|
|
|
|
spin_lock(&p->chip->reg_lock);
|
|
if (p->running & SNDRV_SB_CSP_ST_QSOUND) {
|
|
@@ -892,6 +895,7 @@ static int snd_sb_csp_stop(struct snd_sb_csp * p)
|
|
spin_unlock(&p->chip->reg_lock);
|
|
|
|
/* restore PCM volume */
|
|
+ spin_lock_irqsave(&p->chip->mixer_lock, flags);
|
|
snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL);
|
|
snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR);
|
|
spin_unlock_irqrestore(&p->chip->mixer_lock, flags);
|
|
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
|
|
index 6d2a4dfcfe436..c65144715af78 100644
|
|
--- a/sound/pci/hda/patch_hdmi.c
|
|
+++ b/sound/pci/hda/patch_hdmi.c
|
|
@@ -1939,6 +1939,7 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)
|
|
static const struct snd_pci_quirk force_connect_list[] = {
|
|
SND_PCI_QUIRK(0x103c, 0x870f, "HP", 1),
|
|
SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1),
|
|
+ SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1),
|
|
{}
|
|
};
|
|
|
|
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
|
|
index 1cc83344c2ecf..bedc2a316adf9 100644
|
|
--- a/sound/pci/hda/patch_realtek.c
|
|
+++ b/sound/pci/hda/patch_realtek.c
|
|
@@ -8550,6 +8550,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
|
|
SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
|
|
SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
|
|
SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
|
|
+ SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
|
|
SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
|
|
SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
|
|
SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
|
|
diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c
|
|
index 653da3eaf3559..86d58d0df0571 100644
|
|
--- a/sound/soc/codecs/rt5631.c
|
|
+++ b/sound/soc/codecs/rt5631.c
|
|
@@ -1695,6 +1695,8 @@ static const struct regmap_config rt5631_regmap_config = {
|
|
.reg_defaults = rt5631_reg,
|
|
.num_reg_defaults = ARRAY_SIZE(rt5631_reg),
|
|
.cache_type = REGCACHE_RBTREE,
|
|
+ .use_single_read = true,
|
|
+ .use_single_write = true,
|
|
};
|
|
|
|
static int rt5631_i2c_probe(struct i2c_client *i2c,
|
|
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
|
|
index 985b2dcecf138..51d95437e0fdf 100644
|
|
--- a/sound/soc/codecs/wm_adsp.c
|
|
+++ b/sound/soc/codecs/wm_adsp.c
|
|
@@ -1221,7 +1221,7 @@ static int wm_coeff_tlv_get(struct snd_kcontrol *kctl,
|
|
|
|
mutex_lock(&ctl->dsp->pwr_lock);
|
|
|
|
- ret = wm_coeff_read_ctrl_raw(ctl, ctl->cache, size);
|
|
+ ret = wm_coeff_read_ctrl(ctl, ctl->cache, size);
|
|
|
|
if (!ret && copy_to_user(bytes, ctl->cache, size))
|
|
ret = -EFAULT;
|
|
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
|
|
index 8e11582fbae98..b598f8f0d06ec 100644
|
|
--- a/sound/usb/mixer.c
|
|
+++ b/sound/usb/mixer.c
|
|
@@ -3274,7 +3274,15 @@ static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer,
|
|
{
|
|
struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list);
|
|
static const char * const val_types[] = {
|
|
- "BOOLEAN", "INV_BOOLEAN", "S8", "U8", "S16", "U16", "S32", "U32",
|
|
+ [USB_MIXER_BOOLEAN] = "BOOLEAN",
|
|
+ [USB_MIXER_INV_BOOLEAN] = "INV_BOOLEAN",
|
|
+ [USB_MIXER_S8] = "S8",
|
|
+ [USB_MIXER_U8] = "U8",
|
|
+ [USB_MIXER_S16] = "S16",
|
|
+ [USB_MIXER_U16] = "U16",
|
|
+ [USB_MIXER_S32] = "S32",
|
|
+ [USB_MIXER_U32] = "U32",
|
|
+ [USB_MIXER_BESPOKEN] = "BESPOKEN",
|
|
};
|
|
snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, "
|
|
"channels=%i, type=\"%s\"\n", cval->head.id,
|
|
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
|
|
index bddef8ad57783..7af97448d09b3 100644
|
|
--- a/sound/usb/quirks.c
|
|
+++ b/sound/usb/quirks.c
|
|
@@ -1895,6 +1895,9 @@ static const struct registration_quirk registration_quirks[] = {
|
|
REG_QUIRK_ENTRY(0x0951, 0x16d8, 2), /* Kingston HyperX AMP */
|
|
REG_QUIRK_ENTRY(0x0951, 0x16ed, 2), /* Kingston HyperX Cloud Alpha S */
|
|
REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */
|
|
+ REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */
|
|
+ REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */
|
|
+ REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */
|
|
{ 0 } /* terminator */
|
|
};
|
|
|
|
diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
|
|
index 65303664417e4..6ebf2b215ef49 100644
|
|
--- a/tools/bpf/bpftool/common.c
|
|
+++ b/tools/bpf/bpftool/common.c
|
|
@@ -221,6 +221,11 @@ int mount_bpffs_for_pin(const char *name)
|
|
int err = 0;
|
|
|
|
file = malloc(strlen(name) + 1);
|
|
+ if (!file) {
|
|
+ p_err("mem alloc failed");
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
strcpy(file, name);
|
|
dir = dirname(file);
|
|
|
|
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
|
|
index 5320ac1b1285c..5378a14e38368 100644
|
|
--- a/tools/perf/builtin-inject.c
|
|
+++ b/tools/perf/builtin-inject.c
|
|
@@ -358,9 +358,10 @@ static struct dso *findnew_dso(int pid, int tid, const char *filename,
|
|
dso = machine__findnew_dso_id(machine, filename, id);
|
|
}
|
|
|
|
- if (dso)
|
|
+ if (dso) {
|
|
+ nsinfo__put(dso->nsinfo);
|
|
dso->nsinfo = nsi;
|
|
- else
|
|
+ } else
|
|
nsinfo__put(nsi);
|
|
|
|
thread__put(thread);
|
|
@@ -905,8 +906,10 @@ int cmd_inject(int argc, const char **argv)
|
|
|
|
data.path = inject.input_name;
|
|
inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool);
|
|
- if (IS_ERR(inject.session))
|
|
- return PTR_ERR(inject.session);
|
|
+ if (IS_ERR(inject.session)) {
|
|
+ ret = PTR_ERR(inject.session);
|
|
+ goto out_close_output;
|
|
+ }
|
|
|
|
if (zstd_init(&(inject.session->zstd_data), 0) < 0)
|
|
pr_warning("Decompression initialization failed.\n");
|
|
@@ -948,5 +951,7 @@ int cmd_inject(int argc, const char **argv)
|
|
out_delete:
|
|
zstd_fini(&(inject.session->zstd_data));
|
|
perf_session__delete(inject.session);
|
|
+out_close_output:
|
|
+ perf_data__close(&inject.output);
|
|
return ret;
|
|
}
|
|
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
|
|
index 3c74c9c0f3c38..5824aa24acfcc 100644
|
|
--- a/tools/perf/builtin-report.c
|
|
+++ b/tools/perf/builtin-report.c
|
|
@@ -1143,6 +1143,8 @@ int cmd_report(int argc, const char **argv)
|
|
.socket_filter = -1,
|
|
.annotation_opts = annotation__default_options,
|
|
};
|
|
+ char *sort_order_help = sort_help("sort by key(s):");
|
|
+ char *field_order_help = sort_help("output field(s): overhead period sample ");
|
|
const struct option options[] = {
|
|
OPT_STRING('i', "input", &input_name, "file",
|
|
"input file name"),
|
|
@@ -1177,9 +1179,9 @@ int cmd_report(int argc, const char **argv)
|
|
OPT_BOOLEAN(0, "header-only", &report.header_only,
|
|
"Show only data header."),
|
|
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
|
|
- sort_help("sort by key(s):")),
|
|
+ sort_order_help),
|
|
OPT_STRING('F', "fields", &field_order, "key[,keys...]",
|
|
- sort_help("output field(s): overhead period sample ")),
|
|
+ field_order_help),
|
|
OPT_BOOLEAN(0, "show-cpu-utilization", &symbol_conf.show_cpu_utilization,
|
|
"Show sample percentage for different cpu modes"),
|
|
OPT_BOOLEAN_FLAG(0, "showcpuutilization", &symbol_conf.show_cpu_utilization,
|
|
@@ -1308,11 +1310,11 @@ int cmd_report(int argc, const char **argv)
|
|
char sort_tmp[128];
|
|
|
|
if (ret < 0)
|
|
- return ret;
|
|
+ goto exit;
|
|
|
|
ret = perf_config(report__config, &report);
|
|
if (ret)
|
|
- return ret;
|
|
+ goto exit;
|
|
|
|
argc = parse_options(argc, argv, options, report_usage, 0);
|
|
if (argc) {
|
|
@@ -1326,8 +1328,10 @@ int cmd_report(int argc, const char **argv)
|
|
report.symbol_filter_str = argv[0];
|
|
}
|
|
|
|
- if (annotate_check_args(&report.annotation_opts) < 0)
|
|
- return -EINVAL;
|
|
+ if (annotate_check_args(&report.annotation_opts) < 0) {
|
|
+ ret = -EINVAL;
|
|
+ goto exit;
|
|
+ }
|
|
|
|
if (report.mmaps_mode)
|
|
report.tasks_mode = true;
|
|
@@ -1341,12 +1345,14 @@ int cmd_report(int argc, const char **argv)
|
|
if (symbol_conf.vmlinux_name &&
|
|
access(symbol_conf.vmlinux_name, R_OK)) {
|
|
pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name);
|
|
- return -EINVAL;
|
|
+ ret = -EINVAL;
|
|
+ goto exit;
|
|
}
|
|
if (symbol_conf.kallsyms_name &&
|
|
access(symbol_conf.kallsyms_name, R_OK)) {
|
|
pr_err("Invalid file: %s\n", symbol_conf.kallsyms_name);
|
|
- return -EINVAL;
|
|
+ ret = -EINVAL;
|
|
+ goto exit;
|
|
}
|
|
|
|
if (report.inverted_callchain)
|
|
@@ -1370,12 +1376,14 @@ int cmd_report(int argc, const char **argv)
|
|
|
|
repeat:
|
|
session = perf_session__new(&data, false, &report.tool);
|
|
- if (IS_ERR(session))
|
|
- return PTR_ERR(session);
|
|
+ if (IS_ERR(session)) {
|
|
+ ret = PTR_ERR(session);
|
|
+ goto exit;
|
|
+ }
|
|
|
|
ret = evswitch__init(&report.evswitch, session->evlist, stderr);
|
|
if (ret)
|
|
- return ret;
|
|
+ goto exit;
|
|
|
|
if (zstd_init(&(session->zstd_data), 0) < 0)
|
|
pr_warning("Decompression initialization failed. Reported data may be incomplete.\n");
|
|
@@ -1603,5 +1611,8 @@ error:
|
|
|
|
zstd_fini(&(session->zstd_data));
|
|
perf_session__delete(session);
|
|
+exit:
|
|
+ free(sort_order_help);
|
|
+ free(field_order_help);
|
|
return ret;
|
|
}
|
|
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
|
|
index 0e16f9d5a9471..d3b5f5faf8c14 100644
|
|
--- a/tools/perf/builtin-sched.c
|
|
+++ b/tools/perf/builtin-sched.c
|
|
@@ -3337,6 +3337,16 @@ static void setup_sorting(struct perf_sched *sched, const struct option *options
|
|
sort_dimension__add("pid", &sched->cmp_pid);
|
|
}
|
|
|
|
+static bool schedstat_events_exposed(void)
|
|
+{
|
|
+ /*
|
|
+ * Select "sched:sched_stat_wait" event to check
|
|
+ * whether schedstat tracepoints are exposed.
|
|
+ */
|
|
+ return IS_ERR(trace_event__tp_format("sched", "sched_stat_wait")) ?
|
|
+ false : true;
|
|
+}
|
|
+
|
|
static int __cmd_record(int argc, const char **argv)
|
|
{
|
|
unsigned int rec_argc, i, j;
|
|
@@ -3348,21 +3358,33 @@ static int __cmd_record(int argc, const char **argv)
|
|
"-m", "1024",
|
|
"-c", "1",
|
|
"-e", "sched:sched_switch",
|
|
- "-e", "sched:sched_stat_wait",
|
|
- "-e", "sched:sched_stat_sleep",
|
|
- "-e", "sched:sched_stat_iowait",
|
|
"-e", "sched:sched_stat_runtime",
|
|
"-e", "sched:sched_process_fork",
|
|
"-e", "sched:sched_wakeup_new",
|
|
"-e", "sched:sched_migrate_task",
|
|
};
|
|
+
|
|
+ /*
|
|
+ * The tracepoints trace_sched_stat_{wait, sleep, iowait}
|
|
+ * are not exposed to user if CONFIG_SCHEDSTATS is not set,
|
|
+ * to prevent "perf sched record" execution failure, determine
|
|
+ * whether to record schedstat events according to actual situation.
|
|
+ */
|
|
+ const char * const schedstat_args[] = {
|
|
+ "-e", "sched:sched_stat_wait",
|
|
+ "-e", "sched:sched_stat_sleep",
|
|
+ "-e", "sched:sched_stat_iowait",
|
|
+ };
|
|
+ unsigned int schedstat_argc = schedstat_events_exposed() ?
|
|
+ ARRAY_SIZE(schedstat_args) : 0;
|
|
+
|
|
struct tep_event *waking_event;
|
|
|
|
/*
|
|
* +2 for either "-e", "sched:sched_wakeup" or
|
|
* "-e", "sched:sched_waking"
|
|
*/
|
|
- rec_argc = ARRAY_SIZE(record_args) + 2 + argc - 1;
|
|
+ rec_argc = ARRAY_SIZE(record_args) + 2 + schedstat_argc + argc - 1;
|
|
rec_argv = calloc(rec_argc + 1, sizeof(char *));
|
|
|
|
if (rec_argv == NULL)
|
|
@@ -3378,6 +3400,9 @@ static int __cmd_record(int argc, const char **argv)
|
|
else
|
|
rec_argv[i++] = strdup("sched:sched_wakeup");
|
|
|
|
+ for (j = 0; j < schedstat_argc; j++)
|
|
+ rec_argv[i++] = strdup(schedstat_args[j]);
|
|
+
|
|
for (j = 1; j < (unsigned int)argc; j++, i++)
|
|
rec_argv[i] = argv[j];
|
|
|
|
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
|
|
index 48588ccf902eb..2bb159c105035 100644
|
|
--- a/tools/perf/builtin-script.c
|
|
+++ b/tools/perf/builtin-script.c
|
|
@@ -2483,6 +2483,12 @@ static void perf_script__exit_per_event_dump_stats(struct perf_script *script)
|
|
}
|
|
}
|
|
|
|
+static void perf_script__exit(struct perf_script *script)
|
|
+{
|
|
+ perf_thread_map__put(script->threads);
|
|
+ perf_cpu_map__put(script->cpus);
|
|
+}
|
|
+
|
|
static int __cmd_script(struct perf_script *script)
|
|
{
|
|
int ret;
|
|
@@ -3937,6 +3943,7 @@ out_delete:
|
|
|
|
perf_evlist__free_stats(session->evlist);
|
|
perf_session__delete(session);
|
|
+ perf_script__exit(&script);
|
|
|
|
if (script_started)
|
|
cleanup_scripting();
|
|
diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c
|
|
index bdcf032f85162..1c9a6138fba13 100644
|
|
--- a/tools/perf/tests/event_update.c
|
|
+++ b/tools/perf/tests/event_update.c
|
|
@@ -119,6 +119,6 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu
|
|
TEST_ASSERT_VAL("failed to synthesize attr update cpus",
|
|
!perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus));
|
|
|
|
- perf_cpu_map__put(evsel->core.own_cpus);
|
|
+ evlist__delete(evlist);
|
|
return 0;
|
|
}
|
|
diff --git a/tools/perf/tests/maps.c b/tools/perf/tests/maps.c
|
|
index edcbc70ff9d66..1ac72919fa358 100644
|
|
--- a/tools/perf/tests/maps.c
|
|
+++ b/tools/perf/tests/maps.c
|
|
@@ -116,5 +116,7 @@ int test__maps__merge_in(struct test *t __maybe_unused, int subtest __maybe_unus
|
|
|
|
ret = check_maps(merged3, ARRAY_SIZE(merged3), &maps);
|
|
TEST_ASSERT_VAL("merge check failed", !ret);
|
|
+
|
|
+ maps__exit(&maps);
|
|
return TEST_OK;
|
|
}
|
|
diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
|
|
index 22daf2bdf5faf..f4a2c0df09549 100644
|
|
--- a/tools/perf/tests/topology.c
|
|
+++ b/tools/perf/tests/topology.c
|
|
@@ -52,6 +52,7 @@ static int session_write_header(char *path)
|
|
TEST_ASSERT_VAL("failed to write header",
|
|
!perf_session__write_header(session, session->evlist, data.file.fd, true));
|
|
|
|
+ evlist__delete(session->evlist);
|
|
perf_session__delete(session);
|
|
|
|
return 0;
|
|
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
|
|
index 5d97b3e45fbb1..bcb494dc816a0 100644
|
|
--- a/tools/perf/util/data.c
|
|
+++ b/tools/perf/util/data.c
|
|
@@ -20,7 +20,7 @@
|
|
|
|
static void close_dir(struct perf_data_file *files, int nr)
|
|
{
|
|
- while (--nr >= 1) {
|
|
+ while (--nr >= 0) {
|
|
close(files[nr].fd);
|
|
zfree(&files[nr].path);
|
|
}
|
|
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
|
|
index 55c11e854fe46..b1ff0c9f32daf 100644
|
|
--- a/tools/perf/util/dso.c
|
|
+++ b/tools/perf/util/dso.c
|
|
@@ -1141,8 +1141,10 @@ struct map *dso__new_map(const char *name)
|
|
struct map *map = NULL;
|
|
struct dso *dso = dso__new(name);
|
|
|
|
- if (dso)
|
|
+ if (dso) {
|
|
map = map__new2(0, dso);
|
|
+ dso__put(dso);
|
|
+ }
|
|
|
|
return map;
|
|
}
|
|
diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
|
|
index fadc59708ece0..03bc843b1cf87 100644
|
|
--- a/tools/perf/util/env.c
|
|
+++ b/tools/perf/util/env.c
|
|
@@ -178,10 +178,12 @@ void perf_env__exit(struct perf_env *env)
|
|
zfree(&env->cpuid);
|
|
zfree(&env->cmdline);
|
|
zfree(&env->cmdline_argv);
|
|
+ zfree(&env->sibling_dies);
|
|
zfree(&env->sibling_cores);
|
|
zfree(&env->sibling_threads);
|
|
zfree(&env->pmu_mappings);
|
|
zfree(&env->cpu);
|
|
+ zfree(&env->cpu_pmu_caps);
|
|
zfree(&env->numa_map);
|
|
|
|
for (i = 0; i < env->nr_numa_nodes; i++)
|
|
diff --git a/tools/perf/util/lzma.c b/tools/perf/util/lzma.c
|
|
index 39062df026291..51424cdc3b682 100644
|
|
--- a/tools/perf/util/lzma.c
|
|
+++ b/tools/perf/util/lzma.c
|
|
@@ -69,7 +69,7 @@ int lzma_decompress_to_file(const char *input, int output_fd)
|
|
|
|
if (ferror(infile)) {
|
|
pr_err("lzma: read error: %s\n", strerror(errno));
|
|
- goto err_fclose;
|
|
+ goto err_lzma_end;
|
|
}
|
|
|
|
if (feof(infile))
|
|
@@ -83,7 +83,7 @@ int lzma_decompress_to_file(const char *input, int output_fd)
|
|
|
|
if (writen(output_fd, buf_out, write_size) != write_size) {
|
|
pr_err("lzma: write error: %s\n", strerror(errno));
|
|
- goto err_fclose;
|
|
+ goto err_lzma_end;
|
|
}
|
|
|
|
strm.next_out = buf_out;
|
|
@@ -95,11 +95,13 @@ int lzma_decompress_to_file(const char *input, int output_fd)
|
|
break;
|
|
|
|
pr_err("lzma: failed %s\n", lzma_strerror(ret));
|
|
- goto err_fclose;
|
|
+ goto err_lzma_end;
|
|
}
|
|
}
|
|
|
|
err = 0;
|
|
+err_lzma_end:
|
|
+ lzma_end(&strm);
|
|
err_fclose:
|
|
fclose(infile);
|
|
return err;
|
|
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
|
|
index f4d44f75ba152..6688f6b253a72 100644
|
|
--- a/tools/perf/util/map.c
|
|
+++ b/tools/perf/util/map.c
|
|
@@ -192,6 +192,8 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
|
|
if (!(prot & PROT_EXEC))
|
|
dso__set_loaded(dso);
|
|
}
|
|
+
|
|
+ nsinfo__put(dso->nsinfo);
|
|
dso->nsinfo = nsi;
|
|
dso__put(dso);
|
|
}
|
|
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
|
|
index 8eae2afff71a9..07db6cfad65b9 100644
|
|
--- a/tools/perf/util/probe-event.c
|
|
+++ b/tools/perf/util/probe-event.c
|
|
@@ -180,8 +180,10 @@ struct map *get_target_map(const char *target, struct nsinfo *nsi, bool user)
|
|
struct map *map;
|
|
|
|
map = dso__new_map(target);
|
|
- if (map && map->dso)
|
|
+ if (map && map->dso) {
|
|
+ nsinfo__put(map->dso->nsinfo);
|
|
map->dso->nsinfo = nsinfo__get(nsi);
|
|
+ }
|
|
return map;
|
|
} else {
|
|
return kernel_get_module_map(target);
|
|
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
|
|
index bbecb449ea944..d2b98d64438e5 100644
|
|
--- a/tools/perf/util/probe-file.c
|
|
+++ b/tools/perf/util/probe-file.c
|
|
@@ -342,11 +342,11 @@ int probe_file__del_events(int fd, struct strfilter *filter)
|
|
|
|
ret = probe_file__get_events(fd, filter, namelist);
|
|
if (ret < 0)
|
|
- return ret;
|
|
+ goto out;
|
|
|
|
ret = probe_file__del_strlist(fd, namelist);
|
|
+out:
|
|
strlist__delete(namelist);
|
|
-
|
|
return ret;
|
|
}
|
|
|
|
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
|
|
index 8a3b7d5a47376..5e9e96452b9e6 100644
|
|
--- a/tools/perf/util/sort.c
|
|
+++ b/tools/perf/util/sort.c
|
|
@@ -3177,7 +3177,7 @@ static void add_hpp_sort_string(struct strbuf *sb, struct hpp_dimension *s, int
|
|
add_key(sb, s[i].name, llen);
|
|
}
|
|
|
|
-const char *sort_help(const char *prefix)
|
|
+char *sort_help(const char *prefix)
|
|
{
|
|
struct strbuf sb;
|
|
char *s;
|
|
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
|
|
index 66d39c4cfe2b3..fc94dcd67abc3 100644
|
|
--- a/tools/perf/util/sort.h
|
|
+++ b/tools/perf/util/sort.h
|
|
@@ -293,7 +293,7 @@ void reset_output_field(void);
|
|
void sort__setup_elide(FILE *fp);
|
|
void perf_hpp__set_elide(int idx, bool elide);
|
|
|
|
-const char *sort_help(const char *prefix);
|
|
+char *sort_help(const char *prefix);
|
|
|
|
int report_parse_ignore_callees_opt(const struct option *opt, const char *arg, int unset);
|
|
|
|
diff --git a/tools/testing/selftests/net/icmp_redirect.sh b/tools/testing/selftests/net/icmp_redirect.sh
|
|
index bf361f30d6ef9..104a7a5f13b1e 100755
|
|
--- a/tools/testing/selftests/net/icmp_redirect.sh
|
|
+++ b/tools/testing/selftests/net/icmp_redirect.sh
|
|
@@ -309,9 +309,10 @@ check_exception()
|
|
fi
|
|
log_test $? 0 "IPv4: ${desc}"
|
|
|
|
- if [ "$with_redirect" = "yes" ]; then
|
|
+ # No PMTU info for test "redirect" and "mtu exception plus redirect"
|
|
+ if [ "$with_redirect" = "yes" ] && [ "$desc" != "redirect exception plus mtu" ]; then
|
|
ip -netns h1 -6 ro get ${H1_VRF_ARG} ${H2_N2_IP6} | \
|
|
- grep -q "${H2_N2_IP6} from :: via ${R2_LLADDR} dev br0.*${mtu}"
|
|
+ grep -v "mtu" | grep -q "${H2_N2_IP6} .*via ${R2_LLADDR} dev br0"
|
|
elif [ -n "${mtu}" ]; then
|
|
ip -netns h1 -6 ro get ${H1_VRF_ARG} ${H2_N2_IP6} | \
|
|
grep -q "${mtu}"
|
|
diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
|
|
index c4425597769a0..b1be8df806119 100644
|
|
--- a/tools/testing/selftests/vm/userfaultfd.c
|
|
+++ b/tools/testing/selftests/vm/userfaultfd.c
|
|
@@ -180,8 +180,10 @@ static int anon_release_pages(char *rel_area)
|
|
|
|
static void anon_allocate_area(void **alloc_area)
|
|
{
|
|
- if (posix_memalign(alloc_area, page_size, nr_pages * page_size)) {
|
|
- fprintf(stderr, "out of memory\n");
|
|
+ *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE,
|
|
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
|
+ if (*alloc_area == MAP_FAILED)
|
|
+ fprintf(stderr, "mmap of anonymous memory failed");
|
|
*alloc_area = NULL;
|
|
}
|
|
}
|