Skip to content

Commit 5b8d6e8

Browse files
committed
Merge tag 'xtensa-20230716' of https://github.com/jcmvbkbc/linux-xtensa
Pull xtensa fixes from Max Filippov: - fix interaction between unaligned exception handler and load/store exception handler - fix parsing ISS network interface specification string - add comment about etherdev freeing to ISS network driver * tag 'xtensa-20230716' of https://github.com/jcmvbkbc/linux-xtensa: xtensa: fix unaligned and load/store configuration interaction xtensa: ISS: fix call to split_if_spec xtensa: ISS: add comment about etherdev freeing
2 parents 1667e63 + a160e94 commit 5b8d6e8

File tree

3 files changed

+18
-22
lines changed

3 files changed

+18
-22
lines changed

arch/xtensa/kernel/align.S

+14-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* arch/xtensa/kernel/align.S
33
*
4-
* Handle unalignment exceptions in kernel space.
4+
* Handle unalignment and load/store exceptions.
55
*
66
* This file is subject to the terms and conditions of the GNU General
77
* Public License. See the file "COPYING" in the main directory of
@@ -26,20 +26,18 @@
2626
#define LOAD_EXCEPTION_HANDLER
2727
#endif
2828

29-
#if XCHAL_UNALIGNED_STORE_EXCEPTION || defined LOAD_EXCEPTION_HANDLER
29+
#if XCHAL_UNALIGNED_STORE_EXCEPTION || defined CONFIG_XTENSA_LOAD_STORE
30+
#define STORE_EXCEPTION_HANDLER
31+
#endif
32+
33+
#if defined LOAD_EXCEPTION_HANDLER || defined STORE_EXCEPTION_HANDLER
3034
#define ANY_EXCEPTION_HANDLER
3135
#endif
3236

33-
#if XCHAL_HAVE_WINDOWED
37+
#if XCHAL_HAVE_WINDOWED && defined CONFIG_MMU
3438
#define UNALIGNED_USER_EXCEPTION
3539
#endif
3640

37-
/* First-level exception handler for unaligned exceptions.
38-
*
39-
* Note: This handler works only for kernel exceptions. Unaligned user
40-
* access should get a seg fault.
41-
*/
42-
4341
/* Big and little endian 16-bit values are located in
4442
* different halves of a register. HWORD_START helps to
4543
* abstract the notion of extracting a 16-bit value from a
@@ -228,8 +226,6 @@ ENDPROC(fast_load_store)
228226
#ifdef ANY_EXCEPTION_HANDLER
229227
ENTRY(fast_unaligned)
230228

231-
#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION
232-
233229
call0 .Lsave_and_load_instruction
234230

235231
/* Analyze the instruction (load or store?). */
@@ -244,8 +240,7 @@ ENTRY(fast_unaligned)
244240
/* 'store indicator bit' not set, jump */
245241
_bbci.l a4, OP1_SI_BIT + INSN_OP1, .Lload
246242

247-
#endif
248-
#if XCHAL_UNALIGNED_STORE_EXCEPTION
243+
#ifdef STORE_EXCEPTION_HANDLER
249244

250245
/* Store: Jump to table entry to get the value in the source register.*/
251246

@@ -254,7 +249,7 @@ ENTRY(fast_unaligned)
254249
addx8 a5, a6, a5
255250
jx a5 # jump into table
256251
#endif
257-
#if XCHAL_UNALIGNED_LOAD_EXCEPTION
252+
#ifdef LOAD_EXCEPTION_HANDLER
258253

259254
/* Load: Load memory address. */
260255

@@ -328,7 +323,7 @@ ENTRY(fast_unaligned)
328323
mov a14, a3 ; _j .Lexit; .align 8
329324
mov a15, a3 ; _j .Lexit; .align 8
330325
#endif
331-
#if XCHAL_UNALIGNED_STORE_EXCEPTION
326+
#ifdef STORE_EXCEPTION_HANDLER
332327
.Lstore_table:
333328
l32i a3, a2, PT_AREG0; _j .Lstore_w; .align 8
334329
mov a3, a1; _j .Lstore_w; .align 8 # fishy??
@@ -348,7 +343,6 @@ ENTRY(fast_unaligned)
348343
mov a3, a15 ; _j .Lstore_w; .align 8
349344
#endif
350345

351-
#ifdef ANY_EXCEPTION_HANDLER
352346
/* We cannot handle this exception. */
353347

354348
.extern _kernel_exception
@@ -377,8 +371,8 @@ ENTRY(fast_unaligned)
377371

378372
2: movi a0, _user_exception
379373
jx a0
380-
#endif
381-
#if XCHAL_UNALIGNED_STORE_EXCEPTION
374+
375+
#ifdef STORE_EXCEPTION_HANDLER
382376

383377
# a7: instruction pointer, a4: instruction, a3: value
384378
.Lstore_w:
@@ -444,7 +438,7 @@ ENTRY(fast_unaligned)
444438
s32i a6, a4, 4
445439
#endif
446440
#endif
447-
#ifdef ANY_EXCEPTION_HANDLER
441+
448442
.Lexit:
449443
#if XCHAL_HAVE_LOOPS
450444
rsr a4, lend # check if we reached LEND
@@ -539,7 +533,7 @@ ENTRY(fast_unaligned)
539533
__src_b a4, a4, a5 # a4 has the instruction
540534

541535
ret
542-
#endif
536+
543537
ENDPROC(fast_unaligned)
544538

545539
ENTRY(fast_unaligned_fixup)

arch/xtensa/kernel/traps.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ static dispatch_init_table_t __initdata dispatch_init_table[] = {
102102
#endif
103103
{ EXCCAUSE_INTEGER_DIVIDE_BY_ZERO, 0, do_div0 },
104104
/* EXCCAUSE_PRIVILEGED unhandled */
105-
#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION
105+
#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION || \
106+
IS_ENABLED(CONFIG_XTENSA_LOAD_STORE)
106107
#ifdef CONFIG_XTENSA_UNALIGNED_USER
107108
{ EXCCAUSE_UNALIGNED, USER, fast_unaligned },
108109
#endif

arch/xtensa/platforms/iss/network.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static int tuntap_probe(struct iss_net_private *lp, int index, char *init)
237237

238238
init += sizeof(TRANSPORT_TUNTAP_NAME) - 1;
239239
if (*init == ',') {
240-
rem = split_if_spec(init + 1, &mac_str, &dev_name);
240+
rem = split_if_spec(init + 1, &mac_str, &dev_name, NULL);
241241
if (rem != NULL) {
242242
pr_err("%s: extra garbage on specification : '%s'\n",
243243
dev->name, rem);
@@ -540,6 +540,7 @@ static void iss_net_configure(int index, char *init)
540540
rtnl_unlock();
541541
pr_err("%s: error registering net device!\n", dev->name);
542542
platform_device_unregister(&lp->pdev);
543+
/* dev is freed by the iss_net_pdev_release callback */
543544
return;
544545
}
545546
rtnl_unlock();

0 commit comments

Comments
 (0)