| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * TLB shootdown specifics for powerpc |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2002 Anton Blanchard, IBM Corp. |
|---|
| 5 | 6 | * Copyright (C) 2002 Paul Mackerras, IBM Corp. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or |
|---|
| 8 | | - * modify it under the terms of the GNU General Public License |
|---|
| 9 | | - * as published by the Free Software Foundation; either version |
|---|
| 10 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 11 | 7 | */ |
|---|
| 12 | 8 | #ifndef _ASM_POWERPC_TLB_H |
|---|
| 13 | 9 | #define _ASM_POWERPC_TLB_H |
|---|
| 14 | 10 | #ifdef __KERNEL__ |
|---|
| 15 | 11 | |
|---|
| 16 | 12 | #ifndef __powerpc64__ |
|---|
| 17 | | -#include <asm/pgtable.h> |
|---|
| 13 | +#include <linux/pgtable.h> |
|---|
| 18 | 14 | #endif |
|---|
| 19 | | -#include <asm/pgalloc.h> |
|---|
| 20 | 15 | #ifndef __powerpc64__ |
|---|
| 21 | 16 | #include <asm/page.h> |
|---|
| 22 | 17 | #include <asm/mmu.h> |
|---|
| .. | .. |
|---|
| 27 | 22 | #define tlb_start_vma(tlb, vma) do { } while (0) |
|---|
| 28 | 23 | #define tlb_end_vma(tlb, vma) do { } while (0) |
|---|
| 29 | 24 | #define __tlb_remove_tlb_entry __tlb_remove_tlb_entry |
|---|
| 30 | | -#define tlb_remove_check_page_size_change tlb_remove_check_page_size_change |
|---|
| 31 | 25 | |
|---|
| 26 | +#define tlb_flush tlb_flush |
|---|
| 32 | 27 | extern void tlb_flush(struct mmu_gather *tlb); |
|---|
| 28 | +/* |
|---|
| 29 | + * book3s: |
|---|
| 30 | + * Hash does not use the linux page-tables, so we can avoid |
|---|
| 31 | + * the TLB invalidate for page-table freeing, Radix otoh does use the |
|---|
| 32 | + * page-tables and needs the TLBI. |
|---|
| 33 | + * |
|---|
| 34 | + * nohash: |
|---|
| 35 | + * We still do TLB invalidate in the __pte_free_tlb routine before we |
|---|
| 36 | + * add the page table pages to mmu gather table batch. |
|---|
| 37 | + */ |
|---|
| 38 | +#define tlb_needs_table_invalidate() radix_enabled() |
|---|
| 33 | 39 | |
|---|
| 34 | 40 | /* Get the generic bits... */ |
|---|
| 35 | 41 | #include <asm-generic/tlb.h> |
|---|
| .. | .. |
|---|
| 40 | 46 | static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, |
|---|
| 41 | 47 | unsigned long address) |
|---|
| 42 | 48 | { |
|---|
| 43 | | -#ifdef CONFIG_PPC_STD_MMU_32 |
|---|
| 49 | +#ifdef CONFIG_PPC_BOOK3S_32 |
|---|
| 44 | 50 | if (pte_val(*ptep) & _PAGE_HASHPTE) |
|---|
| 45 | 51 | flush_hash_entry(tlb->mm, ptep, address); |
|---|
| 46 | 52 | #endif |
|---|
| 47 | | -} |
|---|
| 48 | | - |
|---|
| 49 | | -static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb, |
|---|
| 50 | | - unsigned int page_size) |
|---|
| 51 | | -{ |
|---|
| 52 | | - if (!tlb->page_size) |
|---|
| 53 | | - tlb->page_size = page_size; |
|---|
| 54 | | - else if (tlb->page_size != page_size) { |
|---|
| 55 | | - if (!tlb->fullmm) |
|---|
| 56 | | - tlb_flush_mmu(tlb); |
|---|
| 57 | | - /* |
|---|
| 58 | | - * update the page size after flush for the new |
|---|
| 59 | | - * mmu_gather. |
|---|
| 60 | | - */ |
|---|
| 61 | | - tlb->page_size = page_size; |
|---|
| 62 | | - } |
|---|
| 63 | 53 | } |
|---|
| 64 | 54 | |
|---|
| 65 | 55 | #ifdef CONFIG_SMP |
|---|