aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include
diff options
context:
space:
mode:
authorDavid Daney <david.daney@cavium.com>2014-05-28 17:52:13 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-06-02 06:34:20 -0400
commit18280edafef1b8ffc920743eddaf6cf6612b1509 (patch)
tree42136302ac56fb113d16de3128becd1fc6aed7a6 /arch/mips/include
parent90dfdc7ceb577c0d7b7635def3c62039a091e50d (diff)
MIPS: Add code for new system 'paravirt'
For para-virtualized guests running under KVM or other equivalent hypervisor. Signed-off-by: David Daney <david.daney@cavium.com> Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com> Cc: linux-mips@linux-mips.org Cc: James Hogan <james.hogan@imgtec.com> Cc: kvm@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/7004/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include')
-rw-r--r--arch/mips/include/asm/mach-paravirt/cpu-feature-overrides.h36
-rw-r--r--arch/mips/include/asm/mach-paravirt/irq.h19
-rw-r--r--arch/mips/include/asm/mach-paravirt/kernel-entry-init.h50
-rw-r--r--arch/mips/include/asm/mach-paravirt/war.h25
4 files changed, 130 insertions, 0 deletions
diff --git a/arch/mips/include/asm/mach-paravirt/cpu-feature-overrides.h b/arch/mips/include/asm/mach-paravirt/cpu-feature-overrides.h
new file mode 100644
index 000000000000..725e1ed83f6a
--- /dev/null
+++ b/arch/mips/include/asm/mach-paravirt/cpu-feature-overrides.h
@@ -0,0 +1,36 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2013 Cavium, Inc.
7 */
8#ifndef __ASM_MACH_PARAVIRT_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_PARAVIRT_CPU_FEATURE_OVERRIDES_H
10
11#define cpu_has_4kex 1
12#define cpu_has_3k_cache 0
13#define cpu_has_tx39_cache 0
14#define cpu_has_counter 1
15#define cpu_has_llsc 1
16/*
17 * We Disable LL/SC on non SMP systems as it is faster to disable
18 * interrupts for atomic access than a LL/SC.
19 */
20#ifdef CONFIG_SMP
21# define kernel_uses_llsc 1
22#else
23# define kernel_uses_llsc 0
24#endif
25
26#ifdef CONFIG_CPU_CAVIUM_OCTEON
27#define cpu_dcache_line_size() 128
28#define cpu_icache_line_size() 128
29#define cpu_has_octeon_cache 1
30#define cpu_has_4k_cache 0
31#else
32#define cpu_has_octeon_cache 0
33#define cpu_has_4k_cache 1
34#endif
35
36#endif /* __ASM_MACH_PARAVIRT_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-paravirt/irq.h b/arch/mips/include/asm/mach-paravirt/irq.h
new file mode 100644
index 000000000000..9b4d35eca977
--- /dev/null
+++ b/arch/mips/include/asm/mach-paravirt/irq.h
@@ -0,0 +1,19 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2013 Cavium, Inc.
7 */
8#ifndef __ASM_MACH_PARAVIRT_IRQ_H__
9#define __ASM_MACH_PARAVIRT_IRQ_H__
10
11#define NR_IRQS 64
12#define MIPS_CPU_IRQ_BASE 1
13
14#define MIPS_IRQ_PCIA (MIPS_CPU_IRQ_BASE + 8)
15
16#define MIPS_IRQ_MBOX0 (MIPS_CPU_IRQ_BASE + 32)
17#define MIPS_IRQ_MBOX1 (MIPS_CPU_IRQ_BASE + 33)
18
19#endif /* __ASM_MACH_PARAVIRT_IRQ_H__ */
diff --git a/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h b/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h
new file mode 100644
index 000000000000..2f82bfa3a773
--- /dev/null
+++ b/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h
@@ -0,0 +1,50 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2013 Cavium, Inc
7 */
8#ifndef __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H
9#define __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H
10
11#define CP0_EBASE $15, 1
12
13 .macro kernel_entry_setup
14 mfc0 t0, CP0_EBASE
15 andi t0, t0, 0x3ff # CPUNum
16 beqz t0, 1f
17 # CPUs other than zero goto smp_bootstrap
18 j smp_bootstrap
19
201:
21 .endm
22
23/*
24 * Do SMP slave processor setup necessary before we can safely execute
25 * C code.
26 */
27 .macro smp_slave_setup
28 mfc0 t0, CP0_EBASE
29 andi t0, t0, 0x3ff # CPUNum
30 slti t1, t0, NR_CPUS
31 bnez t1, 1f
322:
33 di
34 wait
35 b 2b # Unknown CPU, loop forever.
361:
37 PTR_LA t1, paravirt_smp_sp
38 PTR_SLL t0, PTR_SCALESHIFT
39 PTR_ADDU t1, t1, t0
403:
41 PTR_L sp, 0(t1)
42 beqz sp, 3b # Spin until told to proceed.
43
44 PTR_LA t1, paravirt_smp_gp
45 PTR_ADDU t1, t1, t0
46 sync
47 PTR_L gp, 0(t1)
48 .endm
49
50#endif /* __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H */
diff --git a/arch/mips/include/asm/mach-paravirt/war.h b/arch/mips/include/asm/mach-paravirt/war.h
new file mode 100644
index 000000000000..36d3afb98451
--- /dev/null
+++ b/arch/mips/include/asm/mach-paravirt/war.h
@@ -0,0 +1,25 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 * Copyright (C) 2013 Cavium Networks <support@caviumnetworks.com>
8 */
9#ifndef __ASM_MIPS_MACH_PARAVIRT_WAR_H
10#define __ASM_MIPS_MACH_PARAVIRT_WAR_H
11
12#define R4600_V1_INDEX_ICACHEOP_WAR 0
13#define R4600_V1_HIT_CACHEOP_WAR 0
14#define R4600_V2_HIT_CACHEOP_WAR 0
15#define R5432_CP0_INTERRUPT_WAR 0
16#define BCM1250_M3_WAR 0
17#define SIBYTE_1956_WAR 0
18#define MIPS4K_ICACHE_REFILL_WAR 0
19#define MIPS_CACHE_SYNC_WAR 0
20#define TX49XX_ICACHE_INDEX_INV_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_PARAVIRT_WAR_H */