Skip to content

Commit a5ed1e9

Browse files
committed
Merge tag 'powerpc-5.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: "One fix for a boot failure on 32-bit, introduced during the merge window. A fix for our handling of CLOCK_MONOTONIC in the 64-bit VDSO. Changing the wall clock across the Y2038 boundary could cause CLOCK_MONOTONIC to jump forward and backward. Our spectre_v2 reporting was a bit confusing due to a bug I introduced. On some systems it was reporting that the count cache was disabled and also that we were flushing the count cache on context switch. Only the former is true, and given that the count cache is disabled it doesn't make any sense to flush it. No one reported it, so presumably the presence of any mitigation is all people check for. Finally a small build fix for zsmalloc on 32-bit. Thanks to: Ben Hutchings, Christophe Leroy, Diana Craciun, Guenter Roeck, Michael Neuling" * tag 'powerpc-5.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/security: Fix spectre_v2 reporting powerpc/mm: Only define MAX_PHYSMEM_BITS in SPARSEMEM configurations powerpc/6xx: fix setup and use of SPRN_SPRG_PGDIR for hash32 powerpc/vdso64: Fix CLOCK_MONOTONIC inconsistencies across Y2038
2 parents 070c95d + 92edf8d commit a5ed1e9

File tree

7 files changed

+25
-29
lines changed

7 files changed

+25
-29
lines changed

arch/powerpc/include/asm/mmu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ static inline bool strict_kernel_rwx_enabled(void)
352352
#if defined(CONFIG_SPARSEMEM_VMEMMAP) && defined(CONFIG_SPARSEMEM_EXTREME) && \
353353
defined (CONFIG_PPC_64K_PAGES)
354354
#define MAX_PHYSMEM_BITS 51
355-
#else
355+
#elif defined(CONFIG_SPARSEMEM)
356356
#define MAX_PHYSMEM_BITS 46
357357
#endif
358358

arch/powerpc/include/asm/vdso_datapage.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ struct vdso_data {
8282
__u32 icache_block_size; /* L1 i-cache block size */
8383
__u32 dcache_log_block_size; /* L1 d-cache log block size */
8484
__u32 icache_log_block_size; /* L1 i-cache log block size */
85-
__s32 wtom_clock_sec; /* Wall to monotonic clock */
86-
__s32 wtom_clock_nsec;
87-
struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */
88-
__u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */
85+
__u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */
86+
__s32 wtom_clock_nsec; /* Wall to monotonic clock nsec */
87+
__s64 wtom_clock_sec; /* Wall to monotonic clock sec */
88+
struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */
8989
__u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */
9090
__u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
9191
};

arch/powerpc/kernel/cpu_setup_6xx.S

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ BEGIN_MMU_FTR_SECTION
2424
li r10,0
2525
mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */
2626
END_MMU_FTR_SECTION_IFSET(MMU_FTR_NEED_DTLB_SW_LRU)
27-
lis r10, (swapper_pg_dir - PAGE_OFFSET)@h
28-
ori r10, r10, (swapper_pg_dir - PAGE_OFFSET)@l
29-
mtspr SPRN_SPRG_PGDIR, r10
3027

3128
BEGIN_FTR_SECTION
3229
bl __init_fpu_registers

arch/powerpc/kernel/head_32.S

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,9 @@ __secondary_start:
855855
li r3,0
856856
stw r3, RTAS_SP(r4) /* 0 => not in RTAS */
857857
#endif
858+
lis r4, (swapper_pg_dir - PAGE_OFFSET)@h
859+
ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l
860+
mtspr SPRN_SPRG_PGDIR, r4
858861

859862
/* enable MMU and jump to start_secondary */
860863
li r4,MSR_KERNEL
@@ -942,6 +945,9 @@ start_here:
942945
li r3,0
943946
stw r3, RTAS_SP(r4) /* 0 => not in RTAS */
944947
#endif
948+
lis r4, (swapper_pg_dir - PAGE_OFFSET)@h
949+
ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l
950+
mtspr SPRN_SPRG_PGDIR, r4
945951

946952
/* stack */
947953
lis r1,init_thread_union@ha

arch/powerpc/kernel/security.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -190,29 +190,22 @@ ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, c
190190
bcs = security_ftr_enabled(SEC_FTR_BCCTRL_SERIALISED);
191191
ccd = security_ftr_enabled(SEC_FTR_COUNT_CACHE_DISABLED);
192192

193-
if (bcs || ccd || count_cache_flush_type != COUNT_CACHE_FLUSH_NONE) {
194-
bool comma = false;
193+
if (bcs || ccd) {
195194
seq_buf_printf(&s, "Mitigation: ");
196195

197-
if (bcs) {
196+
if (bcs)
198197
seq_buf_printf(&s, "Indirect branch serialisation (kernel only)");
199-
comma = true;
200-
}
201198

202-
if (ccd) {
203-
if (comma)
204-
seq_buf_printf(&s, ", ");
205-
seq_buf_printf(&s, "Indirect branch cache disabled");
206-
comma = true;
207-
}
208-
209-
if (comma)
199+
if (bcs && ccd)
210200
seq_buf_printf(&s, ", ");
211201

212-
seq_buf_printf(&s, "Software count cache flush");
202+
if (ccd)
203+
seq_buf_printf(&s, "Indirect branch cache disabled");
204+
} else if (count_cache_flush_type != COUNT_CACHE_FLUSH_NONE) {
205+
seq_buf_printf(&s, "Mitigation: Software count cache flush");
213206

214207
if (count_cache_flush_type == COUNT_CACHE_FLUSH_HW)
215-
seq_buf_printf(&s, "(hardware accelerated)");
208+
seq_buf_printf(&s, " (hardware accelerated)");
216209
} else if (btb_flush_enabled) {
217210
seq_buf_printf(&s, "Mitigation: Branch predictor state flush");
218211
} else {

arch/powerpc/kernel/vdso64/gettimeofday.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
9292
* At this point, r4,r5 contain our sec/nsec values.
9393
*/
9494

95-
lwa r6,WTOM_CLOCK_SEC(r3)
95+
ld r6,WTOM_CLOCK_SEC(r3)
9696
lwa r9,WTOM_CLOCK_NSEC(r3)
9797

9898
/* We now have our result in r6,r9. We create a fake dependency
@@ -125,7 +125,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
125125
bne cr6,75f
126126

127127
/* CLOCK_MONOTONIC_COARSE */
128-
lwa r6,WTOM_CLOCK_SEC(r3)
128+
ld r6,WTOM_CLOCK_SEC(r3)
129129
lwa r9,WTOM_CLOCK_NSEC(r3)
130130

131131
/* check if counter has updated */

arch/powerpc/mm/hash_low_32.S

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ _GLOBAL(hash_page)
7070
lis r0,KERNELBASE@h /* check if kernel address */
7171
cmplw 0,r4,r0
7272
ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */
73-
mfspr r5, SPRN_SPRG_PGDIR /* virt page-table root */
73+
mfspr r5, SPRN_SPRG_PGDIR /* phys page-table root */
7474
blt+ 112f /* assume user more likely */
75-
lis r5,swapper_pg_dir@ha /* if kernel address, use */
76-
addi r5,r5,swapper_pg_dir@l /* kernel page table */
75+
lis r5, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
76+
addi r5 ,r5 ,(swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
7777
rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */
78-
112: tophys(r5, r5)
78+
112:
7979
#ifndef CONFIG_PTE_64BIT
8080
rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */
8181
lwz r8,0(r5) /* get pmd entry */

0 commit comments

Comments
 (0)