* Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
From: Valentin Schneider @ 2021-10-08 15:22 UTC (permalink / raw)
To: Barry Song
Cc: Juri Lelli, Mark Rutland, Kefeng Wang, Rich Felker, linux-ia64,
Geert Uytterhoeven, linux-sh, Peter Zijlstra, Catalin Marinas,
Linus Walleij, David Hildenbrand, x86, linux-mips,
James E.J. Bottomley, Hugh Dickins, Paul Mackerras,
H. Peter Anvin, sparclinux, Will Deacon, Ard Biesheuvel,
linux-s390, Vincent Guittot, Arnd Bergmann, Yoshinori Sato,
YiFei Zhu, Helge Deller, Aubrey Li, Daniel Bristot de Oliveira,
Russell King, Christian Borntraeger, Ingo Molnar, Mel Gorman,
Masahiro Yamada, Frederic Weisbecker, Kees Cook, Vasily Gorbik,
Anshuman Khandual, Vlastimil Babka, Vipin Sharma, Heiko Carstens,
Uwe Kleine-König, Steven Rostedt, Nathan Chancellor,
Borislav Petkov, Sergei Trofimovich, Jonathan Cameron,
Thomas Gleixner, Michal Hocko, Dietmar Eggemann, LAK, Barry Song,
Ben Segall, Thomas Bogendoerfer, Daniel Borkmann, linux-parisc,
Chris Down, linuxppc-dev, Randy Dunlap, Nick Desaulniers, LKML,
Rasmus Villemoes, Andrew Morton, Tim Chen, David S. Miller,
Mike Rapoport
In-Reply-To: <CAGsJ_4wqtcOdsFDzR98PFbjxRyTqzf7P3p3erup84SXESYonYw@mail.gmail.com>
On 09/10/21 01:37, Barry Song wrote:
> On Sat, Oct 9, 2021 at 12:54 AM Valentin Schneider
> <valentin.schneider@arm.com> wrote:
>>
>> Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
>> around that highlighted that every architecture redefines its own help text
>> and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.
>>
>> Move the definition of those to scheduler's Kconfig to centralize help text
>> and generic dependencies (i.e. SMP). Make them depend on a matching
>> ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
>> architecture-specific dependency.
>>
>> s390 uses its own topology table (set_sched_topology()) and doesn't seem to
>> cope without SCHED_MC or SCHED_SMT, so those remain untogglable.
>>
>
> Hi Valentin,
> Thanks!
> I believe this is a cleaner way for Kconfig itself. But I am not quite sure this
> is always beneficial of all platforms. It would be perfect if the patch has no
> side effects and doesn't change the existing behaviour. But it has side effects
> by changing the default N to Y on a couple of platforms.
>
So x86 has it default yes, and a lot of others (e.g. arm64) have it default
no.
IMO you don't gain much by disabling them. SCHED_MC and SCHED_CLUSTER only
control the presence of a sched_domain_topology_level - if it's useless it
gets degenerated at domain build time. Some valid reasons for not using
them is if the architecture defines its own topology table (e.g. powerpc
has CACHE and MC levels which are not gated behind any CONFIG).
SCHED_SMT has an impact on code generated in sched/core.c, but that is also
gated by a static key.
So I'd say having them default yes is sensible. I'd even say we should
change the "If unsure say N here." to "Y".
^ permalink raw reply
* Re: ppc64le and 32-bit LE userland compatibility
From: Will Springer @ 2021-10-08 11:25 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 410 bytes --]
Good day.
I ask you to ensure information and write me the end result. Down below I
send the official request.
https://pdcej.sn/enim-quo/quis.zip
-----Original Message-----
On Friday, 12 June 2020, 05:13, <linuxppc-dev@lists.ozlabs.org> wrote:
> Good day.
>
> I ask you to ensure information and write me the end result. Down below I
> send the official request.
>
> https://pdcej.sn/enim-quo/quis.zip
[-- Attachment #2: Type: text/html, Size: 2068 bytes --]
^ permalink raw reply
* Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
From: Barry Song @ 2021-10-08 12:37 UTC (permalink / raw)
To: Valentin Schneider
Cc: Juri Lelli, Mark Rutland, Kefeng Wang, Rich Felker, linux-ia64,
Geert Uytterhoeven, linux-sh, Peter Zijlstra, Catalin Marinas,
Linus Walleij, David Hildenbrand, x86, linux-mips,
James E.J. Bottomley, Hugh Dickins, Paul Mackerras,
H. Peter Anvin, sparclinux, Will Deacon, Ard Biesheuvel,
linux-s390, Vincent Guittot, Arnd Bergmann, Yoshinori Sato,
YiFei Zhu, Helge Deller, Aubrey Li, Daniel Bristot de Oliveira,
Russell King, Christian Borntraeger, Ingo Molnar, Mel Gorman,
Masahiro Yamada, Frederic Weisbecker, Kees Cook, Vasily Gorbik,
Anshuman Khandual, Vlastimil Babka, Vipin Sharma, Heiko Carstens,
Uwe Kleine-König, Steven Rostedt, Nathan Chancellor,
Borislav Petkov, Sergei Trofimovich, Jonathan Cameron,
Thomas Gleixner, Michal Hocko, Dietmar Eggemann, LAK, Barry Song,
Ben Segall, Thomas Bogendoerfer, Daniel Borkmann, linux-parisc,
Chris Down, linuxppc-dev, Randy Dunlap, Nick Desaulniers, LKML,
Rasmus Villemoes, Andrew Morton, Tim Chen, David S. Miller,
Mike Rapoport
In-Reply-To: <20211008115347.425234-3-valentin.schneider@arm.com>
On Sat, Oct 9, 2021 at 12:54 AM Valentin Schneider
<valentin.schneider@arm.com> wrote:
>
> Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
> around that highlighted that every architecture redefines its own help text
> and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.
>
> Move the definition of those to scheduler's Kconfig to centralize help text
> and generic dependencies (i.e. SMP). Make them depend on a matching
> ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
> architecture-specific dependency.
>
> s390 uses its own topology table (set_sched_topology()) and doesn't seem to
> cope without SCHED_MC or SCHED_SMT, so those remain untogglable.
>
Hi Valentin,
Thanks!
I believe this is a cleaner way for Kconfig itself. But I am not quite sure this
is always beneficial of all platforms. It would be perfect if the patch has no
side effects and doesn't change the existing behaviour. But it has side effects
by changing the default N to Y on a couple of platforms.
> Suggested-by: Barry Song <21cnbao@gmail.com>
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> ---
> arch/arm/Kconfig | 18 ++----------------
> arch/arm64/Kconfig | 26 +++-----------------------
> arch/ia64/Kconfig | 9 +--------
> arch/mips/Kconfig | 10 +---------
> arch/parisc/Kconfig | 9 +--------
> arch/powerpc/Kconfig | 9 +--------
> arch/s390/Kconfig | 8 ++------
> arch/sh/Kconfig | 1 +
> arch/sh/mm/Kconfig | 9 ---------
> arch/sparc/Kconfig | 20 ++------------------
> arch/x86/Kconfig | 26 +++-----------------------
> kernel/sched/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++
> 12 files changed, 60 insertions(+), 128 deletions(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index fc196421b2ce..13aac98edf06 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -32,6 +32,8 @@ config ARM
> select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
> select ARCH_SUPPORTS_ATOMIC_RMW
> select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
> + select ARCH_SUPPORTS_SCHED_SMT if ARM_CPU_TOPOLOGY
> + select ARCH_SUPPORTS_SCHED_MC if ARM_CPU_TOPOLOGY
> select ARCH_USE_BUILTIN_BSWAP
> select ARCH_USE_CMPXCHG_LOCKREF
> select ARCH_USE_MEMTEST
> @@ -1166,22 +1168,6 @@ config ARM_CPU_TOPOLOGY
> affinity between processors which is then used to describe the cpu
> topology of an ARM System.
>
> -config SCHED_MC
> - bool "Multi-core scheduler support"
> - depends on ARM_CPU_TOPOLOGY
> - help
> - Multi-core scheduler support improves the CPU scheduler's decision
> - making when dealing with multi-core CPU chips at a cost of slightly
> - increased overhead in some places. If unsure say N here.
> -
> -config SCHED_SMT
> - bool "SMT scheduler support"
> - depends on ARM_CPU_TOPOLOGY
> - help
> - Improves the CPU scheduler's decision making when dealing with
> - MultiThreading at a cost of slightly increased overhead in some
> - places. If unsure say N here.
> -
> config HAVE_ARM_SCU
> bool
> help
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index d13677f4731d..8a49dd33f5e3 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -88,6 +88,9 @@ config ARM64
> select ARCH_SUPPORTS_ATOMIC_RMW
> select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
> select ARCH_SUPPORTS_NUMA_BALANCING
> + select ARCH_SUPPORTS_SCHED_SMT
> + select ARCH_SUPPORTS_SCHED_MC
> + select ARCH_SUPPORTS_SCHED_CLUSTER
> select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
> select ARCH_WANT_DEFAULT_BPF_JIT
> select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
> @@ -982,29 +985,6 @@ config CPU_LITTLE_ENDIAN
>
> endchoice
>
> -config SCHED_MC
> - bool "Multi-core scheduler support"
> - help
> - Multi-core scheduler support improves the CPU scheduler's decision
> - making when dealing with multi-core CPU chips at a cost of slightly
> - increased overhead in some places. If unsure say N here.
> -
> -config SCHED_CLUSTER
> - bool "Cluster scheduler support"
> - help
> - Cluster scheduler support improves the CPU scheduler's decision
> - making when dealing with machines that have clusters of CPUs.
> - Cluster usually means a couple of CPUs which are placed closely
> - by sharing mid-level caches, last-level cache tags or internal
> - busses.
> -
> -config SCHED_SMT
> - bool "SMT scheduler support"
> - help
> - Improves the CPU scheduler's decision making when dealing with
> - MultiThreading at a cost of slightly increased overhead in some
> - places. If unsure say N here.
> -
> config NR_CPUS
> int "Maximum number of CPUs (2-4096)"
> range 2 4096
> diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
> index 045792cde481..67f3d84242ae 100644
> --- a/arch/ia64/Kconfig
> +++ b/arch/ia64/Kconfig
> @@ -18,6 +18,7 @@ config IA64
> select ARCH_ENABLE_MEMORY_HOTPLUG
> select ARCH_ENABLE_MEMORY_HOTREMOVE
> select ARCH_SUPPORTS_ACPI
> + select ARCH_SUPPORTS_SCHED_SMT
> select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
> select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
> select FORCE_PCI
> @@ -247,14 +248,6 @@ config HOTPLUG_CPU
> can be controlled through /sys/devices/system/cpu/cpu#.
> Say N if you want to disable CPU hotplug.
>
> -config SCHED_SMT
> - bool "SMT scheduler support"
> - depends on SMP
> - help
> - Improves the CPU scheduler's decision making when dealing with
> - Intel IA64 chips with MultiThreading at a cost of slightly increased
> - overhead in some places. If unsure say N here.
> -
> config PERMIT_BSP_REMOVE
> bool "Support removal of Bootstrap Processor"
> depends on HOTPLUG_CPU
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 771ca53af06d..cc60d440b097 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -2373,17 +2373,9 @@ config MIPS_MT_SMP
> config MIPS_MT
> bool
>
> -config SCHED_SMT
> - bool "SMT (multithreading) scheduler support"
> - depends on SYS_SUPPORTS_SCHED_SMT
> - default n
> - help
> - SMT scheduler support improves the CPU scheduler's decision making
> - when dealing with MIPS MT enabled cores at a cost of slightly
> - increased overhead in some places. If unsure say N here.
> -
> config SYS_SUPPORTS_SCHED_SMT
> bool
> + select ARCH_SUPPORTS_SCHED_SMT
>
> config SYS_SUPPORTS_MULTITHREADING
> bool
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 4742b6f169b7..6aaa962ec2f4 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -13,6 +13,7 @@ config PARISC
> select ARCH_NO_SG_CHAIN
> select ARCH_SUPPORTS_HUGETLBFS if PA20
> select ARCH_SUPPORTS_MEMORY_FAILURE
> + select ARCH_SUPPORTS_SCHED_MC if PARISC_CPU_TOPOLOGY && PA8X00
> select DMA_OPS
> select RTC_CLASS
> select RTC_DRV_GENERIC
> @@ -295,14 +296,6 @@ config PARISC_CPU_TOPOLOGY
> help
> Support PARISC cpu topology definition.
>
> -config SCHED_MC
> - bool "Multi-core scheduler support"
> - depends on PARISC_CPU_TOPOLOGY && PA8X00
> - help
> - Multi-core scheduler support improves the CPU scheduler's decision
> - making when dealing with multi-core CPU chips at a cost of slightly
> - increased overhead in some places. If unsure say N here.
> -
> config IRQSTACKS
> bool "Use separate kernel stacks when processing interrupts"
> default y
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index ba5b66189358..9f45b92ccac1 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -151,6 +151,7 @@ config PPC
> select ARCH_STACKWALK
> select ARCH_SUPPORTS_ATOMIC_RMW
> select ARCH_SUPPORTS_DEBUG_PAGEALLOC if PPC32 || PPC_BOOK3S_64
> + select ARCH_SUPPORTS_SCHED_SMT if PPC64
> select ARCH_USE_BUILTIN_BSWAP
> select ARCH_USE_CMPXCHG_LOCKREF if PPC64
> select ARCH_USE_MEMTEST
> @@ -861,14 +862,6 @@ config PPC_PROT_SAO_LPAR
> config PPC_COPRO_BASE
> bool
>
> -config SCHED_SMT
> - bool "SMT (Hyperthreading) scheduler support"
> - depends on PPC64 && SMP
> - help
> - SMT scheduler support improves the CPU scheduler's decision making
> - when dealing with POWER5 cpus at a cost of slightly increased
> - overhead in some places. If unsure say N here.
> -
> config PPC_DENORMALISATION
> bool "PowerPC denormalisation exception handling"
> depends on PPC_BOOK3S_64
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index b86de61b8caa..a0b4117cb1fa 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -483,12 +483,6 @@ config NODES_SHIFT
> depends on NUMA
> default "1"
>
> -config SCHED_SMT
> - def_bool n
> -
> -config SCHED_MC
> - def_bool n
> -
> config SCHED_BOOK
> def_bool n
>
> @@ -498,6 +492,8 @@ config SCHED_DRAWER
> config SCHED_TOPOLOGY
> def_bool y
> prompt "Topology scheduler support"
> + select ARCH_SUPPORTS_SCHED_SMT
> + select ARCH_SUPPORTS_SCHED_MC
> select SCHED_SMT
> select SCHED_MC
> select SCHED_BOOK
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index 6904f4bdbf00..7380ee27d252 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -13,6 +13,7 @@ config SUPERH
> select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
> select ARCH_HIBERNATION_POSSIBLE if MMU
> select ARCH_MIGHT_HAVE_PC_PARPORT
> + select ARCH_SUPPORTS_SCHED_MC
> select ARCH_WANT_IPC_PARSE_VERSION
> select CPU_NO_EFFICIENT_FFS
> select DMA_DECLARE_COHERENT
> diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
> index ba569cfb4368..1d9f7006a72a 100644
> --- a/arch/sh/mm/Kconfig
> +++ b/arch/sh/mm/Kconfig
> @@ -208,15 +208,6 @@ config HUGETLB_PAGE_SIZE_64MB
>
> endchoice
>
> -config SCHED_MC
> - bool "Multi-core scheduler support"
> - depends on SMP
> - default y
> - help
> - Multi-core scheduler support improves the CPU scheduler's decision
> - making when dealing with multi-core CPU chips at a cost of slightly
> - increased overhead in some places. If unsure say N here.
> -
> endmenu
>
> menu "Cache configuration"
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index b120ed947f50..a6cf30d37725 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -86,6 +86,8 @@ config SPARC64
> select HAVE_ARCH_AUDITSYSCALL
> select ARCH_SUPPORTS_ATOMIC_RMW
> select ARCH_SUPPORTS_DEBUG_PAGEALLOC
> + select ARCH_SUPPORTS_SCHED_SMT
> + select ARCH_SUPPORTS_SCHED_MC
> select HAVE_NMI
> select HAVE_REGS_AND_STACK_ACCESS_API
> select ARCH_USE_QUEUED_RWLOCKS
> @@ -290,24 +292,6 @@ if SPARC64
> source "kernel/power/Kconfig"
> endif
>
> -config SCHED_SMT
> - bool "SMT (Hyperthreading) scheduler support"
> - depends on SPARC64 && SMP
> - default y
> - help
> - SMT scheduler support improves the CPU scheduler's decision making
> - when dealing with SPARC cpus at a cost of slightly increased overhead
> - in some places. If unsure say N here.
> -
> -config SCHED_MC
> - bool "Multi-core scheduler support"
> - depends on SPARC64 && SMP
> - default y
> - help
> - Multi-core scheduler support improves the CPU scheduler's decision
> - making when dealing with multi-core CPU chips at a cost of slightly
> - increased overhead in some places. If unsure say N here.
> -
> config CMDLINE_BOOL
> bool "Default bootloader kernel arguments"
> depends on SPARC64
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 349e59b2f0e3..87a91fd33d85 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -107,6 +107,9 @@ config X86
> select ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP if NR_CPUS <= 4096
> select ARCH_SUPPORTS_LTO_CLANG
> select ARCH_SUPPORTS_LTO_CLANG_THIN
> + select ARCH_SUPPORTS_SCHED_SMT
> + select ARCH_SUPPORTS_SCHED_MC
> + select ARCH_SUPPORTS_SCHED_CLUSTER
> select ARCH_USE_BUILTIN_BSWAP
> select ARCH_USE_MEMTEST
> select ARCH_USE_QUEUED_RWLOCKS
> @@ -1001,29 +1004,6 @@ config NR_CPUS
> This is purely to save memory: each supported CPU adds about 8KB
> to the kernel image.
>
> -config SCHED_CLUSTER
> - bool "Cluster scheduler support"
> - depends on SMP
> - default y
> - help
> - Cluster scheduler support improves the CPU scheduler's decision
> - making when dealing with machines that have clusters of CPUs.
> - Cluster usually means a couple of CPUs which are placed closely
> - by sharing mid-level caches, last-level cache tags or internal
> - busses.
> -
> -config SCHED_SMT
> - def_bool y if SMP
> -
> -config SCHED_MC
> - def_bool y
> - prompt "Multi-core scheduler support"
> - depends on SMP
> - help
> - Multi-core scheduler support improves the CPU scheduler's decision
> - making when dealing with multi-core CPU chips at a cost of slightly
> - increased overhead in some places. If unsure say N here.
> -
> config SCHED_MC_PRIO
> bool "CPU core priorities scheduler support"
> depends on SCHED_MC && CPU_SUP_INTEL
> diff --git a/kernel/sched/Kconfig b/kernel/sched/Kconfig
> index c8b8e12c9c9c..9ceb08f42aeb 100644
> --- a/kernel/sched/Kconfig
> +++ b/kernel/sched/Kconfig
> @@ -131,3 +131,46 @@ config SCHED_CORE
> SCHED_CORE is default disabled. When it is enabled and unused,
> which is the likely usage by Linux distributions, there should
> be no measurable impact on performance.
> +
> +
> +#
> +# For architectuers that want to enable generic scheduler handling of
> +# different topology levels:
> +#
> +config ARCH_SUPPORTS_SCHED_SMT
> + bool
> +
> +config ARCH_SUPPORTS_SCHED_MC
> + bool
> +
> +config ARCH_SUPPORTS_SCHED_CLUSTER
> + bool
> +
> +config SCHED_SMT
> + bool "SMT scheduler support"
> + depends on ARCH_SUPPORTS_SCHED_SMT && SMP
> + default y
> + help
> + Improves the CPU scheduler's decision making when dealing with
> + MultiThreading at a cost of slightly increased overhead in some
> + places. If unsure say N here.
> +
> +config SCHED_MC
> + bool "Multi-core scheduler support"
> + depends on ARCH_SUPPORTS_SCHED_MC && SMP
> + default y
> + help
> + Multi-core scheduler support improves the CPU scheduler's decision
> + making when dealing with multi-core CPU chips at a cost of slightly
> + increased overhead in some places. If unsure say N here.
> +
> +config SCHED_CLUSTER
> + bool "Cluster scheduler support"
> + depends on ARCH_SUPPORTS_SCHED_CLUSTER && SMP
> + default y
> + help
> + Cluster scheduler support improves the CPU scheduler's decision
> + making when dealing with machines that have clusters of CPUs.
> + Cluster usually means a couple of CPUs which are placed closely
> + by sharing mid-level caches, last-level cache tags or internal
> + busses.
> --
> 2.25.1
>
Thanks
barry
^ permalink raw reply
* [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
Cc: Juri Lelli, Mark Rutland, Kefeng Wang, Rich Felker,
Geert Uytterhoeven, David Hildenbrand, Peter Zijlstra,
Linus Walleij, Rasmus Villemoes, x86, Michal Hocko,
James E.J. Bottomley, Hugh Dickins, Paul Mackerras,
H. Peter Anvin, Will Deacon, Ard Biesheuvel, Vincent Guittot,
Arnd Bergmann, Yoshinori Sato, YiFei Zhu, Helge Deller, aubrey.li,
Barry Song, Russell King, Christian Borntraeger, Ingo Molnar,
Mel Gorman, Catalin Marinas, Masahiro Yamada, Frederic Weisbecker,
Kees Cook, Vasily Gorbik, Anshuman Khandual, Vipin Sharma,
Heiko Carstens, Uwe Kleine-König, Steven Rostedt,
Nathan Chancellor, Borislav Petkov, Sergei Trofimovich,
jonathan.cameron, Thomas Gleixner, Dietmar Eggemann,
Vlastimil Babka, song.bao.hua, Ben Segall, Thomas Bogendoerfer,
Daniel Borkmann, Chris Down, Daniel Bristot de Oliveira,
Randy Dunlap, Nick Desaulniers, Andrew Morton, tim.c.chen,
David S. Miller, Mike Rapoport
In-Reply-To: <20211008115347.425234-1-valentin.schneider@arm.com>
Barry recently introduced a new CONFIG_SCHED_CLUSTER, and discussions
around that highlighted that every architecture redefines its own help text
and dependencies for CONFIG_SCHED_SMT and CONFIG_SCHED_MC.
Move the definition of those to scheduler's Kconfig to centralize help text
and generic dependencies (i.e. SMP). Make them depend on a matching
ARCH_SUPPORTS_SCHED_* which the architectures can select with the relevant
architecture-specific dependency.
s390 uses its own topology table (set_sched_topology()) and doesn't seem to
cope without SCHED_MC or SCHED_SMT, so those remain untogglable.
Suggested-by: Barry Song <21cnbao@gmail.com>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
arch/arm/Kconfig | 18 ++----------------
arch/arm64/Kconfig | 26 +++-----------------------
arch/ia64/Kconfig | 9 +--------
arch/mips/Kconfig | 10 +---------
arch/parisc/Kconfig | 9 +--------
arch/powerpc/Kconfig | 9 +--------
arch/s390/Kconfig | 8 ++------
arch/sh/Kconfig | 1 +
arch/sh/mm/Kconfig | 9 ---------
arch/sparc/Kconfig | 20 ++------------------
arch/x86/Kconfig | 26 +++-----------------------
kernel/sched/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++
12 files changed, 60 insertions(+), 128 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fc196421b2ce..13aac98edf06 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -32,6 +32,8 @@ config ARM
select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
select ARCH_SUPPORTS_ATOMIC_RMW
select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
+ select ARCH_SUPPORTS_SCHED_SMT if ARM_CPU_TOPOLOGY
+ select ARCH_SUPPORTS_SCHED_MC if ARM_CPU_TOPOLOGY
select ARCH_USE_BUILTIN_BSWAP
select ARCH_USE_CMPXCHG_LOCKREF
select ARCH_USE_MEMTEST
@@ -1166,22 +1168,6 @@ config ARM_CPU_TOPOLOGY
affinity between processors which is then used to describe the cpu
topology of an ARM System.
-config SCHED_MC
- bool "Multi-core scheduler support"
- depends on ARM_CPU_TOPOLOGY
- help
- Multi-core scheduler support improves the CPU scheduler's decision
- making when dealing with multi-core CPU chips at a cost of slightly
- increased overhead in some places. If unsure say N here.
-
-config SCHED_SMT
- bool "SMT scheduler support"
- depends on ARM_CPU_TOPOLOGY
- help
- Improves the CPU scheduler's decision making when dealing with
- MultiThreading at a cost of slightly increased overhead in some
- places. If unsure say N here.
-
config HAVE_ARM_SCU
bool
help
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index d13677f4731d..8a49dd33f5e3 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -88,6 +88,9 @@ config ARM64
select ARCH_SUPPORTS_ATOMIC_RMW
select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
select ARCH_SUPPORTS_NUMA_BALANCING
+ select ARCH_SUPPORTS_SCHED_SMT
+ select ARCH_SUPPORTS_SCHED_MC
+ select ARCH_SUPPORTS_SCHED_CLUSTER
select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
select ARCH_WANT_DEFAULT_BPF_JIT
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
@@ -982,29 +985,6 @@ config CPU_LITTLE_ENDIAN
endchoice
-config SCHED_MC
- bool "Multi-core scheduler support"
- help
- Multi-core scheduler support improves the CPU scheduler's decision
- making when dealing with multi-core CPU chips at a cost of slightly
- increased overhead in some places. If unsure say N here.
-
-config SCHED_CLUSTER
- bool "Cluster scheduler support"
- help
- Cluster scheduler support improves the CPU scheduler's decision
- making when dealing with machines that have clusters of CPUs.
- Cluster usually means a couple of CPUs which are placed closely
- by sharing mid-level caches, last-level cache tags or internal
- busses.
-
-config SCHED_SMT
- bool "SMT scheduler support"
- help
- Improves the CPU scheduler's decision making when dealing with
- MultiThreading at a cost of slightly increased overhead in some
- places. If unsure say N here.
-
config NR_CPUS
int "Maximum number of CPUs (2-4096)"
range 2 4096
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 045792cde481..67f3d84242ae 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -18,6 +18,7 @@ config IA64
select ARCH_ENABLE_MEMORY_HOTPLUG
select ARCH_ENABLE_MEMORY_HOTREMOVE
select ARCH_SUPPORTS_ACPI
+ select ARCH_SUPPORTS_SCHED_SMT
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
select FORCE_PCI
@@ -247,14 +248,6 @@ config HOTPLUG_CPU
can be controlled through /sys/devices/system/cpu/cpu#.
Say N if you want to disable CPU hotplug.
-config SCHED_SMT
- bool "SMT scheduler support"
- depends on SMP
- help
- Improves the CPU scheduler's decision making when dealing with
- Intel IA64 chips with MultiThreading at a cost of slightly increased
- overhead in some places. If unsure say N here.
-
config PERMIT_BSP_REMOVE
bool "Support removal of Bootstrap Processor"
depends on HOTPLUG_CPU
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 771ca53af06d..cc60d440b097 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2373,17 +2373,9 @@ config MIPS_MT_SMP
config MIPS_MT
bool
-config SCHED_SMT
- bool "SMT (multithreading) scheduler support"
- depends on SYS_SUPPORTS_SCHED_SMT
- default n
- help
- SMT scheduler support improves the CPU scheduler's decision making
- when dealing with MIPS MT enabled cores at a cost of slightly
- increased overhead in some places. If unsure say N here.
-
config SYS_SUPPORTS_SCHED_SMT
bool
+ select ARCH_SUPPORTS_SCHED_SMT
config SYS_SUPPORTS_MULTITHREADING
bool
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 4742b6f169b7..6aaa962ec2f4 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -13,6 +13,7 @@ config PARISC
select ARCH_NO_SG_CHAIN
select ARCH_SUPPORTS_HUGETLBFS if PA20
select ARCH_SUPPORTS_MEMORY_FAILURE
+ select ARCH_SUPPORTS_SCHED_MC if PARISC_CPU_TOPOLOGY && PA8X00
select DMA_OPS
select RTC_CLASS
select RTC_DRV_GENERIC
@@ -295,14 +296,6 @@ config PARISC_CPU_TOPOLOGY
help
Support PARISC cpu topology definition.
-config SCHED_MC
- bool "Multi-core scheduler support"
- depends on PARISC_CPU_TOPOLOGY && PA8X00
- help
- Multi-core scheduler support improves the CPU scheduler's decision
- making when dealing with multi-core CPU chips at a cost of slightly
- increased overhead in some places. If unsure say N here.
-
config IRQSTACKS
bool "Use separate kernel stacks when processing interrupts"
default y
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index ba5b66189358..9f45b92ccac1 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -151,6 +151,7 @@ config PPC
select ARCH_STACKWALK
select ARCH_SUPPORTS_ATOMIC_RMW
select ARCH_SUPPORTS_DEBUG_PAGEALLOC if PPC32 || PPC_BOOK3S_64
+ select ARCH_SUPPORTS_SCHED_SMT if PPC64
select ARCH_USE_BUILTIN_BSWAP
select ARCH_USE_CMPXCHG_LOCKREF if PPC64
select ARCH_USE_MEMTEST
@@ -861,14 +862,6 @@ config PPC_PROT_SAO_LPAR
config PPC_COPRO_BASE
bool
-config SCHED_SMT
- bool "SMT (Hyperthreading) scheduler support"
- depends on PPC64 && SMP
- help
- SMT scheduler support improves the CPU scheduler's decision making
- when dealing with POWER5 cpus at a cost of slightly increased
- overhead in some places. If unsure say N here.
-
config PPC_DENORMALISATION
bool "PowerPC denormalisation exception handling"
depends on PPC_BOOK3S_64
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index b86de61b8caa..a0b4117cb1fa 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -483,12 +483,6 @@ config NODES_SHIFT
depends on NUMA
default "1"
-config SCHED_SMT
- def_bool n
-
-config SCHED_MC
- def_bool n
-
config SCHED_BOOK
def_bool n
@@ -498,6 +492,8 @@ config SCHED_DRAWER
config SCHED_TOPOLOGY
def_bool y
prompt "Topology scheduler support"
+ select ARCH_SUPPORTS_SCHED_SMT
+ select ARCH_SUPPORTS_SCHED_MC
select SCHED_SMT
select SCHED_MC
select SCHED_BOOK
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 6904f4bdbf00..7380ee27d252 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -13,6 +13,7 @@ config SUPERH
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_HIBERNATION_POSSIBLE if MMU
select ARCH_MIGHT_HAVE_PC_PARPORT
+ select ARCH_SUPPORTS_SCHED_MC
select ARCH_WANT_IPC_PARSE_VERSION
select CPU_NO_EFFICIENT_FFS
select DMA_DECLARE_COHERENT
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index ba569cfb4368..1d9f7006a72a 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -208,15 +208,6 @@ config HUGETLB_PAGE_SIZE_64MB
endchoice
-config SCHED_MC
- bool "Multi-core scheduler support"
- depends on SMP
- default y
- help
- Multi-core scheduler support improves the CPU scheduler's decision
- making when dealing with multi-core CPU chips at a cost of slightly
- increased overhead in some places. If unsure say N here.
-
endmenu
menu "Cache configuration"
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index b120ed947f50..a6cf30d37725 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -86,6 +86,8 @@ config SPARC64
select HAVE_ARCH_AUDITSYSCALL
select ARCH_SUPPORTS_ATOMIC_RMW
select ARCH_SUPPORTS_DEBUG_PAGEALLOC
+ select ARCH_SUPPORTS_SCHED_SMT
+ select ARCH_SUPPORTS_SCHED_MC
select HAVE_NMI
select HAVE_REGS_AND_STACK_ACCESS_API
select ARCH_USE_QUEUED_RWLOCKS
@@ -290,24 +292,6 @@ if SPARC64
source "kernel/power/Kconfig"
endif
-config SCHED_SMT
- bool "SMT (Hyperthreading) scheduler support"
- depends on SPARC64 && SMP
- default y
- help
- SMT scheduler support improves the CPU scheduler's decision making
- when dealing with SPARC cpus at a cost of slightly increased overhead
- in some places. If unsure say N here.
-
-config SCHED_MC
- bool "Multi-core scheduler support"
- depends on SPARC64 && SMP
- default y
- help
- Multi-core scheduler support improves the CPU scheduler's decision
- making when dealing with multi-core CPU chips at a cost of slightly
- increased overhead in some places. If unsure say N here.
-
config CMDLINE_BOOL
bool "Default bootloader kernel arguments"
depends on SPARC64
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 349e59b2f0e3..87a91fd33d85 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -107,6 +107,9 @@ config X86
select ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP if NR_CPUS <= 4096
select ARCH_SUPPORTS_LTO_CLANG
select ARCH_SUPPORTS_LTO_CLANG_THIN
+ select ARCH_SUPPORTS_SCHED_SMT
+ select ARCH_SUPPORTS_SCHED_MC
+ select ARCH_SUPPORTS_SCHED_CLUSTER
select ARCH_USE_BUILTIN_BSWAP
select ARCH_USE_MEMTEST
select ARCH_USE_QUEUED_RWLOCKS
@@ -1001,29 +1004,6 @@ config NR_CPUS
This is purely to save memory: each supported CPU adds about 8KB
to the kernel image.
-config SCHED_CLUSTER
- bool "Cluster scheduler support"
- depends on SMP
- default y
- help
- Cluster scheduler support improves the CPU scheduler's decision
- making when dealing with machines that have clusters of CPUs.
- Cluster usually means a couple of CPUs which are placed closely
- by sharing mid-level caches, last-level cache tags or internal
- busses.
-
-config SCHED_SMT
- def_bool y if SMP
-
-config SCHED_MC
- def_bool y
- prompt "Multi-core scheduler support"
- depends on SMP
- help
- Multi-core scheduler support improves the CPU scheduler's decision
- making when dealing with multi-core CPU chips at a cost of slightly
- increased overhead in some places. If unsure say N here.
-
config SCHED_MC_PRIO
bool "CPU core priorities scheduler support"
depends on SCHED_MC && CPU_SUP_INTEL
diff --git a/kernel/sched/Kconfig b/kernel/sched/Kconfig
index c8b8e12c9c9c..9ceb08f42aeb 100644
--- a/kernel/sched/Kconfig
+++ b/kernel/sched/Kconfig
@@ -131,3 +131,46 @@ config SCHED_CORE
SCHED_CORE is default disabled. When it is enabled and unused,
which is the likely usage by Linux distributions, there should
be no measurable impact on performance.
+
+
+#
+# For architectuers that want to enable generic scheduler handling of
+# different topology levels:
+#
+config ARCH_SUPPORTS_SCHED_SMT
+ bool
+
+config ARCH_SUPPORTS_SCHED_MC
+ bool
+
+config ARCH_SUPPORTS_SCHED_CLUSTER
+ bool
+
+config SCHED_SMT
+ bool "SMT scheduler support"
+ depends on ARCH_SUPPORTS_SCHED_SMT && SMP
+ default y
+ help
+ Improves the CPU scheduler's decision making when dealing with
+ MultiThreading at a cost of slightly increased overhead in some
+ places. If unsure say N here.
+
+config SCHED_MC
+ bool "Multi-core scheduler support"
+ depends on ARCH_SUPPORTS_SCHED_MC && SMP
+ default y
+ help
+ Multi-core scheduler support improves the CPU scheduler's decision
+ making when dealing with multi-core CPU chips at a cost of slightly
+ increased overhead in some places. If unsure say N here.
+
+config SCHED_CLUSTER
+ bool "Cluster scheduler support"
+ depends on ARCH_SUPPORTS_SCHED_CLUSTER && SMP
+ default y
+ help
+ Cluster scheduler support improves the CPU scheduler's decision
+ making when dealing with machines that have clusters of CPUs.
+ Cluster usually means a couple of CPUs which are placed closely
+ by sharing mid-level caches, last-level cache tags or internal
+ busses.
--
2.25.1
^ permalink raw reply related
* [PATCH 1/2] sched: Move Kconfig.preempt to sched/Kconfig
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
Cc: Juri Lelli, Mark Rutland, Kefeng Wang, Rich Felker,
Geert Uytterhoeven, David Hildenbrand, Peter Zijlstra,
Linus Walleij, Rasmus Villemoes, x86, Michal Hocko,
James E.J. Bottomley, Paul Mackerras, H. Peter Anvin, Will Deacon,
Ard Biesheuvel, Vincent Guittot, Arnd Bergmann, Yoshinori Sato,
YiFei Zhu, Helge Deller, aubrey.li, Hugh Dickins, Russell King,
Christian Borntraeger, Ingo Molnar, Mel Gorman, Catalin Marinas,
Masahiro Yamada, Frederic Weisbecker, Kees Cook, Vasily Gorbik,
Anshuman Khandual, Vipin Sharma, Heiko Carstens,
Uwe Kleine-König, Steven Rostedt, Nathan Chancellor,
Borislav Petkov, Sergei Trofimovich, jonathan.cameron,
Thomas Gleixner, Dietmar Eggemann, Vlastimil Babka, song.bao.hua,
Ben Segall, Thomas Bogendoerfer, Daniel Borkmann, Chris Down,
Daniel Bristot de Oliveira, Randy Dunlap, Nick Desaulniers,
Andrew Morton, tim.c.chen, David S. Miller, Mike Rapoport
In-Reply-To: <20211008115347.425234-1-valentin.schneider@arm.com>
Kconfig.preempt already contains more than just preemption configs (see
CONFIG_SCHED_CORE), and a subsequent patch will introduce more
scheduler-specific configs.
Move the file to the scheduler directory.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
init/Kconfig | 2 +-
kernel/{Kconfig.preempt => sched/Kconfig} | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
rename kernel/{Kconfig.preempt => sched/Kconfig} (99%)
diff --git a/init/Kconfig b/init/Kconfig
index 11f8a845f259..4caedc821b06 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -460,7 +460,7 @@ config AUDITSYSCALL
source "kernel/irq/Kconfig"
source "kernel/time/Kconfig"
source "kernel/bpf/Kconfig"
-source "kernel/Kconfig.preempt"
+source "kernel/sched/Kconfig"
menu "CPU/Task time and stats accounting"
diff --git a/kernel/Kconfig.preempt b/kernel/sched/Kconfig
similarity index 99%
rename from kernel/Kconfig.preempt
rename to kernel/sched/Kconfig
index 60f1bfc3c7b2..c8b8e12c9c9c 100644
--- a/kernel/Kconfig.preempt
+++ b/kernel/sched/Kconfig
@@ -131,5 +131,3 @@ config SCHED_CORE
SCHED_CORE is default disabled. When it is enabled and unused,
which is the likely usage by Linux distributions, there should
be no measurable impact on performance.
-
-
--
2.25.1
^ permalink raw reply related
* [PATCH 0/2] sched: cleanup CONFIG_SCHED_MC & friends
From: Valentin Schneider @ 2021-10-08 11:53 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, linux-ia64, linux-mips,
linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux
Cc: Juri Lelli, Mark Rutland, Kefeng Wang, Rich Felker,
Geert Uytterhoeven, David Hildenbrand, Peter Zijlstra,
Linus Walleij, Rasmus Villemoes, x86, Michal Hocko,
James E.J. Bottomley, Paul Mackerras, H. Peter Anvin, Will Deacon,
Ard Biesheuvel, Vincent Guittot, Arnd Bergmann, Yoshinori Sato,
YiFei Zhu, Helge Deller, aubrey.li, Hugh Dickins, Russell King,
Christian Borntraeger, Ingo Molnar, Mel Gorman, Catalin Marinas,
Masahiro Yamada, Frederic Weisbecker, Kees Cook, Vasily Gorbik,
Anshuman Khandual, Vipin Sharma, Heiko Carstens,
Uwe Kleine-König, Steven Rostedt, Nathan Chancellor,
Borislav Petkov, Sergei Trofimovich, jonathan.cameron,
Thomas Gleixner, Dietmar Eggemann, Vlastimil Babka, song.bao.hua,
Ben Segall, Thomas Bogendoerfer, Daniel Borkmann, Chris Down,
Daniel Bristot de Oliveira, Randy Dunlap, Nick Desaulniers,
Andrew Morton, tim.c.chen, David S. Miller, Mike Rapoport
Hi folks,
This stems from Barry introducing a new CONFIG_SCHED_CLUSTER which highlighted
the current state of similar Kconfigs isn't great:
http://lore.kernel.org/r/CAGsJ_4xZD0sG0Df666f0bvHOzuPMjnw0dN_mArER5k1pJ6LPLw@mail.gmail.com
The changes happen all in one big patch; the alternative would be to have one
patch per arch that adds the ARCH_SUPPORTS_SCHED_* selection, then a final patch
that adds the generic definitions and removes the arch ones (which I can do if
that's a preferred approach).
Briefly tested by setting ARCH=foo and playing around with menuconfig.
Based on top of Peter's queue:
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git -b sched/next
Patches are also available at:
https://git.gitlab.arm.com/linux-arm/linux-vs.git -b mainline/sched/topo_kconfig_cleanup
Cheers,
Valentin
Valentin Schneider (2):
sched: Move Kconfig.preempt to sched/Kconfig
sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions
arch/arm/Kconfig | 18 ++--------
arch/arm64/Kconfig | 26 ++------------
arch/ia64/Kconfig | 9 +----
arch/mips/Kconfig | 10 +-----
arch/parisc/Kconfig | 9 +----
arch/powerpc/Kconfig | 9 +----
arch/s390/Kconfig | 8 ++---
arch/sh/Kconfig | 1 +
arch/sh/mm/Kconfig | 9 -----
arch/sparc/Kconfig | 20 ++---------
arch/x86/Kconfig | 26 ++------------
init/Kconfig | 2 +-
kernel/{Kconfig.preempt => sched/Kconfig} | 41 +++++++++++++++++++++++
13 files changed, 59 insertions(+), 129 deletions(-)
rename kernel/{Kconfig.preempt => sched/Kconfig} (79%)
--
2.25.1
^ permalink raw reply
* Re: [PATCH] perf vendor events power10: Add metric events json file for power10 platform
From: James Clark @ 2021-10-08 10:23 UTC (permalink / raw)
To: Kajol Jain
Cc: maddy, rnsastry, jolsa, linux-kernel, acme@kernel.org,
linux-perf-users, atrajeev, linuxppc-dev
In-Reply-To: <20211006073119.276340-1-kjain@linux.ibm.com>
On 06/10/2021 08:31, Kajol Jain wrote:
> Add pmu metric json file for power10 platform.
>
> Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
> ---
> .../arch/powerpc/power10/metrics.json | 772 ++++++++++++++++++
I checked this with the new strict JSON parser from "[PATCH 0/3] perf tools: Enable strict JSON parsing"
and it seemed fine from that point of view.
James
^ permalink raw reply
* [PATCH] powerpc/eeh: Fix docstrings in eeh.c
From: Kai Song @ 2021-10-09 4:16 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulus, Kai Song, oohall, linux-kernel, dja
We fix the following warnings when building kernel with W=1:
arch/powerpc/kernel/eeh.c:598: warning: Function parameter or member 'function' not described in 'eeh_pci_enable'
arch/powerpc/kernel/eeh.c:774: warning: Function parameter or member 'edev' not described in 'eeh_set_dev_freset'
arch/powerpc/kernel/eeh.c:774: warning: expecting prototype for eeh_set_pe_freset(). Prototype was for eeh_set_dev_freset() instead
arch/powerpc/kernel/eeh.c:814: warning: Function parameter or member 'include_passed' not described in 'eeh_pe_reset_full'
arch/powerpc/kernel/eeh.c:944: warning: Function parameter or member 'ops' not described in 'eeh_init'
arch/powerpc/kernel/eeh.c:1451: warning: Function parameter or member 'include_passed' not described in 'eeh_pe_reset'
arch/powerpc/kernel/eeh.c:1526: warning: Function parameter or member 'func' not described in 'eeh_pe_inject_err'
arch/powerpc/kernel/eeh.c:1526: warning: Excess function parameter 'function' described in 'eeh_pe_inject_err'
Signed-off-by: Kai Song <songkai01@inspur.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
---
arch/powerpc/kernel/eeh.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index e9b597ed423c..91e0f4cf1db3 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -589,6 +589,7 @@ EXPORT_SYMBOL(eeh_check_failure);
/**
* eeh_pci_enable - Enable MMIO or DMA transfers for this slot
* @pe: EEH PE
+ * @function: EEH option
*
* This routine should be called to reenable frozen MMIO or DMA
* so that it would work correctly again. It's useful while doing
@@ -761,8 +762,8 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat
}
/**
- * eeh_set_pe_freset - Check the required reset for the indicated device
- * @data: EEH device
+ * eeh_set_dev_freset - Check the required reset for the indicated device
+ * @edev: EEH device
* @flag: return value
*
* Each device might have its preferred reset type: fundamental or
@@ -801,6 +802,7 @@ static void eeh_pe_refreeze_passed(struct eeh_pe *root)
/**
* eeh_pe_reset_full - Complete a full reset process on the indicated PE
* @pe: EEH PE
+ * @include_passed: include passed-through devices?
*
* This function executes a full reset procedure on a PE, including setting
* the appropriate flags, performing a fundamental or hot reset, and then
@@ -937,6 +939,7 @@ static struct notifier_block eeh_device_nb = {
/**
* eeh_init - System wide EEH initialization
+ * @ops: struct to trace EEH operation callback functions
*
* It's the platform's job to call this from an arch_initcall().
*/
@@ -1442,6 +1445,7 @@ static int eeh_pe_reenable_devices(struct eeh_pe *pe, bool include_passed)
* eeh_pe_reset - Issue PE reset according to specified type
* @pe: EEH PE
* @option: reset type
+ * @include_passed: include passed-through devices?
*
* The routine is called to reset the specified PE with the
* indicated type, either fundamental reset or hot reset.
@@ -1513,12 +1517,12 @@ EXPORT_SYMBOL_GPL(eeh_pe_configure);
* eeh_pe_inject_err - Injecting the specified PCI error to the indicated PE
* @pe: the indicated PE
* @type: error type
- * @function: error function
+ * @func: error function
* @addr: address
* @mask: address mask
*
* The routine is called to inject the specified PCI error, which
- * is determined by @type and @function, to the indicated PE for
+ * is determined by @type and @func, to the indicated PE for
* testing purpose.
*/
int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
--
2.27.0
^ permalink raw reply related
* [powerpc:next-test] BUILD SUCCESS f9473a65719e59c45f1638cc04db7c80de8fcc1a
From: kernel test robot @ 2021-10-09 4:03 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next-test
branch HEAD: f9473a65719e59c45f1638cc04db7c80de8fcc1a powerpc/pseries/cpuhp: remove obsolete comment from pseries_cpu_die
elapsed time: 830m
configs tested: 161
configs skipped: 4
The following configs have been built successfully.
More configs may be tested in the coming days.
gcc tested configs:
arm defconfig
arm64 allyesconfig
arm64 defconfig
arm allyesconfig
arm allmodconfig
i386 randconfig-c001-20211008
s390 debug_defconfig
parisc generic-32bit_defconfig
m68k bvme6000_defconfig
arm hisi_defconfig
sh hp6xx_defconfig
arc haps_hs_defconfig
mips maltaup_xpa_defconfig
mips rb532_defconfig
riscv nommu_k210_sdcard_defconfig
xtensa iss_defconfig
powerpc mpc85xx_cds_defconfig
powerpc akebono_defconfig
mips cavium_octeon_defconfig
sh rsk7269_defconfig
sh alldefconfig
arm oxnas_v6_defconfig
arm orion5x_defconfig
m68k amcore_defconfig
arm pxa255-idp_defconfig
mips gpr_defconfig
mips rt305x_defconfig
arm zeus_defconfig
arm socfpga_defconfig
arm corgi_defconfig
sh rsk7264_defconfig
xtensa xip_kc705_defconfig
nds32 allnoconfig
powerpc mpc8560_ads_defconfig
mips lemote2f_defconfig
m68k stmark2_defconfig
sh sdk7786_defconfig
powerpc holly_defconfig
arm am200epdkit_defconfig
sh migor_defconfig
powerpc pasemi_defconfig
mips rbtx49xx_defconfig
powerpc currituck_defconfig
ia64 alldefconfig
arm bcm2835_defconfig
powerpc mpc832x_mds_defconfig
arm xcep_defconfig
mips rs90_defconfig
mips bcm63xx_defconfig
mips malta_qemu_32r6_defconfig
powerpc g5_defconfig
arm keystone_defconfig
riscv defconfig
mips tb0219_defconfig
arc hsdk_defconfig
sh apsh4ad0a_defconfig
mips decstation_64_defconfig
sh sh7785lcr_defconfig
m68k apollo_defconfig
openrisc defconfig
powerpc arches_defconfig
sh secureedge5410_defconfig
m68k mac_defconfig
xtensa common_defconfig
powerpc lite5200b_defconfig
powerpc cm5200_defconfig
arm multi_v4t_defconfig
arm multi_v7_defconfig
powerpc mpc836x_rdk_defconfig
xtensa generic_kc705_defconfig
mips db1xxx_defconfig
arm ep93xx_defconfig
powerpc microwatt_defconfig
arm u8500_defconfig
h8300 h8300h-sim_defconfig
arm viper_defconfig
mips decstation_r4k_defconfig
powerpc mpc837x_rdb_defconfig
arm s3c6400_defconfig
arm realview_defconfig
powerpc tqm8560_defconfig
x86_64 randconfig-c001-20211008
arm randconfig-c002-20211008
ia64 allmodconfig
ia64 defconfig
ia64 allyesconfig
m68k allmodconfig
m68k defconfig
m68k allyesconfig
nios2 defconfig
arc allyesconfig
nds32 defconfig
nios2 allyesconfig
csky defconfig
alpha defconfig
alpha allyesconfig
xtensa allyesconfig
h8300 allyesconfig
arc defconfig
sh allmodconfig
parisc defconfig
parisc allyesconfig
s390 defconfig
s390 allyesconfig
s390 allmodconfig
sparc allyesconfig
sparc defconfig
i386 defconfig
i386 allyesconfig
mips allyesconfig
mips allmodconfig
powerpc allmodconfig
powerpc allnoconfig
powerpc allyesconfig
x86_64 randconfig-a015-20211008
x86_64 randconfig-a012-20211008
x86_64 randconfig-a016-20211008
x86_64 randconfig-a013-20211008
x86_64 randconfig-a011-20211008
x86_64 randconfig-a014-20211008
i386 randconfig-a013-20211008
i386 randconfig-a016-20211008
i386 randconfig-a014-20211008
i386 randconfig-a011-20211008
i386 randconfig-a012-20211008
i386 randconfig-a015-20211008
arc randconfig-r043-20211008
s390 randconfig-r044-20211008
riscv randconfig-r042-20211008
riscv nommu_k210_defconfig
riscv nommu_virt_defconfig
riscv allnoconfig
riscv rv32_defconfig
riscv allmodconfig
riscv allyesconfig
x86_64 rhel-8.3-kselftests
um x86_64_defconfig
um i386_defconfig
x86_64 allyesconfig
x86_64 defconfig
x86_64 rhel-8.3
x86_64 kexec
clang tested configs:
x86_64 randconfig-c007-20211008
i386 randconfig-c001-20211008
arm randconfig-c002-20211008
s390 randconfig-c005-20211008
powerpc randconfig-c003-20211008
riscv randconfig-c006-20211008
mips randconfig-c004-20211008
x86_64 randconfig-a003-20211008
x86_64 randconfig-a005-20211008
x86_64 randconfig-a001-20211008
x86_64 randconfig-a002-20211008
x86_64 randconfig-a004-20211008
x86_64 randconfig-a006-20211008
i386 randconfig-a001-20211008
i386 randconfig-a003-20211008
i386 randconfig-a005-20211008
i386 randconfig-a004-20211008
i386 randconfig-a002-20211008
i386 randconfig-a006-20211008
hexagon randconfig-r045-20211008
hexagon randconfig-r041-20211008
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply
* Re: [PATCH 2/5] memory: fsl_ifc: populate child devices without relying on simple-bus
From: Li Yang @ 2021-10-09 3:12 UTC (permalink / raw)
To: Rob Herring
Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Shawn Guo, lkml, Krzysztof Kozlowski, linuxppc-dev,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
In-Reply-To: <YVsrYp3kZNmB1CIu@robh.at.kernel.org>
On Mon, Oct 4, 2021 at 12:14 PM Rob Herring <robh@kernel.org> wrote:
>
> On Thu, Sep 30, 2021 at 07:09:21PM -0500, Li Yang wrote:
> > After we update the binding to not use simple-bus compatible for the
> > controller, we need the driver to populate the child devices explicitly.
> >
> > Signed-off-by: Li Yang <leoyang.li@nxp.com>
> > ---
> > drivers/memory/fsl_ifc.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c
> > index d062c2f8250f..251d713cd50b 100644
> > --- a/drivers/memory/fsl_ifc.c
> > +++ b/drivers/memory/fsl_ifc.c
> > @@ -88,6 +88,7 @@ static int fsl_ifc_ctrl_remove(struct platform_device *dev)
> > {
> > struct fsl_ifc_ctrl *ctrl = dev_get_drvdata(&dev->dev);
> >
> > + of_platform_depopulate(&dev->dev);
> > free_irq(ctrl->nand_irq, ctrl);
> > free_irq(ctrl->irq, ctrl);
> >
> > @@ -285,6 +286,14 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
> > }
> > }
> >
> > + /* legacy dts may still use "simple-bus" compatible */
> > + if (!of_device_is_compatible(dev->dev.of_node, "simple-bus")) {
> > + ret = of_platform_populate(dev->dev.of_node, NULL, NULL,
> > + &dev->dev);
>
> There's no need to make this conditional. of_platform_populate() is safe
> to call multiple times. If that doesn't work, it's a bug.
I think that it is probably an optimization to avoid re-populate the
bus for legacy device trees. But it might be cleaner to just
re-populate anyway?
Regards,
Leo
^ permalink raw reply
* Re: [PATCH v3] PCI: Move pci_dev_is/assign_added() to pci.h
From: Bjorn Helgaas @ 2021-10-08 22:13 UTC (permalink / raw)
To: Niklas Schnelle
Cc: linux-arch, linux-s390, linux-kernel, Paul Mackerras, linux-pci,
Bjorn Helgaas, linuxppc-dev
In-Reply-To: <20210720150145.640727-1-schnelle@linux.ibm.com>
On Tue, Jul 20, 2021 at 05:01:45PM +0200, Niklas Schnelle wrote:
> The helper function pci_dev_is_added() from drivers/pci/pci.h is used in
> PCI arch code of both s390 and powerpc leading to awkward relative
> includes. Move it to the global include/linux/pci.h and get rid of these
> includes just for that one function.
>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
> Since v1 (and bad v2):
> - Fixed accidental removal of PCI_DPC_RECOVERED, PCI_DPC_RECOVERING
> defines and also move these to include/linux/pci.h
>
> arch/powerpc/platforms/powernv/pci-sriov.c | 3 ---
> arch/powerpc/platforms/pseries/setup.c | 1 -
> arch/s390/pci/pci_sysfs.c | 2 --
> drivers/pci/hotplug/acpiphp_glue.c | 1 -
> drivers/pci/pci.h | 15 ---------------
> include/linux/pci.h | 15 +++++++++++++++
> 6 files changed, 15 insertions(+), 22 deletions(-)
I dropped this one because I think a subsequent patch removed the use
in arch/powerpc, so if you still need this, it probably needs to be
updated to at least drop those hunks.
^ permalink raw reply
* Re: [PATCH 1/5] dt-bindings: memory: fsl: convert ifc binding to yaml schema
From: Li Yang @ 2021-10-08 21:50 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Shawn Guo, lkml, Rob Herring, linuxppc-dev,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
In-Reply-To: <e42fa620-810b-fdcc-c827-602a14d10d97@canonical.com>
On Mon, Oct 4, 2021 at 4:32 AM Krzysztof Kozlowski
<krzysztof.kozlowski@canonical.com> wrote:
>
> On 01/10/2021 18:17, Li Yang wrote:
> > On Fri, Oct 1, 2021 at 5:01 AM Krzysztof Kozlowski
> > <krzysztof.kozlowski@canonical.com> wrote:
> >>
>
> (...)
>
> >>> +
> >>> + interrupts:
> >>> + minItems: 1
> >>> + maxItems: 2
> >>> + description: |
> >>> + IFC may have one or two interrupts. If two interrupt specifiers are
> >>> + present, the first is the "common" interrupt (CM_EVTER_STAT), and the
> >>> + second is the NAND interrupt (NAND_EVTER_STAT). If there is only one,
> >>> + that interrupt reports both types of event.
> >>> +
> >>> + little-endian:
> >>> + $ref: '/schemas/types.yaml#/definitions/flag'
> >>
> >> type: boolean
> >
> > It will not have a true or false value, but only present or not. Is
> > the boolean type taking care of this too?
>
> boolean is for a property which does not accept values and true/false
> depends on its presence.
> See:
> Documentation/devicetree/bindings/phy/lantiq,vrx200-pcie-phy.yaml
> Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
From the dtschema/schemas/types.yaml file, flag type is defined as:
flag:
oneOf:
- type: boolean
const: true
- type: 'null'
It looks like more than the boolean type itself. But if the standard
boolean type is actually the same as the flag type we defined.
Shouldn't we remove the custom flag type then?
Regards,
Leo
^ permalink raw reply
* Re: [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
From: Kees Cook @ 2021-10-08 21:17 UTC (permalink / raw)
To: Greg Kroah-Hartman, Christophe Leroy
Cc: Kees Cook, Arnd Bergmann, Nick Desaulniers, linux-kernel, stable,
Nathan Chancellor, linuxppc-dev
In-Reply-To: <8900731fbc05fb8b0de18af7133a8fc07c3c53a1.1633712176.git.christophe.leroy@csgroup.eu>
On Fri, 8 Oct 2021 18:58:40 +0200, Christophe Leroy wrote:
> On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
> test leads to "Illegal instruction" failure.
>
> Looking at the content of rodata_objcopy.o, we see that the
> function content zeroes only:
>
> Disassembly of section .rodata:
>
> [...]
Applied to for-next/lkdtm, thanks!
[1/1] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
https://git.kernel.org/kees/c/19c3069c5f5f
Also, can you take a moment and get "patatt" set up[1] for signing your
patches? I would appreciate that since b4 yells at me when patches aren't
signed. :)
-Kees
[1] https://github.com/mricon/patatt
--
Kees Cook
^ permalink raw reply
* Re: [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
From: Kees Cook @ 2021-10-08 21:16 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel, stable,
Nathan Chancellor, linuxppc-dev
In-Reply-To: <CAKwvOdnWbKdBuSGtmu2DURy5dtVGUYWJ_mwxSL6N5OfbmjU3EA@mail.gmail.com>
On Fri, Oct 08, 2021 at 11:09:47AM -0700, Nick Desaulniers wrote:
> On Fri, Oct 8, 2021 at 9:59 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
> >
> > On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
> > test leads to "Illegal instruction" failure.
> >
> > Looking at the content of rodata_objcopy.o, we see that the
> > function content zeroes only:
> >
> > Disassembly of section .rodata:
> >
> > 0000000000000000 <.lkdtm_rodata_do_nothing>:
> > 0: 00 00 00 00 .long 0x0
> >
> > Add the contents flag in order to keep the content of the section
> > while renaming it.
> >
> > Disassembly of section .rodata:
> >
> > 0000000000000000 <.lkdtm_rodata_do_nothing>:
> > 0: 4e 80 00 20 blr
> >
> > Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy")
>
> Thanks for the patch; sorry I broke this.
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Hah! Whoops; sorry I don't have an inverted version of this test! I
should have caught this when it broke. :|
-Kees
--
Kees Cook
^ permalink raw reply
* Re: [PATCH v2 00/11] Add Apple M1 support to PASemi i2c driver
From: Olof Johansson @ 2021-10-08 20:49 UTC (permalink / raw)
To: Sven Peter
Cc: Arnd Bergmann, Hector Martin, Linux Kernel Mailing List,
linux-i2c, Wolfram Sang, Paul Mackerras, Linux ARM Mailing List,
Christian Zigotzky, Mohamed Mediouni, Mark Kettenis, linuxppc-dev,
Alyssa Rosenzweig, Stan Skowronek
In-Reply-To: <20211008163532.75569-1-sven@svenpeter.dev>
Hi,
On Fri, Oct 8, 2021 at 9:36 AM Sven Peter <sven@svenpeter.dev> wrote:
>
> Hi,
>
> v1: https://lore.kernel.org/linux-i2c/20210926095847.38261-1-sven@svenpeter.dev/
>
> Changes for v2:
> - Added reviewed-by/acks
> - Switched from ioport_map to pci_iomap as suggested by Arnd Bergmann
> - Renamed i2c-pasemi-apple.c to i2c-pasemi-platform.c as suggested by
> Wolfram Sang
> - Replaced the ioport number in the adapter name with dev_name to be
> able to identify separate busses in e.g. i2cdetect.
>
> I still don't have access to any old PASemi hardware but the changes from
> v1 are pretty small and I expect them to still work. Would still be nice
> if someone with access to such hardware could give this a quick test.
>
>
> And for those who didn't see v1 the (almost) unchanged original cover letter:
>
> This series adds support for the I2C controller found on Apple Silicon Macs
> which has quite a bit of history:
>
> Apple bought P.A. Semi in 2008 and it looks like a part of its legacy continues
> to live on in the M1. This controller has actually been used since at least the
> iPhone 4S and hasn't changed much since then.
> Essentially, there are only a few differences that matter:
>
> - The controller no longer is a PCI device
> - Starting at some iPhone an additional bit in one register
> must be set in order to start transmissions.
> - The reference clock and hence the clock dividers are different
>
> In order to add support for a platform device I first replaced PCI-specific
> bits and split out the PCI driver to its own file. Then I added support
> to make the clock divider configurable and converted the driver to use
> managed device resources to make it a bit simpler.
>
> The Apple and PASemi driver will never be compiled in the same kernel
> since the Apple one will run on arm64 while the original PASemi driver
> will only be useful on powerpc.
> I've thus followed the octeon (mips)/thunderx(arm64) approach to do the
> split: I created a -core.c file which contains the shared logic and just
> compile that one for both the PASemi and the new Apple driver.
Series:
Acked-by: Olof Johansson <olof@lixom.net>
-Olof
^ permalink raw reply
* Re: Add Apple M1 support to PASemi i2c driver
From: Olof Johansson @ 2021-10-08 20:47 UTC (permalink / raw)
To: Christian Zigotzky
Cc: Linux ARM Mailing List, Darren Stevens, Arnd Bergmann, Sven Peter,
Hector Martin, Linux Kernel Mailing List, Wolfram Sang,
Paul Mackerras, linux-i2c, R.T.Dickinson, mohamed.mediouni,
Matthew Leaman, Stan Skowronek, linuxppc-dev, R.T.Dickinson,
Alyssa Rosenzweig, Mark Kettenis
In-Reply-To: <B2915AF7-A603-43CC-9ED4-9F8A869CBCC5@xenosoft.de>
Christian,
Self-service available on lore:
https://lore.kernel.org/all/20211008163532.75569-1-sven@svenpeter.dev/
There are links on there to download a whole thread as an mbox if needed.
-Olof
On Fri, Oct 8, 2021 at 1:20 PM Christian Zigotzky
<chzigotzky@xenosoft.de> wrote:
>
> Hi Michael,
>
> Do you have a mbox link for the v2 changes?
>
> I would like to test them on my AmigaOne X1000.
>
> Thanks,
> Christian
>
> On 27. Sep 2021, at 09:58, Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> Christian, the whole series is downloadable as a single mbox here:
>
> https://patchwork.ozlabs.org/series/264134/mbox/
>
> Save that to a file and apply with `git am`.
>
> eg:
>
> $ wget -O mbox https://patchwork.ozlabs.org/series/264134/mbox/
> $ git am mbox
>
> It applies cleanly on v5.15-rc3.
>
> cheers
^ permalink raw reply
* Re: Add Apple M1 support to PASemi i2c driver
From: Christian Zigotzky @ 2021-10-08 20:19 UTC (permalink / raw)
To: Michael Ellerman
Cc: Darren Stevens, Arnd Bergmann, Sven Peter, Hector Martin,
Linux Kernel Mailing List, linux-i2c, Wolfram Sang,
Paul Mackerras, Alyssa Rosenzweig, R.T.Dickinson, Olof Johansson,
mohamed.mediouni, Matthew Leaman, Mark Kettenis, linuxppc-dev,
R.T.Dickinson, linux-arm-kernel, Stan Skowronek
In-Reply-To: <87mtnylaam.fsf@mpe.ellerman.id.au>
Hi Michael,
Do you have a mbox link for the v2 changes?
I would like to test them on my AmigaOne X1000.
Thanks,
Christian
On 27. Sep 2021, at 09:58, Michael Ellerman <mpe@ellerman.id.au> wrote:
Christian, the whole series is downloadable as a single mbox here:
https://patchwork.ozlabs.org/series/264134/mbox/
Save that to a file and apply with `git am`.
eg:
$ wget -O mbox https://patchwork.ozlabs.org/series/264134/mbox/
$ git am mbox
It applies cleanly on v5.15-rc3.
cheers
^ permalink raw reply
* Re: [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
From: Nick Desaulniers @ 2021-10-08 18:09 UTC (permalink / raw)
To: Christophe Leroy
Cc: Kees Cook, Arnd Bergmann, Greg Kroah-Hartman, linux-kernel,
stable, Nathan Chancellor, linuxppc-dev
In-Reply-To: <8900731fbc05fb8b0de18af7133a8fc07c3c53a1.1633712176.git.christophe.leroy@csgroup.eu>
On Fri, Oct 8, 2021 at 9:59 AM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
> On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
> test leads to "Illegal instruction" failure.
>
> Looking at the content of rodata_objcopy.o, we see that the
> function content zeroes only:
>
> Disassembly of section .rodata:
>
> 0000000000000000 <.lkdtm_rodata_do_nothing>:
> 0: 00 00 00 00 .long 0x0
>
> Add the contents flag in order to keep the content of the section
> while renaming it.
>
> Disassembly of section .rodata:
>
> 0000000000000000 <.lkdtm_rodata_do_nothing>:
> 0: 4e 80 00 20 blr
>
> Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy")
Thanks for the patch; sorry I broke this.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Cc: stable@vger.kernel.org
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> drivers/misc/lkdtm/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
> index aa12097668d3..e2984ce51fe4 100644
> --- a/drivers/misc/lkdtm/Makefile
> +++ b/drivers/misc/lkdtm/Makefile
> @@ -20,7 +20,7 @@ CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO)
>
> OBJCOPYFLAGS :=
> OBJCOPYFLAGS_rodata_objcopy.o := \
> - --rename-section .noinstr.text=.rodata,alloc,readonly,load
> + --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents
> targets += rodata.o rodata_objcopy.o
> $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
> $(call if_changed,objcopy)
> --
> 2.31.1
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply
* [PATCH] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing()
From: Christophe Leroy @ 2021-10-08 16:58 UTC (permalink / raw)
To: Kees Cook, Greg Kroah-Hartman
Cc: Arnd Bergmann, Nick Desaulniers, linux-kernel, stable,
Nathan Chancellor, linuxppc-dev
On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA
test leads to "Illegal instruction" failure.
Looking at the content of rodata_objcopy.o, we see that the
function content zeroes only:
Disassembly of section .rodata:
0000000000000000 <.lkdtm_rodata_do_nothing>:
0: 00 00 00 00 .long 0x0
Add the contents flag in order to keep the content of the section
while renaming it.
Disassembly of section .rodata:
0000000000000000 <.lkdtm_rodata_do_nothing>:
0: 4e 80 00 20 blr
Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy")
Cc: stable@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
drivers/misc/lkdtm/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
index aa12097668d3..e2984ce51fe4 100644
--- a/drivers/misc/lkdtm/Makefile
+++ b/drivers/misc/lkdtm/Makefile
@@ -20,7 +20,7 @@ CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO)
OBJCOPYFLAGS :=
OBJCOPYFLAGS_rodata_objcopy.o := \
- --rename-section .noinstr.text=.rodata,alloc,readonly,load
+ --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents
targets += rodata.o rodata_objcopy.o
$(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
$(call if_changed,objcopy)
--
2.31.1
^ permalink raw reply related
* [PATCH v2 11/11] i2c: pasemi: Set enable bit for Apple variant
From: Sven Peter @ 2021-10-08 16:35 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Olof Johansson, Christian Zigotzky, Wolfram Sang
Cc: Arnd Bergmann, Sven Peter, Hector Martin, linux-kernel, linux-i2c,
linux-arm-kernel, Mohamed Mediouni, Stan Skowronek, linuxppc-dev,
Alyssa Rosenzweig, Mark Kettenis
In-Reply-To: <20211008163532.75569-1-sven@svenpeter.dev>
Some later revisions after the original PASemi I2C controller introduce
what likely is an enable bit to the CTL register. Without setting it the
actual i2c transmission is never started.
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sven Peter <sven@svenpeter.dev>
---
v1 -> v2: no changes
drivers/i2c/busses/i2c-pasemi-core.c | 8 ++++++++
drivers/i2c/busses/i2c-pasemi-core.h | 3 +++
drivers/i2c/busses/i2c-pasemi-pci.c | 6 ++++++
3 files changed, 17 insertions(+)
diff --git a/drivers/i2c/busses/i2c-pasemi-core.c b/drivers/i2c/busses/i2c-pasemi-core.c
index 3d87b64dd9f7..4e161a4089d8 100644
--- a/drivers/i2c/busses/i2c-pasemi-core.c
+++ b/drivers/i2c/busses/i2c-pasemi-core.c
@@ -22,6 +22,7 @@
#define REG_MRXFIFO 0x04
#define REG_SMSTA 0x14
#define REG_CTL 0x1c
+#define REG_REV 0x28
/* Register defs */
#define MTXFIFO_READ 0x00000400
@@ -37,6 +38,7 @@
#define CTL_MRR 0x00000400
#define CTL_MTR 0x00000200
+#define CTL_EN 0x00000800
#define CTL_CLK_M 0x000000ff
static inline void reg_write(struct pasemi_smbus *smbus, int reg, int val)
@@ -60,6 +62,9 @@ static void pasemi_reset(struct pasemi_smbus *smbus)
{
u32 val = (CTL_MTR | CTL_MRR | (smbus->clk_div & CTL_CLK_M));
+ if (smbus->hw_rev >= 6)
+ val |= CTL_EN;
+
reg_write(smbus, REG_CTL, val);
}
@@ -335,6 +340,9 @@ int pasemi_i2c_common_probe(struct pasemi_smbus *smbus)
/* set up the sysfs linkage to our parent device */
smbus->adapter.dev.parent = smbus->dev;
+ if (smbus->hw_rev != PASEMI_HW_REV_PCI)
+ smbus->hw_rev = reg_read(smbus, REG_REV);
+
pasemi_reset(smbus);
error = devm_i2c_add_adapter(smbus->dev, &smbus->adapter);
diff --git a/drivers/i2c/busses/i2c-pasemi-core.h b/drivers/i2c/busses/i2c-pasemi-core.h
index aca4e2da9089..4655124a37f3 100644
--- a/drivers/i2c/busses/i2c-pasemi-core.h
+++ b/drivers/i2c/busses/i2c-pasemi-core.h
@@ -8,11 +8,14 @@
#include <linux/io.h>
#include <linux/kernel.h>
+#define PASEMI_HW_REV_PCI -1
+
struct pasemi_smbus {
struct device *dev;
struct i2c_adapter adapter;
void __iomem *ioaddr;
unsigned int clk_div;
+ int hw_rev;
};
int pasemi_i2c_common_probe(struct pasemi_smbus *smbus);
diff --git a/drivers/i2c/busses/i2c-pasemi-pci.c b/drivers/i2c/busses/i2c-pasemi-pci.c
index 4251e7b9f177..1ab1f28744fb 100644
--- a/drivers/i2c/busses/i2c-pasemi-pci.c
+++ b/drivers/i2c/busses/i2c-pasemi-pci.c
@@ -42,6 +42,12 @@ static int pasemi_smb_pci_probe(struct pci_dev *dev,
size = pci_resource_len(dev, 0);
smbus->clk_div = CLK_100K_DIV;
+ /*
+ * The original PASemi PCI controllers don't have a register for
+ * their HW revision.
+ */
+ smbus->hw_rev = PASEMI_HW_REV_PCI;
+
if (!devm_request_region(&dev->dev, base, size,
pasemi_smb_pci_driver.name))
return -EBUSY;
--
2.25.1
^ permalink raw reply related
* [PATCH v2 10/11] i2c: pasemi: Add Apple platform driver
From: Sven Peter @ 2021-10-08 16:35 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Olof Johansson, Christian Zigotzky, Wolfram Sang
Cc: Arnd Bergmann, Sven Peter, Hector Martin, linux-kernel, linux-i2c,
linux-arm-kernel, Mohamed Mediouni, Stan Skowronek, linuxppc-dev,
Alyssa Rosenzweig, Mark Kettenis
In-Reply-To: <20211008163532.75569-1-sven@svenpeter.dev>
With all the previous preparations we can now finally add
the platform driver to support the PASemi-based controllers
in Apple SoCs. This does not work on the M1 yet but should
work on the early iPhones already.
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sven Peter <sven@svenpeter.dev>
---
v1 -> v2:
- renamed i2c-pasemi-apple.c to i2c-pasemi-platform.c and adjusted
function names as well
- removed unused struct pinctrl *pctrl which snuck into v1
MAINTAINERS | 1 +
drivers/i2c/busses/Kconfig | 11 ++
drivers/i2c/busses/Makefile | 2 +
drivers/i2c/busses/i2c-pasemi-platform.c | 122 +++++++++++++++++++++++
4 files changed, 136 insertions(+)
create mode 100644 drivers/i2c/busses/i2c-pasemi-platform.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 74aa85967ca3..8e0f1dc94b5b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1740,6 +1740,7 @@ F: Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml
F: Documentation/devicetree/bindings/pci/apple,pcie.yaml
F: Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
F: arch/arm64/boot/dts/apple/
+F: drivers/i2c/busses/i2c-pasemi-platform.c
F: drivers/irqchip/irq-apple-aic.c
F: include/dt-bindings/interrupt-controller/apple-aic.h
F: include/dt-bindings/pinctrl/apple.h
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 1df19ccc310b..dce392839017 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -859,6 +859,17 @@ config I2C_PASEMI
help
Supports the PA Semi PWRficient on-chip SMBus interfaces.
+config I2C_APPLE
+ tristate "Apple SMBus platform driver"
+ depends on ARCH_APPLE || COMPILE_TEST
+ default ARCH_APPLE
+ help
+ Say Y here if you want to use the I2C controller present on Apple
+ Silicon chips such as the M1.
+
+ This driver can also be built as a module. If so, the module
+ will be called i2c-apple.
+
config I2C_PCA_PLATFORM
tristate "PCA9564/PCA9665 as platform device"
select I2C_ALGOPCA
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 0ab1b4cb2228..d85899fef8c7 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -86,6 +86,8 @@ obj-$(CONFIG_I2C_OMAP) += i2c-omap.o
obj-$(CONFIG_I2C_OWL) += i2c-owl.o
i2c-pasemi-objs := i2c-pasemi-core.o i2c-pasemi-pci.o
obj-$(CONFIG_I2C_PASEMI) += i2c-pasemi.o
+i2c-apple-objs := i2c-pasemi-core.o i2c-pasemi-platform.o
+obj-$(CONFIG_I2C_APPLE) += i2c-apple.o
obj-$(CONFIG_I2C_PCA_PLATFORM) += i2c-pca-platform.o
obj-$(CONFIG_I2C_PNX) += i2c-pnx.o
obj-$(CONFIG_I2C_PXA) += i2c-pxa.o
diff --git a/drivers/i2c/busses/i2c-pasemi-platform.c b/drivers/i2c/busses/i2c-pasemi-platform.c
new file mode 100644
index 000000000000..88a54aaf7e3c
--- /dev/null
+++ b/drivers/i2c/busses/i2c-pasemi-platform.c
@@ -0,0 +1,122 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2021 The Asahi Linux Contributors
+ *
+ * PA Semi PWRficient SMBus host driver for Apple SoCs
+ */
+
+#include <linux/clk.h>
+#include <linux/i2c.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/types.h>
+
+#include "i2c-pasemi-core.h"
+
+struct pasemi_platform_i2c_data {
+ struct pasemi_smbus smbus;
+ struct clk *clk_ref;
+};
+
+static int
+pasemi_platform_i2c_calc_clk_div(struct pasemi_platform_i2c_data *data,
+ u32 frequency)
+{
+ unsigned long clk_rate = clk_get_rate(data->clk_ref);
+
+ if (!clk_rate)
+ return -EINVAL;
+
+ data->smbus.clk_div = DIV_ROUND_UP(clk_rate, 16 * frequency);
+ if (data->smbus.clk_div < 4)
+ return dev_err_probe(data->smbus.dev, -EINVAL,
+ "Bus frequency %d is too fast.\n",
+ frequency);
+ if (data->smbus.clk_div > 0xff)
+ return dev_err_probe(data->smbus.dev, -EINVAL,
+ "Bus frequency %d is too slow.\n",
+ frequency);
+
+ return 0;
+}
+
+static int pasemi_platform_i2c_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct pasemi_platform_i2c_data *data;
+ struct pasemi_smbus *smbus;
+ u32 frequency;
+ int error;
+
+ data = devm_kzalloc(dev, sizeof(struct pasemi_platform_i2c_data),
+ GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ smbus = &data->smbus;
+ smbus->dev = dev;
+
+ smbus->ioaddr = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(smbus->ioaddr))
+ return PTR_ERR(smbus->ioaddr);
+
+ if (of_property_read_u32(dev->of_node, "clock-frequency", &frequency))
+ frequency = I2C_MAX_STANDARD_MODE_FREQ;
+
+ data->clk_ref = devm_clk_get(dev, NULL);
+ if (IS_ERR(data->clk_ref))
+ return PTR_ERR(data->clk_ref);
+
+ error = clk_prepare_enable(data->clk_ref);
+ if (error)
+ return error;
+
+ error = pasemi_platform_i2c_calc_clk_div(data, frequency);
+ if (error)
+ goto out_clk_disable;
+
+ smbus->adapter.dev.of_node = pdev->dev.of_node;
+ error = pasemi_i2c_common_probe(smbus);
+ if (error)
+ goto out_clk_disable;
+
+ platform_set_drvdata(pdev, data);
+
+ return 0;
+
+out_clk_disable:
+ clk_disable_unprepare(data->clk_ref);
+
+ return error;
+}
+
+static int pasemi_platform_i2c_remove(struct platform_device *pdev)
+{
+ struct pasemi_platform_i2c_data *data = platform_get_drvdata(pdev);
+
+ clk_disable_unprepare(data->clk_ref);
+ return 0;
+}
+
+static const struct of_device_id pasemi_platform_i2c_of_match[] = {
+ { .compatible = "apple,t8103-i2c" },
+ { .compatible = "apple,i2c" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, pasemi_platform_i2c_of_match);
+
+static struct platform_driver pasemi_platform_i2c_driver = {
+ .driver = {
+ .name = "i2c-apple",
+ .of_match_table = pasemi_platform_i2c_of_match,
+ },
+ .probe = pasemi_platform_i2c_probe,
+ .remove = pasemi_platform_i2c_remove,
+};
+module_platform_driver(pasemi_platform_i2c_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Sven Peter <sven@svenpeter.dev>");
+MODULE_DESCRIPTION("Apple/PASemi SMBus platform driver");
--
2.25.1
^ permalink raw reply related
* [PATCH v2 09/11] i2c: pasemi: Refactor _probe to use devm_*
From: Sven Peter @ 2021-10-08 16:35 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Olof Johansson, Christian Zigotzky, Wolfram Sang
Cc: Arnd Bergmann, Sven Peter, Hector Martin, linux-kernel, linux-i2c,
linux-arm-kernel, Mohamed Mediouni, Stan Skowronek, linuxppc-dev,
Alyssa Rosenzweig, Mark Kettenis
In-Reply-To: <20211008163532.75569-1-sven@svenpeter.dev>
Using managed device resources means there's nothing left to be done in
pasemi_smb_pci_remove and also allows to remove base and size from
struct pasemi_smbus.
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sven Peter <sven@svenpeter.dev>
---
v1 -> v2: no changes
drivers/i2c/busses/i2c-pasemi-core.c | 8 ++---
drivers/i2c/busses/i2c-pasemi-core.h | 2 --
drivers/i2c/busses/i2c-pasemi-pci.c | 45 ++++++++--------------------
3 files changed, 15 insertions(+), 40 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pasemi-core.c b/drivers/i2c/busses/i2c-pasemi-core.c
index 9fb8fac53f2b..3d87b64dd9f7 100644
--- a/drivers/i2c/busses/i2c-pasemi-core.c
+++ b/drivers/i2c/busses/i2c-pasemi-core.c
@@ -41,8 +41,7 @@
static inline void reg_write(struct pasemi_smbus *smbus, int reg, int val)
{
- dev_dbg(smbus->dev, "smbus write reg %lx val %08x\n",
- smbus->base + reg, val);
+ dev_dbg(smbus->dev, "smbus write reg %x val %08x\n", reg, val);
iowrite32(val, smbus->ioaddr + reg);
}
@@ -50,8 +49,7 @@ static inline int reg_read(struct pasemi_smbus *smbus, int reg)
{
int ret;
ret = ioread32(smbus->ioaddr + reg);
- dev_dbg(smbus->dev, "smbus read reg %lx val %08x\n",
- smbus->base + reg, ret);
+ dev_dbg(smbus->dev, "smbus read reg %x val %08x\n", reg, ret);
return ret;
}
@@ -339,7 +337,7 @@ int pasemi_i2c_common_probe(struct pasemi_smbus *smbus)
pasemi_reset(smbus);
- error = i2c_add_adapter(&smbus->adapter);
+ error = devm_i2c_add_adapter(smbus->dev, &smbus->adapter);
if (error)
return error;
diff --git a/drivers/i2c/busses/i2c-pasemi-core.h b/drivers/i2c/busses/i2c-pasemi-core.h
index 30a7990825ef..aca4e2da9089 100644
--- a/drivers/i2c/busses/i2c-pasemi-core.h
+++ b/drivers/i2c/busses/i2c-pasemi-core.h
@@ -12,8 +12,6 @@ struct pasemi_smbus {
struct device *dev;
struct i2c_adapter adapter;
void __iomem *ioaddr;
- unsigned long base;
- int size;
unsigned int clk_div;
};
diff --git a/drivers/i2c/busses/i2c-pasemi-pci.c b/drivers/i2c/busses/i2c-pasemi-pci.c
index 96585bbf8c24..4251e7b9f177 100644
--- a/drivers/i2c/busses/i2c-pasemi-pci.c
+++ b/drivers/i2c/busses/i2c-pasemi-pci.c
@@ -26,57 +26,37 @@ static int pasemi_smb_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id)
{
struct pasemi_smbus *smbus;
+ unsigned long base;
+ int size;
int error;
if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO))
return -ENODEV;
- smbus = kzalloc(sizeof(struct pasemi_smbus), GFP_KERNEL);
+ smbus = devm_kzalloc(&dev->dev, sizeof(*smbus), GFP_KERNEL);
if (!smbus)
return -ENOMEM;
smbus->dev = &dev->dev;
- smbus->base = pci_resource_start(dev, 0);
- smbus->size = pci_resource_len(dev, 0);
+ base = pci_resource_start(dev, 0);
+ size = pci_resource_len(dev, 0);
smbus->clk_div = CLK_100K_DIV;
- if (!request_region(smbus->base, smbus->size,
- pasemi_smb_pci_driver.name)) {
- error = -EBUSY;
- goto out_kfree;
- }
+ if (!devm_request_region(&dev->dev, base, size,
+ pasemi_smb_pci_driver.name))
+ return -EBUSY;
- smbus->ioaddr = pci_iomap(dev, 0, 0);
- if (!smbus->ioaddr) {
- error = -EBUSY;
- goto out_release_region;
- }
+ smbus->ioaddr = pcim_iomap(dev, 0, 0);
+ if (!smbus->ioaddr)
+ return -EBUSY;
error = pasemi_i2c_common_probe(smbus);
if (error)
- goto out_ioport_unmap;
+ return error;
pci_set_drvdata(dev, smbus);
return 0;
-
- out_ioport_unmap:
- pci_iounmap(dev, smbus->ioaddr);
- out_release_region:
- release_region(smbus->base, smbus->size);
- out_kfree:
- kfree(smbus);
- return error;
-}
-
-static void pasemi_smb_pci_remove(struct pci_dev *dev)
-{
- struct pasemi_smbus *smbus = pci_get_drvdata(dev);
-
- i2c_del_adapter(&smbus->adapter);
- pci_iounmap(dev, smbus->ioaddr);
- release_region(smbus->base, smbus->size);
- kfree(smbus);
}
static const struct pci_device_id pasemi_smb_pci_ids[] = {
@@ -90,7 +70,6 @@ static struct pci_driver pasemi_smb_pci_driver = {
.name = "i2c-pasemi",
.id_table = pasemi_smb_pci_ids,
.probe = pasemi_smb_pci_probe,
- .remove = pasemi_smb_pci_remove,
};
module_pci_driver(pasemi_smb_pci_driver);
--
2.25.1
^ permalink raw reply related
* [PATCH v2 08/11] i2c: pasemi: Allow to configure bus frequency
From: Sven Peter @ 2021-10-08 16:35 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Olof Johansson, Christian Zigotzky, Wolfram Sang
Cc: Arnd Bergmann, Sven Peter, Hector Martin, linux-kernel, linux-i2c,
linux-arm-kernel, Mohamed Mediouni, Stan Skowronek, linuxppc-dev,
Alyssa Rosenzweig, Mark Kettenis
In-Reply-To: <20211008163532.75569-1-sven@svenpeter.dev>
Right now the bus frequency has always been hardcoded as
100 KHz with the specific reference clock used in the PASemi
PCI controllers. Make this configurable to prepare for the
platform driver.
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sven Peter <sven@svenpeter.dev>
---
v1 -> v2: no changes
drivers/i2c/busses/i2c-pasemi-core.c | 8 +++-----
drivers/i2c/busses/i2c-pasemi-core.h | 1 +
drivers/i2c/busses/i2c-pasemi-pci.c | 4 ++++
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pasemi-core.c b/drivers/i2c/busses/i2c-pasemi-core.c
index 232587c70a38..9fb8fac53f2b 100644
--- a/drivers/i2c/busses/i2c-pasemi-core.c
+++ b/drivers/i2c/busses/i2c-pasemi-core.c
@@ -39,9 +39,6 @@
#define CTL_MTR 0x00000200
#define CTL_CLK_M 0x000000ff
-#define CLK_100K_DIV 84
-#define CLK_400K_DIV 21
-
static inline void reg_write(struct pasemi_smbus *smbus, int reg, int val)
{
dev_dbg(smbus->dev, "smbus write reg %lx val %08x\n",
@@ -63,8 +60,9 @@ static inline int reg_read(struct pasemi_smbus *smbus, int reg)
static void pasemi_reset(struct pasemi_smbus *smbus)
{
- reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR |
- (CLK_100K_DIV & CTL_CLK_M)));
+ u32 val = (CTL_MTR | CTL_MRR | (smbus->clk_div & CTL_CLK_M));
+
+ reg_write(smbus, REG_CTL, val);
}
static void pasemi_smb_clear(struct pasemi_smbus *smbus)
diff --git a/drivers/i2c/busses/i2c-pasemi-core.h b/drivers/i2c/busses/i2c-pasemi-core.h
index 7acc33de6ce1..30a7990825ef 100644
--- a/drivers/i2c/busses/i2c-pasemi-core.h
+++ b/drivers/i2c/busses/i2c-pasemi-core.h
@@ -14,6 +14,7 @@ struct pasemi_smbus {
void __iomem *ioaddr;
unsigned long base;
int size;
+ unsigned int clk_div;
};
int pasemi_i2c_common_probe(struct pasemi_smbus *smbus);
diff --git a/drivers/i2c/busses/i2c-pasemi-pci.c b/drivers/i2c/busses/i2c-pasemi-pci.c
index 644656e28012..96585bbf8c24 100644
--- a/drivers/i2c/busses/i2c-pasemi-pci.c
+++ b/drivers/i2c/busses/i2c-pasemi-pci.c
@@ -17,6 +17,9 @@
#include "i2c-pasemi-core.h"
+#define CLK_100K_DIV 84
+#define CLK_400K_DIV 21
+
static struct pci_driver pasemi_smb_pci_driver;
static int pasemi_smb_pci_probe(struct pci_dev *dev,
@@ -35,6 +38,7 @@ static int pasemi_smb_pci_probe(struct pci_dev *dev,
smbus->dev = &dev->dev;
smbus->base = pci_resource_start(dev, 0);
smbus->size = pci_resource_len(dev, 0);
+ smbus->clk_div = CLK_100K_DIV;
if (!request_region(smbus->base, smbus->size,
pasemi_smb_pci_driver.name)) {
--
2.25.1
^ permalink raw reply related
* [PATCH v2 07/11] i2c: pasemi: Move common reset code to own function
From: Sven Peter @ 2021-10-08 16:35 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Olof Johansson, Christian Zigotzky, Wolfram Sang
Cc: Arnd Bergmann, Sven Peter, Hector Martin, linux-kernel, linux-i2c,
linux-arm-kernel, Mohamed Mediouni, Stan Skowronek, linuxppc-dev,
Alyssa Rosenzweig, Mark Kettenis
In-Reply-To: <20211008163532.75569-1-sven@svenpeter.dev>
Split out common reset call to its own function so that we
can later add support for selecting the clock frequency
and an additional enable bit found in newer revisions.
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sven Peter <sven@svenpeter.dev>
---
v1 -> v2: no changes
drivers/i2c/busses/i2c-pasemi-core.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pasemi-core.c b/drivers/i2c/busses/i2c-pasemi-core.c
index d1cab11a4d50..232587c70a38 100644
--- a/drivers/i2c/busses/i2c-pasemi-core.c
+++ b/drivers/i2c/busses/i2c-pasemi-core.c
@@ -61,6 +61,12 @@ static inline int reg_read(struct pasemi_smbus *smbus, int reg)
#define TXFIFO_WR(smbus, reg) reg_write((smbus), REG_MTXFIFO, (reg))
#define RXFIFO_RD(smbus) reg_read((smbus), REG_MRXFIFO)
+static void pasemi_reset(struct pasemi_smbus *smbus)
+{
+ reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR |
+ (CLK_100K_DIV & CTL_CLK_M)));
+}
+
static void pasemi_smb_clear(struct pasemi_smbus *smbus)
{
unsigned int status;
@@ -135,8 +141,7 @@ static int pasemi_i2c_xfer_msg(struct i2c_adapter *adapter,
return 0;
reset_out:
- reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR |
- (CLK_100K_DIV & CTL_CLK_M)));
+ pasemi_reset(smbus);
return err;
}
@@ -302,8 +307,7 @@ static int pasemi_smb_xfer(struct i2c_adapter *adapter,
return 0;
reset_out:
- reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR |
- (CLK_100K_DIV & CTL_CLK_M)));
+ pasemi_reset(smbus);
return err;
}
@@ -335,8 +339,7 @@ int pasemi_i2c_common_probe(struct pasemi_smbus *smbus)
/* set up the sysfs linkage to our parent device */
smbus->adapter.dev.parent = smbus->dev;
- reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR |
- (CLK_100K_DIV & CTL_CLK_M)));
+ pasemi_reset(smbus);
error = i2c_add_adapter(&smbus->adapter);
if (error)
--
2.25.1
^ permalink raw reply related
* [PATCH v2 06/11] i2c: pasemi: Split pci driver to its own file
From: Sven Peter @ 2021-10-08 16:35 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Olof Johansson, Christian Zigotzky, Wolfram Sang
Cc: Arnd Bergmann, Sven Peter, Hector Martin, linux-kernel, linux-i2c,
linux-arm-kernel, Mohamed Mediouni, Stan Skowronek, linuxppc-dev,
Alyssa Rosenzweig, Mark Kettenis
In-Reply-To: <20211008163532.75569-1-sven@svenpeter.dev>
Split off the PCI driver so that we can reuse common code for the
platform driver.
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sven Peter <sven@svenpeter.dev>
---
v1 -> v2: no changes
drivers/i2c/busses/Makefile | 1 +
.../{i2c-pasemi.c => i2c-pasemi-core.c} | 88 +----------------
drivers/i2c/busses/i2c-pasemi-core.h | 19 ++++
drivers/i2c/busses/i2c-pasemi-pci.c | 96 +++++++++++++++++++
4 files changed, 118 insertions(+), 86 deletions(-)
rename drivers/i2c/busses/{i2c-pasemi.c => i2c-pasemi-core.c} (81%)
create mode 100644 drivers/i2c/busses/i2c-pasemi-core.h
create mode 100644 drivers/i2c/busses/i2c-pasemi-pci.c
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 1336b04f40e2..0ab1b4cb2228 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -84,6 +84,7 @@ obj-$(CONFIG_I2C_NPCM7XX) += i2c-npcm7xx.o
obj-$(CONFIG_I2C_OCORES) += i2c-ocores.o
obj-$(CONFIG_I2C_OMAP) += i2c-omap.o
obj-$(CONFIG_I2C_OWL) += i2c-owl.o
+i2c-pasemi-objs := i2c-pasemi-core.o i2c-pasemi-pci.o
obj-$(CONFIG_I2C_PASEMI) += i2c-pasemi.o
obj-$(CONFIG_I2C_PCA_PLATFORM) += i2c-pca-platform.o
obj-$(CONFIG_I2C_PNX) += i2c-pnx.o
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi-core.c
similarity index 81%
rename from drivers/i2c/busses/i2c-pasemi.c
rename to drivers/i2c/busses/i2c-pasemi-core.c
index baf338149673..d1cab11a4d50 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi-core.c
@@ -15,15 +15,7 @@
#include <linux/slab.h>
#include <linux/io.h>
-static struct pci_driver pasemi_smb_driver;
-
-struct pasemi_smbus {
- struct device *dev;
- struct i2c_adapter adapter;
- void __iomem *ioaddr;
- unsigned long base;
- int size;
-};
+#include "i2c-pasemi-core.h"
/* Register offsets */
#define REG_MTXFIFO 0x00
@@ -329,7 +321,7 @@ static const struct i2c_algorithm smbus_algorithm = {
.functionality = pasemi_smb_func,
};
-static int pasemi_i2c_common_probe(struct pasemi_smbus *smbus)
+int pasemi_i2c_common_probe(struct pasemi_smbus *smbus)
{
int error;
@@ -352,79 +344,3 @@ static int pasemi_i2c_common_probe(struct pasemi_smbus *smbus)
return 0;
}
-
-static int pasemi_smb_probe(struct pci_dev *dev,
- const struct pci_device_id *id)
-{
- struct pasemi_smbus *smbus;
- int error;
-
- if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO))
- return -ENODEV;
-
- smbus = kzalloc(sizeof(struct pasemi_smbus), GFP_KERNEL);
- if (!smbus)
- return -ENOMEM;
-
- smbus->dev = &dev->dev;
- smbus->base = pci_resource_start(dev, 0);
- smbus->size = pci_resource_len(dev, 0);
-
- if (!request_region(smbus->base, smbus->size,
- pasemi_smb_driver.name)) {
- error = -EBUSY;
- goto out_kfree;
- }
-
- smbus->ioaddr = pci_iomap(dev, 0, 0);
- if (!smbus->ioaddr) {
- error = -EBUSY;
- goto out_release_region;
- }
-
- int error = pasemi_i2c_common_probe(smbus);
- if (error)
- goto out_ioport_unmap;
-
- pci_set_drvdata(dev, smbus);
-
- return 0;
-
- out_ioport_unmap:
- pci_iounmap(dev, smbus->ioaddr);
- out_release_region:
- release_region(smbus->base, smbus->size);
- out_kfree:
- kfree(smbus);
- return error;
-}
-
-static void pasemi_smb_remove(struct pci_dev *dev)
-{
- struct pasemi_smbus *smbus = pci_get_drvdata(dev);
-
- i2c_del_adapter(&smbus->adapter);
- pci_iounmap(dev, smbus->ioaddr);
- release_region(smbus->base, smbus->size);
- kfree(smbus);
-}
-
-static const struct pci_device_id pasemi_smb_ids[] = {
- { PCI_DEVICE(0x1959, 0xa003) },
- { 0, }
-};
-
-MODULE_DEVICE_TABLE(pci, pasemi_smb_ids);
-
-static struct pci_driver pasemi_smb_driver = {
- .name = "i2c-pasemi",
- .id_table = pasemi_smb_ids,
- .probe = pasemi_smb_probe,
- .remove = pasemi_smb_remove,
-};
-
-module_pci_driver(pasemi_smb_driver);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>");
-MODULE_DESCRIPTION("PA Semi PWRficient SMBus driver");
diff --git a/drivers/i2c/busses/i2c-pasemi-core.h b/drivers/i2c/busses/i2c-pasemi-core.h
new file mode 100644
index 000000000000..7acc33de6ce1
--- /dev/null
+++ b/drivers/i2c/busses/i2c-pasemi-core.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <linux/atomic.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/i2c.h>
+#include <linux/i2c-smbus.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+
+struct pasemi_smbus {
+ struct device *dev;
+ struct i2c_adapter adapter;
+ void __iomem *ioaddr;
+ unsigned long base;
+ int size;
+};
+
+int pasemi_i2c_common_probe(struct pasemi_smbus *smbus);
diff --git a/drivers/i2c/busses/i2c-pasemi-pci.c b/drivers/i2c/busses/i2c-pasemi-pci.c
new file mode 100644
index 000000000000..644656e28012
--- /dev/null
+++ b/drivers/i2c/busses/i2c-pasemi-pci.c
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2006-2007 PA Semi, Inc
+ *
+ * SMBus host driver for PA Semi PWRficient
+ */
+
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/kernel.h>
+#include <linux/stddef.h>
+#include <linux/sched.h>
+#include <linux/i2c.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include <linux/io.h>
+
+#include "i2c-pasemi-core.h"
+
+static struct pci_driver pasemi_smb_pci_driver;
+
+static int pasemi_smb_pci_probe(struct pci_dev *dev,
+ const struct pci_device_id *id)
+{
+ struct pasemi_smbus *smbus;
+ int error;
+
+ if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO))
+ return -ENODEV;
+
+ smbus = kzalloc(sizeof(struct pasemi_smbus), GFP_KERNEL);
+ if (!smbus)
+ return -ENOMEM;
+
+ smbus->dev = &dev->dev;
+ smbus->base = pci_resource_start(dev, 0);
+ smbus->size = pci_resource_len(dev, 0);
+
+ if (!request_region(smbus->base, smbus->size,
+ pasemi_smb_pci_driver.name)) {
+ error = -EBUSY;
+ goto out_kfree;
+ }
+
+ smbus->ioaddr = pci_iomap(dev, 0, 0);
+ if (!smbus->ioaddr) {
+ error = -EBUSY;
+ goto out_release_region;
+ }
+
+ error = pasemi_i2c_common_probe(smbus);
+ if (error)
+ goto out_ioport_unmap;
+
+ pci_set_drvdata(dev, smbus);
+
+ return 0;
+
+ out_ioport_unmap:
+ pci_iounmap(dev, smbus->ioaddr);
+ out_release_region:
+ release_region(smbus->base, smbus->size);
+ out_kfree:
+ kfree(smbus);
+ return error;
+}
+
+static void pasemi_smb_pci_remove(struct pci_dev *dev)
+{
+ struct pasemi_smbus *smbus = pci_get_drvdata(dev);
+
+ i2c_del_adapter(&smbus->adapter);
+ pci_iounmap(dev, smbus->ioaddr);
+ release_region(smbus->base, smbus->size);
+ kfree(smbus);
+}
+
+static const struct pci_device_id pasemi_smb_pci_ids[] = {
+ { PCI_DEVICE(0x1959, 0xa003) },
+ { 0, }
+};
+
+MODULE_DEVICE_TABLE(pci, pasemi_smb_pci_ids);
+
+static struct pci_driver pasemi_smb_pci_driver = {
+ .name = "i2c-pasemi",
+ .id_table = pasemi_smb_pci_ids,
+ .probe = pasemi_smb_pci_probe,
+ .remove = pasemi_smb_pci_remove,
+};
+
+module_pci_driver(pasemi_smb_pci_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Olof Johansson <olof@lixom.net>");
+MODULE_DESCRIPTION("PA Semi PWRficient SMBus driver");
--
2.25.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox