Skip to content

Commit 342d965

Browse files
committed
Merge tag 'parisc-for-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc architecture updates and fixes from Helge Deller: "Fixes for the IPv4 and IPv6 checksum functions, a fix for the 64-bit unaligned memory exception handler and various code cleanups. Most of the patches are tagged for stable series. - Fix inline assembly in ipv4 and ipv6 checksum functions (Guenter Roeck) - Rewrite 64-bit inline assembly of emulate_ldd() (Guenter Roeck) - Do not clobber carry/borrow bits in tophys and tovirt macros (John David Anglin) - Warn when kernel accesses unaligned memory" * tag 'parisc-for-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: led: Convert to platform remove callback returning void parisc: Strip upper 32 bit of sum in csum_ipv6_magic for 64-bit builds parisc: Fix csum_ipv6_magic on 64-bit systems parisc: Fix csum_ipv6_magic on 32-bit systems parisc: Fix ip_fast_csum parisc: Avoid clobbering the C/B bits in the PSW with tophys and tovirt macros parisc/unaligned: Rewrite 64-bit inline assembly of emulate_ldd() parisc: make parisc_bus_type const parisc: avoid c23 'nullptr' idenitifier parisc: Show kernel unaligned memory accesses parisc: Use irq_enter_rcu() to fix warning at kernel/context_tracking.c:367
2 parents c1f10ac + 26dd487 commit 342d965

File tree

17 files changed

+101
-95
lines changed

17 files changed

+101
-95
lines changed

arch/parisc/include/asm/assembly.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,26 +97,28 @@
9797
* version takes two arguments: a src and destination register.
9898
* However, the source and destination registers can not be
9999
* the same register.
100+
*
101+
* We use add,l to avoid clobbering the C/B bits in the PSW.
100102
*/
101103

102104
.macro tophys grvirt, grphys
103-
ldil L%(__PAGE_OFFSET), \grphys
104-
sub \grvirt, \grphys, \grphys
105+
ldil L%(-__PAGE_OFFSET), \grphys
106+
addl \grvirt, \grphys, \grphys
105107
.endm
106-
108+
107109
.macro tovirt grphys, grvirt
108110
ldil L%(__PAGE_OFFSET), \grvirt
109-
add \grphys, \grvirt, \grvirt
111+
addl \grphys, \grvirt, \grvirt
110112
.endm
111113

112114
.macro tophys_r1 gr
113-
ldil L%(__PAGE_OFFSET), %r1
114-
sub \gr, %r1, \gr
115+
ldil L%(-__PAGE_OFFSET), %r1
116+
addl \gr, %r1, \gr
115117
.endm
116-
118+
117119
.macro tovirt_r1 gr
118120
ldil L%(__PAGE_OFFSET), %r1
119-
add \gr, %r1, \gr
121+
addl \gr, %r1, \gr
120122
.endm
121123

122124
.macro delay value

arch/parisc/include/asm/checksum.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
4040
" addc %0, %5, %0\n"
4141
" addc %0, %3, %0\n"
4242
"1: ldws,ma 4(%1), %3\n"
43-
" addib,< 0, %2, 1b\n"
43+
" addib,> -1, %2, 1b\n"
4444
" addc %0, %3, %0\n"
4545
"\n"
4646
" extru %0, 31, 16, %4\n"
@@ -126,6 +126,7 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
126126
** Try to keep 4 registers with "live" values ahead of the ALU.
127127
*/
128128

129+
" depdi 0, 31, 32, %0\n"/* clear upper half of incoming checksum */
129130
" ldd,ma 8(%1), %4\n" /* get 1st saddr word */
130131
" ldd,ma 8(%2), %5\n" /* get 1st daddr word */
131132
" add %4, %0, %0\n"
@@ -137,8 +138,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
137138
" add,dc %3, %0, %0\n" /* fold in proto+len | carry bit */
138139
" extrd,u %0, 31, 32, %4\n"/* copy upper half down */
139140
" depdi 0, 31, 32, %0\n"/* clear upper half */
140-
" add %4, %0, %0\n" /* fold into 32-bits */
141-
" addc 0, %0, %0\n" /* add carry */
141+
" add,dc %4, %0, %0\n" /* fold into 32-bits, plus carry */
142+
" addc 0, %0, %0\n" /* add final carry */
142143

143144
#else
144145

@@ -163,7 +164,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
163164
" ldw,ma 4(%2), %7\n" /* 4th daddr */
164165
" addc %6, %0, %0\n"
165166
" addc %7, %0, %0\n"
166-
" addc %3, %0, %0\n" /* fold in proto+len, catch carry */
167+
" addc %3, %0, %0\n" /* fold in proto+len */
168+
" addc 0, %0, %0\n" /* add carry */
167169

168170
#endif
169171
: "=r" (sum), "=r" (saddr), "=r" (daddr), "=r" (len),

arch/parisc/include/asm/parisc-device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ parisc_get_drvdata(struct parisc_device *d)
6161
return dev_get_drvdata(&d->dev);
6262
}
6363

64-
extern struct bus_type parisc_bus_type;
64+
extern const struct bus_type parisc_bus_type;
6565

6666
int iosapic_serial_irq(struct parisc_device *dev);
6767

arch/parisc/kernel/drivers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ static struct attribute *parisc_device_attrs[] = {
618618
};
619619
ATTRIBUTE_GROUPS(parisc_device);
620620

621-
struct bus_type parisc_bus_type = {
621+
const struct bus_type parisc_bus_type = {
622622
.name = "parisc",
623623
.match = parisc_generic_match,
624624
.uevent = parisc_uevent,

arch/parisc/kernel/irq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ asmlinkage void do_cpu_irq_mask(struct pt_regs *regs)
498498

499499
old_regs = set_irq_regs(regs);
500500
local_irq_disable();
501-
irq_enter();
501+
irq_enter_rcu();
502502

503503
eirr_val = mfctl(23) & cpu_eiem & per_cpu(local_ack_eiem, cpu);
504504
if (!eirr_val)
@@ -533,7 +533,7 @@ asmlinkage void do_cpu_irq_mask(struct pt_regs *regs)
533533
#endif /* CONFIG_IRQSTACKS */
534534

535535
out:
536-
irq_exit();
536+
irq_exit_rcu();
537537
set_irq_regs(old_regs);
538538
return;
539539

arch/parisc/kernel/unaligned.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ static int emulate_ldw(struct pt_regs *regs, int toreg, int flop)
169169
static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
170170
{
171171
unsigned long saddr = regs->ior;
172+
unsigned long shift, temp1;
172173
__u64 val = 0;
173174
ASM_EXCEPTIONTABLE_VAR(ret);
174175

@@ -180,25 +181,22 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
180181

181182
#ifdef CONFIG_64BIT
182183
__asm__ __volatile__ (
183-
" depd,z %3,60,3,%%r19\n" /* r19=(ofs&7)*8 */
184-
" mtsp %4, %%sr1\n"
185-
" depd %%r0,63,3,%3\n"
186-
"1: ldd 0(%%sr1,%3),%0\n"
187-
"2: ldd 8(%%sr1,%3),%%r20\n"
188-
" subi 64,%%r19,%%r19\n"
189-
" mtsar %%r19\n"
190-
" shrpd %0,%%r20,%%sar,%0\n"
184+
" depd,z %2,60,3,%3\n" /* shift=(ofs&7)*8 */
185+
" mtsp %5, %%sr1\n"
186+
" depd %%r0,63,3,%2\n"
187+
"1: ldd 0(%%sr1,%2),%0\n"
188+
"2: ldd 8(%%sr1,%2),%4\n"
189+
" subi 64,%3,%3\n"
190+
" mtsar %3\n"
191+
" shrpd %0,%4,%%sar,%0\n"
191192
"3: \n"
192193
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 3b, "%1")
193194
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 3b, "%1")
194-
: "=r" (val), "+r" (ret)
195-
: "0" (val), "r" (saddr), "r" (regs->isr)
196-
: "r19", "r20" );
195+
: "+r" (val), "+r" (ret), "+r" (saddr), "=&r" (shift), "=&r" (temp1)
196+
: "r" (regs->isr) );
197197
#else
198-
{
199-
unsigned long shift, temp1;
200198
__asm__ __volatile__ (
201-
" zdep %2,29,2,%3\n" /* r19=(ofs&3)*8 */
199+
" zdep %2,29,2,%3\n" /* shift=(ofs&3)*8 */
202200
" mtsp %5, %%sr1\n"
203201
" dep %%r0,31,2,%2\n"
204202
"1: ldw 0(%%sr1,%2),%0\n"
@@ -214,7 +212,6 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
214212
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(3b, 4b, "%1")
215213
: "+r" (val), "+r" (ret), "+r" (saddr), "=&r" (shift), "=&r" (temp1)
216214
: "r" (regs->isr) );
217-
}
218215
#endif
219216

220217
DPRINTF("val = 0x%llx\n", val);
@@ -399,6 +396,13 @@ void handle_unaligned(struct pt_regs *regs)
399396

400397
if (!unaligned_enabled)
401398
goto force_sigbus;
399+
} else {
400+
static DEFINE_RATELIMIT_STATE(kernel_ratelimit, 5 * HZ, 5);
401+
if (!(current->thread.flags & PARISC_UAC_NOPRINT) &&
402+
__ratelimit(&kernel_ratelimit))
403+
pr_warn("Kernel: unaligned access to " RFMT " in %pS "
404+
"(iir " RFMT ")\n",
405+
regs->ior, (void *)regs->iaoq[0], regs->iir);
402406
}
403407

404408
/* handle modification - OK, it's ugly, see the instruction manual */

arch/parisc/math-emu/dfsqrt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Double Floating-point Square Root
1616
*
1717
* External Interfaces:
18-
* dbl_fsqrt(srcptr,nullptr,dstptr,status)
18+
* dbl_fsqrt(srcptr,_nullptr,dstptr,status)
1919
*
2020
* Internal Interfaces:
2121
*
@@ -37,7 +37,7 @@
3737
unsigned int
3838
dbl_fsqrt(
3939
dbl_floating_point *srcptr,
40-
unsigned int *nullptr,
40+
unsigned int *_nullptr,
4141
dbl_floating_point *dstptr,
4242
unsigned int *status)
4343
{

arch/parisc/math-emu/fcnvff.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* Double Floating-point to Single Floating-point
1717
*
1818
* External Interfaces:
19-
* dbl_to_sgl_fcnvff(srcptr,nullptr,dstptr,status)
20-
* sgl_to_dbl_fcnvff(srcptr,nullptr,dstptr,status)
19+
* dbl_to_sgl_fcnvff(srcptr,_nullptr,dstptr,status)
20+
* sgl_to_dbl_fcnvff(srcptr,_nullptr,dstptr,status)
2121
*
2222
* Internal Interfaces:
2323
*
@@ -40,7 +40,7 @@
4040
int
4141
sgl_to_dbl_fcnvff(
4242
sgl_floating_point *srcptr,
43-
unsigned int *nullptr,
43+
unsigned int *_nullptr,
4444
dbl_floating_point *dstptr,
4545
unsigned int *status)
4646
{
@@ -127,7 +127,7 @@ sgl_to_dbl_fcnvff(
127127
int
128128
dbl_to_sgl_fcnvff(
129129
dbl_floating_point *srcptr,
130-
unsigned int *nullptr,
130+
unsigned int *_nullptr,
131131
sgl_floating_point *dstptr,
132132
unsigned int *status)
133133
{

arch/parisc/math-emu/fcnvfu.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
* Floating-point to Unsigned Fixed-point Converts
1616
*
1717
* External Interfaces:
18-
* dbl_to_dbl_fcnvfu(srcptr,nullptr,dstptr,status)
19-
* dbl_to_sgl_fcnvfu(srcptr,nullptr,dstptr,status)
20-
* sgl_to_dbl_fcnvfu(srcptr,nullptr,dstptr,status)
21-
* sgl_to_sgl_fcnvfu(srcptr,nullptr,dstptr,status)
18+
* dbl_to_dbl_fcnvfu(srcptr,_nullptr,dstptr,status)
19+
* dbl_to_sgl_fcnvfu(srcptr,_nullptr,dstptr,status)
20+
* sgl_to_dbl_fcnvfu(srcptr,_nullptr,dstptr,status)
21+
* sgl_to_sgl_fcnvfu(srcptr,_nullptr,dstptr,status)
2222
*
2323
* Internal Interfaces:
2424
*
@@ -45,7 +45,7 @@
4545
int
4646
sgl_to_sgl_fcnvfu(
4747
sgl_floating_point *srcptr,
48-
unsigned int *nullptr,
48+
unsigned int *_nullptr,
4949
unsigned int *dstptr,
5050
unsigned int *status)
5151
{
@@ -166,7 +166,7 @@ sgl_to_sgl_fcnvfu(
166166
int
167167
sgl_to_dbl_fcnvfu(
168168
sgl_floating_point *srcptr,
169-
unsigned int *nullptr,
169+
unsigned int *_nullptr,
170170
dbl_unsigned *dstptr,
171171
unsigned int *status)
172172
{
@@ -285,7 +285,7 @@ sgl_to_dbl_fcnvfu(
285285
*/
286286
/*ARGSUSED*/
287287
int
288-
dbl_to_sgl_fcnvfu (dbl_floating_point * srcptr, unsigned int *nullptr,
288+
dbl_to_sgl_fcnvfu (dbl_floating_point * srcptr, unsigned int *_nullptr,
289289
unsigned int *dstptr, unsigned int *status)
290290
{
291291
register unsigned int srcp1, srcp2, result;
@@ -408,7 +408,7 @@ dbl_to_sgl_fcnvfu (dbl_floating_point * srcptr, unsigned int *nullptr,
408408
*/
409409
/*ARGSUSED*/
410410
int
411-
dbl_to_dbl_fcnvfu (dbl_floating_point * srcptr, unsigned int *nullptr,
411+
dbl_to_dbl_fcnvfu (dbl_floating_point * srcptr, unsigned int *_nullptr,
412412
dbl_unsigned * dstptr, unsigned int *status)
413413
{
414414
register int src_exponent;

arch/parisc/math-emu/fcnvfut.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
* Floating-point to Unsigned Fixed-point Converts with Truncation
1616
*
1717
* External Interfaces:
18-
* dbl_to_dbl_fcnvfut(srcptr,nullptr,dstptr,status)
19-
* dbl_to_sgl_fcnvfut(srcptr,nullptr,dstptr,status)
20-
* sgl_to_dbl_fcnvfut(srcptr,nullptr,dstptr,status)
21-
* sgl_to_sgl_fcnvfut(srcptr,nullptr,dstptr,status)
18+
* dbl_to_dbl_fcnvfut(srcptr,_nullptr,dstptr,status)
19+
* dbl_to_sgl_fcnvfut(srcptr,_nullptr,dstptr,status)
20+
* sgl_to_dbl_fcnvfut(srcptr,_nullptr,dstptr,status)
21+
* sgl_to_sgl_fcnvfut(srcptr,_nullptr,dstptr,status)
2222
*
2323
* Internal Interfaces:
2424
*
@@ -44,7 +44,7 @@
4444
*/
4545
/*ARGSUSED*/
4646
int
47-
sgl_to_sgl_fcnvfut (sgl_floating_point * srcptr, unsigned int *nullptr,
47+
sgl_to_sgl_fcnvfut (sgl_floating_point * srcptr, unsigned int *_nullptr,
4848
unsigned int *dstptr, unsigned int *status)
4949
{
5050
register unsigned int src, result;
@@ -113,7 +113,7 @@ sgl_to_sgl_fcnvfut (sgl_floating_point * srcptr, unsigned int *nullptr,
113113
*/
114114
/*ARGSUSED*/
115115
int
116-
sgl_to_dbl_fcnvfut (sgl_floating_point * srcptr, unsigned int *nullptr,
116+
sgl_to_dbl_fcnvfut (sgl_floating_point * srcptr, unsigned int *_nullptr,
117117
dbl_unsigned * dstptr, unsigned int *status)
118118
{
119119
register int src_exponent;
@@ -183,7 +183,7 @@ sgl_to_dbl_fcnvfut (sgl_floating_point * srcptr, unsigned int *nullptr,
183183
*/
184184
/*ARGSUSED*/
185185
int
186-
dbl_to_sgl_fcnvfut (dbl_floating_point * srcptr, unsigned int *nullptr,
186+
dbl_to_sgl_fcnvfut (dbl_floating_point * srcptr, unsigned int *_nullptr,
187187
unsigned int *dstptr, unsigned int *status)
188188
{
189189
register unsigned int srcp1, srcp2, result;
@@ -252,7 +252,7 @@ dbl_to_sgl_fcnvfut (dbl_floating_point * srcptr, unsigned int *nullptr,
252252
*/
253253
/*ARGSUSED*/
254254
int
255-
dbl_to_dbl_fcnvfut (dbl_floating_point * srcptr, unsigned int *nullptr,
255+
dbl_to_dbl_fcnvfut (dbl_floating_point * srcptr, unsigned int *_nullptr,
256256
dbl_unsigned * dstptr, unsigned int *status)
257257
{
258258
register int src_exponent;

0 commit comments

Comments
 (0)