- Add HOTPLUG_SMT support (/sys/devices/system/cpu/smt) and honour the configured SMT state when hotplugging CPUs into the system. - Combine final TLB flush and lazy TLB mm shootdown IPIs when using the Radix MMU to avoid a broadcast TLBIE flush on exit. - Drop the exclusion between ptrace/perf watchpoints, and drop the now unused associated arch hooks. - Add support for the "nohlt" command line option to disable CPU idle. - Add support for -fpatchable-function-entry for ftrace, with GCC >= 13.1. - Rework memory block size determination, and support 256MB size on systems with GPUs that have hotpluggable memory. - Various other small features and fixes. Thanks to: Andrew Donnellan, Aneesh Kumar K.V, Arnd Bergmann, Athira Rajeev, Benjamin Gray, Christophe Leroy, Frederic Barrat, Gautam Menghani, Geoff Levand, Hari Bathini, Immad Mir, Jialin Zhang, Joel Stanley, Jordan Niethe, Justin Stitt, Kajol Jain, Kees Cook, Krzysztof Kozlowski, Laurent Dufour, Liang He, Linus Walleij, Mahesh Salgaonkar, Masahiro Yamada, Michal Suchanek, Nageswara R Sastry, Nathan Chancellor, Nathan Lynch, Naveen N Rao, Nicholas Piggin, Nick Desaulniers, Omar Sandoval, Randy Dunlap, Reza Arbab, Rob Herring, Russell Currey, Sourabh Jain, Thomas Gleixner, Trevor Woerner, Uwe Kleine-König, Vaibhav Jain, Xiongfeng Wang, Yuan Tan, Zhang Rui, Zheng Zengkai. -----BEGIN PGP SIGNATURE----- iQJHBAABCAAxFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmTwgbwTHG1wZUBlbGxl cm1hbi5pZC5hdQAKCRBR6+o8yOGlgFmpD/432vipeoqvkAYsyK0xi/Y3GcY0wcyd WJApLXXadEbtKQrgXQ6sowWqalg5thYnQCRarg/tXKK/po3KfgwkPjGDpOL+cIdr 12QVN2XJm9VmJ1wYJxzk+yXx4F43AdmMdr94qWAGufbTHezwb4UpzVR1NxtFrOE/ X5TNsC2+2mdZY/ZaNHS5vsTIFv3EhQfqgjZPlIAdLn6CGc8xWT514Q/uHA8+ytM/ HL7Hqs33DoPSvgTa5TT/2E0d0k5nO3P5KObzAjpYlireTPaBi51mpKGewcrtm0o2 v3cBlbfx3C7pe9ZhKBK9BH8cjynfiqsVZ9/lCw/7eBNdm9tHuzG0jeS7Db9tCZXS fM7G2R7SoIusPTqxlBmkU5DpYslwrHiVgCyy3ijxkoA/fakVwh/GgTcMsRt73IY6 n6DsUvWwuYHCIeIiHmHQJqCqCRtV+aMzU3AbbBHOjtdIanhlW16M686dEsgCirh7 akRVRD5VqKaqXs34PpkRL89Xv3wZRjl6XZ3hZFfCjSYXfpXDXhgSToIskpHYhKL8 gpY7WtG9YQP05Xz5HRCx6EluaZVeKe0lZi6fezX7Mi9AygJQO8FfXqP1mHBlEq40 ThWtvL9D89RV6lADqqFN20XepgvKNOyAXcE4szvsnIZYUSPmZQZSPxx+DHtROaLP jX3ifxtxJp92pQ== =5g7K -----END PGP SIGNATURE----- Merge tag 'powerpc-6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux Pull powerpc updates from Michael Ellerman: - Add HOTPLUG_SMT support (/sys/devices/system/cpu/smt) and honour the configured SMT state when hotplugging CPUs into the system - Combine final TLB flush and lazy TLB mm shootdown IPIs when using the Radix MMU to avoid a broadcast TLBIE flush on exit - Drop the exclusion between ptrace/perf watchpoints, and drop the now unused associated arch hooks - Add support for the "nohlt" command line option to disable CPU idle - Add support for -fpatchable-function-entry for ftrace, with GCC >= 13.1 - Rework memory block size determination, and support 256MB size on systems with GPUs that have hotpluggable memory - Various other small features and fixes Thanks to Andrew Donnellan, Aneesh Kumar K.V, Arnd Bergmann, Athira Rajeev, Benjamin Gray, Christophe Leroy, Frederic Barrat, Gautam Menghani, Geoff Levand, Hari Bathini, Immad Mir, Jialin Zhang, Joel Stanley, Jordan Niethe, Justin Stitt, Kajol Jain, Kees Cook, Krzysztof Kozlowski, Laurent Dufour, Liang He, Linus Walleij, Mahesh Salgaonkar, Masahiro Yamada, Michal Suchanek, Nageswara R Sastry, Nathan Chancellor, Nathan Lynch, Naveen N Rao, Nicholas Piggin, Nick Desaulniers, Omar Sandoval, Randy Dunlap, Reza Arbab, Rob Herring, Russell Currey, Sourabh Jain, Thomas Gleixner, Trevor Woerner, Uwe Kleine-König, Vaibhav Jain, Xiongfeng Wang, Yuan Tan, Zhang Rui, and Zheng Zengkai. * tag 'powerpc-6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (135 commits) macintosh/ams: linux/platform_device.h is needed powerpc/xmon: Reapply "Relax frame size for clang" powerpc/mm/book3s64: Use 256M as the upper limit with coherent device memory attached powerpc/mm/book3s64: Fix build error with SPARSEMEM disabled powerpc/iommu: Fix notifiers being shared by PCI and VIO buses powerpc/mpc5xxx: Add missing fwnode_handle_put() powerpc/config: Disable SLAB_DEBUG_ON in skiroot powerpc/pseries: Remove unused hcall tracing instruction powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n powerpc: dts: add missing space before { powerpc/eeh: Use pci_dev_id() to simplify the code powerpc/64s: Move CPU -mtune options into Kconfig powerpc/powermac: Fix unused function warning powerpc/pseries: Rework lppaca_shared_proc() to avoid DEBUG_PREEMPT powerpc: Don't include lppaca.h in paca.h powerpc/pseries: Move hcall_vphn() prototype into vphn.h powerpc/pseries: Move VPHN constants into vphn.h cxl: Drop unused detach_spa() powerpc: Drop zalloc_maybe_bootmem() powerpc/powernv: Use struct opal_prd_msg in more places ...
202 lines
4.8 KiB
C
202 lines
4.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_POWERPC_PGTABLE_H
|
|
#define _ASM_POWERPC_PGTABLE_H
|
|
|
|
#ifndef __ASSEMBLY__
|
|
#include <linux/mmdebug.h>
|
|
#include <linux/mmzone.h>
|
|
#include <asm/processor.h> /* For TASK_SIZE */
|
|
#include <asm/mmu.h>
|
|
#include <asm/page.h>
|
|
#include <asm/tlbflush.h>
|
|
|
|
struct mm_struct;
|
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
#ifdef CONFIG_PPC_BOOK3S
|
|
#include <asm/book3s/pgtable.h>
|
|
#else
|
|
#include <asm/nohash/pgtable.h>
|
|
#endif /* !CONFIG_PPC_BOOK3S */
|
|
|
|
/*
|
|
* Protection used for kernel text. We want the debuggers to be able to
|
|
* set breakpoints anywhere, so don't write protect the kernel text
|
|
* on platforms where such control is possible.
|
|
*/
|
|
#if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) || \
|
|
defined(CONFIG_KPROBES) || defined(CONFIG_DYNAMIC_FTRACE)
|
|
#define PAGE_KERNEL_TEXT PAGE_KERNEL_X
|
|
#else
|
|
#define PAGE_KERNEL_TEXT PAGE_KERNEL_ROX
|
|
#endif
|
|
|
|
/* Make modules code happy. We don't set RO yet */
|
|
#define PAGE_KERNEL_EXEC PAGE_KERNEL_X
|
|
|
|
/* Advertise special mapping type for AGP */
|
|
#define PAGE_AGP (PAGE_KERNEL_NC)
|
|
#define HAVE_PAGE_AGP
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
void set_ptes(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
|
|
pte_t pte, unsigned int nr);
|
|
#define set_ptes set_ptes
|
|
#define update_mmu_cache(vma, addr, ptep) \
|
|
update_mmu_cache_range(NULL, vma, addr, ptep, 1)
|
|
|
|
#ifndef MAX_PTRS_PER_PGD
|
|
#define MAX_PTRS_PER_PGD PTRS_PER_PGD
|
|
#endif
|
|
|
|
/* Keep these as a macros to avoid include dependency mess */
|
|
#define pte_page(x) pfn_to_page(pte_pfn(x))
|
|
#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
|
|
|
|
static inline unsigned long pte_pfn(pte_t pte)
|
|
{
|
|
return (pte_val(pte) & PTE_RPN_MASK) >> PTE_RPN_SHIFT;
|
|
}
|
|
|
|
/*
|
|
* Select all bits except the pfn
|
|
*/
|
|
static inline pgprot_t pte_pgprot(pte_t pte)
|
|
{
|
|
unsigned long pte_flags;
|
|
|
|
pte_flags = pte_val(pte) & ~PTE_RPN_MASK;
|
|
return __pgprot(pte_flags);
|
|
}
|
|
|
|
#ifndef pmd_page_vaddr
|
|
static inline const void *pmd_page_vaddr(pmd_t pmd)
|
|
{
|
|
return __va(pmd_val(pmd) & ~PMD_MASKED_BITS);
|
|
}
|
|
#define pmd_page_vaddr pmd_page_vaddr
|
|
#endif
|
|
/*
|
|
* ZERO_PAGE is a global shared page that is always zero: used
|
|
* for zero-mapped memory areas etc..
|
|
*/
|
|
extern unsigned long empty_zero_page[];
|
|
#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
|
|
|
|
extern pgd_t swapper_pg_dir[];
|
|
|
|
extern void paging_init(void);
|
|
void poking_init(void);
|
|
|
|
extern unsigned long ioremap_bot;
|
|
extern const pgprot_t protection_map[16];
|
|
|
|
#ifndef CONFIG_TRANSPARENT_HUGEPAGE
|
|
#define pmd_large(pmd) 0
|
|
#endif
|
|
|
|
/* can we use this in kvm */
|
|
unsigned long vmalloc_to_phys(void *vmalloc_addr);
|
|
|
|
void pgtable_cache_add(unsigned int shift);
|
|
|
|
pte_t *early_pte_alloc_kernel(pmd_t *pmdp, unsigned long va);
|
|
|
|
#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_PPC32)
|
|
void mark_initmem_nx(void);
|
|
#else
|
|
static inline void mark_initmem_nx(void) { }
|
|
#endif
|
|
|
|
/*
|
|
* When used, PTE_FRAG_NR is defined in subarch pgtable.h
|
|
* so we are sure it is included when arriving here.
|
|
*/
|
|
#ifdef PTE_FRAG_NR
|
|
static inline void *pte_frag_get(mm_context_t *ctx)
|
|
{
|
|
return ctx->pte_frag;
|
|
}
|
|
|
|
static inline void pte_frag_set(mm_context_t *ctx, void *p)
|
|
{
|
|
ctx->pte_frag = p;
|
|
}
|
|
#else
|
|
#define PTE_FRAG_NR 1
|
|
#define PTE_FRAG_SIZE_SHIFT PAGE_SHIFT
|
|
#define PTE_FRAG_SIZE (1UL << PTE_FRAG_SIZE_SHIFT)
|
|
|
|
static inline void *pte_frag_get(mm_context_t *ctx)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline void pte_frag_set(mm_context_t *ctx, void *p)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
#ifndef pmd_is_leaf
|
|
#define pmd_is_leaf pmd_is_leaf
|
|
static inline bool pmd_is_leaf(pmd_t pmd)
|
|
{
|
|
return false;
|
|
}
|
|
#endif
|
|
|
|
#ifndef pud_is_leaf
|
|
#define pud_is_leaf pud_is_leaf
|
|
static inline bool pud_is_leaf(pud_t pud)
|
|
{
|
|
return false;
|
|
}
|
|
#endif
|
|
|
|
#ifndef p4d_is_leaf
|
|
#define p4d_is_leaf p4d_is_leaf
|
|
static inline bool p4d_is_leaf(p4d_t p4d)
|
|
{
|
|
return false;
|
|
}
|
|
#endif
|
|
|
|
#define pmd_pgtable pmd_pgtable
|
|
static inline pgtable_t pmd_pgtable(pmd_t pmd)
|
|
{
|
|
return (pgtable_t)pmd_page_vaddr(pmd);
|
|
}
|
|
|
|
#ifdef CONFIG_PPC64
|
|
int __meminit vmemmap_populated(unsigned long vmemmap_addr, int vmemmap_map_size);
|
|
bool altmap_cross_boundary(struct vmem_altmap *altmap, unsigned long start,
|
|
unsigned long page_size);
|
|
/*
|
|
* mm/memory_hotplug.c:mhp_supports_memmap_on_memory goes into details
|
|
* some of the restrictions. We don't check for PMD_SIZE because our
|
|
* vmemmap allocation code can fallback correctly. The pageblock
|
|
* alignment requirement is met using altmap->reserve blocks.
|
|
*/
|
|
#define arch_supports_memmap_on_memory arch_supports_memmap_on_memory
|
|
static inline bool arch_supports_memmap_on_memory(unsigned long vmemmap_size)
|
|
{
|
|
if (!radix_enabled())
|
|
return false;
|
|
/*
|
|
* With 4K page size and 2M PMD_SIZE, we can align
|
|
* things better with memory block size value
|
|
* starting from 128MB. Hence align things with PMD_SIZE.
|
|
*/
|
|
if (IS_ENABLED(CONFIG_PPC_4K_PAGES))
|
|
return IS_ALIGNED(vmemmap_size, PMD_SIZE);
|
|
return true;
|
|
}
|
|
|
|
#endif /* CONFIG_PPC64 */
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
#endif /* _ASM_POWERPC_PGTABLE_H */
|