Reorganize setup code and merge 32 and 64-bit setup_arch()
Subsystems (12)
cover Reorganize setup code and merge 32 and 64-bit setup_arch()
This series reorganizes the setup code, moving probe_machine() later than when it's currently done, and sync'ing 32-bit and 64-bit enough to merge their implementations of setup_arch(). We get rid of ppc64 setup_system() which is subsumed by the new setup_arch().
Note: The first 2 patches should go separately. The first one is a pre requisite for the ppc32 move of probe_machine(). The second one a general bug fix for recent kernels which I included here so my test kernels could build.
I test built all ppc64 platforms and the STD_MMU ppc32 ones. I test booted pseries and powermac in qemu.
PATCH 1/38 dt: Add of_device_compatible_match()
This provides an equivalent of of_fdt_match() for non-flat trees.
This is more practical than matching an array of of_device_id structs when converting a bunch of existing users of of_fdt_match().
--- drivers/of/base.c | 22 ++++++++++++++++++++++ include/linux/of.h | 2 ++ 2 files changed, 24 insertions(+)
drivers/of/base.c +22 -0
@@ -493,6 +493,28 @@ int of_device_is_compatible(const struct device_node *device, }EXPORT_SYMBOL (of_device_is_compatible); +/** Checks if the device is compatible with any of the entries in +* a NULL terminated array of strings. Returns the best match +* score or 0. +*/ +int of_device_compatible_match (struct device_node *device, +const char *const *compat) +{ +unsigned int tmp, score =0 ; + +if (!compat) +return 0 ; + +while (*compat) { + tmp =of_device_is_compatible (device, *compat); +if (tmp && (score ==0 || (tmp < score))) + score = tmp; + compat++; + } + +return score; +} +/** * of_machine_is_compatible - Test root of device tree for a given compatible value * @compat: compatible string to look for in root node's compatible property.
include/linux/of.h +2 -0
@@ -324,6 +324,8 @@ extern int of_property_read_string_helper(const struct device_node *np, const char **out_strs, size_t sz, int index);extern int of_device_is_compatible (const struct device_node *device,const char *); +extern int of_device_compatible_match (struct device_node *device, +const char *const *compat);extern bool of_device_is_available (const struct device_node *device);extern bool of_device_is_big_endian (const struct device_node *device); extern const void *of_get_property(const struct device_node *node,
Signature · 1 line
2.7.4
PATCH 2/38 drm: Fix broken use of _PAGE_NO_CACHE on powerpc
In reply to Benjamin HerrenschmidtThat constant no longer exist. Use the proper accessor instead
--- drivers/gpu/drm/drm_memory.c | 2 +- drivers/gpu/drm/drm_scatter.c | 2 +- drivers/gpu/drm/drm_vm.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_memory.c +1 -1
@@ -44,7 +44,7 @@# include <asm/agp.h> #else # ifdef __powerpc__ -# define PAGE_AGP __pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE) +# define PAGE_AGP pgprot_noncached_wc(PAGE_KERNEL)# else # define PAGE_AGP PAGE_KERNEL# endif
drivers/gpu/drm/drm_scatter.c +1 -1
@@ -41,7 +41,7 @@static inline void *drm_vmalloc_dma (unsigned long size) {#if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE ) -return __vmalloc (size,GFP_KERNEL ,PAGE_KERNEL | _PAGE_NO_CACHE); +return __vmalloc (size,GFP_KERNEL ,pgprot_noncached_wc (PAGE_KERNEL ));#else return vmalloc_32 (size);#endif
drivers/gpu/drm/drm_vm.c +2 -2
@@ -80,7 +80,7 @@ static pgprot_t drm_dma_prot(uint32_t map_type, struct vm_area_struct *vma)pgprot_t tmp =vm_get_page_prot (vma->vm_flags);#if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE ) - tmp |= _PAGE_NO_CACHE; + tmp =pgprot_noncached_wc (tmp);#endif return tmp; }
@@ -593,7 +593,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)* pages and mappings in fault() */ #if defined(__powerpc__) -pgprot_val (vma->vm_page_prot) |= _PAGE_NO_CACHE; + vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot);#endif vma->vm_ops = &drm_vm_ops;break ;
Signature · 1 line
2.7.4
PATCH 3/38 powerpc/prom_init: PTRRELOC is not needed
In reply to Benjamin HerrenschmidtThere's one line of code still using PTRRELOC in prom_init, it shouldn't be necessary since that code is relocatable. Take it out.
--- arch/powerpc/kernel/prom_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/prom_init.c +1 -1
@@ -1980,7 +1980,7 @@ static void __init prom_check_displays(void)break ;#ifdef CONFIG_LOGO_LINUX_CLUT224 - clut =PTRRELOC (logo_linux_clut224.clut); + clut = logo_linux_clut224.clut;for (i =0 ; i < logo_linux_clut224.clutsize; i++, clut +=3 )if (prom_set_color (ih, i +32 , clut[0 ], clut[1 ], clut[2 ]) !=0 )
Signature · 1 line
2.7.4
PATCH 4/38 powerpc: Make PTRRELOC() 32-bit only
In reply to Benjamin HerrenschmidtPTRRELOC is only used by 32-bit code since on 32-bit systems, early_init can be run with relocation off and running at an offset. Define it to identity on 64-bit
--- arch/powerpc/include/asm/setup.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/include/asm/setup.h +4 -0
@@ -19,7 +19,11 @@ extern unsigned long reloc_offset(void);extern unsigned long add_reloc_offset (unsigned long );extern void reloc_got2 (unsigned long ); +#ifdef CONFIG_PPC32 #define PTRRELOC (x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) +#else +#define PTRRELOC (x) (x) +#endif void check_for_initrd (void );void initmem_init (void );
Signature · 1 line
2.7.4
PATCH 5/38 powerpc: Factor do_feature_fixup calls
In reply to Benjamin Herrenschmidt32 and 64-bit do a similar set of calls early on, we move it all to a single common function to make the boot code more readable.
--- arch/powerpc/include/asm/feature-fixups.h | 4 ++++ arch/powerpc/include/asm/synch.h | 1 - arch/powerpc/kernel/setup_32.c | 17 ++--------------- arch/powerpc/kernel/setup_64.c | 13 +------------ arch/powerpc/lib/feature-fixups.c | 31 +++++++++++++++++++++++++++++-- 5 files changed, 36 insertions(+), 30 deletions(-)
arch/powerpc/include/asm/feature-fixups.h +4 -0
@@ -184,4 +184,8 @@ label##3: \ FTR_ENTRY_OFFSET label##1b-label##3b; \ .popsection; +#ifndef __ASSEMBLY__ +void apply_feature_fixups (void ); +#endif +#endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */
arch/powerpc/include/asm/synch.h +0 -1
@@ -13,7 +13,6 @@extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup;extern void do_lwsync_fixups (unsigned long value,void *fixup_start,void *fixup_end); -extern void do_final_fixups (void );static inline void eieio (void ) {
arch/powerpc/kernel/setup_32.c +2 -15
@@ -73,7 +73,6 @@ int ucache_bsize;notrace unsigned long __init early_init (unsigned long dt_ptr) {unsigned long offset =reloc_offset (); -struct cpu_spec *spec;/* First zero the BSS -- use memset_io, some platforms don't have * caches on yet */
@@ -84,21 +83,9 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)* Identify the CPU type and fix up code sections * that depend on which cpu we have. */ - spec =identify_cpu (offset,mfspr (SPRN_PVR )); +identify_cpu (offset,mfspr (SPRN_PVR )); -do_feature_fixups (spec->cpu_features, -PTRRELOC (&__start___ftr_fixup), -PTRRELOC (&__stop___ftr_fixup)); - -do_feature_fixups (spec->mmu_features, -PTRRELOC (&__start___mmu_ftr_fixup), -PTRRELOC (&__stop___mmu_ftr_fixup)); - -do_lwsync_fixups (spec->cpu_features, -PTRRELOC (&__start___lwsync_fixup), -PTRRELOC (&__stop___lwsync_fixup)); - -do_final_fixups (); +apply_feature_fixups ();return KERNELBASE + offset; }
arch/powerpc/kernel/setup_64.c +1 -12
@@ -468,18 +468,7 @@ void __init setup_system(void) {DBG (" -> setup_system()\n" ); -/* Apply the CPUs-specific and firmware specific fixups to kernel -* text (nop out sections not relevant to this CPU or this firmware) -*/ -do_feature_fixups (cur_cpu_spec->cpu_features, - &__start___ftr_fixup, &__stop___ftr_fixup); -do_feature_fixups (cur_cpu_spec->mmu_features, - &__start___mmu_ftr_fixup, &__stop___mmu_ftr_fixup); -do_feature_fixups (powerpc_firmware_features, - &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup); -do_lwsync_fixups (cur_cpu_spec->cpu_features, - &__start___lwsync_fixup, &__stop___lwsync_fixup); -do_final_fixups (); +apply_feature_fixups ();/* * Unflatten the device-tree passed by prom_init or kexec
arch/powerpc/lib/feature-fixups.c +29 -2
@@ -20,7 +20,8 @@#include <asm/code-patching.h> #include <asm/page.h> #include <asm/sections.h> - +#include <asm/setup.h> +#include <asm/firmware.h> struct fixup_entry {unsigned long mask;
@@ -130,7 +131,7 @@ void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end) } } -void do_final_fixups (void ) +static void do_final_fixups (void ) {#if defined(CONFIG_PPC64 ) && defined(CONFIG_RELOCATABLE )int *src, *dest;
@@ -151,6 +152,32 @@ void do_final_fixups(void)#endif } +void apply_feature_fixups (void ) +{ +struct cpu_spec *spec = *PTRRELOC (&cur_cpu_spec); + +/* Apply the CPUs-specific and firmware specific fixups to kernel +* text (nop out sections not relevant to this CPU or this firmware) +*/ +do_feature_fixups (spec->cpu_features, +PTRRELOC (&__start___ftr_fixup), +PTRRELOC (&__stop___ftr_fixup)); + +do_feature_fixups (spec->mmu_features, +PTRRELOC (&__start___mmu_ftr_fixup), +PTRRELOC (&__stop___mmu_ftr_fixup)); + +do_lwsync_fixups (spec->cpu_features, +PTRRELOC (&__start___lwsync_fixup), +PTRRELOC (&__stop___lwsync_fixup)); + +#ifdef CONFIG_PPC64 +do_feature_fixups (powerpc_firmware_features, + &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup); +#endif +do_final_fixups (); +} +#ifdef CONFIG_FTR_FIXUP_SELFTEST #define check (x) \
Signature · 1 line
2.7.4
PATCH 6/38 powerpc: Move 64-bit feature fixup earlier
In reply to Benjamin HerrenschmidtMake it part of early_setup() as we really want the feature fixups to be applied before we turn on the MMU since they can have an impact on the various assembly path related to MMU management and interrupts.
This makes 64-bit match what 32-bit does.
--- arch/powerpc/kernel/setup_64.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/kernel/setup_64.c +3 -2
@@ -286,6 +286,9 @@ void __init early_setup(unsigned long dt_ptr)/* Initialize the hash table or TLB handling */ early_init_mmu (); +/* Apply all the dynamic patching */ +apply_feature_fixups (); +/* * At this point, we can let interrupts switch to virtual mode * (the MMU has been setup), so adjust the MSR in the PACA to
@@ -468,8 +471,6 @@ void __init setup_system(void) {DBG (" -> setup_system()\n" ); -apply_feature_fixups (); -/* * Unflatten the device-tree passed by prom_init or kexec */
Signature · 1 line
2.7.4
Re: [PATCH 06/38] powerpc: Move 64-bit feature fixup earlier
Quoted 26 lines · Benjamin Herrenschmidt
Make it part of
early_setup()as we really want the feature fixups to be applied before we turn on the MMU since they can have an impact on the various assembly path related to MMU management and interrupts.This makes 64-bit match what 32-bit does.
Signed-off-by Benjamin Herrenschmidt <[email protected]>--- arch/powerpc/kernel/setup_64.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)arch/powerpc/kernel/setup_64.c +3
-0@@ -286,6 +286,9 @@ void __init early_setup(unsigned long dt_ptr)/* Initialize the hash table or TLB handling */ early_init_mmu (); +/* Apply all the dynamic patching */ +apply_feature_fixups (); +/* * At this point, we can let interrupts switch to virtual mode * (the MMU has been setup), so adjust the MSR in the PACA to
arch/powerpc/kernel/setup_64.c void __init setup_system(void) · line 476
Quoted 8 lines
arch/powerpc/kernel/setup_64.c +0
-2@@ -468,8 +471,6 @@ void __init setup_system(void) {DBG (" -> setup_system()\n" ); -apply_feature_fixups (); -/* * Unflatten the device-tree passed by prom_init or kexec */
Why not move it immediately after we finish all the device tress scan.
ie,
early_init_devtree(__va(dt_ptr)); epapr_paravirt_early_init();
+ apply_feature_fixups(); /* Now we know the logical id of our boot cpu, setup the paca. */ setup_paca(&paca[boot_cpuid]); fixup_boot_paca();
Also with a comment explaining why we can't move it further up ?
-aneesh
Re: [PATCH 06/38] powerpc: Move 64-bit feature fixup earlier
Quoted 2 lines · Aneesh Kumar K.V
Why not move it immediately after we finish all the device tress scan.
Do you need it in early_init_mmu ? The important thing is to have it done before we *turn on* the MMU but yeah, there's no big deal moving it even further up I think..
Quoted 5 lines
ie,
early_init_devtree(__va(dt_ptr));epapr_paravirt_early_init();
Quoted 7 lines
+
apply_feature_fixups();
/* Now we know the logical id of our boot cpu, setup the paca. */
setup_paca(&paca[boot_cpuid]);fixup_boot_paca();Also with a comment explaining why we can't move it further up ?
Yup, adding some comments about the why things are done in that order would be good, I'll improve that
Cheers,
Ben.
Re: [PATCH 06/38] powerpc: Move 64-bit feature fixup earlier
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 2 lines · Aneesh Kumar K.V
Why not move it immediately after we finish all the device tress scan.
Do you need it in
early_init_mmu? The important thing is to have it done before we *turn on* the MMU but yeah, there's no big deal moving it even further up I think..
If we can do feature fixup early. Then this patch series become simpler.
https://lkml.kernel.org/r/1465887288-12952-1-git-send-email-aneesh.kumar@li=
nux.vnet.ibm.com
ie, we can now start using cpu_has_feature/mmu_has_feature early instead of using __cpu/mmu_has_feature.
Quoted 3 lines
Quoted 3 lines
ie, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0early_init_devtree(__va(=
dt_ptr));
Quoted 2 lines
Quoted 2 lines
=20 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0epapr_paravirt_early_ini=
t();
Quoted 3 lines
Quoted 3 lines
=20
=C2=A0 +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0apply_feature_fixups(); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* Now we know the logic=
al id of our boot cpu, setup the
Quoted 2 lines
Quoted 2 lines
paca. */ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0setup_paca(&paca[boot_cp=
uid]);
Quoted 9 lines
Quoted 3 lines
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0fixup_boot_paca(); =20
Also with a comment explaining why we can't move it further up ?Yup, adding some comments about the why things are done in that order would be good, I'll improve that
Cheers,
Ben.
-aneesh
Re: [PATCH 06/38] powerpc: Move 64-bit feature fixup earlier
Quoted 8 lines · Aneesh Kumar K.V
If we can do feature fixup early. Then this patch series become simpler.
https://lkml.kernel.org/r/1465887288-12952-1-git-send-email-aneesh.ku
[email protected]ie, we can now start using cpu_has_feature/mmu_has_feature early instead of using __cpu/mmu_has_feature.
Ok, I'll look into it tomorrow.
Cheers,
Ben.
PATCH 7/38 powerpc: Move 64-bit memory reserves to setup_arch()
In reply to Benjamin HerrenschmidtThere is really no need to do them that early, early_setup() runs before MMU is on, we should do the strict minimum there to get the MMU going.
--- arch/powerpc/kernel/setup_64.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
arch/powerpc/kernel/setup_64.c +11 -11
@@ -296,16 +296,6 @@ void __init early_setup(unsigned long dt_ptr)*/ cpu_ready_for_interrupts (); -/* Reserve large chunks of memory for use by CMA for KVM */ -kvm_cma_reserve (); - -/* -* Reserve any gigantic pages requested on the command line. -* memblock needs to have been initialized by the time this is -* called since this will reserve memory. -*/ -reserve_hugetlb_gpages (); -DBG (" <- early_setup()\n" );#ifdef CONFIG_PPC_EARLY_DEBUG_BOOTX
@@ -688,6 +678,17 @@ void __init setup_arch(char **cmdline_p) dcache_bsize = ppc64_caches.dline_size; icache_bsize = ppc64_caches.iline_size; + +/* Reserve large chunks of memory for use by CMA for KVM */ +kvm_cma_reserve (); + +/* +* Reserve any gigantic pages requested on the command line. +* memblock needs to have been initialized by the time this is +* called since this will reserve memory. +*/ +reserve_hugetlb_gpages (); +if (ppc_md.panic)setup_panic ();
@@ -712,7 +713,6 @@ void __init setup_arch(char **cmdline_p)#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;#endif -if (ppc_md.setup_arch) ppc_md.setup_arch ();
Signature · 1 line
2.7.4
PATCH 8/38 powerpc: Move epapr_paravirt_early_init() to early_init_devtree()
In reply to Benjamin HerrenschmidtThe function is called by both 32-bit and 64-bit early setup right after early_init_devtree(). All it does is run yet another early DT parser which is precisely what early_init_devtree() is about, so move it in there.
--- arch/powerpc/kernel/prom.c | 2 ++ arch/powerpc/kernel/setup_32.c | 3 --- arch/powerpc/kernel/setup_64.c | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-)
arch/powerpc/kernel/prom.c +2 -0
@@ -56,6 +56,7 @@#include <asm/opal.h> #include <asm/fadump.h> #include <asm/debug.h> +#include <asm/epapr_hcalls.h> #include <mm/mmu_decl.h>
@@ -739,6 +740,7 @@ void __init early_init_devtree(void *params)/* Scan and build the list of machine check recoverable ranges */ of_scan_flat_dt (early_init_dt_scan_recoverable_ranges,NULL );#endif +epapr_paravirt_early_init ();DBG (" <- early_init_devtree()\n" ); }
arch/powerpc/kernel/setup_32.c +0 -3
@@ -37,7 +37,6 @@#include <asm/serial.h> #include <asm/udbg.h> #include <asm/mmu_context.h> -#include <asm/epapr_hcalls.h> #include <asm/code-patching.h> #define DBG(fmt...)
@@ -110,8 +109,6 @@ notrace void __init machine_init(u64 dt_ptr)/* Do some early initialization based on the flat device tree */ early_init_devtree (__va (dt_ptr)); -epapr_paravirt_early_init (); -early_init_mmu ();probe_machine ();
arch/powerpc/kernel/setup_64.c +0 -3
@@ -68,7 +68,6 @@#include <asm/code-patching.h> #include <asm/kvm_ppc.h> #include <asm/hugetlb.h> -#include <asm/epapr_hcalls.h> #include <asm/livepatch.h> #ifdef DEBUG
@@ -270,8 +269,6 @@ void __init early_setup(unsigned long dt_ptr)*/ early_init_devtree (__va (dt_ptr)); -epapr_paravirt_early_init (); -/* Now we know the logical id of our boot cpu, setup the paca. */ setup_paca (&paca[boot_cpuid]);fixup_boot_paca ();
Signature · 1 line
2.7.4
PATCH 9/38 powerpc: Update obsolete comments in setup_32.c about entry conditions
In reply to Benjamin Herrenschmidtearly_init() is called in-place before kernel relocation and using whatever MMU setup exists at the point the kernel is entered.
machine_init() is called after relocation and after some initial mapping of PAGE_OFFSET has been established (typically using BATs on 6xx/7xx/7xxx processors or some form of bolted TLB on others).
--- arch/powerpc/kernel/setup_32.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/powerpc/kernel/setup_32.c +5 -3
@@ -61,9 +61,7 @@ int icache_bsize;int ucache_bsize;/* -* We're called here very early in the boot. We determine the machine -* type and call the appropriate low-level setup functions. -* -- Cort <[email protected]> +* We're called here very early in the boot. * * Note that the kernel may be running at an address which is different * from the address that it was linked at, so we must use RELOC/PTRRELOC
@@ -91,6 +89,10 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)/* +* This is run before start_kernel(), the kernel has been relocated +* and we are running with enough of the MMU enabled to have our +* proper kernel virtual addresses +* * Find out what kind of machine we're on and save any data we need * from the early boot process (devtree is copied on pmac by prom_init()). * This is called very early on the boot process, after a minimal
Signature · 1 line
2.7.4
PATCH 10/38 powerpc: Add comment explaining the purpose of setup_kdump_trampoline()
In reply to Benjamin HerrenschmidtAnything in early_setup() needs to be justified to be there, in this case, we need the trampolines before we can take exceptions and thus before we turn on the MMU.
Also remove a pretty meaningless and misplaced debug message
--- arch/powerpc/kernel/setup_64.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/kernel/setup_64.c +3 -2
@@ -276,10 +276,11 @@ void __init early_setup(unsigned long dt_ptr)/* Probe the machine type */ probe_machine (); +/* Setup the trampolines from the lowmem exception vectors +* to the kdump kernel when not using a relocatable kernel. +*/ setup_kdump_trampoline (); -DBG ("Found, Initializing memory management...\n" ); -/* Initialize the hash table or TLB handling */ early_init_mmu ();
Signature · 1 line
2.7.4
PATCH 11/38 powerpc/dart: Use a cachable DART
In reply to Benjamin HerrenschmidtInstead of punching a hole in the linear mapping, just use normal cachable memory, and apply the flush sequence documented in the CPC625 (aka U3) user manual.
This allows us to remove quite a bit of code related to the early allocation of the DART and the hole in the linear mapping. We can also get rid of the copy of the DART for suspend/resume as the original memory can just be saved/restored now, as long as we properly sync the caches.
--- arch/powerpc/include/asm/iommu.h | 1 - arch/powerpc/mm/hash_utils_64.c | 32 ------ arch/powerpc/platforms/maple/setup.c | 7 -- arch/powerpc/platforms/powermac/setup.c | 8 -- arch/powerpc/sysdev/dart_iommu.c | 180 +++++++++++++++----------------- 5 files changed, 84 insertions(+), 144 deletions(-)
arch/powerpc/include/asm/iommu.h +0 -1
@@ -273,7 +273,6 @@ extern void iommu_init_early_pSeries(void);extern void iommu_init_early_dart (struct pci_controller_ops *controller_ops);extern void iommu_init_early_pasemi (void ); -extern void alloc_dart_table (void );#if defined(CONFIG_PPC64 ) && defined(CONFIG_PM )static inline void iommu_save (void ) {
arch/powerpc/mm/hash_utils_64.c +0 -32
@@ -87,10 +87,6 @@* */ -#ifdef CONFIG_U3_DART -extern unsigned long dart_tablebase; -#endif /* CONFIG_U3_DART */ -static unsigned long _SDR1;struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT ];EXPORT_SYMBOL_GPL (mmu_psize_defs);
@@ -828,34 +824,6 @@ static void __init htab_initialize(void)DBG ("creating mapping for region: %lx..%lx (prot: %lx)\n" , base, size, prot); -#ifdef CONFIG_U3_DART -/* Do not map the DART space. Fortunately, it will be aligned -* in such a way that it will not cross two memblock regions and -* will fit within a single 16Mb page. -* The DART space is assumed to be a full 16Mb region even if -* we only use 2Mb of that space. We will use more of it later -* for AGP GART. We have to use a full 16Mb large page. -*/ -DBG ("DART base: %lx\n" , dart_tablebase); - -if (dart_tablebase !=0 && dart_tablebase >= base - && dart_tablebase < (base + size)) { -unsigned long dart_table_end = dart_tablebase +16 *MB ; -if (base != dart_tablebase) -BUG_ON (htab_bolt_mapping (base, dart_tablebase, -__pa (base), prot, - mmu_linear_psize, - mmu_kernel_ssize)); -if ((base + size) > dart_table_end) -BUG_ON (htab_bolt_mapping (dart_tablebase+16 *MB , - base + size, -__pa (dart_table_end), - prot, - mmu_linear_psize, - mmu_kernel_ssize)); -continue ; - } -#endif /* CONFIG_U3_DART */ BUG_ON (htab_bolt_mapping (base, base + size,__pa (base), prot, mmu_linear_psize, mmu_kernel_ssize)); }
arch/powerpc/platforms/maple/setup.c +0 -7
@@ -303,13 +303,6 @@ static int __init maple_probe(void)if (!of_flat_dt_is_compatible (root,"Momentum,Maple" ) && !of_flat_dt_is_compatible (root,"Momentum,Apache" ))return 0 ; -/* -* On U3, the DART (iommu) must be allocated now since it -* has an impact on htab_initialize (due to the large page it -* occupies having to be broken up so the DART itself is not -* part of the cacheable linar mapping -*/ -alloc_dart_table ();hpte_init_native (); pm_power_off = maple_power_off;
arch/powerpc/platforms/powermac/setup.c +0 -8
@@ -605,14 +605,6 @@ static int __init pmac_probe(void)return 0 ;#ifdef CONFIG_PPC64 -/* -* On U3, the DART (iommu) must be allocated now since it -* has an impact on htab_initialize (due to the large page it -* occupies having to be broken up so the DART itself is not -* part of the cacheable linar mapping -*/ -alloc_dart_table (); -hpte_init_native ();#endif
arch/powerpc/sysdev/dart_iommu.c +84 -96
273 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 12/38 powerpc: Move FW feature probing out of pseries probe()
In reply to Benjamin HerrenschmidtWe move the function itself to pseries/firmware.c and call it along with almost all other flat device-tree parsers from early_init_devtree()
--- arch/powerpc/include/asm/firmware.h | 4 +++ arch/powerpc/kernel/prom.c | 6 +++++ arch/powerpc/platforms/pseries/firmware.c | 44 +++++++++++++++++++++++++++++-- arch/powerpc/platforms/pseries/pseries.h | 5 ---- arch/powerpc/platforms/pseries/setup.c | 41 ---------------------------- 5 files changed, 52 insertions(+), 48 deletions(-)
arch/powerpc/include/asm/firmware.h +4 -0
@@ -126,6 +126,10 @@ extern int fwnmi_active;extern unsigned int __start___fw_ftr_fixup, __stop___fw_ftr_fixup; +int pseries_probe_fw_features (unsigned long node, +const char *uname,int depth, +void *data); +#endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* __ASM_POWERPC_FIRMWARE_H */
arch/powerpc/kernel/prom.c +6 -0
@@ -57,6 +57,7 @@#include <asm/fadump.h> #include <asm/debug.h> #include <asm/epapr_hcalls.h> +#include <asm/firmware.h> #include <mm/mmu_decl.h>
@@ -740,8 +741,13 @@ void __init early_init_devtree(void *params)/* Scan and build the list of machine check recoverable ranges */ of_scan_flat_dt (early_init_dt_scan_recoverable_ranges,NULL );#endif +epapr_paravirt_early_init (); +#ifdef CONFIG_PPC_PSERIES +/* Now try to figure out if we are running on LPAR */ +of_scan_flat_dt (pseries_probe_fw_features,NULL ); +#endif DBG (" <- early_init_devtree()\n" ); }
arch/powerpc/platforms/pseries/firmware.c +42 -2
59 lines not on this page · raw message
arch/powerpc/platforms/pseries/pseries.h +0 -5
@@ -20,11 +20,6 @@ extern void request_event_sources_irqs(struct device_node *np,#include <linux/of.h> -extern void __init fw_hypertas_feature_init (const char *hypertas, -unsigned long len); -extern void __init fw_vec5_feature_init (const char *hypertas, -unsigned long len); -struct pt_regs ;extern int pSeries_system_reset_exception (struct pt_regs *regs);
arch/powerpc/platforms/pseries/setup.c +0 -41
53 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 13/38 powerpc: Put exception configuration in a common place
In reply to Benjamin HerrenschmidtThe various calls to establish exception endianness and AIL are now done from a single point using already established CPU and FW feature bits to decide what to do.
--- arch/powerpc/include/asm/opal.h | 1 + arch/powerpc/kernel/setup_64.c | 68 +++++++++++++++++++++++++++------- arch/powerpc/platforms/powernv/opal.c | 13 +++---- arch/powerpc/platforms/pseries/setup.c | 29 --------------- 4 files changed, 60 insertions(+), 51 deletions(-)
arch/powerpc/include/asm/opal.h +1 -0
@@ -215,6 +215,7 @@ extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data);extern int early_init_dt_scan_recoverable_ranges (unsigned long node,const char *uname,int depth,void *data); +extern void opal_configure_cores (void );extern int opal_get_chars (uint32_t vtermno,char *buf,int count);extern int opal_put_chars (uint32_t vtermno,const char *buf,int total_len);
arch/powerpc/kernel/setup_64.c +54 -14
91 lines not on this page · raw message
arch/powerpc/platforms/powernv/opal.c +5 -8
@@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(opal_write_lock);static struct atomic_notifier_head opal_msg_notifier_head[OPAL_MSG_TYPE_MAX ];static uint32_t opal_heartbeat; -static void opal_reinit_cores (void ) +void opal_configure_cores (void ) {/* Do the actual re-init, This will clobber all FPRs, VRs, etc... *
@@ -69,6 +69,10 @@ static void opal_reinit_cores(void)#else opal_reinit_cpus (OPAL_REINIT_CPUS_HILE_LE );#endif + +/* Restore some bits */ +if (cur_cpu_spec->cpu_restore) + cur_cpu_spec->cpu_restore (); } int __init early_init_dt_scan_opal(unsigned long node,
@@ -105,13 +109,6 @@ int __init early_init_dt_scan_opal(unsigned long node,panic ("OPAL != V3 detected, no longer supported.\n" ); } -/* Reinit all cores with the right endian */ -opal_reinit_cores (); - -/* Restore some bits */ -if (cur_cpu_spec->cpu_restore) - cur_cpu_spec->cpu_restore (); -return 1 ; }
arch/powerpc/platforms/pseries/setup.c +0 -29
@@ -537,18 +537,6 @@ static void __init pSeries_setup_arch(void) } ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare; - -if (firmware_has_feature (FW_FEATURE_SET_MODE )) { -long rc; - - rc =pSeries_enable_reloc_on_exc (); -if (rc ==H_P2 ) { -pr_info ("Relocation on exceptions not supported\n" ); - }else if (rc !=H_SUCCESS ) { -pr_warn ("Unable to enable relocation on exceptions: " -"%ld\n" , rc); - } - } }static int __init pSeries_init_panel (void )
@@ -751,23 +739,6 @@ static int __init pSeries_probe(void)pr_debug ("pSeries detected, looking for LPAR capability...\n" ); - -#ifdef __LITTLE_ENDIAN__ -if (firmware_has_feature (FW_FEATURE_SET_MODE )) { -long rc; -/* -* Tell the hypervisor that we want our exceptions to -* be taken in little endian mode. If this fails we don't -* want to use BUG() because it will trigger an exception. -*/ - rc =pseries_little_endian_exceptions (); -if (rc) { - ppc_md.progress ("H_SET_MODE LE exception fail" ,0 ); -panic ("Could not enable little endian exceptions" ); - } - } -#endif -if (firmware_has_feature (FW_FEATURE_LPAR ))hpte_init_lpar ();else
Signature · 1 line
2.7.4
PATCH v2 13/38 powerpc: Put exception configuration in a common place
The various calls to establish exception endianness and AIL are now done from a single point using already established CPU and FW feature bits to decide what to do.
---
v2: Add/fix prototypes of exported function, remove "static"
arch/powerpc/include/asm/hvcall.h | 8 ++-- arch/powerpc/include/asm/opal.h | 1 + arch/powerpc/kernel/setup_64.c | 68 +++++++++++++++++++++++++++------- arch/powerpc/platforms/powernv/opal.c | 13 +++---- arch/powerpc/platforms/pseries/setup.c | 31 +--------------- 5 files changed, 66 insertions(+), 55 deletions(-)
arch/powerpc/include/asm/hvcall.h +5 -3
@@ -434,13 +434,15 @@ static inline unsigned long cmo_get_page_size(void)extern long pSeries_enable_reloc_on_exc (void );extern long pSeries_disable_reloc_on_exc (void ); -extern long pseries_big_endian_exceptions (void ); +extern long pseries_little_endian_exceptions (void );#else -#define pSeries_enable_reloc_on_exc () do {} while (0) -#define pSeries_disable_reloc_on_exc () do {} while (0) +#define pSeries_enable_reloc_on_exc () (0) +#define pSeries_disable_reloc_on_exc () (0) +#define pseries_big_endian_exceptions () (0) +#define pseries_little_endian_exceptions () (0)#endif /* CONFIG_PPC_PSERIES */
arch/powerpc/include/asm/opal.h +1 -0
@@ -215,6 +215,7 @@ extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data);extern int early_init_dt_scan_recoverable_ranges (unsigned long node,const char *uname,int depth,void *data); +extern void opal_configure_cores (void );extern int opal_get_chars (uint32_t vtermno,char *buf,int count);extern int opal_put_chars (uint32_t vtermno,const char *buf,int total_len);
arch/powerpc/kernel/setup_64.c +54 -14
91 lines not on this page · raw message
arch/powerpc/platforms/powernv/opal.c +5 -8
@@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(opal_write_lock);static struct atomic_notifier_head opal_msg_notifier_head[OPAL_MSG_TYPE_MAX ];static uint32_t opal_heartbeat; -static void opal_reinit_cores (void ) +void opal_configure_cores (void ) {/* Do the actual re-init, This will clobber all FPRs, VRs, etc... *
@@ -69,6 +69,10 @@ static void opal_reinit_cores(void)#else opal_reinit_cpus (OPAL_REINIT_CPUS_HILE_LE );#endif + +/* Restore some bits */ +if (cur_cpu_spec->cpu_restore) + cur_cpu_spec->cpu_restore (); } int __init early_init_dt_scan_opal(unsigned long node,
@@ -105,13 +109,6 @@ int __init early_init_dt_scan_opal(unsigned long node,panic ("OPAL != V3 detected, no longer supported.\n" ); } -/* Reinit all cores with the right endian */ -opal_reinit_cores (); - -/* Restore some bits */ -if (cur_cpu_spec->cpu_restore) - cur_cpu_spec->cpu_restore (); -return 1 ; }
arch/powerpc/platforms/pseries/setup.c +1 -30
@@ -458,7 +458,7 @@ long pseries_big_endian_exceptions(void) } } -static long pseries_little_endian_exceptions (void ) +long pseries_little_endian_exceptions (void ) {long rc;
@@ -537,18 +537,6 @@ static void __init pSeries_setup_arch(void) } ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare; - -if (firmware_has_feature (FW_FEATURE_SET_MODE )) { -long rc; - - rc =pSeries_enable_reloc_on_exc (); -if (rc ==H_P2 ) { -pr_info ("Relocation on exceptions not supported\n" ); - }else if (rc !=H_SUCCESS ) { -pr_warn ("Unable to enable relocation on exceptions: " -"%ld\n" , rc); - } - } }static int __init pSeries_init_panel (void )
@@ -751,23 +739,6 @@ static int __init pSeries_probe(void)pr_debug ("pSeries detected, looking for LPAR capability...\n" ); - -#ifdef __LITTLE_ENDIAN__ -if (firmware_has_feature (FW_FEATURE_SET_MODE )) { -long rc; -/* -* Tell the hypervisor that we want our exceptions to -* be taken in little endian mode. If this fails we don't -* want to use BUG() because it will trigger an exception. -*/ - rc =pseries_little_endian_exceptions (); -if (rc) { - ppc_md.progress ("H_SET_MODE LE exception fail" ,0 ); -panic ("Could not enable little endian exceptions" ); - } - } -#endif -if (firmware_has_feature (FW_FEATURE_LPAR ))hpte_init_lpar ();else
Re: [PATCH 13/38] powerpc: Put exception configuration in a common place
In reply to Benjamin HerrenschmidtHi Ben,
Quoted 5 lines
The various calls to establish exception endianness and AIL are now done from a single point using already established CPU and FW feature bits to decide what to do.
Signed-off-by Benjamin Herrenschmidt <[email protected]>
...
+static void configure_exceptions(void)
+{
+ /* Setup the trampolines from the lowmem exception vectors
+ * to the kdump kernel when not using a relocatable kernel.
+ */
+ setup_kdump_trampoline();
+
+ /* Under a PAPR hypervisor, we need hypercalls */
+ if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
+ long rc;
+
+ /* Enable AIL */
+ rc = pSeries_enable_reloc_on_exc();
+ if (rc == H_P2) {
+ pr_info("Relocation on exceptions not supported\n");
+ } else if (rc != H_SUCCESS) {
+ pr_warn("Unable to enable relocation on exceptions: "
+ "%ld\n", rc);
+ }
+
+ /*
+ * Tell the hypervisor that we want our exceptions to
+ * be taken in little endian mode. If this fails we don't
+ * want to use BUG() because it will trigger an exception.
+ *
+ * We don't call this for big endian as our calling convention
+ * makes us always enter in BE, and the call may fail under
+ * some circumstances with kdump.
+ */
+#ifdef __LITTLE_ENDIAN__
+ rc = pseries_little_endian_exceptions();
+ if (rc) {
+ ppc_md.progress("H_SET_MODE LE exception fail", 0);
+ panic("Could not enable little endian exceptions");
+ }
+#endif
+ } else {
+ /* Set endian mode using OPAL */
+ if (firmware_has_feature(FW_FEATURE_OPAL))
+ opal_configure_cores();
+
+ /* Enable AIL if supported, and we are in hypervisor mode */
+ if (cpu_has_feature(CPU_FTR_HVMODE) &&
+ cpu_has_feature(CPU_FTR_ARCH_207S)) {
+ unsigned long lpcr = mfspr(SPRN_LPCR);
+ mtspr(SPRN_LPCR, lpcr | LPCR_AIL_3);
+ }
+ }
+}
It looks like we only set LPCR_AIL_3 on the boot CPU after this change, is that expected? Before that we did it in cpu_ready_for_interrupts() which is called for the primary and all secondary CPUs.
Anton
Re: [PATCH 13/38] powerpc: Put exception configuration in a common place
Quoted 3 lines · Anton Blanchard
It looks like we only set
LPCR_AIL_3on the boot CPU after this change, is that expected? Before that we did it incpu_ready_for_interrupts()which is called for the primary and all secondary CPUs.
That would be a mistake... I suppose I didn't realize we had to call these things for every CPU.
I'll try to cook up a fix next week.
Cheers,
Ben.
PATCH 14/38 powerpc/pmac: Remove early allocation of the SMU command buffer
In reply to Benjamin HerrenschmidtThe SMU command buffer needs to be allocated below 2G using memblock.
In the past, this had to be done very early from the arch code as memblock wasn't available past that point. That is no longer the case though, smu_init() is called from setup_arch() when memblock is still functional these days. So move the allocation to the SMU driver itself.
--- arch/powerpc/include/asm/smu.h | 7 ------- arch/powerpc/platforms/powermac/setup.c | 16 ---------------- drivers/macintosh/smu.c | 9 ++++++++- 3 files changed, 8 insertions(+), 24 deletions(-)
arch/powerpc/include/asm/smu.h +0 -7
@@ -471,13 +471,6 @@ extern int smu_get_rtc_time(struct rtc_time *time, int spinwait);extern int smu_set_rtc_time (struct rtc_time *time,int spinwait);/* -* SMU command buffer absolute address, exported by pmac_setup, -* this is allocated very early during boot. -*/ -extern unsigned long smu_cmdbuf_abs; - - -/* * Kernel asynchronous i2c interface */
arch/powerpc/platforms/powermac/setup.c +0 -16
@@ -52,7 +52,6 @@#include <linux/suspend.h> #include <linux/of_device.h> #include <linux/of_platform.h> -#include <linux/memblock.h> #include <asm/reg.h> #include <asm/sections.h>
@@ -97,11 +96,6 @@ int sccdbg;sys_ctrler_t sys_ctrler =SYS_CTRLER_UNKNOWN ;EXPORT_SYMBOL (sys_ctrler); -#ifdef CONFIG_PMAC_SMU -unsigned long smu_cmdbuf_abs; -EXPORT_SYMBOL (smu_cmdbuf_abs); -#endif -static void pmac_show_cpuinfo (struct seq_file *m) {struct device_node *np;
@@ -325,7 +319,6 @@ static void __init pmac_setup_arch(void)defined (CONFIG_PPC64)pmac_nvram_init ();#endif -#ifdef CONFIG_PPC32 #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start)
@@ -615,15 +608,6 @@ static int __init pmac_probe(void)DMA_MODE_WRITE =2 ;#endif /* CONFIG_PPC32 */ -#ifdef CONFIG_PMAC_SMU -/* -* SMU based G5s need some memory below 2Gb, at least the current -* driver needs that. We have to allocate it now. We allocate 4k -* (1 small page) for now. -*/ - smu_cmdbuf_abs =memblock_alloc_base (4096 ,4096 ,0x80000000UL ); -#endif /* CONFIG_PMAC_SMU */ - pm_power_off = pmac_power_off;return 1 ;
drivers/macintosh/smu.c +8 -1
@@ -38,6 +38,7 @@#include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/slab.h> +#include <linux/memblock.h> #include <asm/byteorder.h> #include <asm/io.h>
@@ -99,6 +100,7 @@ static DEFINE_MUTEX(smu_mutex);static struct smu_device *smu;static DEFINE_MUTEX (smu_part_access);static int smu_irq_inited; +static unsigned long smu_cmdbuf_abs;static void smu_i2c_retry (unsigned long data);
@@ -479,8 +481,13 @@ int __init smu_init (void)printk (KERN_INFO "SMU: Driver %s %s\n" ,VERSION ,AUTHOR ); +/* +* SMU based G5s need some memory below 2Gb. Thankfully this is +* called at a time where memblock is still available. +*/ + smu_cmdbuf_abs =memblock_alloc_base (4096 ,4096 ,0x80000000UL );if (smu_cmdbuf_abs ==0 ) { -printk (KERN_ERR "SMU: Command buffer not allocated !\n" ); +printk (KERN_ERR "SMU: Command buffer allocation failed !\n" ); ret = -EINVAL ; goto fail_np; }
Signature · 1 line
2.7.4
PATCH 15/38 powerpc/64: Move MMU backend selection out of platform code
In reply to Benjamin HerrenschmidtWe move it into early_mmu_init() based on firmware features. For PS3, we have to move the setting of these into early_init_devtree().
--- arch/powerpc/include/asm/ps3.h | 2 ++ arch/powerpc/kernel/prom.c | 7 +++++++ arch/powerpc/mm/hash_utils_64.c | 9 +++++++++ arch/powerpc/mm/pgtable-radix.c | 1 + arch/powerpc/platforms/cell/setup.c | 1 - arch/powerpc/platforms/maple/setup.c | 1 - arch/powerpc/platforms/pasemi/setup.c | 2 -- arch/powerpc/platforms/powermac/setup.c | 4 ---- arch/powerpc/platforms/powernv/setup.c | 5 ----- arch/powerpc/platforms/ps3/setup.c | 15 +++++++++------ arch/powerpc/platforms/pseries/setup.c | 7 ------- 11 files changed, 28 insertions(+), 26 deletions(-)
arch/powerpc/include/asm/ps3.h +2 -0
@@ -526,4 +526,6 @@ void ps3_sync_irq(int node);u32 ps3_get_hw_thread_id (int cpu);u64 ps3_get_spe_id (void *arg); +void ps3_early_mm_init (void ); +#endif
arch/powerpc/kernel/prom.c +7 -0
@@ -748,6 +748,13 @@ void __init early_init_devtree(void *params)/* Now try to figure out if we are running on LPAR */ of_scan_flat_dt (pseries_probe_fw_features,NULL );#endif + +#ifdef CONFIG_PPC_PS3 +/* Identify PS3 firmware */ +if (of_flat_dt_is_compatible (of_get_flat_dt_root (),"sony,ps3" )) + powerpc_firmware_features |=FW_FEATURE_PS3_POSSIBLE ; +#endif +DBG (" <- early_init_devtree()\n" ); }
arch/powerpc/mm/hash_utils_64.c +9 -0
@@ -58,6 +58,7 @@#include <asm/firmware.h> #include <asm/tm.h> #include <asm/trace.h> +#include <asm/ps3.h> #ifdef DEBUG #define DBG(fmt...) udbg_printf(fmt)
@@ -886,6 +887,14 @@ void __init hash__early_init_mmu(void) vmemmap = (struct page *)H_VMEMMAP_BASE ; ioremap_bot =IOREMAP_BASE ; +/* Select appropriate backend */ +if (firmware_has_feature (FW_FEATURE_PS3_LV1 )) +ps3_early_mm_init (); +else if (firmware_has_feature (FW_FEATURE_LPAR )) +hpte_init_lpar (); +else +hpte_init_native (); +/* Initialize the MMU Hash table and create the linear mapping * of memory. Has to be done before SLB initialization as this is * currently where the page size encoding is obtained.
arch/powerpc/mm/pgtable-radix.c +1 -0
@@ -339,6 +339,7 @@ void __init radix__early_init_mmu(void)radix_init_page_sizes ();if (!firmware_has_feature (FW_FEATURE_LPAR )) { +radix_init_native (); lpcr =mfspr (SPRN_LPCR );mtspr (SPRN_LPCR , lpcr |LPCR_UPRT );radix_init_partition_table ();
arch/powerpc/platforms/cell/setup.c +0 -1
@@ -261,7 +261,6 @@ static int __init cell_probe(void) !of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))return 0 ; -hpte_init_native (); pm_power_off = rtas_power_off;return 1 ;
arch/powerpc/platforms/maple/setup.c +0 -1
@@ -304,7 +304,6 @@ static int __init maple_probe(void) !of_flat_dt_is_compatible(root, "Momentum,Apache"))return 0 ; -hpte_init_native (); pm_power_off = maple_power_off;return 1 ;
arch/powerpc/platforms/pasemi/setup.c +0 -2
@@ -426,8 +426,6 @@ static int __init pas_probe(void) !of_flat_dt_is_compatible(root, "pasemi,pwrficient"))return 0 ; -hpte_init_native (); -alloc_iobmap_l2 ();return 1 ;
arch/powerpc/platforms/powermac/setup.c +0 -4
@@ -597,10 +597,6 @@ static int __init pmac_probe(void) !of_flat_dt_is_compatible(root, "MacRISC"))return 0 ; -#ifdef CONFIG_PPC64 -hpte_init_native (); -#endif -#ifdef CONFIG_PPC32 /* isa_io_base gets set in pmac_pci_init */ ISA_DMA_THRESHOLD = ~0L ;
arch/powerpc/platforms/powernv/setup.c +0 -5
@@ -273,11 +273,6 @@ static int __init pnv_probe(void)if (!of_flat_dt_is_compatible (root,"ibm,powernv" ))return 0 ; -if (IS_ENABLED (CONFIG_PPC_RADIX_MMU ) &&radix_enabled ()) -radix_init_native (); -else if (IS_ENABLED (CONFIG_PPC_STD_MMU_64 )) -hpte_init_native (); -if (firmware_has_feature (FW_FEATURE_OPAL ))pnv_setup_machdep_opal ();
arch/powerpc/platforms/ps3/setup.c +9 -6
@@ -226,9 +226,17 @@ static void __init ps3_progress(char *s, unsigned short hex)printk ("*** %04x : %s\n" , hex, s ? s :"" ); } -static int __init ps3_probe (void ) +void __init ps3_early_mm_init (void ) {unsigned long htab_size; + +ps3_mm_init (); +ps3_mm_vas_create (&htab_size); +ps3_hpte_init (htab_size); +} + +static int __init ps3_probe (void ) +{unsigned long dt_root;DBG (" -> %s:%d\n" , __func__, __LINE__);
@@ -237,12 +245,7 @@ static int __init ps3_probe(void)if (!of_flat_dt_is_compatible (dt_root,"sony,ps3" ))return 0 ; - powerpc_firmware_features |=FW_FEATURE_PS3_POSSIBLE ; -ps3_os_area_save_params (); -ps3_mm_init (); -ps3_mm_vas_create (&htab_size); -ps3_hpte_init (htab_size); pm_power_off = ps3_power_off;DBG (" <- %s:%d\n" , __func__, __LINE__);
arch/powerpc/platforms/pseries/setup.c +0 -7
@@ -737,13 +737,6 @@ static int __init pSeries_probe(void) of_flat_dt_is_compatible(root, "IBM,CBEA"))return 0 ; -pr_debug ("pSeries detected, looking for LPAR capability...\n" ); - -if (firmware_has_feature (FW_FEATURE_LPAR )) -hpte_init_lpar (); -else -hpte_init_native (); - pm_power_off = pseries_power_off; pr_debug("Machine is%s LPAR !\n",
Signature · 1 line
2.7.4
PATCH 16/38 powerpc/pasemi: Remove IOBMAP allocation from platform probe()
In reply to Benjamin HerrenschmidtThese days, memblocks is available later, so we can just allocate it as part of iob_init.
--- arch/powerpc/platforms/pasemi/iommu.c | 15 +++++---------- arch/powerpc/platforms/pasemi/pasemi.h | 1 - arch/powerpc/platforms/pasemi/setup.c | 2 -- 3 files changed, 5 insertions(+), 13 deletions(-)
arch/powerpc/platforms/pasemi/iommu.c +5 -10
@@ -202,6 +202,11 @@ int __init iob_init(struct device_node *dn)pr_debug (" -> %s\n" , __func__); +/* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */ + iob_l2_base = (u32 *)__va (memblock_alloc_base (1UL <<21 ,1UL <<21 ,0x80000000 )); + +printk (KERN_INFO "IOBMAP L2 allocated at: %p\n" , iob_l2_base); +/* Allocate a spare page to map all invalid IOTLB pages. */ tmp =memblock_alloc (IOBMAP_PAGE_SIZE ,IOBMAP_PAGE_SIZE );if (!tmp)
@@ -260,13 +265,3 @@ void __init iommu_init_early_pasemi(void)set_pci_dma_ops (&dma_iommu_ops); } -void __init alloc_iobmap_l2 (void ) -{ -#ifndef CONFIG_PPC_PASEMI_IOMMU -return ; -#endif -/* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */ - iob_l2_base = (u32 *)__va (memblock_alloc_base (1UL <<21 ,1UL <<21 ,0x80000000 )); - -printk (KERN_INFO "IOBMAP L2 allocated at: %p\n" , iob_l2_base); -}
arch/powerpc/platforms/pasemi/pasemi.h +0 -1
@@ -8,7 +8,6 @@ extern void pas_pci_dma_dev_setup(struct pci_dev *dev);extern void __iomem *pasemi_pci_getcfgaddr (struct pci_dev *dev,int offset); -extern void __init alloc_iobmap_l2 (void );extern void __init pasemi_map_registers (void );/* Power savings modes, implemented in asm */
arch/powerpc/platforms/pasemi/setup.c +0 -2
@@ -426,8 +426,6 @@ static int __init pas_probe(void) !of_flat_dt_is_compatible(root, "pasemi,pwrficient"))return 0 ; -alloc_iobmap_l2 (); -return 1 ; }
Signature · 1 line
2.7.4
PATCH 17/38 powerpc/mm/hash: Don't use machine_is() early during boot
In reply to Benjamin HerrenschmidtUse the device-tree instead as we'll be moving probe_machine() out of early_setup
--- arch/powerpc/mm/hash_utils_64.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
arch/powerpc/mm/hash_utils_64.c +16 -9
@@ -34,6 +34,7 @@#include <linux/signal.h> #include <linux/memblock.h> #include <linux/context_tracking.h> +#include <linux/libfdt.h> #include <asm/processor.h> #include <asm/pgtable.h>
@@ -731,7 +732,7 @@ static void __init htab_initialize(void)unsigned long table;unsigned long pteg_count;unsigned long prot; -unsigned long base =0 , size =0 , limit; +unsigned long base =0 , size =0 ;struct memblock_region *reg;DBG (" -> htab_initialize()\n" );
@@ -757,7 +758,8 @@ static void __init htab_initialize(void) htab_hash_mask = pteg_count -1 ; -if (firmware_has_feature (FW_FEATURE_LPAR )) { +if (firmware_has_feature (FW_FEATURE_LPAR ) || +firmware_has_feature (FW_FEATURE_PS3_LV1 )) {/* Using a hypervisor which owns the htab */ htab_address =NULL ; _SDR1 =0 ;
@@ -772,16 +774,21 @@ static void __init htab_initialize(void) ppc_md.hpte_clear_all ();#endif }else { -/* Find storage for the HPT. Must be contiguous in -* the absolute address space. On cell we want it to be -* in the first 2 Gig so we can use it for IOMMU hacks. +unsigned long limit =MEMBLOCK_ALLOC_ANYWHERE ; + +#ifdef CONFIG_PPC_CELL +/* Cell may require the hash table down low when using the +* Axon IOMMU in order to fit the dynamic region over it, see +* comments in cell/iommu.c */ -if (machine_is (cell)) +if (fdt_subnode_offset (initial_boot_params,0 ,"axon" ) >0 ) { limit =0x80000000 ; -else - limit =MEMBLOCK_ALLOC_ANYWHERE ; +pr_info ("Hash table forced below 2G for Axon IOMMU\n" ); + } +#endif /* CONFIG_PPC_CELL */ - table =memblock_alloc_base (htab_size_bytes, htab_size_bytes, limit); + table =memblock_alloc_base (htab_size_bytes, htab_size_bytes, + limit);DBG ("Hash table allocated at %lx, size: %lx\n" , table, htab_size_bytes);
Signature · 1 line
2.7.4
PATCH 18/38 powerpc/rtas: Don't test for machine type in rtas_initialize()
In reply to Benjamin HerrenschmidtThe test is unnecessary, the FW_FEATURE_LPAR is sufficient as there exist no other LPAR type that has RTAS.
--- arch/powerpc/kernel/rtas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/rtas.c +1 -1
@@ -1174,7 +1174,7 @@ void __init rtas_initialize(void)* the stop-self token if any */ #ifdef CONFIG_PPC64 -if (machine_is (pseries) &&firmware_has_feature (FW_FEATURE_LPAR )) { +if (firmware_has_feature (FW_FEATURE_LPAR )) { rtas_region =min (ppc64_rma_size,RTAS_INSTANTIATE_MAX ); ibm_suspend_me_token =rtas_token ("ibm,suspend-me" ); }
Signature · 1 line
2.7.4
PATCH 19/38 powerpc: Don't test for machine type in smp_setup_cpu_maps()
In reply to Benjamin HerrenschmidtThe subsequent test for RTAS along with the LPAR test are sufficient
--- arch/powerpc/kernel/setup-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/setup-common.c +1 -1
@@ -494,7 +494,7 @@ void __init smp_setup_cpu_maps(void)* On pSeries LPAR, we need to know how many cpus * could possibly be added to this partition. */ -if (machine_is (pseries) &&firmware_has_feature (FW_FEATURE_LPAR ) && +if (firmware_has_feature (FW_FEATURE_LPAR ) && (dn =of_find_node_by_path ("/rtas" ))) {int num_addr_cell, num_size_cell, maxcpus;const __be32 *ireg;
Signature · 1 line
2.7.4
PATCH 20/38 powerpc/mm/hash64: Don't test for machine type to detect HEA special case
In reply to Benjamin HerrenschmidtInstead, check for FW_FEATURE_SPLPAR. This should be roughtly equivalent as all pseries machiens that can have an HEA also support SPLPAR and no other machine type does.
--- arch/powerpc/mm/hash_utils_64.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/mm/hash_utils_64.c +3 -2
@@ -508,7 +508,8 @@ static bool might_have_hea(void)* we will never see an HEA ethernet device. */ #ifdef CONFIG_IBMEBUS -return !cpu_has_feature (CPU_FTR_ARCH_207S ); +return !cpu_has_feature (CPU_FTR_ARCH_207S ) && + !firmware_has_feature (FW_FEATURE_SPLPAR );#else return false;#endif
@@ -574,7 +575,7 @@ found:* would stop us accessing the HEA ethernet. So if we * have the chance of ever seeing one, stay at 4k. */ -if (!might_have_hea () || !machine_is (pseries)) +if (!might_have_hea ()) mmu_io_psize =MMU_PAGE_64K ; }else mmu_ci_restrictions =1 ;
Signature · 1 line
2.7.4
PATCH 21/38 powerpc/pmac: Remove spurrious machine type test
In reply to Benjamin Herrenschmidtpmac_declare_of_platform_devices() is already a machine initcall, thus it won't be called on a non-powermac machine. Testing for chrp there is pointless.
--- arch/powerpc/platforms/powermac/setup.c | 3 --- 1 file changed, 3 deletions(-)
arch/powerpc/platforms/powermac/setup.c +0 -3
@@ -482,9 +482,6 @@ static int __init pmac_declare_of_platform_devices(void) {struct device_node *np; -if (machine_is (chrp)) -return -1 ; - np =of_find_node_by_name (NULL ,"valkyrie" );if (np) {of_platform_device_create (np,"valkyrie" ,NULL );
Signature · 1 line
2.7.4
PATCH 22/38 powerpc/mm: Move hash table ops to a separate structure
In reply to Benjamin HerrenschmidtMoving probe_machine() to after mmu init will cause the ppc_md fields relative to the hash table management to be overwritten.
Since we have essentially disconnected the machine type from the hash backend ops, finish the job by moving them to a different structure.
The only callback that didn't quite fix is update_partition_table since this is not specific to hash, so I moved it to a standalone variable for now. We can revisit later if needed.
--- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 39 ++++++++++++++++++++ arch/powerpc/include/asm/book3s/64/mmu.h | 2 ++ arch/powerpc/include/asm/machdep.h | 37 ------------------- arch/powerpc/kernel/machine_kexec_64.c | 4 +-- arch/powerpc/kernel/misc_64.S | 2 +- arch/powerpc/kvm/book3s_64_mmu_host.c | 18 +++++----- arch/powerpc/mm/hash64_4k.c | 18 +++++----- arch/powerpc/mm/hash64_64k.c | 39 +++++++++++--------- arch/powerpc/mm/hash_native_64.c | 18 +++++----- arch/powerpc/mm/hash_utils_64.c | 51 +++++++++++++++------------ arch/powerpc/mm/hugepage-hash64.c | 17 ++++----- arch/powerpc/mm/hugetlbpage-hash64.c | 4 +-- arch/powerpc/mm/pgtable-book3s64.c | 2 ++ arch/powerpc/mm/pgtable-radix.c | 7 ++-- arch/powerpc/platforms/ps3/htab.c | 12 +++---- arch/powerpc/platforms/pseries/lpar.c | 18 +++++----- 16 files changed, 156 insertions(+), 132 deletions(-)
arch/powerpc/include/asm/book3s/64/mmu-hash.h +39 -0
@@ -123,6 +123,45 @@ #ifndef __ASSEMBLY__ +struct mmu_hash_ops { + void (*hpte_invalidate)(unsigned long slot, + unsigned long vpn, + int bpsize, int apsize, + int ssize, int local); + long (*hpte_updatepp)(unsigned long slot, + unsigned long newpp, + unsigned long vpn, + int bpsize, int apsize, + int ssize, unsigned long flags); + void (*hpte_updateboltedpp)(unsigned long newpp, + unsigned long ea, + int psize, int ssize); + long (*hpte_insert)(unsigned long hpte_group, + unsigned long vpn, + unsigned long prpn, + unsigned long rflags, + unsigned long vflags, + int psize, int apsize, + int ssize); + long (*hpte_remove)(unsigned long hpte_group); + int (*hpte_removebolted)(unsigned long ea, + int psize, int ssize); + void (*flush_hash_range)(unsigned long number, int local); + void (*hugepage_invalidate)(unsigned long vsid, + unsigned long addr, + unsigned char *hpte_slot_array, + int psize, int ssize, int local); + /* + * Special for kexec. + * To be called in real mode with interrupts disabled. No locks are + * taken as such, concurrent access on pre POWER5 hardware could result + * in a deadlock. + * The linear mapping is destroyed as well. + */ + void (*hpte_clear_all)(void); +}; +extern struct mmu_hash_ops mmu_hash_ops; + struct hash_pte { __be64 v; __be64 r;
arch/powerpc/include/asm/book3s/64/mmu.h +2 -0
@@ -25,6 +25,8 @@ extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];#define radix_enabled () mmu_has_feature(MMU_FTR_RADIX) +extern int (*ppc64_update_partition_table)(u64 ); +#endif /* __ASSEMBLY__ */ /* 64-bit classic hash table MMU */
arch/powerpc/include/asm/machdep.h +0 -37
@@ -34,42 +34,6 @@ struct pci_host_bridge;struct machdep_calls {char *name;#ifdef CONFIG_PPC64 -void (*hpte_invalidate)(unsigned long slot, -unsigned long vpn, -int bpsize,int apsize, -int ssize,int local); -long (*hpte_updatepp)(unsigned long slot, -unsigned long newpp, -unsigned long vpn, -int bpsize,int apsize, -int ssize,unsigned long flags); -void (*hpte_updateboltedpp)(unsigned long newpp, -unsigned long ea, -int psize,int ssize); -long (*hpte_insert)(unsigned long hpte_group, -unsigned long vpn, -unsigned long prpn, -unsigned long rflags, -unsigned long vflags, -int psize,int apsize, -int ssize); -long (*hpte_remove)(unsigned long hpte_group); -int (*hpte_removebolted)(unsigned long ea, -int psize,int ssize); -void (*flush_hash_range)(unsigned long number,int local); -void (*hugepage_invalidate)(unsigned long vsid, -unsigned long addr, -unsigned char *hpte_slot_array, -int psize,int ssize,int local); -/* -* Special for kexec. -* To be called in real mode with interrupts disabled. No locks are -* taken as such, concurrent access on pre POWER5 hardware could result -* in a deadlock. -* The linear mapping is destroyed as well. -*/ -void (*hpte_clear_all)(void ); -void __iomem * (*ioremap)(phys_addr_t addr,unsigned long size,unsigned long flags,void *caller);void (*iounmap)(volatile void __iomem *token);
@@ -256,7 +220,6 @@ struct machdep_calls {#ifdef CONFIG_ARCH_RANDOM int (*get_random_seed)(unsigned long *v);#endif -int (*update_partition_table)(u64 ); };extern void e500_idle (void );
arch/powerpc/kernel/machine_kexec_64.c +2 -2
@@ -54,7 +54,7 @@ int default_machine_kexec_prepare(struct kimage *image)const unsigned long *basep;const unsigned int *sizep; -if (!ppc_md.hpte_clear_all) +if (!mmu_hash_ops.hpte_clear_all)return -ENOENT ;/*
@@ -379,7 +379,7 @@ void default_machine_kexec(struct kimage *image)*/ kexec_sequence (&kexec_stack, image->start, image,page_address (image->control_code_page), - ppc_md.hpte_clear_all); + mmu_hash_ops.hpte_clear_all);/* NOTREACHED */ }
arch/powerpc/kernel/misc_64.S +1 -1
@@ -667,7 +667,7 @@ _GLOBAL(kexec_sequence) mr r12,r27 #endif mtctr r12 - bctrl /* ppc_md.hpte_clear_all(void); */ + bctrl /* mmu_hash_ops.hpte_clear_all(void); */ #endif /* !CONFIG_PPC_BOOK3E */ /*
arch/powerpc/kvm/book3s_64_mmu_host.c +10 -8
@@ -34,9 +34,9 @@void kvmppc_mmu_invalidate_pte (struct kvm_vcpu *vcpu,struct hpte_cache *pte) { - ppc_md.hpte_invalidate (pte->slot, pte->host_vpn, - pte->pagesize, pte->pagesize,MMU_SEGSIZE_256M , - false); + mmu_hash_ops.hpte_invalidate (pte->slot, pte->host_vpn, + pte->pagesize, pte->pagesize, +MMU_SEGSIZE_256M , false); }/* We keep 512 gvsid->hvsid entries, mapping the guest ones to the array using
@@ -169,13 +169,13 @@ map_again:/* In case we tried normal mapping already, let's nuke old entries */ if (attempt >1 ) -if (ppc_md.hpte_remove (hpteg) <0 ) { +if (mmu_hash_ops.hpte_remove (hpteg) <0 ) { r =-1 ; goto out_unlock; } - ret = ppc_md.hpte_insert (hpteg, vpn, hpaddr, rflags, vflags, - hpsize, hpsize,MMU_SEGSIZE_256M ); + ret = mmu_hash_ops.hpte_insert (hpteg, vpn, hpaddr, rflags, vflags, + hpsize, hpsize,MMU_SEGSIZE_256M );if (ret <0 ) {/* If we couldn't map a primary PTE, try a secondary */
@@ -187,8 +187,10 @@ map_again:trace_kvm_book3s_64_mmu_map (rflags, hpteg, vpn, hpaddr, orig_pte); -/* The ppc_md code may give us a secondary entry even though we -asked for a primary. Fix up. */ +/* The mmu_hash_ops code may give us a secondary entry even +* though we +* asked for a primary. Fix up. +*/ if ((ret & _PTEIDX_SECONDARY) && !(vflags &HPTE_V_SECONDARY )) { hash = ~hash; hpteg = ((hash & htab_hash_mask) *HPTES_PER_GROUP );
arch/powerpc/mm/hash64_4k.c +10 -8
@@ -70,8 +70,8 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid, slot = (hash & htab_hash_mask) *HPTES_PER_GROUP ; slot += (old_pte &H_PAGE_F_GIX ) >>H_PAGE_F_GIX_SHIFT ; -if (ppc_md.hpte_updatepp (slot, rflags, vpn,MMU_PAGE_4K , -MMU_PAGE_4K , ssize, flags) ==-1 ) +if (mmu_hash_ops.hpte_updatepp (slot, rflags, vpn,MMU_PAGE_4K , +MMU_PAGE_4K , ssize, flags) ==-1 ) old_pte &= ~_PAGE_HPTEFLAGS; }
@@ -84,21 +84,23 @@ repeat: hpte_group = ((hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ;/* Insert into the hash table, primary slot */ - slot = ppc_md.hpte_insert (hpte_group, vpn, pa, rflags,0 , -MMU_PAGE_4K ,MMU_PAGE_4K , ssize); + slot = mmu_hash_ops.hpte_insert (hpte_group, vpn, pa, rflags,0 , +MMU_PAGE_4K ,MMU_PAGE_4K , ssize);/* * Primary is full, try the secondary */ if (unlikely (slot ==-1 )) { hpte_group = ((~hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ; - slot = ppc_md.hpte_insert (hpte_group, vpn, pa, - rflags,HPTE_V_SECONDARY , -MMU_PAGE_4K ,MMU_PAGE_4K , ssize); + slot = mmu_hash_ops.hpte_insert (hpte_group, vpn, pa, + rflags, +HPTE_V_SECONDARY , +MMU_PAGE_4K , +MMU_PAGE_4K , ssize);if (slot ==-1 ) {if (mftb () &0x1 ) hpte_group = ((hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ; - ppc_md.hpte_remove (hpte_group); + mmu_hash_ops.hpte_remove (hpte_group);/* * FIXME!! Should be try the group from which we removed ? */
arch/powerpc/mm/hash64_64k.c +22 -17
@@ -133,9 +133,9 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid, slot = (hash & htab_hash_mask) *HPTES_PER_GROUP ; slot += hidx & _PTEIDX_GROUP_IX; - ret = ppc_md.hpte_updatepp (slot, rflags, vpn, -MMU_PAGE_4K ,MMU_PAGE_4K , - ssize, flags); + ret = mmu_hash_ops.hpte_updatepp (slot, rflags, vpn, +MMU_PAGE_4K ,MMU_PAGE_4K , + ssize, flags);/* *if we failed because typically the HPTE wasn't really here * we try an insertion.
@@ -166,21 +166,22 @@ repeat: hpte_group = ((hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ;/* Insert into the hash table, primary slot */ - slot = ppc_md.hpte_insert (hpte_group, vpn, pa, rflags,0 , -MMU_PAGE_4K ,MMU_PAGE_4K , ssize); + slot = mmu_hash_ops.hpte_insert (hpte_group, vpn, pa, rflags,0 , +MMU_PAGE_4K ,MMU_PAGE_4K , ssize);/* * Primary is full, try the secondary */ if (unlikely (slot ==-1 )) { hpte_group = ((~hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ; - slot = ppc_md.hpte_insert (hpte_group, vpn, pa, - rflags,HPTE_V_SECONDARY , -MMU_PAGE_4K ,MMU_PAGE_4K , ssize); + slot = mmu_hash_ops.hpte_insert (hpte_group, vpn, pa, + rflags,HPTE_V_SECONDARY , +MMU_PAGE_4K ,MMU_PAGE_4K , + ssize);if (slot ==-1 ) {if (mftb () &0x1 ) hpte_group = ((hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ; - ppc_md.hpte_remove (hpte_group); + mmu_hash_ops.hpte_remove (hpte_group);/* * FIXME!! Should be try the group from which we removed ? */
@@ -272,8 +273,9 @@ int __hash_page_64K(unsigned long ea, unsigned long access, slot = (hash & htab_hash_mask) *HPTES_PER_GROUP ; slot += (old_pte &H_PAGE_F_GIX ) >>H_PAGE_F_GIX_SHIFT ; -if (ppc_md.hpte_updatepp (slot, rflags, vpn,MMU_PAGE_64K , -MMU_PAGE_64K , ssize, flags) ==-1 ) +if (mmu_hash_ops.hpte_updatepp (slot, rflags, vpn,MMU_PAGE_64K , +MMU_PAGE_64K , ssize, + flags) ==-1 ) old_pte &= ~_PAGE_HPTEFLAGS; }
@@ -286,21 +288,24 @@ repeat: hpte_group = ((hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ;/* Insert into the hash table, primary slot */ - slot = ppc_md.hpte_insert (hpte_group, vpn, pa, rflags,0 , -MMU_PAGE_64K ,MMU_PAGE_64K , ssize); + slot = mmu_hash_ops.hpte_insert (hpte_group, vpn, pa, rflags,0 , +MMU_PAGE_64K ,MMU_PAGE_64K , + ssize);/* * Primary is full, try the secondary */ if (unlikely (slot ==-1 )) { hpte_group = ((~hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ; - slot = ppc_md.hpte_insert (hpte_group, vpn, pa, - rflags,HPTE_V_SECONDARY , -MMU_PAGE_64K ,MMU_PAGE_64K , ssize); + slot = mmu_hash_ops.hpte_insert (hpte_group, vpn, pa, + rflags, +HPTE_V_SECONDARY , +MMU_PAGE_64K , +MMU_PAGE_64K , ssize);if (slot ==-1 ) {if (mftb () &0x1 ) hpte_group = ((hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ; - ppc_md.hpte_remove (hpte_group); + mmu_hash_ops.hpte_remove (hpte_group);/* * FIXME!! Should be try the group from which we removed ? */
arch/powerpc/mm/hash_native_64.c +9 -9
@@ -731,15 +731,15 @@ static int native_update_partition_table(u64 patb1)void __init hpte_init_native (void ) { - ppc_md.hpte_invalidate = native_hpte_invalidate; - ppc_md.hpte_updatepp = native_hpte_updatepp; - ppc_md.hpte_updateboltedpp = native_hpte_updateboltedpp; - ppc_md.hpte_insert = native_hpte_insert; - ppc_md.hpte_remove = native_hpte_remove; - ppc_md.hpte_clear_all = native_hpte_clear; - ppc_md.flush_hash_range = native_flush_hash_range; - ppc_md.hugepage_invalidate = native_hugepage_invalidate; + mmu_hash_ops.hpte_invalidate = native_hpte_invalidate; + mmu_hash_ops.hpte_updatepp = native_hpte_updatepp; + mmu_hash_ops.hpte_updateboltedpp = native_hpte_updateboltedpp; + mmu_hash_ops.hpte_insert = native_hpte_insert; + mmu_hash_ops.hpte_remove = native_hpte_remove; + mmu_hash_ops.hpte_clear_all = native_hpte_clear; + mmu_hash_ops.flush_hash_range = native_flush_hash_range; + mmu_hash_ops.hugepage_invalidate = native_hugepage_invalidate;if (cpu_has_feature (CPU_FTR_ARCH_300 )) - ppc_md.update_partition_table = native_update_partition_table; + ppc64_update_partition_table = native_update_partition_table; }
arch/powerpc/mm/hash_utils_64.c +28 -23
124 lines not on this page · raw message
arch/powerpc/mm/hugepage-hash64.c +9 -8
@@ -103,8 +103,8 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, slot = (hash & htab_hash_mask) *HPTES_PER_GROUP ; slot += hidx & _PTEIDX_GROUP_IX; - ret = ppc_md.hpte_updatepp (slot, rflags, vpn, - psize, lpsize, ssize, flags); + ret = mmu_hash_ops.hpte_updatepp (slot, rflags, vpn, + psize, lpsize, ssize, flags);/* * We failed to update, try to insert a new entry. */
@@ -131,23 +131,24 @@ repeat: hpte_group = ((hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ;/* Insert into the hash table, primary slot */ - slot = ppc_md.hpte_insert (hpte_group, vpn, pa, rflags,0 , - psize, lpsize, ssize); + slot = mmu_hash_ops.hpte_insert (hpte_group, vpn, pa, rflags,0 , + psize, lpsize, ssize);/* * Primary is full, try the secondary */ if (unlikely (slot ==-1 )) { hpte_group = ((~hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ; - slot = ppc_md.hpte_insert (hpte_group, vpn, pa, - rflags,HPTE_V_SECONDARY , - psize, lpsize, ssize); + slot = mmu_hash_ops.hpte_insert (hpte_group, vpn, pa, + rflags, +HPTE_V_SECONDARY , + psize, lpsize, ssize);if (slot ==-1 ) {if (mftb () &0x1 ) hpte_group = ((hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ; - ppc_md.hpte_remove (hpte_group); + mmu_hash_ops.hpte_remove (hpte_group); goto repeat; } }
arch/powerpc/mm/hugetlbpage-hash64.c +2 -2
@@ -79,8 +79,8 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, slot = (hash & htab_hash_mask) *HPTES_PER_GROUP ; slot += (old_pte &H_PAGE_F_GIX ) >>H_PAGE_F_GIX_SHIFT ; -if (ppc_md.hpte_updatepp (slot, rflags, vpn, mmu_psize, - mmu_psize, ssize, flags) ==-1 ) +if (mmu_hash_ops.hpte_updatepp (slot, rflags, vpn, mmu_psize, + mmu_psize, ssize, flags) ==-1 ) old_pte &= ~_PAGE_HPTEFLAGS; }
arch/powerpc/mm/pgtable-book3s64.c +2 -0
@@ -14,6 +14,8 @@#include "mmu_decl.h" #include <trace/events/thp.h> +int (*ppc64_update_partition_table)(u64 ); +#ifdef CONFIG_TRANSPARENT_HUGEPAGE /* * This is called when relaxing access to a hugepage. It's also called in the page
arch/powerpc/mm/pgtable-radix.c +5 -2
@@ -114,6 +114,9 @@ static void __init radix_init_pgtable(void)/* We don't support slb for radix */ mmu_slb_size =0 ; + +BUG_ON (!ppc64_update_partition_table); +/* * Create the linear mapping, using standard page size for now */
@@ -169,7 +172,7 @@ redo:* of process table here. But our linear mapping also enable us to use * physical address here. */ - ppc_md.update_partition_table (__pa (process_tb) | (PRTB_SIZE_SHIFT -12 ) |PATB_GR ); +ppc64_update_partition_table (__pa (process_tb) | (PRTB_SIZE_SHIFT -12 ) |PATB_GR );pr_info ("Process table %p and radix root for kernel: %p\n" , process_tb, init_mm.pgd); }
@@ -197,7 +200,7 @@ static void __init radix_init_partition_table(void)void __init radix_init_native (void ) { - ppc_md.update_partition_table = native_update_partition_table; + ppc64_update_partition_table = native_update_partition_table; }static int __init get_idx_from_shift (unsigned int shift)
arch/powerpc/platforms/ps3/htab.c +6 -6
@@ -195,12 +195,12 @@ static void ps3_hpte_clear(void)void __init ps3_hpte_init (unsigned long htab_size) { - ppc_md.hpte_invalidate = ps3_hpte_invalidate; - ppc_md.hpte_updatepp = ps3_hpte_updatepp; - ppc_md.hpte_updateboltedpp = ps3_hpte_updateboltedpp; - ppc_md.hpte_insert = ps3_hpte_insert; - ppc_md.hpte_remove = ps3_hpte_remove; - ppc_md.hpte_clear_all = ps3_hpte_clear; + mmu_hash_ops.hpte_invalidate = ps3_hpte_invalidate; + mmu_hash_ops.hpte_updatepp = ps3_hpte_updatepp; + mmu_hash_ops.hpte_updateboltedpp = ps3_hpte_updateboltedpp; + mmu_hash_ops.hpte_insert = ps3_hpte_insert; + mmu_hash_ops.hpte_remove = ps3_hpte_remove; + mmu_hash_ops.hpte_clear_all = ps3_hpte_clear; ppc64_pft_size =__ilog2 (htab_size); }
arch/powerpc/platforms/pseries/lpar.c +9 -9
@@ -606,15 +606,15 @@ __setup("bulk_remove=", disable_bulk_remove);void __init hpte_init_lpar (void ) { - ppc_md.hpte_invalidate = pSeries_lpar_hpte_invalidate; - ppc_md.hpte_updatepp = pSeries_lpar_hpte_updatepp; - ppc_md.hpte_updateboltedpp = pSeries_lpar_hpte_updateboltedpp; - ppc_md.hpte_insert = pSeries_lpar_hpte_insert; - ppc_md.hpte_remove = pSeries_lpar_hpte_remove; - ppc_md.hpte_removebolted = pSeries_lpar_hpte_removebolted; - ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range; - ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear; - ppc_md.hugepage_invalidate = pSeries_lpar_hugepage_invalidate; + mmu_hash_ops.hpte_invalidate = pSeries_lpar_hpte_invalidate; + mmu_hash_ops.hpte_updatepp = pSeries_lpar_hpte_updatepp; + mmu_hash_ops.hpte_updateboltedpp = pSeries_lpar_hpte_updateboltedpp; + mmu_hash_ops.hpte_insert = pSeries_lpar_hpte_insert; + mmu_hash_ops.hpte_remove = pSeries_lpar_hpte_remove; + mmu_hash_ops.hpte_removebolted = pSeries_lpar_hpte_removebolted; + mmu_hash_ops.flush_hash_range = pSeries_lpar_flush_hash_range; + mmu_hash_ops.hpte_clear_all = pSeries_lpar_hptab_clear; + mmu_hash_ops.hugepage_invalidate = pSeries_lpar_hugepage_invalidate; }#ifdef CONFIG_PPC_SMLPAR
Signature · 1 line
2.7.4
PATCH 23/38 powerpc: Ensure that ppc_md is empty before probing for machine type
In reply to Benjamin HerrenschmidtAnything in there will be overwritten, so it helps catching nasty bugs if we check that it's indeed full of NULL's before we do so.
--- arch/powerpc/kernel/setup-common.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/powerpc/kernel/setup-common.c +11 -0
@@ -575,6 +575,7 @@ void probe_machine(void) {extern struct machdep_calls __machine_desc_start;extern struct machdep_calls __machine_desc_end; +unsigned int i;/* * Iterate all ppc_md structures until we find the proper
@@ -582,6 +583,16 @@ void probe_machine(void)*/ DBG ("Probing machine type ...\n" ); +/* Check ppc_md is empty, if not we have a bug, ie, we setup an +* entry before probe_machine() which will be overwritten +*/ +for (i =0 ; i < (sizeof (ppc_md) /sizeof (void *)); i++) { +if (((void **)&ppc_md)[i]) { +printk (KERN_ERR "Entry %d in ppc_md non empty before" +" machine probe !\n" , i); + } + } +for (machine_id = &__machine_desc_start; machine_id < &__machine_desc_end; machine_id++) {
Signature · 1 line
2.7.4
PATCH 24/38 powerpc: Move 64-bit probe_machine() to later in the boot process
In reply to Benjamin HerrenschmidtWe no long need the machine type that early, so we can move probe_machine() to after the device-tree has been expanded. This will allow further consolidation.
--- arch/powerpc/kernel/setup_64.c | 6 +++--- arch/powerpc/platforms/cell/setup.c | 6 ++---- arch/powerpc/platforms/maple/setup.c | 6 ++---- arch/powerpc/platforms/pasemi/setup.c | 6 ++---- arch/powerpc/platforms/powermac/setup.c | 6 ++++++ arch/powerpc/platforms/powernv/setup.c | 4 +--- arch/powerpc/platforms/ps3/setup.c | 6 ++---- arch/powerpc/platforms/pseries/setup.c | 7 +++---- 8 files changed, 21 insertions(+), 26 deletions(-)
arch/powerpc/kernel/setup_64.c +3 -3
@@ -313,9 +313,6 @@ void __init early_setup(unsigned long dt_ptr)setup_paca (&paca[boot_cpuid]);fixup_boot_paca (); -/* Probe the machine type */ -probe_machine (); -/* Configure exception handlers. This include setting up trampolines * if needed, setting exception endian mode, etc... */
@@ -522,6 +519,9 @@ void __init setup_system(void)*/ check_for_initrd (); +/* Probe the machine type */ +probe_machine (); +/* * Do some platform specific early initializations, that includes * setting up the hash table pointers. It also sets up some interrupt-mapping
arch/powerpc/platforms/cell/setup.c +2 -4
@@ -255,10 +255,8 @@ static void __init cell_setup_arch(void)static int __init cell_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"IBM,CBEA" ) && - !of_flat_dt_is_compatible (root,"IBM,CPBW-1.0" )) +if (!of_machine_is_compatible ("IBM,CBEA" ) && + !of_machine_is_compatible ("IBM,CPBW-1.0" ))return 0 ; pm_power_off = rtas_power_off;
arch/powerpc/platforms/maple/setup.c +2 -4
@@ -298,10 +298,8 @@ static void __init maple_progress(char *s, unsigned short hex)*/ static int __init maple_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"Momentum,Maple" ) && - !of_flat_dt_is_compatible (root,"Momentum,Apache" )) +if (!of_machine_is_compatible ("Momentum,Maple" ) && + !of_machine_is_compatible ("Momentum,Apache" ))return 0 ; pm_power_off = maple_power_off;
arch/powerpc/platforms/pasemi/setup.c +2 -4
@@ -420,10 +420,8 @@ machine_device_initcall(pasemi, pasemi_publish_devices);*/ static int __init pas_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"PA6T-1682M" ) && - !of_flat_dt_is_compatible (root,"pasemi,pwrficient" )) +if (!of_machine_is_compatible ("PA6T-1682M" ) && + !of_machine_is_compatible ("pasemi,pwrficient" ))return 0 ;return 1 ;
arch/powerpc/platforms/powermac/setup.c +6 -0
@@ -588,11 +588,17 @@ console_initcall(check_pmac_serial_console);*/ static int __init pmac_probe (void ) { +#ifdef CONFIG_PPC32 unsigned long root =of_get_flat_dt_root ();if (!of_flat_dt_is_compatible (root,"Power Macintosh" ) && !of_flat_dt_is_compatible (root,"MacRISC" ))return 0 ; +#else +if (!of_machine_is_compatible ("Power Macintosh" ) && + !of_machine_is_compatible ("MacRISC" )) +return 0 ; +#endif #ifdef CONFIG_PPC32 /* isa_io_base gets set in pmac_pci_init */
arch/powerpc/platforms/powernv/setup.c +1 -3
@@ -268,9 +268,7 @@ static void __init pnv_setup_machdep_opal(void)static int __init pnv_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"ibm,powernv" )) +if (!of_machine_is_compatible ("ibm,powernv" ))return 0 ;if (firmware_has_feature (FW_FEATURE_OPAL ))
arch/powerpc/platforms/ps3/setup.c +2 -4
@@ -237,15 +237,13 @@ void __init ps3_early_mm_init(void)static int __init ps3_probe (void ) { -unsigned long dt_root; -DBG (" -> %s:%d\n" , __func__, __LINE__); - dt_root =of_get_flat_dt_root (); -if (!of_flat_dt_is_compatible (dt_root,"sony,ps3" )) +if (!of_machine_is_compatible ("sony,ps3" ))return 0 ;ps3_os_area_save_params (); + pm_power_off = ps3_power_off;DBG (" <- %s:%d\n" , __func__, __LINE__);
arch/powerpc/platforms/pseries/setup.c +3 -4
@@ -722,8 +722,7 @@ static void pseries_power_off(void)static int __init pSeries_probe (void ) { -unsigned long root =of_get_flat_dt_root (); -const char *dtype =of_get_flat_dt_prop (root,"device_type" ,NULL ); +const char *dtype =of_get_property (of_root,"device_type" ,NULL );if (dtype ==NULL )return 0 ;
@@ -733,8 +732,8 @@ static int __init pSeries_probe(void)/* Cell blades firmware claims to be chrp while it's not. Until this * is fixed, we need to avoid those here. */ -if (of_flat_dt_is_compatible (root,"IBM,CPBW-1.0" ) || -of_flat_dt_is_compatible (root,"IBM,CBEA" )) +if (of_machine_is_compatible ("IBM,CPBW-1.0" ) || +of_machine_is_compatible ("IBM,CBEA" ))return 0 ; pm_power_off = pseries_power_off;
Signature · 1 line
2.7.4
PATCH 25/38 powerpc/cell: Don't use flat device-tree after boot
In reply to Benjamin HerrenschmidtSome bit of SPU code was using the FDT rather than the expanded device-tree. Fix it.
--- arch/powerpc/platforms/cell/spu_manage.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/platforms/cell/spu_manage.c +1 -2
@@ -535,8 +535,7 @@ static int __init init_affinity(void)if (of_has_vicinity ()) {init_affinity_fw (); }else { -long root =of_get_flat_dt_root (); -if (of_flat_dt_is_compatible (root,"IBM,CPBW-1.0" )) +if (of_machine_is_compatible ("IBM,CPBW-1.0" ))init_affinity_qs20_harcoded ();else printk ("No affinity configuration found\n" );
Signature · 1 line
2.7.4
PATCH 26/38 powerpc/85xx/ge_imp3a: Don't use the flat device-tree after boot
In reply to Benjamin Herrenschmidtge_imp3a_pic_init() is called way beyond the unflattening of the tree, it shouldn't be using of_flat_dt_*
--- arch/powerpc/platforms/85xx/ge_imp3a.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/platforms/85xx/ge_imp3a.c +1 -2
@@ -47,9 +47,8 @@ void __init ge_imp3a_pic_init(void)struct mpic *mpic;struct device_node *np;struct device_node *cascade_node =NULL ; -unsigned long root =of_get_flat_dt_root (); -if (of_flat_dt_is_compatible (root,"fsl,MPC8572DS-CAMP" )) { +if (of_machine_is_compatible ("fsl,MPC8572DS-CAMP" )) { mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET | MPIC_BIG_ENDIAN |
Signature · 1 line
2.7.4
PATCH 27/38 powerpc/85xx/mpc85xx_ds: Don't use the flat device-tree after boot
In reply to Benjamin Herrenschmidt--- arch/powerpc/platforms/85xx/mpc85xx_ds.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_ds.c +1 -3
@@ -66,9 +66,7 @@ void __init mpc85xx_ds_pic_init(void)struct device_node *cascade_node =NULL ;int cascade_irq;#endif -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"fsl,MPC8572DS-CAMP" )) { +if (of_machine_is_compatible ("fsl,MPC8572DS-CAMP" )) { mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET | MPIC_BIG_ENDIAN |
Signature · 1 line
2.7.4
PATCH 28/38 powerpc/85xx/mpc85xx_rdb: Don't use the flat device-tree after boot
In reply to Benjamin Herrenschmidt--- arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +1 -2
@@ -47,13 +47,12 @@void __init mpc85xx_rdb_pic_init (void ) {struct mpic *mpic; -unsigned long root =of_get_flat_dt_root ();#ifdef CONFIG_QUICC_ENGINE struct device_node *np;#endif -if (of_flat_dt_is_compatible (root,"fsl,MPC85XXRDB-CAMP" )) { +if (of_machine_is_compatible ("fsl,MPC85XXRDB-CAMP" )) { mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET | MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU,
Signature · 1 line
2.7.4
PATCH 29/38 powerpc: Move 32-bit probe() machine to later in the boot process
In reply to Benjamin HerrenschmidtThis converts all the 32-bit platforms to use the expanded device-tree which is a pretty mechanical change. Unlike 64-bit, the 32-bit kernel didn't rely on platform initializations to setup the MMU since it sets it up entirely before probe_machine() so the move has comparatively less consequences though it's a bigger patch.
--- arch/powerpc/kernel/setup_32.c | 35 +++++++++++--------- arch/powerpc/platforms/40x/ep405.c | 4 +-- arch/powerpc/platforms/40x/ppc40x_simple.c | 2 +- arch/powerpc/platforms/40x/virtex.c | 4 +-- arch/powerpc/platforms/40x/walnut.c | 4 +-- arch/powerpc/platforms/44x/canyonlands.c | 5 ++- arch/powerpc/platforms/44x/ebony.c | 4 +-- arch/powerpc/platforms/44x/iss4xx.c | 4 +-- arch/powerpc/platforms/44x/ppc44x_simple.c | 3 +- arch/powerpc/platforms/44x/ppc476.c | 6 ++-- arch/powerpc/platforms/44x/sam440ep.c | 4 +-- arch/powerpc/platforms/44x/virtex.c | 4 +-- arch/powerpc/platforms/44x/warp.c | 4 +-- arch/powerpc/platforms/512x/mpc5121_ads.c | 4 +-- arch/powerpc/platforms/512x/mpc512x_generic.c | 2 +- arch/powerpc/platforms/512x/pdm360ng.c | 4 +-- arch/powerpc/platforms/52xx/efika.c | 3 +- arch/powerpc/platforms/52xx/lite5200.c | 2 +- arch/powerpc/platforms/52xx/media5200.c | 2 +- arch/powerpc/platforms/52xx/mpc5200_simple.c | 2 +- arch/powerpc/platforms/82xx/ep8248e.c | 3 +- arch/powerpc/platforms/82xx/km82xx.c | 3 +- arch/powerpc/platforms/82xx/mpc8272_ads.c | 3 +- arch/powerpc/platforms/82xx/pq2fads.c | 3 +- arch/powerpc/platforms/83xx/asp834x.c | 3 +- arch/powerpc/platforms/83xx/km83xx.c | 3 +- arch/powerpc/platforms/83xx/mpc830x_rdb.c | 2 +- arch/powerpc/platforms/83xx/mpc831x_rdb.c | 2 +- arch/powerpc/platforms/83xx/mpc832x_mds.c | 4 +-- arch/powerpc/platforms/83xx/mpc832x_rdb.c | 4 +-- arch/powerpc/platforms/83xx/mpc834x_itx.c | 4 +-- arch/powerpc/platforms/83xx/mpc834x_mds.c | 4 +-- arch/powerpc/platforms/83xx/mpc836x_mds.c | 4 +-- arch/powerpc/platforms/83xx/mpc836x_rdk.c | 4 +-- arch/powerpc/platforms/83xx/mpc837x_mds.c | 4 +-- arch/powerpc/platforms/83xx/mpc837x_rdb.c | 2 +- arch/powerpc/platforms/83xx/sbc834x.c | 4 +-- arch/powerpc/platforms/85xx/bsc913x_qds.c | 4 +-- arch/powerpc/platforms/85xx/bsc913x_rdb.c | 4 +-- arch/powerpc/platforms/85xx/c293pcie.c | 4 +-- arch/powerpc/platforms/85xx/corenet_generic.c | 5 ++- arch/powerpc/platforms/85xx/ge_imp3a.c | 4 +-- arch/powerpc/platforms/85xx/ksi8560.c | 4 +-- arch/powerpc/platforms/85xx/mpc8536_ds.c | 4 +-- arch/powerpc/platforms/85xx/mpc85xx_ads.c | 4 +-- arch/powerpc/platforms/85xx/mpc85xx_cds.c | 4 +-- arch/powerpc/platforms/85xx/mpc85xx_ds.c | 12 ++----- arch/powerpc/platforms/85xx/mpc85xx_mds.c | 12 ++----- arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 40 ++++++----------------- arch/powerpc/platforms/85xx/mvme2500.c | 4 +-- arch/powerpc/platforms/85xx/p1010rdb.c | 6 ++-- arch/powerpc/platforms/85xx/p1022_ds.c | 4 +-- arch/powerpc/platforms/85xx/p1022_rdk.c | 4 +-- arch/powerpc/platforms/85xx/p1023_rdb.c | 4 +-- arch/powerpc/platforms/85xx/ppa8548.c | 4 +-- arch/powerpc/platforms/85xx/qemu_e500.c | 4 +-- arch/powerpc/platforms/85xx/sbc8548.c | 4 +-- arch/powerpc/platforms/85xx/socrates.c | 4 +-- arch/powerpc/platforms/85xx/stx_gp3.c | 4 +-- arch/powerpc/platforms/85xx/tqm85xx.c | 2 +- arch/powerpc/platforms/85xx/twr_p102x.c | 4 +-- arch/powerpc/platforms/85xx/xes_mpc85xx.c | 12 ++----- arch/powerpc/platforms/86xx/gef_ppc9a.c | 4 +-- arch/powerpc/platforms/86xx/gef_sbc310.c | 4 +-- arch/powerpc/platforms/86xx/gef_sbc610.c | 4 +-- arch/powerpc/platforms/86xx/mpc8610_hpcd.c | 4 +-- arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 6 ++-- arch/powerpc/platforms/86xx/sbc8641d.c | 4 +-- arch/powerpc/platforms/8xx/adder875.c | 3 +- arch/powerpc/platforms/8xx/ep88xc.c | 3 +- arch/powerpc/platforms/8xx/mpc86xads_setup.c | 3 +- arch/powerpc/platforms/8xx/mpc885ads_setup.c | 3 +- arch/powerpc/platforms/8xx/tqm8xx_setup.c | 4 +-- arch/powerpc/platforms/amigaone/setup.c | 4 +-- arch/powerpc/platforms/embedded6xx/c2k.c | 4 +-- arch/powerpc/platforms/embedded6xx/gamecube.c | 5 +-- arch/powerpc/platforms/embedded6xx/holly.c | 4 +-- arch/powerpc/platforms/embedded6xx/linkstation.c | 6 +--- arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c | 4 +-- arch/powerpc/platforms/embedded6xx/mvme5100.c | 4 +-- arch/powerpc/platforms/embedded6xx/storcenter.c | 4 +-- arch/powerpc/platforms/embedded6xx/wii.c | 5 +-- arch/powerpc/platforms/powermac/setup.c | 8 ----- 83 files changed, 120 insertions(+), 289 deletions(-)
arch/powerpc/kernel/setup_32.c +19 -16
@@ -113,23 +113,7 @@ notrace void __init machine_init(u64 dt_ptr)early_init_mmu (); -probe_machine (); -setup_kdump_trampoline (); - -#ifdef CONFIG_6xx -if (cpu_has_feature (CPU_FTR_CAN_DOZE ) || -cpu_has_feature (CPU_FTR_CAN_NAP )) - ppc_md.power_save = ppc6xx_idle; -#endif - -#ifdef CONFIG_E500 -if (cpu_has_feature (CPU_FTR_CAN_DOZE ) || -cpu_has_feature (CPU_FTR_CAN_NAP )) - ppc_md.power_save = e500_idle; -#endif -if (ppc_md.progress) - ppc_md.progress ("id mach(): done" ,0x200 ); }/* Checks "l2cr=xxxx" command-line option */
@@ -249,6 +233,21 @@ static void __init exc_lvl_early_init(void)#define exc_lvl_early_init ()#endif +static void setup_power_save (void ) +{ +#ifdef CONFIG_6xx +if (cpu_has_feature (CPU_FTR_CAN_DOZE ) || +cpu_has_feature (CPU_FTR_CAN_NAP )) + ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_E500 +if (cpu_has_feature (CPU_FTR_CAN_DOZE ) || +cpu_has_feature (CPU_FTR_CAN_NAP )) + ppc_md.power_save = e500_idle; +#endif +} +/* Warning, IO base is not yet inited */ void __init setup_arch (char **cmdline_p) {
@@ -260,6 +259,10 @@ void __init setup_arch(char **cmdline_p)unflatten_device_tree ();check_for_initrd (); +probe_machine (); + +setup_power_save (); +if (ppc_md.init_early) ppc_md.init_early ();
arch/powerpc/platforms/40x/ep405.c +1 -3
@@ -105,9 +105,7 @@ static void __init ep405_setup_arch(void)static int __init ep405_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"ep405" )) +if (!of_machine_is_compatible ("ep405" ))return 0 ;return 1 ;
arch/powerpc/platforms/40x/ppc40x_simple.c +1 -1
@@ -63,7 +63,7 @@ static const char * const board[] __initconst = {static int __init ppc40x_probe (void ) { -if (of_flat_dt_match (of_get_flat_dt_root (), board)) { +if (of_device_compatible_match (of_root, board)) {pci_set_flags (PCI_REASSIGN_ALL_RSRC );return 1 ; }
arch/powerpc/platforms/40x/virtex.c +1 -3
@@ -37,9 +37,7 @@ machine_device_initcall(virtex, virtex_device_probe);static int __init virtex_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"xlnx,virtex" )) +if (!of_machine_is_compatible ("xlnx,virtex" ))return 0 ;return 1 ;
arch/powerpc/platforms/40x/walnut.c +1 -3
@@ -46,9 +46,7 @@ machine_device_initcall(walnut, walnut_device_probe);static int __init walnut_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"ibm,walnut" )) +if (!of_machine_is_compatible ("ibm,walnut" ))return 0 ;pci_set_flags (PCI_REASSIGN_ALL_RSRC );
arch/powerpc/platforms/44x/canyonlands.c +2 -3
@@ -53,11 +53,10 @@ machine_device_initcall(canyonlands, ppc460ex_device_probe);static int __init ppc460ex_probe (void ) { -unsigned long root =of_get_flat_dt_root (); -if (of_flat_dt_is_compatible (root,"amcc,canyonlands" )) { +if (of_machine_is_compatible ("amcc,canyonlands" )) {pci_set_flags (PCI_REASSIGN_ALL_RSRC );return 1 ; - } + }return 0 ; }
arch/powerpc/platforms/44x/ebony.c +1 -3
@@ -49,9 +49,7 @@ machine_device_initcall(ebony, ebony_device_probe);*/ static int __init ebony_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"ibm,ebony" )) +if (!of_machine_is_compatible ("ibm,ebony" ))return 0 ;pci_set_flags (PCI_REASSIGN_ALL_RSRC );
arch/powerpc/platforms/44x/iss4xx.c +1 -3
@@ -149,9 +149,7 @@ static void __init iss4xx_setup_arch(void)*/ static int __init iss4xx_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"ibm,iss-4xx" )) +if (!of_machine_is_compatible ("ibm,iss-4xx" ))return 0 ;return 1 ;
arch/powerpc/platforms/44x/ppc44x_simple.c +1 -2
@@ -67,11 +67,10 @@ static char *board[] __initdata = {static int __init ppc44x_probe (void ) { -unsigned long root =of_get_flat_dt_root ();int i =0 ;for (i =0 ; i <ARRAY_SIZE (board); i++) { -if (of_flat_dt_is_compatible (root, board[i])) { +if (of_machine_is_compatible (board[i])) {pci_set_flags (PCI_REASSIGN_ALL_RSRC );return 1 ; }
arch/powerpc/platforms/44x/ppc476.c +2 -4
@@ -275,12 +275,10 @@ static void ppc47x_pci_irq_fixup(struct pci_dev *dev)*/ static int __init ppc47x_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"ibm,akebono" )) +if (of_machine_is_compatible ("ibm,akebono" ))return 1 ; -if (of_flat_dt_is_compatible (root,"ibm,currituck" )) { +if (of_machine_is_compatible ("ibm,currituck" )) { ppc_md.pci_irq_fixup = ppc47x_pci_irq_fixup;return 1 ; }
arch/powerpc/platforms/44x/sam440ep.c +1 -3
@@ -46,9 +46,7 @@ machine_device_initcall(sam440ep, sam440ep_device_probe);static int __init sam440ep_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"acube,sam440ep" )) +if (!of_machine_is_compatible ("acube,sam440ep" ))return 0 ;pci_set_flags (PCI_REASSIGN_ALL_RSRC );
arch/powerpc/platforms/44x/virtex.c +1 -3
@@ -43,9 +43,7 @@ machine_device_initcall(virtex, virtex_device_probe);static int __init virtex_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"xlnx,virtex440" )) +if (!of_machine_is_compatible ("xlnx,virtex440" ))return 0 ;return 1 ;
arch/powerpc/platforms/44x/warp.c +1 -3
@@ -44,9 +44,7 @@ machine_device_initcall(warp, warp_device_probe);static int __init warp_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"pika,warp" )) +if (!of_machine_compatible ("pika,warp" ))return 0 ;/* For __dma_alloc_coherent */
arch/powerpc/platforms/512x/mpc5121_ads.c +1 -3
@@ -57,9 +57,7 @@ static void __init mpc5121_ads_init_IRQ(void)*/ static int __init mpc5121_ads_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,mpc5121ads" ); +return of_machine_is_compatible ("fsl,mpc5121ads" ); }define_machine (mpc5121_ads) {
arch/powerpc/platforms/512x/mpc512x_generic.c +1 -1
@@ -38,7 +38,7 @@ static const char * const board[] __initconst = {*/ static int __init mpc512x_generic_probe (void ) { -return of_flat_dt_match (of_get_flat_dt_root (), board); +return of_device_compatible_match (of_root, board); }define_machine (mpc512x_generic) {
arch/powerpc/platforms/512x/pdm360ng.c +1 -3
@@ -113,9 +113,7 @@ void __init pdm360ng_init(void)static int __init pdm360ng_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"ifm,pdm360ng" ); +return of_machine_is_compatible ("ifm,pdm360ng" ); }define_machine (pdm360ng) {
arch/powerpc/platforms/52xx/efika.c +1 -2
@@ -200,8 +200,7 @@ static void __init efika_setup_arch(void)static int __init efika_probe (void ) { -const char *model =of_get_flat_dt_prop (of_get_flat_dt_root (), -"model" ,NULL ); +const char *model =of_get_property (of_root,"model" ,NULL );if (model ==NULL )return 0 ;
arch/powerpc/platforms/52xx/lite5200.c +1 -1
@@ -183,7 +183,7 @@ static const char * const board[] __initconst = {*/ static int __init lite5200_probe (void ) { -return of_flat_dt_match (of_get_flat_dt_root (), board); +return of_device_compatible_match (of_root, board); }define_machine (lite5200) {
arch/powerpc/platforms/52xx/media5200.c +1 -1
@@ -242,7 +242,7 @@ static const char * const board[] __initconst = {*/ static int __init media5200_probe (void ) { -return of_flat_dt_match (of_get_flat_dt_root (), board); +return of_device_compatible_match (of_root, board); }define_machine (media5200_platform) {
arch/powerpc/platforms/52xx/mpc5200_simple.c +1 -1
@@ -70,7 +70,7 @@ static const char *board[] __initdata = {*/ static int __init mpc5200_simple_probe (void ) { -return of_flat_dt_match (of_get_flat_dt_root (), board); +return of_device_compatible_match (of_root, board); }define_machine (mpc5200_simple_platform) {
arch/powerpc/platforms/82xx/ep8248e.c +1 -2
@@ -309,8 +309,7 @@ machine_device_initcall(ep8248e, declare_of_platform_devices);*/ static int __init ep8248e_probe (void ) { -unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"fsl,ep8248e" ); +return of_machine_is_compatible ("fsl,ep8248e" ); }define_machine (ep8248e)
arch/powerpc/platforms/82xx/km82xx.c +1 -2
@@ -198,8 +198,7 @@ machine_device_initcall(km82xx, declare_of_platform_devices);*/ static int __init km82xx_probe (void ) { -unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"keymile,km82xx" ); +return of_machine_is_compatible ("keymile,km82xx" ); }define_machine (km82xx)
arch/powerpc/platforms/82xx/mpc8272_ads.c +1 -2
@@ -201,8 +201,7 @@ machine_device_initcall(mpc8272_ads, declare_of_platform_devices);*/ static int __init mpc8272_ads_probe (void ) { -unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"fsl,mpc8272ads" ); +return of_machine_is_compatible ("fsl,mpc8272ads" ); }define_machine (mpc8272_ads)
arch/powerpc/platforms/82xx/pq2fads.c +1 -2
@@ -164,8 +164,7 @@ static void __init pq2fads_setup_arch(void)*/ static int __init pq2fads_probe (void ) { -unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"fsl,pq2fads" ); +return of_machine_is_compatible ("fsl,pq2fads" ); }static const struct of_device_id of_bus_ids[]__initconst = {
arch/powerpc/platforms/83xx/asp834x.c +1 -2
@@ -43,8 +43,7 @@ machine_device_initcall(asp834x, mpc83xx_declare_of_platform_devices);*/ static int __init asp834x_probe (void ) { -unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"analogue-and-micro,asp8347e" ); +return of_machine_is_compatible ("analogue-and-micro,asp8347e" ); }define_machine (asp834x) {
arch/powerpc/platforms/83xx/km83xx.c +1 -2
@@ -171,11 +171,10 @@ static char *board[] __initdata = {*/ static int __init mpc83xx_km_probe (void ) { -unsigned long node =of_get_flat_dt_root ();int i =0 ;while (board[i]) { -if (of_flat_dt_is_compatible (node, board[i])) +if (of_machine_is_compatible (board[i]))break ; i++; }
arch/powerpc/platforms/83xx/mpc830x_rdb.c +1 -1
@@ -46,7 +46,7 @@ static const char *board[] __initdata = {*/ static int __init mpc830x_rdb_probe (void ) { -return of_flat_dt_match (of_get_flat_dt_root (), board); +return of_device_compatible_match (of_root, board); }machine_device_initcall (mpc830x_rdb, mpc83xx_declare_of_platform_devices);
arch/powerpc/platforms/83xx/mpc831x_rdb.c +1 -1
@@ -46,7 +46,7 @@ static const char *board[] __initdata = {*/ static int __init mpc831x_rdb_probe (void ) { -return of_flat_dt_match (of_get_flat_dt_root (), board); +return of_device_compatible_match (of_root, board); }machine_device_initcall (mpc831x_rdb, mpc83xx_declare_of_platform_devices);
arch/powerpc/platforms/83xx/mpc832x_mds.c +1 -3
@@ -102,9 +102,7 @@ machine_device_initcall(mpc832x_mds, mpc83xx_declare_of_platform_devices);*/ static int __init mpc832x_sys_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"MPC832xMDS" ); +return of_machine_is_compatible ("MPC832xMDS" ); }define_machine (mpc832x_mds) {
arch/powerpc/platforms/83xx/mpc832x_rdb.c +1 -3
@@ -220,9 +220,7 @@ machine_device_initcall(mpc832x_rdb, mpc83xx_declare_of_platform_devices);*/ static int __init mpc832x_rdb_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"MPC832xRDB" ); +return of_machine_is_compatible ("MPC832xRDB" ); }define_machine (mpc832x_rdb) {
arch/powerpc/platforms/83xx/mpc834x_itx.c +1 -3
@@ -70,9 +70,7 @@ static void __init mpc834x_itx_setup_arch(void)*/ static int __init mpc834x_itx_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"MPC834xMITX" ); +return of_machine_is_compatible ("MPC834xMITX" ); }define_machine (mpc834x_itx) {
arch/powerpc/platforms/83xx/mpc834x_mds.c +1 -3
@@ -91,9 +91,7 @@ machine_device_initcall(mpc834x_mds, mpc83xx_declare_of_platform_devices);*/ static int __init mpc834x_mds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"MPC834xMDS" ); +return of_machine_is_compatible ("MPC834xMDS" ); }define_machine (mpc834x_mds) {
arch/powerpc/platforms/83xx/mpc836x_mds.c +1 -3
@@ -209,9 +209,7 @@ machine_arch_initcall(mpc836x_mds, mpc836x_usb_cfg);*/ static int __init mpc836x_mds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"MPC836xMDS" ); +return of_machine_is_compatible ("MPC836xMDS" ); }define_machine (mpc836x_mds) {
arch/powerpc/platforms/83xx/mpc836x_rdk.c +1 -3
@@ -42,9 +42,7 @@ static void __init mpc836x_rdk_setup_arch(void)*/ static int __init mpc836x_rdk_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,mpc8360rdk" ); +return of_machine_is_compatible ("fsl,mpc8360rdk" ); }define_machine (mpc836x_rdk) {
arch/powerpc/platforms/83xx/mpc837x_mds.c +1 -3
@@ -93,9 +93,7 @@ machine_device_initcall(mpc837x_mds, mpc83xx_declare_of_platform_devices);*/ static int __init mpc837x_mds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,mpc837xmds" ); +return of_machine_is_compatible ("fsl,mpc837xmds" ); }define_machine (mpc837x_mds) {
arch/powerpc/platforms/83xx/mpc837x_rdb.c +1 -1
@@ -73,7 +73,7 @@ static const char * const board[] __initconst = {*/ static int __init mpc837x_rdb_probe (void ) { -return of_flat_dt_match (of_get_flat_dt_root (), board); +return of_device_compatible_match (of_root, board); }define_machine (mpc837x_rdb) {
arch/powerpc/platforms/83xx/sbc834x.c +1 -3
@@ -60,9 +60,7 @@ machine_device_initcall(sbc834x, mpc83xx_declare_of_platform_devices);*/ static int __init sbc834x_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"SBC834xE" ); +return of_machine_is_compatible ("SBC834xE" ); }define_machine (sbc834x) {
arch/powerpc/platforms/85xx/bsc913x_qds.c +1 -3
@@ -60,9 +60,7 @@ machine_arch_initcall(bsc9132_qds, mpc85xx_common_publish_devices);static int __init bsc9132_qds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,bsc9132qds" ); +return of_machine_is_compatible ("fsl,bsc9132qds" ); }define_machine (bsc9132_qds) {
arch/powerpc/platforms/85xx/bsc913x_rdb.c +1 -3
@@ -50,9 +50,7 @@ machine_device_initcall(bsc9131_rdb, mpc85xx_common_publish_devices);static int __init bsc9131_rdb_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,bsc9131rdb" ); +return of_machine_is_compatible ("fsl,bsc9131rdb" ); }define_machine (bsc9131_rdb) {
arch/powerpc/platforms/85xx/c293pcie.c +1 -3
@@ -54,9 +54,7 @@ machine_arch_initcall(c293_pcie, mpc85xx_common_publish_devices);*/ static int __init c293_pcie_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"fsl,C293PCIE" )) +if (of_machine_is_compatible ("fsl,C293PCIE" ))return 1 ;return 0 ; }
arch/powerpc/platforms/85xx/corenet_generic.c +2 -3
@@ -170,20 +170,19 @@ static const char * const boards[] __initconst = {*/ static int __init corenet_generic_probe (void ) { -unsigned long root =of_get_flat_dt_root ();char hv_compat[24 ];int i;#ifdef CONFIG_SMP extern struct smp_ops_t smp_85xx_ops;#endif -if (of_flat_dt_match (root, boards)) +if (of_device_compatible_match (of_root, boards))return 1 ;/* Check if we're running under the Freescale hypervisor */ for (i =0 ; boards[i]; i++) {snprintf (hv_compat,sizeof (hv_compat),"%s-hv" , boards[i]); -if (of_flat_dt_is_compatible (root, hv_compat)) { +if (of_machine_is_compatible (hv_compat)) { ppc_md.init_IRQ = ehv_pic_init; ppc_md.get_irq = ehv_pic_get_irq;
arch/powerpc/platforms/85xx/ge_imp3a.c +1 -3
@@ -197,9 +197,7 @@ static void ge_imp3a_show_cpuinfo(struct seq_file *m)*/ static int __init ge_imp3a_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"ge,IMP3A" ); +return of_machine_is_compatible ("ge,IMP3A" ); }machine_arch_initcall (ge_imp3a, mpc85xx_common_publish_devices);
arch/powerpc/platforms/85xx/ksi8560.c +1 -3
@@ -176,9 +176,7 @@ machine_device_initcall(ksi8560, mpc85xx_common_publish_devices);*/ static int __init ksi8560_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"emerson,KSI8560" ); +return of_machine_is_compatible ("emerson,KSI8560" ); }define_machine (ksi8560) {
arch/powerpc/platforms/85xx/mpc8536_ds.c +1 -3
@@ -64,9 +64,7 @@ machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier);*/ static int __init mpc8536_ds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,mpc8536ds" ); +return of_machine_is_compatible ("fsl,mpc8536ds" ); }define_machine (mpc8536_ds) {
arch/powerpc/platforms/85xx/mpc85xx_ads.c +1 -3
@@ -160,9 +160,7 @@ machine_arch_initcall(mpc85xx_ads, mpc85xx_common_publish_devices);*/ static int __init mpc85xx_ads_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"MPC85xxADS" ); +return of_machine_is_compatible ("MPC85xxADS" ); }define_machine (mpc85xx_ads) {
arch/powerpc/platforms/85xx/mpc85xx_cds.c +1 -3
@@ -367,9 +367,7 @@ static void mpc85xx_cds_show_cpuinfo(struct seq_file *m)*/ static int __init mpc85xx_cds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"MPC85xxCDS" ); +return of_machine_is_compatible ("MPC85xxCDS" ); }machine_arch_initcall (mpc85xx_cds, mpc85xx_common_publish_devices);
arch/powerpc/platforms/85xx/mpc85xx_ds.c +3 -9
@@ -167,9 +167,7 @@ static void __init mpc85xx_ds_setup_arch(void)*/ static int __init mpc8544_ds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return !!of_flat_dt_is_compatible (root,"MPC8544DS" ); +return !!of_machine_is_compatible ("MPC8544DS" ); }machine_arch_initcall (mpc8544_ds, mpc85xx_common_publish_devices);
@@ -185,9 +183,7 @@ machine_arch_initcall(p2020_ds, swiotlb_setup_bus_notifier);*/ static int __init mpc8572_ds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return !!of_flat_dt_is_compatible (root,"fsl,MPC8572DS" ); +return !!of_machine_is_compatible ("fsl,MPC8572DS" ); }/*
@@ -195,9 +191,7 @@ static int __init mpc8572_ds_probe(void)*/ static int __init p2020_ds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return !!of_flat_dt_is_compatible (root,"fsl,P2020DS" ); +return !!of_machine_is_compatible ("fsl,P2020DS" ); }define_machine (mpc8544_ds) {
arch/powerpc/platforms/85xx/mpc85xx_mds.c +3 -9
@@ -376,9 +376,7 @@ static void __init mpc85xx_mds_pic_init(void)static int __init mpc85xx_mds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"MPC85xxMDS" ); +return of_machine_is_compatible ("MPC85xxMDS" ); }define_machine (mpc8568_mds) {
@@ -398,9 +396,7 @@ define_machine(mpc8568_mds) {static int __init mpc8569_mds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,MPC8569EMDS" ); +return of_machine_is_compatible ("fsl,MPC8569EMDS" ); }define_machine (mpc8569_mds) {
@@ -420,9 +416,7 @@ define_machine(mpc8569_mds) {static int __init p1021_mds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,P1021MDS" ); +return of_machine_is_compatible ("fsl,P1021MDS" ); }
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +10 -30
@@ -147,80 +147,60 @@ machine_arch_initcall(p1024_rdb, mpc85xx_common_publish_devices);*/ static int __init p2020_rdb_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"fsl,P2020RDB" )) +if (of_machine_is_compatible ("fsl,P2020RDB" ))return 1 ;return 0 ; }static int __init p1020_rdb_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"fsl,P1020RDB" )) +if (of_machine_is_compatible ("fsl,P1020RDB" ))return 1 ;return 0 ; }static int __init p1020_rdb_pc_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,P1020RDB-PC" ); +return of_machine_is_compatible ("fsl,P1020RDB-PC" ); }static int __init p1020_rdb_pd_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,P1020RDB-PD" ); +return of_machine_is_compatible ("fsl,P1020RDB-PD" ); }static int __init p1021_rdb_pc_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"fsl,P1021RDB-PC" )) +if (of_machine_is_compatible ("fsl,P1021RDB-PC" ))return 1 ;return 0 ; }static int __init p2020_rdb_pc_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"fsl,P2020RDB-PC" )) +if (of_machine_is_compatible ("fsl,P2020RDB-PC" ))return 1 ;return 0 ; }static int __init p1025_rdb_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,P1025RDB" ); +return of_machine_is_compatible ("fsl,P1025RDB" ); }static int __init p1020_mbg_pc_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,P1020MBG-PC" ); +return of_machine_is_compatible ("fsl,P1020MBG-PC" ); }static int __init p1020_utm_pc_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,P1020UTM-PC" ); +return of_machine_is_compatible ("fsl,P1020UTM-PC" ); }static int __init p1024_rdb_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,P1024RDB" ); +return of_machine_is_compatible ("fsl,P1024RDB" ); }define_machine (p2020_rdb) {
arch/powerpc/platforms/85xx/mvme2500.c +1 -3
@@ -53,9 +53,7 @@ machine_arch_initcall(mvme2500, mpc85xx_common_publish_devices);*/ static int __init mvme2500_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"artesyn,MVME2500" ); +return of_machine_is_compatible ("artesyn,MVME2500" ); }define_machine (mvme2500) {
arch/powerpc/platforms/85xx/p1010rdb.c +2 -4
@@ -62,11 +62,9 @@ machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier);*/ static int __init p1010_rdb_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"fsl,P1010RDB" )) +if (of_machine_is_compatible ("fsl,P1010RDB" ))return 1 ; -if (of_flat_dt_is_compatible (root,"fsl,P1010RDB-PB" )) +if (of_machine_is_compatible ("fsl,P1010RDB-PB" ))return 1 ;return 0 ; }
arch/powerpc/platforms/85xx/p1022_ds.c +1 -3
@@ -555,9 +555,7 @@ machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier);*/ static int __init p1022_ds_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,p1022ds" ); +return of_machine_is_compatible ("fsl,p1022ds" ); }define_machine (p1022_ds) {
arch/powerpc/platforms/85xx/p1022_rdk.c +1 -3
@@ -135,9 +135,7 @@ machine_arch_initcall(p1022_rdk, swiotlb_setup_bus_notifier);*/ static int __init p1022_rdk_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,p1022rdk" ); +return of_machine_is_compatible ("fsl,p1022rdk" ); }define_machine (p1022_rdk) {
arch/powerpc/platforms/85xx/p1023_rdb.c +1 -3
@@ -100,9 +100,7 @@ static void __init mpc85xx_rdb_pic_init(void)static int __init p1023_rdb_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"fsl,P1023RDB" ); +return of_machine_is_compatible ("fsl,P1023RDB" ); }
arch/powerpc/platforms/85xx/ppa8548.c +1 -3
@@ -81,9 +81,7 @@ machine_device_initcall(ppa8548, declare_of_platform_devices);*/ static int __init ppa8548_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"ppa8548" ); +return of_machine_is_compatible ("ppa8548" ); }define_machine (ppa8548) {
arch/powerpc/platforms/85xx/qemu_e500.c +1 -3
@@ -62,9 +62,7 @@ static void __init qemu_e500_setup_arch(void)*/ static int __init qemu_e500_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return !!of_flat_dt_is_compatible (root,"fsl,qemu-e500" ); +return !!of_machine_is_compatible ("fsl,qemu-e500" ); }machine_arch_initcall (qemu_e500, mpc85xx_common_publish_devices);
arch/powerpc/platforms/85xx/sbc8548.c +1 -3
@@ -120,9 +120,7 @@ machine_arch_initcall(sbc8548, mpc85xx_common_publish_devices);*/ static int __init sbc8548_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"SBC8548" ); +return of_machine_is_compatible ("SBC8548" ); }define_machine (sbc8548) {
arch/powerpc/platforms/85xx/socrates.c +1 -3
@@ -79,9 +79,7 @@ machine_arch_initcall(socrates, mpc85xx_common_publish_devices);*/ static int __init socrates_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"abb,socrates" )) +if (of_machine_is_compatible ("abb,socrates" ))return 1 ;return 0 ;
arch/powerpc/platforms/85xx/stx_gp3.c +1 -3
@@ -93,9 +93,7 @@ machine_arch_initcall(stx_gp3, mpc85xx_common_publish_devices);*/ static int __init stx_gp3_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"stx,gp3-8560" ); +return of_machine_is_compatible ("stx,gp3-8560" ); }define_machine (stx_gp3) {
arch/powerpc/platforms/85xx/tqm85xx.c +1 -1
@@ -122,7 +122,7 @@ static const char * const board[] __initconst = {*/ static int __init tqm85xx_probe (void ) { -return of_flat_dt_match (of_get_flat_dt_root (), board); +return of_device_compatible_match (of_root, board); }define_machine (tqm85xx) {
arch/powerpc/platforms/85xx/twr_p102x.c +1 -3
@@ -127,10 +127,8 @@ static void __init twr_p1025_setup_arch(void)machine_arch_initcall (twr_p1025, mpc85xx_common_publish_devices);static int __init twr_p1025_probe (void ) -{ -unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"fsl,TWR-P1025" ); + return of_machine_is_compatible("fsl,TWR-P1025"); } define_machine(twr_p1025) {
arch/powerpc/platforms/85xx/xes_mpc85xx.c +3 -9
@@ -144,23 +144,17 @@ machine_arch_initcall(xes_mpc8540, mpc85xx_common_publish_devices);*/ static int __init xes_mpc8572_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"xes,MPC8572" ); +return of_machine_is_compatible ("xes,MPC8572" ); }static int __init xes_mpc8548_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"xes,MPC8548" ); +return of_machine_is_compatible ("xes,MPC8548" ); }static int __init xes_mpc8540_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"xes,MPC8540" ); +return of_machine_is_compatible ("xes,MPC8540" ); }define_machine (xes_mpc8572) {
arch/powerpc/platforms/86xx/gef_ppc9a.c +1 -3
@@ -189,9 +189,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,*/ static int __init gef_ppc9a_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"gef,ppc9a" )) +if (of_machine_is_compatible ("gef,ppc9a" ))return 1 ;return 0 ;
arch/powerpc/platforms/86xx/gef_sbc310.c +1 -3
@@ -176,9 +176,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,*/ static int __init gef_sbc310_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"gef,sbc310" )) +if (of_machine_is_compatible ("gef,sbc310" ))return 1 ;return 0 ;
arch/powerpc/platforms/86xx/gef_sbc610.c +1 -3
@@ -166,9 +166,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,*/ static int __init gef_sbc610_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"gef,sbc610" )) +if (of_machine_is_compatible ("gef,sbc610" ))return 1 ;return 0 ;
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +1 -3
@@ -319,9 +319,7 @@ static void __init mpc86xx_hpcd_setup_arch(void)*/ static int __init mpc86xx_hpcd_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"fsl,MPC8610HPCD" )) +if (of_machine_is_compatible ("fsl,MPC8610HPCD" ))return 1 ;/* Looks good */ return 0 ;
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +2 -4
@@ -96,13 +96,11 @@ mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)*/ static int __init mpc86xx_hpcn_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"fsl,mpc8641hpcn" )) +if (of_machine_is_compatible ("fsl,mpc8641hpcn" ))return 1 ;/* Looks good */ /* Be nice and don't give silent boot death. Delete this in 2.6.27 */ -if (of_flat_dt_is_compatible (root,"mpc86xx" )) { +if (of_machine_is_compatible ("mpc86xx" )) {pr_warning ("WARNING: your dts/dtb is old. You must update before the next kernel release\n" );return 1 ; }
arch/powerpc/platforms/86xx/sbc8641d.c +1 -3
@@ -67,9 +67,7 @@ sbc8641_show_cpuinfo(struct seq_file *m)*/ static int __init sbc8641_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"wind,sbc8641" )) +if (of_machine_is_compatible ("wind,sbc8641" ))return 1 ;/* Looks good */ return 0 ;
arch/powerpc/platforms/8xx/adder875.c +1 -2
@@ -88,8 +88,7 @@ static void __init adder875_setup(void)static int __init adder875_probe (void ) { -unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"analogue-and-micro,adder875" ); +return of_machine_is_compatible ("analogue-and-micro,adder875" ); }static const struct of_device_id of_bus_ids[]__initconst = {
arch/powerpc/platforms/8xx/ep88xc.c +1 -2
@@ -143,8 +143,7 @@ static void __init ep88xc_setup_arch(void)static int __init ep88xc_probe (void ) { -unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"fsl,ep88xc" ); +return of_machine_is_compatible ("fsl,ep88xc" ); }static const struct of_device_id of_bus_ids[]__initconst = {
arch/powerpc/platforms/8xx/mpc86xads_setup.c +1 -2
@@ -118,8 +118,7 @@ static void __init mpc86xads_setup_arch(void)static int __init mpc86xads_probe (void ) { -unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"fsl,mpc866ads" ); +return of_machine_is_compatible ("fsl,mpc866ads" ); }static const struct of_device_id of_bus_ids[]__initconst = {
arch/powerpc/platforms/8xx/mpc885ads_setup.c +1 -2
@@ -193,8 +193,7 @@ static void __init mpc885ads_setup_arch(void)static int __init mpc885ads_probe (void ) { -unsigned long root =of_get_flat_dt_root (); -return of_flat_dt_is_compatible (root,"fsl,mpc885ads" ); +return of_machine_is_compatible ("fsl,mpc885ads" ); }static const struct of_device_id of_bus_ids[]__initconst = {
arch/powerpc/platforms/8xx/tqm8xx_setup.c +1 -3
@@ -119,9 +119,7 @@ static void __init tqm8xx_setup_arch(void)static int __init tqm8xx_probe (void ) { -unsigned long node =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (node,"tqc,tqm8xx" ); +return of_machine_is_compatible ("tqc,tqm8xx" ); }static const struct of_device_id of_bus_ids[]__initconst = {
arch/powerpc/platforms/amigaone/setup.c +1 -3
@@ -143,9 +143,7 @@ void amigaone_restart(char *cmd)static int __init amigaone_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"eyetech,amigaone" )) { +if (of_machine_is_compatible ("eyetech,amigaone" )) {/* * Coherent memory access cause complete system lockup! Thus * disable this CPU feature, even if the CPU needs it.
arch/powerpc/platforms/embedded6xx/c2k.c +1 -3
@@ -123,9 +123,7 @@ void c2k_show_cpuinfo(struct seq_file *m)*/ static int __init c2k_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"GEFanuc,C2K" )) +if (!of_machine_is_compatible ("GEFanuc,C2K" ))return 0 ;printk (KERN_INFO "Detected a GEFanuc C2K board\n" );
arch/powerpc/platforms/embedded6xx/gamecube.c +1 -4
@@ -61,10 +61,7 @@ static void __init gamecube_init_early(void)static int __init gamecube_probe (void ) { -unsigned long dt_root; - - dt_root =of_get_flat_dt_root (); -if (!of_flat_dt_is_compatible (dt_root,"nintendo,gamecube" )) +if (!of_machine_is_compatible ("nintendo,gamecube" ))return 0 ; pm_power_off = gamecube_power_off;
arch/powerpc/platforms/embedded6xx/holly.c +1 -3
@@ -250,9 +250,7 @@ void holly_halt(void)*/ static int __init holly_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"ibm,holly" )) +if (!of_machine_is_compatible ("ibm,holly" ))return 0 ;return 1 ; }
arch/powerpc/platforms/embedded6xx/linkstation.c +1 -5
@@ -141,11 +141,7 @@ static void linkstation_show_cpuinfo(struct seq_file *m)static int __init linkstation_probe (void ) { -unsigned long root; - - root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"linkstation" )) +if (!of_machine_is_compatible ("linkstation" ))return 0 ; pm_power_off = linkstation_power_off;
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c +1 -3
@@ -161,9 +161,7 @@ void mpc7448_hpc2_restart(char *cmd)*/ static int __init mpc7448_hpc2_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"mpc74xx" )) +if (!of_machine_is_compatible ("mpc74xx" ))return 0 ;return 1 ; }
arch/powerpc/platforms/embedded6xx/mvme5100.c +1 -3
@@ -194,9 +194,7 @@ static void mvme5100_restart(char *cmd)*/ static int __init mvme5100_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"MVME5100" ); +return of_machine_is_compatible ("MVME5100" ); }static int __init probe_of_platform_devices (void )
arch/powerpc/platforms/embedded6xx/storcenter.c +1 -3
@@ -109,9 +109,7 @@ static void storcenter_restart(char *cmd)static int __init storcenter_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -return of_flat_dt_is_compatible (root,"iomega,storcenter" ); +return of_machine_is_compatible ("iomega,storcenter" ); }define_machine (storcenter){
arch/powerpc/platforms/embedded6xx/wii.c +1 -4
@@ -205,10 +205,7 @@ static void __init wii_pic_probe(void)static int __init wii_probe (void ) { -unsigned long dt_root; - - dt_root =of_get_flat_dt_root (); -if (!of_flat_dt_is_compatible (dt_root,"nintendo,wii" )) +if (!of_machine_is_compatible ("nintendo,wii" ))return 0 ; pm_power_off = wii_power_off;
arch/powerpc/platforms/powermac/setup.c +0 -8
@@ -588,17 +588,9 @@ console_initcall(check_pmac_serial_console);*/ static int __init pmac_probe (void ) { -#ifdef CONFIG_PPC32 -unsigned long root =of_get_flat_dt_root (); - -if (!of_flat_dt_is_compatible (root,"Power Macintosh" ) && - !of_flat_dt_is_compatible (root,"MacRISC" )) -return 0 ; -#else if (!of_machine_is_compatible ("Power Macintosh" ) && !of_machine_is_compatible ("MacRISC" ))return 0 ; -#endif #ifdef CONFIG_PPC32 /* isa_io_base gets set in pmac_pci_init */
Signature · 1 line
2.7.4
Re: [PATCH 29/38] powerpc: Move 32-bit probe() machine to later in the boot process
Am 2016-06-27 um 13:29 schrieb Benjamin Herrenschmidt:
Quoted 7 lines
This converts all the 32-bit platforms to use the expanded device-tree which is a pretty mechanical change. Unlike 64-bit, the 32-bit kernel didn't rely on platform initializations to setup the MMU since it sets it up entirely before
probe_machine()so the move has comparatively less consequences though it's a bigger patch.Signed-off-by Benjamin Herrenschmidt <[email protected]>
[...]
Quoted 5 lines
arch/powerpc/platforms/amigaone/setup.c +0
-0
arch/powerpc/platforms/amigaone/setup.c void amigaone_restart(char *cmd) · line 149
Quoted 10 lines
arch/powerpc/platforms/amigaone/setup.c +1
-3@@ -143,9 +143,7 @@ void amigaone_restart(char *cmd)static int __init amigaone_probe (void ) { -unsigned long root =of_get_flat_dt_root (); - -if (of_flat_dt_is_compatible (root,"eyetech,amigaone" )) { +if (of_machine_is_compatible ("eyetech,amigaone" )) {/* * Coherent memory access cause complete system lockup! Thus * disable this CPU feature, even if the CPU needs it.
This patch series reminds me of a long-standing issue with the AmigaOne platform code, which would have to clear the coherence
(M) flag for every memory mapping to avoid lockups (especially on G4 CPUs) - as you can read in the comment below your patch above.
Now the follow-up code in amigaone/setup.c to clear the corresponding CPU feature flag is essentially dead code (it used to work with a second call of do_feature_fixups() before the handling of the CPU_FTR_NEED_COHERENT flag was changed/inverted somewhere around v2.6.30). Also it doesn't seem to fix all deadlocks, as e.g. KVM virtual machines can still inject memory mappings with the M flag set AFAICT.
Now I wonder, if there is a reasonably clean way to clear the M flag in all hardware page table and BAT entries without defacing generic kernel code too much. Any ideas?
BR,
Gerhard
Re: [PATCH 29/38] powerpc: Move 32-bit probe() machine to later in the boot process
Quoted 14 lines · Gerhard Pircher
This patch series reminds me of a long-standing issue with the AmigaOne platform code, which would have to clear the coherence
(M) flag for every memory mapping to avoid lockups (especially on G4 CPUs) - as you can read in the comment below your patch above.Now the follow-up code in
amigaone/setup.cto clear the corresponding CPU feature flag is essentially dead code (it used to work with a second call ofdo_feature_fixups()before the handling of theCPU_FTR_NEED_COHERENTflag was changed/inverted somewhere around v2.6.30). Also it doesn't seem to fix all deadlocks, as e.g. KVM virtual machines can still inject memory mappings with the M flag set AFAICT.
Quoted 3 lines
Now I wonder, if there is a reasonably clean way to clear the M flag in all hardware page table and BAT entries without defacing generic kernel code too much. Any ideas?
Other than a compile time option ? Do we know where the lockups come from btw ? A problem with the northbridge ?
Cheers,
Ben.
Re: [PATCH 29/38] powerpc: Move 32-bit probe() machine to later in the boot process
Quoted 15 lines · Benjamin Herrenschmidt
Quoted 14 lines · Gerhard Pircher
This patch series reminds me of a long-standing issue with the AmigaOne platform code, which would have to clear the coherence
(M) flag for every memory mapping to avoid lockups (especially on G4 CPUs) - as you can read in the comment below your patch above.Now the follow-up code in
amigaone/setup.cto clear the corresponding CPU feature flag is essentially dead code (it used to work with a second call ofdo_feature_fixups()before the handling of theCPU_FTR_NEED_COHERENTflag was changed/inverted somewhere around v2.6.30). Also it doesn't seem to fix all deadlocks, as e.g. KVM virtual machines can still inject memory mappings with the M flag set AFAICT.
Quoted 5 lines
Quoted 3 lines
Now I wonder, if there is a reasonably clean way to clear the M flag in all hardware page table and BAT entries without defacing generic kernel code too much. Any ideas?
Other than a compile time option ?
Well, I guess a runtime option would always be preferable, but I don't see how this could be implemented without moving probe_machine() in front of identify_cpu() (which doesn't look easy either). On the other side the AmigaOne also requires CONFIG_NOT_COHERENT_CACHE set and this one is still a compile time option, too.
The question is, if a compile time option that simply clears CPU_FTR_NEED_COHERENT after identify_cpu() would be acceptable. And then I still wonder why KVM needs its own similar fix to work on the AmigaOne. I specifically had to remove/clear the PTE_M bit in arch/powerpc/kvm/book3s_32_mmu_host.c for this:
206 pteg0 = ((eaddr & 0x0fffffff) >> 22) | (vsid << 7) | PTE_V |
207 (primary ? 0 : PTE_SEC);
208 pteg1 = hpaddr | PTE_M | PTE_R | PTE_C;
^^^^^Quoted 2 lines
Do we know where the lockups come from btw ? A problem with the northbridge ?
Yes, it's a problem with the northbridge...as usual. :-(
Quoted 2 lines
Cheers,
Ben.
Thanks!
BR,
Gerhard
Re: [PATCH 29/38] powerpc: Move 32-bit probe() machine to later in the boot process
Quoted 5 lines · Gerhard Pircher
The question is, if a compile time option that simply clear ?s
CPU_FTR_NEED_COHERENTafteridentify_cpu()would be acceptable. And then I still wonder why KVM needs its own similar fix to work on the AmigaOne. I specifically had to remove/clear thePTE_Mbitinarch/powerpc/kvm/book3s_32_mmu_host.cfor th
No we could just add something to early_init_devtree that does clear
that bit if it sees the relevant piece of broken HW, it's not the AmigaOne per-se, it's the northbridge right ?
We could also make non-coherent cache a runtime option if we really wanted, it's just more churn ...
Quoted 9 lines
206 pteg0 = ((eaddr &
0x0fffffff) >> 22) | (vsid << 7) |PTE_V|
207 (primary ? 0 :PTE_SEC);
208 pteg1 = hpaddr |PTE_M|PTE_R|PTE_C; ^^^^^Quoted 2 lines
Do we know where the lockups come from btw ? A problem with the northbridge ?
Yes, it's a problem with the northbridge...as usual. :-(
Marvell ?
Cheers,
Ben.
Re: [PATCH 29/38] powerpc: Move 32-bit probe() machine to later in the boot process
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 5 lines · Gerhard Pircher
The question is, if a compile time option that simply clear ?s
CPU_FTR_NEED_COHERENTafteridentify_cpu()would be acceptable. And then I still wonder why KVM needs its own similar fix to work on the AmigaOne. I specifically had to remove/clear thePTE_Mbitinarch/powerpc/kvm/book3s_32_mmu_host.cfor thNo we could just add something to
early_init_devtreethat does clear
that bit if it sees the relevant piece of broken HW, it's not the AmigaOne per-se, it's the northbridge right ?
Does that work for CPU_FTR_NEED_COHERENT, given that the feature fixups are done right after identify_cpu() and instructions within BEGIN_FTR_SECTION and END_FTR_SECTION* are patched out (if I understand this mechanism correctly) !?
But yes, the specific northbridge is the problem here.
Quoted 2 lines
We could also make non-coherent cache a runtime option if we really wanted, it's just more churn ...
Yeah, I remember a discussion or two about this topic and I always wondered how driver code would differentiate then between non-coherent and coherent DMA, given that they sometimes require different handling of the DMA addresses (e.g. if I look at /sound/core/pcm_native.c or the DRM code).
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
Do we know where the lockups come from btw ? A problem with the northbridge ?
Yes, it's a problem with the northbridge...as usual. :-(
Marvell ?
No, the one with the dreaded "A" name: MAI Logic's "Articia S" :-)
BR,
Gerhard
Re: [PATCH 29/38] powerpc: Move 32-bit probe() machine to later in the boot process
Quoted 6 lines · Gerhard Pircher
Quoted 2 lines
No we could just add something to
early_init_devtreethat does clear
that bit if it sees the relevant piece of broken HW, it's not the AmigaOne per-se, it's the northbridge right ?Does that work for
CPU_FTR_NEED_COHERENT, given that the feature fixups are done right afteridentify_cpu()and instructions withinBEGIN_FTR_SECTIONand END_FTR_SECTION* are patched out (if I understand this mechanism correctly) !?
Right that's a problem. We do the fixup before early_init_devtree() on ppc32 (we don't on ppc64) ... ugh. I'll have to think about it. We can try to make them match by moving the fixup but that means making sure that the transition to the "initial" MMU mapping use for machine_init() can be done without the fixups being applied.
I can have a quick sweep of the init code later today or tomorrow to see how bad that would be.
Otherwise, compile option...
Quoted 9 lines
But yes, the specific northbridge is the problem here.
Quoted 2 lines
We could also make non-coherent cache a runtime option if we really wanted, it's just more churn ...
Yeah, I remember a discussion or two about this topic and I always wondered how driver code would differentiate then between non-coherent and coherent DMA, given that they sometimes require different handling of the DMA addresses (e.g. if I look at /sound/core/pcm_native.c or the DRM code).
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
Do we know where the lockups come from btw ? A problem with the northbridge ?
Yes, it's a problem with the northbridge...as usual. :-(
Marvell ?No, the one with the dreaded "A" name: MAI Logic's "Articia S" :-)
Heh ok.
Cheers,
Ben.
PATCH 30/38 powerpc: Get rid of ppc_md.init_early()
In reply to Benjamin HerrenschmidtIt is now called right after platform probe, so the probe function can just do the job.
--- arch/powerpc/include/asm/machdep.h | 1 - arch/powerpc/kernel/setup_32.c | 3 --- arch/powerpc/kernel/setup_64.c | 8 -------- arch/powerpc/platforms/512x/mpc5121_ads.c | 8 ++++++-- arch/powerpc/platforms/512x/mpc512x_generic.c | 8 ++++++-- arch/powerpc/platforms/512x/pdm360ng.c | 8 ++++++-- arch/powerpc/platforms/chrp/setup.c | 5 +++-- arch/powerpc/platforms/embedded6xx/c2k.c | 4 +++- arch/powerpc/platforms/embedded6xx/gamecube.c | 8 ++------ arch/powerpc/platforms/embedded6xx/wii.c | 8 ++------ arch/powerpc/platforms/maple/setup.c | 15 ++------------- arch/powerpc/platforms/pasemi/setup.c | 8 ++------ arch/powerpc/platforms/powermac/setup.c | 5 +++-- arch/powerpc/platforms/powernv/setup.c | 5 +++-- arch/powerpc/platforms/pseries/setup.c | 9 +++++---- 15 files changed, 43 insertions(+), 60 deletions(-)
arch/powerpc/include/asm/machdep.h +0 -1
@@ -53,7 +53,6 @@ struct machdep_calls {int (*probe)(void );void (*setup_arch)(void );/* Optional, may be NULL */ -void (*init_early)(void );/* Optional, may be NULL. */ void (*show_cpuinfo)(struct seq_file *m);void (*show_percpuinfo)(struct seq_file *m,int i);
arch/powerpc/kernel/setup_32.c +0 -3
@@ -263,9 +263,6 @@ void __init setup_arch(char **cmdline_p)setup_power_save (); -if (ppc_md.init_early) - ppc_md.init_early (); -find_legacy_serial_ports ();smp_setup_cpu_maps ();
arch/powerpc/kernel/setup_64.c +0 -8
@@ -522,14 +522,6 @@ void __init setup_system(void)/* Probe the machine type */ probe_machine (); -/* -* Do some platform specific early initializations, that includes -* setting up the hash table pointers. It also sets up some interrupt-mapping -* related options that will be used by finish_device_tree() -*/ -if (ppc_md.init_early) - ppc_md.init_early (); -/* * We can discover serial ports now since the above did setup the * hash table management for us, thus ioremap works. We do that early
arch/powerpc/platforms/512x/mpc5121_ads.c +6 -2
@@ -57,7 +57,12 @@ static void __init mpc5121_ads_init_IRQ(void)*/ static int __init mpc5121_ads_probe (void ) { -return of_machine_is_compatible ("fsl,mpc5121ads" ); +if (!of_machine_is_compatible ("fsl,mpc5121ads" )) +return 0 ; + +mpc512x_init_early (); + +return 1 ; }define_machine (mpc5121_ads) {
@@ -65,7 +70,6 @@ define_machine(mpc5121_ads) { .probe = mpc5121_ads_probe, .setup_arch = mpc5121_ads_setup_arch, .init = mpc512x_init, - .init_early = mpc512x_init_early, .init_IRQ = mpc5121_ads_init_IRQ, .get_irq = ipic_get_irq, .calibrate_decr = generic_calibrate_decr,
arch/powerpc/platforms/512x/mpc512x_generic.c +6 -2
@@ -38,14 +38,18 @@ static const char * const board[] __initconst = {*/ static int __init mpc512x_generic_probe (void ) { -return of_device_compatible_match (of_root, board); +if (!of_device_compatible_match (of_root, board)) +return 0 ; + +mpc512x_init_early (); + +return 1 ; }define_machine (mpc512x_generic) { .name = "MPC512x generic", .probe = mpc512x_generic_probe, .init = mpc512x_init, - .init_early = mpc512x_init_early, .setup_arch = mpc512x_setup_arch, .init_IRQ = mpc512x_init_IRQ, .get_irq = ipic_get_irq,
arch/powerpc/platforms/512x/pdm360ng.c +6 -2
@@ -113,7 +113,12 @@ void __init pdm360ng_init(void)static int __init pdm360ng_probe (void ) { -return of_machine_is_compatible ("ifm,pdm360ng" ); +if (!of_machine_is_compatible ("ifm,pdm360ng" )) +return 0 ; + +mpc512x_init_early (); + +return 1 ; }define_machine (pdm360ng) {
@@ -121,7 +126,6 @@ define_machine(pdm360ng) { .probe = pdm360ng_probe, .setup_arch = mpc512x_setup_arch, .init = pdm360ng_init, - .init_early = mpc512x_init_early, .init_IRQ = mpc512x_init_IRQ, .get_irq = ipic_get_irq, .calibrate_decr = generic_calibrate_decr,
arch/powerpc/platforms/chrp/setup.c +3 -2
@@ -253,7 +253,7 @@ static void briq_restart(char *cmd)* But unfortunately, the firmware does not connect /chosen/{stdin,stdout} * the the built-in serial node. Instead, a /failsafe node is created. */ -static __init void chrp_init_early (void ) +static __init void chrp_init (void ) {struct device_node *node;const char *property;
@@ -587,6 +587,8 @@ static int __init chrp_probe(void) pm_power_off = rtas_power_off; +chrp_init (); +return 1 ; }
@@ -595,7 +597,6 @@ define_machine(chrp) { .probe = chrp_probe, .setup_arch = chrp_setup_arch, .init = chrp_init2, - .init_early = chrp_init_early, .show_cpuinfo = chrp_show_cpuinfo, .init_IRQ = chrp_init_IRQ, .restart = rtas_restart,
arch/powerpc/platforms/embedded6xx/c2k.c +3 -1
@@ -130,6 +130,9 @@ static int __init c2k_probe(void)_set_L2CR (0 );_set_L2CR (L2CR_L2E |L2CR_L2PE |L2CR_L2I ); + +mv64x60_init_early (); +return 1 ; }
@@ -137,7 +140,6 @@ define_machine(c2k) { .name = "C2K", .probe = c2k_probe, .setup_arch = c2k_setup_arch, - .init_early = mv64x60_init_early, .show_cpuinfo = c2k_show_cpuinfo, .init_IRQ = mv64x60_init_irq, .get_irq = mv64x60_get_irq,
arch/powerpc/platforms/embedded6xx/gamecube.c +2 -6
@@ -54,11 +54,6 @@ static void gamecube_halt(void)gamecube_restart (NULL ); } -static void __init gamecube_init_early (void ) -{ -ug_udbg_init (); -} -static int __init gamecube_probe (void ) {if (!of_machine_is_compatible ("nintendo,gamecube" ))
@@ -66,6 +61,8 @@ static int __init gamecube_probe(void) pm_power_off = gamecube_power_off; +ug_udbg_init (); +return 1 ; }
@@ -77,7 +74,6 @@ static void gamecube_shutdown(void)define_machine (gamecube) { .name = "gamecube", .probe = gamecube_probe, - .init_early = gamecube_init_early, .restart = gamecube_restart, .halt = gamecube_halt, .init_IRQ = flipper_pic_probe,
arch/powerpc/platforms/embedded6xx/wii.c +2 -6
@@ -192,11 +192,6 @@ static void wii_halt(void)wii_spin (); } -static void __init wii_init_early (void ) -{ -ug_udbg_init (); -} -static void __init wii_pic_probe (void ) {flipper_pic_probe ();
@@ -210,6 +205,8 @@ static int __init wii_probe(void) pm_power_off = wii_power_off; +ug_udbg_init (); +return 1 ; }
@@ -222,7 +219,6 @@ static void wii_shutdown(void)define_machine (wii) { .name = "wii", .probe = wii_probe, - .init_early = wii_init_early, .setup_arch = wii_setup_arch, .restart = wii_restart, .halt = wii_halt,
arch/powerpc/platforms/maple/setup.c +2 -13
@@ -196,18 +196,6 @@ void __init maple_setup_arch(void)mmio_nvram_init (); } -/* -* Early initialization. -*/ -static void __init maple_init_early (void ) -{ -DBG (" -> maple_init_early\n" ); - -iommu_init_early_dart (&maple_pci_controller_ops); - -DBG (" <- maple_init_early\n" ); -} -/* * This is almost identical to pSeries and CHRP. We need to make that * code generic at one point, with appropriate bits in the device-tree to
@@ -304,6 +292,8 @@ static int __init maple_probe(void) pm_power_off = maple_power_off; +iommu_init_early_dart (&maple_pci_controller_ops); +return 1 ; }
@@ -311,7 +301,6 @@ define_machine(maple) { .name = "Maple", .probe = maple_probe, .setup_arch = maple_setup_arch, - .init_early = maple_init_early, .init_IRQ = maple_init_IRQ, .pci_irq_fixup = maple_pci_irq_fixup, .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq,
arch/powerpc/platforms/pasemi/setup.c +2 -6
@@ -339,11 +339,6 @@ out:return !!(srr1 &0x2 ); } -static void __init pas_init_early (void ) -{ -iommu_init_early_pasemi (); -} -#ifdef CONFIG_PCMCIA static int pcmcia_notify (struct notifier_block *nb,unsigned long action,void *data)
@@ -424,6 +419,8 @@ static int __init pas_probe(void) !of_machine_is_compatible("pasemi,pwrficient"))return 0 ; +iommu_init_early_pasemi (); +return 1 ; }
@@ -431,7 +428,6 @@ define_machine(pasemi) { .name = "PA Semi PWRficient", .probe = pas_probe, .setup_arch = pas_setup_arch, - .init_early = pas_init_early, .init_IRQ = pas_init_IRQ, .get_irq = mpic_get_irq, .restart = pas_restart,
arch/powerpc/platforms/powermac/setup.c +3 -2
@@ -450,7 +450,7 @@ pmac_halt(void)/* * Early initialization. */ -static void __init pmac_init_early (void ) +static void __init pmac_init (void ) {/* Enable early btext debug if requested */ if (strstr (boot_command_line,"btextdbg" )) {
@@ -601,6 +601,8 @@ static int __init pmac_probe(void) pm_power_off = pmac_power_off; +pmac_init (); +return 1 ; }
@@ -608,7 +610,6 @@ define_machine(powermac) { .name = "PowerMac", .probe = pmac_probe, .setup_arch = pmac_setup_arch, - .init_early = pmac_init_early, .show_cpuinfo = pmac_show_cpuinfo, .init_IRQ = pmac_pic_init, .get_irq = NULL, /* changed later */
arch/powerpc/platforms/powernv/setup.c +3 -2
@@ -58,7 +58,7 @@ static void __init pnv_setup_arch(void)/* XXX PMCS */ } -static void __init pnv_init_early (void ) +static void __init pnv_init (void ) {/* * Initialize the LPC bus now so that legacy serial
@@ -276,6 +276,8 @@ static int __init pnv_probe(void)pr_debug ("PowerNV detected !\n" ); +pnv_init (); +return 1 ; }
@@ -301,7 +303,6 @@ static unsigned long pnv_get_proc_freq(unsigned int cpu)define_machine (powernv) { .name = "PowerNV", .probe = pnv_probe, - .init_early = pnv_init_early, .setup_arch = pnv_setup_arch, .init_IRQ = pnv_init_IRQ, .show_cpuinfo = pnv_show_cpuinfo,
arch/powerpc/platforms/pseries/setup.c +5 -4
@@ -670,9 +670,9 @@ static void pSeries_cmo_feature_init(void)/* * Early initialization. Relocation is on but do not reference unbolted pages */ -static void __init pSeries_init_early (void ) +static void __init pSeries_init (void ) { -pr_debug (" -> pSeries_init_early()\n" ); +pr_debug (" -> pSeries_init()\n" );#ifdef CONFIG_HVC_CONSOLE if (firmware_has_feature (FW_FEATURE_LPAR ))
@@ -689,7 +689,7 @@ static void __init pSeries_init_early(void)pSeries_cmo_feature_init ();iommu_init_early_pSeries (); -pr_debug (" <- pSeries_init_early()\n" ); +pr_debug (" <- pSeries_init()\n" ); }/**
@@ -741,6 +741,8 @@ static int __init pSeries_probe(void)pr_debug ("Machine is%s LPAR !\n" , (powerpc_firmware_features &FW_FEATURE_LPAR ) ?"" :" not" ); +pSeries_init (); +return 1 ; }
@@ -759,7 +761,6 @@ define_machine(pseries) { .name = "pSeries", .probe = pSeries_probe, .setup_arch = pSeries_setup_arch, - .init_early = pSeries_init_early, .show_cpuinfo = pSeries_show_cpuinfo, .log_error = pSeries_log_error, .pcibios_fixup = pSeries_final_fixup,
Signature · 1 line
2.7.4
PATCH 31/38 powerpc/64: Move the boot time info banner to a separate function
In reply to Benjamin Herrenschmidt--- arch/powerpc/kernel/setup_64.c | 66 ++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 31 deletions(-)
arch/powerpc/kernel/setup_64.c +35 -31
@@ -487,6 +487,37 @@ static void __init initialize_cache_info(void)DBG (" <- initialize_cache_info()\n" ); } +static __init void print_system_info (void ) +{ +pr_info ("-----------------------------------------------------\n" ); +pr_info ("ppc64_pft_size = 0x%llx\n" , ppc64_pft_size); +pr_info ("phys_mem_size = 0x%llx\n" ,memblock_phys_mem_size ()); + +if (ppc64_caches.dline_size !=0x80 ) +pr_info ("dcache_line_size = 0x%x\n" , ppc64_caches.dline_size); +if (ppc64_caches.iline_size !=0x80 ) +pr_info ("icache_line_size = 0x%x\n" , ppc64_caches.iline_size); + +pr_info ("cpu_features = 0x%016lx\n" , cur_cpu_spec->cpu_features); +pr_info (" possible = 0x%016lx\n" ,CPU_FTRS_POSSIBLE ); +pr_info (" always = 0x%016lx\n" ,CPU_FTRS_ALWAYS ); +pr_info ("cpu_user_features = 0x%08x 0x%08x\n" , cur_cpu_spec->cpu_user_features, + cur_cpu_spec->cpu_user_features2); +pr_info ("mmu_features = 0x%08x\n" , cur_cpu_spec->mmu_features); +pr_info ("firmware_features = 0x%016lx\n" , powerpc_firmware_features); + +#ifdef CONFIG_PPC_STD_MMU_64 +if (htab_address) +pr_info ("htab_address = 0x%p\n" , htab_address); + +pr_info ("htab_hash_mask = 0x%lx\n" , htab_hash_mask); +#endif + +if (PHYSICAL_START >0 ) +pr_info ("physical_start = 0x%llx\n" , + (unsigned long long )PHYSICAL_START ); +pr_info ("-----------------------------------------------------\n" ); +}/* * Do some initial setup of the system. The parameters are those which
@@ -554,37 +585,10 @@ void __init setup_system(void)smp_release_cpus ();#endif -pr_info ("Starting Linux %s %s\n" ,init_utsname ()->machine, -init_utsname ()->version); - -pr_info ("-----------------------------------------------------\n" ); -pr_info ("ppc64_pft_size = 0x%llx\n" , ppc64_pft_size); -pr_info ("phys_mem_size = 0x%llx\n" ,memblock_phys_mem_size ()); - -if (ppc64_caches.dline_size !=0x80 ) -pr_info ("dcache_line_size = 0x%x\n" , ppc64_caches.dline_size); -if (ppc64_caches.iline_size !=0x80 ) -pr_info ("icache_line_size = 0x%x\n" , ppc64_caches.iline_size); - -pr_info ("cpu_features = 0x%016lx\n" , cur_cpu_spec->cpu_features); -pr_info (" possible = 0x%016lx\n" ,CPU_FTRS_POSSIBLE ); -pr_info (" always = 0x%016lx\n" ,CPU_FTRS_ALWAYS ); -pr_info ("cpu_user_features = 0x%08x 0x%08x\n" , cur_cpu_spec->cpu_user_features, - cur_cpu_spec->cpu_user_features2); -pr_info ("mmu_features = 0x%08x\n" , cur_cpu_spec->mmu_features); -pr_info ("firmware_features = 0x%016lx\n" , powerpc_firmware_features); - -#ifdef CONFIG_PPC_STD_MMU_64 -if (htab_address) -pr_info ("htab_address = 0x%p\n" , htab_address); - -pr_info ("htab_hash_mask = 0x%lx\n" , htab_hash_mask); -#endif - -if (PHYSICAL_START >0 ) -pr_info ("physical_start = 0x%llx\n" , - (unsigned long long )PHYSICAL_START ); -pr_info ("-----------------------------------------------------\n" ); +/* Print various info about the machine that gave been gathered +* so far +*/ +print_system_info ();DBG (" <- setup_system()\n" ); }
Signature · 1 line
2.7.4
PATCH 32/38 powerpc/64: Move setting of {i, d}cache_bsize to initialize_cache_info()
In reply to Benjamin HerrenschmidtAlso remove the completely osbolete comment. We *do* look in the device-tree.
--- arch/powerpc/kernel/setup_64.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
arch/powerpc/kernel/setup_64.c +4 -9
@@ -484,6 +484,10 @@ static void __init initialize_cache_info(void) } } +/* For use by binfmt_elf */ + dcache_bsize = ppc64_caches.dline_size; + icache_bsize = ppc64_caches.iline_size; +DBG (" <- initialize_cache_info()\n" ); }
@@ -704,15 +708,6 @@ void __init setup_arch(char **cmdline_p) { *cmdline_p = boot_command_line; -/* -* Set cache line size based on type of cpu as a default. -* Systems with OF can look in the properties on the cpu node(s) -* for a possibly more accurate value. -*/ - dcache_bsize = ppc64_caches.dline_size; - icache_bsize = ppc64_caches.iline_size; - -/* Reserve large chunks of memory for use by CMA for KVM */ kvm_cma_reserve ();
Signature · 1 line
2.7.4
PATCH 33/38 powerpc/64: Move the content of setup_system() to setup_arch()
In reply to Benjamin HerrenschmidtAnd kill setup_system()
--- arch/powerpc/kernel/head_64.S | 5 +- arch/powerpc/kernel/setup_64.c | 137 +++++++++++++++++++---------------------- 2 files changed, 64 insertions(+), 78 deletions(-)
arch/powerpc/kernel/head_64.S +1 -4
@@ -941,7 +941,7 @@ start_here_multiplatform: mtspr SPRN_SRR1,r4 RFI b . /* prevent speculative execution */ - + /* This is where all platforms converge execution */ start_here_common:
@@ -951,9 +951,6 @@ start_here_common: /* Load the TOC (virtual address) */ ld r2,PACATOC(r13) - /* Do more system initializations in virtual mode */ - bl setup_system - /* Mark interrupts soft and hard disabled (they might be enabled * in the PACA when doing hotplug) */
arch/powerpc/kernel/setup_64.c +63 -74
149 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 34/38 powerpc/32: Move cache info inits to a separate function
In reply to Benjamin HerrenschmidtMatches 64-bit. Also move the call to the same spot as ppc64
--- arch/powerpc/kernel/setup_32.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
arch/powerpc/kernel/setup_32.c +16 -11
@@ -248,6 +248,21 @@ static void setup_power_save(void)#endif } +static __init void initialize_cache_info (void ) +{ +/* +* Set cache line size based on type of cpu as a default. +* Systems with OF can look in the properties on the cpu node(s) +* for a possibly more accurate value. +*/ + dcache_bsize = cur_cpu_spec->dcache_bsize; + icache_bsize = cur_cpu_spec->icache_bsize; + ucache_bsize =0 ; +if (cpu_has_feature (CPU_FTR_UNIFIED_ID_CACHE )) + ucache_bsize = icache_bsize = dcache_bsize; +} + +/* Warning, IO base is not yet inited */ void __init setup_arch (char **cmdline_p) {
@@ -257,6 +272,7 @@ void __init setup_arch(char **cmdline_p) loops_per_jiffy =500000000 /HZ ;unflatten_device_tree (); +initialize_cache_info ();check_for_initrd ();probe_machine ();
@@ -272,17 +288,6 @@ void __init setup_arch(char **cmdline_p)xmon_setup (); -/* -* Set cache line size based on type of cpu as a default. -* Systems with OF can look in the properties on the cpu node(s) -* for a possibly more accurate value. -*/ - dcache_bsize = cur_cpu_spec->dcache_bsize; - icache_bsize = cur_cpu_spec->icache_bsize; - ucache_bsize =0 ; -if (cpu_has_feature (CPU_FTR_UNIFIED_ID_CACHE )) - ucache_bsize = icache_bsize = dcache_bsize; -if (ppc_md.panic)setup_panic ();
Signature · 1 line
2.7.4
PATCH 35/38 powerpc: Re-order the call to smp_setup_cpu_maps()
In reply to Benjamin HerrenschmidtIt makes more sense to do it before intializing xmon() as xmon might use the info in there. We do want to register the console early though in case we want some functioning printk's in the cpu map setup.
--- arch/powerpc/kernel/setup_32.c | 4 ++-- arch/powerpc/kernel/setup_64.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-)
arch/powerpc/kernel/setup_32.c +2 -2
@@ -281,11 +281,11 @@ void __init setup_arch(char **cmdline_p)find_legacy_serial_ports (); -smp_setup_cpu_maps (); -/* Register early console */ register_early_udbg_console (); +smp_setup_cpu_maps (); +xmon_setup ();if (ppc_md.panic)
arch/powerpc/kernel/setup_64.c +2 -1
@@ -672,12 +672,13 @@ void __init setup_arch(char **cmdline_p)*/ register_early_udbg_console (); +smp_setup_cpu_maps (); +/* * Initialize xmon */ xmon_setup (); -smp_setup_cpu_maps ();check_smt_enabled ();setup_tlb_core_data ();
Signature · 1 line
2.7.4
PATCH 36/38 powerpc: Re-order setup_panic()
In reply to Benjamin HerrenschmidtDo it right after probe_machine() since it's about testing ppc_md, and put the test in the common code.
--- arch/powerpc/kernel/setup-common.c | 2 ++ arch/powerpc/kernel/setup_32.c | 5 ++--- arch/powerpc/kernel/setup_64.c | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/kernel/setup-common.c +2 -0
@@ -687,6 +687,8 @@ static struct notifier_block ppc_panic_block = {void __init setup_panic (void ) { +if (!ppc_md.panic) +return ;atomic_notifier_chain_register (&panic_notifier_list, &ppc_panic_block); }
arch/powerpc/kernel/setup_32.c +2 -3
@@ -277,6 +277,8 @@ void __init setup_arch(char **cmdline_p)probe_machine (); +setup_panic (); +setup_power_save ();find_legacy_serial_ports ();
@@ -288,9 +290,6 @@ void __init setup_arch(char **cmdline_p)xmon_setup (); -if (ppc_md.panic) -setup_panic (); - init_mm.start_code = (unsigned long )_stext; init_mm.end_code = (unsigned long ) _etext; init_mm.end_data = (unsigned long ) _edata;
arch/powerpc/kernel/setup_64.c +2 -3
@@ -660,6 +660,8 @@ void __init setup_arch(char **cmdline_p)/* Probe the machine type */ probe_machine (); +setup_panic (); +/* * We can discover serial ports now since the above did setup the * hash table management for us, thus ioremap works. We do that early
@@ -708,9 +710,6 @@ void __init setup_arch(char **cmdline_p)*/ reserve_hugetlb_gpages (); -if (ppc_md.panic) -setup_panic (); -klp_init_thread_info (&init_thread_info); init_mm.start_code = (unsigned long )_stext;
Signature · 1 line
2.7.4
PATCH 37/38 powerpc/64: Make a few boot functions __init
In reply to Benjamin Herrenschmidt--- arch/powerpc/kernel/setup_64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/setup_64.c +3 -3
@@ -198,7 +198,7 @@ early_param("smt-enabled", early_smt_enabled);#endif /* CONFIG_SMP */ /** Fix up paca fields required for the boot cpu */ -static void fixup_boot_paca (void ) +static void __init fixup_boot_paca (void ) {/* The boot cpu is started */ get_paca ()->cpu_start =1 ;
@@ -206,7 +206,7 @@ static void fixup_boot_paca(void)get_paca ()->data_offset =0 ; } -static void configure_exceptions (void ) +static void __init configure_exceptions (void ) {/* Setup the trampolines from the lowmem exception vectors * to the kdump kernel when not using a relocatable kernel.
@@ -528,7 +528,7 @@ static __init void print_system_info(void)* used to allocate interrupt or emergency stacks for which our * exception entry path doesn't deal with being interrupted. */ -static u64 safe_stack_limit (void ) +static __init u64 safe_stack_limit (void ) {#ifdef CONFIG_PPC_BOOK3E /* Freescale BookE bolts the entire linear mapping */
Signature · 1 line
2.7.4
PATCH 38/38 powerpc: Merge 32-bit and 64-bit setup_arch()
In reply to Benjamin HerrenschmidtThere is little enough differences now. Use a few __weak stubs for functions that may not be around in order to avoid too many ifdefs.
--- arch/powerpc/include/asm/setup.h | 4 + arch/powerpc/kernel/setup-common.c | 202 +++++++++++++++++++++++++++++++++++++ arch/powerpc/kernel/setup_32.c | 65 +----------- arch/powerpc/kernel/setup_64.c | 178 ++------------------------------ 4 files changed, 218 insertions(+), 231 deletions(-)
arch/powerpc/include/asm/setup.h +4 -0
@@ -19,6 +19,10 @@ extern unsigned long reloc_offset(void);extern unsigned long add_reloc_offset (unsigned long );extern void reloc_got2 (unsigned long ); +extern void initialize_cache_info (void ); +extern void irqstack_early_init (void ); +extern void emergency_stack_init (void ); +#ifdef CONFIG_PPC32 #define PTRRELOC (x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))#else
arch/powerpc/kernel/setup-common.c +202 -0
217 lines not on this page · raw message
arch/powerpc/kernel/setup_32.c +4 -61
100 lines not on this page · raw message
arch/powerpc/kernel/setup_64.c +8 -170
258 lines not on this page · raw message
Signature · 1 line
2.7.4