Skip to content

Commit fa165f9

Browse files
FlyGoattsbogend
authored andcommitted
MIPS: Loongson64: Switch to SYNC_R4K
Nowadays SYNC_R4K is performing better than Loongson64's custom sync mechanism. Switch to SYNC_R4K to improve performance and reduce code duplication. Signed-off-by: Jiaxun Yang <[email protected]> Reviewed-by: Huacai Chen <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent bb2d635 commit fa165f9

File tree

3 files changed

+3
-34
lines changed

3 files changed

+3
-34
lines changed

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ config MACH_LOONGSON64
478478
select BOARD_SCACHE
479479
select CSRC_R4K
480480
select CEVT_R4K
481+
select SYNC_R4K
481482
select FORCE_PCI
482483
select ISA
483484
select I8259

arch/mips/include/asm/smp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ extern int __cpu_logical_map[NR_CPUS];
5050
#define SMP_CALL_FUNCTION 0x2
5151
/* Octeon - Tell another core to flush its icache */
5252
#define SMP_ICACHE_FLUSH 0x4
53-
#define SMP_ASK_C0COUNT 0x8
5453

5554
/* Mask of CPUs which are currently definitely operating coherently */
5655
extern cpumask_t cpu_coherent_mask;

arch/mips/loongson64/smp.c

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ static void __iomem *ipi_clear0_regs[16];
3333
static void __iomem *ipi_status0_regs[16];
3434
static void __iomem *ipi_en0_regs[16];
3535
static void __iomem *ipi_mailbox_buf[16];
36-
static uint32_t core0_c0count[NR_CPUS];
3736

3837
static u32 (*ipi_read_clear)(int cpu);
3938
static void (*ipi_write_action)(int cpu, u32 action);
@@ -382,11 +381,10 @@ loongson3_send_ipi_mask(const struct cpumask *mask, unsigned int action)
382381
ipi_write_action(cpu_logical_map(i), (u32)action);
383382
}
384383

385-
386384
static irqreturn_t loongson3_ipi_interrupt(int irq, void *dev_id)
387385
{
388-
int i, cpu = smp_processor_id();
389-
unsigned int action, c0count;
386+
int cpu = smp_processor_id();
387+
unsigned int action;
390388

391389
action = ipi_read_clear(cpu);
392390

@@ -399,26 +397,14 @@ static irqreturn_t loongson3_ipi_interrupt(int irq, void *dev_id)
399397
irq_exit();
400398
}
401399

402-
if (action & SMP_ASK_C0COUNT) {
403-
BUG_ON(cpu != 0);
404-
c0count = read_c0_count();
405-
c0count = c0count ? c0count : 1;
406-
for (i = 1; i < nr_cpu_ids; i++)
407-
core0_c0count[i] = c0count;
408-
nudge_writes(); /* Let others see the result ASAP */
409-
}
410-
411400
return IRQ_HANDLED;
412401
}
413402

414-
#define MAX_LOOPS 800
415403
/*
416404
* SMP init and finish on secondary CPUs
417405
*/
418406
static void loongson3_init_secondary(void)
419407
{
420-
int i;
421-
uint32_t initcount;
422408
unsigned int cpu = smp_processor_id();
423409
unsigned int imask = STATUSF_IP7 | STATUSF_IP6 |
424410
STATUSF_IP3 | STATUSF_IP2;
@@ -432,23 +418,6 @@ static void loongson3_init_secondary(void)
432418
cpu_logical_map(cpu) % loongson_sysconf.cores_per_package);
433419
cpu_data[cpu].package =
434420
cpu_logical_map(cpu) / loongson_sysconf.cores_per_package;
435-
436-
i = 0;
437-
core0_c0count[cpu] = 0;
438-
loongson3_send_ipi_single(0, SMP_ASK_C0COUNT);
439-
while (!core0_c0count[cpu]) {
440-
i++;
441-
cpu_relax();
442-
}
443-
444-
if (i > MAX_LOOPS)
445-
i = MAX_LOOPS;
446-
if (cpu_data[cpu].package)
447-
initcount = core0_c0count[cpu] + i;
448-
else /* Local access is faster for loops */
449-
initcount = core0_c0count[cpu] + i/2;
450-
451-
write_c0_count(initcount);
452421
}
453422

454423
static void loongson3_smp_finish(void)

0 commit comments

Comments
 (0)