Skip to content

Commit c0b27c5

Browse files
npigginmpe
authored andcommitted
powerpc/64s/pseries: Fix hash tlbiel_all_isa300 for guest kernels
tlbiel_all() can not be usable in !HVMODE when running hash presently, remove HV privileged flushes when running in guest to make it usable. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20201126102530.691335-3-npiggin@gmail.com
1 parent 5844cc2 commit c0b27c5

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

arch/powerpc/mm/book3s64/hash_native.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,15 @@ static void tlbiel_all_isa300(unsigned int num_sets, unsigned int is)
9292
asm volatile("ptesync": : :"memory");
9393

9494
/*
95-
* Flush the first set of the TLB, and any caching of partition table
96-
* entries. Then flush the remaining sets of the TLB. Hash mode uses
97-
* partition scoped TLB translations.
95+
* Flush the partition table cache if this is HV mode.
9896
*/
99-
tlbiel_hash_set_isa300(0, is, 0, 2, 0);
100-
for (set = 1; set < num_sets; set++)
101-
tlbiel_hash_set_isa300(set, is, 0, 0, 0);
97+
if (early_cpu_has_feature(CPU_FTR_HVMODE))
98+
tlbiel_hash_set_isa300(0, is, 0, 2, 0);
10299

103100
/*
104-
* Now invalidate the process table cache.
101+
* Now invalidate the process table cache. UPRT=0 HPT modes (what
102+
* current hardware implements) do not use the process table, but
103+
* add the flushes anyway.
105104
*
106105
* From ISA v3.0B p. 1078:
107106
* The following forms are invalid.
@@ -110,6 +109,14 @@ static void tlbiel_all_isa300(unsigned int num_sets, unsigned int is)
110109
*/
111110
tlbiel_hash_set_isa300(0, is, 0, 2, 1);
112111

112+
/*
113+
* Then flush the sets of the TLB proper. Hash mode uses
114+
* partition scoped TLB translations, which may be flushed
115+
* in !HV mode.
116+
*/
117+
for (set = 0; set < num_sets; set++)
118+
tlbiel_hash_set_isa300(set, is, 0, 0, 0);
119+
113120
ppc_after_tlbiel_barrier();
114121

115122
asm volatile(PPC_ISA_3_0_INVALIDATE_ERAT "; isync" : : :"memory");

0 commit comments

Comments
 (0)