Skip to contentSkip to conversation

5.10.192-rc1 review

PATCH In review Greg Kroah-Hartman 13 participants 162 messages Aug 24, 2023 – Oct 25, 2023 Page 2 of 2

Subsystems (3)
lore
Share & tools
lore
author maintainer
#136 lore raw

PATCH 128/135 x86/srso: Explain the untraining sequences a bit more

In reply to Greg Kroah-Hartman

5.10-stable review patch. If anyone has any objections, please let me know.

------------------

From: Borislav Petkov (AMD) <[email protected]>

commit 9dbd23e42ff0b10c9b02c9e649c76e5228241a8e upstream.

The goal is to eventually have a proper documentation about all this.

---
 arch/x86/lib/retpoline.S |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
arch/x86/lib/retpoline.S +19 -0
@@ -128,6 +128,25 @@ SYM_CODE_START(srso_alias_return_thunk)
 SYM_CODE_END(srso_alias_return_thunk)
 
 /*
+ * Some generic notes on the untraining sequences:
+ *
+ * They are interchangeable when it comes to flushing potentially wrong
+ * RET predictions from the BTB.
+ *
+ * The SRSO Zen1/2 (MOVABS) untraining sequence is longer than the
+ * Retbleed sequence because the return sequence done there
+ * (srso_safe_ret()) is longer and the return sequence must fully nest
+ * (end before) the untraining sequence. Therefore, the untraining
+ * sequence must fully overlap the return sequence.
+ *
+ * Regarding alignment - the instructions which need to be untrained,
+ * must all start at a cacheline boundary for Zen1/2 generations. That
+ * is, instruction sequences starting at srso_safe_ret() and
+ * the respective instruction sequences at retbleed_return_thunk()
+ * must start at a cacheline boundary.
+ */
+
+/*
  * Safety details here pertain to the AMD Zen{1,2} microarchitecture:
  * 1) The RET at retbleed_return_thunk must be on a 64 byte boundary, for
  *    alignment within the BTB.
author maintainer
#137 lore raw

PATCH 129/135 x86/static_call: Fix __static_call_fixup()

In reply to Greg Kroah-Hartman

5.10-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <[email protected]>

commit 54097309620ef0dc2d7083783dc521c6a5fef957 upstream.

Christian reported spurious module load crashes after some of Song's module memory layout patches.

Turns out that if the very last instruction on the very last page of the module is a 'JMP __x86_return_thunk' then __static_call_fixup() will trip a fault and die.

And while the module rework made this slightly more likely to happen, it's always been possible.

---
 arch/x86/kernel/static_call.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/x86/kernel/static_call.c +13 -0
@@ -123,6 +123,19 @@ EXPORT_SYMBOL_GPL(arch_static_call_trans
  */
 bool __static_call_fixup(void *tramp, u8 op, void *dest)
 {
+	unsigned long addr = (unsigned long)tramp;
+	/*
+	 * Not all .return_sites are a static_call trampoline (most are not).
+	 * Check if the 3 bytes after the return are still kernel text, if not,
+	 * then this definitely is not a trampoline and we need not worry
+	 * further.
+	 *
+	 * This avoids the memcmp() below tripping over pagefaults etc..
+	 */
+	if (((addr >> PAGE_SHIFT) != ((addr + 7) >> PAGE_SHIFT)) &&
+	    !kernel_text_address(addr + 7))
+		return false;
+
 	if (memcmp(tramp+5, tramp_ud, 3)) {
 		/* Not a trampoline site, not our problem. */
 		return false;
author maintainer
#138 lore raw

PATCH 130/135 x86/retpoline: Dont clobber RFLAGS during srso_safe_ret()

In reply to Greg Kroah-Hartman

5.10-stable review patch. If anyone has any objections, please let me know.

------------------

From: Sean Christopherson <[email protected]>

commit ba5ca5e5e6a1d55923e88b4a83da452166f5560e upstream.

Use LEA instead of ADD when adjusting %rsp in srso_safe_ret{,_alias}() so as to avoid clobbering flags. Drop one of the INT3 instructions to account for the LEA consuming one more byte than the ADD.

KVM's emulator makes indirect calls into a jump table of sorts, where the destination of each call is a small blob of code that performs fast emulation by executing the target instruction with fixed operands.

E.g. to emulate ADC, fastop() invokes adcb_al_dl():

adcb_al_dl:

    <+0>:  adc    %dl,%al
    <+2>:  jmp    <__x86_return_thunk>

A major motivation for doing fast emulation is to leverage the CPU to handle consumption and manipulation of arithmetic flags, i.e. RFLAGS is both an input and output to the target of the call. fastop() collects the RFLAGS result by pushing RFLAGS onto the stack and popping them back into a variable (held in %rdi in this case):

asm("push %[flags]; popf; " CALL_NOSPEC " ; pushf; pop %[flags]\n"

  <+71>: mov    0xc0(%r8),%rdx
  <+78>: mov    0x100(%r8),%rcx
  <+85>: push   %rdi

<+86>: popf
<+87>: call *%rsi
<+89>: nop
<+90>: nop
<+91>: nop
<+92>: pushf
<+93>: pop %rdi

and then propagating the arithmetic flags into the vCPU's emulator state:

  ctxt->eflags = (ctxt->eflags & ~EFLAGS_MASK) | (flags & EFLAGS_MASK);
  <+64>:  and    $0xfffffffffffff72a,%r9
  <+94>:  and    $0x8d5,%edi
  <+109>: or     %rdi,%r9
  <+122>: mov    %r9,0x10(%r8)

The failures can be most easily reproduced by running the "emulator" test in KVM-Unit-Tests.

If you're feeling a bit of deja vu, see commit b63f20a778c8 ("x86/retpoline: Don't clobber RFLAGS during CALL_NOSPEC on i386").

In addition, this breaks booting of clang-compiled guest on a gcc-compiled host where the host contains the %rsp-modifying SRSO mitigations.

[ bp: Massage commit message, extend, remove addresses. ]

---
 arch/x86/lib/retpoline.S |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
arch/x86/lib/retpoline.S +3 -4
@@ -111,7 +111,7 @@ SYM_FUNC_END(srso_alias_untrain_ret)
 #endif
 
 SYM_START(srso_alias_safe_ret, SYM_L_GLOBAL, SYM_A_NONE)
-	add $8, %_ASM_SP
+	lea 8(%_ASM_SP), %_ASM_SP
 	UNWIND_HINT_FUNC
 	ANNOTATE_UNRET_SAFE
 	ret
@@ -211,7 +211,7 @@ __EXPORT_THUNK(retbleed_untrain_ret)
  * SRSO untraining sequence for Zen1/2, similar to retbleed_untrain_ret()
  * above. On kernel entry, srso_untrain_ret() is executed which is a
  *
- * movabs $0xccccccc308c48348,%rax
+ * movabs $0xccccc30824648d48,%rax
  *
  * and when the return thunk executes the inner label srso_safe_ret()
  * later, it is a stack manipulation and a RET which is mispredicted and
@@ -229,11 +229,10 @@ SYM_START(srso_untrain_ret, SYM_L_GLOBAL
  * the stack.
  */
 SYM_INNER_LABEL(srso_safe_ret, SYM_L_GLOBAL)
-	add $8, %_ASM_SP
+	lea 8(%_ASM_SP), %_ASM_SP
 	ret
 	int3
 	int3
-	int3
 	/* end of movabs */
 	lfence
 	call srso_safe_ret
author maintainer
#139 lore raw

PATCH 131/135 x86/CPU/AMD: Fix the DIV(0) initial fix attempt

In reply to Greg Kroah-Hartman

5.10-stable review patch. If anyone has any objections, please let me know.

------------------

From: Borislav Petkov (AMD) <[email protected]>

commit f58d6fbcb7c848b7f2469be339bc571f2e9d245b upstream.

Initially, it was thought that doing an innocuous division in the #DE handler would take care to prevent any leaking of old data from the divider but by the time the fault is raised, the speculation has already advanced too far and such data could already have been used by younger operations.

Therefore, do the innocuous division on every exit to userspace so that userspace doesn't see any potentially old data from integer divisions in kernel space.

Do the same before VMRUN too, to protect host data from leaking into the guest too.

Fixes 77245f1c3c64 ("x86/CPU/AMD: Do not leak quotient data after a division by 0")
---
 arch/x86/include/asm/entry-common.h |    1 +
 arch/x86/kernel/cpu/amd.c           |    1 +
 arch/x86/kernel/traps.c             |    2 --
 arch/x86/kvm/svm/svm.c              |    1 +
 4 files changed, 3 insertions(+), 2 deletions(-)
arch/x86/include/asm/entry-common.h +1 -0
@@ -78,6 +78,7 @@ static inline void arch_exit_to_user_mod
 static __always_inline void arch_exit_to_user_mode(void)
 {
 	mds_user_clear_cpu_buffers();
+	amd_clear_divider();
 }
 #define arch_exit_to_user_mode arch_exit_to_user_mode
 
arch/x86/kernel/cpu/amd.c +1 -0
@@ -1332,3 +1332,4 @@ void noinstr amd_clear_divider(void)
 	asm volatile(ALTERNATIVE("", "div %2\n\t", X86_BUG_DIV0)
 		     :: "a" (0), "d" (0), "r" (1));
 }
+EXPORT_SYMBOL_GPL(amd_clear_divider);
arch/x86/kernel/traps.c +0 -2
@@ -198,8 +198,6 @@ DEFINE_IDTENTRY(exc_divide_error)
 {
 	do_error_trap(regs, 0, "divide error", X86_TRAP_DE, SIGFPE,
 		      FPE_INTDIV, error_get_trap_addr(regs));
-
-	amd_clear_divider();
 }
 
 DEFINE_IDTENTRY(exc_overflow)
arch/x86/kvm/svm/svm.c +1 -0
@@ -3376,6 +3376,7 @@ static void svm_flush_tlb_gva(struct kvm
 
 static void svm_prepare_guest_switch(struct kvm_vcpu *vcpu)
 {
+	amd_clear_divider();
 }
 
 static inline void sync_cr8_to_lapic(struct kvm_vcpu *vcpu)
author maintainer
#130 lore raw

PATCH 122/135 objtool: Add frame-pointer-specific function ignore

In reply to Greg Kroah-Hartman

5.10-stable review patch. If anyone has any objections, please let me know.

------------------

From: Josh Poimboeuf <[email protected]>

[ Upstream commit e028c4f7ac7ca8c96126fe46c54ab3d56ffe6a66 ]

Add a CONFIG_FRAME_POINTER-specific version of STACK_FRAME_NON_STANDARD() for the case where a function is intentionally missing frame pointer setup, but otherwise needs objtool/ORC coverage when frame pointers are disabled.

Stable-dep-of: c8c301abeae5 ("x86/ibt: Add ANNOTATE_NOENDBR")

---
 include/linux/objtool.h       |   12 ++++++++++++
 tools/include/linux/objtool.h |   12 ++++++++++++
 2 files changed, 24 insertions(+)
include/linux/objtool.h +12 -0
@@ -71,6 +71,17 @@ struct unwind_hint {
 	static void __used __section(".discard.func_stack_frame_non_standard") \
 		*__func_stack_frame_non_standard_##func = func
 
+/*
+ * STACK_FRAME_NON_STANDARD_FP() is a frame-pointer-specific function ignore
+ * for the case where a function is intentionally missing frame pointer setup,
+ * but otherwise needs objtool/ORC coverage when frame pointers are disabled.
+ */
+#ifdef CONFIG_FRAME_POINTER
+#define STACK_FRAME_NON_STANDARD_FP(func) STACK_FRAME_NON_STANDARD(func)
+#else
+#define STACK_FRAME_NON_STANDARD_FP(func)
+#endif
+
 #else /* __ASSEMBLY__ */
 
 /*
@@ -126,6 +137,7 @@ struct unwind_hint {
 #define UNWIND_HINT(sp_reg, sp_offset, type, end)	\
 	"\n\t"
 #define STACK_FRAME_NON_STANDARD(func)
+#define STACK_FRAME_NON_STANDARD_FP(func)
 #else
 #define ANNOTATE_INTRA_FUNCTION_CALL
 .macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 end=0
tools/include/linux/objtool.h +12 -0
@@ -71,6 +71,17 @@ struct unwind_hint {
 	static void __used __section(".discard.func_stack_frame_non_standard") \
 		*__func_stack_frame_non_standard_##func = func
 
+/*
+ * STACK_FRAME_NON_STANDARD_FP() is a frame-pointer-specific function ignore
+ * for the case where a function is intentionally missing frame pointer setup,
+ * but otherwise needs objtool/ORC coverage when frame pointers are disabled.
+ */
+#ifdef CONFIG_FRAME_POINTER
+#define STACK_FRAME_NON_STANDARD_FP(func) STACK_FRAME_NON_STANDARD(func)
+#else
+#define STACK_FRAME_NON_STANDARD_FP(func)
+#endif
+
 #else /* __ASSEMBLY__ */
 
 /*
@@ -126,6 +137,7 @@ struct unwind_hint {
 #define UNWIND_HINT(sp_reg, sp_offset, type, end)	\
 	"\n\t"
 #define STACK_FRAME_NON_STANDARD(func)
+#define STACK_FRAME_NON_STANDARD_FP(func)
 #else
 #define ANNOTATE_INTRA_FUNCTION_CALL
 .macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 end=0
Tested-by on the v1 series
#147 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.192-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

thanks,

greg k-h

On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:

Signature · 1 line
Florian
Tested-by on the v1 series
#148 lore raw
In reply to Greg Kroah-Hartman
Quoted 5 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Quoted 8 lines

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.192-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

For RCU,

thanks,

- Joel

Quoted 554 lines

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <[email protected]>

    Linux 5.10.192-rc1

Borislav Petkov (AMD) <[email protected]>
x86/srso: Correct the mitigation status when SMT is disabled

Peter Zijlstra <[email protected]>
objtool/x86: Fixup frame-pointer vs rethunk

Petr Pavlu <[email protected]>
x86/retpoline,kprobes: Fix position of thunk sections with CONFIG_LTO_CLANG

Borislav Petkov (AMD) <[email protected]>
x86/srso: Disable the mitigation on unaffected configurations

Borislav Petkov (AMD) <[email protected]>
x86/CPU/AMD: Fix the DIV(0) initial fix attempt

Sean Christopherson <[email protected]>
x86/retpoline: Don't clobber RFLAGS during srso_safe_ret()

Peter Zijlstra <[email protected]>

    x86/static_call: Fix __static_call_fixup()

Borislav Petkov (AMD) <[email protected]>
x86/srso: Explain the untraining sequences a bit more

Peter Zijlstra <[email protected]>
x86/cpu: Cleanup the untrain mess

Peter Zijlstra <[email protected]>

    x86/cpu: Rename srso_(.*)_alias to srso_alias_\1

Peter Zijlstra <[email protected]>
x86/cpu: Rename original retbleed methods

Peter Zijlstra <[email protected]>
x86/cpu: Clean up SRSO return thunk mess

Peter Zijlstra <[email protected]>
x86/ibt: Add ANNOTATE_NOENDBR

Josh Poimboeuf <[email protected]>
objtool: Add frame-pointer-specific function ignore

Peter Zijlstra <[email protected]>
x86/alternative: Make custom return thunk unconditional

Peter Zijlstra <[email protected]>

    x86/cpu: Fix up srso_safe_ret() and __x86_return_thunk()

Peter Zijlstra <[email protected]>
x86/cpu: Fix __x86_return_thunk symbol type

Yangtao Li <[email protected]>
mmc: f-sdh30: fix order of function calls in sdhci_f_sdh30_remove

Jason Xing <[email protected]>
net: fix the RTO timer retransmitting skb every 1ms if linear option is enabled

Jason Wang <[email protected]>
virtio-net: set queues after driver_ok

Kuniyuki Iwashima <[email protected]>
af_unix: Fix null-ptr-deref in unix_stream_sendpage().

Xin Long <[email protected]>
netfilter: set default timeout to 3 secs for sctp shutdown send and recv state

Yibin Ding <[email protected]>
mmc: block: Fix in_flight[issue_type] value error

Yang Yingliang <[email protected]>
mmc: wbsd: fix double mmc_free_host() in wbsd_init()

Russell Harmon via samba-technical <[email protected]>
cifs: Release folio lock on fscache read hit.

dengxiang <[email protected]>
ALSA: usb-audio: Add support for Mythware XA001AU capture and playback interfaces.

Tony Lindgren <[email protected]>

    serial: 8250: Fix oops for port->pm on uart_change_pm()

Alexandre Ghiti <[email protected]>
riscv: uaccess: Return the number of bytes effectively not copied

Chen Lifu <[email protected]>
riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit

Jisheng Zhang <[email protected]>
riscv: lib: uaccess: fold fixups into body

Akira Tsukamoto <[email protected]>
riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall

Kailang Yang <[email protected]>
ALSA: hda/realtek - Remodified 3k pull low procedure

Jerome Brunet <[email protected]>
ASoC: meson: axg-tdm-formatter: fix channel slot allocation

Zhang Shurong <[email protected]>
ASoC: rt5665: add missed regulator_bulk_disable

Christopher Obbard <[email protected]>
arm64: dts: rockchip: Disable HS400 for eMMC on ROCK Pi 4

FUKAUMI Naoki <[email protected]>
arm64: dts: rockchip: sort nodes/properties on rk3399-rock-4

FUKAUMI Naoki <[email protected]>
arm64: dts: rockchip: fix regulator name on rk3399-rock-4

Alex Bee <[email protected]>
arm64: dts: rockchip: add SPDIF node for ROCK Pi 4

Alex Bee <[email protected]>
arm64: dts: rockchip: add ES8316 codec for ROCK Pi 4

Vicente Bergas <[email protected]>
arm64: dts: rockchip: use USB host by default on rk3399-rock-pi-4

Vicente Bergas <[email protected]>
arm64: dts: rockchip: fix supplies on rk3399-rock-pi-4

Tony Lindgren <[email protected]>
bus: ti-sysc: Flush posted write on enable before reset

Eric Dumazet <[email protected]>
net: do not allow gso_size to be set to GSO_BY_FRAGS

Abel Wu <[email protected]>
sock: Fix misuse of sk_under_memory_pressure()

Alfred Lee <[email protected]>
net: dsa: mv88e6xxx: Wait for EEPROM done before HW reset

Andrii Staikov <[email protected]>
i40e: fix misleading debug logs

Ziyang Xuan <[email protected]>
team: Fix incorrect deletion of ETH_P_8021AD protocol vid from slaves

Justin Chen <[email protected]>
net: phy: broadcom: stub c45 read/write for 54810

Pablo Neira Ayuso <[email protected]>
netfilter: nft_dynset: disallow object maps

Sishuai Gong <[email protected]>
ipvs: fix racy memcpy in proc_do_sync_threshold

Luca Ceresoli <[email protected]>
drm/panel: simple: Fix AUO G121EAN01 panel timings according to the docs

Petr Machata <[email protected]>
selftests: mirror_gre_changes: Tighten up the TTL test match

Lin Ma <[email protected]>
xfrm: add forgotten nla_policy for XFRMA_MTIMER_THRESH

Lin Ma <[email protected]>
xfrm: add NULL check in xfrm_update_ae_params

Zhengchao Shao <[email protected]>
ip_vti: fix potential slab-use-after-free in decode_session6

Zhengchao Shao <[email protected]>
ip6_vti: fix slab-use-after-free in decode_session6

Zhengchao Shao <[email protected]>
xfrm: fix slab-use-after-free in decode_session6

Lin Ma <[email protected]>
net: xfrm: Amend XFRMA_SEC_CTX nla_policy structure

Lin Ma <[email protected]>
net: af_key: fix sadb_x_filter validation

Lin Ma <[email protected]>
net: xfrm: Fix xfrm_address_filter OOB read

Tam Nguyen <[email protected]>
i2c: designware: Handle invalid SMBus block data response length value

xiaoshoukui <[email protected]>
btrfs: fix BUG_ON condition in btrfs_cancel_balance

Sherry Sun <[email protected]>
tty: serial: fsl_lpuart: Clear the error flags by writing 1 for lpuart32 platforms

Yi Yang <[email protected]>
tty: n_gsm: fix the UAF caused by race condition in gsm_cleanup_mux

Nathan Lynch <[email protected]>
powerpc/rtas_flash: allow user copy to flash block cache objects

Yuanjun Gong <[email protected]>
fbdev: mmp: fix value check in mmphw_probe()

Chengfeng Ye <[email protected]>
i2c: bcm-iproc: Fix bcm_iproc_i2c_isr deadlock issue

Wolfram Sang <[email protected]>
virtio-mmio: don't break lifecycle of vm_dev

Tang Bin <[email protected]>
virtio-mmio: Use to_virtio_mmio_device() to simply code

Ivan Mikhaylov <[email protected]>
net/ncsi: change from ndo_set_mac_address to dev_set_mac_address

Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Fix to update dynamic data counter if fetcharg uses it

Steven Rostedt (VMware) <[email protected]>
tracing/probes: Have process_fetch_insn() take a void * instead of pt_regs

Sergey Shtylyov <[email protected]>
mmc: meson-gx: fix deferred probing

Heiner Kallweit <[email protected]>
mmc: meson-gx: use devm_mmc_alloc_host

Heiner Kallweit <[email protected]>
mmc: core: add devm_mmc_alloc_host

Sergey Shtylyov <[email protected]>
mmc: sunxi: fix deferred probing

Sergey Shtylyov <[email protected]>
mmc: bcm2835: fix deferred probing

Johan Hovold <[email protected]>
USB: dwc3: qcom: fix NULL-deref on suspend

Frank Li <[email protected]>

    usb: cdns3: fix NCM gadget RX speed 20x slow than expection at iMX8QM

Frank Li <[email protected]>
usb: cdns3: allocate TX FIFO size according to composite EP number

Wesley Cheng <[email protected]>
usb: gadget: udc: core: Introduce check_config to verify USB configuration

Pawel Laszczak <[email protected]>
usb: cdnsp: Device side header file for CDNSP driver

Jiaxun Yang <[email protected]>
irqchip/mips-gic: Use raw spinlock for gic_lock

Marc Zyngier <[email protected]>
irqchip/mips-gic: Get rid of the reliance on irq_cpu_online()

Jeffrey Hugo <[email protected]>
bus: mhi: host: Range check CHDBOFF and ERDBOFF

Manivannan Sadhasivam <[email protected]>
bus: mhi: Move host MHI code to "host" directory

Bhaumik Bhatt <[email protected]>
bus: mhi: Add MMIO region length to controller structure

Loic Poulain <[email protected]>
bus: mhi: Add MHI PCI support for WWAN modems

William Breathitt Gray <[email protected]>
iio: addac: stx104: Fix race condition when converting analog-to-digital

William Breathitt Gray <[email protected]>
iio: addac: stx104: Fix race condition for stx104_write_raw()

William Breathitt Gray <[email protected]>
iio: adc: stx104: Implement and utilize register structures

William Breathitt Gray <[email protected]>
iio: adc: stx104: Utilize iomap interface

Cosmin Tanislav <[email protected]>

    dt-bindings: iio: add AD74413R

Cosmin Tanislav <[email protected]>
iio: add addac subdirectory

Randy Dunlap <[email protected]>
IMA: allow/fix UML builds

Chen Lin <[email protected]>
ring-buffer: Do not swap cpu_buffer during resize process

Benjamin Gray <[email protected]>
powerpc/kasan: Disable KCOV in KASAN code

Tuo Li <[email protected]>
ALSA: hda: fix a possible null-pointer dereference due to data race in snd_hdac_regmap_sync()

dengxiang <[email protected]>
ALSA: hda/realtek: Add quirks for Unis H3C Desktop B760 & Q760

shanzhulig <[email protected]>
drm/amdgpu: Fix potential fence use-after-free v2

Matthew Anderson <[email protected]>
Bluetooth: btusb: Add MT7922 bluetooth ID for the Asus Ally

Zhengping Jiang <[email protected]>
Bluetooth: L2CAP: Fix use-after-free

Armin Wolf <[email protected]>
pcmcia: rsrc_nonstatic: Fix memory leak in nonstatic_release_resource_db()

Tuo Li <[email protected]>
gfs2: Fix possible data races in gfs2_show_options()

Xu Yang <[email protected]>
usb: chipidea: imx: add missing USB PHY DPDM wakeup setting

Xu Yang <[email protected]>
usb: chipidea: imx: don't request QoS for imx8ulp

Hans Verkuil <[email protected]>
media: platform: mediatek: vpu: fix NULL ptr dereference

Prashanth K <[email protected]>
usb: gadget: u_serial: Avoid spinlock recursion in __gs_console_push

Yunfei Dong <[email protected]>
media: v4l2-mem2mem: add lock to protect parameter num_rdy

Immad Mir <[email protected]>
FS: JFS: Check for read-only mounted filesystem in txBegin

Immad Mir <[email protected]>
FS: JFS: Fix null-ptr-deref Read in txBegin

Gustavo A. R. Silva <[email protected]>
MIPS: dec: prom: Address -Warray-bounds warning

Yogesh <[email protected]>
fs: jfs: Fix UBSAN: array-index-out-of-bounds in dbAllocDmapLev

Jan Kara <[email protected]>
udf: Fix uninitialized array access for some pathnames

Christian Brauner <[email protected]>
ovl: check type and offset of struct vfsmount in ovl_entry

Patrisious Haddad <[email protected]>
RDMA/mlx5: Return the firmware result upon destroying QP/RQ

Marco Morandini <[email protected]>
HID: add quirk for 03f0:464a HP Elite Presenter Mouse

Lang Yu <[email protected]>
drm/amdgpu: install stub fence into potential unused fence pointers

gaoxu <[email protected]>
dma-remap: use kvmalloc_array/kvfree for larger dma memory remap

Ye Bin <[email protected]>
quota: fix warning in dqgrab()

Jan Kara <[email protected]>
quota: Properly disable quotas when add_dquot_ref() fails

Geert Uytterhoeven <[email protected]>
iopoll: Call cpu_relax() in busy loops

Uday M Bhat <[email protected]>
ASoC: Intel: sof_sdw: Add support for Rex soundwire

Oleksij Rempel <[email protected]>
ARM: dts: imx6dl: prtrvt, prtvt7, prti6q, prtwd2: fix USB related warnings

Sumit Gupta <[email protected]>
PCI: tegra194: Fix possible array out of bounds access

Peter Ujfalusi <[email protected]>
ASoC: Intel: sof_sdw: add quirk for LNL RVP

Bard Liao <[email protected]>
ASoC: Intel: sof_sdw: add quirk for MTL RVP

Oswald Buddenhagen <[email protected]>
ALSA: emu10k1: roll up loops in DSP setup code for Audigy

hackyzh002 <[email protected]>
drm/radeon: Fix integer overflow in radeon_cs_parser_init

Moshe Shemesh <[email protected]>
net/mlx5: Skip clock update work when device is in error state

Eran Ben Elisha <[email protected]>
net/mlx5: Move all internal timer metadata into a dedicated struct

Eran Ben Elisha <[email protected]>
net/mlx5: Refactor init clock function

Eric Dumazet <[email protected]>
macsec: use DEV_STATS_INC()

Clayton Yager <[email protected]>
macsec: Fix traffic counters/statistics

Kunihiko Hayashi <[email protected]>
mmc: sdhci-f-sdh30: Replace with sdhci_pltfm

-------------

Diffstat:

 Documentation/admin-guide/hw-vuln/srso.rst         |    4 +-
 .../bindings/iio/addac/adi,ad74413r.yaml           |  158 +++
 Makefile                                           |    4 +-
 arch/arm/boot/dts/imx6dl-prtrvt.dts                |    4 +
 arch/arm/boot/dts/imx6qdl-prti6q.dtsi              |   11 +-
 arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi |  207 +--
 arch/mips/include/asm/dec/prom.h                   |    2 +-
 arch/powerpc/kernel/rtas_flash.c                   |    6 +-
 arch/powerpc/mm/kasan/Makefile                     |    1 +
 arch/riscv/lib/uaccess.S                           |  212 ++-
 arch/x86/include/asm/entry-common.h                |    1 +
 arch/x86/include/asm/nospec-branch.h               |   28 +-
 arch/x86/kernel/cpu/amd.c                          |    1 +
 arch/x86/kernel/cpu/bugs.c                         |   28 +-
 arch/x86/kernel/static_call.c                      |   13 +
 arch/x86/kernel/traps.c                            |    2 -
 arch/x86/kernel/vmlinux.lds.S                      |   18 +-
 arch/x86/kvm/svm/svm.c                             |    1 +
 arch/x86/lib/retpoline.S                           |  141 +-
 drivers/bluetooth/btusb.c                          |    3 +
 drivers/bus/Makefile                               |    2 +-
 drivers/bus/mhi/Kconfig                            |   18 +-
 drivers/bus/mhi/Makefile                           |    4 +-
 drivers/bus/mhi/host/Kconfig                       |   31 +
 drivers/bus/mhi/{core => host}/Makefile            |    4 +-
 drivers/bus/mhi/{core => host}/boot.c              |    0
 drivers/bus/mhi/{core => host}/debugfs.c           |    0
 drivers/bus/mhi/{core => host}/init.c              |   12 +
 drivers/bus/mhi/{core => host}/internal.h          |    0
 drivers/bus/mhi/{core => host}/main.c              |    0
 drivers/bus/mhi/host/pci_generic.c                 |  345 +++++
 drivers/bus/mhi/{core => host}/pm.c                |    0
 drivers/bus/ti-sysc.c                              |    2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c             |    6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c             |    6 +-
 drivers/gpu/drm/panel/panel-simple.c               |   24 +-
 drivers/gpu/drm/radeon/radeon_cs.c                 |    3 +-
 drivers/hid/hid-ids.h                              |    1 +
 drivers/hid/hid-quirks.c                           |    1 +
 drivers/i2c/busses/i2c-bcm-iproc.c                 |   11 +-
 drivers/i2c/busses/i2c-designware-master.c         |   15 +-
 drivers/iio/Kconfig                                |    1 +
 drivers/iio/Makefile                               |    1 +
 drivers/iio/adc/stx104.c                           |   98 +-
 drivers/iio/addac/Kconfig                          |    8 +
 drivers/iio/addac/Makefile                         |    6 +
 drivers/infiniband/hw/mlx5/qpc.c                   |   10 +-
 drivers/irqchip/irq-mips-gic.c                     |   63 +-
 drivers/media/platform/mtk-vpu/mtk_vpu.c           |    6 +-
 drivers/mmc/core/block.c                           |    7 +-
 drivers/mmc/core/host.c                            |   26 +
 drivers/mmc/host/bcm2835.c                         |    4 +-
 drivers/mmc/host/meson-gx-mmc.c                    |   52 +-
 drivers/mmc/host/sdhci_f_sdh30.c                   |   66 +-
 drivers/mmc/host/sunxi-mmc.c                       |    4 +-
 drivers/mmc/host/wbsd.c                            |    2 -
 drivers/net/dsa/mv88e6xxx/chip.c                   |    8 +
 drivers/net/ethernet/intel/i40e/i40e_nvm.c         |   16 +-
 .../net/ethernet/mellanox/mlx5/core/lib/clock.c    |  166 ++-
 .../net/ethernet/mellanox/mlx5/core/lib/clock.h    |    3 +-
 drivers/net/macsec.c                               |   70 +-
 drivers/net/phy/broadcom.c                         |   13 +
 drivers/net/team/team.c                            |    4 +-
 drivers/net/virtio_net.c                           |    4 +-
 drivers/pci/controller/dwc/pcie-tegra194.c         |   13 +-
 drivers/pcmcia/rsrc_nonstatic.c                    |    2 +
 drivers/tty/n_gsm.c                                |    3 +-
 drivers/tty/serial/8250/8250_port.c                |    1 +
 drivers/tty/serial/fsl_lpuart.c                    |    4 +-
 drivers/usb/cdns3/cdnsp-gadget.h                   | 1463 ++++++++++++++++++++
 drivers/usb/cdns3/gadget.c                         |   60 +-
 drivers/usb/cdns3/gadget.h                         |    9 +-
 drivers/usb/chipidea/ci_hdrc_imx.c                 |    5 +
 drivers/usb/chipidea/usbmisc_imx.c                 |    2 +-
 drivers/usb/dwc3/dwc3-qcom.c                       |   11 +-
 drivers/usb/gadget/function/u_serial.c             |    3 +
 drivers/usb/gadget/udc/core.c                      |   19 +
 drivers/video/fbdev/mmp/hw/mmp_ctrl.c              |    4 +-
 drivers/virtio/virtio_mmio.c                       |    8 +-
 fs/btrfs/volumes.c                                 |    3 +-
 fs/cifs/file.c                                     |    2 +-
 fs/gfs2/super.c                                    |   26 +-
 fs/jfs/jfs_dmap.c                                  |    3 +
 fs/jfs/jfs_txnmgr.c                                |    5 +
 fs/jfs/namei.c                                     |    5 +
 fs/overlayfs/ovl_entry.h                           |    9 +
 fs/quota/dquot.c                                   |    5 +-
 fs/udf/unicode.c                                   |    2 +-
 include/dt-bindings/iio/addac/adi,ad74413r.h       |   21 +
 include/linux/iopoll.h                             |    2 +
 include/linux/mhi.h                                |    2 +
 include/linux/mlx5/driver.h                        |   12 +-
 include/linux/mmc/host.h                           |    1 +
 include/linux/objtool.h                            |   28 +
 include/linux/usb/gadget.h                         |    4 +
 include/linux/virtio_net.h                         |    4 +
 include/media/v4l2-mem2mem.h                       |   18 +-
 include/net/sock.h                                 |    6 +
 kernel/dma/remap.c                                 |    4 +-
 kernel/trace/ring_buffer.c                         |   14 +-
 kernel/trace/trace.c                               |    3 +-
 kernel/trace/trace_kprobe.c                        |    3 +-
 kernel/trace/trace_probe_tmpl.h                    |   18 +-
 kernel/trace/trace_uprobe.c                        |    3 +-
 net/bluetooth/l2cap_core.c                         |    5 +
 net/core/sock.c                                    |    2 +-
 net/ipv4/ip_vti.c                                  |    4 +-
 net/ipv4/tcp_timer.c                               |    4 +-
 net/ipv6/ip6_vti.c                                 |    4 +-
 net/key/af_key.c                                   |    4 +-
 net/ncsi/ncsi-rsp.c                                |    5 +-
 net/netfilter/ipvs/ip_vs_ctl.c                     |    4 +
 net/netfilter/nf_conntrack_proto_sctp.c            |    6 +-
 net/netfilter/nft_dynset.c                         |    3 +
 net/unix/af_unix.c                                 |    9 +-
 net/xfrm/xfrm_compat.c                             |    2 +-
 net/xfrm/xfrm_interface_core.c                     |    4 +-
 net/xfrm/xfrm_user.c                               |   14 +-
 security/integrity/ima/Kconfig                     |    2 +-
 sound/hda/hdac_regmap.c                            |    7 +-
 sound/pci/emu10k1/emufx.c                          |  112 +-
 sound/pci/hda/patch_realtek.c                      |   16 +-
 sound/soc/codecs/rt5665.c                          |    2 +
 sound/soc/intel/boards/sof_sdw.c                   |   25 +
 sound/soc/meson/axg-tdm-formatter.c                |   42 +-
 sound/usb/quirks-table.h                           |   29 +
 tools/include/linux/objtool.h                      |   28 +
 tools/objtool/arch/x86/decode.c                    |    2 +-
 tools/objtool/check.c                              |   21 +-
 .../selftests/net/forwarding/mirror_gre_changes.sh |    3 +-
 130 files changed, 3442 insertions(+), 695 deletions(-)
#70 lore raw

Re: [PATCH 5.10 066/135] net/ncsi: change from ndo_set_mac_address to dev_set_mac_address

In reply to Greg Kroah-Hartman
Quoted 52 lines · Greg Kroah-Hartman

5.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ivan Mikhaylov <[email protected]>

[ Upstream commit 790071347a0a1a89e618eedcd51c687ea783aeb3 ]

Change ndo_set_mac_address to dev_set_mac_address because dev_set_mac_address provides a way to notify network layer about MAC change. In other case, services may not aware about MAC change and keep
using old one which set from network adapter driver.

As example, DHCP client from systemd do not update MAC address without
notification from net subsystem which leads to the problem with acquiring
the right address from DHCP server.

Fixes cb10c7c0dfd9e ("net/ncsi: Add NCSI Broadcom OEM command")
Cc [email protected] # v6.0+ 2f38e84 net/ncsi: make one oem_gma

function for all mfr id

---
 net/ncsi/ncsi-rsp.c | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)
net/ncsi/ncsi-rsp.c +0 -1
index 888ccc2d4e34b..47ffb790ff99f 100644
@@ -616,7 +616,6 @@ static int ncsi_rsp_handler_oem_mlx_gma(struct
 ncsi_request *nr)
  {
         struct ncsi_dev_priv *ndp = nr->ndp;
         struct net_device *ndev = ndp->ndev.dev;
-       const struct net_device_ops *ops = ndev->netdev_ops;
         struct ncsi_rsp_oem_pkt *rsp;
         struct sockaddr saddr;

        int ret = 0;

net/ncsi/ncsi-rsp.c +0 -0
@@ -630,7 +629,9 @@ static int ncsi_rsp_handler_oem_mlx_gma(struct
 ncsi_request *nr)
         /* Set the flag for GMA command which should only be called

once */
        ndp->gma_flag = 1;

Quoted 8 lines

-       ret = ops->ndo_set_mac_address(ndev, &saddr); +       rtnl_lock();
+       ret = dev_set_mac_address(ndev, &saddr, NULL); +       rtnl_unlock();
        if (ret < 0)
                netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n");

Greg, we had conversation in the past about this particular patchset series:
https://www.spinics.net/lists/stable-commits/msg308587.html

Just one patch is not enough, I didn't test it either on linux kernel version < 6.0 , also I saw the Sasha's commits about the same for 5.4, 5.10, 5.15 and answered to him about necessity of two patchsets instead of one on 19 aug.

Thanks.

#55 lore raw

RE: [PATCH 5.10 054/135] usb: cdnsp: Device side header file for CDNSP driver

In reply to Greg Kroah-Hartman

Hi Greg,

I don't understand why this is queued for 5.10 stable version.

Driver has been upstreamed into 5.12 version.

Is anyone trying backporting this driver to older version?

Regards,
Pawel,

Quoted 1,560 lines

EXTERNAL MAIL

5.10-stable review patch. If anyone has any objections, please let me know.

------------------

From: Pawel Laszczak <[email protected]>

[ Upstream commit e93e58d2740282d32c0278fab283eb0ae158bb59 ]

Patch defines macros, registers and structures used by Device side driver.

Because the size of main patch is very big, I’ve decided to create separate patch for cdnsp-gadget.h. It should simplify reviewing the code.

Stable-dep-of: dbe678f6192f ("usb: cdns3: fix NCM gadget RX speed 20x slow than expection at iMX8QM")

---
drivers/usb/cdns3/cdnsp-gadget.h | 1463
++++++++++++++++++++++++++++++

1 file changed, 1463 insertions(+)

create mode 100644 drivers/usb/cdns3/cdnsp-gadget.h

drivers/usb/cdns3/cdnsp- renamed from drivers/usb/cdns3/cdnsp-gadget.h +0 -0

gadget.h
new file mode 100644
index 0000000000000..93da1dcdad600

drivers/usb/cdns3/cdnsp-gadget.h new file +90 -0
@@ -0,0 +1,1463 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Cadence CDNSP DRD Driver.
+ *
+ * Copyright (C) 2020 Cadence.
+ *
+ * Author: Pawel Laszczak <[email protected]>
+ *
+ * Code based on Linux XHCI driver.
+ * Origin: Copyright (C) 2008 Intel Corp.
+ */
+#ifndef __LINUX_CDNSP_GADGET_H
+#define __LINUX_CDNSP_GADGET_H
+
+#include <linux/io-64-nonatomic-lo-hi.h>
+#include <linux/usb/gadget.h>
+#include <linux/irq.h>
+
+/* Max number slots - only 1 is allowed. */
+#define CDNSP_DEV_MAX_SLOTS	1
+
+#define CDNSP_EP0_SETUP_SIZE	512
+
+/* One control and 15 for in and 15 for out endpoints. */
+#define CDNSP_ENDPOINTS_NUM	31
+
+/* Best Effort Service Latency. */
+#define CDNSP_DEFAULT_BESL	0
+
+/* Device Controller command default timeout value in us */
+#define CDNSP_CMD_TIMEOUT	(15 * 1000)
+
+/* Up to 16 ms to halt an device controller */
+#define CDNSP_MAX_HALT_USEC	(16 * 1000)
+
+#define CDNSP_CTX_SIZE	2112
+
+/*
+ * Controller register interface.
+ */
+
+/**
+ * struct cdnsp_cap_regs - CDNSP Registers.
+ * @hc_capbase:	Length of the capabilities register and controller
+ *              version number
+ * @hcs_params1: HCSPARAMS1 - Structural Parameters 1
+ * @hcs_params2: HCSPARAMS2 - Structural Parameters 2
+ * @hcs_params3: HCSPARAMS3 - Structural Parameters 3
+ * @hcc_params: HCCPARAMS - Capability Parameters
+ * @db_off: DBOFF - Doorbell array offset
+ * @run_regs_off: RTSOFF - Runtime register space offset
+ * @hcc_params2: HCCPARAMS2 Capability Parameters 2,
+ */
+struct cdnsp_cap_regs {
+	__le32 hc_capbase;
+	__le32 hcs_params1;
+	__le32 hcs_params2;
+	__le32 hcs_params3;
+	__le32 hcc_params;
+	__le32 db_off;
+	__le32 run_regs_off;
+	__le32 hcc_params2;
+	/* Reserved up to (CAPLENGTH - 0x1C) */
+};
+
+/* hc_capbase bitmasks. */
+/* bits 7:0 - how long is the Capabilities register. */
+#define HC_LENGTH(p)		(((p) >> 00) & GENMASK(7, 0))
+/* bits 31:16	*/
+#define HC_VERSION(p)		(((p) >> 16) & GENMASK(15, 1))
+
+/* HCSPARAMS1 - hcs_params1 - bitmasks */
+/* bits 0:7, Max Device Endpoints */
+#define HCS_ENDPOINTS_MASK	GENMASK(7, 0)
+#define HCS_ENDPOINTS(p)	(((p) & HCS_ENDPOINTS_MASK) >> 0)
+
+/* HCCPARAMS offset from PCI base address */
+#define HCC_PARAMS_OFFSET	0x10
+
+/* HCCPARAMS - hcc_params - bitmasks */
+/* 1: device controller can use 64-bit address pointers. */
+#define HCC_64BIT_ADDR(p)	((p) & BIT(0))
+/* 1: device controller uses 64-byte Device Context structures. */
+#define HCC_64BYTE_CONTEXT(p)	((p) & BIT(2))
+/* Max size for Primary Stream Arrays - 2^(n+1), where n is bits 12:15. */
+#define HCC_MAX_PSA(p)		((((p) >> 12) & 0xf) + 1)
+/* Extended Capabilities pointer from PCI base. */
+#define HCC_EXT_CAPS(p)		(((p) & GENMASK(31, 16)) >> 16)
+
+#define CTX_SIZE(_hcc)		(HCC_64BYTE_CONTEXT(_hcc) ? 64 :

32)

drivers/usb/cdns3/cdnsp-gadget.h new file +12 -0
+
+/* db_off bitmask - bits 0:1 reserved. */
+#define DBOFF_MASK	GENMASK(31, 2)
+
+/* run_regs_off bitmask - bits 0:4 reserved. */
+#define RTSOFF_MASK	GENMASK(31, 5)
+
+/**
+ * struct cdnsp_op_regs - Device Controller Operational Registers.
+ * @command: USBCMD - Controller command register.
+ * @status: USBSTS - Controller status register.
+ * @page_size: This indicates the page size that the device controller

supports.
+ * If bit n is set, the controller supports a page size of 2^(n+12),
+ * up to a 128MB page size. 4K is the minimum page size.
+ * @dnctrl: DNCTRL - Device notification control register.
+ * @cmd_ring: CRP - 64-bit Command Ring Pointer.
+ * @dcbaa_ptr: DCBAAP - 64-bit Device Context Base Address Array Pointer.
+ * @config_reg: CONFIG - Configure Register
+ * @port_reg_base: PORTSCn - base address for Port Status and Control

+ *                 Each port has a Port Status and Control register,
+ *                 followed by a Port Power Management Status and Control
+ *                 register, a Port Link Info register, and a reserved
+ *                 register.

+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +25 -0
+struct cdnsp_op_regs {
+	__le32 command;
+	__le32 status;
+	__le32 page_size;
+	__le32 reserved1;
+	__le32 reserved2;
+	__le32 dnctrl;
+	__le64 cmd_ring;
+	/* rsvd: offset 0x20-2F. */
+	__le32 reserved3[4];
+	__le64 dcbaa_ptr;
+	__le32 config_reg;
+	/* rsvd: offset 0x3C-3FF. */
+	__le32 reserved4[241];
+	/* port 1 registers, which serve as a base address for other ports. */
+	__le32 port_reg_base;
+};
+
+/* Number of registers per port. */
+#define NUM_PORT_REGS	4
+
+/**
+ * struct cdnsp_port_regs - Port Registers.
+ * @portsc: PORTSC - Port Status and Control Register.
+ * @portpmsc: PORTPMSC - Port Power Managements Status and Control

Register.
+ * @portli: PORTLI - Port Link Info register.
+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +20 -0
+struct cdnsp_port_regs {
+	__le32 portsc;
+	__le32 portpmsc;
+	__le32 portli;
+	__le32 reserved;
+};
+
+/*
+ * These bits are Read Only (RO) and should be saved and written to the
+ * registers: 0 (connect status) and  10:13 (port speed).
+ * These bits are also sticky - meaning they're in the AUX well and they aren't
+ * changed by a hot and warm.
+ */
+#define CDNSP_PORT_RO	(PORT_CONNECT | DEV_SPEED_MASK)
+
+/*
+ * These bits are RW; writing a 0 clears the bit, writing a 1 sets the bit:
+ * bits 5:8 (link state), 25:26  ("wake on" enable state)
+ */
+#define CDNSP_PORT_RWS	(PORT_PLS_MASK | PORT_WKCONN_E |

PORT_WKDISC_E)

drivers/usb/cdns3/cdnsp-gadget.h new file +7 -0
+
+/*
+ * These bits are RW; writing a 1 clears the bit, writing a 0 has no effect:
+ * bits 1 (port enable/disable), 17  ( connect changed),
+ * 21 (port reset changed) , 22 (Port Link State Change),
+ */
+#define CDNSP_PORT_RW1CS (PORT_PED | PORT_CSC | PORT_RC |

PORT_PLC)

drivers/usb/cdns3/cdnsp-gadget.h new file +62 -0
+
+/* USBCMD - USB command - bitmasks. */
+/* Run/Stop, controller execution - do not write unless controller is halted.*/
+#define CMD_R_S		BIT(0)
+/*
+ * Reset device controller - resets internal controller state machine and all
+ * registers (except PCI config regs).
+ */
+#define CMD_RESET	BIT(1)
+/* Event Interrupt Enable - a '1' allows interrupts from the controller. */
+#define CMD_INTE	BIT(2)
+/*
+ * Device System Error Interrupt Enable - get out-of-band signal for
+ * controller errors.
+ */
+#define CMD_DSEIE	BIT(3)
+/* device controller save/restore state. */
+#define CMD_CSS		BIT(8)
+#define CMD_CRS		BIT(9)
+/*
+ * Enable Wrap Event - '1' means device controller generates an event
+ * when MFINDEX wraps.
+ */
+#define CMD_EWE		BIT(10)
+/* 1: device enabled */
+#define CMD_DEVEN	BIT(17)
+/* bits 18:31 are reserved (and should be preserved on writes). */
+
+/* Command register values to disable interrupts. */
+#define CDNSP_IRQS	(CMD_INTE | CMD_DSEIE | CMD_EWE)
+
+/* USBSTS - USB status - bitmasks */
+/* controller not running - set to 1 when run/stop bit is cleared. */
+#define STS_HALT	BIT(0)
+/*
+ * serious error, e.g. PCI parity error. The controller will clear
+ * the run/stop bit.
+ */
+#define STS_FATAL	BIT(2)
+/* event interrupt - clear this prior to clearing any IP flags in IR set.*/
+#define STS_EINT	BIT(3)
+/* port change detect */
+#define STS_PCD		BIT(4)
+/* save state status - '1' means device controller is saving state. */
+#define STS_SSS		BIT(8)
+/* restore state status - '1' means controllers is restoring state. */
+#define STS_RSS		BIT(9)
+/* 1: save or restore error */
+#define STS_SRE		BIT(10)
+/* 1: device Not Ready to accept doorbell or op reg writes after reset. */
+#define STS_CNR		BIT(11)
+/* 1: internal Device Controller Error.*/
+#define STS_HCE		BIT(12)
+
+/* CRCR - Command Ring Control Register - cmd_ring bitmasks. */
+/* bit 0 is the command ring cycle state. */
+#define CMD_RING_CS		BIT(0)
+/* stop ring immediately - abort the currently executing command. */
+#define CMD_RING_ABORT		BIT(2)
+/*
+ * Command Ring Busy.
+ * Set when Doorbell register is written with DB for command and cleared

when
+ * the controller reached end of CR.
+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +60 -0
+#define CMD_RING_BUSY(p)	((p) & BIT(4))
+/* 1: command ring is running */
+#define CMD_RING_RUNNING	BIT(3)
+/* Command Ring pointer - bit mask for the lower 32 bits. */
+#define CMD_RING_RSVD_BITS	GENMASK(5, 0)
+
+/* CONFIG - Configure Register - config_reg bitmasks. */
+/* bits 0:7 - maximum number of device slots enabled. */
+#define MAX_DEVS		GENMASK(7, 0)
+/* bit 8: U3 Entry Enabled, assert PLC when controller enters U3. */
+#define CONFIG_U3E		BIT(8)
+
+/* PORTSC - Port Status and Control Register - port_reg_base bitmasks */
+/* 1: device connected. */
+#define PORT_CONNECT		BIT(0)
+/* 1: port enabled. */
+#define PORT_PED		BIT(1)
+/* 1: port reset signaling asserted. */
+#define PORT_RESET		BIT(4)
+/*
+ * Port Link State - bits 5:8
+ * A read gives the current link PM state of the port,
+ * a write with Link State Write Strobe sets the link state.
+ */
+#define PORT_PLS_MASK		GENMASK(8, 5)
+#define XDEV_U0			(0x0 << 5)
+#define XDEV_U1			(0x1 << 5)
+#define XDEV_U2			(0x2 << 5)
+#define XDEV_U3			(0x3 << 5)
+#define XDEV_DISABLED		(0x4 << 5)
+#define XDEV_RXDETECT		(0x5 << 5)
+#define XDEV_INACTIVE		(0x6 << 5)
+#define XDEV_POLLING		(0x7 << 5)
+#define XDEV_RECOVERY		(0x8 << 5)
+#define XDEV_HOT_RESET		(0x9 << 5)
+#define XDEV_COMP_MODE		(0xa << 5)
+#define XDEV_TEST_MODE		(0xb << 5)
+#define XDEV_RESUME		(0xf << 5)
+/* 1: port has power. */
+#define PORT_POWER		BIT(9)
+/*
+ * bits 10:13 indicate device speed:
+ * 0 - undefined speed - port hasn't be initialized by a reset yet
+ * 1 - full speed
+ * 2 - Reserved (Low Speed not supported
+ * 3 - high speed
+ * 4 - super speed
+ * 5 - super speed
+ * 6-15 reserved
+ */
+#define DEV_SPEED_MASK		GENMASK(13, 10)
+#define XDEV_FS			(0x1 << 10)
+#define XDEV_HS			(0x3 << 10)
+#define XDEV_SS			(0x4 << 10)
+#define XDEV_SSP		(0x5 << 10)
+#define DEV_UNDEFSPEED(p)	(((p) & DEV_SPEED_MASK) == (0x0 << 10))
+#define DEV_FULLSPEED(p)	(((p) & DEV_SPEED_MASK) == XDEV_FS)
+#define DEV_HIGHSPEED(p)	(((p) & DEV_SPEED_MASK) == XDEV_HS)
+#define DEV_SUPERSPEED(p)	(((p) & DEV_SPEED_MASK) == XDEV_SS)
+#define DEV_SUPERSPEEDPLUS(p)	(((p) & DEV_SPEED_MASK) ==

XDEV_SSP)
+#define DEV_SUPERSPEED_ANY(p) (((p) & DEV_SPEED_MASK) >=
XDEV_SS)

drivers/usb/cdns3/cdnsp-gadget.h new file +34 -0
+#define DEV_PORT_SPEED(p)	(((p) >> 10) & 0x0f)
+/* Port Link State Write Strobe - set this when changing link state */
+#define PORT_LINK_STROBE	BIT(16)
+/* 1: connect status change */
+#define PORT_CSC		BIT(17)
+/* 1: warm reset for a USB 3.0 device is done. */
+#define PORT_WRC		BIT(19)
+/* 1: reset change - 1 to 0 transition of PORT_RESET */
+#define PORT_RC			BIT(21)
+/*
+ * port link status change - set on some port link state transitions:
+ * Transition			Reason
+ * ----------------------------------------------------------------------------
+ * - U3 to Resume		Wakeup signaling from a device
+ * - Resume to Recovery to U0	USB 3.0 device resume
+ * - Resume to U0		USB 2.0 device resume
+ * - U3 to Recovery to U0	Software resume of USB 3.0 device complete
+ * - U3 to U0			Software resume of USB 2.0 device complete
+ * - U2 to U0			L1 resume of USB 2.1 device complete
+ * - U0 to U0			L1 entry rejection by USB 2.1 device
+ * - U0 to disabled		L1 entry error with USB 2.1 device
+ * - Any state to inactive	Error on USB 3.0 port
+ */
+#define PORT_PLC		BIT(22)
+/* Port configure error change - port failed to configure its link partner. */
+#define PORT_CEC		BIT(23)
+/* Wake on connect (enable). */
+#define PORT_WKCONN_E		BIT(25)
+/* Wake on disconnect (enable). */
+#define PORT_WKDISC_E		BIT(26)
+/* Indicates if Warm Reset is being received. */
+#define PORT_WR			BIT(31)
+
+#define PORT_CHANGE_BITS (PORT_CSC | PORT_WRC | PORT_RC |

PORT_PLC | PORT_CEC)

drivers/usb/cdns3/cdnsp-gadget.h new file +2 -0
+
+/* PORTPMSCUSB3 - Port Power Management Status and Control - bitmasks.

*/

drivers/usb/cdns3/cdnsp-gadget.h new file +6 -0
+/*  Enables U1 entry. */
+#define PORT_U1_TIMEOUT_MASK	GENMASK(7, 0)
+#define PORT_U1_TIMEOUT(p)	((p) & PORT_U1_TIMEOUT_MASK)
+/* Enables U2 entry .*/
+#define PORT_U2_TIMEOUT_MASK	GENMASK(14, 8)
+#define PORT_U2_TIMEOUT(p)	(((p) << 8) &

PORT_U2_TIMEOUT_MASK)

drivers/usb/cdns3/cdnsp-gadget.h new file +2 -0
+
+/* PORTPMSCUSB2 - Port Power Management Status and Control - bitmasks.

*/

drivers/usb/cdns3/cdnsp-gadget.h new file +29 -0
+#define PORT_L1S_MASK		GENMASK(2, 0)
+#define PORT_L1S(p)		((p) & PORT_L1S_MASK)
+#define PORT_L1S_ACK		PORT_L1S(1)
+#define PORT_L1S_NYET		PORT_L1S(2)
+#define PORT_L1S_STALL		PORT_L1S(3)
+#define PORT_L1S_TIMEOUT	PORT_L1S(4)
+/* Remote Wake Enable. */
+#define PORT_RWE		BIT(3)
+/* Best Effort Service Latency (BESL). */
+#define PORT_BESL(p)		(((p) << 4) & GENMASK(7, 4))
+/* Hardware LPM Enable (HLE). */
+#define PORT_HLE		BIT(16)
+/* Received Best Effort Service Latency (BESL). */
+#define PORT_RRBESL(p)		(((p) & GENMASK(20, 17)) >> 17)
+/* Port Test Control. */
+#define PORT_TEST_MODE_MASK	GENMASK(31, 28)
+#define PORT_TEST_MODE(p)	(((p) << 28) & PORT_TEST_MODE_MASK)
+
+/**
+ * struct cdnsp_intr_reg - Interrupt Register Set.
+ * @irq_pending: IMAN - Interrupt Management Register. Used to enable
+ *               interrupts and check for pending interrupts.
+ * @irq_control: IMOD - Interrupt Moderation Register.
+ *               Used to throttle interrupts.
+ * @erst_size: Number of segments in the Event Ring Segment Table (ERST).
+ * @erst_base: ERST base address.
+ * @erst_dequeue: Event ring dequeue pointer.
+ *
+ * Each interrupter (defined by a MSI-X vector) has an event ring and an

Event
+ * Ring Segment Table (ERST) associated with it. The event ring is comprised of
+ * multiple segments of the same size. The controller places events on the ring
+ * and "updates the Cycle bit in the TRBs to indicate to software the current
+ * position of the Enqueue Pointer." The driver processes those events and
+ * updates the dequeue pointer.
+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +24 -0
+struct cdnsp_intr_reg {
+	__le32 irq_pending;
+	__le32 irq_control;
+	__le32 erst_size;
+	__le32 rsvd;
+	__le64 erst_base;
+	__le64 erst_dequeue;
+};
+
+/* IMAN - Interrupt Management Register - irq_pending bitmasks l. */
+#define IMAN_IE			BIT(1)
+#define IMAN_IP			BIT(0)
+/* bits 2:31 need to be preserved */
+#define IMAN_IE_SET(p)		(((p) & IMAN_IE) | 0x2)
+#define IMAN_IE_CLEAR(p)	(((p) & IMAN_IE) & ~(0x2))
+
+/* IMOD - Interrupter Moderation Register - irq_control bitmasks. */
+/*
+ * Minimum interval between interrupts (in 250ns intervals). The interval
+ * between interrupts will be longer if there are no events on the event ring.
+ * Default is 4000 (1 ms).
+ */
+#define IMOD_INTERVAL_MASK	GENMASK(15, 0)
+/* Counter used to count down the time to the next interrupt - HW use only

*/

drivers/usb/cdns3/cdnsp-gadget.h new file +75 -0
+#define IMOD_COUNTER_MASK	GENMASK(31, 16)
+#define IMOD_DEFAULT_INTERVAL	0
+
+/* erst_size bitmasks. */
+/* Preserve bits 16:31 of erst_size. */
+#define ERST_SIZE_MASK		GENMASK(31, 16)
+
+/* erst_dequeue bitmasks. */
+/*
+ * Dequeue ERST Segment Index (DESI) - Segment number (or alias)
+ * where the current dequeue pointer lies. This is an optional HW hint.
+ */
+#define ERST_DESI_MASK		GENMASK(2, 0)
+/* Event Handler Busy (EHB) - is the event ring scheduled to be serviced. */
+#define ERST_EHB		BIT(3)
+#define ERST_PTR_MASK		GENMASK(3, 0)
+
+/**
+ * struct cdnsp_run_regs
+ * @microframe_index: MFINDEX - current microframe number.
+ * @ir_set: Array of Interrupter registers.
+ *
+ * Device Controller Runtime Registers:
+ * "Software should read and write these registers using only Dword (32 bit)
+ * or larger accesses"
+ */
+struct cdnsp_run_regs {
+	__le32 microframe_index;
+	__le32 rsvd[7];
+	struct cdnsp_intr_reg ir_set[128];
+};
+
+/**
+ * USB2.0 Port Peripheral Configuration Registers.
+ * @ext_cap: Header register for Extended Capability.
+ * @port_reg1: Timer Configuration Register.
+ * @port_reg2: Timer Configuration Register.
+ * @port_reg3: Timer Configuration Register.
+ * @port_reg4: Timer Configuration Register.
+ * @port_reg5: Timer Configuration Register.
+ * @port_reg6: Chicken bits for USB20PPP.
+ */
+struct cdnsp_20port_cap {
+	__le32 ext_cap;
+	__le32 port_reg1;
+	__le32 port_reg2;
+	__le32 port_reg3;
+	__le32 port_reg4;
+	__le32 port_reg5;
+	__le32 port_reg6;
+};
+
+/* Extended capability register fields */
+#define EXT_CAPS_ID(p)			(((p) >> 0) & GENMASK(7, 0))
+#define EXT_CAPS_NEXT(p)		(((p) >> 8) & GENMASK(7, 0))
+/* Extended capability IDs - ID 0 reserved */
+#define EXT_CAPS_PROTOCOL		2
+
+/* USB 2.0 Port Peripheral Configuration Extended Capability */
+#define EXT_CAP_CFG_DEV_20PORT_CAP_ID	0xC1
+/*
+ * Setting this bit to '1' enables automatic wakeup from L1 state on transfer
+ * TRB prepared when USBSSP operates in USB2.0 mode.
+ */
+#define PORT_REG6_L1_L0_HW_EN		BIT(1)
+/*
+ * Setting this bit to '1' forces Full Speed when USBSSP operates in USB2.0
+ * mode (disables High Speed).
+ */
+#define PORT_REG6_FORCE_FS		BIT(0)
+
+/**
+ * USB3.x Port Peripheral Configuration Registers.
+ * @ext_cap: Header register for Extended Capability.
+ * @mode_addr: Miscellaneous 3xPORT operation mode configuration

register.
+ * @mode_2: 3x Port Control Register 2.
+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +23 -0
+struct cdnsp_3xport_cap {
+	__le32 ext_cap;
+	__le32 mode_addr;
+	__le32 reserved[52];
+	__le32 mode_2;
+};
+
+/* Extended Capability Header for 3XPort Configuration Registers. */
+#define D_XEC_CFG_3XPORT_CAP		0xC0
+#define CFG_3XPORT_SSP_SUPPORT		BIT(31)
+#define CFG_3XPORT_U1_PIPE_CLK_GATE_EN	BIT(0)
+
+/* Revision Extended Capability ID */
+#define RTL_REV_CAP			0xC4
+#define RTL_REV_CAP_RX_BUFF_CMD_SIZE	BITMASK(31, 24)
+#define RTL_REV_CAP_RX_BUFF_SIZE	BITMASK(15, 0)
+#define RTL_REV_CAP_TX_BUFF_CMD_SIZE	BITMASK(31, 24)
+#define RTL_REV_CAP_TX_BUFF_SIZE	BITMASK(15, 0)
+
+#define CDNSP_VER_1 0x00000000
+#define CDNSP_VER_2 0x10000000
+
+#define CDNSP_IF_EP_EXIST(pdev, ep_num, dir) ((pdev)-
Quoted 1 line

rev_cap.ep_supported & \

drivers/usb/cdns3/cdnsp-gadget.h new file +45 -0
+			  (BIT(ep_num) << ((dir) ? 0 : 16)))
+
+/**
+ * struct cdnsp_rev_cap - controller capabilities .
+ * @ext_cap: Header for RTL Revision Extended Capability.
+ * @rtl_revision: RTL revision.
+ * @rx_buff_size: Rx buffer sizes.
+ * @tx_buff_size: Tx buffer sizes.
+ * @ep_supported: Supported endpoints.
+ * @ctrl_revision: Controller revision ID.
+ */
+struct cdnsp_rev_cap {
+	__le32 ext_cap;
+	__le32 rtl_revision;
+	__le32 rx_buff_size;
+	__le32 tx_buff_size;
+	__le32 ep_supported;
+	__le32 ctrl_revision;
+};
+
+/* USB2.0 Port Peripheral Configuration Registers. */
+#define D_XEC_PRE_REGS_CAP		0xC8
+#define REG_CHICKEN_BITS_2_OFFSET	0x48
+#define CHICKEN_XDMA_2_TP_CACHE_DIS	BIT(28)
+
+/* XBUF Extended Capability ID. */
+#define XBUF_CAP_ID			0xCB
+#define XBUF_RX_TAG_MASK_0_OFFSET	0x1C
+#define XBUF_RX_TAG_MASK_1_OFFSET	0x24
+#define XBUF_TX_CMD_OFFSET		0x2C
+
+/**
+ * struct cdnsp_doorbell_array.
+ * @cmd_db: Command ring doorbell register.
+ * @ep_db: Endpoint ring doorbell register.
+ *         Bits 0 - 7: Endpoint target.
+ *         Bits 8 - 15: RsvdZ.
+ *         Bits 16 - 31: Stream ID.
+ */
+struct cdnsp_doorbell_array {
+	__le32 cmd_db;
+	__le32 ep_db;
+};
+
+#define DB_VALUE(ep, stream)		((((ep) + 1) & 0xff) | ((stream)

<< 16))

drivers/usb/cdns3/cdnsp-gadget.h new file +82 -0
+#define DB_VALUE_EP0_OUT(ep, stream)	((ep) & 0xff)
+#define DB_VALUE_CMD			0x00000000
+
+/**
+ * struct cdnsp_container_ctx.
+ * @type: Type of context. Used to calculated offsets to contained contexts.
+ * @size: Size of the context data.
+ * @ctx_size: context data structure size - 64 or 32 bits.
+ * @dma: dma address of the bytes.
+ * @bytes: The raw context data given to HW.
+ *
+ * Represents either a Device or Input context. Holds a pointer to the raw
+ * memory used for the context (bytes) and dma address of it (dma).
+ */
+struct cdnsp_container_ctx {
+	unsigned int type;
+#define CDNSP_CTX_TYPE_DEVICE	0x1
+#define CDNSP_CTX_TYPE_INPUT	0x2
+	int size;
+	int ctx_size;
+	dma_addr_t dma;
+	u8 *bytes;
+};
+
+/**
+ * struct cdnsp_slot_ctx
+ * @dev_info: Device speed, and last valid endpoint.
+ * @dev_port: Device port number that is needed to access the USB device.
+ * @int_target: Interrupter target number.
+ * @dev_state: Slot state and device address.
+ *
+ * Slot Context - This assumes the controller uses 32-byte context
+ * structures. If the controller uses 64-byte contexts, there is an additional
+ * 32 bytes reserved at the end of the slot context for controller internal use.
+ */
+struct cdnsp_slot_ctx {
+	__le32 dev_info;
+	__le32 dev_port;
+	__le32 int_target;
+	__le32 dev_state;
+	/* offset 0x10 to 0x1f reserved for controller internal use. */
+	__le32 reserved[4];
+};
+
+/* Bits 20:23 in the Slot Context are the speed for the device. */
+#define SLOT_SPEED_FS		(XDEV_FS << 10)
+#define SLOT_SPEED_HS		(XDEV_HS << 10)
+#define SLOT_SPEED_SS		(XDEV_SS << 10)
+#define SLOT_SPEED_SSP		(XDEV_SSP << 10)
+
+/* dev_info bitmasks. */
+/* Device speed - values defined by PORTSC Device Speed field - 20:23. */
+#define DEV_SPEED		GENMASK(23, 20)
+#define GET_DEV_SPEED(n)	(((n) & DEV_SPEED) >> 20)
+/* Index of the last valid endpoint context in this device context - 27:31. */
+#define LAST_CTX_MASK		GENMASK(31, 27)
+#define LAST_CTX(p)		((p) << 27)
+#define LAST_CTX_TO_EP_NUM(p)	(((p) >> 27) - 1)
+#define SLOT_FLAG		BIT(0)
+#define EP0_FLAG		BIT(1)
+
+/* dev_port bitmasks */
+/* Device port number that is needed to access the USB device. */
+#define DEV_PORT(p)		(((p) & 0xff) << 16)
+
+/* dev_state bitmasks */
+/* USB device address - assigned by the controller. */
+#define DEV_ADDR_MASK		GENMASK(7, 0)
+/* Slot state */
+#define SLOT_STATE		GENMASK(31, 27)
+#define GET_SLOT_STATE(p)	(((p) & SLOT_STATE) >> 27)
+
+#define SLOT_STATE_DISABLED	0
+#define SLOT_STATE_ENABLED	SLOT_STATE_DISABLED
+#define SLOT_STATE_DEFAULT	1
+#define SLOT_STATE_ADDRESSED	2
+#define SLOT_STATE_CONFIGURED	3
+
+/**
+ * struct cdnsp_ep_ctx.
+ * @ep_info: Endpoint state, streams, mult, and interval information.
+ * @ep_info2: Information on endpoint type, max packet size, max burst

size,
+ * error count, and whether the controller will force an event for
+ * all transactions.
+ * @deq: 64-bit ring dequeue pointer address. If the endpoint only

+ *       defines one stream, this points to the endpoint transfer ring.
+ *       Otherwise, it points to a stream context array, which has a
+ *       ring pointer for each flow.

+ * @tx_info: Average TRB lengths for the endpoint ring and
+ * max payload within an Endpoint Service Interval Time (ESIT).
+ *
+ * Endpoint Context - This assumes the controller uses 32-byte context
+ * structures. If the controller uses 64-byte contexts, there is an additional
+ * 32 bytes reserved at the end of the endpoint context for controller internal
+ * use.
+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +26 -0
+struct cdnsp_ep_ctx {
+	__le32 ep_info;
+	__le32 ep_info2;
+	__le64 deq;
+	__le32 tx_info;
+	/* offset 0x14 - 0x1f reserved for controller internal use. */
+	__le32 reserved[3];
+};
+
+/* ep_info bitmasks. */
+/*
+ * Endpoint State - bits 0:2:
+ * 0 - disabled
+ * 1 - running
+ * 2 - halted due to halt condition
+ * 3 - stopped
+ * 4 - TRB error
+ * 5-7 - reserved
+ */
+#define EP_STATE_MASK		GENMASK(3, 0)
+#define EP_STATE_DISABLED	0
+#define EP_STATE_RUNNING	1
+#define EP_STATE_HALTED		2
+#define EP_STATE_STOPPED	3
+#define EP_STATE_ERROR		4
+#define GET_EP_CTX_STATE(ctx)	(le32_to_cpu((ctx)->ep_info) &

EP_STATE_MASK)

drivers/usb/cdns3/cdnsp-gadget.h new file +8 -0
+
+/* Mult - Max number of burst within an interval, in EP companion desc. */
+#define EP_MULT(p)			(((p) << 8) & GENMASK(9, 8))
+#define CTX_TO_EP_MULT(p)		(((p) & GENMASK(9, 8)) >> 8)
+/* bits 10:14 are Max Primary Streams. */
+/* bit 15 is Linear Stream Array. */
+/* Interval - period between requests to an endpoint - 125u increments. */
+#define EP_INTERVAL(p)			(((p) << 16) & GENMASK(23,

16))
+#define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) & GENMASK(23, 16))

Quoted 1 line
Quoted 1 line

16))

+#define CTX_TO_EP_INTERVAL(p) (((p) & GENMASK(23, 16)) >>
16)

drivers/usb/cdns3/cdnsp-gadget.h new file +2 -0
+#define EP_MAXPSTREAMS_MASK		GENMASK(14, 10)
+#define EP_MAXPSTREAMS(p)		(((p) << 10) &

EP_MAXPSTREAMS_MASK)
+#define CTX_TO_EP_MAXPSTREAMS(p) (((p) &
EP_MAXPSTREAMS_MASK) >> 10)
+/* Endpoint is set up with a Linear Stream Array (vs. Secondary Stream Array) */

drivers/usb/cdns3/cdnsp-gadget.h new file +24 -0
+#define EP_HAS_LSA			BIT(15)
+
+/* ep_info2 bitmasks */
+#define ERROR_COUNT(p)		(((p) & 0x3) << 1)
+#define CTX_TO_EP_TYPE(p)	(((p) >> 3) & 0x7)
+#define EP_TYPE(p)		((p) << 3)
+#define ISOC_OUT_EP		1
+#define BULK_OUT_EP		2
+#define INT_OUT_EP		3
+#define CTRL_EP			4
+#define ISOC_IN_EP		5
+#define BULK_IN_EP		6
+#define INT_IN_EP		7
+/* bit 6 reserved. */
+/* bit 7 is Device Initiate Disable - for disabling stream selection. */
+#define MAX_BURST(p)		(((p) << 8) & GENMASK(15, 8))
+#define CTX_TO_MAX_BURST(p)	(((p) & GENMASK(15, 8)) >> 8)
+#define MAX_PACKET(p)		(((p) << 16) & GENMASK(31, 16))
+#define MAX_PACKET_MASK		GENMASK(31, 16)
+#define MAX_PACKET_DECODED(p)	(((p) & GENMASK(31, 16)) >> 16)
+
+/* tx_info bitmasks. */
+#define EP_AVG_TRB_LENGTH(p)		((p) & GENMASK(15, 0))
+#define EP_MAX_ESIT_PAYLOAD_LO(p)	(((p) << 16) & GENMASK(31,

16))
+#define EP_MAX_ESIT_PAYLOAD_HI(p) ((((p) & GENMASK(23, 16)) >>
16) << 24)
+#define CTX_TO_MAX_ESIT_PAYLOAD_LO(p) (((p) & GENMASK(31, 16)) >>
16)
+#define CTX_TO_MAX_ESIT_PAYLOAD_HI(p) (((p) & GENMASK(31, 24)) >>
24)

drivers/usb/cdns3/cdnsp-gadget.h new file +20 -0
+
+/* deq bitmasks. */
+#define EP_CTX_CYCLE_MASK		BIT(0)
+#define CTX_DEQ_MASK			(~0xfL)
+
+/**
+ * struct cdnsp_input_control_context
+ * Input control context;
+ *
+ * @drop_context: Set the bit of the endpoint context you want to disable.
+ * @add_context: Set the bit of the endpoint context you want to enable.
+ */
+struct cdnsp_input_control_ctx {
+	__le32 drop_flags;
+	__le32 add_flags;
+	__le32 rsvd2[6];
+};
+
+/**
+ * Represents everything that is needed to issue a command on the

command ring.
+ *
+ * @in_ctx: Pointer to input context structure.
+ * @status: Command Completion Code for last command.
+ * @command_trb: Pointer to command TRB.
+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +32 -0
+struct cdnsp_command {
+	/* Input context for changing device state. */
+	struct cdnsp_container_ctx *in_ctx;
+	u32 status;
+	union cdnsp_trb *command_trb;
+};
+
+/**
+ * Stream context structure.
+ *
+ * @stream_ring: 64-bit stream ring address, cycle state, and stream type.
+ * @reserved: offset 0x14 - 0x1f reserved for controller internal use.
+ */
+struct cdnsp_stream_ctx {
+	__le64 stream_ring;
+	__le32 reserved[2];
+};
+
+/* Stream Context Types - bits 3:1 of stream ctx deq ptr. */
+#define SCT_FOR_CTX(p)		(((p) << 1) & GENMASK(3, 1))
+/* Secondary stream array type, dequeue pointer is to a transfer ring. */
+#define SCT_SEC_TR		0
+/* Primary stream array type, dequeue pointer is to a transfer ring. */
+#define SCT_PRI_TR		1
+
+/**
+ *  struct cdnsp_stream_info: Representing everything that is needed to
+ *                            supports stream capable endpoints.
+ *  @stream_rings: Array of pointers containing Transfer rings for all
+ *                 supported streams.
+ *  @num_streams: Number of streams, including stream 0.
+ *  @stream_ctx_array: The stream context array may be bigger than the

number
+ * of streams the driver asked for.

+ *  @num_stream_ctxs: Number of streams.
+ *  @ctx_array_dma: Dma address of Context Stream Array.
+ *  @trb_address_map: For mapping physical TRB addresses to segments in
+ *                    stream rings.
+ *  @td_count: Number of TDs associated with endpoint.
+ *  @first_prime_det: First PRIME packet detected.
+ *  @drbls_count: Number of allowed doorbells.

+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +32 -0
+struct cdnsp_stream_info {
+	struct cdnsp_ring **stream_rings;
+	unsigned int num_streams;
+	struct cdnsp_stream_ctx *stream_ctx_array;
+	unsigned int num_stream_ctxs;
+	dma_addr_t ctx_array_dma;
+	struct radix_tree_root trb_address_map;
+	int td_count;
+	u8 first_prime_det;
+#define STREAM_DRBL_FIFO_DEPTH 2
+	u8 drbls_count;
+};
+
+#define STREAM_LOG_STREAMS 4
+#define STREAM_NUM_STREAMS BIT(STREAM_LOG_STREAMS)
+
+#if STREAM_LOG_STREAMS > 16 && STREAM_LOG_STREAMS < 1
+#error "Not suupported stream value"
+#endif
+
+/**
+ * struct cdnsp_ep - extended device side representation of USB endpoint.
+ * @endpoint: usb endpoint
+ * @pending_req_list: List of requests queuing on transfer ring.
+ * @pdev: Device associated with this endpoint.
+ * @number: Endpoint number (1 - 15).
+ * idx: The device context index (DCI).
+ * interval: Interval between packets used for ISOC endpoint.
+ * @name: A human readable name e.g. ep1out.
+ * @direction: Endpoint direction.
+ * @buffering: Number of on-chip buffers related to endpoint.
+ * @buffering_period; Number of on-chip buffers related to periodic

endpoint.
+ * @in_ctx: Pointer to input endpoint context structure.
+ * @out_ctx: Pointer to output endpoint context structure.
+ * @ring: Pointer to transfer ring.
+ * @stream_info: Hold stream information.
+ * @ep_state: Current state of endpoint.
+ * @skip: Sometimes the controller can not process isochronous endpoint ring

+ *        quickly enough, and it will miss some isoc tds on the ring and
+ *        generate Missed Service Error Event.
+ *        Set skip flag when receive a Missed Service Error Event and
+ *        process the missed tds on the endpoint ring.

+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +58 -0
+struct cdnsp_ep {
+	struct usb_ep endpoint;
+	struct list_head pending_list;
+	struct cdnsp_device *pdev;
+	u8 number;
+	u8 idx;
+	u32 interval;
+	char name[20];
+	u8 direction;
+	u8 buffering;
+	u8 buffering_period;
+	struct cdnsp_ep_ctx *in_ctx;
+	struct cdnsp_ep_ctx *out_ctx;
+	struct cdnsp_ring *ring;
+	struct cdnsp_stream_info stream_info;
+	unsigned int ep_state;
+#define EP_ENABLED		BIT(0)
+#define EP_DIS_IN_RROGRESS	BIT(1)
+#define EP_HALTED		BIT(2)
+#define EP_STOPPED		BIT(3)
+#define EP_WEDGE		BIT(4)
+#define EP0_HALTED_STATUS	BIT(5)
+#define EP_HAS_STREAMS		BIT(6)
+
+	bool skip;
+};
+
+/**
+ * struct cdnsp_device_context_array
+ * @dev_context_ptr: Array of 64-bit DMA addresses for device contexts.
+ * @dma: DMA address for device contexts structure.
+ */
+struct cdnsp_device_context_array {
+	__le64 dev_context_ptrs[CDNSP_DEV_MAX_SLOTS + 1];
+	dma_addr_t dma;
+};
+
+/**
+ * struct cdnsp_transfer_event.
+ * @buffer: 64-bit buffer address, or immediate data.
+ * @transfer_len: Data length transferred.
+ * @flags: Field is interpreted differently based on the type of TRB.
+ */
+struct cdnsp_transfer_event {
+	__le64 buffer;
+	__le32 transfer_len;
+	__le32 flags;
+};
+
+/* Invalidate event after disabling endpoint. */
+#define TRB_EVENT_INVALIDATE 8
+
+/* Transfer event TRB length bit mask. */
+/* bits 0:23 */
+#define EVENT_TRB_LEN(p)			((p) & GENMASK(23, 0))
+/* Completion Code - only applicable for some types of TRBs */
+#define COMP_CODE_MASK				(0xff << 24)
+#define GET_COMP_CODE(p)			(((p) & COMP_CODE_MASK) >>

24)

drivers/usb/cdns3/cdnsp-gadget.h new file +32 -0
+#define COMP_INVALID				0
+#define COMP_SUCCESS				1
+#define COMP_DATA_BUFFER_ERROR			2
+#define COMP_BABBLE_DETECTED_ERROR		3
+#define COMP_TRB_ERROR				5
+#define COMP_RESOURCE_ERROR			7
+#define COMP_NO_SLOTS_AVAILABLE_ERROR		9
+#define COMP_INVALID_STREAM_TYPE_ERROR		10
+#define COMP_SLOT_NOT_ENABLED_ERROR		11
+#define COMP_ENDPOINT_NOT_ENABLED_ERROR		12
+#define COMP_SHORT_PACKET			13
+#define COMP_RING_UNDERRUN			14
+#define COMP_RING_OVERRUN			15
+#define COMP_VF_EVENT_RING_FULL_ERROR		16
+#define COMP_PARAMETER_ERROR			17
+#define COMP_CONTEXT_STATE_ERROR		19
+#define COMP_EVENT_RING_FULL_ERROR		21
+#define COMP_INCOMPATIBLE_DEVICE_ERROR		22
+#define COMP_MISSED_SERVICE_ERROR		23
+#define COMP_COMMAND_RING_STOPPED		24
+#define COMP_COMMAND_ABORTED			25
+#define COMP_STOPPED				26
+#define COMP_STOPPED_LENGTH_INVALID		27
+#define COMP_STOPPED_SHORT_PACKET		28
+#define COMP_MAX_EXIT_LATENCY_TOO_LARGE_ERROR	29
+#define COMP_ISOCH_BUFFER_OVERRUN		31
+#define COMP_EVENT_LOST_ERROR			32
+#define COMP_UNDEFINED_ERROR			33
+#define COMP_INVALID_STREAM_ID_ERROR		34
+
+/*Transfer Event NRDY bit fields */
+#define TRB_TO_DEV_STREAM(p)			((p) & GENMASK(16,

0))
+#define TRB_TO_HOST_STREAM(p) ((p) & GENMASK(16,
0))

drivers/usb/cdns3/cdnsp-gadget.h new file +5 -0
+#define STREAM_PRIME_ACK			0xFFFE
+#define STREAM_REJECTED				0xFFFF
+
+/** Transfer Event bit fields **/
+#define TRB_TO_EP_ID(p)				(((p) & GENMASK(20,

16)) >> 16)

drivers/usb/cdns3/cdnsp-gadget.h new file +19 -0
+
+/**
+ * struct cdnsp_link_trb
+ * @segment_ptr: 64-bit segment pointer.
+ * @intr_target: Interrupter target.
+ * @control: Flags.
+ */
+struct cdnsp_link_trb {
+	__le64 segment_ptr;
+	__le32 intr_target;
+	__le32 control;
+};
+
+/* control bitfields */
+#define LINK_TOGGLE	BIT(1)
+
+/**
+ * struct cdnsp_event_cmd - Command completion event TRB.
+ * cmd_trb: Pointer to command TRB, or the value passed by the event data

trb
+ * status: Command completion parameters and error code.
+ * flags: Flags.
+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +18 -0
+struct cdnsp_event_cmd {
+	__le64 cmd_trb;
+	__le32 status;
+	__le32 flags;
+};
+
+/* flags bitmasks */
+
+/* Address device - disable SetAddress. */
+#define TRB_BSR		BIT(9)
+
+/* Configure Endpoint - Deconfigure. */
+#define TRB_DC		BIT(9)
+
+/* Force Header */
+#define TRB_FH_TO_PACKET_TYPE(p)	((p) & GENMASK(4, 0))
+#define TRB_FH_TR_PACKET		0x4
+#define TRB_FH_TO_DEVICE_ADDRESS(p)	(((p) << 25) & GENMASK(31,

25))

drivers/usb/cdns3/cdnsp-gadget.h new file +25 -0
+#define TRB_FH_TR_PACKET_DEV_NOT	0x6
+#define TRB_FH_TO_NOT_TYPE(p)		(((p) << 4) & GENMASK(7, 4))
+#define TRB_FH_TR_PACKET_FUNCTION_WAKE	0x1
+#define TRB_FH_TO_INTERFACE(p)		(((p) << 8) & GENMASK(15, 8))
+
+enum cdnsp_setup_dev {
+	SETUP_CONTEXT_ONLY,
+	SETUP_CONTEXT_ADDRESS,
+};
+
+/* bits 24:31 are the slot ID. */
+#define TRB_TO_SLOT_ID(p)		(((p) & GENMASK(31, 24)) >> 24)
+#define SLOT_ID_FOR_TRB(p)		(((p) << 24) & GENMASK(31, 24))
+
+/* Stop Endpoint TRB - ep_index to endpoint ID for this TRB. */
+#define TRB_TO_EP_INDEX(p)		(((p) >> 16) & 0x1f)
+
+#define EP_ID_FOR_TRB(p)		((((p) + 1) << 16) & GENMASK(20, 16))
+
+#define SUSPEND_PORT_FOR_TRB(p)		(((p) & 1) << 23)
+#define TRB_TO_SUSPEND_PORT(p)		(((p) >> 23) & 0x1)
+#define LAST_EP_INDEX			30
+
+/* Set TR Dequeue Pointer command TRB fields. */
+#define TRB_TO_STREAM_ID(p)		((((p) & GENMASK(31, 16)) >>

16))
+#define STREAM_ID_FOR_TRB(p) ((((p)) << 16) & GENMASK(31,
16))

drivers/usb/cdns3/cdnsp-gadget.h new file +8 -0
+#define SCT_FOR_TRB(p)			(((p) << 1) & 0x7)
+
+/* Link TRB specific fields. */
+#define TRB_TC				BIT(1)
+
+/* Port Status Change Event TRB fields. */
+/* Port ID - bits 31:24. */
+#define GET_PORT_ID(p)			(((p) & GENMASK(31, 24)) >>

24)
+#define SET_PORT_ID(p) (((p) << 24) & GENMASK(31,
24))

drivers/usb/cdns3/cdnsp-gadget.h new file +8 -0
+#define EVENT_DATA			BIT(2)
+
+/* Normal TRB fields. */
+/* transfer_len bitmasks - bits 0:16. */
+#define TRB_LEN(p)			((p) & GENMASK(16, 0))
+/* TD Size, packets remaining in this TD, bits 21:17 (5 bits, so max 31). */
+#define TRB_TD_SIZE(p)			(min((p), (u32)31) << 17)
+#define GET_TD_SIZE(p)			(((p) & GENMASK(21, 17)) >>

17)

drivers/usb/cdns3/cdnsp-gadget.h new file +6 -0
+/*
+ * Controller uses the TD_SIZE field for TBC if Extended TBC
+ * is enabled (ETE).
+ */
+#define TRB_TD_SIZE_TBC(p)		(min((p), (u32)31) << 17)
+/* Interrupter Target - which MSI-X vector to target the completion event at.

*/

drivers/usb/cdns3/cdnsp-gadget.h new file +38 -0
+#define TRB_INTR_TARGET(p)		(((p) << 22) & GENMASK(31, 22))
+#define GET_INTR_TARGET(p)		(((p) & GENMASK(31, 22)) >> 22)
+/*
+ * Total burst count field, Rsvdz on controller with Extended TBC
+ * enabled (ETE).
+ */
+#define TRB_TBC(p)			(((p) & 0x3) << 7)
+#define TRB_TLBPC(p)			(((p) & 0xf) << 16)
+
+/* Cycle bit - indicates TRB ownership by driver or driver.*/
+#define TRB_CYCLE			BIT(0)
+/*
+ * Force next event data TRB to be evaluated before task switch.
+ * Used to pass OS data back after a TD completes.
+ */
+#define TRB_ENT				BIT(1)
+/* Interrupt on short packet. */
+#define TRB_ISP				BIT(2)
+/* Set PCIe no snoop attribute. */
+#define TRB_NO_SNOOP			BIT(3)
+/* Chain multiple TRBs into a TD. */
+#define TRB_CHAIN			BIT(4)
+/* Interrupt on completion. */
+#define TRB_IOC				BIT(5)
+/* The buffer pointer contains immediate data. */
+#define TRB_IDT				BIT(6)
+/* 0 - NRDY during data stage, 1 - NRDY during status stage (only control). */
+#define TRB_STAT			BIT(7)
+/* Block Event Interrupt. */
+#define TRB_BEI				BIT(9)
+
+/* Control transfer TRB specific fields. */
+#define TRB_DIR_IN			BIT(16)
+
+/* TRB bit mask in Data Stage TRB */
+#define TRB_SETUPID_BITMASK		GENMASK(9, 8)
+#define TRB_SETUPID(p)			((p) << 8)
+#define TRB_SETUPID_TO_TYPE(p)		(((p) &

TRB_SETUPID_BITMASK) >> 8)

drivers/usb/cdns3/cdnsp-gadget.h new file +12 -0
+
+#define TRB_SETUP_SPEEDID_USB3		0x1
+#define TRB_SETUP_SPEEDID_USB2		0x0
+#define TRB_SETUP_SPEEDID(p)		((p) & (1 << 7))
+
+#define TRB_SETUPSTAT_ACK		0x1
+#define TRB_SETUPSTAT_STALL		0x0
+#define TRB_SETUPSTAT(p)		((p) << 6)
+
+/* Isochronous TRB specific fields */
+#define TRB_SIA				BIT(31)
+#define TRB_FRAME_ID(p)			(((p) << 20) & GENMASK(30,

20))

drivers/usb/cdns3/cdnsp-gadget.h new file +56 -0
+
+struct cdnsp_generic_trb {
+	__le32 field[4];
+};
+
+union cdnsp_trb {
+	struct cdnsp_link_trb link;
+	struct cdnsp_transfer_event trans_event;
+	struct cdnsp_event_cmd event_cmd;
+	struct cdnsp_generic_trb generic;
+};
+
+/* TRB bit mask. */
+#define TRB_TYPE_BITMASK	GENMASK(15, 10)
+#define TRB_TYPE(p)		((p) << 10)
+#define TRB_FIELD_TO_TYPE(p)	(((p) & TRB_TYPE_BITMASK) >> 10)
+
+/* TRB type IDs. */
+/* bulk, interrupt, isoc scatter/gather, and control data stage. */
+#define TRB_NORMAL		1
+/* Setup Stage for control transfers. */
+#define TRB_SETUP		2
+/* Data Stage for control transfers. */
+#define TRB_DATA		3
+/* Status Stage for control transfers. */
+#define TRB_STATUS		4
+/* ISOC transfers. */
+#define TRB_ISOC		5
+/* TRB for linking ring segments. */
+#define TRB_LINK		6
+#define TRB_EVENT_DATA		7
+/* Transfer Ring No-op (not for the command ring). */
+#define TRB_TR_NOOP		8
+
+/* Command TRBs */
+/* Enable Slot Command. */
+#define TRB_ENABLE_SLOT		9
+/* Disable Slot Command. */
+#define TRB_DISABLE_SLOT	10
+/* Address Device Command. */
+#define TRB_ADDR_DEV		11
+/* Configure Endpoint Command. */
+#define TRB_CONFIG_EP		12
+/* Evaluate Context Command. */
+#define TRB_EVAL_CONTEXT	13
+/* Reset Endpoint Command. */
+#define TRB_RESET_EP		14
+/* Stop Transfer Ring Command. */
+#define TRB_STOP_RING		15
+/* Set Transfer Ring Dequeue Pointer Command. */
+#define TRB_SET_DEQ		16
+/* Reset Device Command. */
+#define TRB_RESET_DEV		17
+/* Force Event Command (opt). */
+#define TRB_FORCE_EVENT		18
+/* Force Header Command - generate a transaction or link management

packet. */

drivers/usb/cdns3/cdnsp-gadget.h new file +28 -0
+#define TRB_FORCE_HEADER	22
+/* No-op Command - not for transfer rings. */
+#define TRB_CMD_NOOP		23
+/* TRB IDs 24-31 reserved. */
+
+/* Event TRBS. */
+/* Transfer Event. */
+#define TRB_TRANSFER		32
+/* Command Completion Event. */
+#define TRB_COMPLETION		33
+/* Port Status Change Event. */
+#define TRB_PORT_STATUS		34
+/* Device Controller Event. */
+#define TRB_HC_EVENT		37
+/* MFINDEX Wrap Event - microframe counter wrapped. */
+#define TRB_MFINDEX_WRAP	39
+/* TRB IDs 40-47 reserved. */
+/* Endpoint Not Ready Event. */
+#define TRB_ENDPOINT_NRDY	48
+/* TRB IDs 49-53 reserved. */
+/* Halt Endpoint Command. */
+#define TRB_HALT_ENDPOINT	54
+/* Doorbell Overflow Event. */
+#define TRB_DRB_OVERFLOW	57
+/* Flush Endpoint Command. */
+#define TRB_FLUSH_ENDPOINT	58
+
+#define TRB_TYPE_LINK(x)	(((x) & TRB_TYPE_BITMASK) ==

TRB_TYPE(TRB_LINK))
+#define TRB_TYPE_LINK_LE32(x) (((x) &
cpu_to_le32(TRB_TYPE_BITMASK)) == \

drivers/usb/cdns3/cdnsp-gadget.h new file +2 -0
+					cpu_to_le32(TRB_TYPE(TRB_LINK)))
+#define TRB_TYPE_NOOP_LE32(x)	(((x) &

cpu_to_le32(TRB_TYPE_BITMASK)) == \
+

	cpu_to_le32(TRB_TYPE(TRB_TR_NOOP)))
drivers/usb/cdns3/cdnsp-gadget.h new file +87 -0
+
+/*
+ * TRBS_PER_SEGMENT must be a multiple of 4.
+ * The command ring is 64-byte aligned, so it must also be greater than 16.
+ */
+#define TRBS_PER_SEGMENT		256
+#define TRBS_PER_EVENT_SEGMENT		256
+#define TRBS_PER_EV_DEQ_UPDATE		100
+#define TRB_SEGMENT_SIZE		(TRBS_PER_SEGMENT * 16)
+#define TRB_SEGMENT_SHIFT		(ilog2(TRB_SEGMENT_SIZE))
+/* TRB buffer pointers can't cross 64KB boundaries. */
+#define TRB_MAX_BUFF_SHIFT		16
+#define TRB_MAX_BUFF_SIZE		BIT(TRB_MAX_BUFF_SHIFT)
+/* How much data is left before the 64KB boundary? */
+#define TRB_BUFF_LEN_UP_TO_BOUNDARY(addr) (TRB_MAX_BUFF_SIZE - \
+					((addr) & (TRB_MAX_BUFF_SIZE - 1)))
+
+/**
+ * struct cdnsp_segment - segment related data.
+ * @trbs: Array of Transfer Request Blocks.
+ * @next: Pointer to the next segment.
+ * @dma: DMA address of current segment.
+ * @bounce_dma: Bounce  buffer DMA address .
+ * @bounce_buf: Bounce buffer virtual address.
+ * bounce_offs: Bounce buffer offset.
+ * bounce_len: Bounce buffer length.
+ */
+struct cdnsp_segment {
+	union cdnsp_trb *trbs;
+	struct cdnsp_segment *next;
+	dma_addr_t dma;
+	/* Max packet sized bounce buffer for td-fragmant alignment */
+	dma_addr_t bounce_dma;
+	void *bounce_buf;
+	unsigned int bounce_offs;
+	unsigned int bounce_len;
+};
+
+/**
+ * struct cdnsp_td - Transfer Descriptor object.
+ * @td_list: Used for binding TD with ep_ring->td_list.
+ * @preq: Request associated with this TD
+ * @start_seg: Segment containing the first_trb in TD.
+ * @first_trb: First TRB for this TD.
+ * @last_trb: Last TRB related with TD.
+ * @bounce_seg: Bounce segment for this TD.
+ * @request_length_set: actual_length of the request has already been set.
+ * @drbl - TD has been added to HW scheduler - only for stream capable
+ *         endpoints.
+ */
+struct cdnsp_td {
+	struct list_head td_list;
+	struct cdnsp_request *preq;
+	struct cdnsp_segment *start_seg;
+	union cdnsp_trb *first_trb;
+	union cdnsp_trb *last_trb;
+	struct cdnsp_segment *bounce_seg;
+	bool request_length_set;
+	bool drbl;
+};
+
+/**
+ * struct cdnsp_dequeue_state - New dequeue pointer for Transfer Ring.
+ * @new_deq_seg: New dequeue segment.
+ * @new_deq_ptr: New dequeue pointer.
+ * @new_cycle_state: New cycle state.
+ * @stream_id: stream id for which new dequeue pointer has been selected.
+ */
+struct cdnsp_dequeue_state {
+	struct cdnsp_segment *new_deq_seg;
+	union cdnsp_trb *new_deq_ptr;
+	int new_cycle_state;
+	unsigned int stream_id;
+};
+
+enum cdnsp_ring_type {
+	TYPE_CTRL = 0,
+	TYPE_ISOC,
+	TYPE_BULK,
+	TYPE_INTR,
+	TYPE_STREAM,
+	TYPE_COMMAND,
+	TYPE_EVENT,
+};
+
+/**
+ * struct cdnsp_ring - information describing transfer, command or event

ring.
+ * @first_seg: First segment on transfer ring.
+ * @last_seg: Last segment on transfer ring.
+ * @enqueue: SW enqueue pointer address.
+ * @enq_seg: SW enqueue segment address.
+ * @dequeue: SW dequeue pointer address.
+ * @deq_seg: SW dequeue segment address.
+ * @td_list: transfer descriptor list associated with this ring.
+ * @cycle_state: Current cycle bit. Write the cycle state into the TRB cycle

+ *               field to give ownership of the TRB to the device controller
+ *               (if we are the producer) or to check if we own the TRB
+ *               (if we are the consumer).

+ * @stream_id: Stream id
+ * @stream_active: Stream is active - PRIME packet has been detected.
+ * @stream_rejected: This ring has been rejected by host.
+ * @num_tds: Number of TDs associated with ring.
+ * @num_segs: Number of segments.
+ * @num_trbs_free: Number of free TRBs on the ring.
+ * @bounce_buf_len: Length of bounce buffer.
+ * @type: Ring type - event, transfer, or command ring.
+ * @last_td_was_short - TD is short TD.
+ * @trb_address_map: For mapping physical TRB addresses to segments in
+ * stream rings.
+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +47 -0
+struct cdnsp_ring {
+	struct cdnsp_segment *first_seg;
+	struct cdnsp_segment *last_seg;
+	union cdnsp_trb	 *enqueue;
+	struct cdnsp_segment *enq_seg;
+	union cdnsp_trb	 *dequeue;
+	struct cdnsp_segment *deq_seg;
+	struct list_head td_list;
+	u32 cycle_state;
+	unsigned int stream_id;
+	unsigned int stream_active;
+	unsigned int stream_rejected;
+	int num_tds;
+	unsigned int num_segs;
+	unsigned int num_trbs_free;
+	unsigned int bounce_buf_len;
+	enum cdnsp_ring_type type;
+	bool last_td_was_short;
+	struct radix_tree_root *trb_address_map;
+};
+
+/**
+ * struct cdnsp_erst_entry - even ring segment table entry object.
+ * @seg_addr: 64-bit event ring segment address.
+ * seg_size: Number of TRBs in segment.;
+ */
+struct cdnsp_erst_entry {
+	__le64 seg_addr;
+	__le32 seg_size;
+	/* Set to zero */
+	__le32 rsvd;
+};
+
+/**
+ * struct cdnsp_erst - even ring segment table for event ring.
+ * @entries: Array of event ring segments
+ * @num_entries: Number of segments in entries array.
+ * @erst_dma_addr: DMA address for entries array.
+ */
+struct cdnsp_erst {
+	struct cdnsp_erst_entry *entries;
+	unsigned int num_entries;
+	dma_addr_t erst_dma_addr;
+};
+
+/**
+ * struct cdnsp_request - extended device side representation of

usb_request
+ * object .
+ * @td: Transfer descriptor associated with this request.
+ * @request: Generic usb_request object describing single I/O request.
+ * @list: Used to adding request to endpoint pending_list.
+ * @pep: Extended representation of usb_ep object
+ * @epnum: Endpoint number associated with usb request.
+ * @direction: Endpoint direction for usb request.
+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +70 -0
+struct cdnsp_request {
+	struct	cdnsp_td td;
+	struct usb_request request;
+	struct list_head list;
+	struct cdnsp_ep	 *pep;
+	u8 epnum;
+	unsigned direction:1;
+};
+
+#define	ERST_NUM_SEGS	1
+
+/* Stages used during enumeration process.*/
+enum cdnsp_ep0_stage {
+	CDNSP_SETUP_STAGE,
+	CDNSP_DATA_STAGE,
+	CDNSP_STATUS_STAGE,
+};
+
+/**
+ * struct cdnsp_port - holds information about detected ports.
+ * @port_num: Port number.
+ * @exist: Indicate if port exist.
+ * maj_rev: Major revision.
+ * min_rev: Minor revision.
+ */
+struct cdnsp_port {
+	struct cdnsp_port_regs __iomem *regs;
+	u8 port_num;
+	u8 exist;
+	u8 maj_rev;
+	u8 min_rev;
+};
+
+#define CDNSP_EXT_PORT_MAJOR(x)		(((x) >> 24) & 0xff)
+#define CDNSP_EXT_PORT_MINOR(x)		(((x) >> 16) & 0xff)
+#define CDNSP_EXT_PORT_OFF(x)		((x) & 0xff)
+#define CDNSP_EXT_PORT_COUNT(x)		(((x) >> 8) & 0xff)
+
+/**
+ * struct cdnsp_device - represent USB device.
+ * @dev: Pointer to device structure associated whit this controller.
+ * @gadget: Device side representation of the peripheral controller.
+ * @gadget_driver: Pointer to the gadget driver.
+ * @irq: IRQ line number used by device side.
+ * @regs:IO device memory.
+ * @cap_regs: Capability registers.
+ * @op_regs: Operational registers.
+ * @run_regs: Runtime registers.
+ * @dba: Device base address register.
+ * @ir_set: Current interrupter register set.
+ * @port20_regs: Port 2.0 Peripheral Configuration Registers.
+ * @port3x_regs: USB3.x Port Peripheral Configuration Registers.
+ * @hcs_params1: Cached register copies of read-only HCSPARAMS1
+ * @hcc_params: Cached register copies of read-only HCCPARAMS1
+ * @rev_cap: Controller capability.
+ * @setup: Temporary buffer for setup packet.
+ * @ep0_preq: Internal allocated request used during enumeration.
+ * @ep0_stage: ep0 stage during enumeration process.
+ * @three_stage_setup: Three state or two state setup.
+ * @ep0_expect_in: Data IN expected for control transfer.
+ * @setup_id: Setup identifier.
+ * @setup_speed - Speed detected for current SETUP packet.
+ * @setup_buf: Buffer for SETUP packet.
+ * @device_address: Current device address.
+ * @may_wakeup: remote wakeup enabled/disabled.
+ * @lock: Lock used in interrupt thread context.
+ * @hci_version: device controller version.
+ * @dcbaa: Device context base address array.
+ * @cmd_ring: Command ring.
+ * @cmd: Represent all what is needed to issue command on Command

Ring.
+ * @event_ring: Event ring.
+ * @erst: Event Ring Segment table
+ * @slot_id: Current Slot ID. Should be 0 or 1.
+ * @out_ctx: Output context.
+ * @in_ctx: Input context.
+ * @eps: array of endpoints object associated with device.
+ * @usb2_hw_lpm_capable: hardware lpm is enabled;
+ * @u1_allowed: Allow device transition to U1 state.
+ * @u2_allowed: Allow device transition to U2 state
+ * @device_pool: DMA pool for allocating input and output context.
+ * @segment_pool: DMA pool for allocating new segments.
+ * @cdnsp_state: Current state of controller.
+ * @link_state: Current link state.
+ * @usb2_port - Port USB 2.0.
+ * @usb3_port - Port USB 3.0.
+ * @active_port - Current selected Port.
+ * @test_mode: selected Test Mode.
+ */

drivers/usb/cdns3/cdnsp-gadget.h new file +74 -1
+struct cdnsp_device {
+	struct device *dev;
+	struct usb_gadget gadget;
+	struct usb_gadget_driver *gadget_driver;
+	unsigned int irq;
+	void __iomem *regs;
+
+	/* Registers map */
+	struct cdnsp_cap_regs __iomem *cap_regs;
+	struct cdnsp_op_regs __iomem *op_regs;
+	struct cdnsp_run_regs __iomem *run_regs;
+	struct cdnsp_doorbell_array __iomem *dba;
+	struct	cdnsp_intr_reg __iomem *ir_set;
+	struct cdnsp_20port_cap __iomem *port20_regs;
+	struct cdnsp_3xport_cap __iomem *port3x_regs;
+
+	/* Cached register copies of read-only CDNSP data */
+	__u32 hcs_params1;
+	__u32 hcs_params3;
+	__u32 hcc_params;
+	struct cdnsp_rev_cap rev_cap;
+	/* Lock used in interrupt thread context. */
+	spinlock_t lock;
+	struct usb_ctrlrequest setup;
+	struct cdnsp_request ep0_preq;
+	enum cdnsp_ep0_stage ep0_stage;
+	u8 three_stage_setup;
+	u8 ep0_expect_in;
+	u8 setup_id;
+	u8 setup_speed;
+	void *setup_buf;
+	u8 device_address;
+	int may_wakeup;
+	u16 hci_version;
+
+	/* data structures */
+	struct cdnsp_device_context_array *dcbaa;
+	struct cdnsp_ring *cmd_ring;
+	struct cdnsp_command cmd;
+	struct cdnsp_ring *event_ring;
+	struct cdnsp_erst erst;
+	int slot_id;
+
+	/*
+	 * Commands to the hardware are passed an "input context" that
+	 * tells the hardware what to change in its data structures.
+	 * The hardware will return changes in an "output context" that
+	 * software must allocate for the hardware. .
+	 */
+	struct cdnsp_container_ctx out_ctx;
+	struct cdnsp_container_ctx in_ctx;
+	struct cdnsp_ep eps[CDNSP_ENDPOINTS_NUM];
+	u8 usb2_hw_lpm_capable:1;
+	u8 u1_allowed:1;
+	u8 u2_allowed:1;
+
+	/* DMA pools */
+	struct dma_pool *device_pool;
+	struct dma_pool	*segment_pool;
+
+#define CDNSP_STATE_HALTED		BIT(1)
+#define CDNSP_STATE_DYING		BIT(2)
+#define CDNSP_STATE_DISCONNECT_PENDING	BIT(3)
+#define CDNSP_WAKEUP_PENDING		BIT(4)
+	unsigned int cdnsp_state;
+	unsigned int link_state;
+
+	struct cdnsp_port usb2_port;
+	struct cdnsp_port usb3_port;
+	struct cdnsp_port *active_port;
+	u16 test_mode;
+};
+
+#endif /* __LINUX_CDNSP_GADGET_H */
--

2.40.1

author maintainer
#56 lore raw

Re: [PATCH 5.10 054/135] usb: cdnsp: Device side header file for CDNSP driver

Quoted 5 lines · Pawel Laszczak

Hi Greg,

I don't understand why this is queued for 5.10 stable version.

Driver has been upstreamed into 5.12 version.

Which specific driver? cdns3 is in 5.10

Quoted 7 lines
Quoted 7 lines

Because the size of main patch is very big, I’ve decided to create separate patch for cdnsp-gadget.h. It should simplify reviewing the code.

Stable-dep-of: dbe678f6192f ("usb: cdns3: fix NCM gadget RX speed 20x slow than expection at iMX8QM")

The patch was taken as a dependancy of this commit, which is fixing an issue for the change that went into 5.4, which is in 5.10.y.

Maybe the dependancy checker got this incorrect, let me go see...

thanks,

greg k-h

author maintainer
#57 lore raw

Re: [PATCH 5.10 054/135] usb: cdnsp: Device side header file for CDNSP driver

Quoted 17 lines · Greg Kroah-Hartman
Quoted 5 lines · Pawel Laszczak

Hi Greg,

I don't understand why this is queued for 5.10 stable version.

Driver has been upstreamed into 5.12 version.

Which specific driver? cdns3 is in 5.10

Quoted 7 lines
Quoted 7 lines

Because the size of main patch is very big, I’ve decided to create separate patch for cdnsp-gadget.h. It should simplify reviewing the code.

Stable-dep-of: dbe678f6192f ("usb: cdns3: fix NCM gadget RX speed 20x slow than expection at iMX8QM")

Quoted 4 lines

The patch was taken as a dependancy of this commit, which is fixing an issue for the change that went into 5.4, which is in 5.10.y.

Maybe the dependancy checker got this incorrect, let me go see...

Yes, the checker got this wrong, it wasn't needed at all, thanks for pointing it out. I've dropped this from the queue now.

thanks,

greg k-h

author maintainer
#71 lore raw

Re: [PATCH 5.10 066/135] net/ncsi: change from ndo_set_mac_address to dev_set_mac_address

In reply to Ivan Mikhaylov
Quoted 66 lines · Ivan Mikhaylov
Quoted 52 lines · Greg Kroah-Hartman

5.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ivan Mikhaylov <[email protected]>

[ Upstream commit 790071347a0a1a89e618eedcd51c687ea783aeb3 ]

Change ndo_set_mac_address to dev_set_mac_address because dev_set_mac_address provides a way to notify network layer about MAC change. In other case, services may not aware about MAC change and keep
using old one which set from network adapter driver.

As example, DHCP client from systemd do not update MAC address without
notification from net subsystem which leads to the problem with acquiring
the right address from DHCP server.

Fixes cb10c7c0dfd9e ("net/ncsi: Add NCSI Broadcom OEM command")
Cc [email protected] # v6.0+ 2f38e84 net/ncsi: make one oem_gma

function for all mfr id

---
 net/ncsi/ncsi-rsp.c | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)
net/ncsi/ncsi-rsp.c +0 -1
index 888ccc2d4e34b..47ffb790ff99f 100644
@@ -616,7 +616,6 @@ static int ncsi_rsp_handler_oem_mlx_gma(struct
 ncsi_request *nr)
  {
         struct ncsi_dev_priv *ndp = nr->ndp;
         struct net_device *ndev = ndp->ndev.dev;
-       const struct net_device_ops *ops = ndev->netdev_ops;
         struct ncsi_rsp_oem_pkt *rsp;
         struct sockaddr saddr;

        int ret = 0;

net/ncsi/ncsi-rsp.c +0 -0
@@ -630,7 +629,9 @@ static int ncsi_rsp_handler_oem_mlx_gma(struct
 ncsi_request *nr)
         /* Set the flag for GMA command which should only be called

once */
        ndp->gma_flag = 1;

Quoted 8 lines

-       ret = ops->ndo_set_mac_address(ndev, &saddr); +       rtnl_lock();
+       ret = dev_set_mac_address(ndev, &saddr, NULL); +       rtnl_unlock();
        if (ret < 0)
                netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n");

Greg, we had conversation in the past about this particular patchset series:
https://www.spinics.net/lists/stable-commits/msg308587.html

Quoted 4 lines

Just one patch is not enough, I didn't test it either on linux kernel version < 6.0 , also I saw the Sasha's commits about the same for 5.4, 5.10, 5.15 and answered to him about necessity of two patchsets instead of one on 19 aug.

Ah, so I should also include commit 74b449b98dcc ("net/ncsi: make one oem_gma function for all mfr id"), right?

thanks,

greg k-h

#72 lore raw

Re: [PATCH 5.10 066/135] net/ncsi: change from ndo_set_mac_address to dev_set_mac_address

Quoted 83 lines · Greg Kroah-Hartman
Quoted 74 lines · Ivan Mikhaylov
Quoted 59 lines · Greg Kroah-Hartman

5.10-stable review patch.  If anyone has any objections, please let
me know.

------------------

From: Ivan Mikhaylov <[email protected]>

[ Upstream commit 790071347a0a1a89e618eedcd51c687ea783aeb3 ]

Change ndo_set_mac_address to dev_set_mac_address because dev_set_mac_address provides a way to notify network layer about MAC
change. In other case, services may not aware about MAC change and
keep
using old one which set from network adapter driver.

As example, DHCP client from systemd do not update MAC address without
notification from net subsystem which leads to the problem with acquiring
the right address from DHCP server.

Fixes cb10c7c0dfd9e ("net/ncsi: Add NCSI Broadcom OEM command")
Cc [email protected] # v6.0+ 2f38e84 net/ncsi: make one

oem_gma
function for all mfr id

---
 net/ncsi/ncsi-rsp.c | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)
net/ncsi/ncsi-rsp.c +0 -0
index 888ccc2d4e34b..47ffb790ff99f 100644
@@ -616,7 +616,6 @@ static int

ncsi_rsp_handler_oem_mlx_gma(struct
ncsi_request *nr)
 {
        struct ncsi_dev_priv *ndp = nr->ndp; struct net_device *ndev = ndp->ndev.dev;
-       const struct net_device_ops *ops = ndev->netdev_ops; struct ncsi_rsp_oem_pkt *rsp;
        struct sockaddr saddr;
        int ret = 0;

net/ncsi/ncsi-rsp.c +0 -0
@@ -630,7 +629,9 @@ static int

ncsi_rsp_handler_oem_mlx_gma(struct
ncsi_request *nr)
        /* Set the flag for GMA command which should only be called
once */
        ndp->gma_flag = 1;

Quoted 8 lines

-       ret = ops->ndo_set_mac_address(ndev, &saddr); +       rtnl_lock();
+       ret = dev_set_mac_address(ndev, &saddr, NULL); +       rtnl_unlock();
        if (ret < 0)
                netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n");

Greg, we had conversation in the past about this particular patchset
series:
https://www.spinics.net/lists/stable-commits/msg308587.html

Quoted 7 lines

Just one patch is not enough, I didn't test it either on linux kernel
version < 6.0 , also I saw the Sasha's commits about the same for 5.4,
5.10, 5.15 and answered to him about necessity of two patchsets instead
of one on 19 aug.

Quoted 6 lines

Ah, so I should also include commit 74b449b98dcc ("net/ncsi: make one oem_gma function for all mfr id"), right?

thanks,

greg k-h

Greg, yes, that's right and I'm not sure if these two patches applies well for 5.x stable releases.

Thanks.

#149 lore raw
In reply to Greg Kroah-Hartman
Quoted 10 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
        https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.192-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

thanks,

greg k-h

The same test regressions found on stable-rc linux.5.10.y as reported on stable-rc linux.6.1.y and linux.5.15.y branch. LTP syscalls chown02 and fchown02 fails on arm64 Rpi4 device with the NFS rootfile system.

Test log:
--------
chown02.c:46: TPASS: chown(testfile1, 0, 0) passed
chown02.c:46: TPASS: chown(testfile2, 0, 0) passed
chown02.c:58: TFAIL: testfile2: wrong mode permissions 0100700, expected 0102700

fchown02.c:57: TPASS: fchown(3, 0, 0) passed fchown02.c:57: TPASS: fchown(4, 0, 0) passed fchown02.c:67: TFAIL: testfile2: wrong mode permissions 0100700, expected 0102700

NOTE:
Do we need a backport for this patch ?

nfsd: use vfs setgid helper

    commit 2d8ae8c417db284f598dffb178cc01e7db0f1821 upstream.

## Build
* kernel: 5.10.191-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.10.y
* git commit: da59b7b5c515edab9a57efd37b031b5b97e6c1cc
* git describe: v5.10.190-136-gda59b7b5c515
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.190-136-gda59b7b5c515

## Test Regressions (compared to v5.10.191)
* bcm2711-rpi-4-b, ltp-syscalls
- chown02
- fchown02

* bcm2711-rpi-4-b-clang, ltp-syscalls
- chown02
- fchown02

--
Linaro LKFT
https://lkft.linaro.org

Tested-by Sudip Mukherjee on the v1 series
#150 lore raw
In reply to Greg Kroah-Hartman

Hi Greg,

Quoted 7 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

Build test (gcc version 11.4.1 20230625):
mips: 63 configs -> 3 failures
arm: 104 configs -> no failure
arm64: 3 configs -> no failure
x86_64: 4 configs -> no failure alpha allmodconfig -> no failure powerpc allmodconfig -> no failure riscv allmodconfig -> no failure s390 allmodconfig -> no failure xtensa allmodconfig -> no failure

Note:

mips db1xxx_defconfig, gpr_defconfig and mtx1_defconfig failed to build:

rch/mips/alchemy/common/dbdma.c: In function 'au1xxx_dbdma_put_source':
arch/mips/alchemy/common/dbdma.c:632:14: error: 'dma_default_coherent' undeclared (first use in this function); did you mean 'dma_free_coherent'?

  632 |         if (!dma_default_coherent)
      |              ^~~~~~~~~~~~~~~~~~~~
      |              dma_free_coherent
arch/mips/alchemy/common/dbdma.c:632:14: note: each undeclared identifier is reported only once for each function it appears in
arch/mips/alchemy/common/dbdma.c: In function 'au1xxx_dbdma_put_dest':
arch/mips/alchemy/common/dbdma.c:695:14: error: 'dma_default_coherent' undeclared (first use in this function); did you mean 'dma_free_coherent'?
  695 |         if (!dma_default_coherent)
      |              ^~~~~~~~~~~~~~~~~~~~
      |              dma_free_coherent

Boot test:
x86_64: Booted on my test laptop. No regression.
x86_64: Booted on qemu. No regression. [1]
arm64: Booted on rpi4b (4GB model). No regression. [2]

[1]. https://openqa.qa.codethink.co.uk/tests/4779
[2]. https://openqa.qa.codethink.co.uk/tests/4780

Signature · 2 lines
Regards
Sudip
maintainer Tested-by on the v1 series
#151 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.192-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

thanks,

greg k-h

All tests passing for Tegra ...

Test results for stable-v5.10:

    11 builds:	11 pass, 0 fail
    28 boots:	28 pass, 0 fail
    75 tests:	75 pass, 0 fail

Linux version: 5.10.192-rc1-g78bdf347b342
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,

                tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
                tegra20-ventana, tegra210-p2371-2180,
                tegra210-p3450-0000, tegra30-cardhu-a04

Jon

Tested-by Linux Kernel Functional Testing on the v1 series
#152 lore raw
In reply to Greg Kroah-Hartman
Quoted 10 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
        https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.192-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

thanks,

greg k-h

Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.

NOTE:
1)
LTP syscalls chown02 and fchown02 test failures on NFS mounted filesystem on arm64 Rpi4 will be investigated further.

## Build
* kernel: 5.10.191-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.10.y
* git commit: da59b7b5c515edab9a57efd37b031b5b97e6c1cc
* git describe: v5.10.190-136-gda59b7b5c515
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.190-136-gda59b7b5c515

## Test Regressions (compared to v5.10.191)

## Metric Regressions (compared to v5.10.191)

## Test Fixes (compared to v5.10.191)

## Metric Fixes (compared to v5.10.191)

## Test result summary
total: 98769, pass: 80650, fail: 1588, skip: 16473, xfail: 58

## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 116 total, 116 passed, 0 failed
* arm64: 43 total, 43 passed, 0 failed
* i386: 34 total, 34 passed, 0 failed
* mips: 27 total, 26 passed, 1 failed
* parisc: 4 total, 0 passed, 4 failed
* powerpc: 26 total, 25 passed, 1 failed
* riscv: 12 total, 11 passed, 1 failed
* s390: 12 total, 12 passed, 0 failed
* sh: 14 total, 12 passed, 2 failed
* sparc: 8 total, 8 passed, 0 failed
* x86_64: 36 total, 36 passed, 0 failed

## Test suites summary
* boot
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timens
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-user_events
* kselftest-vDSO
* kselftest-vm
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
* v4l2-compliance

--
Linaro LKFT
https://lkft.linaro.org

#153 lore raw
In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

Testing is not complete, but early feedback: All riscv32 boot tests crash badly with errors such as

Starting syslogd: OK
Starting klogd: OK
/etc/init.d/S02sysctl: line 68: syntax error: EOF in backquote substitution /etc/init.d/S20seedrng: line 33: syntax error: unexpected end of file (expecting ";;") Starting network: /bin/sh: syntax error: unterminated quoted string
sed: unmatched '/'
/bin/sh: syntax error: unterminated quoted string
FAIL
/etc/init.d/S55runtest: line 48: syntax error: EOF in backquote substitution

This is no longer seen after reverting the following patches.

92609bb3a1f8 riscv: uaccess: Return the number of bytes effectively not copied e06648704417 riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit
20704d763646 riscv: lib: uaccess: fold fixups into body
4f503bad920e riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall

Guenter

#157 lore raw
In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

Build results:

	total: 159 pass: 159 fail: 0
Qemu test results:
	total: 487 pass: 469 fail: 18
Failed tests:
	<all riscv32>

As already reported, all riscv32 boot tests fail. The failure is no longer seen after reverting the riscv specific patches.

Guenter

Tested-by on the v1 series
#158 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 9 lines
	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.192-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

thanks,

greg k-h

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

Tested-by Hulk Robot on the v1 series
#159 lore raw
In reply to Greg Kroah-Hartman

Tested on arm64 and x86 for 5.10.192-rc1,

Kernel repo:https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Branch: linux-5.10.y
Version: 5.10.192-rc1
Commit: 78bdf347b342992291284fd060ee34dbccf570a8
Compiler: gcc version 7.3.0 (GCC)

arm64:
--------------------------------------------------------------------
Testcase Result Summary:
total: 8978
passed: 8978
failed: 0
timeout: 0
--------------------------------------------------------------------

x86:
--------------------------------------------------------------------
Testcase Result Summary:
total: 8978
passed: 8978
failed: 0
timeout: 0
--------------------------------------------------------------------

Quoted 569 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.192-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <[email protected]>

     Linux 5.10.192-rc1

Borislav Petkov (AMD) <[email protected]>
x86/srso: Correct the mitigation status when SMT is disabled

Peter Zijlstra <[email protected]>
objtool/x86: Fixup frame-pointer vs rethunk

Petr Pavlu <[email protected]>
x86/retpoline,kprobes: Fix position of thunk sections with CONFIG_LTO_CLANG

Borislav Petkov (AMD) <[email protected]>
x86/srso: Disable the mitigation on unaffected configurations

Borislav Petkov (AMD) <[email protected]>
x86/CPU/AMD: Fix the DIV(0) initial fix attempt

Sean Christopherson <[email protected]>
x86/retpoline: Don't clobber RFLAGS during srso_safe_ret()

Peter Zijlstra <[email protected]>

     x86/static_call: Fix __static_call_fixup()

Borislav Petkov (AMD) <[email protected]>
x86/srso: Explain the untraining sequences a bit more

Peter Zijlstra <[email protected]>
x86/cpu: Cleanup the untrain mess

Peter Zijlstra <[email protected]>

     x86/cpu: Rename srso_(.*)_alias to srso_alias_\1

Peter Zijlstra <[email protected]>
x86/cpu: Rename original retbleed methods

Peter Zijlstra <[email protected]>
x86/cpu: Clean up SRSO return thunk mess

Peter Zijlstra <[email protected]>
x86/ibt: Add ANNOTATE_NOENDBR

Josh Poimboeuf <[email protected]>
objtool: Add frame-pointer-specific function ignore

Peter Zijlstra <[email protected]>
x86/alternative: Make custom return thunk unconditional

Peter Zijlstra <[email protected]>

     x86/cpu: Fix up srso_safe_ret() and __x86_return_thunk()

Peter Zijlstra <[email protected]>
x86/cpu: Fix __x86_return_thunk symbol type

Yangtao Li <[email protected]>
mmc: f-sdh30: fix order of function calls in sdhci_f_sdh30_remove

Jason Xing <[email protected]>
net: fix the RTO timer retransmitting skb every 1ms if linear option is enabled

Jason Wang <[email protected]>
virtio-net: set queues after driver_ok

Kuniyuki Iwashima <[email protected]>
af_unix: Fix null-ptr-deref in unix_stream_sendpage().

Xin Long <[email protected]>
netfilter: set default timeout to 3 secs for sctp shutdown send and recv state

Yibin Ding <[email protected]>
mmc: block: Fix in_flight[issue_type] value error

Yang Yingliang <[email protected]>
mmc: wbsd: fix double mmc_free_host() in wbsd_init()

Russell Harmon via samba-technical <[email protected]>
cifs: Release folio lock on fscache read hit.

dengxiang <[email protected]>
ALSA: usb-audio: Add support for Mythware XA001AU capture and playback interfaces.

Tony Lindgren <[email protected]>

     serial: 8250: Fix oops for port->pm on uart_change_pm()

Alexandre Ghiti <[email protected]>
riscv: uaccess: Return the number of bytes effectively not copied

Chen Lifu <[email protected]>
riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit

Jisheng Zhang <[email protected]>
riscv: lib: uaccess: fold fixups into body

Akira Tsukamoto <[email protected]>
riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall

Kailang Yang <[email protected]>
ALSA: hda/realtek - Remodified 3k pull low procedure

Jerome Brunet <[email protected]>
ASoC: meson: axg-tdm-formatter: fix channel slot allocation

Zhang Shurong <[email protected]>
ASoC: rt5665: add missed regulator_bulk_disable

Christopher Obbard <[email protected]>
arm64: dts: rockchip: Disable HS400 for eMMC on ROCK Pi 4

FUKAUMI Naoki <[email protected]>
arm64: dts: rockchip: sort nodes/properties on rk3399-rock-4

FUKAUMI Naoki <[email protected]>
arm64: dts: rockchip: fix regulator name on rk3399-rock-4

Alex Bee <[email protected]>
arm64: dts: rockchip: add SPDIF node for ROCK Pi 4

Alex Bee <[email protected]>
arm64: dts: rockchip: add ES8316 codec for ROCK Pi 4

Vicente Bergas <[email protected]>
arm64: dts: rockchip: use USB host by default on rk3399-rock-pi-4

Vicente Bergas <[email protected]>
arm64: dts: rockchip: fix supplies on rk3399-rock-pi-4

Tony Lindgren <[email protected]>
bus: ti-sysc: Flush posted write on enable before reset

Eric Dumazet <[email protected]>
net: do not allow gso_size to be set to GSO_BY_FRAGS

Abel Wu <[email protected]>
sock: Fix misuse of sk_under_memory_pressure()

Alfred Lee <[email protected]>
net: dsa: mv88e6xxx: Wait for EEPROM done before HW reset

Andrii Staikov <[email protected]>
i40e: fix misleading debug logs

Ziyang Xuan <[email protected]>
team: Fix incorrect deletion of ETH_P_8021AD protocol vid from slaves

Justin Chen <[email protected]>
net: phy: broadcom: stub c45 read/write for 54810

Pablo Neira Ayuso <[email protected]>
netfilter: nft_dynset: disallow object maps

Sishuai Gong <[email protected]>
ipvs: fix racy memcpy in proc_do_sync_threshold

Luca Ceresoli <[email protected]>
drm/panel: simple: Fix AUO G121EAN01 panel timings according to the docs

Petr Machata <[email protected]>
selftests: mirror_gre_changes: Tighten up the TTL test match

Lin Ma <[email protected]>
xfrm: add forgotten nla_policy for XFRMA_MTIMER_THRESH

Lin Ma <[email protected]>
xfrm: add NULL check in xfrm_update_ae_params

Zhengchao Shao <[email protected]>
ip_vti: fix potential slab-use-after-free in decode_session6

Zhengchao Shao <[email protected]>
ip6_vti: fix slab-use-after-free in decode_session6

Zhengchao Shao <[email protected]>
xfrm: fix slab-use-after-free in decode_session6

Lin Ma <[email protected]>
net: xfrm: Amend XFRMA_SEC_CTX nla_policy structure

Lin Ma <[email protected]>
net: af_key: fix sadb_x_filter validation

Lin Ma <[email protected]>
net: xfrm: Fix xfrm_address_filter OOB read

Tam Nguyen <[email protected]>
i2c: designware: Handle invalid SMBus block data response length value

xiaoshoukui <[email protected]>
btrfs: fix BUG_ON condition in btrfs_cancel_balance

Sherry Sun <[email protected]>
tty: serial: fsl_lpuart: Clear the error flags by writing 1 for lpuart32 platforms

Yi Yang <[email protected]>
tty: n_gsm: fix the UAF caused by race condition in gsm_cleanup_mux

Nathan Lynch <[email protected]>
powerpc/rtas_flash: allow user copy to flash block cache objects

Yuanjun Gong <[email protected]>
fbdev: mmp: fix value check in mmphw_probe()

Chengfeng Ye <[email protected]>
i2c: bcm-iproc: Fix bcm_iproc_i2c_isr deadlock issue

Wolfram Sang <[email protected]>
virtio-mmio: don't break lifecycle of vm_dev

Tang Bin <[email protected]>
virtio-mmio: Use to_virtio_mmio_device() to simply code

Ivan Mikhaylov <[email protected]>
net/ncsi: change from ndo_set_mac_address to dev_set_mac_address

Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Fix to update dynamic data counter if fetcharg uses it

Steven Rostedt (VMware) <[email protected]>
tracing/probes: Have process_fetch_insn() take a void * instead of pt_regs

Sergey Shtylyov <[email protected]>
mmc: meson-gx: fix deferred probing

Heiner Kallweit <[email protected]>
mmc: meson-gx: use devm_mmc_alloc_host

Heiner Kallweit <[email protected]>
mmc: core: add devm_mmc_alloc_host

Sergey Shtylyov <[email protected]>
mmc: sunxi: fix deferred probing

Sergey Shtylyov <[email protected]>
mmc: bcm2835: fix deferred probing

Johan Hovold <[email protected]>
USB: dwc3: qcom: fix NULL-deref on suspend

Frank Li <[email protected]>

     usb: cdns3: fix NCM gadget RX speed 20x slow than expection at iMX8QM

Frank Li <[email protected]>
usb: cdns3: allocate TX FIFO size according to composite EP number

Wesley Cheng <[email protected]>
usb: gadget: udc: core: Introduce check_config to verify USB configuration

Pawel Laszczak <[email protected]>
usb: cdnsp: Device side header file for CDNSP driver

Jiaxun Yang <[email protected]>
irqchip/mips-gic: Use raw spinlock for gic_lock

Marc Zyngier <[email protected]>
irqchip/mips-gic: Get rid of the reliance on irq_cpu_online()

Jeffrey Hugo <[email protected]>
bus: mhi: host: Range check CHDBOFF and ERDBOFF

Manivannan Sadhasivam <[email protected]>
bus: mhi: Move host MHI code to "host" directory

Bhaumik Bhatt <[email protected]>
bus: mhi: Add MMIO region length to controller structure

Loic Poulain <[email protected]>
bus: mhi: Add MHI PCI support for WWAN modems

William Breathitt Gray <[email protected]>
iio: addac: stx104: Fix race condition when converting analog-to-digital

William Breathitt Gray <[email protected]>
iio: addac: stx104: Fix race condition for stx104_write_raw()

William Breathitt Gray <[email protected]>
iio: adc: stx104: Implement and utilize register structures

William Breathitt Gray <[email protected]>
iio: adc: stx104: Utilize iomap interface

Cosmin Tanislav <[email protected]>

     dt-bindings: iio: add AD74413R

Cosmin Tanislav <[email protected]>
iio: add addac subdirectory

Randy Dunlap <[email protected]>
IMA: allow/fix UML builds

Chen Lin <[email protected]>
ring-buffer: Do not swap cpu_buffer during resize process

Benjamin Gray <[email protected]>
powerpc/kasan: Disable KCOV in KASAN code

Tuo Li <[email protected]>
ALSA: hda: fix a possible null-pointer dereference due to data race in snd_hdac_regmap_sync()

dengxiang <[email protected]>
ALSA: hda/realtek: Add quirks for Unis H3C Desktop B760 & Q760

shanzhulig <[email protected]>
drm/amdgpu: Fix potential fence use-after-free v2

Matthew Anderson <[email protected]>
Bluetooth: btusb: Add MT7922 bluetooth ID for the Asus Ally

Zhengping Jiang <[email protected]>
Bluetooth: L2CAP: Fix use-after-free

Armin Wolf <[email protected]>
pcmcia: rsrc_nonstatic: Fix memory leak in nonstatic_release_resource_db()

Tuo Li <[email protected]>
gfs2: Fix possible data races in gfs2_show_options()

Xu Yang <[email protected]>
usb: chipidea: imx: add missing USB PHY DPDM wakeup setting

Xu Yang <[email protected]>
usb: chipidea: imx: don't request QoS for imx8ulp

Hans Verkuil <[email protected]>
media: platform: mediatek: vpu: fix NULL ptr dereference

Prashanth K <[email protected]>
usb: gadget: u_serial: Avoid spinlock recursion in __gs_console_push

Yunfei Dong <[email protected]>
media: v4l2-mem2mem: add lock to protect parameter num_rdy

Immad Mir <[email protected]>
FS: JFS: Check for read-only mounted filesystem in txBegin

Immad Mir <[email protected]>
FS: JFS: Fix null-ptr-deref Read in txBegin

Gustavo A. R. Silva <[email protected]>
MIPS: dec: prom: Address -Warray-bounds warning

Yogesh <[email protected]>
fs: jfs: Fix UBSAN: array-index-out-of-bounds in dbAllocDmapLev

Jan Kara <[email protected]>
udf: Fix uninitialized array access for some pathnames

Christian Brauner <[email protected]>
ovl: check type and offset of struct vfsmount in ovl_entry

Patrisious Haddad <[email protected]>
RDMA/mlx5: Return the firmware result upon destroying QP/RQ

Marco Morandini <[email protected]>
HID: add quirk for 03f0:464a HP Elite Presenter Mouse

Lang Yu <[email protected]>
drm/amdgpu: install stub fence into potential unused fence pointers

gaoxu <[email protected]>
dma-remap: use kvmalloc_array/kvfree for larger dma memory remap

Ye Bin <[email protected]>
quota: fix warning in dqgrab()

Jan Kara <[email protected]>
quota: Properly disable quotas when add_dquot_ref() fails

Geert Uytterhoeven <[email protected]>
iopoll: Call cpu_relax() in busy loops

Uday M Bhat <[email protected]>
ASoC: Intel: sof_sdw: Add support for Rex soundwire

Oleksij Rempel <[email protected]>
ARM: dts: imx6dl: prtrvt, prtvt7, prti6q, prtwd2: fix USB related warnings

Sumit Gupta <[email protected]>
PCI: tegra194: Fix possible array out of bounds access

Peter Ujfalusi <[email protected]>
ASoC: Intel: sof_sdw: add quirk for LNL RVP

Bard Liao <[email protected]>
ASoC: Intel: sof_sdw: add quirk for MTL RVP

Oswald Buddenhagen <[email protected]>
ALSA: emu10k1: roll up loops in DSP setup code for Audigy

hackyzh002 <[email protected]>
drm/radeon: Fix integer overflow in radeon_cs_parser_init

Moshe Shemesh <[email protected]>
net/mlx5: Skip clock update work when device is in error state

Eran Ben Elisha <[email protected]>
net/mlx5: Move all internal timer metadata into a dedicated struct

Eran Ben Elisha <[email protected]>
net/mlx5: Refactor init clock function

Eric Dumazet <[email protected]>
macsec: use DEV_STATS_INC()

Clayton Yager <[email protected]>
macsec: Fix traffic counters/statistics

Kunihiko Hayashi <[email protected]>
mmc: sdhci-f-sdh30: Replace with sdhci_pltfm

-------------

Diffstat:

  Documentation/admin-guide/hw-vuln/srso.rst         |    4 +-
  .../bindings/iio/addac/adi,ad74413r.yaml           |  158 +++
  Makefile                                           |    4 +-
  arch/arm/boot/dts/imx6dl-prtrvt.dts                |    4 +
  arch/arm/boot/dts/imx6qdl-prti6q.dtsi              |   11 +-
  arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi |  207 +--
  arch/mips/include/asm/dec/prom.h                   |    2 +-
  arch/powerpc/kernel/rtas_flash.c                   |    6 +-
  arch/powerpc/mm/kasan/Makefile                     |    1 +
  arch/riscv/lib/uaccess.S                           |  212 ++-
  arch/x86/include/asm/entry-common.h                |    1 +
  arch/x86/include/asm/nospec-branch.h               |   28 +-
  arch/x86/kernel/cpu/amd.c                          |    1 +
  arch/x86/kernel/cpu/bugs.c                         |   28 +-
  arch/x86/kernel/static_call.c                      |   13 +
  arch/x86/kernel/traps.c                            |    2 -
  arch/x86/kernel/vmlinux.lds.S                      |   18 +-
  arch/x86/kvm/svm/svm.c                             |    1 +
  arch/x86/lib/retpoline.S                           |  141 +-
  drivers/bluetooth/btusb.c                          |    3 +
  drivers/bus/Makefile                               |    2 +-
  drivers/bus/mhi/Kconfig                            |   18 +-
  drivers/bus/mhi/Makefile                           |    4 +-
  drivers/bus/mhi/host/Kconfig                       |   31 +
  drivers/bus/mhi/{core => host}/Makefile            |    4 +-
  drivers/bus/mhi/{core => host}/boot.c              |    0
  drivers/bus/mhi/{core => host}/debugfs.c           |    0
  drivers/bus/mhi/{core => host}/init.c              |   12 +
  drivers/bus/mhi/{core => host}/internal.h          |    0
  drivers/bus/mhi/{core => host}/main.c              |    0
  drivers/bus/mhi/host/pci_generic.c                 |  345 +++++
  drivers/bus/mhi/{core => host}/pm.c                |    0
  drivers/bus/ti-sysc.c                              |    2 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c             |    6 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c             |    6 +-
  drivers/gpu/drm/panel/panel-simple.c               |   24 +-
  drivers/gpu/drm/radeon/radeon_cs.c                 |    3 +-
  drivers/hid/hid-ids.h                              |    1 +
  drivers/hid/hid-quirks.c                           |    1 +
  drivers/i2c/busses/i2c-bcm-iproc.c                 |   11 +-
  drivers/i2c/busses/i2c-designware-master.c         |   15 +-
  drivers/iio/Kconfig                                |    1 +
  drivers/iio/Makefile                               |    1 +
  drivers/iio/adc/stx104.c                           |   98 +-
  drivers/iio/addac/Kconfig                          |    8 +
  drivers/iio/addac/Makefile                         |    6 +
  drivers/infiniband/hw/mlx5/qpc.c                   |   10 +-
  drivers/irqchip/irq-mips-gic.c                     |   63 +-
  drivers/media/platform/mtk-vpu/mtk_vpu.c           |    6 +-
  drivers/mmc/core/block.c                           |    7 +-
  drivers/mmc/core/host.c                            |   26 +
  drivers/mmc/host/bcm2835.c                         |    4 +-
  drivers/mmc/host/meson-gx-mmc.c                    |   52 +-
  drivers/mmc/host/sdhci_f_sdh30.c                   |   66 +-
  drivers/mmc/host/sunxi-mmc.c                       |    4 +-
  drivers/mmc/host/wbsd.c                            |    2 -
  drivers/net/dsa/mv88e6xxx/chip.c                   |    8 +
  drivers/net/ethernet/intel/i40e/i40e_nvm.c         |   16 +-
  .../net/ethernet/mellanox/mlx5/core/lib/clock.c    |  166 ++-
  .../net/ethernet/mellanox/mlx5/core/lib/clock.h    |    3 +-
  drivers/net/macsec.c                               |   70 +-
  drivers/net/phy/broadcom.c                         |   13 +
  drivers/net/team/team.c                            |    4 +-
  drivers/net/virtio_net.c                           |    4 +-
  drivers/pci/controller/dwc/pcie-tegra194.c         |   13 +-
  drivers/pcmcia/rsrc_nonstatic.c                    |    2 +
  drivers/tty/n_gsm.c                                |    3 +-
  drivers/tty/serial/8250/8250_port.c                |    1 +
  drivers/tty/serial/fsl_lpuart.c                    |    4 +-
  drivers/usb/cdns3/cdnsp-gadget.h                   | 1463 ++++++++++++++++++++
  drivers/usb/cdns3/gadget.c                         |   60 +-
  drivers/usb/cdns3/gadget.h                         |    9 +-
  drivers/usb/chipidea/ci_hdrc_imx.c                 |    5 +
  drivers/usb/chipidea/usbmisc_imx.c                 |    2 +-
  drivers/usb/dwc3/dwc3-qcom.c                       |   11 +-
  drivers/usb/gadget/function/u_serial.c             |    3 +
  drivers/usb/gadget/udc/core.c                      |   19 +
  drivers/video/fbdev/mmp/hw/mmp_ctrl.c              |    4 +-
  drivers/virtio/virtio_mmio.c                       |    8 +-
  fs/btrfs/volumes.c                                 |    3 +-
  fs/cifs/file.c                                     |    2 +-
  fs/gfs2/super.c                                    |   26 +-
  fs/jfs/jfs_dmap.c                                  |    3 +
  fs/jfs/jfs_txnmgr.c                                |    5 +
  fs/jfs/namei.c                                     |    5 +
  fs/overlayfs/ovl_entry.h                           |    9 +
  fs/quota/dquot.c                                   |    5 +-
  fs/udf/unicode.c                                   |    2 +-
  include/dt-bindings/iio/addac/adi,ad74413r.h       |   21 +
  include/linux/iopoll.h                             |    2 +
  include/linux/mhi.h                                |    2 +
  include/linux/mlx5/driver.h                        |   12 +-
  include/linux/mmc/host.h                           |    1 +
  include/linux/objtool.h                            |   28 +
  include/linux/usb/gadget.h                         |    4 +
  include/linux/virtio_net.h                         |    4 +
  include/media/v4l2-mem2mem.h                       |   18 +-
  include/net/sock.h                                 |    6 +
  kernel/dma/remap.c                                 |    4 +-
  kernel/trace/ring_buffer.c                         |   14 +-
  kernel/trace/trace.c                               |    3 +-
  kernel/trace/trace_kprobe.c                        |    3 +-
  kernel/trace/trace_probe_tmpl.h                    |   18 +-
  kernel/trace/trace_uprobe.c                        |    3 +-
  net/bluetooth/l2cap_core.c                         |    5 +
  net/core/sock.c                                    |    2 +-
  net/ipv4/ip_vti.c                                  |    4 +-
  net/ipv4/tcp_timer.c                               |    4 +-
  net/ipv6/ip6_vti.c                                 |    4 +-
  net/key/af_key.c                                   |    4 +-
  net/ncsi/ncsi-rsp.c                                |    5 +-
  net/netfilter/ipvs/ip_vs_ctl.c                     |    4 +
  net/netfilter/nf_conntrack_proto_sctp.c            |    6 +-
  net/netfilter/nft_dynset.c                         |    3 +
  net/unix/af_unix.c                                 |    9 +-
  net/xfrm/xfrm_compat.c                             |    2 +-
  net/xfrm/xfrm_interface_core.c                     |    4 +-
  net/xfrm/xfrm_user.c                               |   14 +-
  security/integrity/ima/Kconfig                     |    2 +-
  sound/hda/hdac_regmap.c                            |    7 +-
  sound/pci/emu10k1/emufx.c                          |  112 +-
  sound/pci/hda/patch_realtek.c                      |   16 +-
  sound/soc/codecs/rt5665.c                          |    2 +
  sound/soc/intel/boards/sof_sdw.c                   |   25 +
  sound/soc/meson/axg-tdm-formatter.c                |   42 +-
  sound/usb/quirks-table.h                           |   29 +
  tools/include/linux/objtool.h                      |   28 +
  tools/objtool/arch/x86/decode.c                    |    2 +-
  tools/objtool/check.c                              |   21 +-
  .../selftests/net/forwarding/mirror_gre_changes.sh |    3 +-
  130 files changed, 3442 insertions(+), 695 deletions(-)

.

author maintainer
#154 lore raw
In reply to Guenter Roeck
Quoted 23 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

Testing is not complete, but early feedback: All riscv32 boot tests crash badly with errors such as

Starting syslogd: OK
Starting klogd: OK
/etc/init.d/S02sysctl: line 68: syntax error: EOF in backquote substitution /etc/init.d/S20seedrng: line 33: syntax error: unexpected end of file (expecting ";;") Starting network: /bin/sh: syntax error: unterminated quoted string
sed: unmatched '/'
/bin/sh: syntax error: unterminated quoted string
FAIL
/etc/init.d/S55runtest: line 48: syntax error: EOF in backquote substitution

Quoted 6 lines

This is no longer seen after reverting the following patches.

92609bb3a1f8 riscv: uaccess: Return the number of bytes effectively not copied e06648704417 riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit
20704d763646 riscv: lib: uaccess: fold fixups into body
4f503bad920e riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall

Thanks for the review, I'll go drop all of the riscv patches here. Really, we shouldn't be adding any of them to any kernels older than 5.15 these days as I do not think anyone using that cpu is using those older kernels (or at least I sure hope not...)

thanks,

greg k-h

author maintainer
#73 lore raw

Re: [PATCH 5.10 066/135] net/ncsi: change from ndo_set_mac_address to dev_set_mac_address

In reply to Ivan Mikhaylov
Quoted 87 lines · Ivan Mikhaylov
Quoted 86 lines · Greg Kroah-Hartman
Quoted 74 lines · Ivan Mikhaylov
Quoted 59 lines · Greg Kroah-Hartman

5.10-stable review patch.  If anyone has any objections, please let
me know.

------------------

From: Ivan Mikhaylov <[email protected]>

[ Upstream commit 790071347a0a1a89e618eedcd51c687ea783aeb3 ]

Change ndo_set_mac_address to dev_set_mac_address because dev_set_mac_address provides a way to notify network layer about MAC
change. In other case, services may not aware about MAC change and
keep
using old one which set from network adapter driver.

As example, DHCP client from systemd do not update MAC address without
notification from net subsystem which leads to the problem with acquiring
the right address from DHCP server.

Fixes cb10c7c0dfd9e ("net/ncsi: Add NCSI Broadcom OEM command")
Cc [email protected] # v6.0+ 2f38e84 net/ncsi: make one

oem_gma
function for all mfr id

---
 net/ncsi/ncsi-rsp.c | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)
net/ncsi/ncsi-rsp.c +0 -0
index 888ccc2d4e34b..47ffb790ff99f 100644
@@ -616,7 +616,6 @@ static int

ncsi_rsp_handler_oem_mlx_gma(struct
ncsi_request *nr)
 {
        struct ncsi_dev_priv *ndp = nr->ndp; struct net_device *ndev = ndp->ndev.dev;
-       const struct net_device_ops *ops = ndev->netdev_ops; struct ncsi_rsp_oem_pkt *rsp;
        struct sockaddr saddr;
        int ret = 0;

net/ncsi/ncsi-rsp.c +0 -0
@@ -630,7 +629,9 @@ static int

ncsi_rsp_handler_oem_mlx_gma(struct
ncsi_request *nr)
        /* Set the flag for GMA command which should only be called
once */
        ndp->gma_flag = 1;

Quoted 8 lines

-       ret = ops->ndo_set_mac_address(ndev, &saddr); +       rtnl_lock();
+       ret = dev_set_mac_address(ndev, &saddr, NULL); +       rtnl_unlock();
        if (ret < 0)
                netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n");

Greg, we had conversation in the past about this particular patchset
series:
https://www.spinics.net/lists/stable-commits/msg308587.html

Quoted 7 lines

Just one patch is not enough, I didn't test it either on linux kernel
version < 6.0 , also I saw the Sasha's commits about the same for 5.4,
5.10, 5.15 and answered to him about necessity of two patchsets instead
of one on 19 aug.

Ah, so I should also include commit 74b449b98dcc ("net/ncsi: make one oem_gma function for all mfr id"), right?

Quoted 6 lines
Quoted 3 lines

thanks,

greg k-h

Greg, yes, that's right and I'm not sure if these two patches applies well for 5.x stable releases.

Thanks, I've dropped this one patch for now , and will revisit this after this release to see if both work in these trees.

greg k-h

#155 lore raw
In reply to Greg Kroah-Hartman
Quoted 31 lines · Greg Kroah-Hartman
Quoted 23 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

Testing is not complete, but early feedback: All riscv32 boot tests crash badly with errors such as

Starting syslogd: OK
Starting klogd: OK
/etc/init.d/S02sysctl: line 68: syntax error: EOF in backquote substitution /etc/init.d/S20seedrng: line 33: syntax error: unexpected end of file (expecting ";;") Starting network: /bin/sh: syntax error: unterminated quoted string
sed: unmatched '/'
/bin/sh: syntax error: unterminated quoted string
FAIL
/etc/init.d/S55runtest: line 48: syntax error: EOF in backquote substitution

Quoted 6 lines

This is no longer seen after reverting the following patches.

92609bb3a1f8 riscv: uaccess: Return the number of bytes effectively not copied e06648704417 riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit
20704d763646 riscv: lib: uaccess: fold fixups into body
4f503bad920e riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall

Quoted 4 lines

Thanks for the review, I'll go drop all of the riscv patches here. Really, we shouldn't be adding any of them to any kernels older than 5.15 these days as I do not think anyone using that cpu is using those older kernels (or at least I sure hope not...)

I know one of the main cpu IP vendors does run a 5.10 based tree, but that thing is both an abomination of out-of-tree patches to core arch code & about 100 releases out of date, therefore not really worth factoring. Anyone in their right mind should be running something significantly more recent than 5.10 for riscv.

author maintainer
#156 lore raw
Quoted 37 lines · Conor Dooley
Quoted 31 lines · Greg Kroah-Hartman
Quoted 23 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

Testing is not complete, but early feedback: All riscv32 boot tests crash badly with errors such as

Starting syslogd: OK
Starting klogd: OK
/etc/init.d/S02sysctl: line 68: syntax error: EOF in backquote substitution /etc/init.d/S20seedrng: line 33: syntax error: unexpected end of file (expecting ";;") Starting network: /bin/sh: syntax error: unterminated quoted string
sed: unmatched '/'
/bin/sh: syntax error: unterminated quoted string
FAIL
/etc/init.d/S55runtest: line 48: syntax error: EOF in backquote substitution

Quoted 6 lines

This is no longer seen after reverting the following patches.

92609bb3a1f8 riscv: uaccess: Return the number of bytes effectively not copied e06648704417 riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit
20704d763646 riscv: lib: uaccess: fold fixups into body
4f503bad920e riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall

Quoted 4 lines

Thanks for the review, I'll go drop all of the riscv patches here. Really, we shouldn't be adding any of them to any kernels older than 5.15 these days as I do not think anyone using that cpu is using those older kernels (or at least I sure hope not...)

Quoted 5 lines

I know one of the main cpu IP vendors does run a 5.10 based tree, but that thing is both an abomination of out-of-tree patches to core arch code & about 100 releases out of date, therefore not really worth factoring. Anyone in their right mind should be running something significantly more recent than 5.10 for riscv.

Thanks for the verification. Anyone using such an abomination of a tree, gets their support from the creator of such an abomination :)

greg k-h

author maintainer
#74 lore raw

Re: [PATCH 5.10 066/135] net/ncsi: change from ndo_set_mac_address to dev_set_mac_address

In reply to Ivan Mikhaylov
Quoted 87 lines · Ivan Mikhaylov
Quoted 86 lines · Greg Kroah-Hartman
Quoted 74 lines · Ivan Mikhaylov
Quoted 59 lines · Greg Kroah-Hartman

5.10-stable review patch.  If anyone has any objections, please let
me know.

------------------

From: Ivan Mikhaylov <[email protected]>

[ Upstream commit 790071347a0a1a89e618eedcd51c687ea783aeb3 ]

Change ndo_set_mac_address to dev_set_mac_address because dev_set_mac_address provides a way to notify network layer about MAC
change. In other case, services may not aware about MAC change and
keep
using old one which set from network adapter driver.

As example, DHCP client from systemd do not update MAC address without
notification from net subsystem which leads to the problem with acquiring
the right address from DHCP server.

Fixes cb10c7c0dfd9e ("net/ncsi: Add NCSI Broadcom OEM command")
Cc [email protected] # v6.0+ 2f38e84 net/ncsi: make one

oem_gma
function for all mfr id

---
 net/ncsi/ncsi-rsp.c | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)
net/ncsi/ncsi-rsp.c +0 -0
index 888ccc2d4e34b..47ffb790ff99f 100644
@@ -616,7 +616,6 @@ static int

ncsi_rsp_handler_oem_mlx_gma(struct
ncsi_request *nr)
 {
        struct ncsi_dev_priv *ndp = nr->ndp; struct net_device *ndev = ndp->ndev.dev;
-       const struct net_device_ops *ops = ndev->netdev_ops; struct ncsi_rsp_oem_pkt *rsp;
        struct sockaddr saddr;
        int ret = 0;

net/ncsi/ncsi-rsp.c +0 -0
@@ -630,7 +629,9 @@ static int

ncsi_rsp_handler_oem_mlx_gma(struct
ncsi_request *nr)
        /* Set the flag for GMA command which should only be called
once */
        ndp->gma_flag = 1;

Quoted 8 lines

-       ret = ops->ndo_set_mac_address(ndev, &saddr); +       rtnl_lock();
+       ret = dev_set_mac_address(ndev, &saddr, NULL); +       rtnl_unlock();
        if (ret < 0)
                netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n");

Greg, we had conversation in the past about this particular patchset
series:
https://www.spinics.net/lists/stable-commits/msg308587.html

Quoted 7 lines

Just one patch is not enough, I didn't test it either on linux kernel
version < 6.0 , also I saw the Sasha's commits about the same for 5.4,
5.10, 5.15 and answered to him about necessity of two patchsets instead
of one on 19 aug.

Ah, so I should also include commit 74b449b98dcc ("net/ncsi: make one oem_gma function for all mfr id"), right?

Quoted 6 lines
Quoted 3 lines

thanks,

greg k-h

Greg, yes, that's right and I'm not sure if these two patches applies well for 5.x stable releases.

It worked for 5.15.y, which is good enough for me :)

thanks,

greg k-h

#160 lore raw
In reply to Greg Kroah-Hartman

Hi,

Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

[ ... ]

Quoted 3 lines

Lang Yu <[email protected]>
drm/amdgpu: install stub fence into potential unused fence pointers

This patch is causing continuous log spam in chromeos-5.10, so we are going to revert it.

WARNING: CPU: 1 PID: 13383 at include/linux/dma-fence.h:478 amdgpu_sync_keep_later+0x95/0xbd

This is just a note to let others know that this may be the cause if they see the same problem.

Thanks,
Guenter

author maintainer
#161 lore raw
Quoted 17 lines · Guenter Roeck

Hi,

Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.192 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat, 26 Aug 2023 17:05:50 +0000. Anything received after that time might be too late.

[ ... ]

Quoted 3 lines

Lang Yu <[email protected]>
drm/amdgpu: install stub fence into potential unused fence pointers

Quoted 7 lines

This patch is causing continuous log spam in chromeos-5.10, so we are going to revert it.

WARNING: CPU: 1 PID: 13383 at include/linux/dma-fence.h:478 amdgpu_sync_keep_later+0x95/0xbd

This is just a note to let others know that this may be the cause if they see the same problem.

Thanks, I'll go revert it now.

greg k-h

author maintainer
#143 lore raw

Re: [PATCH 5.10 134/135] objtool/x86: Fixup frame-pointer vs rethunk

In reply to Greg Kroah-Hartman
Quoted 72 lines · John Sperbeck
Quoted 56 lines

5.10-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <[email protected]>

commit dbf46008775516f7f25c95b7760041c286299783 upstream.

For stack-validation of a frame-pointer build, objtool validates that every CALL instruction is preceded by a frame-setup. The new SRSO return thunks violate this with their RSB stuffing trickery.

Extend the __fentry__ exception to also cover the embedded_insn case used for this. This cures:

vmlinux.o: warning: objtool: srso_untrain_ret+0xd: call without frame pointer save/setup

---
 tools/objtool/check.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
tools/objtool/check.c +10 -5
@@ -2079,12 +2079,17 @@ static int decode_sections(struct objtoo
 	return 0;
 }
 
-static bool is_fentry_call(struct instruction *insn)
+static bool is_special_call(struct instruction *insn)
 {
-	if (insn->type == INSN_CALL &&
-	    insn->call_dest &&
-	    insn->call_dest->fentry)
-		return true;
+	if (insn->type == INSN_CALL) {
+		struct symbol *dest = insn->call_dest;
+
+		if (!dest)
+			return false;
+
+		if (dest->fentry)
+			return true;
+	}
 
 	return false;
 }

tools/objtool/check.c static int validate_branch(struct objtoo · line 2969

Quoted 8 lines
tools/objtool/check.c +1 -1
@@ -2958,7 +2963,7 @@ static int validate_branch(struct objtoo
 			if (ret)
 				return ret;
 
-			if (!no_fp && func && !is_fentry_call(insn) &&
+			if (!no_fp && func && !is_special_call(insn) &&
 			    !has_valid_stack_frame(&state)) {
 				WARN_FUNC("call without frame pointer save/setup",
 					  sec, insn->offset);

We still see the 'srso_untrain_ret+0xd: call without frame pointer save/setup' warning with v5.15.136. It looks like the backport might be incomplete. Is this additional change needed?

tools/objtool/check.c +0 -0
index 36ad0b6b94a9..c3bb96e5bfa6 100644

tools/objtool/check.c static bool is_special_call(struct instruction *insn) · line 2208

Quoted 8 lines
tools/objtool/check.c +1 -1
@@ -2202,7 +2202,7 @@ static bool is_special_call(struct instruction *insn)
 		if (!dest)
 			return false;
 
-		if (dest->fentry)
+		if (dest->fentry || dest->embedded_insn)
 			return true;
 	}
 

Possibly, I remember this was a pain to backport. Can you try this and see? If so, can you send a working and tested patch?

thanks,

greg k-h

#144 lore raw

Re: [PATCH 5.10 134/135] objtool/x86: Fixup frame-pointer vs rethunk

Quoted 86 lines · Greg KH
Quoted 72 lines · John Sperbeck
Quoted 56 lines

5.10-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <[email protected]>

commit dbf46008775516f7f25c95b7760041c286299783 upstream.

For stack-validation of a frame-pointer build, objtool validates that every CALL instruction is preceded by a frame-setup. The new SRSO return thunks violate this with their RSB stuffing trickery.

Extend the __fentry__ exception to also cover the embedded_insn case used for this. This cures:

vmlinux.o: warning: objtool: srso_untrain_ret+0xd: call without frame pointer save/setup

---
 tools/objtool/check.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
tools/objtool/check.c +10 -5
@@ -2079,12 +2079,17 @@ static int decode_sections(struct objtoo
    return 0;
 }
 
-static bool is_fentry_call(struct instruction *insn)
+static bool is_special_call(struct instruction *insn)
 {
-   if (insn->type == INSN_CALL &&
-       insn->call_dest &&
-       insn->call_dest->fentry)
-           return true;
+   if (insn->type == INSN_CALL) {
+           struct symbol *dest = insn->call_dest;
+
+           if (!dest)
+                   return false;
+
+           if (dest->fentry)
+                   return true;
+   }
 
    return false;
 }

tools/objtool/check.c static int validate_branch(struct objtoo · line 2969

Quoted 8 lines
tools/objtool/check.c +1 -1
@@ -2958,7 +2963,7 @@ static int validate_branch(struct objtoo
                    if (ret)
                            return ret;
 
-                   if (!no_fp && func && !is_fentry_call(insn) &&
+                   if (!no_fp && func && !is_special_call(insn) &&
                        !has_valid_stack_frame(&state)) {
                            WARN_FUNC("call without frame pointer save/setup",
                                      sec, insn->offset);

We still see the 'srso_untrain_ret+0xd: call without frame pointer save/setup' warning with v5.15.136. It looks like the backport might be incomplete. Is this additional change needed?

tools/objtool/check.c +0 -0
index 36ad0b6b94a9..c3bb96e5bfa6 100644

tools/objtool/check.c static bool is_special_call(struct instruction *insn) · line 2208

Quoted 8 lines
tools/objtool/check.c +1 -1
@@ -2202,7 +2202,7 @@ static bool is_special_call(struct instruction *insn)
              if (!dest)
                      return false;
 
-             if (dest->fentry)
+             if (dest->fentry || dest->embedded_insn)
                      return true;
      }
 

Possibly, I remember this was a pain to backport. Can you try this and see? If so, can you send a working and tested patch?

Quoted 3 lines

thanks,

greg k-h

I think I can do that. What's the process for a patch that would only go to certain stable branches? The 6.5 branch is okay. A fix would apply to 6.1, 5.15, and 5.10. The original partial backport hasn't gone into early releases, but I don't know if it will in the future.

author maintainer
#145 lore raw

Re: [PATCH 5.10 134/135] objtool/x86: Fixup frame-pointer vs rethunk

Quoted 87 lines · John Sperbeck
Quoted 86 lines · Greg KH
Quoted 72 lines · John Sperbeck
Quoted 56 lines

5.10-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <[email protected]>

commit dbf46008775516f7f25c95b7760041c286299783 upstream.

For stack-validation of a frame-pointer build, objtool validates that every CALL instruction is preceded by a frame-setup. The new SRSO return thunks violate this with their RSB stuffing trickery.

Extend the __fentry__ exception to also cover the embedded_insn case used for this. This cures:

vmlinux.o: warning: objtool: srso_untrain_ret+0xd: call without frame pointer save/setup

---
 tools/objtool/check.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
tools/objtool/check.c +10 -5
@@ -2079,12 +2079,17 @@ static int decode_sections(struct objtoo
    return 0;
 }
 
-static bool is_fentry_call(struct instruction *insn)
+static bool is_special_call(struct instruction *insn)
 {
-   if (insn->type == INSN_CALL &&
-       insn->call_dest &&
-       insn->call_dest->fentry)
-           return true;
+   if (insn->type == INSN_CALL) {
+           struct symbol *dest = insn->call_dest;
+
+           if (!dest)
+                   return false;
+
+           if (dest->fentry)
+                   return true;
+   }
 
    return false;
 }

tools/objtool/check.c static int validate_branch(struct objtoo · line 2969

Quoted 8 lines
tools/objtool/check.c +1 -1
@@ -2958,7 +2963,7 @@ static int validate_branch(struct objtoo
                    if (ret)
                            return ret;
 
-                   if (!no_fp && func && !is_fentry_call(insn) &&
+                   if (!no_fp && func && !is_special_call(insn) &&
                        !has_valid_stack_frame(&state)) {
                            WARN_FUNC("call without frame pointer save/setup",
                                      sec, insn->offset);

We still see the 'srso_untrain_ret+0xd: call without frame pointer save/setup' warning with v5.15.136. It looks like the backport might be incomplete. Is this additional change needed?

tools/objtool/check.c +0 -0
index 36ad0b6b94a9..c3bb96e5bfa6 100644

tools/objtool/check.c static bool is_special_call(struct instruction *insn) · line 2208

Quoted 8 lines
tools/objtool/check.c +1 -1
@@ -2202,7 +2202,7 @@ static bool is_special_call(struct instruction *insn)
              if (!dest)
                      return false;
 
-             if (dest->fentry)
+             if (dest->fentry || dest->embedded_insn)
                      return true;
      }
 

Possibly, I remember this was a pain to backport. Can you try this and see? If so, can you send a working and tested patch?

Quoted 6 lines
Quoted 3 lines

thanks,

greg k-h

I think I can do that. What's the process for a patch that would only go to certain stable branches?

Send it to use and say "This only applies to X and Y", there are loads of examples on the stable mailing list of this happening all the time.

thanks,

greg k-h