[PATCH v2] powerpc/crash: save cpu register data in crash_smp_send_stop()
During kdump, two set of NMI IPIs are sent to secondary CPUs, if 'crash_kexec_post_notifiers' option is set. The first set of NMI IPIs to stop the CPUs and the other set to collect register data. Instead, capture register data for secondary CPUs while stopping them itself. Also, fallback to smp_send_stop() in case the function gets called without kdump configured. Signed-off-by: Hari Bathini --- Changes in v2: * For INTERRUPT_SYSTEM_RESET case, stopped sending IPIs again to secondary CPUs via crash_kexec_prepare_cpus(). * Added comments where appropriate. arch/powerpc/include/asm/kexec.h | 1 + arch/powerpc/kernel/smp.c| 29 arch/powerpc/kexec/crash.c | 77 +++- 3 files changed, 57 insertions(+), 50 deletions(-) diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index 2aefe14e1442..cce69101205e 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -83,6 +83,7 @@ extern void default_machine_crash_shutdown(struct pt_regs *regs); extern int crash_shutdown_register(crash_shutdown_t handler); extern int crash_shutdown_unregister(crash_shutdown_t handler); +extern void crash_kexec_prepare(void); extern void crash_kexec_secondary(struct pt_regs *regs); int __init overlaps_crashkernel(unsigned long start, unsigned long size); extern void reserve_crashkernel(void); diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index bcefab484ea6..6b850c157a62 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -55,7 +56,6 @@ #endif #include #include -#include #include #include #include @@ -619,20 +619,6 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) } #endif -#ifdef CONFIG_NMI_IPI -static void crash_stop_this_cpu(struct pt_regs *regs) -#else -static void crash_stop_this_cpu(void *dummy) -#endif -{ - /* -* Just busy wait here and avoid marking CPU as offline to ensure -* register data is captured appropriately. -*/ - while (1) - cpu_relax(); -} - void crash_smp_send_stop(void) { static bool stopped = false; @@ -651,11 +637,14 @@ void crash_smp_send_stop(void) stopped = true; -#ifdef CONFIG_NMI_IPI - smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 100); -#else - smp_call_function(crash_stop_this_cpu, NULL, 0); -#endif /* CONFIG_NMI_IPI */ +#ifdef CONFIG_KEXEC_CORE + if (kexec_crash_image) { + crash_kexec_prepare(); + return; + } +#endif + + smp_send_stop(); } #ifdef CONFIG_NMI_IPI diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c index 80f54723cf6d..252724ed666a 100644 --- a/arch/powerpc/kexec/crash.c +++ b/arch/powerpc/kexec/crash.c @@ -40,6 +40,14 @@ #define REAL_MODE_TIMEOUT 1 static int time_to_dump; + +/* + * In case of system reset, secondary CPUs enter crash_kexec_secondary with out + * having to send an IPI explicitly. So, indicate if the crash is via + * system reset to avoid sending another IPI. + */ +static int is_via_system_reset; + /* * crash_wake_offline should be set to 1 by platforms that intend to wake * up offline cpus prior to jumping to a kdump kernel. Currently powernv @@ -101,7 +109,7 @@ void crash_ipi_callback(struct pt_regs *regs) /* NOTREACHED */ } -static void crash_kexec_prepare_cpus(int cpu) +static void crash_kexec_prepare_cpus(void) { unsigned int msecs; volatile unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */ @@ -113,7 +121,15 @@ static void crash_kexec_prepare_cpus(int cpu) if (crash_wake_offline) ncpus = num_present_cpus() - 1; - crash_send_ipi(crash_ipi_callback); + /* +* If we came in via system reset, secondaries enter via crash_kexec_secondary(). +* So, wait a while for the secondary CPUs to enter for that case. +* Else, send IPI to all other CPUs. +*/ + if (is_via_system_reset) + mdelay(PRIMARY_TIMEOUT); + else + crash_send_ipi(crash_ipi_callback); smp_wmb(); again: @@ -202,7 +218,7 @@ void crash_kexec_secondary(struct pt_regs *regs) #else /* ! CONFIG_SMP */ -static void crash_kexec_prepare_cpus(int cpu) +static void crash_kexec_prepare_cpus(void) { /* * move the secondaries to us so that we can copy @@ -248,6 +264,32 @@ noinstr static void __maybe_unused crash_kexec_wait_realmode(int cpu) static inline void crash_kexec_wait_realmode(int cpu) {} #endif /* CONFIG_SMP && CONFIG_PPC64 */ +void crash_kexec_prepare(void) +{ + /* Avoid hardlocking with irresponsive CPU holding logbuf_lock */ + printk_deferred_enter(); + + /* +* This function is only called after the system +* has panicke
Re: [PATCH] powerpc/crash: save cpu register data in crash_smp_send_stop()
Please ignore this thread. Will resend with v2 tag.. On 30/06/22 11:00 am, Hari Bathini wrote: During kdump, two set of NMI IPIs are sent to secondary CPUs, if 'crash_kexec_post_notifiers' option is set. The first set of NMI IPIs to stop the CPUs and the other set to collect register data. Instead, capture register data for secondary CPUs while stopping them itself. Also, fallback to smp_send_stop() in case the function gets called without kdump configured. Signed-off-by: Hari Bathini --- arch/powerpc/include/asm/kexec.h | 1 + arch/powerpc/kernel/smp.c| 29 arch/powerpc/kexec/crash.c | 77 +++- 3 files changed, 57 insertions(+), 50 deletions(-) diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index 2aefe14e1442..cce69101205e 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -83,6 +83,7 @@ extern void default_machine_crash_shutdown(struct pt_regs *regs); extern int crash_shutdown_register(crash_shutdown_t handler); extern int crash_shutdown_unregister(crash_shutdown_t handler); +extern void crash_kexec_prepare(void); extern void crash_kexec_secondary(struct pt_regs *regs); int __init overlaps_crashkernel(unsigned long start, unsigned long size); extern void reserve_crashkernel(void); diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index bcefab484ea6..6b850c157a62 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -55,7 +56,6 @@ #endif #include #include -#include #include #include #include @@ -619,20 +619,6 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) } #endif -#ifdef CONFIG_NMI_IPI -static void crash_stop_this_cpu(struct pt_regs *regs) -#else -static void crash_stop_this_cpu(void *dummy) -#endif -{ - /* -* Just busy wait here and avoid marking CPU as offline to ensure -* register data is captured appropriately. -*/ - while (1) - cpu_relax(); -} - void crash_smp_send_stop(void) { static bool stopped = false; @@ -651,11 +637,14 @@ void crash_smp_send_stop(void) stopped = true; -#ifdef CONFIG_NMI_IPI - smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 100); -#else - smp_call_function(crash_stop_this_cpu, NULL, 0); -#endif /* CONFIG_NMI_IPI */ +#ifdef CONFIG_KEXEC_CORE + if (kexec_crash_image) { + crash_kexec_prepare(); + return; + } +#endif + + smp_send_stop(); } #ifdef CONFIG_NMI_IPI diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c index 80f54723cf6d..252724ed666a 100644 --- a/arch/powerpc/kexec/crash.c +++ b/arch/powerpc/kexec/crash.c @@ -40,6 +40,14 @@ #define REAL_MODE_TIMEOUT 1 static int time_to_dump; + +/* + * In case of system reset, secondary CPUs enter crash_kexec_secondary with out + * having to send an IPI explicitly. So, indicate if the crash is via + * system reset to avoid sending another IPI. + */ +static int is_via_system_reset; + /* * crash_wake_offline should be set to 1 by platforms that intend to wake * up offline cpus prior to jumping to a kdump kernel. Currently powernv @@ -101,7 +109,7 @@ void crash_ipi_callback(struct pt_regs *regs) /* NOTREACHED */ } -static void crash_kexec_prepare_cpus(int cpu) +static void crash_kexec_prepare_cpus(void) { unsigned int msecs; volatile unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */ @@ -113,7 +121,15 @@ static void crash_kexec_prepare_cpus(int cpu) if (crash_wake_offline) ncpus = num_present_cpus() - 1; - crash_send_ipi(crash_ipi_callback); + /* +* If we came in via system reset, secondaries enter via crash_kexec_secondary(). +* So, wait a while for the secondary CPUs to enter for that case. +* Else, send IPI to all other CPUs. +*/ + if (is_via_system_reset) + mdelay(PRIMARY_TIMEOUT); + else + crash_send_ipi(crash_ipi_callback); smp_wmb(); again: @@ -202,7 +218,7 @@ void crash_kexec_secondary(struct pt_regs *regs) #else /* ! CONFIG_SMP */ -static void crash_kexec_prepare_cpus(int cpu) +static void crash_kexec_prepare_cpus(void) { /* * move the secondaries to us so that we can copy @@ -248,6 +264,32 @@ noinstr static void __maybe_unused crash_kexec_wait_realmode(int cpu) static inline void crash_kexec_wait_realmode(int cpu) {} #endif/* CONFIG_SMP && CONFIG_PPC64 */ +void crash_kexec_prepare(void) +{ + /* Avoid hardlocking with irresponsive CPU holding logbuf_lock */ + printk_deferred_enter(); + + /* +* This function is only called after the system +* has panicked or is otherw
[PATCH] powerpc/crash: save cpu register data in crash_smp_send_stop()
During kdump, two set of NMI IPIs are sent to secondary CPUs, if 'crash_kexec_post_notifiers' option is set. The first set of NMI IPIs to stop the CPUs and the other set to collect register data. Instead, capture register data for secondary CPUs while stopping them itself. Also, fallback to smp_send_stop() in case the function gets called without kdump configured. Signed-off-by: Hari Bathini --- arch/powerpc/include/asm/kexec.h | 1 + arch/powerpc/kernel/smp.c| 29 arch/powerpc/kexec/crash.c | 77 +++- 3 files changed, 57 insertions(+), 50 deletions(-) diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index 2aefe14e1442..cce69101205e 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -83,6 +83,7 @@ extern void default_machine_crash_shutdown(struct pt_regs *regs); extern int crash_shutdown_register(crash_shutdown_t handler); extern int crash_shutdown_unregister(crash_shutdown_t handler); +extern void crash_kexec_prepare(void); extern void crash_kexec_secondary(struct pt_regs *regs); int __init overlaps_crashkernel(unsigned long start, unsigned long size); extern void reserve_crashkernel(void); diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index bcefab484ea6..6b850c157a62 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -55,7 +56,6 @@ #endif #include #include -#include #include #include #include @@ -619,20 +619,6 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) } #endif -#ifdef CONFIG_NMI_IPI -static void crash_stop_this_cpu(struct pt_regs *regs) -#else -static void crash_stop_this_cpu(void *dummy) -#endif -{ - /* -* Just busy wait here and avoid marking CPU as offline to ensure -* register data is captured appropriately. -*/ - while (1) - cpu_relax(); -} - void crash_smp_send_stop(void) { static bool stopped = false; @@ -651,11 +637,14 @@ void crash_smp_send_stop(void) stopped = true; -#ifdef CONFIG_NMI_IPI - smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 100); -#else - smp_call_function(crash_stop_this_cpu, NULL, 0); -#endif /* CONFIG_NMI_IPI */ +#ifdef CONFIG_KEXEC_CORE + if (kexec_crash_image) { + crash_kexec_prepare(); + return; + } +#endif + + smp_send_stop(); } #ifdef CONFIG_NMI_IPI diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c index 80f54723cf6d..252724ed666a 100644 --- a/arch/powerpc/kexec/crash.c +++ b/arch/powerpc/kexec/crash.c @@ -40,6 +40,14 @@ #define REAL_MODE_TIMEOUT 1 static int time_to_dump; + +/* + * In case of system reset, secondary CPUs enter crash_kexec_secondary with out + * having to send an IPI explicitly. So, indicate if the crash is via + * system reset to avoid sending another IPI. + */ +static int is_via_system_reset; + /* * crash_wake_offline should be set to 1 by platforms that intend to wake * up offline cpus prior to jumping to a kdump kernel. Currently powernv @@ -101,7 +109,7 @@ void crash_ipi_callback(struct pt_regs *regs) /* NOTREACHED */ } -static void crash_kexec_prepare_cpus(int cpu) +static void crash_kexec_prepare_cpus(void) { unsigned int msecs; volatile unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */ @@ -113,7 +121,15 @@ static void crash_kexec_prepare_cpus(int cpu) if (crash_wake_offline) ncpus = num_present_cpus() - 1; - crash_send_ipi(crash_ipi_callback); + /* +* If we came in via system reset, secondaries enter via crash_kexec_secondary(). +* So, wait a while for the secondary CPUs to enter for that case. +* Else, send IPI to all other CPUs. +*/ + if (is_via_system_reset) + mdelay(PRIMARY_TIMEOUT); + else + crash_send_ipi(crash_ipi_callback); smp_wmb(); again: @@ -202,7 +218,7 @@ void crash_kexec_secondary(struct pt_regs *regs) #else /* ! CONFIG_SMP */ -static void crash_kexec_prepare_cpus(int cpu) +static void crash_kexec_prepare_cpus(void) { /* * move the secondaries to us so that we can copy @@ -248,6 +264,32 @@ noinstr static void __maybe_unused crash_kexec_wait_realmode(int cpu) static inline void crash_kexec_wait_realmode(int cpu) {} #endif /* CONFIG_SMP && CONFIG_PPC64 */ +void crash_kexec_prepare(void) +{ + /* Avoid hardlocking with irresponsive CPU holding logbuf_lock */ + printk_deferred_enter(); + + /* +* This function is only called after the system +* has panicked or is otherwise in a critical state. +* The minimum amount of code to allow a kexec'd kernel +* to run successfully needs to happen here. +* +
[PATCH V6 26/26] mm/mmap: Drop ARCH_HAS_VM_GET_PAGE_PROT
Now all the platforms enable ARCH_HAS_GET_PAGE_PROT. They define and export own vm_get_page_prot() whether custom or standard DECLARE_VM_GET_PAGE_PROT. Hence there is no need for default generic fallback for vm_get_page_prot(). Just drop this fallback and also ARCH_HAS_GET_PAGE_PROT mechanism. Cc: Andrew Morton Cc: linux...@kvack.org Cc: linux-ker...@vger.kernel.org Reviewed-by: Christoph Hellwig Reviewed-by: Christophe Leroy Signed-off-by: Anshuman Khandual --- arch/alpha/Kconfig | 1 - arch/arc/Kconfig| 1 - arch/arm/Kconfig| 1 - arch/arm64/Kconfig | 1 - arch/csky/Kconfig | 1 - arch/hexagon/Kconfig| 1 - arch/ia64/Kconfig | 1 - arch/loongarch/Kconfig | 1 - arch/m68k/Kconfig | 1 - arch/microblaze/Kconfig | 1 - arch/mips/Kconfig | 1 - arch/nios2/Kconfig | 1 - arch/openrisc/Kconfig | 1 - arch/parisc/Kconfig | 1 - arch/powerpc/Kconfig| 1 - arch/riscv/Kconfig | 1 - arch/s390/Kconfig | 1 - arch/sh/Kconfig | 1 - arch/sparc/Kconfig | 1 - arch/um/Kconfig | 1 - arch/x86/Kconfig| 1 - arch/xtensa/Kconfig | 1 - include/linux/mm.h | 3 --- mm/Kconfig | 3 --- mm/mmap.c | 22 -- 25 files changed, 50 deletions(-) diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index db1c8b329461..7d0d26b5b3f5 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -2,7 +2,6 @@ config ALPHA bool default y - select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_32BIT_USTAT_F_TINODE select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 8be56a5d8a9b..9e3653253ef2 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -13,7 +13,6 @@ config ARC select ARCH_HAS_SETUP_DMA_OPS select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE - select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC select ARCH_32BIT_OFF_T select BUILDTIME_TABLE_SORT diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index e153b6d4fc5b..7630ba9cb6cc 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -24,7 +24,6 @@ config ARM select ARCH_HAS_SYNC_DMA_FOR_CPU if SWIOTLB || !MMU select ARCH_HAS_TEARDOWN_DMA_OPS if MMU select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST - select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_HAVE_CUSTOM_GPIO_H select ARCH_HAVE_NMI_SAFE_CMPXCHG if CPU_V7 || CPU_V7M || CPU_V6K select ARCH_HAS_GCOV_PROFILE_ALL diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 1652a9800ebe..7030bf3f8d6f 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -45,7 +45,6 @@ config ARM64 select ARCH_HAS_SYSCALL_WRAPPER select ARCH_HAS_TEARDOWN_DMA_OPS if IOMMU_SUPPORT select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST - select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_HAS_ZONE_DMA_SET if EXPERT select ARCH_HAVE_ELF_PROT select ARCH_HAVE_NMI_SAFE_CMPXCHG diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index 588b8a9c68ed..21d72b078eef 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -6,7 +6,6 @@ config CSKY select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE - select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_QUEUED_RWLOCKS select ARCH_WANT_FRAME_POINTERS if !CPU_CK610 && $(cc-option,-mbacktrace) diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig index bc4ceecd0588..54eadf265178 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig @@ -6,7 +6,6 @@ config HEXAGON def_bool y select ARCH_32BIT_OFF_T select ARCH_HAS_SYNC_DMA_FOR_DEVICE - select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_NO_PREEMPT select DMA_GLOBAL_POOL # Other pending projects/to-do items. diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 0510a5737711..cb93769a9f2a 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -12,7 +12,6 @@ config IA64 select ARCH_HAS_DMA_MARK_CLEAN select ARCH_HAS_STRNCPY_FROM_USER select ARCH_HAS_STRNLEN_USER - select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select ACPI diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index fd07b8e760ee..1920d52653b4 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -9,7 +9,6 @@ config LOONGARCH select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_PHYS_TO_DMA select ARCH_HAS_PTE_SPECIAL - select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select A
[PATCH V6 25/26] sh/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Yoshinori Sato Cc: Rich Felker Cc: linux...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/sh/Kconfig | 1 + arch/sh/include/asm/pgtable.h | 17 - arch/sh/mm/mmap.c | 20 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 5f220e903e5a..91f3ea325388 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -12,6 +12,7 @@ config SUPERH select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_PTE_SPECIAL select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_HIBERNATION_POSSIBLE if MMU select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_WANT_IPC_PARSE_VERSION diff --git a/arch/sh/include/asm/pgtable.h b/arch/sh/include/asm/pgtable.h index d7ddb1ec86a0..6fb9ec54cf9b 100644 --- a/arch/sh/include/asm/pgtable.h +++ b/arch/sh/include/asm/pgtable.h @@ -89,23 +89,6 @@ static inline unsigned long phys_addr_mask(void) * completely separate permission bits for user and kernel space. */ /*xwr*/ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_EXECREAD -#define __P101 PAGE_EXECREAD -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_WRITEONLY -#define __S011 PAGE_SHARED -#define __S100 PAGE_EXECREAD -#define __S101 PAGE_EXECREAD -#define __S110 PAGE_RWX -#define __S111 PAGE_RWX typedef pte_t *pte_addr_t; diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c index 6a1a1297baae..46c1183493af 100644 --- a/arch/sh/mm/mmap.c +++ b/arch/sh/mm/mmap.c @@ -162,3 +162,23 @@ int valid_mmap_phys_addr_range(unsigned long pfn, size_t size) { return 1; } + +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READONLY, + [VM_WRITE] = PAGE_COPY, + [VM_WRITE | VM_READ]= PAGE_COPY, + [VM_EXEC] = PAGE_EXECREAD, + [VM_EXEC | VM_READ] = PAGE_EXECREAD, + [VM_EXEC | VM_WRITE]= PAGE_COPY, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_COPY, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READONLY, + [VM_SHARED | VM_WRITE] = PAGE_WRITEONLY, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED, + [VM_SHARED | VM_EXEC] = PAGE_EXECREAD, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_EXECREAD, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_RWX, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_RWX +}; +DECLARE_VM_GET_PAGE_PROT -- 2.25.1
[PATCH V6 24/26] um/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Jeff Dike Cc: linux...@lists.infradead.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/um/Kconfig | 1 + arch/um/include/asm/pgtable.h | 17 - arch/um/kernel/mem.c | 20 arch/x86/um/mem_32.c | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/arch/um/Kconfig b/arch/um/Kconfig index 4ec22e156a2e..7fb43654e5b5 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig @@ -10,6 +10,7 @@ config UML select ARCH_HAS_KCOV select ARCH_HAS_STRNCPY_FROM_USER select ARCH_HAS_STRNLEN_USER + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_NO_PREEMPT select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_SECCOMP_FILTER diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h index 167e236d9bb8..66bc3f99d9be 100644 --- a/arch/um/include/asm/pgtable.h +++ b/arch/um/include/asm/pgtable.h @@ -68,23 +68,6 @@ extern unsigned long end_iomem; * Also, write permissions imply read permissions. This is the closest we can * get.. */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_READONLY -#define __P101 PAGE_READONLY -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY -#define __S101 PAGE_READONLY -#define __S110 PAGE_SHARED -#define __S111 PAGE_SHARED /* * ZERO_PAGE is a global shared page that is always zero: used diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c index 15295c3237a0..5b259f0a1f94 100644 --- a/arch/um/kernel/mem.c +++ b/arch/um/kernel/mem.c @@ -197,3 +197,23 @@ void *uml_kmalloc(int size, int flags) { return kmalloc(size, flags); } + +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READONLY, + [VM_WRITE] = PAGE_COPY, + [VM_WRITE | VM_READ]= PAGE_COPY, + [VM_EXEC] = PAGE_READONLY, + [VM_EXEC | VM_READ] = PAGE_READONLY, + [VM_EXEC | VM_WRITE]= PAGE_COPY, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_COPY, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READONLY, + [VM_SHARED | VM_WRITE] = PAGE_SHARED, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED, + [VM_SHARED | VM_EXEC] = PAGE_READONLY, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_READONLY, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_SHARED, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_SHARED +}; +DECLARE_VM_GET_PAGE_PROT diff --git a/arch/x86/um/mem_32.c b/arch/x86/um/mem_32.c index 19c5dbd46770..cafd01f730da 100644 --- a/arch/x86/um/mem_32.c +++ b/arch/x86/um/mem_32.c @@ -17,7 +17,7 @@ static int __init gate_vma_init(void) gate_vma.vm_start = FIXADDR_USER_START; gate_vma.vm_end = FIXADDR_USER_END; gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; - gate_vma.vm_page_prot = __P101; + gate_vma.vm_page_prot = PAGE_READONLY; return 0; } -- 2.25.1
[PATCH V6 23/26] arm/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Russell King Cc: Arnd Bergmann Cc: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/arm/Kconfig | 1 + arch/arm/include/asm/pgtable.h | 17 - arch/arm/lib/uaccess_with_memcpy.c | 2 +- arch/arm/mm/mmu.c | 20 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 7630ba9cb6cc..e153b6d4fc5b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -24,6 +24,7 @@ config ARM select ARCH_HAS_SYNC_DMA_FOR_CPU if SWIOTLB || !MMU select ARCH_HAS_TEARDOWN_DMA_OPS if MMU select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_HAVE_CUSTOM_GPIO_H select ARCH_HAVE_NMI_SAFE_CMPXCHG if CPU_V7 || CPU_V7M || CPU_V6K select ARCH_HAS_GCOV_PROFILE_ALL diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index cd1f84bb40ae..78a532068fec 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -137,23 +137,6 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, * 2) If we could do execute protection, then read is implied * 3) write implies read permissions */ -#define __P000 __PAGE_NONE -#define __P001 __PAGE_READONLY -#define __P010 __PAGE_COPY -#define __P011 __PAGE_COPY -#define __P100 __PAGE_READONLY_EXEC -#define __P101 __PAGE_READONLY_EXEC -#define __P110 __PAGE_COPY_EXEC -#define __P111 __PAGE_COPY_EXEC - -#define __S000 __PAGE_NONE -#define __S001 __PAGE_READONLY -#define __S010 __PAGE_SHARED -#define __S011 __PAGE_SHARED -#define __S100 __PAGE_READONLY_EXEC -#define __S101 __PAGE_READONLY_EXEC -#define __S110 __PAGE_SHARED_EXEC -#define __S111 __PAGE_SHARED_EXEC #ifndef __ASSEMBLY__ /* diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c index c30b689bec2e..14eecaaf295f 100644 --- a/arch/arm/lib/uaccess_with_memcpy.c +++ b/arch/arm/lib/uaccess_with_memcpy.c @@ -237,7 +237,7 @@ static int __init test_size_treshold(void) if (!dst_page) goto no_dst; kernel_ptr = page_address(src_page); - user_ptr = vmap(&dst_page, 1, VM_IOREMAP, __pgprot(__P010)); + user_ptr = vmap(&dst_page, 1, VM_IOREMAP, __pgprot(__PAGE_COPY)); if (!user_ptr) goto no_vmap; diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 5e2be37a198e..2722abddd725 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -405,6 +405,26 @@ void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot) local_flush_tlb_kernel_range(vaddr, vaddr + PAGE_SIZE); } +static pgprot_t protection_map[16] __ro_after_init = { + [VM_NONE] = __PAGE_NONE, + [VM_READ] = __PAGE_READONLY, + [VM_WRITE] = __PAGE_COPY, + [VM_WRITE | VM_READ]= __PAGE_COPY, + [VM_EXEC] = __PAGE_READONLY_EXEC, + [VM_EXEC | VM_READ] = __PAGE_READONLY_EXEC, + [VM_EXEC | VM_WRITE]= __PAGE_COPY_EXEC, + [VM_EXEC | VM_WRITE | VM_READ] = __PAGE_COPY_EXEC, + [VM_SHARED] = __PAGE_NONE, + [VM_SHARED | VM_READ] = __PAGE_READONLY, + [VM_SHARED | VM_WRITE] = __PAGE_SHARED, + [VM_SHARED | VM_WRITE | VM_READ]= __PAGE_SHARED, + [VM_SHARED | VM_EXEC] = __PAGE_READONLY_EXEC, + [VM_SHARED | VM_EXEC | VM_READ] = __PAGE_READONLY_EXEC, + [VM_SHARED | VM_EXEC | VM_WRITE]= __PAGE_SHARED_EXEC, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = __PAGE_SHARED_EXEC +}; +DECLARE_VM_GET_PAGE_PROT + /* * Adjust the PMD section entries according to the CPU in use. */ -- 2.25.1
[PATCH V6 22/26] arc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Vineet Gupta Cc: linux-snps-...@lists.infradead.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/arc/Kconfig | 1 + arch/arc/include/asm/pgtable-bits-arcv2.h | 18 -- arch/arc/mm/mmap.c| 20 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 9e3653253ef2..8be56a5d8a9b 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -13,6 +13,7 @@ config ARC select ARCH_HAS_SETUP_DMA_OPS select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC select ARCH_32BIT_OFF_T select BUILDTIME_TABLE_SORT diff --git a/arch/arc/include/asm/pgtable-bits-arcv2.h b/arch/arc/include/asm/pgtable-bits-arcv2.h index 183d23bc1e00..b23be557403e 100644 --- a/arch/arc/include/asm/pgtable-bits-arcv2.h +++ b/arch/arc/include/asm/pgtable-bits-arcv2.h @@ -72,24 +72,6 @@ * This is to enable COW mechanism */ /* xwr */ -#define __P000 PAGE_U_NONE -#define __P001 PAGE_U_R -#define __P010 PAGE_U_R /* Pvt-W => !W */ -#define __P011 PAGE_U_R /* Pvt-W => !W */ -#define __P100 PAGE_U_X_R /* X => R */ -#define __P101 PAGE_U_X_R -#define __P110 PAGE_U_X_R /* Pvt-W => !W and X => R */ -#define __P111 PAGE_U_X_R /* Pvt-W => !W */ - -#define __S000 PAGE_U_NONE -#define __S001 PAGE_U_R -#define __S010 PAGE_U_W_R /* W => R */ -#define __S011 PAGE_U_W_R -#define __S100 PAGE_U_X_R /* X => R */ -#define __S101 PAGE_U_X_R -#define __S110 PAGE_U_X_W_R /* X => R */ -#define __S111 PAGE_U_X_W_R - #ifndef __ASSEMBLY__ #define pte_write(pte) (pte_val(pte) & _PAGE_WRITE) diff --git a/arch/arc/mm/mmap.c b/arch/arc/mm/mmap.c index 722d26b94307..fce5fa2b4f52 100644 --- a/arch/arc/mm/mmap.c +++ b/arch/arc/mm/mmap.c @@ -74,3 +74,23 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, info.align_offset = pgoff << PAGE_SHIFT; return vm_unmapped_area(&info); } + +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_U_NONE, + [VM_READ] = PAGE_U_R, + [VM_WRITE] = PAGE_U_R, + [VM_WRITE | VM_READ]= PAGE_U_R, + [VM_EXEC] = PAGE_U_X_R, + [VM_EXEC | VM_READ] = PAGE_U_X_R, + [VM_EXEC | VM_WRITE]= PAGE_U_X_R, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_U_X_R, + [VM_SHARED] = PAGE_U_NONE, + [VM_SHARED | VM_READ] = PAGE_U_R, + [VM_SHARED | VM_WRITE] = PAGE_U_W_R, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_U_W_R, + [VM_SHARED | VM_EXEC] = PAGE_U_X_R, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_U_X_R, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_U_X_W_R, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_U_X_W_R +}; +DECLARE_VM_GET_PAGE_PROT -- 2.25.1
[PATCH V6 21/26] m68k/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Thomas Bogendoerfer Cc: linux-m...@lists.linux-m68k.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/m68k/Kconfig| 1 + arch/m68k/include/asm/mcf_pgtable.h | 54 --- arch/m68k/include/asm/motorola_pgtable.h | 22 -- arch/m68k/include/asm/sun3_pgtable.h | 17 arch/m68k/mm/mcfmmu.c| 55 arch/m68k/mm/motorola.c | 20 + arch/m68k/mm/sun3mmu.c | 20 + 7 files changed, 96 insertions(+), 93 deletions(-) diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 936cce42ae9a..49aa0cf13e96 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -7,6 +7,7 @@ config M68K select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DMA_PREP_COHERENT if HAS_DMA && MMU && !COLDFIRE select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS select ARCH_MIGHT_HAVE_PC_PARPORT if ISA select ARCH_NO_PREEMPT if !COLDFIRE diff --git a/arch/m68k/include/asm/mcf_pgtable.h b/arch/m68k/include/asm/mcf_pgtable.h index 94f38d76e278..0e9c1b28dcab 100644 --- a/arch/m68k/include/asm/mcf_pgtable.h +++ b/arch/m68k/include/asm/mcf_pgtable.h @@ -91,60 +91,6 @@ * for use. In general, the bit positions are xwr, and P-items are * private, the S-items are shared. */ -#define __P000 PAGE_NONE -#define __P001 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_READABLE) -#define __P010 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_WRITABLE) -#define __P011 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_READABLE \ -| CF_PAGE_WRITABLE) -#define __P100 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_EXEC) -#define __P101 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_READABLE \ -| CF_PAGE_EXEC) -#define __P110 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_WRITABLE \ -| CF_PAGE_EXEC) -#define __P111 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_READABLE \ -| CF_PAGE_WRITABLE \ -| CF_PAGE_EXEC) - -#define __S000 PAGE_NONE -#define __S001 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_READABLE) -#define __S010 PAGE_SHARED -#define __S011 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_SHARED \ -| CF_PAGE_READABLE) -#define __S100 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_EXEC) -#define __S101 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_READABLE \ -| CF_PAGE_EXEC) -#define __S110 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_SHARED \ -| CF_PAGE_EXEC) -#define __S111 __pgprot(CF_PAGE_VALID \ -| CF_PAGE_ACCESSED \ -| CF_PAGE_SHARED \ -| CF_PAGE_READABLE \ -| CF_PAGE_EXEC) - #define PTE_MASK PAGE_MASK #define CF_PAGE_CHG_MASK (PTE_MASK | CF_PAGE_ACCESSED | CF_PAGE_DIRTY) diff --git a/arch/m68k/include/asm/motorola_pgtable.h b/arch/m68k/include/asm/motorola_pgtable.h index 7c9b56e2a750..63aaece0722f 100644 --- a/arch/m68k/include/asm/motorola_pgtable.h +++ b/arch/m68k/include/asm/motorola_pgtable.h @@ -83,28 +83,6 @@ extern unsigned long mm_cachebits; #define PAGE_COPY_C__pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED) #define PAGE_READONLY_C__pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED) -/* - * The m68k can't do page prote
[PATCH V6 20/26] mips/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Thomas Bogendoerfer Cc: linux-m...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/mips/Kconfig | 1 + arch/mips/include/asm/pgtable.h | 22 -- arch/mips/mm/cache.c| 3 +++ 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index db09d45d59ec..d0b7eb11ec81 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -14,6 +14,7 @@ config MIPS select ARCH_HAS_STRNLEN_USER select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UBSAN_SANITIZE_ALL + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_KEEP_MEMBLOCK select ARCH_SUPPORTS_UPROBES diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 374c6322775d..6caec386ad2f 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -41,28 +41,6 @@ struct vm_area_struct; * by reasonable means.. */ -/* - * Dummy values to fill the table in mmap.c - * The real values will be generated at runtime - */ -#define __P000 __pgprot(0) -#define __P001 __pgprot(0) -#define __P010 __pgprot(0) -#define __P011 __pgprot(0) -#define __P100 __pgprot(0) -#define __P101 __pgprot(0) -#define __P110 __pgprot(0) -#define __P111 __pgprot(0) - -#define __S000 __pgprot(0) -#define __S001 __pgprot(0) -#define __S010 __pgprot(0) -#define __S011 __pgprot(0) -#define __S100 __pgprot(0) -#define __S101 __pgprot(0) -#define __S110 __pgprot(0) -#define __S111 __pgprot(0) - extern unsigned long _page_cachable_default; extern void __update_cache(unsigned long address, pte_t pte); diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c index 7be7240f7703..11b3e7ddafd5 100644 --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c @@ -159,6 +159,9 @@ EXPORT_SYMBOL(_page_cachable_default); #define PM(p) __pgprot(_page_cachable_default | (p)) +static pgprot_t protection_map[16] __ro_after_init; +DECLARE_VM_GET_PAGE_PROT + static inline void setup_protection_map(void) { protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); -- 2.25.1
[PATCH V6 19/26] ia64/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: linux-i...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/ia64/Kconfig | 1 + arch/ia64/include/asm/pgtable.h | 18 -- arch/ia64/mm/init.c | 28 +++- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index cb93769a9f2a..0510a5737711 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -12,6 +12,7 @@ config IA64 select ARCH_HAS_DMA_MARK_CLEAN select ARCH_HAS_STRNCPY_FROM_USER select ARCH_HAS_STRNLEN_USER + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select ACPI diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h index 7aa8f2330fb1..6925e28ae61d 100644 --- a/arch/ia64/include/asm/pgtable.h +++ b/arch/ia64/include/asm/pgtable.h @@ -161,24 +161,6 @@ * attempts to write to the page. */ /* xwr */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_READONLY /* write to priv pg -> copy & make writable */ -#define __P011 PAGE_READONLY /* ditto */ -#define __P100 __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_X_RX) -#define __P101 __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_RX) -#define __P110 PAGE_COPY_EXEC -#define __P111 PAGE_COPY_EXEC - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED /* we don't have (and don't need) write-only */ -#define __S011 PAGE_SHARED -#define __S100 __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_X_RX) -#define __S101 __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_RX) -#define __S110 __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_RWX) -#define __S111 __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_RWX) - #define pgd_ERROR(e) printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e)) #if CONFIG_PGTABLE_LEVELS == 4 #define pud_ERROR(e) printk("%s:%d: bad pud %016lx.\n", __FILE__, __LINE__, pud_val(e)) diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index 855d949d81df..fc4e4217e87f 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c @@ -273,7 +273,7 @@ static int __init gate_vma_init(void) gate_vma.vm_start = FIXADDR_USER_START; gate_vma.vm_end = FIXADDR_USER_END; gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; - gate_vma.vm_page_prot = __P101; + gate_vma.vm_page_prot = __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_RX); return 0; } @@ -490,3 +490,29 @@ void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap) __remove_pages(start_pfn, nr_pages, altmap); } #endif + +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READONLY, + [VM_WRITE] = PAGE_READONLY, + [VM_WRITE | VM_READ]= PAGE_READONLY, + [VM_EXEC] = __pgprot(__ACCESS_BITS | _PAGE_PL_3 | + _PAGE_AR_X_RX), + [VM_EXEC | VM_READ] = __pgprot(__ACCESS_BITS | _PAGE_PL_3 | + _PAGE_AR_RX), + [VM_EXEC | VM_WRITE]= PAGE_COPY_EXEC, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_COPY_EXEC, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READONLY, + [VM_SHARED | VM_WRITE] = PAGE_SHARED, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED, + [VM_SHARED | VM_EXEC] = __pgprot(__ACCESS_BITS | _PAGE_PL_3 | + _PAGE_AR_X_RX), + [VM_SHARED | VM_EXEC | VM_READ] = __pgprot(__ACCESS_BITS | _PAGE_PL_3 | + _PAGE_AR_RX), + [VM_SHARED | VM_EXEC | VM_WRITE]= __pgprot(__ACCESS_BITS | _PAGE_PL_3 | + _PAGE_AR_RWX), + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = __pgprot(__ACCESS_BITS | _PAGE_PL_3 | + _PAGE_AR_RWX) +}; +DECLARE_VM_GET_PAGE_PROT -- 2.25.1
[PATCH V6 18/26] s390/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Heiko Carstens Cc: Vasily Gorbik Cc: linux-s...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/s390/Kconfig | 1 + arch/s390/include/asm/pgtable.h | 17 - arch/s390/mm/mmap.c | 20 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 91c0b80a8bf0..c4481377ca83 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -81,6 +81,7 @@ config S390 select ARCH_HAS_SYSCALL_WRAPPER select ARCH_HAS_UBSAN_SANITIZE_ALL select ARCH_HAS_VDSO_DATA + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_INLINE_READ_LOCK select ARCH_INLINE_READ_LOCK_BH diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index a397b072a580..c63a05b5368a 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h @@ -424,23 +424,6 @@ static inline int is_module_addr(void *addr) * implies read permission. */ /*xwr*/ -#define __P000 PAGE_NONE -#define __P001 PAGE_RO -#define __P010 PAGE_RO -#define __P011 PAGE_RO -#define __P100 PAGE_RX -#define __P101 PAGE_RX -#define __P110 PAGE_RX -#define __P111 PAGE_RX - -#define __S000 PAGE_NONE -#define __S001 PAGE_RO -#define __S010 PAGE_RW -#define __S011 PAGE_RW -#define __S100 PAGE_RX -#define __S101 PAGE_RX -#define __S110 PAGE_RWX -#define __S111 PAGE_RWX /* * Segment entry (large page) protection definitions. diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c index d545f5c39f7e..5980ce348832 100644 --- a/arch/s390/mm/mmap.c +++ b/arch/s390/mm/mmap.c @@ -188,3 +188,23 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) mm->get_unmapped_area = arch_get_unmapped_area_topdown; } } + +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_RO, + [VM_WRITE] = PAGE_RO, + [VM_WRITE | VM_READ]= PAGE_RO, + [VM_EXEC] = PAGE_RX, + [VM_EXEC | VM_READ] = PAGE_RX, + [VM_EXEC | VM_WRITE]= PAGE_RX, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_RX, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_RO, + [VM_SHARED | VM_WRITE] = PAGE_RW, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_RW, + [VM_SHARED | VM_EXEC] = PAGE_RX, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_RX, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_RWX, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_RWX +}; +DECLARE_VM_GET_PAGE_PROT -- 2.25.1
[PATCH V6 17/26] csky/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Geert Uytterhoeven Cc: linux-c...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Acked-by: Guo Ren Signed-off-by: Anshuman Khandual --- arch/csky/Kconfig | 1 + arch/csky/include/asm/pgtable.h | 18 -- arch/csky/mm/init.c | 20 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index 21d72b078eef..588b8a9c68ed 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -6,6 +6,7 @@ config CSKY select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_QUEUED_RWLOCKS select ARCH_WANT_FRAME_POINTERS if !CPU_CK610 && $(cc-option,-mbacktrace) diff --git a/arch/csky/include/asm/pgtable.h b/arch/csky/include/asm/pgtable.h index bbe24511..229a5f4ad7fc 100644 --- a/arch/csky/include/asm/pgtable.h +++ b/arch/csky/include/asm/pgtable.h @@ -77,24 +77,6 @@ #define MAX_SWAPFILES_CHECK() \ BUILD_BUG_ON(MAX_SWAPFILES_SHIFT != 5) -#define __P000 PAGE_NONE -#define __P001 PAGE_READ -#define __P010 PAGE_READ -#define __P011 PAGE_READ -#define __P100 PAGE_READ -#define __P101 PAGE_READ -#define __P110 PAGE_READ -#define __P111 PAGE_READ - -#define __S000 PAGE_NONE -#define __S001 PAGE_READ -#define __S010 PAGE_WRITE -#define __S011 PAGE_WRITE -#define __S100 PAGE_READ -#define __S101 PAGE_READ -#define __S110 PAGE_WRITE -#define __S111 PAGE_WRITE - extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) diff --git a/arch/csky/mm/init.c b/arch/csky/mm/init.c index bf2004aa811a..bde7cabd23df 100644 --- a/arch/csky/mm/init.c +++ b/arch/csky/mm/init.c @@ -197,3 +197,23 @@ void __init fixaddr_init(void) vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; fixrange_init(vaddr, vaddr + PMD_SIZE, swapper_pg_dir); } + +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READ, + [VM_WRITE] = PAGE_READ, + [VM_WRITE | VM_READ]= PAGE_READ, + [VM_EXEC] = PAGE_READ, + [VM_EXEC | VM_READ] = PAGE_READ, + [VM_EXEC | VM_WRITE]= PAGE_READ, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_READ, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READ, + [VM_SHARED | VM_WRITE] = PAGE_WRITE, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_WRITE, + [VM_SHARED | VM_EXEC] = PAGE_READ, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_READ, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_WRITE, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_WRITE +}; +DECLARE_VM_GET_PAGE_PROT -- 2.25.1
[PATCH V6 16/26] riscv/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: linux-ri...@lists.infradead.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/pgtable.h | 20 arch/riscv/mm/init.c | 20 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 32ffef9f6e5b..583389d4e43a 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -32,6 +32,7 @@ config RISCV select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UBSAN_SANITIZE_ALL + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT select ARCH_STACKWALK diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 1d1be9d9419c..23e643db6575 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -186,26 +186,6 @@ extern struct pt_alloc_ops pt_ops __initdata; extern pgd_t swapper_pg_dir[]; -/* MAP_PRIVATE permissions: xwr (copy-on-write) */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READ -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_EXEC -#define __P101 PAGE_READ_EXEC -#define __P110 PAGE_COPY_EXEC -#define __P111 PAGE_COPY_READ_EXEC - -/* MAP_SHARED permissions: xwr */ -#define __S000 PAGE_NONE -#define __S001 PAGE_READ -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_EXEC -#define __S101 PAGE_READ_EXEC -#define __S110 PAGE_SHARED_EXEC -#define __S111 PAGE_SHARED_EXEC - #ifdef CONFIG_TRANSPARENT_HUGEPAGE static inline int pmd_present(pmd_t pmd) { diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index d466ec670e1f..a88b7dc31a68 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -288,6 +288,26 @@ static pmd_t __maybe_unused early_dtb_pmd[PTRS_PER_PMD] __initdata __aligned(PAG #define early_pg_dir ((pgd_t *)XIP_FIXUP(early_pg_dir)) #endif /* CONFIG_XIP_KERNEL */ +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READ, + [VM_WRITE] = PAGE_COPY, + [VM_WRITE | VM_READ]= PAGE_COPY, + [VM_EXEC] = PAGE_EXEC, + [VM_EXEC | VM_READ] = PAGE_READ_EXEC, + [VM_EXEC | VM_WRITE]= PAGE_COPY_EXEC, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_COPY_READ_EXEC, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READ, + [VM_SHARED | VM_WRITE] = PAGE_SHARED, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED, + [VM_SHARED | VM_EXEC] = PAGE_EXEC, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_READ_EXEC, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_SHARED_EXEC, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_SHARED_EXEC +}; +DECLARE_VM_GET_PAGE_PROT + void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot) { unsigned long addr = __fix_to_virt(idx); -- 2.25.1
[PATCH V6 15/26] nios2/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Dinh Nguyen Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/nios2/Kconfig | 1 + arch/nios2/include/asm/pgtable.h | 16 arch/nios2/mm/init.c | 20 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index 4167f1eb4cd8..e0459dffd218 100644 --- a/arch/nios2/Kconfig +++ b/arch/nios2/Kconfig @@ -6,6 +6,7 @@ config NIOS2 select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_HAS_DMA_SET_UNCACHED + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_NO_SWAP select COMMON_CLK select TIMER_OF diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/asm/pgtable.h index 262d0609268c..470516d4555e 100644 --- a/arch/nios2/include/asm/pgtable.h +++ b/arch/nios2/include/asm/pgtable.h @@ -40,24 +40,8 @@ struct mm_struct; */ /* Remove W bit on private pages for COW support */ -#define __P000 MKP(0, 0, 0) -#define __P001 MKP(0, 0, 1) -#define __P010 MKP(0, 0, 0)/* COW */ -#define __P011 MKP(0, 0, 1)/* COW */ -#define __P100 MKP(1, 0, 0) -#define __P101 MKP(1, 0, 1) -#define __P110 MKP(1, 0, 0)/* COW */ -#define __P111 MKP(1, 0, 1)/* COW */ /* Shared pages can have exact HW mapping */ -#define __S000 MKP(0, 0, 0) -#define __S001 MKP(0, 0, 1) -#define __S010 MKP(0, 1, 0) -#define __S011 MKP(0, 1, 1) -#define __S100 MKP(1, 0, 0) -#define __S101 MKP(1, 0, 1) -#define __S110 MKP(1, 1, 0) -#define __S111 MKP(1, 1, 1) /* Used all over the kernel */ #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_CACHED | _PAGE_READ | \ diff --git a/arch/nios2/mm/init.c b/arch/nios2/mm/init.c index 613fcaa5988a..ae24687d12ad 100644 --- a/arch/nios2/mm/init.c +++ b/arch/nios2/mm/init.c @@ -124,3 +124,23 @@ const char *arch_vma_name(struct vm_area_struct *vma) { return (vma->vm_start == KUSER_BASE) ? "[kuser]" : NULL; } + +static const pgprot_t protection_map[16] = { + [VM_NONE] = MKP(0, 0, 0), + [VM_READ] = MKP(0, 0, 1), + [VM_WRITE] = MKP(0, 0, 0), + [VM_WRITE | VM_READ]= MKP(0, 0, 1), + [VM_EXEC] = MKP(1, 0, 0), + [VM_EXEC | VM_READ] = MKP(1, 0, 1), + [VM_EXEC | VM_WRITE]= MKP(1, 0, 0), + [VM_EXEC | VM_WRITE | VM_READ] = MKP(1, 0, 1), + [VM_SHARED] = MKP(0, 0, 0), + [VM_SHARED | VM_READ] = MKP(0, 0, 1), + [VM_SHARED | VM_WRITE] = MKP(0, 1, 0), + [VM_SHARED | VM_WRITE | VM_READ]= MKP(0, 1, 1), + [VM_SHARED | VM_EXEC] = MKP(1, 0, 0), + [VM_SHARED | VM_EXEC | VM_READ] = MKP(1, 0, 1), + [VM_SHARED | VM_EXEC | VM_WRITE]= MKP(1, 1, 0), + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = MKP(1, 1, 1) +}; +DECLARE_VM_GET_PAGE_PROT -- 2.25.1
[PATCH V6 14/26] alpha/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Richard Henderson Cc: linux-al...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/alpha/Kconfig | 1 + arch/alpha/include/asm/pgtable.h | 17 - arch/alpha/mm/init.c | 22 ++ 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 7d0d26b5b3f5..db1c8b329461 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -2,6 +2,7 @@ config ALPHA bool default y + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_32BIT_USTAT_F_TINODE select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h index 170451fde043..3ea9661c09ff 100644 --- a/arch/alpha/include/asm/pgtable.h +++ b/arch/alpha/include/asm/pgtable.h @@ -116,23 +116,6 @@ struct vm_area_struct; * arch/alpha/mm/fault.c) */ /* xwr */ -#define __P000 _PAGE_P(_PAGE_FOE | _PAGE_FOW | _PAGE_FOR) -#define __P001 _PAGE_P(_PAGE_FOE | _PAGE_FOW) -#define __P010 _PAGE_P(_PAGE_FOE) -#define __P011 _PAGE_P(_PAGE_FOE) -#define __P100 _PAGE_P(_PAGE_FOW | _PAGE_FOR) -#define __P101 _PAGE_P(_PAGE_FOW) -#define __P110 _PAGE_P(0) -#define __P111 _PAGE_P(0) - -#define __S000 _PAGE_S(_PAGE_FOE | _PAGE_FOW | _PAGE_FOR) -#define __S001 _PAGE_S(_PAGE_FOE | _PAGE_FOW) -#define __S010 _PAGE_S(_PAGE_FOE) -#define __S011 _PAGE_S(_PAGE_FOE) -#define __S100 _PAGE_S(_PAGE_FOW | _PAGE_FOR) -#define __S101 _PAGE_S(_PAGE_FOW) -#define __S110 _PAGE_S(0) -#define __S111 _PAGE_S(0) /* * pgprot_noncached() is only for infiniband pci support, and a real diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c index 7511723b7669..a155180d7a83 100644 --- a/arch/alpha/mm/init.c +++ b/arch/alpha/mm/init.c @@ -280,3 +280,25 @@ mem_init(void) high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); memblock_free_all(); } + +static const pgprot_t protection_map[16] = { + [VM_NONE] = _PAGE_P(_PAGE_FOE | _PAGE_FOW | + _PAGE_FOR), + [VM_READ] = _PAGE_P(_PAGE_FOE | _PAGE_FOW), + [VM_WRITE] = _PAGE_P(_PAGE_FOE), + [VM_WRITE | VM_READ]= _PAGE_P(_PAGE_FOE), + [VM_EXEC] = _PAGE_P(_PAGE_FOW | _PAGE_FOR), + [VM_EXEC | VM_READ] = _PAGE_P(_PAGE_FOW), + [VM_EXEC | VM_WRITE]= _PAGE_P(0), + [VM_EXEC | VM_WRITE | VM_READ] = _PAGE_P(0), + [VM_SHARED] = _PAGE_S(_PAGE_FOE | _PAGE_FOW | + _PAGE_FOR), + [VM_SHARED | VM_READ] = _PAGE_S(_PAGE_FOE | _PAGE_FOW), + [VM_SHARED | VM_WRITE] = _PAGE_S(_PAGE_FOE), + [VM_SHARED | VM_WRITE | VM_READ]= _PAGE_S(_PAGE_FOE), + [VM_SHARED | VM_EXEC] = _PAGE_S(_PAGE_FOW | _PAGE_FOR), + [VM_SHARED | VM_EXEC | VM_READ] = _PAGE_S(_PAGE_FOW), + [VM_SHARED | VM_EXEC | VM_WRITE]= _PAGE_S(0), + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = _PAGE_S(0) +}; +DECLARE_VM_GET_PAGE_PROT -- 2.25.1
[PATCH V6 13/26] parisc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: "James E.J. Bottomley" Cc: linux-par...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/parisc/Kconfig | 1 + arch/parisc/include/asm/pgtable.h | 18 -- arch/parisc/mm/init.c | 20 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index fa400055b2d5..891d82393957 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -12,6 +12,7 @@ config PARISC select ARCH_HAS_STRICT_KERNEL_RWX select ARCH_HAS_STRICT_MODULE_RWX select ARCH_HAS_UBSAN_SANITIZE_ALL + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_HAS_PTE_SPECIAL select ARCH_NO_SG_CHAIN select ARCH_SUPPORTS_HUGETLBFS if PA20 diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h index 69765a6dbe89..6a1899a9b420 100644 --- a/arch/parisc/include/asm/pgtable.h +++ b/arch/parisc/include/asm/pgtable.h @@ -271,24 +271,6 @@ extern void __update_cache(pte_t pte); */ /*xwr*/ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 __P000 /* copy on write */ -#define __P011 __P001 /* copy on write */ -#define __P100 PAGE_EXECREAD -#define __P101 PAGE_EXECREAD -#define __P110 __P100 /* copy on write */ -#define __P111 __P101 /* copy on write */ - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_WRITEONLY -#define __S011 PAGE_SHARED -#define __S100 PAGE_EXECREAD -#define __S101 PAGE_EXECREAD -#define __S110 PAGE_RWX -#define __S111 PAGE_RWX - extern pgd_t swapper_pg_dir[]; /* declared in init_task.c */ diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 0a81499dd35e..f03e0961fa25 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c @@ -871,3 +871,23 @@ void flush_tlb_all(void) spin_unlock(&sid_lock); } #endif + +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READONLY, + [VM_WRITE] = PAGE_NONE, + [VM_WRITE | VM_READ]= PAGE_READONLY, + [VM_EXEC] = PAGE_EXECREAD, + [VM_EXEC | VM_READ] = PAGE_EXECREAD, + [VM_EXEC | VM_WRITE]= PAGE_EXECREAD, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_EXECREAD, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READONLY, + [VM_SHARED | VM_WRITE] = PAGE_WRITEONLY, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED, + [VM_SHARED | VM_EXEC] = PAGE_EXECREAD, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_EXECREAD, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_RWX, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_RWX +}; +DECLARE_VM_GET_PAGE_PROT -- 2.25.1
[PATCH V6 12/26] hexagon/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Brian Cain Cc: linux-hexa...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Acked-by: Brian Cain Signed-off-by: Anshuman Khandual --- arch/hexagon/Kconfig | 1 + arch/hexagon/include/asm/pgtable.h | 27 --- arch/hexagon/mm/init.c | 42 ++ 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig index 54eadf265178..bc4ceecd0588 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig @@ -6,6 +6,7 @@ config HEXAGON def_bool y select ARCH_32BIT_OFF_T select ARCH_HAS_SYNC_DMA_FOR_DEVICE + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_NO_PREEMPT select DMA_GLOBAL_POOL # Other pending projects/to-do items. diff --git a/arch/hexagon/include/asm/pgtable.h b/arch/hexagon/include/asm/pgtable.h index 0610724d6a28..f7048c18b6f9 100644 --- a/arch/hexagon/include/asm/pgtable.h +++ b/arch/hexagon/include/asm/pgtable.h @@ -126,33 +126,6 @@ extern unsigned long _dflt_cache_att; */ #define CACHEDEF (CACHE_DEFAULT << 6) -/* Private (copy-on-write) page protections. */ -#define __P000 __pgprot(_PAGE_PRESENT | _PAGE_USER | CACHEDEF) -#define __P001 __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_READ | CACHEDEF) -#define __P010 __P000 /* Write-only copy-on-write */ -#define __P011 __P001 /* Read/Write copy-on-write */ -#define __P100 __pgprot(_PAGE_PRESENT | _PAGE_USER | \ - _PAGE_EXECUTE | CACHEDEF) -#define __P101 __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_EXECUTE | \ - _PAGE_READ | CACHEDEF) -#define __P110 __P100 /* Write/execute copy-on-write */ -#define __P111 __P101 /* Read/Write/Execute, copy-on-write */ - -/* Shared page protections. */ -#define __S000 __P000 -#define __S001 __P001 -#define __S010 __pgprot(_PAGE_PRESENT | _PAGE_USER | \ - _PAGE_WRITE | CACHEDEF) -#define __S011 __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_READ | \ - _PAGE_WRITE | CACHEDEF) -#define __S100 __pgprot(_PAGE_PRESENT | _PAGE_USER | \ - _PAGE_EXECUTE | CACHEDEF) -#define __S101 __P101 -#define __S110 __pgprot(_PAGE_PRESENT | _PAGE_USER | \ - _PAGE_EXECUTE | _PAGE_WRITE | CACHEDEF) -#define __S111 __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_READ | \ - _PAGE_EXECUTE | _PAGE_WRITE | CACHEDEF) - extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; /* located in head.S */ /* HUGETLB not working currently */ diff --git a/arch/hexagon/mm/init.c b/arch/hexagon/mm/init.c index 3167a3b5c97b..146115c9de61 100644 --- a/arch/hexagon/mm/init.c +++ b/arch/hexagon/mm/init.c @@ -234,3 +234,45 @@ void __init setup_arch_memory(void) * which is called by start_kernel() later on in the process */ } + +static const pgprot_t protection_map[16] = { + [VM_NONE] = __pgprot(_PAGE_PRESENT | _PAGE_USER | + CACHEDEF), + [VM_READ] = __pgprot(_PAGE_PRESENT | _PAGE_USER | + _PAGE_READ | CACHEDEF), + [VM_WRITE] = __pgprot(_PAGE_PRESENT | _PAGE_USER | + CACHEDEF), + [VM_WRITE | VM_READ]= __pgprot(_PAGE_PRESENT | _PAGE_USER | + _PAGE_READ | CACHEDEF), + [VM_EXEC] = __pgprot(_PAGE_PRESENT | _PAGE_USER | + _PAGE_EXECUTE | CACHEDEF), + [VM_EXEC | VM_READ] = __pgprot(_PAGE_PRESENT | _PAGE_USER | + _PAGE_EXECUTE | _PAGE_READ | + CACHEDEF), + [VM_EXEC | VM_WRITE]= __pgprot(_PAGE_PRESENT | _PAGE_USER | + _PAGE_EXECUTE | CACHEDEF), + [VM_EXEC | VM_WRITE | VM_READ] = __pgprot(_PAGE_PRESENT | _PAGE_USER | + _PAGE_EXECUTE | _PAGE_READ | + CACHEDEF), + [VM_SHARED] = __pgprot(_PAGE_PRESENT | _PAGE_USER | +
[PATCH V6 11/26] xtensa/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Chris Zankel Cc: Guo Ren Cc: linux-xte...@linux-xtensa.org Cc: linux-c...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/xtensa/Kconfig | 1 + arch/xtensa/include/asm/pgtable.h | 18 -- arch/xtensa/mm/init.c | 20 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 0b0f0172cced..4c0d83520ff1 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -11,6 +11,7 @@ config XTENSA select ARCH_HAS_DMA_SET_UNCACHED if MMU select ARCH_HAS_STRNCPY_FROM_USER if !KASAN select ARCH_HAS_STRNLEN_USER + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_USE_MEMTEST select ARCH_USE_QUEUED_RWLOCKS select ARCH_USE_QUEUED_SPINLOCKS diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h index 0a91376131c5..e0d5531ae00d 100644 --- a/arch/xtensa/include/asm/pgtable.h +++ b/arch/xtensa/include/asm/pgtable.h @@ -200,24 +200,6 @@ * What follows is the closest we can get by reasonable means.. * See linux/mm/mmap.c for protection_map[] array that uses these definitions. */ -#define __P000 PAGE_NONE /* private --- */ -#define __P001 PAGE_READONLY /* private --r */ -#define __P010 PAGE_COPY /* private -w- */ -#define __P011 PAGE_COPY /* private -wr */ -#define __P100 PAGE_READONLY_EXEC /* private x-- */ -#define __P101 PAGE_READONLY_EXEC /* private x-r */ -#define __P110 PAGE_COPY_EXEC /* private xw- */ -#define __P111 PAGE_COPY_EXEC /* private xwr */ - -#define __S000 PAGE_NONE /* shared --- */ -#define __S001 PAGE_READONLY /* shared --r */ -#define __S010 PAGE_SHARED /* shared -w- */ -#define __S011 PAGE_SHARED /* shared -wr */ -#define __S100 PAGE_READONLY_EXEC /* shared x-- */ -#define __S101 PAGE_READONLY_EXEC /* shared x-r */ -#define __S110 PAGE_SHARED_EXEC/* shared xw- */ -#define __S111 PAGE_SHARED_EXEC/* shared xwr */ - #ifndef __ASSEMBLY__ #define pte_ERROR(e) \ diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c index 6a32b2cf2718..fb830ec8183c 100644 --- a/arch/xtensa/mm/init.c +++ b/arch/xtensa/mm/init.c @@ -216,3 +216,23 @@ static int __init parse_memmap_opt(char *str) return 0; } early_param("memmap", parse_memmap_opt); + +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READONLY, + [VM_WRITE] = PAGE_COPY, + [VM_WRITE | VM_READ]= PAGE_COPY, + [VM_EXEC] = PAGE_READONLY_EXEC, + [VM_EXEC | VM_READ] = PAGE_READONLY_EXEC, + [VM_EXEC | VM_WRITE]= PAGE_COPY_EXEC, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_COPY_EXEC, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READONLY, + [VM_SHARED | VM_WRITE] = PAGE_SHARED, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED, + [VM_SHARED | VM_EXEC] = PAGE_READONLY_EXEC, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_READONLY_EXEC, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_SHARED_EXEC, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_SHARED_EXEC +}; +DECLARE_VM_GET_PAGE_PROT -- 2.25.1
[PATCH V6 10/26] openrisc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Jonas Bonn Cc: openr...@lists.librecores.org Cc: linux-ker...@vger.kernel.org Acked-by: Stafford Horne Signed-off-by: Anshuman Khandual --- arch/openrisc/Kconfig | 1 + arch/openrisc/include/asm/pgtable.h | 18 -- arch/openrisc/mm/init.c | 20 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index e814df4c483c..fe0dfb50eb86 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig @@ -10,6 +10,7 @@ config OPENRISC select ARCH_HAS_DMA_SET_UNCACHED select ARCH_HAS_DMA_CLEAR_UNCACHED select ARCH_HAS_SYNC_DMA_FOR_DEVICE + select ARCH_HAS_VM_GET_PAGE_PROT select COMMON_CLK select OF select OF_EARLY_FLATTREE diff --git a/arch/openrisc/include/asm/pgtable.h b/arch/openrisc/include/asm/pgtable.h index c3abbf71e09f..dcae8aea132f 100644 --- a/arch/openrisc/include/asm/pgtable.h +++ b/arch/openrisc/include/asm/pgtable.h @@ -176,24 +176,6 @@ extern void paging_init(void); __pgprot(_PAGE_ALL | _PAGE_SRE | _PAGE_SWE \ | _PAGE_SHARED | _PAGE_DIRTY | _PAGE_EXEC | _PAGE_CI) -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY_X -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY_X -#define __P100 PAGE_READONLY -#define __P101 PAGE_READONLY_X -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY_X - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY_X -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED_X -#define __S100 PAGE_READONLY -#define __S101 PAGE_READONLY_X -#define __S110 PAGE_SHARED -#define __S111 PAGE_SHARED_X - /* zero page used for uninitialized stuff */ extern unsigned long empty_zero_page[2048]; #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c index 3a021ab6f1ae..d531ab82be12 100644 --- a/arch/openrisc/mm/init.c +++ b/arch/openrisc/mm/init.c @@ -208,3 +208,23 @@ void __init mem_init(void) mem_init_done = 1; return; } + +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READONLY_X, + [VM_WRITE] = PAGE_COPY, + [VM_WRITE | VM_READ]= PAGE_COPY_X, + [VM_EXEC] = PAGE_READONLY, + [VM_EXEC | VM_READ] = PAGE_READONLY_X, + [VM_EXEC | VM_WRITE]= PAGE_COPY, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_COPY_X, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READONLY_X, + [VM_SHARED | VM_WRITE] = PAGE_SHARED, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED_X, + [VM_SHARED | VM_EXEC] = PAGE_READONLY, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_READONLY_X, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_SHARED, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_SHARED_X +}; +DECLARE_VM_GET_PAGE_PROT -- 2.25.1
[PATCH V6 09/26] loongarch/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Huacai Chen Cc: WANG Xuerui Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/loongarch/Kconfig| 1 + arch/loongarch/include/asm/pgtable-bits.h | 19 -- arch/loongarch/mm/cache.c | 46 +++ 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index 1920d52653b4..fd07b8e760ee 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -9,6 +9,7 @@ config LOONGARCH select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_PHYS_TO_DMA select ARCH_HAS_PTE_SPECIAL + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_INLINE_READ_LOCK if !PREEMPTION select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION diff --git a/arch/loongarch/include/asm/pgtable-bits.h b/arch/loongarch/include/asm/pgtable-bits.h index 3badd112d9ab..9ca147a29bab 100644 --- a/arch/loongarch/include/asm/pgtable-bits.h +++ b/arch/loongarch/include/asm/pgtable-bits.h @@ -83,25 +83,6 @@ _PAGE_GLOBAL | _PAGE_KERN | _CACHE_SUC) #define PAGE_KERNEL_WUC __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \ _PAGE_GLOBAL | _PAGE_KERN | _CACHE_WUC) - -#define __P000 __pgprot(_CACHE_CC | _PAGE_USER | _PAGE_PROTNONE | _PAGE_NO_EXEC | _PAGE_NO_READ) -#define __P001 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT | _PAGE_NO_EXEC) -#define __P010 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT | _PAGE_NO_EXEC) -#define __P011 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT | _PAGE_NO_EXEC) -#define __P100 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT) -#define __P101 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT) -#define __P110 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT) -#define __P111 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT) - -#define __S000 __pgprot(_CACHE_CC | _PAGE_USER | _PAGE_PROTNONE | _PAGE_NO_EXEC | _PAGE_NO_READ) -#define __S001 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT | _PAGE_NO_EXEC) -#define __S010 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE) -#define __S011 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE) -#define __S100 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT) -#define __S101 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT) -#define __S110 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT | _PAGE_WRITE) -#define __S111 __pgprot(_CACHE_CC | _PAGE_VALID | _PAGE_USER | _PAGE_PRESENT | _PAGE_WRITE) - #ifndef __ASSEMBLY__ #define pgprot_noncached pgprot_noncached diff --git a/arch/loongarch/mm/cache.c b/arch/loongarch/mm/cache.c index 9e5ce5aa73f7..e8c68dcf6ab2 100644 --- a/arch/loongarch/mm/cache.c +++ b/arch/loongarch/mm/cache.c @@ -139,3 +139,49 @@ void cpu_cache_init(void) shm_align_mask = PAGE_SIZE - 1; } + +static const pgprot_t protection_map[16] = { + [VM_NONE] = __pgprot(_CACHE_CC | _PAGE_USER | + _PAGE_PROTNONE | _PAGE_NO_EXEC | + _PAGE_NO_READ), + [VM_READ] = __pgprot(_CACHE_CC | _PAGE_VALID | + _PAGE_USER | _PAGE_PRESENT | + _PAGE_NO_EXEC), + [VM_WRITE] = __pgprot(_CACHE_CC | _PAGE_VALID | + _PAGE_USER | _PAGE_PRESENT | + _PAGE_NO_EXEC), + [VM_WRITE | VM_READ]= __pgprot(_CACHE_CC | _PAGE_VALID | + _PAGE_USER | _PAGE_PRESENT | + _PAGE_NO_EXEC), + [VM_EXEC] = __pgprot(_CACHE_CC | _PAGE_VALID | + _PAGE_USER | _PAGE_PRESENT), + [VM_EXEC | VM_READ] = __pgprot(_CACHE_CC | _PAGE_VALID | + _PAGE_USER | _PAGE_PRESENT), + [VM_EXEC |
[PATCH V6 08/26] microblaze/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT
This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks up a private and static protection_map[] array. Subsequently all __SXXX and __PXXX macros can be dropped which are no longer needed. Cc: Michal Simek Cc: linux-ker...@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/microblaze/Kconfig | 1 + arch/microblaze/include/asm/pgtable.h | 17 - arch/microblaze/mm/init.c | 20 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 8cf429ad1c84..15f91ba8a0c4 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig @@ -7,6 +7,7 @@ config MICROBLAZE select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_WANT_IPC_PARSE_VERSION select BUILDTIME_TABLE_SORT diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h index 0c72646370e1..ba348e997dbb 100644 --- a/arch/microblaze/include/asm/pgtable.h +++ b/arch/microblaze/include/asm/pgtable.h @@ -204,23 +204,6 @@ extern pte_t *va_to_pte(unsigned long address); * We consider execute permission the same as read. * Also, write permissions imply read permissions. */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY_X -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY_X -#define __P100 PAGE_READONLY -#define __P101 PAGE_READONLY_X -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY_X - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY_X -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED_X -#define __S100 PAGE_READONLY -#define __S101 PAGE_READONLY_X -#define __S110 PAGE_SHARED -#define __S111 PAGE_SHARED_X #ifndef __ASSEMBLY__ /* diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c index f4e503461d24..353fabdfcbc5 100644 --- a/arch/microblaze/mm/init.c +++ b/arch/microblaze/mm/init.c @@ -285,3 +285,23 @@ void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask) return p; } + +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READONLY_X, + [VM_WRITE] = PAGE_COPY, + [VM_WRITE | VM_READ]= PAGE_COPY_X, + [VM_EXEC] = PAGE_READONLY, + [VM_EXEC | VM_READ] = PAGE_READONLY_X, + [VM_EXEC | VM_WRITE]= PAGE_COPY, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_COPY_X, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READONLY_X, + [VM_SHARED | VM_WRITE] = PAGE_SHARED, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED_X, + [VM_SHARED | VM_EXEC] = PAGE_READONLY, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_READONLY_X, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_SHARED, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_SHARED_X +}; +DECLARE_VM_GET_PAGE_PROT -- 2.25.1
[PATCH V6 07/26] mm/mmap: Build protect protection_map[] with ARCH_HAS_VM_GET_PAGE_PROT
Now that protection_map[] has been moved inside those platforms that enable ARCH_HAS_VM_GET_PAGE_PROT. Hence generic protection_map[] array now can be protected with CONFIG_ARCH_HAS_VM_GET_PAGE_PROT intead of __P000. Cc: Andrew Morton Cc: linux...@kvack.org Cc: linux-ker...@vger.kernel.org Reviewed-by: Christophe Leroy Signed-off-by: Anshuman Khandual --- include/linux/mm.h | 2 +- mm/mmap.c | 5 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 0ff0a1bad091..07b56995e0fe 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -424,7 +424,7 @@ extern unsigned int kobjsize(const void *objp); * mapping from the currently active vm_flags protection bits (the * low four bits) to a page protection mask.. */ -#ifdef __P000 +#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT extern pgprot_t protection_map[16]; #endif diff --git a/mm/mmap.c b/mm/mmap.c index b46d5e931bb3..2cc722e162fa 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -81,7 +81,7 @@ static void unmap_region(struct mm_struct *mm, struct vm_area_struct *vma, struct vm_area_struct *prev, unsigned long start, unsigned long end); -#ifdef __P000 +#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT pgprot_t protection_map[16] __ro_after_init = { [VM_NONE] = __P000, [VM_READ] = __P001, @@ -100,9 +100,6 @@ pgprot_t protection_map[16] __ro_after_init = { [VM_SHARED | VM_EXEC | VM_WRITE]= __S110, [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = __S111 }; -#endif - -#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT DECLARE_VM_GET_PAGE_PROT #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */ -- 2.25.1
[PATCH V6 06/26] x86/mm: Move protection_map[] inside the platform
This moves protection_map[] inside the platform and makes it a static. This also defines a helper function add_encrypt_protection_map() that can update the protection_map[] array with pgprot_encrypted(). Cc: Thomas Gleixner Cc: Ingo Molnar Cc: x...@kernel.org Cc: linux-ker...@vger.kernel.org Reviewed-by: Christoph Hellwig Signed-off-by: Anshuman Khandual --- arch/x86/include/asm/pgtable_types.h | 19 --- arch/x86/mm/mem_encrypt_amd.c| 7 +++ arch/x86/mm/pgprot.c | 27 +++ 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index bdaf8391e2e0..aa174fed3a71 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h @@ -230,25 +230,6 @@ enum page_cache_mode { #endif /* __ASSEMBLY__ */ -/* xwr */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_READONLY_EXEC -#define __P101 PAGE_READONLY_EXEC -#define __P110 PAGE_COPY_EXEC -#define __P111 PAGE_COPY_EXEC - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY_EXEC -#define __S101 PAGE_READONLY_EXEC -#define __S110 PAGE_SHARED_EXEC -#define __S111 PAGE_SHARED_EXEC - /* * early identity mapping pte attrib macros. */ diff --git a/arch/x86/mm/mem_encrypt_amd.c b/arch/x86/mm/mem_encrypt_amd.c index f6d038e2cd8e..4b3ec87e8c7d 100644 --- a/arch/x86/mm/mem_encrypt_amd.c +++ b/arch/x86/mm/mem_encrypt_amd.c @@ -484,10 +484,10 @@ void __init early_set_mem_enc_dec_hypercall(unsigned long vaddr, int npages, boo enc_dec_hypercall(vaddr, npages, enc); } +void add_encrypt_protection_map(void); + void __init sme_early_init(void) { - unsigned int i; - if (!sme_me_mask) return; @@ -496,8 +496,7 @@ void __init sme_early_init(void) __supported_pte_mask = __sme_set(__supported_pte_mask); /* Update the protection map with memory encryption mask */ - for (i = 0; i < ARRAY_SIZE(protection_map); i++) - protection_map[i] = pgprot_encrypted(protection_map[i]); + add_encrypt_protection_map(); x86_platform.guest.enc_status_change_prepare = amd_enc_status_change_prepare; x86_platform.guest.enc_status_change_finish = amd_enc_status_change_finish; diff --git a/arch/x86/mm/pgprot.c b/arch/x86/mm/pgprot.c index 763742782286..b867839b16aa 100644 --- a/arch/x86/mm/pgprot.c +++ b/arch/x86/mm/pgprot.c @@ -4,6 +4,33 @@ #include #include +static pgprot_t protection_map[16] __ro_after_init = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READONLY, + [VM_WRITE] = PAGE_COPY, + [VM_WRITE | VM_READ]= PAGE_COPY, + [VM_EXEC] = PAGE_READONLY_EXEC, + [VM_EXEC | VM_READ] = PAGE_READONLY_EXEC, + [VM_EXEC | VM_WRITE]= PAGE_COPY_EXEC, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_COPY_EXEC, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READONLY, + [VM_SHARED | VM_WRITE] = PAGE_SHARED, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED, + [VM_SHARED | VM_EXEC] = PAGE_READONLY_EXEC, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_READONLY_EXEC, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_SHARED_EXEC, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_SHARED_EXEC +}; + +void add_encrypt_protection_map(void) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(protection_map); i++) + protection_map[i] = pgprot_encrypted(protection_map[i]); +} + pgprot_t vm_get_page_prot(unsigned long vm_flags) { unsigned long val = pgprot_val(protection_map[vm_flags & -- 2.25.1
[PATCH V6 05/26] arm64/mm: Move protection_map[] inside the platform
This moves protection_map[] inside the platform and makes it a static. Cc: Catalin Marinas Cc: Will Deacon Cc: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org Reviewed-by: Catalin Marinas Signed-off-by: Anshuman Khandual --- arch/arm64/include/asm/pgtable-prot.h | 18 -- arch/arm64/mm/mmap.c | 21 + 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h index 62e0ebeed720..9b165117a454 100644 --- a/arch/arm64/include/asm/pgtable-prot.h +++ b/arch/arm64/include/asm/pgtable-prot.h @@ -89,24 +89,6 @@ extern bool arm64_use_ng_mappings; #define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN) #define PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_RDONLY | PTE_NG | PTE_PXN) -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_READONLY -#define __P011 PAGE_READONLY -#define __P100 PAGE_READONLY_EXEC /* PAGE_EXECONLY if Enhanced PAN */ -#define __P101 PAGE_READONLY_EXEC -#define __P110 PAGE_READONLY_EXEC -#define __P111 PAGE_READONLY_EXEC - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY_EXEC /* PAGE_EXECONLY if Enhanced PAN */ -#define __S101 PAGE_READONLY_EXEC -#define __S110 PAGE_SHARED_EXEC -#define __S111 PAGE_SHARED_EXEC - #endif /* __ASSEMBLY__ */ #endif /* __ASM_PGTABLE_PROT_H */ diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c index 78e9490f748d..8f5b7ce857ed 100644 --- a/arch/arm64/mm/mmap.c +++ b/arch/arm64/mm/mmap.c @@ -13,6 +13,27 @@ #include #include +static pgprot_t protection_map[16] __ro_after_init = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READONLY, + [VM_WRITE] = PAGE_READONLY, + [VM_WRITE | VM_READ]= PAGE_READONLY, + /* PAGE_EXECONLY if Enhanced PAN */ + [VM_EXEC] = PAGE_READONLY_EXEC, + [VM_EXEC | VM_READ] = PAGE_READONLY_EXEC, + [VM_EXEC | VM_WRITE]= PAGE_READONLY_EXEC, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_READONLY_EXEC, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READONLY, + [VM_SHARED | VM_WRITE] = PAGE_SHARED, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED, + /* PAGE_EXECONLY if Enhanced PAN */ + [VM_SHARED | VM_EXEC] = PAGE_READONLY_EXEC, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_READONLY_EXEC, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_SHARED_EXEC, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_SHARED_EXEC +}; + /* * You really shouldn't be using read() or write() on /dev/mem. This might go * away in the future. -- 2.25.1
[PATCH V6 04/26] sparc/mm: Move protection_map[] inside the platform
This moves protection_map[] inside the platform and while here, also enable ARCH_HAS_VM_GET_PAGE_PROT on 32 bit platforms via DECLARE_VM_GET_PAGE_PROT. Cc: "David S. Miller" Cc: sparcli...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Reviewed-by: Sam Ravnborg Signed-off-by: Anshuman Khandual --- arch/sparc/Kconfig | 2 +- arch/sparc/include/asm/pgtable_32.h | 19 --- arch/sparc/include/asm/pgtable_64.h | 19 --- arch/sparc/mm/init_32.c | 20 arch/sparc/mm/init_64.c | 3 +++ 5 files changed, 24 insertions(+), 39 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index ba449c47effd..09f868613a4d 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -13,6 +13,7 @@ config 64BIT config SPARC bool default y + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI select ARCH_MIGHT_HAVE_PC_SERIO select DMA_OPS @@ -84,7 +85,6 @@ config SPARC64 select PERF_USE_VMALLOC select ARCH_HAVE_NMI_SAFE_CMPXCHG select HAVE_C_RECORDMCOUNT - select ARCH_HAS_VM_GET_PAGE_PROT select HAVE_ARCH_AUDITSYSCALL select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_DEBUG_PAGEALLOC diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index 4866625da314..8ff549004fac 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h @@ -64,25 +64,6 @@ void paging_init(void); extern unsigned long ptr_in_current_pgd; -/* xwr */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_READONLY -#define __P101 PAGE_READONLY -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY -#define __S101 PAGE_READONLY -#define __S110 PAGE_SHARED -#define __S111 PAGE_SHARED - /* First physical page can be anywhere, the following is needed so that * va-->pa and vice versa conversions work properly without performance * hit for all __pa()/__va() operations. diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index 4679e45c8348..a779418ceba9 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -187,25 +187,6 @@ bool kern_addr_valid(unsigned long addr); #define _PAGE_SZHUGE_4U_PAGE_SZ4MB_4U #define _PAGE_SZHUGE_4V_PAGE_SZ4MB_4V -/* These are actually filled in at boot time by sun4{u,v}_pgprot_init() */ -#define __P000 __pgprot(0) -#define __P001 __pgprot(0) -#define __P010 __pgprot(0) -#define __P011 __pgprot(0) -#define __P100 __pgprot(0) -#define __P101 __pgprot(0) -#define __P110 __pgprot(0) -#define __P111 __pgprot(0) - -#define __S000 __pgprot(0) -#define __S001 __pgprot(0) -#define __S010 __pgprot(0) -#define __S011 __pgprot(0) -#define __S100 __pgprot(0) -#define __S101 __pgprot(0) -#define __S110 __pgprot(0) -#define __S111 __pgprot(0) - #ifndef __ASSEMBLY__ pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long); diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index 1e9f577f084d..d88e774c8eb4 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c @@ -302,3 +302,23 @@ void sparc_flush_page_to_ram(struct page *page) __flush_page_to_ram(vaddr); } EXPORT_SYMBOL(sparc_flush_page_to_ram); + +static const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READONLY, + [VM_WRITE] = PAGE_COPY, + [VM_WRITE | VM_READ]= PAGE_COPY, + [VM_EXEC] = PAGE_READONLY, + [VM_EXEC | VM_READ] = PAGE_READONLY, + [VM_EXEC | VM_WRITE]= PAGE_COPY, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_COPY, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READONLY, + [VM_SHARED | VM_WRITE] = PAGE_SHARED, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED, + [VM_SHARED | VM_EXEC] = PAGE_READONLY, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_READONLY, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_SHARED, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_SHARED +}; +DECLARE_VM_GET_PAGE_PROT diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index f6174df2d5af..d6faee23c77d 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -2634,6 +2634,9 @@ vo
[PATCH V6 03/26] powerpc/mm: Move protection_map[] inside the platform
This moves protection_map[] inside the platform and while here, also enable ARCH_HAS_VM_GET_PAGE_PROT on 32 bit and nohash 64 (aka book3e/64) platforms via DECLARE_VM_GET_PAGE_PROT. Cc: Michael Ellerman Cc: Paul Mackerras Cc: Nicholas Piggin Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-ker...@vger.kernel.org Reviewed-by: Christophe Leroy Signed-off-by: Anshuman Khandual --- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/pgtable.h | 20 +--- arch/powerpc/mm/pgtable.c | 24 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c2ce2e60c8f0..1035d172c7dd 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -140,7 +140,7 @@ config PPC select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UACCESS_FLUSHCACHE select ARCH_HAS_UBSAN_SANITIZE_ALL - select ARCH_HAS_VM_GET_PAGE_PROTif PPC_BOOK3S_64 + select ARCH_HAS_VM_GET_PAGE_PROT select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_KEEP_MEMBLOCK select ARCH_MIGHT_HAVE_PC_PARPORT diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index d564d0ecd4cd..33f4bf8d22b0 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -20,25 +20,6 @@ struct mm_struct; #include #endif /* !CONFIG_PPC_BOOK3S */ -/* Note due to the way vm flags are laid out, the bits are XWR */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_READONLY_X -#define __P101 PAGE_READONLY_X -#define __P110 PAGE_COPY_X -#define __P111 PAGE_COPY_X - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY_X -#define __S101 PAGE_READONLY_X -#define __S110 PAGE_SHARED_X -#define __S111 PAGE_SHARED_X - #ifndef __ASSEMBLY__ #ifndef MAX_PTRS_PER_PGD @@ -79,6 +60,7 @@ extern void paging_init(void); void poking_init(void); extern unsigned long ioremap_bot; +extern const pgprot_t protection_map[16]; /* * kern_addr_valid is intended to indicate whether an address is a valid diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index e6166b71d36d..cb2dcdb18f8e 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c @@ -472,3 +472,27 @@ pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea, return ret_pte; } EXPORT_SYMBOL_GPL(__find_linux_pte); + +/* Note due to the way vm flags are laid out, the bits are XWR */ +const pgprot_t protection_map[16] = { + [VM_NONE] = PAGE_NONE, + [VM_READ] = PAGE_READONLY, + [VM_WRITE] = PAGE_COPY, + [VM_WRITE | VM_READ]= PAGE_COPY, + [VM_EXEC] = PAGE_READONLY_X, + [VM_EXEC | VM_READ] = PAGE_READONLY_X, + [VM_EXEC | VM_WRITE]= PAGE_COPY_X, + [VM_EXEC | VM_WRITE | VM_READ] = PAGE_COPY_X, + [VM_SHARED] = PAGE_NONE, + [VM_SHARED | VM_READ] = PAGE_READONLY, + [VM_SHARED | VM_WRITE] = PAGE_SHARED, + [VM_SHARED | VM_WRITE | VM_READ]= PAGE_SHARED, + [VM_SHARED | VM_EXEC] = PAGE_READONLY_X, + [VM_SHARED | VM_EXEC | VM_READ] = PAGE_READONLY_X, + [VM_SHARED | VM_EXEC | VM_WRITE]= PAGE_SHARED_X, + [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = PAGE_SHARED_X +}; + +#ifndef CONFIG_PPC_BOOK3S_64 +DECLARE_VM_GET_PAGE_PROT +#endif -- 2.25.1
[PATCH V6 02/26] mm/mmap: Define DECLARE_VM_GET_PAGE_PROT
This just converts the generic vm_get_page_prot() implementation into a new macro i.e DECLARE_VM_GET_PAGE_PROT which later can be used across platforms when enabling them with ARCH_HAS_VM_GET_PAGE_PROT. This does not create any functional change. Cc: Andrew Morton Cc: linux...@kvack.org Cc: linux-ker...@vger.kernel.org Reviewed-by: Christophe Leroy Suggested-by: Christoph Hellwig Signed-off-by: Anshuman Khandual --- include/linux/pgtable.h | 28 mm/mmap.c | 26 +- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 3cdc16cfd867..014ee8f0fbaa 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1689,4 +1689,32 @@ typedef unsigned int pgtbl_mod_mask; #define MAX_PTRS_PER_P4D PTRS_PER_P4D #endif +/* description of effects of mapping type and prot in current implementation. + * this is due to the limited x86 page protection hardware. The expected + * behavior is in parens: + * + * map_typeprot + * PROT_NONE PROT_READ PROT_WRITE PROT_EXEC + * MAP_SHARED r: (no) no r: (yes) yesr: (no) yes r: (no) yes + * w: (no) no w: (no) no w: (yes) yesw: (no) no + * x: (no) no x: (no) yes x: (no) yes x: (yes) yes + * + * MAP_PRIVATE r: (no) no r: (yes) yesr: (no) yes r: (no) yes + * w: (no) no w: (no) no w: (copy) copy w: (no) no + * x: (no) no x: (no) yes x: (no) yes x: (yes) yes + * + * On arm64, PROT_EXEC has the following behaviour for both MAP_SHARED and + * MAP_PRIVATE (with Enhanced PAN supported): + * r: (no) no + * w: (no) no + * x: (yes) yes + */ +#define DECLARE_VM_GET_PAGE_PROT \ +pgprot_t vm_get_page_prot(unsigned long vm_flags) \ +{ \ + return protection_map[vm_flags &\ + (VM_READ | VM_WRITE | VM_EXEC | VM_SHARED)];\ +} \ +EXPORT_SYMBOL(vm_get_page_prot); + #endif /* _LINUX_PGTABLE_H */ diff --git a/mm/mmap.c b/mm/mmap.c index b01f0280bda2..b46d5e931bb3 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -81,26 +81,6 @@ static void unmap_region(struct mm_struct *mm, struct vm_area_struct *vma, struct vm_area_struct *prev, unsigned long start, unsigned long end); -/* description of effects of mapping type and prot in current implementation. - * this is due to the limited x86 page protection hardware. The expected - * behavior is in parens: - * - * map_typeprot - * PROT_NONE PROT_READ PROT_WRITE PROT_EXEC - * MAP_SHARED r: (no) no r: (yes) yesr: (no) yes r: (no) yes - * w: (no) no w: (no) no w: (yes) yesw: (no) no - * x: (no) no x: (no) yes x: (no) yes x: (yes) yes - * - * MAP_PRIVATE r: (no) no r: (yes) yesr: (no) yes r: (no) yes - * w: (no) no w: (no) no w: (copy) copy w: (no) no - * x: (no) no x: (no) yes x: (no) yes x: (yes) yes - * - * On arm64, PROT_EXEC has the following behaviour for both MAP_SHARED and - * MAP_PRIVATE (with Enhanced PAN supported): - * r: (no) no - * w: (no) no - * x: (yes) yes - */ #ifdef __P000 pgprot_t protection_map[16] __ro_after_init = { [VM_NONE] = __P000, @@ -123,11 +103,7 @@ pgprot_t protection_map[16] __ro_after_init = { #endif #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT -pgprot_t vm_get_page_prot(unsigned long vm_flags) -{ - return protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]; -} -EXPORT_SYMBOL(vm_get_page_prot); +DECLARE_VM_GET_PAGE_PROT #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */ static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags) -- 2.25.1
[PATCH V6 01/26] mm/mmap: Build protect protection_map[] with __P000
Build protect generic protection_map[] array with __P000, so that it can be moved inside all the platforms one after the other. Otherwise there will be build failures during this process. CONFIG_ARCH_HAS_VM_GET_PAGE_PROT cannot be used for this purpose as only certain platforms enable this config now. Cc: Andrew Morton Cc: linux...@kvack.org Cc: linux-ker...@vger.kernel.org Reviewed-by: Christoph Hellwig Reviewed-by: Christophe Leroy Suggested-by: Christophe Leroy Signed-off-by: Anshuman Khandual --- include/linux/mm.h | 2 ++ mm/mmap.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index cf3d0d673f6b..0ff0a1bad091 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -424,7 +424,9 @@ extern unsigned int kobjsize(const void *objp); * mapping from the currently active vm_flags protection bits (the * low four bits) to a page protection mask.. */ +#ifdef __P000 extern pgprot_t protection_map[16]; +#endif /* * The default fault flags that should be used by most of the diff --git a/mm/mmap.c b/mm/mmap.c index 61e6135c54ef..b01f0280bda2 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -101,6 +101,7 @@ static void unmap_region(struct mm_struct *mm, * w: (no) no * x: (yes) yes */ +#ifdef __P000 pgprot_t protection_map[16] __ro_after_init = { [VM_NONE] = __P000, [VM_READ] = __P001, @@ -119,6 +120,7 @@ pgprot_t protection_map[16] __ro_after_init = { [VM_SHARED | VM_EXEC | VM_WRITE]= __S110, [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = __S111 }; +#endif #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT pgprot_t vm_get_page_prot(unsigned long vm_flags) -- 2.25.1
[PATCH V6 00/26] mm/mmap: Drop __SXXX/__PXXX macros from across platforms
__SXXX/__PXXX macros is an unnecessary abstraction layer in creating the generic protection_map[] array which is used for vm_get_page_prot(). This abstraction layer can be avoided, if the platforms just define the array protection_map[] for all possible vm_flags access permission combinations and also export vm_get_page_prot() implementation. This series drops __SXXX/__PXXX macros from across platforms in the tree. First it build protects generic protection_map[] array with '#ifdef __P000' and moves it inside platforms which enable ARCH_HAS_VM_GET_PAGE_PROT. Later this build protects same array with '#ifdef ARCH_HAS_VM_GET_PAGE_PROT' and moves inside remaining platforms while enabling ARCH_HAS_VM_GET_PAGE_PROT. This adds a new macro DECLARE_VM_GET_PAGE_PROT defining the current generic vm_get_page_prot(), in order for it to be reused on platforms that do not require custom implementation. Finally, ARCH_HAS_VM_GET_PAGE_PROT can just be dropped, as all platforms now define and export vm_get_page_prot(), via looking up a private and static protection_map[] array. protection_map[] data type has been changed as 'static const' on all platforms that do not change it during boot. This series applies on v5.19-rc4 and has been build tested for multiple platforms. While here it has dropped off all previous tags from folks after the current restructuring. Series common CC list has been expanded to cover all impacted platforms for wider reach. - Anshuman Changes in V6: - Converted protection_map[] array as 'static const' on sparc32 platform - Rebased on v5.19-rc4 - Collected tags Changes in V5: https://lore.kernel.org/all/20220627045833.1590055-1-anshuman.khand...@arm.com/ - Converted most platfomr protection_map[] array as 'static const' - Moved DECLARE_VM_GET_PAGE_PROT inside - Moved generic protection_map[] comment near DECLARE_VM_GET_PAGE_PROT - Updated some commit messages Changes in V4: https://lore.kernel.org/all/20220624044339.1533882-1-anshuman.khand...@arm.com/ - Both protection_map[] and vm_get_page_prot() moves inside all platforms - Split patches to create modular changes for individual platforms - Add macro DECLARE_VM_GET_PAGE_PROT defining generic vm_get_page_prot() - Drop ARCH_HAS_VM_GET_PAGE_PROT Changes in V3: https://lore.kernel.org/all/20220616040924.1022607-1-anshuman.khand...@arm.com/ - Fix build issues on powerpc and riscv Changes in V2: https://lore.kernel.org/all/20220613053354.553579-1-anshuman.khand...@arm.com/ - Add 'const' identifier to protection_map[] on powerpc - Dropped #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT check from sparc 32 - Dropped protection_map[] init from sparc 64 - Dropped all new platform changes subscribing ARCH_HAS_VM_GET_PAGE_PROT - Added a second patch which moves generic protection_map[] array into all remaining platforms (!ARCH_HAS_VM_GET_PAGE_PROT) Changes in V1: https://lore.kernel.org/all/20220603101411.488970-1-anshuman.khand...@arm.com/ Cc: Andrew Morton Cc: Christoph Hellwig Cc: Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org Cc: sparcli...@vger.kernel.org Cc: x...@kernel.org Cc: openr...@lists.librecores.org Cc: linux-xte...@linux-xtensa.org Cc: linux-c...@vger.kernel.org Cc: linux-hexa...@vger.kernel.org Cc: linux-par...@vger.kernel.org Cc: linux-al...@vger.kernel.org Cc: linux-ri...@lists.infradead.org Cc: linux-c...@vger.kernel.org Cc: linux-s...@vger.kernel.org Cc: linux-i...@vger.kernel.org Cc: linux-m...@vger.kernel.org Cc: linux-m...@lists.linux-m68k.org Cc: linux-snps-...@lists.infradead.org Cc: linux-arm-ker...@lists.infradead.org Cc: linux...@lists.infradead.org Cc: linux...@vger.kernel.org Cc: linux...@kvack.org Cc: linux-ker...@vger.kernel.org Anshuman Khandual (26): mm/mmap: Build protect protection_map[] with __P000 mm/mmap: Define DECLARE_VM_GET_PAGE_PROT powerpc/mm: Move protection_map[] inside the platform sparc/mm: Move protection_map[] inside the platform arm64/mm: Move protection_map[] inside the platform x86/mm: Move protection_map[] inside the platform mm/mmap: Build protect protection_map[] with ARCH_HAS_VM_GET_PAGE_PROT microblaze/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT loongarch/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT openrisc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT xtensa/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT hexagon/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT parisc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT alpha/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT nios2/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT riscv/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT csky/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT s390/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT ia64/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT mips/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT m68k/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT arc/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT arm/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT um/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT sh/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT mm/mmap: Drop ARCH_HAS_VM_GET_PAGE_PROT arch/alpha/include/asm/pgtable.h
Re: [PATCH v2] powerpc/smp: poll cpu_callin_map more aggressively in __cpu_up()
Nathan Lynch writes: > > Without the msleep(1) in the hotplug path, the time it takes to online a > CPU on a P9 PowerVM LPAR goes from roughly 30ms to 4ms or less when > exercised via thaw_secondary_cpus(). I need to reword this part. More testing shows that the time for _cpu_up() to complete increases with the number of CPUs online, with or without this change. The patch eliminates the msleep() penalty (roughly 20ms) but does not provide a consistent order-of-magnitude improvement, unfortunately. That is, even with this change, the time to online creeps back up into the tens of milliseconds after a few dozen CPUs: # dmesg --reltime | grep -A88 'Enabling non' [ +5.06] Enabling non-boot CPUs ... [ +0.000894] CPU1 is up [ +0.000613] CPU2 is up [ +0.000697] CPU3 is up [ +0.000894] CPU4 is up [ +0.000956] CPU5 is up [ +0.001110] CPU6 is up [ +0.001497] CPU7 is up [ +0.001606] CPU8 is up [ +0.001841] CPU9 is up [ +0.001998] CPU10 is up [ +0.002229] CPU11 is up [ +0.002488] CPU12 is up [ +0.002618] CPU13 is up [ +0.002767] CPU14 is up [ +0.002931] CPU15 is up [ +0.003283] CPU16 is up [ +0.003220] CPU17 is up [ +0.003427] CPU18 is up [ +0.003648] CPU19 is up [ +0.003870] CPU20 is up [ +0.004044] CPU21 is up [ +0.004246] CPU22 is up [ +0.004420] CPU23 is up [ +0.008634] CPU24 is up [ +0.006166] CPU25 is up [ +0.006373] CPU26 is up [ +0.006603] CPU27 is up [ +0.006913] CPU28 is up [ +0.007031] CPU29 is up [ +0.007287] CPU30 is up [ +0.007570] CPU31 is up [ +0.008670] CPU32 is up [ +0.007793] CPU33 is up [ +0.008104] CPU34 is up [ +0.008440] CPU35 is up [ +0.008358] CPU36 is up [ +0.008386] CPU37 is up [ +0.008696] CPU38 is up [ +0.009104] CPU39 is up [ +0.009676] CPU40 is up [ +0.009687] CPU41 is up [ +0.009761] CPU42 is up [ +0.010089] CPU43 is up [ +0.010362] CPU44 is up [ +0.010683] CPU45 is up [ +0.011054] CPU46 is up [ +0.011399] CPU47 is up [ +0.012013] CPU48 is up [ +0.011597] CPU49 is up [ +0.011791] CPU50 is up [ +0.012115] CPU51 is up [ +0.012415] CPU52 is up [ +0.012954] CPU53 is up [ +0.013131] CPU54 is up [ +0.013244] CPU55 is up [ +0.013775] CPU56 is up [ +0.013599] CPU57 is up [ +0.013867] CPU58 is up [ +0.014255] CPU59 is up [ +0.014563] CPU60 is up [ +0.014904] CPU61 is up [ +0.015125] CPU62 is up [ +0.015360] CPU63 is up [ +0.015923] CPU64 is up [ +0.015721] CPU65 is up [ +0.016026] CPU66 is up [ +0.016395] CPU67 is up [ +0.016811] CPU68 is up [ +0.017045] CPU69 is up [ +0.017270] CPU70 is up [ +0.017613] CPU71 is up [ +0.018072] CPU72 is up [ +0.017913] CPU73 is up [ +0.018184] CPU74 is up [ +0.018519] CPU75 is up [ +0.018929] CPU76 is up [ +0.019179] CPU77 is up [ +0.019470] CPU78 is up [ +0.019766] CPU79 is up [ +0.020331] CPU80 is up [ +0.020244] CPU81 is up [ +0.020464] CPU82 is up [ +0.020876] CPU83 is up [ +0.021229] CPU84 is up [ +0.021542] CPU85 is up [ +0.021903] CPU86 is up [ +0.022062] CPU87 is up
Re: [PATCH] cxl: drop unexpected word "the" in the comments
On Wed, 2022-06-29 at 22:15 +1000, Michael Ellerman wrote: > On Tue, 21 Jun 2022 20:53:21 +0800, Jiang Jian wrote: > > there is an unexpected word "the" in the comments that need to be > > dropped > > > > file: drivers/misc/cxl/cxl.h > > line: 1107 > > +/* check if the given pci_dev is on the the cxl vphb bus */ > > changed to > > +/* check if the given pci_dev is on the cxl vphb bus */ > > > > [...] > > Applied to powerpc/next. > > [1/1] cxl: drop unexpected word "the" in the comments > > https://git.kernel.org/powerpc/c/882c835b71e22ca82361dab3b60b85b557abd72f I believe Greg's already merged this in char-misc... Andrew
[powerpc:next-test] BUILD SUCCESS 54c15ec3b738c6086f2be001dae962ec412640e5
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next-test branch HEAD: 54c15ec3b738c6086f2be001dae962ec412640e5 powerpc: dts: Add DTS file for CZ.NIC Turris 1.x routers elapsed time: 724m configs tested: 52 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64allyesconfig arm allyesconfig ia64 allmodconfig arc allyesconfig alphaallyesconfig m68k allyesconfig m68k allmodconfig powerpc allnoconfig sh allmodconfig mips allyesconfig powerpc allmodconfig i386defconfig i386 allyesconfig x86_64randconfig-a002 x86_64randconfig-a004 x86_64randconfig-a006 i386 randconfig-a001 i386 randconfig-a003 i386 randconfig-a005 x86_64randconfig-a013 x86_64randconfig-a011 x86_64randconfig-a015 i386 randconfig-a014 i386 randconfig-a012 i386 randconfig-a016 arc randconfig-r043-20220629 s390 randconfig-r044-20220629 riscvrandconfig-r042-20220629 um i386_defconfig um x86_64_defconfig x86_64 defconfig x86_64 rhel-8.3 x86_64 allyesconfig x86_64 rhel-8.3-func x86_64 rhel-8.3-kunit x86_64rhel-8.3-kselftests x86_64 rhel-8.3-syz clang tested configs: x86_64randconfig-a001 x86_64randconfig-a003 x86_64randconfig-a005 i386 randconfig-a002 i386 randconfig-a006 i386 randconfig-a004 x86_64randconfig-a014 x86_64randconfig-a012 x86_64randconfig-a016 i386 randconfig-a013 i386 randconfig-a015 i386 randconfig-a011 hexagon randconfig-r045-20220629 hexagon randconfig-r041-20220629 -- 0-DAY CI Kernel Test Service https://01.org/lkp
[powerpc:merge] BUILD SUCCESS 3cdab7e81d28bd4d06004e34c87a1b5da745dd53
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git merge branch HEAD: 3cdab7e81d28bd4d06004e34c87a1b5da745dd53 Automatic merge of 'next' into merge (2022-06-29 22:17) elapsed time: 723m configs tested: 52 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64allyesconfig arm allyesconfig ia64 allmodconfig arc allyesconfig alphaallyesconfig m68k allyesconfig m68k allmodconfig mips allyesconfig powerpc allmodconfig sh allmodconfig powerpc allnoconfig i386defconfig i386 allyesconfig i386 randconfig-a001 i386 randconfig-a003 i386 randconfig-a005 x86_64randconfig-a015 x86_64randconfig-a013 x86_64randconfig-a011 i386 randconfig-a014 i386 randconfig-a012 i386 randconfig-a016 x86_64randconfig-a004 x86_64randconfig-a002 x86_64randconfig-a006 arc randconfig-r043-20220629 riscvrandconfig-r042-20220629 s390 randconfig-r044-20220629 um x86_64_defconfig um i386_defconfig x86_64 defconfig x86_64 rhel-8.3 x86_64 allyesconfig x86_64rhel-8.3-kselftests x86_64 rhel-8.3-func x86_64 rhel-8.3-kunit x86_64 rhel-8.3-syz clang tested configs: i386 randconfig-a002 i386 randconfig-a004 i386 randconfig-a006 x86_64randconfig-a014 x86_64randconfig-a016 x86_64randconfig-a012 i386 randconfig-a011 i386 randconfig-a013 i386 randconfig-a015 x86_64randconfig-a001 x86_64randconfig-a003 x86_64randconfig-a005 hexagon randconfig-r045-20220629 hexagon randconfig-r041-20220629 -- 0-DAY CI Kernel Test Service https://01.org/lkp
[powerpc:fixes-test] BUILD SUCCESS ac790d09885d36143076e7e02825c541e8eee899
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git fixes-test branch HEAD: ac790d09885d36143076e7e02825c541e8eee899 powerpc/memhotplug: Add add_pages override for PPC elapsed time: 723m configs tested: 2 configs skipped: 102 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: powerpc allnoconfig powerpc allmodconfig -- 0-DAY CI Kernel Test Service https://01.org/lkp
Re: [PATCH 6/6] i2c: Make remove callback return void
n...@kernel.org>, Robert Jones , George Joseph , Vincent Knecht , Robin van der Gracht , Randy Dunlap , linux-st...@st-md-mailman.stormreply.com, Michael Tretter , Geert Uytterhoeven , Phong LE , Daniel Beer , Krzysztof Opasiak , Bjorn Andersson , Linux Crypto Mailing List , Pengutronix Kernel Team , Heungjun Kim , Hans Verkuil , David Lin , Vladimir Oltean , David Rhodes , Claudiu Beznea , Jean-Baptiste Maneyrol , Alexandre Belloni , Dan Robertson , Martyn Welch , Jiri Slaby , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , David Airlie , Jon Nettleton , Srinivas Pandruvada , Marco Felsch , Wim Van Sebroeck , Sebastian Reichel , Max Filippov , "Lad, Prabhakar" , Thierry Reding , linux-...@vger.kernel.org, Martiros Shakhzadyan , Guenter Roeck , Matthias Schwarzott , Sylwester Nawrocki , Eric Dumazet , =?UTF-8?B?TWFyZWsgQmVow7pu?= , Saranya Gopal , Lars-Peter Clausen , Corey Minyard , Evgeny Novikov , Frank Rowand , Bartosz Golaszewski , Manivannan Sadhasivam , Pierre-Louis Bossart , Minghao Chi , linux-...@vger.kernel.org, Nathan Chancellor , MyungJoo Ham , Charles Gorand , Jagan Teki , Vijendar Mukunda , Miguel Ojeda , Kyungmin Park , Tianshu Qiu , Martin Donnelly , Woojung Huh , Rudolf Marek , Charles Keepax , Linux Watchdog Mailing List , Michael Hennerich , Ido Schimmel , acpi4asus-u...@lists.sourceforge.net, Simon Trimmer , Ricard Wanderlof , Rikard Falkeborn , Alex Deucher , Jiri Valek - 2N , linux-rpi-ker...@lists.infradead.org, Biju Das , Wayne Chang , Chen-Yu Tsai , Sing-Han Chen , Linux ARM , =?UTF-8?Q?Niklas_Söderlund?= , Hans de Goede , Stephen Boyd , Maslov Dmitry , "open list:GPIO SUBSYSTEM" , Jens Frederich , Douglas Anderson , Linux Media Mailing List , "David S. Miller" , Wolfram Sang , Jarkko Sakkinen , USB list , Jacopo Mondi , Maxime Coquelin , CGEL ZTE , Colin Leroy , Platform Driver , linux-integrity , Kevin Tsai , =?UTF-8?Q?Pali_Rohár?= , Jonathan Cameron , Heiner Kallweit , Daniel Palmer , Arec Kao , Crt Mori , Jose Cazarin , Neil Armstrong , linux-...@vger.kernel.org, Tom Rix , Michael Turquette , Peter Senna Tschudin , Benjamin Mugnier , =?UTF-8?B?TnVubyBTw6E=?= , Jan-Simon Moeller , Wei Yongjun , Laurent Pinchart , Andrzej Hajda , Nikita Travkin , Jeremy Kerr , Jasmin Jessich , Sam Ravnborg , Kevin Cernekee , Alyssa Rosenzweig , linux-...@vger.ker nel.org, Daniel Thompson , Florian Fainelli , Lucas Tanure , Stefan Mavrodiev , Masahiro Yamada , Sylvain Petinot , Network Development , Kieran Bingham , Jernej Skrabec , Xin Ji , Seven Lee , Matt Ranostay , Broadcom internal kernel review list , Adrien Grassein , Yang Yingliang , chrome-platf...@lists.linux.dev, Mats Randgaard , Paolo Abeni , Alexey Dobriyan , Joel Stanley , linux-input , linuxppc-dev , Lyude Paul , Kees Cook , =?UTF-8?Q?Uwe_Kleine-König?= , Jonas Karlman , Yang Li , Tim Harvey , Jiri Kosina , Akinobu Mita , Mark Gross , Richard Fitzgerald , Mark Brown , wengjianfeng , Maxime Ripard , Sven Peter , Martin Kepplinger , openipmi-develo...@lists.sourceforge.net, Mauro Carvalho Chehab , Benson Leung , "Daniel W. S. Almeida" , Chiranjeevi Rapolu , Alessandro Zummo , linux-hw...@vger.kernel.org, Felipe Balbi , Stephan Gerhold , Support Opensource , Alexandru Ardelean , Dmitry Torokhov , Marc Hulsman , Corentin Chary , Stephen Kitt , Daniel Scally , Linux Fbdev development list , Andrey Ryabinin , Arnd Bergmann , Kirill Shilimanov , Sakari Ailus , patc...@opensource.cirrus.com, Zheng Yongjun , Alejandro Tafalla , Peter Rosin , Arnaud Ferraris , Hector Martin , Vignesh Raghavendra , Nick Dyer , Greg Kroah-Hartman , Tony Lindgren , Alexandre Torgue , Takashi Iwai , Paul Cercueil , George McCollister , Mac Chiang , Antoniu Miclaus , Alexander Potapenko , linux-stag...@lists.linux.dev, Adam Fo rd , Peter Huewe , unglinuxdri...@microchip.com, Lee Jones , MTD Maling List , Alexey Khoroshilov , Marek Vasut , Paul Kocialkowski , ALSA Development Mailing List , Vincenzo Frascino , Eric Piel , Herbert Xu , Tobias Schrammm , Richard Weinberger , Tomasz Duszynski , Janusz Krzysztofik , Russell King , linux-...@vger.kernel.org, Jason Gunthorpe , Thomas Zimmermann , Bastien Nocera , Jingoo Han , Jakub Kicinski , Vivien Didelot , Yizhuo , Shawn Tu , Leon Luo , Yan Lei , Akihiro Tsukada , Tudor Ambarus , Dmitry Rokosov , Oliver Graute , Alistair Francis , Dongliang Mu , =?UTF-8?Q?Jonathan_Neuschäfer?= , Eduardo Valentin , Rui Miguel Silva , Michael Srba , Rob Herring , linux-media...@lists.infradead.org, Fabio Estevam , Matthias Brugger , kasan-dev , "Paul J. Murphy" , Nicola Lunghi , Daniele Alessandrelli , Dmitry Vyukov , Ramesh Shanmugasundaram , Liam Girdwood , Juerg Haefliger , Oder Chiou , Shengjiu Wang , Nicolas Ferre , Robert Foss , Krzysztof Kozlowski , Daniel Vetter , =?UTF-8?Q?Alvin_Šipraga?= , Luca Ceresoli , =?UTF-8?B?Sm9zw6kgRXhww7NzaXRv?= , Johannes Berg , Colin Ian King , Ma
Re: [PATCH 6/6] i2c: Make remove callback return void
_Roh=c3=a1r?= , "David S. Miller" Errors-To: linuxppc-dev-bounces+archive=mail-archive@lists.ozlabs.org Sender: "Linuxppc-dev" On 6/28/22 16:03, Uwe Kleine-König wrote: From: Uwe Kleine-König The value returned by an i2c driver's remove function is mostly ignored. (Only an error message is printed if the value is non-zero that the error is ignored.) So change the prototype of the remove function to return no value. This way driver authors are not tempted to assume that passing an error to the upper layer is a good idea. All drivers are adapted accordingly. There is no intended change of behaviour, all callbacks were prepared to return 0 before. Signed-off-by: Uwe Kleine-König [...] drivers/platform/surface/surface3_power.c | 4 +--- [...] diff --git a/drivers/platform/surface/surface3_power.c b/drivers/platform/surface/surface3_power.c index 444ec81ba02d..3b20dddeb815 100644 --- a/drivers/platform/surface/surface3_power.c +++ b/drivers/platform/surface/surface3_power.c @@ -554,7 +554,7 @@ static int mshw0011_probe(struct i2c_client *client) return error; } -static int mshw0011_remove(struct i2c_client *client) +static void mshw0011_remove(struct i2c_client *client) { struct mshw0011_data *cdata = i2c_get_clientdata(client); @@ -564,8 +564,6 @@ static int mshw0011_remove(struct i2c_client *client) kthread_stop(cdata->poll_task); i2c_unregister_device(cdata->bat0); - - return 0; } static const struct acpi_device_id mshw0011_acpi_match[] = { For the quoted above: Reviewed-by: Maximilian Luz
[PATCH] ethernet/ibm:fix repeated words in comments
Delete the redundant word 'a'. Signed-off-by: Jilin Yuan --- drivers/net/ethernet/ibm/ibmvnic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 7e7fe5bdf1f8..8ab326fdc3f5 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -3073,7 +3073,7 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter, /* If failover is pending don't schedule any other reset. * Instead let the failover complete. If there is already a -* a failover reset scheduled, we will detect and drop the +* failover reset scheduled, we will detect and drop the * duplicate reset when walking the ->rwi_list below. */ if (adapter->state == VNIC_REMOVING || -- 2.36.1
[PATCH] freescale/fs_enet:fix repeated words in comments
Delete the redundant word 'a'. Signed-off-by: Jilin Yuan --- drivers/net/ethernet/freescale/fs_enet/fs_enet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet.h b/drivers/net/ethernet/freescale/fs_enet/fs_enet.h index 5ff2634bee2f..cb419aef8d1b 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet.h +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet.h @@ -201,7 +201,7 @@ void fs_enet_platform_cleanup(void); /* access macros */ #if defined(CONFIG_CPM1) -/* for a a CPM1 __raw_xxx's are sufficient */ +/* for a CPM1 __raw_xxx's are sufficient */ #define __cbd_out32(addr, x) __raw_writel(x, addr) #define __cbd_out16(addr, x) __raw_writew(x, addr) #define __cbd_in32(addr) __raw_readl(addr) -- 2.36.1
Re: [PATCH 6/6] i2c: Make remove callback return void
Hi, [keeping only individuals and lists in Cc to avoid bounces] On 28/06/22 16:03, Uwe Kleine-König wrote: > From: Uwe Kleine-König > > The value returned by an i2c driver's remove function is mostly ignored. > (Only an error message is printed if the value is non-zero that the > error is ignored.) > > So change the prototype of the remove function to return no value. This > way driver authors are not tempted to assume that passing an error to > the upper layer is a good idea. All drivers are adapted accordingly. > There is no intended change of behaviour, all callbacks were prepared to > return 0 before. > > Signed-off-by: Uwe Kleine-König For versaclock: > diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c > index e7be3e54b9be..657493ecce4c 100644 > --- a/drivers/clk/clk-versaclock5.c > +++ b/drivers/clk/clk-versaclock5.c > @@ -1138,7 +1138,7 @@ static int vc5_probe(struct i2c_client *client) > return ret; > } > > -static int vc5_remove(struct i2c_client *client) > +static void vc5_remove(struct i2c_client *client) > { > struct vc5_driver_data *vc5 = i2c_get_clientdata(client); > > @@ -1146,8 +1146,6 @@ static int vc5_remove(struct i2c_client *client) > > if (vc5->chip_info->flags & VC5_HAS_INTERNAL_XTAL) > clk_unregister_fixed_rate(vc5->pin_xin); > - > - return 0; > } > > static int __maybe_unused vc5_suspend(struct device *dev) Reviewed-by: Luca Ceresoli Reviewed-by: Luca Ceresoli -- Luca
[PATCH v2] powerpc/smp: poll cpu_callin_map more aggressively in __cpu_up()
It is not necessary to delay or sleep between polls of cpu_callin_map when waiting for a kicked CPU to come up. We can use spin_until_cond(), combining the boot and hotplug paths while preserving the intended timeout. Without the msleep(1) in the hotplug path, the time it takes to online a CPU on a P9 PowerVM LPAR goes from roughly 30ms to 4ms or less when exercised via thaw_secondary_cpus(). Signed-off-by: Nathan Lynch --- Notes: Changes since v1: * Do not poll indefinitely; restore the original 5sec timeout "Benchmark" method, on a LPAR with 24 CPUs: $ echo processors > /sys/power/pm_test $ echo mem > /sys/power/state $ dmesg --reltime | grep -A23 'Enabling non-boot CPUs' Before: [ +5.03] Enabling non-boot CPUs ... [ +0.047537] CPU1 is up [ +0.030177] CPU2 is up [ +0.030082] CPU3 is up [ +0.030146] CPU4 is up [ +0.030114] CPU5 is up [ +0.030108] CPU6 is up [ +0.030134] CPU7 is up [ +0.040272] CPU8 is up [ +0.030352] CPU9 is up [ +0.030169] CPU10 is up [ +0.040224] CPU11 is up [ +0.030186] CPU12 is up [ +0.030173] CPU13 is up [ +0.030181] CPU14 is up [ +0.030179] CPU15 is up [ +0.030236] CPU16 is up [ +0.030012] CPU17 is up [ +0.030188] CPU18 is up [ +0.030233] CPU19 is up [ +0.030182] CPU20 is up [ +0.030160] CPU21 is up [ +0.030226] CPU22 is up [ +0.030125] CPU23 is up After: [ +5.04] Enabling non-boot CPUs ... [ +0.000956] CPU1 is up [ +0.000568] CPU2 is up [ +0.000682] CPU3 is up [ +0.000836] CPU4 is up [ +0.000914] CPU5 is up [ +0.001054] CPU6 is up [ +0.001184] CPU7 is up [ +0.001533] CPU8 is up [ +0.001779] CPU9 is up [ +0.001935] CPU10 is up [ +0.002151] CPU11 is up [ +0.002358] CPU12 is up [ +0.002597] CPU13 is up [ +0.002713] CPU14 is up [ +0.002891] CPU15 is up [ +0.003209] CPU16 is up [ +0.003149] CPU17 is up [ +0.003337] CPU18 is up [ +0.003552] CPU19 is up [ +0.003765] CPU20 is up [ +0.003922] CPU21 is up [ +0.004104] CPU22 is up [ +0.004266] CPU23 is up arch/powerpc/kernel/smp.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index bcefab484ea6..c8431074d590 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -1268,7 +1269,8 @@ static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle) int __cpu_up(unsigned int cpu, struct task_struct *tidle) { - int rc, c; + unsigned long deadline; + int rc; /* * Don't allow secondary threads to come online if inhibited @@ -1313,23 +1315,10 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) } /* -* wait to see if the cpu made a callin (is actually up). -* use this value that I found through experimentation. -* -- Cort +* Give the remote CPU five seconds to enter the kernel. */ - if (system_state < SYSTEM_RUNNING) - for (c = 5; c && !cpu_callin_map[cpu]; c--) - udelay(100); -#ifdef CONFIG_HOTPLUG_CPU - else - /* -* CPUs can take much longer to come up in the -* hotplug case. Wait five seconds. -*/ - for (c = 5000; c && !cpu_callin_map[cpu]; c--) - msleep(1); -#endif - + deadline = jiffies + msecs_to_jiffies(5000); + spin_until_cond(cpu_callin_map[cpu] != 0 || time_after(jiffies, deadline)); if (!cpu_callin_map[cpu]) { printk(KERN_ERR "Processor %u is stuck.\n", cpu); return -ENOENT; -- 2.36.1
Re: [PATCH v3 02/12] powerpc: wiiu: device tree
On Wed, Jun 29, 2022 at 08:13:13PM +0200, Krzysztof Kozlowski wrote: > On 29/06/2022 18:13, Segher Boessenkool wrote: > > On Wed, Jun 29, 2022 at 11:58:18AM +0200, Krzysztof Kozlowski wrote: > >>> + /* TODO: Add SMP */ > >>> + PowerPC,espresso@0 { > >> > >> Node name should be generic, so "cpu". Unless something needs the > >> specific node name? > > > > This is how most other PowerPC firmwares do it. The PowerPC processor > > binding is older than the generic naming practice, so CPU nodes have > > device_type "cpu" instead. > > ePAPR 1.0 from 2008 explicitly asks for generic node names. So 4 years > before Nintento Wii U. Maybe earlier ePAPR-s were also asking for this, > no clue, don't have them. The majority of PowerPC 750 systems long predate that. Many *current* systems implement the PowerPC Processor Binding, too (not the epapr thing, which is incompatible with the older standards!) > > There is no added value in generic naming for CPU nodes anyway, since > > you just find them as the children of the "/cpus" node :-) > > There is because you might have there caches. It also makes code easier > to read. In the processor binding the cache nodes were subnodes of cpu nodes or other cache nodes. But in some server products you can have cache that is enabled while the corresponding core is disabled; and also, not all cache belongs to only one higher level anyway. This was modelled pretty uncleanly, yup (cleaner would have been to have a /caches node as well as /cpus, for example). But on 750 you just have "l2-cache" subnodes, and all nodes in /cpus are CPUs :-) Segher
[Bug 216190] 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6)
https://bugzilla.kernel.org/show_bug.cgi?id=216190 --- Comment #1 from Erhard F. (erhar...@mailbox.org) --- Created attachment 301308 --> https://bugzilla.kernel.org/attachment.cgi?id=301308&action=edit dmesg (5.19-rc4, outline KASAN, without SMP, PowerMac G4 DP) -- You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 216190] New: 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6)
https://bugzilla.kernel.org/show_bug.cgi?id=216190 Bug ID: 216190 Summary: 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6) Product: Platform Specific/Hardware Version: 2.5 Kernel Version: 5.19-rc4 Hardware: PPC-32 OS: Linux Tree: Mainline Status: NEW Severity: normal Priority: P1 Component: PPC-32 Assignee: platform_ppc...@kernel-bugs.osdl.org Reporter: erhar...@mailbox.org CC: christophe.le...@csgroup.eu Regression: No Created attachment 301307 --> https://bugzilla.kernel.org/attachment.cgi?id=301307&action=edit kernel .config (5.19-rc4, outline KASAN, CONFIG_SMP=y, PowerMac G4 DP) Revisiting bug #215389 and bug #216041 I fiddled around with KASAN builds again and finally may have found a clue. Kernel 5.19-rc4 runs fine with outline KASAN as long as '# CONFIG_SMP is not set'. It runs perfetly well without any advanced options needed, also setting THREAD_SHIFT manually to 14 is not needed. As soon as I set CONFIG_SMP=y in the attached .config I get a non-working kernel. It boots but gets stuck very early on a white screen reading "done found display: /pci@f000/ATY,AlteracParent@10/ATY,Alterac_B@1, opening..." Interesting thing is that without SMP I also didn't get memory corruption as in bug #215389 nor stack overflows as in bug #216041 after hours of building so far. -- You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[linux-next:master] BUILD REGRESSION c4ef528bd006febc7de444d9775b28706d924f78
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master branch HEAD: c4ef528bd006febc7de444d9775b28706d924f78 Add linux-next specific files for 20220629 Error/Warning reports: https://lore.kernel.org/linux-mm/202206292052.lsfui3zo-...@intel.com Error/Warning: (recently discovered and may have been fixed) arch/powerpc/kernel/interrupt.c:542:55: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body] arch/powerpc/kernel/interrupt.c:542:55: warning: suggest braces around empty body in an 'if' statement [-Wempty-body] drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:1025:33: warning: variable 'pre_connection_type' set but not used [-Wunused-but-set-variable] drivers/pci/endpoint/functions/pci-epf-vntb.c:1247: undefined reference to `ntb_register_device' drivers/pci/endpoint/functions/pci-epf-vntb.c:174: undefined reference to `ntb_link_event' drivers/pci/endpoint/functions/pci-epf-vntb.c:262: undefined reference to `ntb_db_event' drivers/pci/endpoint/functions/pci-epf-vntb.c:975:5: warning: no previous prototype for 'pci_read' [-Wmissing-prototypes] drivers/pci/endpoint/functions/pci-epf-vntb.c:984:5: warning: no previous prototype for 'pci_write' [-Wmissing-prototypes] Unverified Error/Warning (likely false positive, please contact us if interested): drivers/net/ethernet/microchip/lan743x_main.c:1238:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/soc/mediatek/mtk-mutex.c:799:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/staging/media/zoran/zr36016.c:430:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/staging/media/zoran/zr36050.c:829:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/staging/media/zoran/zr36060.c:869:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/thunderbolt/tmu.c:758:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 sound/soc/sof/intel/mtl.c:547:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 Error/Warning ids grouped by kconfigs: gcc_recent_errors |-- alpha-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- alpha-randconfig-r013-20220629 | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- arc-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-net-ethernet-microchip-lan743x_main.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write | |-- drivers-soc-mediatek-mtk-mutex.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-staging-media-zoran-zr36016.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-staging-media-zoran-zr36050.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-staging-media-zoran-zr36060.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-thunderbolt-tmu.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | `-- sound-soc-sof-intel-mtl.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c |-- arc-randconfig-r043-20220629 | `-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used |-- arm-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- arm64-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- arm64-randconfig-r012-20220629 | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:undefined-reference-to-ntb_db_event | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:undefined-reference-
Re: [RFC PATCH v3 11/12] powerpc: Remove unreachable() from WARN_ON()
Hi Sathvika, Adding ARM people as they seem to face the same kind of problem (see https://patchwork.kernel.org/project/linux-kbuild/patch/20220623014917.199563-33-chenzhong...@huawei.com/) Le 27/06/2022 à 17:35, Sathvika Vasireddy a écrit : > > On 25/06/22 12:16, Christophe Leroy wrote: >> >> Le 24/06/2022 à 20:32, Sathvika Vasireddy a écrit : >>> objtool is throwing *unannotated intra-function call* >>> warnings with a few instructions that are marked >>> unreachable. Remove unreachable() from WARN_ON() >>> to fix these warnings, as the codegen remains same >>> with and without unreachable() in WARN_ON(). >> Did you try the two exemples described in commit 1e688dd2a3d6 >> ("powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with >> asm goto") ? >> >> Without your patch: >> >> 0640 : >> 640: 81 23 00 84 lwz r9,132(r3) >> 644: 71 29 40 00 andi. r9,r9,16384 >> 648: 40 82 00 0c bne 654 >> 64c: 80 63 00 0c lwz r3,12(r3) >> 650: 4e 80 00 20 blr >> 654: 0f e0 00 00 twui r0,0 >> >> 0658 : >> 658: 2c 04 00 00 cmpwi r4,0 >> 65c: 41 82 00 0c beq 668 >> 660: 7c 63 23 96 divwu r3,r3,r4 >> 664: 4e 80 00 20 blr >> 668: 0f e0 00 00 twui r0,0 >> 66c: 38 60 00 00 li r3,0 >> 670: 4e 80 00 20 blr >> >> >> With your patch: >> >> 0640 : >> 640: 81 23 00 84 lwz r9,132(r3) >> 644: 71 29 40 00 andi. r9,r9,16384 >> 648: 40 82 00 0c bne 654 >> 64c: 80 63 00 0c lwz r3,12(r3) >> 650: 4e 80 00 20 blr >> 654: 0f e0 00 00 twui r0,0 >> 658: 4b ff ff f4 b 64c <== >> >> 065c : >> 65c: 2c 04 00 00 cmpwi r4,0 >> 660: 41 82 00 0c beq 66c >> 664: 7c 63 23 96 divwu r3,r3,r4 >> 668: 4e 80 00 20 blr >> 66c: 0f e0 00 00 twui r0,0 >> 670: 38 60 00 00 li r3,0 <== >> 674: 4e 80 00 20 blr <== >> 678: 38 60 00 00 li r3,0 >> 67c: 4e 80 00 20 blr >> > The builtin variant of unreachable (__builtin_unreachable()) works. > > How about using that instead of unreachable() ? > > In fact the problem comes from the macro annotate_unreachable() which is called by unreachable() before calling __build_unreachable(). Seems like this macro adds (after the unconditional trap twui) a call to an empty function whose address is listed in section .discard.unreachable 1c78: 00 00 e0 0f twuir0,0 1c7c: 55 e7 ff 4b bl 3d0 RELOCATION RECORDS FOR [.discard.unreachable]: OFFSET TYPE VALUE R_PPC64_REL32 .text+0x03d0 The problem is that that function has size 0: 03d0 l F .text qdisc_root_sleeping_lock.part.0 And objtool is not prepared for a function with size 0. The following changes to objtool seem to fix the problem, most warning are gone with that change. diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 63218f5799c2..37c0a268b7ea 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -77,6 +77,8 @@ static int symbol_by_offset(const void *key, const struct rb_node *node) if (*o < s->offset) return -1; + if (*o == s->offset && !s->len) + return 0; if (*o >= s->offset + s->len) return 1; @@ -400,7 +402,7 @@ static void elf_add_symbol(struct elf *elf, struct symbol *sym) * Don't store empty STT_NOTYPE symbols in the rbtree. They * can exist within a function, confusing the sorting. */ - if (!sym->len) + if (sym->type == STT_NOTYPE && !sym->len) rb_erase(&sym->node, &sym->sec->symbol_tree); } --- I also had objtool running for ever on arch/powerpc/sysdev/xics/icp-hv.o, which I fixed with the below hack: diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 51b6dcec8d6a..ef2303ad6381 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -529,7 +529,7 @@ static struct instruction *find_last_insn(struct objtool_file *file, unsigned int offset; unsigned int end = (sec->sh.sh_size > 10) ? sec->sh.sh_size - 10 : 0; - for (offset = sec->sh.sh_size - 1; offset >= end && !insn; offset--) + for (offset = sec->sh.sh_size - 1; offset && offset >= end && !insn; offset--) insn = find_insn(file, sec, offset); return insn; --- Now I only have the following two warnings: arch/powerpc/sysdev/xics/icp-hv.o: warning: objtool: can't find unreachable insn at .text.unlikely+0x0 drivers/crypto/vmx/aesp8-ppc.o: warning: objtool: aes_p8_set_encrypt_key+0x44: unannotated intra-function call The first one is linked to the infinite loop I hacked. So I now have to understand what the problem really
Re: [PATCH v6 25/33] arm64: crypto: Mark constant as data
On Thu, Jun 23, 2022 at 09:49:09AM +0800, Chen Zhongjin wrote: > Use SYM_DATA_* macros to annotate data bytes in the middle of .text > sections. > > For local symbols, ".L" prefix needs to be dropped as the assembler > exclude the symbols from the .o symbol table, making objtool unable > to see them. Reviewed-by: Mark Brown signature.asc Description: PGP signature
Re: [PATCH v3 02/12] powerpc: wiiu: device tree
On 29/06/2022 18:13, Segher Boessenkool wrote: > On Wed, Jun 29, 2022 at 11:58:18AM +0200, Krzysztof Kozlowski wrote: >> On 28/06/2022 15:31, Ash Logan wrote: >>> + model = "nintendo,wiiu"; >> >> It's not compatible, but user-visible string, e.g. "Nintendo Wii U" > > The "model" property in OF is documented as: > > --- > “model”S > Standard property name to define a manufacturer’s model number. > > prop-encoded-array: > Text string, encoded with encode-string. > A manufacturer-dependent string that generally specifies the model name > and number (including revision level) for this device. The format of the > text string is arbitrary, although in conventional usage the string > begins with the name of the device’s manufacturer as with the “name” > property. > Although there is no standard interpretation for the value of the > “model” property, a specific device driver might use it to learn, for > instance, the revision level of its particular device. > > See also: property, model. > > Used as: " XYZCO,1416-02" encode-string " model" property Hm, surprising to duplicate the compatible, but OK. > --- > >>> + cpus { >>> + #address-cells = <1>; >>> + #size-cells = <0>; >>> + >>> + /* TODO: Add SMP */ >>> + PowerPC,espresso@0 { >> >> Node name should be generic, so "cpu". Unless something needs the >> specific node name? > > This is how most other PowerPC firmwares do it. The PowerPC processor > binding is older than the generic naming practice, so CPU nodes have > device_type "cpu" instead. ePAPR 1.0 from 2008 explicitly asks for generic node names. So 4 years before Nintento Wii U. Maybe earlier ePAPR-s were also asking for this, no clue, don't have them. > This is a required property btw, with that > value. (There is no requirement on the names of the CPU nodes). That's fine, I am not talking about property. > There is no added value in generic naming for CPU nodes anyway, since > you just find them as the children of the "/cpus" node :-) There is because you might have there caches. It also makes code easier to read. Best regards, Krzysztof
Re: [PATCH v6 24/33] arm64: proc: Mark constant as data
On Thu, Jun 23, 2022 at 09:49:08AM +0800, Chen Zhongjin wrote: > Label __idmap_kpti_flag represents the location of a constant. > Mark it as data symbol. Reviewed-by: Mark Brown signature.asc Description: PGP signature
Re: [PATCH v6 22/33] arm64: efi-header: Mark efi header as data
On Thu, Jun 23, 2022 at 09:49:06AM +0800, Chen Zhongjin wrote: > This file only contains a set of constants forming the efi header. > > Make the constants part of a data symbol. Reviewed-by: Mark Brown signature.asc Description: PGP signature
Re: [PATCH] powerpc/smp: poll cpu_callin_map more aggressively in __cpu_up()
Michael Ellerman writes: > Nathan Lynch writes: >> Replace the outdated iteration and timeout calculations here with >> indefinite spin_until_cond()-wrapped poll of cpu_callin_map. __cpu_up() >> already does this when waiting for the cpu to set its online bit before >> returning, so this change is not really making the function more brittle. > > I'm not sure I agree that this doesn't make the code more brittle. > > The existing indefinite wait you mention is later in the function, and > happens after the CPU has successfully come into the kernel. > > I think it's more common that a stuck/borked CPU doesn't come into the > kernel at all, rather than comes in and then fails to online. > > So I think the bail out when the CPU fails to call in is useful, I would > guess I see that "Processor x is stuck" message multiple times a year > while debugging various things. Yeah I can see how my claim is too strong here. >> Removing the msleep(1) in the hotplug path here reduces the time it takes >> to online a CPU on a P9 PowerVM LPAR from about 30ms to 1ms when exercised >> via thaw_secondary_cpus(). > > That is a nice improvement. > > Can we do something that returns quickly in the happy case and still has > a timeout when things go wrong? Seems like a busy loop with a > time_after() check would do the trick. Yes, I'll rework it like that. Thanks.
Re: [PATCH v6 18/33] arm64: Change symbol type annotations
On Thu, Jun 23, 2022 at 09:49:02AM +0800, Chen Zhongjin wrote: > Code symbols not following the aarch64 procedure call convention should > be annotated with SYM_CODE_* instead of SYM_FUNC_* > > Mark relevant symbols as generic code symbols. > -SYM_CODE_START(tramp_exit_native) > +SYM_CODE_START_LOCAL(tramp_exit_native) > tramp_exit > SYM_CODE_END(tramp_exit_native) > > -SYM_CODE_START(tramp_exit_compat) > +SYM_CODE_START_LOCAL(tramp_exit_compat) The commit log says this is fixing things mistakenly lablelld SYM_FUNC but this bit of the actual change is making some symbols local. > -SYM_FUNC_START_LOCAL(__create_page_tables) > +SYM_CODE_START_LOCAL(__create_page_tables) > mov x28, lr > > /* > @@ -389,7 +389,7 @@ SYM_FUNC_START_LOCAL(__create_page_tables) > bl dcache_inval_poc > > ret x28 > -SYM_FUNC_END(__create_page_tables) > +SYM_CODE_END(__create_page_tables) This is removed by Ard's recent refactoring, the others that are still present look valid enough (for things that don't use the stack IIRC they could be seen as conforming but equally this is all running in non standard environments). signature.asc Description: PGP signature
Re: [PATCH v3 02/12] powerpc: wiiu: device tree
On Wed, Jun 29, 2022 at 11:58:18AM +0200, Krzysztof Kozlowski wrote: > On 28/06/2022 15:31, Ash Logan wrote: > > + model = "nintendo,wiiu"; > > It's not compatible, but user-visible string, e.g. "Nintendo Wii U" The "model" property in OF is documented as: --- “model”S Standard property name to define a manufacturer’s model number. prop-encoded-array: Text string, encoded with encode-string. A manufacturer-dependent string that generally specifies the model name and number (including revision level) for this device. The format of the text string is arbitrary, although in conventional usage the string begins with the name of the device’s manufacturer as with the “name” property. Although there is no standard interpretation for the value of the “model” property, a specific device driver might use it to learn, for instance, the revision level of its particular device. See also: property, model. Used as: " XYZCO,1416-02" encode-string " model" property --- > > + cpus { > > + #address-cells = <1>; > > + #size-cells = <0>; > > + > > + /* TODO: Add SMP */ > > + PowerPC,espresso@0 { > > Node name should be generic, so "cpu". Unless something needs the > specific node name? This is how most other PowerPC firmwares do it. The PowerPC processor binding is older than the generic naming practice, so CPU nodes have device_type "cpu" instead. This is a required property btw, with that value. (There is no requirement on the names of the CPU nodes). There is no added value in generic naming for CPU nodes anyway, since you just find them as the children of the "/cpus" node :-) Segher
Re: [PATCH] UAPI: fix a spelling mistake
Hi-- On 6/28/22 23:27, Zhang Jiaming wrote: > Change 'informations' to 'information'. > > Signed-off-by: Zhang Jiaming > --- > arch/powerpc/include/uapi/asm/bootx.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/include/uapi/asm/bootx.h > b/arch/powerpc/include/uapi/asm/bootx.h > index 6728c7e24e58..eb0769e50e93 100644 > --- a/arch/powerpc/include/uapi/asm/bootx.h > +++ b/arch/powerpc/include/uapi/asm/bootx.h > @@ -60,7 +60,7 @@ typedef struct boot_info_map_entry > } boot_info_map_entry_t; > > > -/* Here are the boot informations that are passed to the bootstrap > +/* Here are the boot information that are passed to the bootstrap I would say: /* Here is the boot information that is passed to the bootstrap. I.e., use "is" instead of "are" and add a period at the end. > * Note that the kernel arguments and the device tree are appended > * at the end of this structure. */ > typedef struct boot_infos -- ~Randy
Re: [PATCH v3] powerpc/memhotplug: Add add_pages override for PPC
On Wed, Jun 29, 2022 at 10:39:25AM +0530, Aneesh Kumar K.V wrote: > With commit ffa0b64e3be5 ("powerpc: Fix virt_addr_valid() for 64-bit Book3E & > 32-bit") > the kernel now validate the addr against high_memory value. This results > in the below BUG_ON with dax pfns. > > [ 635.798741][T26531] kernel BUG at mm/page_alloc.c:5521! > 1:mon> e > cpu 0x1: Vector: 700 (Program Check) at [c7287630] > pc: c055ed48: free_pages.part.0+0x48/0x110 > lr: c053ca70: tlb_finish_mmu+0x80/0xd0 > sp: c72878d0 >msr: 8282b033 > current = 0xcafabe00 > paca= 0xc0037300 irqmask: 0x03 irq_happened: 0x05 > pid = 26531, comm = 50-landscape-sy > kernel BUG at :5521! > Linux version 5.19.0-rc3-14659-g4ec05be7c2e1 (kvaneesh@ltc-boston8) (gcc > (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) > #625 SMP Thu Jun 23 00:35:43 CDT 2022 > 1:mon> t > [link register ] c053ca70 tlb_finish_mmu+0x80/0xd0 > [c72878d0] c053ca54 tlb_finish_mmu+0x64/0xd0 (unreliable) > [c7287900] c0539424 exit_mmap+0xe4/0x2a0 > [c72879e0] c019fc1c mmput+0xcc/0x210 > [c7287a20] c0629230 begin_new_exec+0x5e0/0xf40 > [c7287ae0] c070b3cc load_elf_binary+0x3ac/0x1e00 > [c7287c10] c0627af0 bprm_execve+0x3b0/0xaf0 > [c7287cd0] c0628414 do_execveat_common.isra.0+0x1e4/0x310 > [c7287d80] c062858c sys_execve+0x4c/0x60 > [c7287db0] c002c1b0 system_call_exception+0x160/0x2c0 > [c7287e10] c000c53c system_call_common+0xec/0x250 > > The fix is to make sure we update high_memory on memory hotplug. > This is similar to what x86 does in commit 3072e413e305 ("mm/memory_hotplug: > introduce add_pages") > > Fixes: ffa0b64e3be5 ("powerpc: Fix virt_addr_valid() for 64-bit Book3E & > 32-bit") > Cc: Kefeng Wang > Cc: Christophe Leroy > Signed-off-by: Aneesh Kumar K.V Reviewed-by: Oscar Salvador > --- > Changes from v2: > * drop WARN_ON_ONCE > * check for error from __add_pages > > arch/powerpc/Kconfig | 4 > arch/powerpc/mm/mem.c | 33 - > 2 files changed, 36 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index c2ce2e60c8f0..7aa12e88c580 100644 > --- a/arch/powerpc/Kconfig > +++ b/arch/powerpc/Kconfig > @@ -358,6 +358,10 @@ config ARCH_SUSPEND_NONZERO_CPU > def_bool y > depends on PPC_POWERNV || PPC_PSERIES > > +config ARCH_HAS_ADD_PAGES > + def_bool y > + depends on ARCH_ENABLE_MEMORY_HOTPLUG > + > config PPC_DCR_NATIVE > bool > > diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c > index 52b77684acda..a97128a48817 100644 > --- a/arch/powerpc/mm/mem.c > +++ b/arch/powerpc/mm/mem.c > @@ -105,6 +105,37 @@ void __ref arch_remove_linear_mapping(u64 start, u64 > size) > vm_unmap_aliases(); > } > > +/* > + * After memory hotplug the variables max_pfn, max_low_pfn and high_memory > need > + * updating. > + */ > +static void update_end_of_memory_vars(u64 start, u64 size) > +{ > + unsigned long end_pfn = PFN_UP(start + size); > + > + if (end_pfn > max_pfn) { > + max_pfn = end_pfn; > + max_low_pfn = end_pfn; > + high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1; > + } > +} > + > +int __ref add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, > + struct mhp_params *params) > +{ > + int ret; > + > + ret = __add_pages(nid, start_pfn, nr_pages, params); > + if (ret) > + return ret; > + > + /* update max_pfn, max_low_pfn and high_memory */ > + update_end_of_memory_vars(start_pfn << PAGE_SHIFT, > + nr_pages << PAGE_SHIFT); > + > + return ret; > +} > + > int __ref arch_add_memory(int nid, u64 start, u64 size, > struct mhp_params *params) > { > @@ -115,7 +146,7 @@ int __ref arch_add_memory(int nid, u64 start, u64 size, > rc = arch_create_linear_mapping(nid, start, size, params); > if (rc) > return rc; > - rc = __add_pages(nid, start_pfn, nr_pages, params); > + rc = add_pages(nid, start_pfn, nr_pages, params); > if (rc) > arch_remove_linear_mapping(start, size); > return rc; > -- > 2.36.1 > > -- Oscar Salvador SUSE Labs
Re: [PATCH 6/6] i2c: Make remove callback return void
[Dropped most people from Cc, keeping only lists] On Wed, Jun 29, 2022 at 04:11:26PM +0300, Andrey Ryabinin wrote: > On 6/28/22 17:03, Uwe Kleine-König wrote: > > From: Uwe Kleine-König > > > > The value returned by an i2c driver's remove function is mostly ignored. > > (Only an error message is printed if the value is non-zero that the > > error is ignored.) > > > > So change the prototype of the remove function to return no value. This > > way driver authors are not tempted to assume that passing an error to > > the upper layer is a good idea. All drivers are adapted accordingly. > > There is no intended change of behaviour, all callbacks were prepared to > > return 0 before. > > > > Signed-off-by: Uwe Kleine-König > > --- > | 2 +- > > lib/Kconfig.kasan | 1 + > > > diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan > > index f0973da583e0..366e61639cb2 100644 > > --- a/lib/Kconfig.kasan > > +++ b/lib/Kconfig.kasan > > @@ -149,6 +149,7 @@ config KASAN_STACK > > depends on KASAN_GENERIC || KASAN_SW_TAGS > > depends on !ARCH_DISABLE_KASAN_INLINE > > default y if CC_IS_GCC > > + depends on !ARM > > help > > Disables stack instrumentation and thus KASAN's ability to detect > > out-of-bounds bugs in stack variables. > > > What is this doing here? Huh, that is wrong. I needed that for build testing, but it shouldn't have been added to the patch. I'm dropping that for the final submission. Thanks for spotting. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König| Industrial Linux Solutions | https://www.pengutronix.de/ | signature.asc Description: PGP signature
Re: [PATCH] selftests/powerpc: Skip energy_scale_info test on older firmware
On Mon, 20 Jun 2022 09:31:03 +1000, Michael Ellerman wrote: > Older machines don't have the firmware feature that enables the code > this test is testing. Skip the test if the sysfs directory doesn't > exist. Also use the FAIL_IF() macro to provide more verbose error > reporting if an error is encountered. > > Applied to powerpc/next. [1/1] selftests/powerpc: Skip energy_scale_info test on older firmware https://git.kernel.org/powerpc/c/4228a996b072d36f3baafb4afdc2d2d66d2cbadf cheers
Re: [PATCH] powerc: Update asm-prototypes.h comment
On Fri, 17 Jun 2022 18:02:43 +1000, Michael Ellerman wrote: > This header was recently cleaned up in commit 76222808fc25 ("powerpc: > Move C prototypes out of asm-prototypes.h"), update the comment to > reflect it's proper purpose. > > Applied to powerpc/next. [1/1] powerc: Update asm-prototypes.h comment https://git.kernel.org/powerpc/c/2d386769753a71e57a1a38c7fb79013d3ac451e9 cheers
Re: [PATCH] cxl: drop unexpected word "the" in the comments
On Tue, 21 Jun 2022 20:53:21 +0800, Jiang Jian wrote: > there is an unexpected word "the" in the comments that need to be dropped > > file: drivers/misc/cxl/cxl.h > line: 1107 > +/* check if the given pci_dev is on the the cxl vphb bus */ > changed to > +/* check if the given pci_dev is on the cxl vphb bus */ > > [...] Applied to powerpc/next. [1/1] cxl: drop unexpected word "the" in the comments https://git.kernel.org/powerpc/c/882c835b71e22ca82361dab3b60b85b557abd72f cheers
Re: [PATCH] powerpc/powermac: Remove empty function note_scsi_host()
On Thu, 23 Jun 2022 12:08:36 +0200, Christophe Leroy wrote: > note_scsi_host() has been an empty function since > commit 6ee0d9f744d4 ("[POWERPC] Remove unused old code > from powermac setup code"). > > Remove it. > > > [...] Applied to powerpc/next. [1/1] powerpc/powermac: Remove empty function note_scsi_host() https://git.kernel.org/powerpc/c/d7f396461518c766b2436d64b6d3ba6a4c418dcf cheers
Re: [PATCH 1/2] powerpc: Don't include asm/setup.h in asm/machdep.h
On Sat, 11 Jun 2022 18:55:15 +0200, Christophe Leroy wrote: > asm/machdep.h doesn't need asm/setup.h > > Remove it. > > Add it directly in files that needs it. > > > [...] Applied to powerpc/next. [1/2] powerpc: Don't include asm/setup.h in asm/machdep.h https://git.kernel.org/powerpc/c/113fe88eed53af08800f54a03e463636105831e0 [2/2] powerpc: Move prom_init() out of asm-prototypes.h https://git.kernel.org/powerpc/c/7dc3ba0a071892ea212f90f63738fd9f81b1f638 cheers
Re: [PATCH v2 1/4] powerpc/52xx: Remove dead code, i.e. mpc52xx_get_xtal_freq()
On Sat, 7 May 2022 13:01:44 +0300, Andy Shevchenko wrote: > It seems mpc52xx_get_xtal_freq() is not used anywhere. Remove dead code. > > Patches 1-3 applied to powerpc/next. [1/4] powerpc/52xx: Remove dead code, i.e. mpc52xx_get_xtal_freq() https://git.kernel.org/powerpc/c/6d056b7254f9954522b7bb9947c8779a013d189f [2/4] powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode https://git.kernel.org/powerpc/c/de06fba62af64144aca6f8a8bedbc848d2e5b440 [3/4] powerpc/52xx: Get rid of of_node assignment https://git.kernel.org/powerpc/c/00bcb550dc60f73d593d2dbb718c4f521c7d7be8 cheers
Re: [PATCH v3] powerpc/memhotplug: Add add_pages override for PPC
On Wed, 29 Jun 2022 10:39:25 +0530, Aneesh Kumar K.V wrote: > With commit ffa0b64e3be5 ("powerpc: Fix virt_addr_valid() for 64-bit Book3E & > 32-bit") > the kernel now validate the addr against high_memory value. This results > in the below BUG_ON with dax pfns. > > [ 635.798741][T26531] kernel BUG at mm/page_alloc.c:5521! > 1:mon> e > cpu 0x1: Vector: 700 (Program Check) at [c7287630] > pc: c055ed48: free_pages.part.0+0x48/0x110 > lr: c053ca70: tlb_finish_mmu+0x80/0xd0 > sp: c72878d0 >msr: 8282b033 > current = 0xcafabe00 > paca= 0xc0037300 irqmask: 0x03 irq_happened: 0x05 > pid = 26531, comm = 50-landscape-sy > kernel BUG at :5521! > Linux version 5.19.0-rc3-14659-g4ec05be7c2e1 (kvaneesh@ltc-boston8) (gcc > (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) > #625 SMP Thu Jun 23 00:35:43 CDT 2022 > 1:mon> t > [link register ] c053ca70 tlb_finish_mmu+0x80/0xd0 > [c72878d0] c053ca54 tlb_finish_mmu+0x64/0xd0 (unreliable) > [c7287900] c0539424 exit_mmap+0xe4/0x2a0 > [c72879e0] c019fc1c mmput+0xcc/0x210 > [c7287a20] c0629230 begin_new_exec+0x5e0/0xf40 > [c7287ae0] c070b3cc load_elf_binary+0x3ac/0x1e00 > [c7287c10] c0627af0 bprm_execve+0x3b0/0xaf0 > [c7287cd0] c0628414 do_execveat_common.isra.0+0x1e4/0x310 > [c7287d80] c062858c sys_execve+0x4c/0x60 > [c7287db0] c002c1b0 system_call_exception+0x160/0x2c0 > [c7287e10] c000c53c system_call_common+0xec/0x250 > > [...] Applied to powerpc/fixes. [1/1] powerpc/memhotplug: Add add_pages override for PPC https://git.kernel.org/powerpc/c/ac790d09885d36143076e7e02825c541e8eee899 cheers
Re: [PATCH powerpc v2] powerpc/bpf: Fix use of user_pt_regs in uapi
On Tue, 28 Jun 2022 00:41:19 +0530, Naveen N. Rao wrote: > Trying to build a .c file that includes : > $ cat test_bpf_headers.c > #include > > throws the below error: > /usr/include/linux/bpf_perf_event.h:14:28: error: field ‘regs’ has > incomplete type > 14 | bpf_user_pt_regs_t regs; > |^~~~ > > [...] Applied to powerpc/fixes. [1/1] powerpc/bpf: Fix use of user_pt_regs in uapi https://git.kernel.org/powerpc/c/b21bd5a4b130f8370861478d2880985daace5913 cheers
Re: [PATCH 6/6] i2c: Make remove callback return void
On Tue, Jun 28, 2022 at 04:03:12PM +0200, Uwe Kleine-König wrote: > From: Uwe Kleine-König > > The value returned by an i2c driver's remove function is mostly ignored. > (Only an error message is printed if the value is non-zero that the > error is ignored.) > > So change the prototype of the remove function to return no value. This > way driver authors are not tempted to assume that passing an error to > the upper layer is a good idea. All drivers are adapted accordingly. > There is no intended change of behaviour, all callbacks were prepared to > return 0 before. > > Signed-off-by: Uwe Kleine-König > --- > Documentation/i2c/writing-clients.rst | 2 +- > arch/arm/mach-davinci/board-dm644x-evm.c | 3 +-- > arch/arm/mach-davinci/board-dm646x-evm.c | 3 +-- > arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c| 3 +-- > drivers/auxdisplay/ht16k33.c | 4 +--- > drivers/auxdisplay/lcd2s.c| 3 +-- > drivers/char/ipmi/ipmb_dev_int.c | 4 +--- > drivers/char/ipmi/ipmi_ipmb.c | 4 +--- > drivers/char/ipmi/ipmi_ssif.c | 6 ++ > drivers/char/tpm/st33zp24/i2c.c | 4 +--- > drivers/char/tpm/tpm_i2c_atmel.c | 3 +-- > drivers/char/tpm/tpm_i2c_infineon.c | 4 +--- > drivers/char/tpm/tpm_i2c_nuvoton.c| 3 +-- > drivers/char/tpm/tpm_tis_i2c_cr50.c | 6 ++ > drivers/clk/clk-cdce706.c | 3 +-- > drivers/clk/clk-cs2000-cp.c | 4 +--- > drivers/clk/clk-si514.c | 3 +-- > drivers/clk/clk-si5341.c | 4 +--- > drivers/clk/clk-si5351.c | 4 +--- > drivers/clk/clk-si570.c | 3 +-- > drivers/clk/clk-versaclock5.c | 4 +--- > drivers/crypto/atmel-ecc.c| 6 ++ > drivers/crypto/atmel-sha204a.c| 6 ++ > drivers/extcon/extcon-rt8973a.c | 4 +--- > drivers/gpio/gpio-adp5588.c | 4 +--- > drivers/gpio/gpio-max7300.c | 4 +--- > drivers/gpio/gpio-pca953x.c | 4 +--- > drivers/gpio/gpio-pcf857x.c | 4 +--- > drivers/gpio/gpio-tpic2810.c | 4 +--- > drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 4 +--- > drivers/gpu/drm/bridge/analogix/analogix-anx6345.c| 4 +--- > drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c| 4 +--- > drivers/gpu/drm/bridge/analogix/anx7625.c | 4 +--- > drivers/gpu/drm/bridge/chrontel-ch7033.c | 4 +--- > drivers/gpu/drm/bridge/cros-ec-anx7688.c | 4 +--- > drivers/gpu/drm/bridge/ite-it6505.c | 4 +--- > drivers/gpu/drm/bridge/ite-it66121.c | 4 +--- > drivers/gpu/drm/bridge/lontium-lt8912b.c | 3 +-- > drivers/gpu/drm/bridge/lontium-lt9211.c | 4 +--- > drivers/gpu/drm/bridge/lontium-lt9611.c | 4 +--- > drivers/gpu/drm/bridge/lontium-lt9611uxc.c| 4 +--- > drivers/gpu/drm/bridge/megachips-stdp-ge-b850v3-fw.c | 8 ++-- > drivers/gpu/drm/bridge/nxp-ptn3460.c | 4 +--- > drivers/gpu/drm/bridge/parade-ps8622.c| 4 +--- > drivers/gpu/drm/bridge/parade-ps8640.c| 4 +--- > drivers/gpu/drm/bridge/sii902x.c | 4 +--- > drivers/gpu/drm/bridge/sii9234.c | 4 +--- > drivers/gpu/drm/bridge/sil-sii8620.c | 4 +--- > drivers/gpu/drm/bridge/tc358767.c | 4 +--- > drivers/gpu/drm/bridge/tc358768.c | 4 +--- > drivers/gpu/drm/bridge/tc358775.c | 4 +--- > drivers/gpu/drm/bridge/ti-sn65dsi83.c | 4 +--- > drivers/gpu/drm/bridge/ti-tfp410.c| 4 +--- > drivers/gpu/drm/i2c/ch7006_drv.c | 4 +--- > drivers/gpu/drm/i2c/tda9950.c | 4 +--- > drivers/gpu/drm/i2c/tda998x_drv.c | 3 +-- > drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c| 4 +--- > drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 4 +--- > drivers/gpu/drm/solomon/ssd130x-i2c.c | 4 +--- > drivers/hid/i2c-hid/i2c-hid-core.c| 4 +--- > drivers/hid/i2c-hid/i2c-hid.h | 2 +- > drivers/hwmon/adc128d818.c| 4 +--- > drivers/hwmon/adt7470.c
[Bug 216183] Kernel 5.19-rc4 boots ok with CONFIG_PPC_RADIX_MMU=y but fails to boot with CONFIG_PPC_HASH_MMU_NATIVE=y
https://bugzilla.kernel.org/show_bug.cgi?id=216183 --- Comment #3 from Erhard F. (erhar...@mailbox.org) --- Biggest difference probably is that I run the Talos 2 on Big Endian. ;) I'll check out older LTS kernels and see I can get a bisect if they just work with Hash MMU. -- You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 215389] pagealloc: memory corruption at building glibc-2.33 and running its' testsuite
https://bugzilla.kernel.org/show_bug.cgi?id=215389 --- Comment #31 from Erhard F. (erhar...@mailbox.org) --- (In reply to Michael Ellerman from comment #30) > It's a bit of a stab in the dark, but can you try turning preempt off? > > ie. CONFIG_PREEMPT_NONE=y Just tested that. Backtrace looks a little different but not much. [..] pagealloc: memory corruption fffdfff0: 00 00 00 00 CPU: 0 PID: 29086 Comm: localedef Not tainted 5.19.0-rc4-PMacG4 #2 Call Trace: [f397bc90] [c05eb280] dump_stack_lvl+0x60/0x90 (unreliable) [f397bcb0] [c0233128] __kernel_unpoison_pages+0x1a8/0x1ec [f397bd00] [c02172ec] get_page_from_freelist+0xc20/0xe70 [f397bdc0] [c0217de0] __alloc_pages+0x180/0xe98 [f397be80] [c01fa164] handle_mm_fault+0x450/0xd64 [f397bf00] [c00215d8] do_page_fault+0x1d0/0x82c [f397bf30] [c000433c] DataAccess_virt+0x124/0x17c --- interrupt: 300 at 0x83f1b8 NIP: 0083f1b8 LR: 0083e25c CTR: REGS: f397bf40 TRAP: 0300 Not tainted (5.19.0-rc4-PMacG4) MSR: d032 CR: 88224462 XER: DAR: 01232b3c DSISR: 4200 GPR00: 00840220 af9416c0 a7ca4000 01231b50 0fe0 0005 01232b38 GPR08: 0ff1 01231b48 f4c9 008422b0 01067408 00a2fe34 0070 01231b50 GPR16: 0007 003f 009ba23c 01067010 009ba79c GPR24: 0062 009bdac8 00fe 009ba79c 0fe0 009ba764 009b9ff4 0ff0 NIP [0083f1b8] 0x83f1b8 LR [0083e25c] 0x83e25c --- interrupt: 300 page:ef4bd80c refcount:1 mapcount:0 mapping: index:0x1 pfn:0x310ab flags: 0x8000(zone=2) raw: 8000 0100 0122 0001 0001 raw: page dumped because: pagealloc: corrupted page details Interesting thing is the memory corruption always seems to happen in the last stage of installing, after building is done at copying over the binaries from build directory to target directory: [...] if test -r /var/tmp/portage/sys-libs/glibc-2.34-r13/image//usr/include/gnu/stubs-32.h && cmp -s /var/tmp/portage/sys-libs/glibc-2.34-r13/work/build-ppc-powerpc-unknown-linux-gnu-nptl/stubs.h /var/tmp/portage/sys-libs/glibc-2.34-r13/image//usr/include/gnu/stubs-32.h; \ then echo 'stubs.h unchanged'; \ else /usr/lib/portage/python3.10/ebuild-helpers/xattr/install -c -m 644 /var/tmp/portage/sys-libs/glibc-2.34-r13/work/build-ppc-powerpc-unknown-linux-gnu-nptl/stubs.h /var/tmp/portage/sys-libs/glibc-2.34-r13/image//usr/include/gnu/stubs-32.h; fi rm -f /var/tmp/portage/sys-libs/glibc-2.34-r13/work/build-ppc-powerpc-unknown-linux-gnu-nptl/stubs.h make[1]: Leaving directory '/var/tmp/portage/sys-libs/glibc-2.34-r13/work/glibc-2.34' >>> Completed installing sys-libs/glibc-2.34-r13 into >>> /var/tmp/portage/sys-libs/glibc-2.34-r13/image * Final size of build directory: 635640 KiB (620.7 MiB) * Final size of installed tree: 109892 KiB (107.3 MiB) making executable: /usr/lib/libc.so compressme : 44.96% ( 3.80 KiB => 1.71 KiB, compressme.zst) [...] /var/tmp/portage/sys-libs/glibc-2.34-r13/image/usr/share/doc/glibc-2.34-r13/NEWS : 33.98% ( 315 KiB =>107 KiB, /var/tmp/portage/sys-libs/glibc-2.34-r13/image/usr/share/doc/glibc-2.34-r13/NEWS.zst) strip: powerpc-unknown-linux-gnu-strip --strip-unneeded -N __gentoo_check_ldflags__ -R .comment -R .GCC.command.line -R .note.gnu.gold-version /usr/lib/crt1.o /usr/lib/Mcrt1.o /usr/lib/gcrt1.o /usr/lib/Scrt1.o [...] /lib/ld.so.1 /usr/lib/audit/sotruss-lib.so /usr/bin/pldd installsources: rsyncing source files rsync: [sender] link_stat "/var/tmp/portage/sys-libs/glibc-2.34-r13/work/glibc-2.34/iconv/charmap-kw.gperf" failed: No such file or directory (2) rsync: [sender] link_stat "/var/tmp/portage/sys-libs/glibc-2.34-r13/work/glibc-2.34/locale/charmap-kw.gperf" failed: No such file or directory (2) rsync: [sender] link_stat "/var/tmp/portage/sys-libs/glibc-2.34-r13/work/glibc-2.34/locale/locfile-kw.gperf" failed: No such file or directory (2) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1326) [sender=3.2.4] >>> Installing (1 of 1) sys-libs/glibc-2.34-r13::gentoo * Defaulting /etc/host.conf:multi to on * Last-minute run tests with ./ld.so.1 in /lib ... [...] -- You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
Re: [PATCH 6/6] i2c: Make remove callback return void
rg>, Robert Jones , George Joseph , Vincent Knecht , Robin van der Gracht , Randy Dunlap , linux-st...@st-md-mailman.stormreply.com, Michael Tretter , Geert Uytterhoeven , Phong LE , Daniel Beer , Krzysztof Opasiak , Bjorn Andersson , linux-cry...@vger.kernel.org, Pengutronix Kernel Team , Heungjun Kim , Hans Verkuil , David Lin , Vladimir Oltean , David Rhodes , Claudiu Beznea , Jean-Baptiste Maneyrol , Alexandre Belloni , Dan Robertson , Martyn Welch , Jiri Slaby , devicet...@vger.kernel.org, David Airlie , Jon Nettleton , Srinivas Pandruvada , Marco Felsch , Wim Van Sebroeck , Sebastian Reichel , Max Filippov , "Lad, Prabhakar" , Thierry Reding , linux-...@vger.kernel.org, Martiros Shakhzadyan , Guenter Roeck , Matthias Schwarzott , Sylwester Nawrocki , Eric Dumazet , Leon Luo , Saranya Gopal , Lars-Peter Clausen , Corey Minyard , Evgeny Novikov , Frank Rowand , Bartosz Golaszewski , Manivannan Sadhasivam , Pierre-Louis Bossart , Minghao Chi < chi.ming...@zte.com.cn>, linux-...@vger.kernel.org, Nathan Chancellor , MyungJoo Ham , Charles Gorand , Jagan Teki , Vijendar Mukunda , Miguel Ojeda , Kyungmin Park , Tianshu Qiu , Martin Donnelly , Woojung Huh , Rudolf Marek , Charles Keepax , linux-watch...@vger.kernel.org, Michael Hennerich , Ido Schimmel , acpi4asus-u...@lists.sourceforge.net, Simon Trimmer , Ricard Wanderlof , Rikard Falkeborn , Alex Deucher , Jiri Valek - 2N , linux-rpi-ker...@lists.infradead.org, Biju Das , Wayne Chang , Chen-Yu Tsai , Sing-Han Chen , linux-arm-ker...@lists.infradead.org, Niklas =?UTF-8?B?U8O2ZGVybHVuZA==?= , Hans de Goede , Stephen Boyd , Maslov Dmitry , linux-g...@vger.kernel.org, Jens Frederich , Douglas Anderson , "David S. Miller" , Wolfram Sang , Jarkko Sakkinen , linux-...@vger.kernel.org, Jacopo Mondi , Maxime Coquelin , CGEL ZTE , Colin Leroy , platform-driver-...@vger.kernel.org, linux-integr...@vger.kernel.org, Kevin Tsai , Pali =?UTF-8?B?Um9ow6Fy?= , Jonathan Cameron , Heiner Kallweit , Daniel Palmer , Arec Kao , Crt Mori , Jose Cazarin , Neil Armstrong , linux-...@vger.kernel.org, Tom Rix , Michael Turquette , Peter Senna Tschudin , Benjamin Mugnier , Nuno =?UTF-8?B?U8Oh?= , Jan-Simon Moeller , Wei Yongjun , Laurent Pinchart , Andrzej Hajda , Nikita Travkin , Jeremy Kerr , Jasmin Jessich , Sam Ravnborg , Kevin Cernekee , Alyssa Rosenzweig , linux-...@vger.kernel.org, Daniel Thompson , Florian Fainelli , Lucas Tanure , Stefan Mavrodiev , Masahiro Yamada , Sylvain Petinot , net...@vger.kernel.org, Kieran Bingham , Jernej Skrabec , Xin Ji , Seven Lee , Matt Ranostay , Broadcom internal kernel review list , Adrien Grassein , Yang Yingliang , chrome-platf...@lists.linux.dev, Mats Randgaard , Paolo Abeni , Alexey Dobriyan , Joel Stanley , linux-in...@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Lyude Paul , Kees Cook , Uwe =?UTF-8?B?S2xlaW5lLUvDtm5pZw==?= , Jonas Karlman , Yang Li , Tim Harvey , Jiri Kosina , Akinobu Mita , Mark Gross , Richard Fitzgerald , Mark Brown < broo...@kernel.org>, wengjianfeng , Maxime Ripard , Sven Peter , Martin Kepplinger , openipmi-develo...@lists.sourceforge.net, Mauro Carvalho Chehab , Benson Leung , "Daniel W. S. Almeida" , Chiranjeevi Rapolu , Alessandro Zummo , linux-hw...@vger.kernel.org, Felipe Balbi , Stephan Gerhold , Support Opensource , Alexandru Ardelean , Dmitry Torokhov , Marc Hulsman , Corentin Chary , Stephen Kitt , Daniel Scally , linux-fb...@vger.kernel.org, Andrey Ryabinin , Arnd Bergmann , Kirill Shilimanov , Sakari Ailus , patc...@opensource.cirrus.com, Zh eng Yongjun , Alejandro Tafalla , Peter Rosin , Arnaud Ferraris , Hector Martin , Vignesh Raghavendra , Nick Dyer , Greg Kroah-Hartman , Tony Lindgren , Alexandre Torgue , Takashi Iwai , Paul Cercueil , George McCollister , Mac Chiang , Antoniu Miclaus , Alexander Potapenko , linux-stag...@lists.linux.dev, Adam Ford , Peter Huewe , unglinuxdri...@microchip.com, Lee Jones , linux-...@lists.infradead.org, Alexey Khoroshilov , Marek Vasut , Paul Kocialkowski , alsa-de...@alsa-project.org, Vincenzo Frasc ino , Eric Piel , Herbert Xu , Tobias Schrammm , Richard Weinberger , Tomasz Duszynski , Janusz Krzysztofik , Russell King , linux-...@vger.kernel.org, Jason Gunthorpe , Thomas Zimmermann , Bastien Nocera , Jingoo Han , Jakub Kicinski , Vivien Didelot , Yizhuo , Shawn Tu , linux-me...@vger.kernel.org, Yan Lei , Akihiro Tsukada , Tudor Ambarus , Dmitry Rokosov , Oliver Graute , Alistair Francis , Dongliang Mu , Jonathan =?UTF-8?B?TmV1c2Now6RmZXI=?= , Eduardo Valentin , Rui Migue l Silva , Michael Srba , Rob Herring , linux-media...@lists.infradead.org, Fabio Estevam , Matthias Brugger , kasan-...@googlegroups.com, "Paul J. Murphy" , Nicola Lunghi , Daniele Alessandrelli , Dmitry Vyukov , Ramesh Shanmugasundaram , Liam Girdwood , Juerg Haefliger , Oder Chiou , Shengjiu Wang , Nicolas Ferre , Robert Foss , Krzysztof Kozlowski , Dan
Re: [PATCH 6/6] i2c: Make remove callback return void
.org>, Robert Jones , George Joseph , Vincent Knecht , Robin van der Gracht , Randy Dunlap , linux-st...@st-md-mailman.stormreply.com, Michael Tretter , Geert Uytterhoeven , Phong LE , Daniel Beer , Krzysztof Opasiak , Bjorn Andersson , linux-cry...@vger.kernel.org, Pengutronix Kernel Team , Heungjun Kim , Hans Verkuil , David Lin , Vladimir Oltean , David Rhodes , Claudiu Beznea , Jean-Baptiste Maneyrol , Alexandre Belloni , Dan Robertson , Martyn Welch , Jiri Slaby , devicet...@vger.kernel.org, David Airlie , Jon Nettleton , Srinivas Pandruvada , Marco Felsch , Wim Van Sebroeck , Sebastian Reichel , Max Filippov , "Lad, Prabhakar" , Thierry Reding , linux-...@vger.kernel.org, Martiros Shakhzadyan , Guenter Roeck , Matthias Schwarzott , Sylwester Nawrocki , Eric Dumazet , Marek =?iso-8859-1?Q?Beh=FAn?= , Saranya Gopal , Lars-Peter Clausen , Corey Minyard , Evgeny Novikov , Frank Rowand , Bartosz Golaszewski , Manivannan Sadhasivam , Pierr e-Louis Bossart , Minghao Chi , linux-...@vger.kernel.org, Nathan >Chancellor , MyungJoo Ham , >Charles Gorand , Jagan Teki >, Vijendar Mukunda , >Miguel Ojeda , Kyungmin Park , >Tianshu Qiu , Martin Donnelly >, Woojung Huh , Rudolf >Marek , Charles Keepax , >linux-watch...@vger.kernel.org, Michael Hennerich >, Ido Schimmel , >acpi4asus-u...@lists.sourceforge.net, Simon Trimmer >, Ricard Wanderlof , Rikard >Falkeborn , Alex Deucher >, Jiri Valek - 2N , >linux-rpi-ker...@lists.infradead.org, Biju Das , Wa yne Chang , Chen-Yu Tsai , Sing-Han Chen , linux-arm-ker...@lists.infradead.org, Niklas =?iso-8859-1?Q?S=F6derlund?= , Hans de Goede , Stephen Boyd , Maslov Dmitry , linux-g...@vger.kernel.org, Jens Frederich , Douglas Anderson , linux-me...@vger.kernel.org, "David S. Miller" , Wolfram Sang , Jarkko Sakkinen , linux-...@vger.kernel.org, Jacopo Mondi , Maxime Coquelin , CGEL ZTE , Colin Leroy , platform-driver-...@vger.kernel.org, linux-integr...@vger.kernel.org, Kevin Tsai , Pali =?iso-8859-1?Q?Roh=E1r?= , Jonathan Cameron , Heiner Kallweit , Daniel Palmer , Arec Kao , Crt Mor i , Jose Cazarin , Neil Armstrong , linux-...@vger.kernel.org, Tom Rix , Michael Turquette , Peter Senna Tschudin , Benjamin Mugnier , Nuno =?iso-8859-1?Q?S=E1?= , Jan-Simon Moeller , Wei Yongjun , Laurent Pinchart , Andrzej Hajda , Nikita Travkin , Jeremy Kerr , Jasmin Jessich , Sam Ravnborg , Kevin Cernekee , Alyssa Rosenzweig , linux-...@vger.kernel.org, Daniel Thompson , Florian Fainelli , Lucas Tanure , Stefan Mavrodiev , Masahiro Yamada , Sylvain Petinot < sylvain.peti...@foss.st.com>, net...@vger.kernel.org, Kieran Bingham , Jernej Skrabec , Xin Ji , Seven Lee , Matt Ranostay , Broadcom internal kernel review list , Adrien Grassein , Yang Yingliang , chrome-platf...@lists.linux.dev, Mats Randgaard , Paolo Abeni , Alexey Dobriyan , Joel Stanley , linux-in...@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Lyude Paul , Kees Cook , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Jonas Karlman , Yang Li , Tim Harvey , Jiri Kosina , Akinobu Mita , Mark Gross , Richar d Fitzgerald , Mark Brown < broo...@kernel.org>, wengjianfeng , Maxime Ripard , Sven Peter , Martin Kepplinger , openipmi-develo...@lists.sourceforge.net, Mauro Carvalho Chehab , Benson Leung , "Daniel W. S. Almeida" , Chiranjeevi Rapolu , Alessandro Zummo , linux-hw...@vger.kernel.org, Felipe Balbi , Stephan Gerhold , Support Opensource , Alexandru Ardelean , Dmitry Torokhov , Marc Hulsman , Corentin Chary , Stephen Kitt , Daniel Scally , linux-fb...@vger.kernel.org, Andrey Ryabinin , Arnd Bergmann , Kirill Shilimanov , Sakari Ailus , patc...@opensource.cirrus.com, Zheng Yongjun , Alejandro Tafalla , Peter Rosin , Arnaud Ferraris , Hector Martin , Vignesh Raghavendra , Nick Dyer , Liam Girdwood , Tony Lindgren , Alexandre Torgue , Takashi Iwai , Paul Cercueil , George McCollister , Mac Chiang , Antoniu Miclaus , Alexander Potapenko , linux-stag...@lists.linux.dev, Adam Ford , Peter Huewe , unglinuxdri...@microchip.com, Lee Jones , linux-...@lists.infradead.org, Alexey Khoroshilov , Marek Vasut , Paul Kocialkowski , al sa-de...@alsa-project.org, Vincenzo Frascino , Eric Piel , Herbert Xu , Tobias Schrammm , Richard Weinberger , Tomasz Duszynski , Janusz Krzysztofik , Russell King , linux-...@vger.kernel.org, Jason Gunthorpe , Thomas Zimmermann , Bastien Nocera , Jingoo Han , Jakub Kicinski , Vivien Didelot , Yizhuo , Shawn Tu , Leon Luo , Yan Lei , Akihiro Tsukada , Tudor Ambarus , Dmitry Rokosov , Oliver Graute , Alistair Francis , Dongliang Mu , Jonathan =?iso-8859-1?Q?Neusch=E4fer?= , Eduardo Valentin , Rui Miguel Silva , Michael Srba , Rob Herring , linux-media...@lists.infradead.org, Fabio Estevam , Matthias Brugger , kasan-...@googlegroups.com, "Paul J. Murphy" , Nicola Lunghi , Daniele Alessandrelli , Dmitry Vyukov , Ramesh Shanmugasundaram , Juerg Haefliger , Oder Chiou , Shengjiu Wang , Nicolas Ferre ,
Re: [PATCH 6/6] i2c: Make remove callback return void
Hello, On Wed, Jun 29, 2022 at 09:24:55AM +0200, Crt Mori wrote: > On Tue, 28 Jun 2022 at 16:04, Uwe Kleine-König > wrote: > > static const struct i2c_device_id mlx90614_id[] = { > > diff --git a/drivers/iio/temperature/mlx90632.c > > b/drivers/iio/temperature/mlx90632.c > > index 7ee7ff8047a4..e8ef47147e2b 100644 > > --- a/drivers/iio/temperature/mlx90632.c > > +++ b/drivers/iio/temperature/mlx90632.c > > @@ -924,7 +924,7 @@ static int mlx90632_probe(struct i2c_client *client, > > return iio_device_register(indio_dev); > > } > > > > -static int mlx90632_remove(struct i2c_client *client) > > +static void mlx90632_remove(struct i2c_client *client) > > { > > struct iio_dev *indio_dev = i2c_get_clientdata(client); > > struct mlx90632_data *data = iio_priv(indio_dev); > > @@ -936,8 +936,6 @@ static int mlx90632_remove(struct i2c_client *client) > > pm_runtime_put_noidle(&client->dev); > > > > mlx90632_sleep(data); > > - > > - return 0; > > } > > > For both mlx drivers > > Reviewed-by: "Crt Mori " Thanks, it was more complicated than (IMHO) necessary to find these lines. I suggest to strip the irrelevant part the quoted mail for the next time. I added your tag without the quotes to my tree. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König| Industrial Linux Solutions | https://www.pengutronix.de/ | signature.asc Description: PGP signature
Re: [PATCH 6/6] i2c: Make remove callback return void
On Tue, Jun 28, 2022 at 04:03:12PM +0200, Uwe Kleine-König wrote: > diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c > index cd47c3597e19..2a58185fb14c 100644 > --- a/drivers/usb/typec/hd3ss3220.c > +++ b/drivers/usb/typec/hd3ss3220.c > @@ -245,14 +245,12 @@ static int hd3ss3220_probe(struct i2c_client *client, > return ret; > } > > -static int hd3ss3220_remove(struct i2c_client *client) > +static void hd3ss3220_remove(struct i2c_client *client) > { > struct hd3ss3220 *hd3ss3220 = i2c_get_clientdata(client); > > typec_unregister_port(hd3ss3220->port); > usb_role_switch_put(hd3ss3220->role_sw); > - > - return 0; > } > > static const struct of_device_id dev_ids[] = { > diff --git a/drivers/usb/typec/mux/fsa4480.c b/drivers/usb/typec/mux/fsa4480.c > index 6184f5367190..d6495e533e58 100644 > --- a/drivers/usb/typec/mux/fsa4480.c > +++ b/drivers/usb/typec/mux/fsa4480.c > @@ -181,14 +181,12 @@ static int fsa4480_probe(struct i2c_client *client) > return 0; > } > > -static int fsa4480_remove(struct i2c_client *client) > +static void fsa4480_remove(struct i2c_client *client) > { > struct fsa4480 *fsa = i2c_get_clientdata(client); > > typec_mux_unregister(fsa->mux); > typec_switch_unregister(fsa->sw); > - > - return 0; > } > > static const struct i2c_device_id fsa4480_table[] = { > diff --git a/drivers/usb/typec/mux/pi3usb30532.c > b/drivers/usb/typec/mux/pi3usb30532.c > index 6ce9f282594e..1cd388b55c30 100644 > --- a/drivers/usb/typec/mux/pi3usb30532.c > +++ b/drivers/usb/typec/mux/pi3usb30532.c > @@ -160,13 +160,12 @@ static int pi3usb30532_probe(struct i2c_client *client) > return 0; > } > > -static int pi3usb30532_remove(struct i2c_client *client) > +static void pi3usb30532_remove(struct i2c_client *client) > { > struct pi3usb30532 *pi = i2c_get_clientdata(client); > > typec_mux_unregister(pi->mux); > typec_switch_unregister(pi->sw); > - return 0; > } > > static const struct i2c_device_id pi3usb30532_table[] = { > diff --git a/drivers/usb/typec/rt1719.c b/drivers/usb/typec/rt1719.c > index f1b698edd7eb..ea8b700b0ceb 100644 > --- a/drivers/usb/typec/rt1719.c > +++ b/drivers/usb/typec/rt1719.c > @@ -930,14 +930,12 @@ static int rt1719_probe(struct i2c_client *i2c) > return ret; > } > > -static int rt1719_remove(struct i2c_client *i2c) > +static void rt1719_remove(struct i2c_client *i2c) > { > struct rt1719_data *data = i2c_get_clientdata(i2c); > > typec_unregister_port(data->port); > usb_role_switch_put(data->role_sw); > - > - return 0; > } > > static const struct of_device_id __maybe_unused rt1719_device_table[] = { > diff --git a/drivers/usb/typec/stusb160x.c b/drivers/usb/typec/stusb160x.c > index e7745d1c2a5c..8638f1d39896 100644 > --- a/drivers/usb/typec/stusb160x.c > +++ b/drivers/usb/typec/stusb160x.c > @@ -801,7 +801,7 @@ static int stusb160x_probe(struct i2c_client *client) > return ret; > } > > -static int stusb160x_remove(struct i2c_client *client) > +static void stusb160x_remove(struct i2c_client *client) > { > struct stusb160x *chip = i2c_get_clientdata(client); > > @@ -823,8 +823,6 @@ static int stusb160x_remove(struct i2c_client *client) > > if (chip->main_supply) > regulator_disable(chip->main_supply); > - > - return 0; > } > > static int __maybe_unused stusb160x_suspend(struct device *dev) > diff --git a/drivers/usb/typec/tcpm/fusb302.c > b/drivers/usb/typec/tcpm/fusb302.c > index 96c55eaf3f80..5e9348f28d50 100644 > --- a/drivers/usb/typec/tcpm/fusb302.c > +++ b/drivers/usb/typec/tcpm/fusb302.c > @@ -1771,7 +1771,7 @@ static int fusb302_probe(struct i2c_client *client, > return ret; > } > > -static int fusb302_remove(struct i2c_client *client) > +static void fusb302_remove(struct i2c_client *client) > { > struct fusb302_chip *chip = i2c_get_clientdata(client); > > @@ -1783,8 +1783,6 @@ static int fusb302_remove(struct i2c_client *client) > fwnode_handle_put(chip->tcpc_dev.fwnode); > destroy_workqueue(chip->wq); > fusb302_debugfs_exit(chip); > - > - return 0; > } > > static int fusb302_pm_suspend(struct device *dev) > diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c > index f33e08eb7670..c48fca60bb06 100644 > --- a/drivers/usb/typec/tcpm/tcpci.c > +++ b/drivers/usb/typec/tcpm/tcpci.c > @@ -869,7 +869,7 @@ static int tcpci_probe(struct i2c_client *client, > return 0; > } > > -static int tcpci_remove(struct i2c_client *client) > +static void tcpci_remove(struct i2c_client *client) > { > struct tcpci_chip *chip = i2c_get_clientdata(client); > int err; > @@ -880,8 +880,6 @@ static int tcpci_remove(struct i2c_client *client) > dev_warn(&client->dev, "Failed to disable irqs (%pe)\n", > ERR_PTR(err)); > > tcpci_unregister_port(chip->tcpci); > - > - return 0; >
Re: [PATCH 6/6] i2c: Make remove callback return void
.org>, Robert Jones , George Joseph , Vincent Knecht , Robin van der Gracht , Randy Dunlap , linux-st...@st-md-mailman.stormreply.com, Michael Tretter , Geert Uytterhoeven , Phong LE , Daniel Beer , Krzysztof Opasiak , Bjorn Andersson , linux-cry...@vger.kernel.org, Pengutronix Kernel Team , Heungjun Kim , Hans Verkuil , David Lin , Vladimir Oltean , David Rhodes , Claudiu Beznea , Jean-Baptiste Maneyrol , Alexandre Belloni , Dan Robertson , Martyn Welch , Jiri Slaby , devicet...@vger.kernel.org, David Airlie , Jon Nettleton , Srinivas Pandruvada , Marco Felsch , Wim Van Sebroeck , Sebastian Reichel , Max Filippov , "Lad, Prabhakar" , Thierry Reding , linux-...@vger.kernel.org, Martiros Shakhzadyan , Guenter Roeck , Matthias Schwarzott , Sylwester Nawrocki , Eric Dumazet , Marek =?ISO-8859-1?Q?Beh�n?= , Saranya Gopal , Lars-Peter Clausen , Corey Minyard , Evgeny Novikov , Frank Rowand , Bartosz Golaszewski , Manivannan Sadhasivam , Pierr e-Louis Bossart , Minghao Chi , linux-...@vger.kernel.org, Nathan >Chancellor , MyungJoo Ham , >Charles Gorand , Jagan Teki >, Vijendar Mukunda , >Miguel Ojeda , Kyungmin Park , >Tianshu Qiu , Martin Donnelly >, Woojung Huh , Rudolf >Marek , Charles Keepax , >linux-watch...@vger.kernel.org, Michael Hennerich >, Ido Schimmel , >acpi4asus-u...@lists.sourceforge.net, Simon Trimmer >, Ricard Wanderlof , Rikard >Falkeborn , Alex Deucher >, Jiri Valek - 2N , >linux-rpi-ker...@lists.infradead.org, Biju Das , Wa yne Chang , Chen-Yu Tsai , Sing-Han Chen , linux-arm-ker...@lists.infradead.org, Niklas =?ISO-8859-1?Q?S�derlund?= , Hans de Goede , Stephen Boyd , Maslov Dmitry , linux-g...@vger.kernel.org, Jens Frederich , Douglas Anderson , linux-me...@vger.kernel.org, "David S. Miller" , Paul Kocialkowski , Jarkko Sakkinen , linux-...@vger.kernel.org, Jacopo Mondi , Maxime Coquelin , CGEL ZTE , Colin Leroy , platform-driver-...@vger.kernel.org, linux-integr...@vger.kernel.org, Kevin Tsai , Pali =?ISO-8859-1?Q?Roh�r?= , Jonathan Cameron , Heiner Kallweit , Daniel Palmer , Arec Kao , Crt Mori , Jose Cazarin , Neil Armstrong , linux-...@vger.kernel.org, Tom Rix , Michael Turquette , Peter Senna Tschudin , Benjamin Mugnier , Nuno =?ISO-8859-1?Q?S�?= , Jan-Simon Moeller , Wei Yongjun , Laurent Pinchart , Andrzej Hajda , Nikita Travkin , Jasmin Jessich , Sam Ravnborg , Kevin Cernekee , Alyssa Rosenzweig , linux-...@vger.kernel.org, Daniel Thompson , Florian Fainelli , Lucas Tanure , Stefan Mavrodiev , Masahiro Yamada , Sylvain Petinot , net...@vger.kernel.org, Kieran Bingham , Jernej Skrabec , Xin Ji , Seven Lee , Matt Ranostay , Broadcom internal kernel review list , Adrien Grassein , Yang Yingliang , chrome-platf...@lists.linux.dev, Mats Randgaard , Paolo Abeni , Alexey Dobriyan , Joel Stanley , linux-in...@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Lyude Paul , Kees Cook , Uwe =?ISO-8859-1?Q?Kleine-K�nig?= , Jonas Karlman , Yang Li , Tim Harvey , Jiri Kosina , Akinobu Mita , Mark Gross , Richard Fitzgerald , Mark Brown , wengjianfeng , Maxime Ripard , Sven Peter , Martin Kepplinger , openipmi-develo...@lists.sourceforge.net, Mauro Carvalho Chehab , Benson Leung , "Daniel W. S. Almeida" , Chiranjeevi Rapolu , Alessandro Zummo , linux-hw...@vger.kernel.org, Felipe Balbi , Stephan Gerhold , Support Opensource , Alexandru Ardelean , Dmitry Torokhov , Marc Hulsman , Corentin Chary , Stephen Kitt , Daniel Scally , linux-fb...@vger.kernel.org, Andrey Ryabinin , Arnd Bergmann , Kirill Shilimanov , Sakari Ailus , patc...@opensource.cirrus.com, Zheng Yongjun , Alejandro Tafalla , Peter Rosin , Arnaud Ferraris , Hector Martin , Vignesh Raghavendra , Nick Dyer , Greg Kroah-Hartman , Tony Lindgren , Alexandre Torgue , Takashi Iwai , Paul Cercueil , George McCollister , Mac Chiang , Antoniu Miclaus , Alexander Potapenko , linux-stag...@lists.linux.dev, Adam Ford , Peter Huewe , unglinuxdri...@microchip.com, Lee Jones , linux-...@lists.infradead.org, Alexey Khoroshilov , Marek Vasut , Yizhuo , alsa-de...@alsa-project.org, Vinc enzo Frascino , Eric Piel , Herbert Xu , Tobias Schrammm , Richard Weinberger , Tomasz Duszynski , Janusz Krzysztofik , Russell King , linux-...@vger.kernel.org, Jason Gunthorpe , Thomas Zimmermann , Bastien Nocera , Jingoo Han , Jakub Kicinski , Vivien Didelot , Shawn Tu , Leon Luo , Yan Lei , Akihiro Tsukada , Tudor Ambarus , Dmitry Rokosov , Oliver Graute , Alistair Francis , Dongliang Mu , Jonathan =?ISO-8859-1?Q?Neusch�fer?= , Eduardo Valentin , Rui Miguel Silva , Michael Srba , Rob Herring , linux-media...@lists.infradead.org, Fabio Estevam , Matthias Brugger , kasan-...@googlegroups.com, "Paul J. Murphy" , Nicola Lunghi , Daniele Alessandrelli , Dmitry Vyukov , Ramesh Shanmugasundaram , Liam Girdwood , Juerg Haefliger , Oder Chiou , Shengjiu Wang , Nicolas Ferre , Robert Foss , Krzysztof Kozlowski , Daniel Vetter , Alvin =?UTF-8?Q
Re: [PATCH v3 02/12] powerpc: wiiu: device tree
On 28/06/2022 15:31, Ash Logan wrote: > Add a device tree source file for the Nintendo Wii U video game console. > > Signed-off-by: Ash Logan > Co-developed-by: Roberto Van Eeden > Signed-off-by: Roberto Van Eeden > Co-developed-by: Emmanuel Gil Peyrot > Signed-off-by: Emmanuel Gil Peyrot > --- > v1->v2: Style and formatting changes suggested by Rob Herring. > License remains GPL-2.0 as the other powerpc dtses are the same, happy > to change if there is a different preferred default. > v2->v3: Re-added address-cells accidentally removed in v2. > Marked latte as a simple-bus, since it is. Thank you for your patch. There is something to discuss/improve. > > arch/powerpc/boot/dts/wiiu.dts | 326 + > 1 file changed, 326 insertions(+) > create mode 100644 arch/powerpc/boot/dts/wiiu.dts > > diff --git a/arch/powerpc/boot/dts/wiiu.dts b/arch/powerpc/boot/dts/wiiu.dts > new file mode 100644 > index ..44a5a1469095 > --- /dev/null > +++ b/arch/powerpc/boot/dts/wiiu.dts > @@ -0,0 +1,326 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Nintendo Wii U Device Tree Source > + * > + * Copyright (C) 2022 The linux-wiiu Team > + */ > + > +/dts-v1/; > +#include > +#include > + > +/ { > + model = "nintendo,wiiu"; It's not compatible, but user-visible string, e.g. "Nintendo Wii U" > + compatible = "nintendo,wiiu"; > + > + #address-cells = <1>; > + #size-cells = <1>; > + > + chosen { > + bootargs = "root=/dev/sda1 rootwait"; This does not belong to shared DTS. No bootargs. > + }; > + > + memory { > + device_type = "memory"; > + reg = <0x 0x0200/* MEM1 - 32MiB */ > +0x0800 0x0030/* MEM0 - 3MiB */ > +0x1000 0x8000>; /* MEM2 - 2GiB */ > + }; > + > + cpus { > + #address-cells = <1>; > + #size-cells = <0>; > + > + /* TODO: Add SMP */ > + PowerPC,espresso@0 { Node name should be generic, so "cpu". Unless something needs the specific node name? > + device_type = "cpu"; > + reg = <0>; > + clock-frequency = <1243125000>; /* 1.243125GHz > */ > + bus-frequency = <248625000>;/* 248.625MHz > core-to-bus 5x */ > + timebase-frequency = <62156250>;/* 1/4 of the > bus clock */ > + i-cache-size = <32768>; /* 32K icache */ > + i-cache-line-size = <32>; > + i-cache-block-size = <32>; > + i-cache-sets = <128>; > + d-cache-size = <32768>; /* 32K dcache */ > + d-cache-line-size = <32>; > + d-cache-block-size = <32>; > + d-cache-sets = <128>; > + next-level-cache = <&L2_0>; > + L2_0:l2-cache { > + compatible = "cache"; > + cache-level = <2>; > + cache-unified; > + cache-size = <0x8>; /* 512KB L2 */ > + cache-line-size = <64>; > + cache-block-size = <32>; > + cache-sets = <2048>; > + }; > + }; > + }; > + > + latte { Generic node names. > + #address-cells = <1>; > + #size-cells = <1>; > + compatible = "nintendo,latte", "simple-bus"; > + ranges = <0x0c00 0x0c00 0x0040 /* > Espresso-only registers */ > + 0x0d00 0x0d00 0x0020 /* Latte AHB > deivces */ > + 0x0d80 0x0d80 0x0080>;/* Latte SoC > registers */ > + > + latte_gpu: gpu@c20 { > + compatible = "nintendo,latte-gpu7"; > + reg = <0x0c20 0x8>; > + interrupts = <2>; > + interrupt-parent = <&espresso_pic>; > + }; > + > + espresso_pic: pic@c78 { interrupt-controller > + #interrupt-cells = <1>; > + interrupt-controller; > + > + compatible = "nintendo,espresso-pic"; > + reg = <0x0c78 0x18>; > + }; > + > + latte_dsp: dsp@c005000 { > + compatible = "nintendo,latte-dsp"; > + reg = <0x0c005000 0x200>; > + }; > + > + ehci_0: usb@d04 { > + compatible = "nintendo,latte-usb-ehci", "usb-ehci"; > + reg = <0x0d04 0x100>; > + interrupts = <4>; > + interrupt-parent = <&latte_pic>; > + big-endian-regs; > + }; > + > + ohci_0
Re: [PATCH v3 01/12] dt-bindings: wiiu: Document the Nintendo Wii U devicetree
On 28/06/2022 15:31, Ash Logan wrote: > Adds schema for the various Wii U devicetree nodes used. > > Signed-off-by: Ash Logan > --- > .../bindings/powerpc/nintendo/wiiu.yaml | 28 +++ > .../powerpc/nintendo/wiiu/espresso-pic.yaml | 42 + > .../bindings/powerpc/nintendo/wiiu/gpu7.yaml | 41 + > .../powerpc/nintendo/wiiu/latte-ahci.yaml | 43 + > .../powerpc/nintendo/wiiu/latte-dsp.yaml | 35 ++ > .../powerpc/nintendo/wiiu/latte-pic.yaml | 46 +++ > .../powerpc/nintendo/wiiu/latte-sdhci.yaml| 40 > .../bindings/powerpc/nintendo/wiiu/latte.yaml | 25 ++ > 8 files changed, 300 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/powerpc/nintendo/wiiu.yaml > create mode 100644 > Documentation/devicetree/bindings/powerpc/nintendo/wiiu/espresso-pic.yaml > create mode 100644 > Documentation/devicetree/bindings/powerpc/nintendo/wiiu/gpu7.yaml > create mode 100644 > Documentation/devicetree/bindings/powerpc/nintendo/wiiu/latte-ahci.yaml > create mode 100644 > Documentation/devicetree/bindings/powerpc/nintendo/wiiu/latte-dsp.yaml > create mode 100644 > Documentation/devicetree/bindings/powerpc/nintendo/wiiu/latte-pic.yaml > create mode 100644 > Documentation/devicetree/bindings/powerpc/nintendo/wiiu/latte-sdhci.yaml > create mode 100644 > Documentation/devicetree/bindings/powerpc/nintendo/wiiu/latte.yaml > > diff --git a/Documentation/devicetree/bindings/powerpc/nintendo/wiiu.yaml > b/Documentation/devicetree/bindings/powerpc/nintendo/wiiu.yaml > new file mode 100644 > index ..5824b07928f5 > --- /dev/null > +++ b/Documentation/devicetree/bindings/powerpc/nintendo/wiiu.yaml > @@ -0,0 +1,28 @@ > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > +%YAML 1.2 > +--- > + > +$id: http://devicetree.org/schemas/powerpc/nintendo/wiiu.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Nintendo Wii U bindings > + > +maintainers: > + - Ash Logan > + - Emmanuel Gil Peyrot > + > +description: | > + Nintendo Wii U video game console binding. > + > +properties: > + $nodename: > +const: "/" > + compatible: > +oneOf: > + - description: Nintendo Wii U video game console > +items: > + - const: nintendo,wiiu > + > +additionalProperties: true > + > +... > diff --git > a/Documentation/devicetree/bindings/powerpc/nintendo/wiiu/espresso-pic.yaml > b/Documentation/devicetree/bindings/powerpc/nintendo/wiiu/espresso-pic.yaml > new file mode 100644 > index ..878a81595f5f > --- /dev/null > +++ > b/Documentation/devicetree/bindings/powerpc/nintendo/wiiu/espresso-pic.yaml > @@ -0,0 +1,42 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/powerpc/nintendo/wiiu/espresso-pic.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Nintendo Wii U "Espresso" interrupt controller > + > +maintainers: > + - Ash Logan > + - Emmanuel Gil Peyrot > + > +description: | > + Interrupt controller found on the Nintendo Wii U for the "Espresso" > processor. > + > +properties: > + compatible: > +oneOf: No need for oneOf, just const. > + - description: Nintendo Wii U "Espresso" interrupt controller No need for description. > +items: > + - const: nintendo,espresso-pic > + '#interrupt-cells': > +# Interrupt numbers 0-32 in one cell > +const: 1 Blank line between each property. > + interrupt-controller: true > + reg: > +items: > + - description: Core registers Just maxItems:1. Description is not helpful. Missing required properties. > + > +additionalProperties: false > + > +examples: > + - | > +espresso_pic: pic@c78 { Generic node name, so "interrupt-controller" > +#interrupt-cells = <1>; > +interrupt-controller; > + > +compatible = "nintendo,espresso-pic"; > +reg = <0x0c78 0x18>; compatible and reg by convention go first in list of properties. This applies everywhere, also to your DTS. > +}; > + > +... > diff --git > a/Documentation/devicetree/bindings/powerpc/nintendo/wiiu/gpu7.yaml > b/Documentation/devicetree/bindings/powerpc/nintendo/wiiu/gpu7.yaml > new file mode 100644 > index ..e54d49015f36 > --- /dev/null > +++ b/Documentation/devicetree/bindings/powerpc/nintendo/wiiu/gpu7.yaml > @@ -0,0 +1,41 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/powerpc/nintendo/wiiu/gpu7.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Nintendo Wii U Latte "GPU7" graphics processor > + > +maintainers: > + - Ash Logan > + - Emmanuel Gil Peyrot > + > +description: | > + GPU7 graphics processor, also known as "GX2", found in the Latte > multifunction chip of the > + Nintendo Wi
Re: [PATCH] powerpc/smp: poll cpu_callin_map more aggressively in __cpu_up()
Nathan Lynch writes: > Replace the outdated iteration and timeout calculations here with > indefinite spin_until_cond()-wrapped poll of cpu_callin_map. __cpu_up() > already does this when waiting for the cpu to set its online bit before > returning, so this change is not really making the function more brittle. Sorry for the glacial response. I'm not sure I agree that this doesn't make the code more brittle. The existing indefinite wait you mention is later in the function, and happens after the CPU has successfully come into the kernel. I think it's more common that a stuck/borked CPU doesn't come into the kernel at all, rather than comes in and then fails to online. So I think the bail out when the CPU fails to call in is useful, I would guess I see that "Processor x is stuck" message multiple times a year while debugging various things. > Removing the msleep(1) in the hotplug path here reduces the time it takes > to online a CPU on a P9 PowerVM LPAR from about 30ms to 1ms when exercised > via thaw_secondary_cpus(). That is a nice improvement. Can we do something that returns quickly in the happy case and still has a timeout when things go wrong? Seems like a busy loop with a time_after() check would do the trick. cheers
[PATCH llvm v2] powerpc/llvm/lto: Allow LLVM LTO builds
This enables LTO_CLANG builds on POWER with the upstream version of LLVM. LTO optimizes the output vmlinux binary and this may affect the FTP alternative section if alt branches use "bc" (Branch Conditional) which is limited by 16 bit offsets. This shows up in errors like: ld.lld: error: InputSection too large for range extension thunk vmlinux.o:(__ftr_alt_97+0xF0) This works around the issue by replacing "bc" in FTR_SECTION_ELSE with "b" which allows 26 bit offsets. This catches the problem instructions in vmlinux.o before it LTO'ed: $ objdump -d -M raw -j __ftr_alt_97 vmlinux.o | egrep '\S+\s*\' 30: 00 00 82 40 bc 4,eq,30 <__ftr_alt_97+0x30> f0: 00 00 82 40 bc 4,eq,f0 <__ftr_alt_97+0xf0> This allows LTO builds for ppc64le_defconfig plus LTO options. Note that DYNAMIC_FTRACE/FUNCTION_TRACER is not supported by LTO builds but this is not POWERPC-specific. This makes the copy routines slower on POWER6 as this partially reverts a4e22f02f5b6 ("powerpc: Update 64bit__copy_tofrom_user() using CPU_FTR_UNALIGNED_LD_STD") Signed-off-by: Alexey Kardashevskiy --- Changes: v2: * dropped FTR sections which were only meant to improve POWER6 as Paul suggested --- Note 1: This is further development of https://lore.kernel.org/all/20220211023125.1790960-1-...@ozlabs.ru/T/ Note 2: CONFIG_ZSTD_COMPRESS and CONFIG_ZSTD_DECOMPRESS must be both "m" or "y" or it won't link. For details: https://lore.kernel.org/lkml/20220428043850.1706973-1-...@ozlabs.ru/T/ --- arch/powerpc/Kconfig | 2 ++ arch/powerpc/kernel/exceptions-64s.S | 4 +++- arch/powerpc/lib/copyuser_64.S | 15 +-- arch/powerpc/lib/feature-fixups-test.S | 3 +-- arch/powerpc/lib/memcpy_64.S | 14 +- 5 files changed, 8 insertions(+), 30 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 3eaddb8997a9..35050264ea7b 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -162,6 +162,8 @@ config PPC select ARCH_WANTS_MODULES_DATA_IN_VMALLOC if PPC_BOOK3S_32 || PPC_8xx select ARCH_WANTS_NO_INSTR select ARCH_WEAK_RELEASE_ACQUIRE + select ARCH_SUPPORTS_LTO_CLANG + select ARCH_SUPPORTS_LTO_CLANG_THIN select BINFMT_ELF select BUILDTIME_TABLE_SORT select CLONE_BACKWARDS diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index b66dd6f775a4..5b783bd51260 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -476,9 +476,11 @@ DEFINE_FIXED_SYMBOL(\name\()_common_real, text) .if IHSRR_IF_HVMODE BEGIN_FTR_SECTION bne masked_Hinterrupt + b 4f FTR_SECTION_ELSE - bne masked_interrupt ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206) + bne masked_interrupt +4: .elseif IHSRR bne masked_Hinterrupt .else diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S index db8719a14846..b914e52ed240 100644 --- a/arch/powerpc/lib/copyuser_64.S +++ b/arch/powerpc/lib/copyuser_64.S @@ -9,7 +9,7 @@ #include #ifndef SELFTEST_CASE -/* 0 == most CPUs, 1 == POWER6, 2 == Cell */ +/* 0 == most CPUs, 2 == Cell */ #define SELFTEST_CASE 0 #endif @@ -68,19 +68,6 @@ _GLOBAL(__copy_tofrom_user_base) andi. r6,r6,7 PPC_MTOCRF(0x01,r5) blt cr1,.Lshort_copy -/* Below we want to nop out the bne if we're on a CPU that has the - * CPU_FTR_UNALIGNED_LD_STD bit set and the CPU_FTR_CP_USE_DCBTZ bit - * cleared. - * At the time of writing the only CPU that has this combination of bits - * set is Power6. - */ -test_feature = (SELFTEST_CASE == 1) -BEGIN_FTR_SECTION - nop -FTR_SECTION_ELSE - bne .Ldst_unaligned -ALT_FTR_SECTION_END(CPU_FTR_UNALIGNED_LD_STD | CPU_FTR_CP_USE_DCBTZ, \ - CPU_FTR_UNALIGNED_LD_STD) .Ldst_aligned: addir3,r3,-16 r3_offset = 16 diff --git a/arch/powerpc/lib/feature-fixups-test.S b/arch/powerpc/lib/feature-fixups-test.S index 480172fbd024..2751e42a9fd7 100644 --- a/arch/powerpc/lib/feature-fixups-test.S +++ b/arch/powerpc/lib/feature-fixups-test.S @@ -145,7 +145,6 @@ BEGIN_FTR_SECTION FTR_SECTION_ELSE 2: or 2,2,2 PPC_LCMPI r3,1 - beq 3f blt 2b b 3f b 1b @@ -160,10 +159,10 @@ globl(ftr_fixup_test6_expected) 1: or 1,1,1 2: or 2,2,2 PPC_LCMPI r3,1 - beq 3f blt 2b b 3f b 1b + nop 3: or 1,1,1 or 2,2,2 or 3,3,3 diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S index 016c91e958d8..117399dbc891 100644 --- a/arch/powerpc/lib/memcpy_64.S +++ b/arch/powerpc/lib/memcpy_64.S @@ -10,7 +10,7 @@ #include #i
Re: [PATCH 6/6] i2c: Make remove callback return void
On 6/29/22 09:55, Christophe Leroy wrote: > > > Le 29/06/2022 à 09:23, Uwe Kleine-König a écrit : >> Hello, >> >> [I dropped nearly all individuals from the Cc: list because various >> bounces reported to be unhappy about the long (logical) line.] > > Good idea, even patchwork made a mess of it, see > https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20220628140313.74984-7-u.kleine-koe...@pengutronix.de/ > FYI, for patches like these what I usually use is: ./scripts/get_maintainer.pl --nogit-fallback --no-m --no-r -- Best regards, Javier Martinez Canillas Linux Engineering Red Hat
[PATCH] powerpc: platforms: 85xx: Fix spelling mistake
Change 'wont' to 'won't'. Signed-off-by: Zhang Jiaming --- arch/powerpc/platforms/85xx/sgy_cts1000.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c b/arch/powerpc/platforms/85xx/sgy_cts1000.c index 98ae64075193..a920852703ba 100644 --- a/arch/powerpc/platforms/85xx/sgy_cts1000.c +++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c @@ -29,7 +29,7 @@ static const struct of_device_id child_match[] = { static void gpio_halt_wfn(struct work_struct *work) { - /* Likely wont return */ + /* Likely won't return */ orderly_poweroff(true); } static DECLARE_WORK(gpio_halt_wq, gpio_halt_wfn); @@ -51,7 +51,7 @@ static void __noreturn gpio_halt_cb(void) printk(KERN_INFO "gpio-halt: triggering GPIO.\n"); - /* Probably wont return */ + /* Probably won't return */ gpio_set_value(gpio, trigger); panic("Halt failed\n"); @@ -147,7 +147,7 @@ static int gpio_halt_remove(struct platform_device *pdev) static const struct of_device_id gpio_halt_match[] = { /* We match on the gpio bus itself and scan the children since they -* wont be matched against us. We know the bus wont match until it +* won't be matched against us. We know the bus won't match until it * has been registered too. */ { .compatible = "fsl,qoriq-gpio", -- 2.34.1
Re: [PATCH 6/6] i2c: Make remove callback return void
Le 29/06/2022 à 09:23, Uwe Kleine-König a écrit : > Hello, > > [I dropped nearly all individuals from the Cc: list because various > bounces reported to be unhappy about the long (logical) line.] Good idea, even patchwork made a mess of it, see https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20220628140313.74984-7-u.kleine-koe...@pengutronix.de/ > > On Wed, Jun 29, 2022 at 03:03:54PM +0800, Jeremy Kerr wrote: >> Looks good - just one minor change for the mctp-i2c driver, but only >> worthwhile if you end up re-rolling this series for other reasons: >> >>> -static int mctp_i2c_remove(struct i2c_client *client) >>> +static void mctp_i2c_remove(struct i2c_client *client) >>> { >>> struct mctp_i2c_client *mcli = i2c_get_clientdata(client); >>> struct mctp_i2c_dev *midev = NULL, *tmp = NULL; >>> @@ -1000,7 +1000,6 @@ static int mctp_i2c_remove(struct i2c_client *client) >>> mctp_i2c_free_client(mcli); >>> mutex_unlock(&driver_clients_lock); >>> /* Callers ignore return code */ >>> - return 0; >>> } >> >> The comment there no longer makes much sense, I'd suggest removing that >> too. > > Yeah, that was already pointed out to me in a private reply. It's > already fixed in > > https://git.pengutronix.de/cgit/ukl/linux/log/?h=i2c-remove-void > >> Either way: >> >> Reviewed-by: Jeremy Kerr > > Added to my tree, too. > > Thanks > Uwe >
Re: [PATCH 6/6] i2c: Make remove callback return void
On 6/29/22 09:23, Uwe Kleine-König wrote: > Hello, > > [I dropped nearly all individuals from the Cc: list because various > bounces reported to be unhappy about the long (logical) line.] > Yes, it also bounced for me when I tried to reply earlier today. > diff --git a/drivers/gpu/drm/solomon/ssd130x-i2c.c > b/drivers/gpu/drm/solomon/ssd130x-i2c.c > index 1e0fcec7be47..ddfa0bb5d9c9 100644 > --- a/drivers/gpu/drm/solomon/ssd130x-i2c.c > +++ b/drivers/gpu/drm/solomon/ssd130x-i2c.c > @@ -39,13 +39,11 @@ static int ssd130x_i2c_probe(struct i2c_client *client) > return 0; > } > > -static int ssd130x_i2c_remove(struct i2c_client *client) > +static void ssd130x_i2c_remove(struct i2c_client *client) > { > struct ssd130x_device *ssd130x = i2c_get_clientdata(client); > > ssd130x_remove(ssd130x); > - > - return 0; > } > > static void ssd130x_i2c_shutdown(struct i2c_client *client) Reviewed-by: Javier Martinez Canillas -- Best regards, Javier Martinez Canillas Linux Engineering Red Hat
Re: [PATCH v2] stack: Declare {randomize_,}kstack_offset to fix Sparse warnings
Le 29/06/2022 à 08:04, GONG, Ruiqi a écrit : > [Vous ne recevez pas souvent de courriers de gongrui...@huawei.com. Découvrez > pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] > > Fix the following Sparse warnings that got noticed when the PPC-dev > patchwork was checking another patch (see the link below): > > init/main.c:862:1: warning: symbol 'randomize_kstack_offset' was not > declared. Should it be static? > init/main.c:864:1: warning: symbol 'kstack_offset' was not declared. Should > it be static? > > Which in fact are triggered on all architectures that have > HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET support (for instances x86, arm64 > etc). > > Link: > https://lore.kernel.org/lkml/e7b0d68b-914d-7283-827c-101988923...@huawei.com/T/#m49b2d4490121445ce4bf7653500aba59eefcb67f > Cc: Christophe Leroy > Cc: Xiu Jianfeng > Signed-off-by: GONG, Ruiqi Reviewed-by: Christophe Leroy > --- > > v2: remove unnecessary #ifdef around the header > > init/main.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/init/main.c b/init/main.c > index e2490387db2b..eb9bf7c5b28b 100644 > --- a/init/main.c > +++ b/init/main.c > @@ -99,6 +99,7 @@ > #include > #include > #include > +#include > #include > > #include > -- > 2.25.1 >
Re: [PATCH 6/6] i2c: Make remove callback return void
Hello, [I dropped nearly all individuals from the Cc: list because various bounces reported to be unhappy about the long (logical) line.] On Wed, Jun 29, 2022 at 03:03:54PM +0800, Jeremy Kerr wrote: > Looks good - just one minor change for the mctp-i2c driver, but only > worthwhile if you end up re-rolling this series for other reasons: > > > -static int mctp_i2c_remove(struct i2c_client *client) > > +static void mctp_i2c_remove(struct i2c_client *client) > > { > > struct mctp_i2c_client *mcli = i2c_get_clientdata(client); > > struct mctp_i2c_dev *midev = NULL, *tmp = NULL; > > @@ -1000,7 +1000,6 @@ static int mctp_i2c_remove(struct i2c_client *client) > > mctp_i2c_free_client(mcli); > > mutex_unlock(&driver_clients_lock); > > /* Callers ignore return code */ > > - return 0; > > } > > The comment there no longer makes much sense, I'd suggest removing that > too. Yeah, that was already pointed out to me in a private reply. It's already fixed in https://git.pengutronix.de/cgit/ukl/linux/log/?h=i2c-remove-void > Either way: > > Reviewed-by: Jeremy Kerr Added to my tree, too. Thanks Uwe -- Pengutronix e.K. | Uwe Kleine-König| Industrial Linux Solutions | https://www.pengutronix.de/ | signature.asc Description: PGP signature
Re: [PATCH v3] powerpc/memhotplug: Add add_pages override for PPC
On 6/29/22 12:00 PM, Kefeng Wang wrote: > Hi, > > On 2022/6/29 13:09, Aneesh Kumar K.V wrote: >> With commit ffa0b64e3be5 ("powerpc: Fix virt_addr_valid() for 64-bit Book3E >> & 32-bit") >> the kernel now validate the addr against high_memory value. This results >> in the below BUG_ON with dax pfns. >> >> [ 635.798741][T26531] kernel BUG at mm/page_alloc.c:5521! >> 1:mon> e >> cpu 0x1: Vector: 700 (Program Check) at [c7287630] >> pc: c055ed48: free_pages.part.0+0x48/0x110 >> lr: c053ca70: tlb_finish_mmu+0x80/0xd0 >> sp: c72878d0 >> msr: 8282b033 >> current = 0xcafabe00 >> paca = 0xc0037300 irqmask: 0x03 irq_happened: 0x05 >> pid = 26531, comm = 50-landscape-sy >> kernel BUG at :5521! >> Linux version 5.19.0-rc3-14659-g4ec05be7c2e1 (kvaneesh@ltc-boston8) (gcc >> (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) >> 2.34) #625 SMP Thu Jun 23 00:35:43 CDT 2022 >> 1:mon> t >> [link register ] c053ca70 tlb_finish_mmu+0x80/0xd0 >> [c72878d0] c053ca54 tlb_finish_mmu+0x64/0xd0 (unreliable) >> [c7287900] c0539424 exit_mmap+0xe4/0x2a0 >> [c72879e0] c019fc1c mmput+0xcc/0x210 >> [c7287a20] c0629230 begin_new_exec+0x5e0/0xf40 >> [c7287ae0] c070b3cc load_elf_binary+0x3ac/0x1e00 >> [c7287c10] c0627af0 bprm_execve+0x3b0/0xaf0 >> [c7287cd0] c0628414 do_execveat_common.isra.0+0x1e4/0x310 >> [c7287d80] c062858c sys_execve+0x4c/0x60 >> [c7287db0] c002c1b0 system_call_exception+0x160/0x2c0 >> [c7287e10] c000c53c system_call_common+0xec/0x250 >> >> The fix is to make sure we update high_memory on memory hotplug. >> This is similar to what x86 does in commit 3072e413e305 ("mm/memory_hotplug: >> introduce add_pages") >> >> Fixes: ffa0b64e3be5 ("powerpc: Fix virt_addr_valid() for 64-bit Book3E & >> 32-bit") >> Cc: Kefeng Wang >> Cc: Christophe Leroy >> Signed-off-by: Aneesh Kumar K.V >> --- >> Changes from v2: >> * drop WARN_ON_ONCE >> * check for error from __add_pages >> >> arch/powerpc/Kconfig | 4 >> arch/powerpc/mm/mem.c | 33 - >> 2 files changed, 36 insertions(+), 1 deletion(-) >> >> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig >> index c2ce2e60c8f0..7aa12e88c580 100644 >> --- a/arch/powerpc/Kconfig >> +++ b/arch/powerpc/Kconfig >> @@ -358,6 +358,10 @@ config ARCH_SUSPEND_NONZERO_CPU >> def_bool y >> depends on PPC_POWERNV || PPC_PSERIES >> +config ARCH_HAS_ADD_PAGES >> + def_bool y >> + depends on ARCH_ENABLE_MEMORY_HOTPLUG >> + >> config PPC_DCR_NATIVE >> bool >> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c >> index 52b77684acda..a97128a48817 100644 >> --- a/arch/powerpc/mm/mem.c >> +++ b/arch/powerpc/mm/mem.c >> @@ -105,6 +105,37 @@ void __ref arch_remove_linear_mapping(u64 start, u64 >> size) >> vm_unmap_aliases(); >> } >> +/* >> + * After memory hotplug the variables max_pfn, max_low_pfn and high_memory >> need >> + * updating. >> + */ >> +static void update_end_of_memory_vars(u64 start, u64 size) >> +{ >> + unsigned long end_pfn = PFN_UP(start + size); >> + >> + if (end_pfn > max_pfn) { >> + max_pfn = end_pfn; >> + max_low_pfn = end_pfn; >> + high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1; >> + } >> +} >> + >> +int __ref add_pages(int nid, unsigned long start_pfn, unsigned long >> nr_pages, >> + struct mhp_params *params) >> +{ >> + int ret; > int ret = -EINVAL; >> + >> + ret = __add_pages(nid, start_pfn, nr_pages, params); >> + if (ret) >> + return ret; >> + considering we are updating ret immediately why should we initialize that to EINVAL? int ret = -EINVAL; ret = __add_pages(nid, start_pfn, nr_pages, params); >> + /* update max_pfn, max_low_pfn and high_memory */ >> + update_end_of_memory_vars(start_pfn << PAGE_SHIFT, >> + nr_pages << PAGE_SHIFT); >> + >> + return ret; >> +} >> + > and could we only call update_end_of_memory_vars() in arch_add_memory()? >> int __ref arch_add_memory(int nid, u64 start, u64 size, >> struct mhp_params *params) >> { >> @@ -115,7 +146,7 @@ int __ref arch_add_memory(int nid, u64 start, u64 size, >> rc = arch_create_linear_mapping(nid, start, size, params); >> if (rc) >> return rc; >> - rc = __add_pages(nid, start_pfn, nr_pages, params); >> + rc = add_pages(nid, start_pfn, nr_pages, params); >> if (rc) >> arch_remove_linear_mapping(start, size); > > if (!rc) > > update_end_of_memory_vars(start_pfn << PAGE_SHIFT, nr_pages << > PAGE_SHIFT); > > else > > arch_remove_linear_mapping(start, size); > > Thanks > commit 3072e413e305 goes into the details of why it is done in add_pag
Re: [PATCH] powerpc/xive/spapr: correct bitmap allocation size
On Thu, 23 Jun 2022 13:25:09 -0500, Nathan Lynch wrote: > kasan detects access beyond the end of the xibm->bitmap allocation: > > BUG: KASAN: slab-out-of-bounds in _find_first_zero_bit+0x40/0x140 > Read of size 8 at addr c0001d1d0118 by task swapper/0/1 > > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.19.0-rc2-1-g90df023b36dd #28 > Call Trace: > [c0001d98f770] [c12baab8] dump_stack_lvl+0xac/0x108 (unreliable) > [c0001d98f7b0] [c068faac] print_report+0x37c/0x710 > [c0001d98f880] [c06902c0] kasan_report+0x110/0x354 > [c0001d98f950] [c0692324] __asan_load8+0xa4/0xe0 > [c0001d98f970] [c11c6ed0] _find_first_zero_bit+0x40/0x140 > [c0001d98f9b0] [c00dbfbc] xive_spapr_get_ipi+0xcc/0x260 > [c0001d98fa70] [c00d6d28] xive_setup_cpu_ipi+0x1e8/0x450 > [c0001d98fb30] [c4032a20] pSeries_smp_probe+0x5c/0x118 > [c0001d98fb60] [c4018b44] smp_prepare_cpus+0x944/0x9ac > [c0001d98fc90] [c4009f9c] kernel_init_freeable+0x2d4/0x640 > [c0001d98fd90] [c00131e8] kernel_init+0x28/0x1d0 > [c0001d98fe10] [c000cd54] ret_from_kernel_thread+0x5c/0x64 > > [...] Applied to powerpc/fixes. [1/1] powerpc/xive/spapr: correct bitmap allocation size https://git.kernel.org/powerpc/c/19fc5bb93c6bbdce8292b4d7eed04e2fa118d2fe cheers
Re: [PATCH] powerpc/prom_init: Fix kernel config grep
On Fri, 24 Jun 2022 01:17:58 +, Liam Howlett wrote: > When searching for config options, use the KCONFIG shell variable so > that builds using non-standard config locations work. > > Applied to powerpc/fixes. [1/1] powerpc/prom_init: Fix kernel config grep https://git.kernel.org/powerpc/c/6886da5f49e6d86aad76807a93f3eef5e4f01b10 cheers
Re: [PATCH] powerpc/book3e: Fix PUD allocation size in map_kernel_page()
On Thu, 23 Jun 2022 10:56:17 +0200, Christophe Leroy wrote: > Commit 2fb4706057bc ("powerpc: add support for folded p4d page tables") > erroneously changed PUD setup to a mix of PMD and PUD. Fix it. > > While at it, use PTE_TABLE_SIZE instead of PAGE_SIZE for PTE tables > in order to avoid any confusion. > > > [...] Applied to powerpc/fixes. [1/1] powerpc/book3e: Fix PUD allocation size in map_kernel_page() https://git.kernel.org/powerpc/c/986481618023e18e187646b0fff05a3c337531cb cheers