Skip to content

Commit 9f22578

Browse files
committed
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull powerpc fixes from Ben Herrenschmidt: "Here are a few powerpc bits & fixes for rc1. A couple of str*cpy fixes, some fixes in handling the FSCR register on Power8 (controls the enabling of processor features), a 32-bit build fix and a couple more nits." * 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: powerpc: Set DSCR bit in FSCR setup powerpc: Add DSCR FSCR register bit definition powerpc: Fix setting FSCR for HV=0 and on secondary CPUs powerpc: Wireup the kcmp syscall to sys_ni powerpc: Remove unused BITOP_LE_SWIZZLE macro powerpc: Avoid link stack corruption in MMU on syscall entry path drivers/tty/hvc: Use strlcpy instead of strncpy powerpc/pseries/hvcserver: Fix strncpy buffer limit in location code powerpc: Fix compile of sha1-powerpc-asm.S on 32-bit
2 parents d7b815d + 54c9b22 commit 9f22578

10 files changed

Lines changed: 17 additions & 19 deletions

File tree

‎arch/powerpc/crypto/sha1-powerpc-asm.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
STEPUP4((t)+16, fn)
114114

115115
_GLOBAL(powerpc_sha_transform)
116-
PPC_STLU r1,-STACKFRAMESIZE(r1)
116+
PPC_STLU r1,-INT_FRAME_SIZE(r1)
117117
SAVE_8GPRS(14, r1)
118118
SAVE_10GPRS(22, r1)
119119

@@ -175,5 +175,5 @@ _GLOBAL(powerpc_sha_transform)
175175

176176
REST_8GPRS(14, r1)
177177
REST_10GPRS(22, r1)
178-
addi r1,r1,STACKFRAMESIZE
178+
addi r1,r1,INT_FRAME_SIZE
179179
blr

‎arch/powerpc/include/asm/bitops.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@
5252
#define smp_mb__before_clear_bit() smp_mb()
5353
#define smp_mb__after_clear_bit() smp_mb()
5454

55-
#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
56-
5755
/* Macro for generating the ***_bits() functions */
5856
#define DEFINE_BITOP(fn, op, prefix, postfix) \
5957
static __inline__ void fn(unsigned long mask, \

‎arch/powerpc/include/asm/reg.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@
266266
#define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */
267267
#define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */
268268
#define SPRN_FSCR 0x099 /* Facility Status & Control Register */
269-
#define FSCR_TAR (1<<8) /* Enable Target Adress Register */
269+
#define FSCR_TAR (1 << (63-55)) /* Enable Target Address Register */
270+
#define FSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */
270271
#define SPRN_TAR 0x32f /* Target Address Register */
271272
#define SPRN_LPCR 0x13E /* LPAR Control Register */
272273
#define LPCR_VPM0 (1ul << (63-0))

‎arch/powerpc/include/asm/systbl.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,4 @@ SYSCALL_SPU(setns)
358358
COMPAT_SYS(process_vm_readv)
359359
COMPAT_SYS(process_vm_writev)
360360
SYSCALL(finit_module)
361+
SYSCALL(ni_syscall) /* sys_kcmp */

‎arch/powerpc/include/asm/unistd.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <uapi/asm/unistd.h>
1313

1414

15-
#define __NR_syscalls 354
15+
#define __NR_syscalls 355
1616

1717
#define __NR__exit __NR_exit
1818
#define NR_syscalls __NR_syscalls

‎arch/powerpc/include/uapi/asm/unistd.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@
376376
#define __NR_process_vm_readv 351
377377
#define __NR_process_vm_writev 352
378378
#define __NR_finit_module 353
379+
#define __NR_kcmp 354
379380

380381

381382
#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */

‎arch/powerpc/kernel/cpu_setup_power.S‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ _GLOBAL(__restore_cpu_power7)
4848

4949
_GLOBAL(__setup_cpu_power8)
5050
mflr r11
51+
bl __init_FSCR
5152
bl __init_hvmode_206
5253
mtlr r11
5354
beqlr
@@ -56,13 +57,13 @@ _GLOBAL(__setup_cpu_power8)
5657
mfspr r3,SPRN_LPCR
5758
oris r3, r3, LPCR_AIL_3@h
5859
bl __init_LPCR
59-
bl __init_FSCR
6060
bl __init_TLB
6161
mtlr r11
6262
blr
6363

6464
_GLOBAL(__restore_cpu_power8)
6565
mflr r11
66+
bl __init_FSCR
6667
mfmsr r3
6768
rldicl. r0,r3,4,63
6869
beqlr
@@ -115,7 +116,7 @@ __init_LPCR:
115116

116117
__init_FSCR:
117118
mfspr r3,SPRN_FSCR
118-
ori r3,r3,FSCR_TAR
119+
ori r3,r3,FSCR_TAR|FSCR_DSCR
119120
mtspr SPRN_FSCR,r3
120121
blr
121122

‎arch/powerpc/kernel/exceptions-64s.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \
7474
mflr r10 ; \
7575
ld r12,PACAKBASE(r13) ; \
7676
LOAD_HANDLER(r12, system_call_entry_direct) ; \
77-
mtlr r12 ; \
77+
mtctr r12 ; \
7878
mfspr r12,SPRN_SRR1 ; \
7979
/* Re-use of r13... No spare regs to do this */ \
8080
li r13,MSR_RI ; \
8181
mtmsrd r13,1 ; \
8282
GET_PACA(r13) ; /* get r13 back */ \
83-
blr ;
83+
bctr ;
8484
#else
8585
/* We can branch directly */
8686
#define SYSCALL_PSERIES_2_DIRECT \

‎arch/powerpc/platforms/pseries/hvcserver.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/list.h>
2424
#include <linux/module.h>
2525
#include <linux/slab.h>
26+
#include <linux/string.h>
2627

2728
#include <asm/hvcall.h>
2829
#include <asm/hvcserver.h>
@@ -188,9 +189,9 @@ int hvcs_get_partner_info(uint32_t unit_address, struct list_head *head,
188189
= (unsigned int)last_p_partition_ID;
189190

190191
/* copy the Null-term char too */
191-
strncpy(&next_partner_info->location_code[0],
192+
strlcpy(&next_partner_info->location_code[0],
192193
(char *)&pi_buff[2],
193-
strlen((char *)&pi_buff[2]) + 1);
194+
sizeof(next_partner_info->location_code));
194195

195196
list_add_tail(&(next_partner_info->node), head);
196197
next_partner_info = NULL;

‎drivers/tty/hvc/hvcs.c‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -881,17 +881,12 @@ static struct vio_driver hvcs_vio_driver = {
881881
/* Only called from hvcs_get_pi please */
882882
static void hvcs_set_pi(struct hvcs_partner_info *pi, struct hvcs_struct *hvcsd)
883883
{
884-
int clclength;
885-
886884
hvcsd->p_unit_address = pi->unit_address;
887885
hvcsd->p_partition_ID = pi->partition_ID;
888-
clclength = strlen(&pi->location_code[0]);
889-
if (clclength > HVCS_CLC_LENGTH)
890-
clclength = HVCS_CLC_LENGTH;
891886

892887
/* copy the null-term char too */
893-
strncpy(&hvcsd->p_location_code[0],
894-
&pi->location_code[0], clclength + 1);
888+
strlcpy(&hvcsd->p_location_code[0],
889+
&pi->location_code[0], sizeof(hvcsd->p_location_code));
895890
}
896891

897892
/*

0 commit comments

Comments
 (0)