Skip to content

Commit 2e2d663

Browse files
committed
Merge branch 'wip-mips-pm' of https://github.com/paulburton/linux into mips-for-linux-next
2 parents 5ec79bf + 3220145 commit 2e2d663

41 files changed

Lines changed: 2257 additions & 218 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/mips/Kconfig‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ config MIPS
5050
select CLONE_BACKWARDS
5151
select HAVE_DEBUG_STACKOVERFLOW
5252
select HAVE_CC_STACKPROTECTOR
53+
select CPU_PM if CPU_IDLE
54+
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
5355

5456
menu "Machine selection"
5557

@@ -2012,9 +2014,11 @@ config MIPS_CPS
20122014
depends on SYS_SUPPORTS_MIPS_CPS
20132015
select MIPS_CM
20142016
select MIPS_CPC
2017+
select MIPS_CPS_PM if HOTPLUG_CPU
20152018
select MIPS_GIC_IPI
20162019
select SMP
20172020
select SYNC_R4K if (CEVT_R4K || CSRC_R4K)
2021+
select SYS_SUPPORTS_HOTPLUG_CPU
20182022
select SYS_SUPPORTS_SMP
20192023
select WEAK_ORDERING
20202024
help
@@ -2024,6 +2028,9 @@ config MIPS_CPS
20242028
no external assistance. It is safe to enable this when hardware
20252029
support is unavailable.
20262030

2031+
config MIPS_CPS_PM
2032+
bool
2033+
20272034
config MIPS_GIC_IPI
20282035
bool
20292036

@@ -2633,12 +2640,16 @@ endmenu
26332640
config MIPS_EXTERNAL_TIMER
26342641
bool
26352642

2636-
if CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER
26372643
menu "CPU Power Management"
2644+
2645+
if CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER
26382646
source "drivers/cpufreq/Kconfig"
2639-
endmenu
26402647
endif
26412648

2649+
source "drivers/cpuidle/Kconfig"
2650+
2651+
endmenu
2652+
26422653
source "net/Kconfig"
26432654

26442655
source "drivers/Kconfig"

‎arch/mips/configs/maltasmvp_defconfig‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ CONFIG_CPU_MIPS32_R2=y
44
CONFIG_PAGE_SIZE_16KB=y
55
CONFIG_MIPS_MT_SMP=y
66
CONFIG_SCHED_SMT=y
7-
CONFIG_MIPS_CMP=y
7+
CONFIG_MIPS_CPS=y
88
CONFIG_NR_CPUS=8
99
CONFIG_HZ_100=y
10-
CONFIG_LOCALVERSION="cmp"
1110
CONFIG_SYSVIPC=y
1211
CONFIG_POSIX_MQUEUE=y
1312
CONFIG_AUDIT=y

‎arch/mips/configs/maltasmvp_eva_defconfig‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ CONFIG_CPU_MIPS32_3_5_FEATURES=y
55
CONFIG_PAGE_SIZE_16KB=y
66
CONFIG_MIPS_MT_SMP=y
77
CONFIG_SCHED_SMT=y
8-
CONFIG_MIPS_CMP=y
8+
CONFIG_MIPS_CPS=y
99
CONFIG_NR_CPUS=8
1010
CONFIG_HZ_100=y
11-
CONFIG_LOCALVERSION="cmp"
1211
CONFIG_SYSVIPC=y
1312
CONFIG_POSIX_MQUEUE=y
1413
CONFIG_AUDIT=y

‎arch/mips/include/asm/cacheflush.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ unsigned long run_uncached(void *func);
113113

114114
extern void *kmap_coherent(struct page *page, unsigned long addr);
115115
extern void kunmap_coherent(void);
116+
extern void *kmap_noncoherent(struct page *page, unsigned long addr);
117+
118+
static inline void kunmap_noncoherent(void)
119+
{
120+
kunmap_coherent();
121+
}
116122

117123
#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
118124
static inline void flush_kernel_dcache_page(struct page *page)

‎arch/mips/include/asm/gic.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ extern unsigned int gic_compare_int (void);
380380
extern cycle_t gic_read_count(void);
381381
extern cycle_t gic_read_compare(void);
382382
extern void gic_write_compare(cycle_t cnt);
383+
extern void gic_write_cpu_compare(cycle_t cnt, int cpu);
383384
extern void gic_send_ipi(unsigned int intr);
384385
extern unsigned int plat_ipi_call_int_xlate(unsigned int);
385386
extern unsigned int plat_ipi_resched_int_xlate(unsigned int);

‎arch/mips/include/asm/idle.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef __ASM_IDLE_H
22
#define __ASM_IDLE_H
33

4+
#include <linux/cpuidle.h>
45
#include <linux/linkage.h>
56

67
extern void (*cpu_wait)(void);
@@ -20,4 +21,17 @@ static inline int address_is_in_r4k_wait_irqoff(unsigned long addr)
2021
addr < (unsigned long)__pastwait;
2122
}
2223

24+
extern int mips_cpuidle_wait_enter(struct cpuidle_device *dev,
25+
struct cpuidle_driver *drv, int index);
26+
27+
#define MIPS_CPUIDLE_WAIT_STATE {\
28+
.enter = mips_cpuidle_wait_enter,\
29+
.exit_latency = 1,\
30+
.target_residency = 1,\
31+
.power_usage = UINT_MAX,\
32+
.flags = CPUIDLE_FLAG_TIME_VALID,\
33+
.name = "wait",\
34+
.desc = "MIPS wait",\
35+
}
36+
2337
#endif /* __ASM_IDLE_H */

‎arch/mips/include/asm/mips-cpc.h‎

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ static inline bool mips_cpc_present(void)
7272
#define MIPS_CPC_COCB_OFS 0x4000
7373

7474
/* Macros to ease the creation of register access functions */
75-
#define BUILD_CPC_R_(name, off) \
75+
#define BUILD_CPC_R_(name, off) \
76+
static inline u32 *addr_cpc_##name(void) \
77+
{ \
78+
return (u32 *)(mips_cpc_base + (off)); \
79+
} \
80+
\
7681
static inline u32 read_cpc_##name(void) \
7782
{ \
7883
return __raw_readl(mips_cpc_base + (off)); \
@@ -147,4 +152,31 @@ BUILD_CPC_Cx_RW(other, 0x10)
147152
#define CPC_Cx_OTHER_CORENUM_SHF 16
148153
#define CPC_Cx_OTHER_CORENUM_MSK (_ULCAST_(0xff) << 16)
149154

155+
#ifdef CONFIG_MIPS_CPC
156+
157+
/**
158+
* mips_cpc_lock_other - lock access to another core
159+
* core: the other core to be accessed
160+
*
161+
* Call before operating upon a core via the 'other' register region in
162+
* order to prevent the region being moved during access. Must be followed
163+
* by a call to mips_cpc_unlock_other.
164+
*/
165+
extern void mips_cpc_lock_other(unsigned int core);
166+
167+
/**
168+
* mips_cpc_unlock_other - unlock access to another core
169+
*
170+
* Call after operating upon another core via the 'other' register region.
171+
* Must be called after mips_cpc_lock_other.
172+
*/
173+
extern void mips_cpc_unlock_other(void);
174+
175+
#else /* !CONFIG_MIPS_CPC */
176+
177+
static inline void mips_cpc_lock_other(unsigned int core) { }
178+
static inline void mips_cpc_unlock_other(void) { }
179+
180+
#endif /* !CONFIG_MIPS_CPC */
181+
150182
#endif /* __MIPS_ASM_MIPS_CPC_H__ */

‎arch/mips/include/asm/mipsmtregs.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636

3737
#define read_c0_tcbind() __read_32bit_c0_register($2, 2)
3838

39+
#define write_c0_tchalt(val) __write_32bit_c0_register($2, 4, val)
40+
3941
#define read_c0_tccontext() __read_32bit_c0_register($2, 5)
4042
#define write_c0_tccontext(val) __write_32bit_c0_register($2, 5, val)
4143

‎arch/mips/include/asm/mmu_context.h‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ do { \
2727
} while (0)
2828

2929
#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
30+
31+
#define TLBMISS_HANDLER_RESTORE() \
32+
write_c0_xcontext((unsigned long) smp_processor_id() << \
33+
SMP_CPUID_REGSHIFT)
34+
3035
#define TLBMISS_HANDLER_SETUP() \
3136
do { \
3237
TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir); \
33-
write_c0_xcontext((unsigned long) smp_processor_id() << \
34-
SMP_CPUID_REGSHIFT); \
38+
TLBMISS_HANDLER_RESTORE(); \
3539
} while (0)
3640

3741
#else /* !CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/
@@ -43,9 +47,12 @@ do { \
4347
*/
4448
extern unsigned long pgd_current[];
4549

46-
#define TLBMISS_HANDLER_SETUP() \
50+
#define TLBMISS_HANDLER_RESTORE() \
4751
write_c0_context((unsigned long) smp_processor_id() << \
48-
SMP_CPUID_REGSHIFT); \
52+
SMP_CPUID_REGSHIFT)
53+
54+
#define TLBMISS_HANDLER_SETUP() \
55+
TLBMISS_HANDLER_RESTORE(); \
4956
back_to_back_c0_hazard(); \
5057
TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
5158
#endif /* CONFIG_MIPS_PGD_C0_CONTEXT*/

‎arch/mips/include/asm/pgtable.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ struct vm_area_struct;
3232
_page_cachable_default)
3333
#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
3434
_PAGE_GLOBAL | _page_cachable_default)
35+
#define PAGE_KERNEL_NC __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
36+
_PAGE_GLOBAL | _CACHE_CACHABLE_NONCOHERENT)
3537
#define PAGE_USERIO __pgprot(_PAGE_PRESENT | (cpu_has_rixi ? 0 : _PAGE_READ) | _PAGE_WRITE | \
3638
_page_cachable_default)
3739
#define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | \

0 commit comments

Comments
 (0)