Skip to content

Commit 56f1f4b

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Pull sparc fixes from David Miller: 1) Do serial locking in a way that makes things clear that these are IRQ spinlocks. 2) Conversion to generic idle loop broke first generation Niagara machines, need to have %pil interrupts enabled during cpu yield hypervisor call. 3) Do not use magic constants for iterations over tsb tables, from Doug Wilson. 4) Fix erroneous truncation of 64-bit system call return values to 32-bit. From Dave Kleikamp. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc: sparc64: Make sure %pil interrupts are enabled during hypervisor yield. sparc64:tsb.c:use array size macro rather than number sparc64: don't treat 64-bit syscall return codes as 32-bit sparc: serial: Clean up the locking for -rt
2 parents 8a10944 + cb3042d commit 56f1f4b

File tree

7 files changed

+31
-43
lines changed

7 files changed

+31
-43
lines changed

arch/sparc/kernel/process_64.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ void arch_cpu_idle(void)
5858
{
5959
if (tlb_type != hypervisor) {
6060
touch_nmi_watchdog();
61+
local_irq_enable();
6162
} else {
6263
unsigned long pstate;
6364

65+
local_irq_enable();
66+
6467
/* The sun4v sleeping code requires that we have PSTATE.IE cleared over
6568
* the cpu sleep hypervisor call.
6669
*/
@@ -82,7 +85,6 @@ void arch_cpu_idle(void)
8285
: "=&r" (pstate)
8386
: "i" (PSTATE_IE));
8487
}
85-
local_irq_enable();
8688
}
8789

8890
#ifdef CONFIG_HOTPLUG_CPU

arch/sparc/kernel/syscalls.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ linux_sparc_syscall32:
189189
mov %i0, %l5 ! IEU1
190190
5: call %l7 ! CTI Group brk forced
191191
srl %i5, 0, %o5 ! IEU1
192-
ba,a,pt %xcc, 3f
192+
ba,pt %xcc, 3f
193+
sra %o0, 0, %o0
193194

194195
/* Linux native system calls enter here... */
195196
.align 32
@@ -217,7 +218,6 @@ linux_sparc_syscall:
217218
3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
218219
ret_sys_call:
219220
ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
220-
sra %o0, 0, %o0
221221
mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
222222
sllx %g2, 32, %g2
223223

arch/sparc/mm/tsb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ void __init pgtable_cache_init(void)
273273
prom_halt();
274274
}
275275

276-
for (i = 0; i < 8; i++) {
276+
for (i = 0; i < ARRAY_SIZE(tsb_cache_names); i++) {
277277
unsigned long size = 8192 << i;
278278
const char *name = tsb_cache_names[i];
279279

drivers/tty/serial/sunhv.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,10 @@ static void sunhv_console_write_paged(struct console *con, const char *s, unsign
433433
unsigned long flags;
434434
int locked = 1;
435435

436-
local_irq_save(flags);
437-
if (port->sysrq) {
438-
locked = 0;
439-
} else if (oops_in_progress) {
440-
locked = spin_trylock(&port->lock);
441-
} else
442-
spin_lock(&port->lock);
436+
if (port->sysrq || oops_in_progress)
437+
locked = spin_trylock_irqsave(&port->lock, flags);
438+
else
439+
spin_lock_irqsave(&port->lock, flags);
443440

444441
while (n > 0) {
445442
unsigned long ra = __pa(con_write_page);
@@ -470,8 +467,7 @@ static void sunhv_console_write_paged(struct console *con, const char *s, unsign
470467
}
471468

472469
if (locked)
473-
spin_unlock(&port->lock);
474-
local_irq_restore(flags);
470+
spin_unlock_irqrestore(&port->lock, flags);
475471
}
476472

477473
static inline void sunhv_console_putchar(struct uart_port *port, char c)
@@ -492,7 +488,10 @@ static void sunhv_console_write_bychar(struct console *con, const char *s, unsig
492488
unsigned long flags;
493489
int i, locked = 1;
494490

495-
local_irq_save(flags);
491+
if (port->sysrq || oops_in_progress)
492+
locked = spin_trylock_irqsave(&port->lock, flags);
493+
else
494+
spin_lock_irqsave(&port->lock, flags);
496495
if (port->sysrq) {
497496
locked = 0;
498497
} else if (oops_in_progress) {
@@ -507,8 +506,7 @@ static void sunhv_console_write_bychar(struct console *con, const char *s, unsig
507506
}
508507

509508
if (locked)
510-
spin_unlock(&port->lock);
511-
local_irq_restore(flags);
509+
spin_unlock_irqrestore(&port->lock, flags);
512510
}
513511

514512
static struct console sunhv_console = {

drivers/tty/serial/sunsab.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -844,20 +844,16 @@ static void sunsab_console_write(struct console *con, const char *s, unsigned n)
844844
unsigned long flags;
845845
int locked = 1;
846846

847-
local_irq_save(flags);
848-
if (up->port.sysrq) {
849-
locked = 0;
850-
} else if (oops_in_progress) {
851-
locked = spin_trylock(&up->port.lock);
852-
} else
853-
spin_lock(&up->port.lock);
847+
if (up->port.sysrq || oops_in_progress)
848+
locked = spin_trylock_irqsave(&up->port.lock, flags);
849+
else
850+
spin_lock_irqsave(&up->port.lock, flags);
854851

855852
uart_console_write(&up->port, s, n, sunsab_console_putchar);
856853
sunsab_tec_wait(up);
857854

858855
if (locked)
859-
spin_unlock(&up->port.lock);
860-
local_irq_restore(flags);
856+
spin_unlock_irqrestore(&up->port.lock, flags);
861857
}
862858

863859
static int sunsab_console_setup(struct console *con, char *options)

drivers/tty/serial/sunsu.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,13 +1295,10 @@ static void sunsu_console_write(struct console *co, const char *s,
12951295
unsigned int ier;
12961296
int locked = 1;
12971297

1298-
local_irq_save(flags);
1299-
if (up->port.sysrq) {
1300-
locked = 0;
1301-
} else if (oops_in_progress) {
1302-
locked = spin_trylock(&up->port.lock);
1303-
} else
1304-
spin_lock(&up->port.lock);
1298+
if (up->port.sysrq || oops_in_progress)
1299+
locked = spin_trylock_irqsave(&up->port.lock, flags);
1300+
else
1301+
spin_lock_irqsave(&up->port.lock, flags);
13051302

13061303
/*
13071304
* First save the UER then disable the interrupts
@@ -1319,8 +1316,7 @@ static void sunsu_console_write(struct console *co, const char *s,
13191316
serial_out(up, UART_IER, ier);
13201317

13211318
if (locked)
1322-
spin_unlock(&up->port.lock);
1323-
local_irq_restore(flags);
1319+
spin_unlock_irqrestore(&up->port.lock, flags);
13241320
}
13251321

13261322
/*

drivers/tty/serial/sunzilog.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,20 +1195,16 @@ sunzilog_console_write(struct console *con, const char *s, unsigned int count)
11951195
unsigned long flags;
11961196
int locked = 1;
11971197

1198-
local_irq_save(flags);
1199-
if (up->port.sysrq) {
1200-
locked = 0;
1201-
} else if (oops_in_progress) {
1202-
locked = spin_trylock(&up->port.lock);
1203-
} else
1204-
spin_lock(&up->port.lock);
1198+
if (up->port.sysrq || oops_in_progress)
1199+
locked = spin_trylock_irqsave(&up->port.lock, flags);
1200+
else
1201+
spin_lock_irqsave(&up->port.lock, flags);
12051202

12061203
uart_console_write(&up->port, s, count, sunzilog_putchar);
12071204
udelay(2);
12081205

12091206
if (locked)
1210-
spin_unlock(&up->port.lock);
1211-
local_irq_restore(flags);
1207+
spin_unlock_irqrestore(&up->port.lock, flags);
12121208
}
12131209

12141210
static int __init sunzilog_console_setup(struct console *con, char *options)

0 commit comments

Comments
 (0)