arm/arm64: few fixes
Subsystems (2)
cover arm/arm64: few fixes
Fix1, patches 1: SKIP if pci-testdev isn't available rather than FAIL
Fix2, patches 4,5: 64-bit MPIDRs will have 2 32-bit regs in DT Fix3, patches 2,3: While doing Fix2 I noticed a need for different/strict
setup order
Andrew Jones (5):
arm/pci-test: skip on pci/pci-testdev probe failure lib/arm/setup: fix and comment init order lib/powerpc/setup: comment init dependencies
devicetree: cpu nodes may have 64-bit regs arm/arm64: support 64-bit MPIDRs
lib/arm/asm/processor.h | 2 +- lib/arm/asm/setup.h | 2 +- lib/arm64/asm/processor.h | 2 +- lib/devicetree.h | 2 +- lib/arm/setup.c | 13 +++++++++---- lib/devicetree.c | 9 +++++++-- lib/powerpc/setup.c | 6 +++++- lib/powerpc/smp.c | 2 +- arm/pci-test.c | 13 +++++++++---- powerpc/tm.c | 2 +- 10 files changed, 36 insertions(+), 17 deletions(-)
Signature · 1 line
2.9.3
PATCH 1/5 arm/pci-test: skip on pci/pci-testdev probe failure
Some configurations don't have pci or pci-testdev. This patch avoids saying FAIL in those cases. Instead we get SKIP.
--- arm/pci-test.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
arm/pci-test.c +9 -4
@@ -14,14 +14,19 @@ int main(void) {int ret; -if (!pci_probe ()) -report_abort ("PCI bus probing failed\n" ); +if (!pci_probe ()) { +printf ("PCI bus probing failed, skipping tests...\n" ); +return report_summary (); + }pci_print (); ret =pci_testdev (); -report ("PCI test device passed %d/%d tests" , - ret >=NR_TESTS , ret >0 ? ret :0 ,NR_TESTS ); +if (ret ==-1 ) +report_skip ("No PCI test device" ); +else +report ("PCI test device passed %d/%d tests" , + ret >=NR_TESTS , ret >0 ? ret :0 ,NR_TESTS );return report_summary (); }
Signature · 1 line
2.9.3
PATCH 2/5 lib/arm/setup: fix and comment init order
In reply to Andrew JonesWhile reading code I noticed we need to call thread_info_init before mem_init to be correct. In practice it hasn't mattered because cpu0 is calling mem_init, and it's cpu index is 0, which is what a fresh first boot would have it be anyway. With reset tests (coming soon) combined with mmu tests (hopefully coming someday) it could be problematic though, so let's fix it. Additionally comment the order to make sure we maintain it. The io_init dependency on mem_init is because io_init calls init functions that make use of heap allocation.
--- lib/arm/setup.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
lib/arm/setup.c +7 -2
@@ -126,12 +126,17 @@ void setup(const void *fdt) ret =dt_init (&stacktop);assert (ret ==0 ); -mem_init (PAGE_ALIGN ((unsigned long )&stacktop + fdt_size)); -io_init ();cpu_init (); +/* cpu_init must be called before thread_info_init */ thread_info_init (current_thread_info (),0 ); +/* thread_info_init must be called before mem_init */ +mem_init (PAGE_ALIGN ((unsigned long )&stacktop + fdt_size)); + +/* mem_init must be called before io_init */ +io_init (); + ret =dt_get_bootargs (&bootargs);assert (ret ==0 );setup_args_progname (bootargs);
Signature · 1 line
2.9.3
PATCH 3/5 lib/powerpc/setup: comment init dependencies
In reply to Andrew Jonescpu_init must be called before mem_init because cpu_init determines the cache-line sizes. Currently io_init has no dependency on mem_init, but io_init should be allowed to use heap allocation, and someday it may, so we proactively comment it.
--- lib/powerpc/setup.c | 4 ++++ 1 file changed, 4 insertions(+)
lib/powerpc/setup.c +4 -0
@@ -168,7 +168,11 @@ void setup(const void *fdt)assert (ret ==0 );cpu_init (); + +/* cpu_init must be called before mem_init */ mem_init (PAGE_ALIGN ((unsigned long )&stacktop + fdt_size)); + +/* mem_init must be called before io_init */ io_init (); ret =dt_get_bootargs (&bootargs);
Signature · 1 line
2.9.3
PATCH 4/5 devicetree: cpu nodes may have 64-bit regs
In reply to Andrew Jones--- lib/devicetree.h | 2 +- lib/arm/setup.c | 2 +- lib/devicetree.c | 9 +++++++-- lib/powerpc/setup.c | 2 +- lib/powerpc/smp.c | 2 +- powerpc/tm.c | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-)
lib/devicetree.h +1 -1
@@ -234,7 +234,7 @@ extern int dt_get_memory_params(struct dt_pbus_reg *regs, int nr_regs);* - zero on success * - a negative FDT_ERR_* value on failure */ -extern int dt_for_each_cpu_node (void (*func)(int fdtnode,u32 regval, +extern int dt_for_each_cpu_node (void (*func)(int fdtnode,u64 regval,void *info),void *info);#endif /* _DEVICETREE_H_ */
lib/arm/setup.c +1 -1
@@ -40,7 +40,7 @@ int mpidr_to_cpu(uint64_t mpidr)return -1 ; } -static void cpu_set(int fdtnode __unused, u32 regval, void *info __unused) +static void cpu_set(int fdtnode __unused, u64 regval, void *info __unused) {int cpu = nr_cpus++;
lib/devicetree.c +7 -2
@@ -202,13 +202,14 @@ int dt_get_memory_params(struct dt_pbus_reg *regs, int nr_regs)return node != -FDT_ERR_NOTFOUND ? node : nr; } -int dt_for_each_cpu_node (void (*func)(int fdtnode,u32 regval,void *info), +int dt_for_each_cpu_node (void (*func)(int fdtnode,u64 regval,void *info),void *info) {const struct fdt_property *prop;int cpus, cpu, ret, len;struct dt_reg raw_reg;u32 nac, nsc; +u64 regval; cpus =fdt_path_offset (fdt,"/cpus" );if (cpus <0 )
@@ -233,7 +234,11 @@ int dt_for_each_cpu_node(void (*func)(int fdtnode, u32 regval, void *info),if (ret <0 )return ret; -func (cpu, raw_reg.address_cells[0 ], info); + regval = raw_reg.address_cells[0 ]; +if (nac ==2 ) + regval = (regval <<32 ) | raw_reg.address_cells[1 ]; + +func (cpu, regval, info); }return 0 ;
lib/powerpc/setup.c +1 -1
@@ -40,7 +40,7 @@ struct cpu_set_params {static char exception_stack[NR_CPUS ][EXCEPTION_STACK_SIZE ]; -static void cpu_set (int fdtnode,u32 regval,void *info) +static void cpu_set (int fdtnode,u64 regval,void *info) {static bool read_common_info = false;struct cpu_set_params *params = info;
lib/powerpc/smp.c +1 -1
@@ -75,7 +75,7 @@ struct start_threads start_cpu(int cpu_node, secondary_entry_fn entry,return (struct start_threads ) { nr_threads, nr_started }; } -static void start_each_secondary(int fdtnode, u32 regval __unused, void *info) +static void start_each_secondary(int fdtnode, u64 regval __unused, void *info) {struct secondary_entry_data *datap = info;struct start_threads ret =start_cpu (fdtnode, datap->entry, datap->r3);
powerpc/tm.c +1 -1
@@ -14,7 +14,7 @@#include <devicetree.h> /* Check "ibm,pa-features" property of a CPU node for the TM flag */ -static void cpu_has_tm(int fdtnode, u32 regval __unused, void *ptr) +static void cpu_has_tm(int fdtnode, u64 regval __unused, void *ptr) {const struct fdt_property *prop;int plen;
Signature · 1 line
2.9.3
PATCH 5/5 arm/arm64: support 64-bit MPIDRs
In reply to Andrew Jones--- lib/arm/asm/processor.h | 2 +- lib/arm/asm/setup.h | 2 +- lib/arm64/asm/processor.h | 2 +- lib/arm/setup.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
lib/arm/asm/processor.h +1 -1
@@ -46,7 +46,7 @@ static inline void local_irq_disable(void) }#define MPIDR __ACCESS_CP15(c0, 0, c0, 5) -static inline unsigned int get_mpidr (void ) +static inline uint64_t get_mpidr (void ) {return read_sysreg (MPIDR ); }
lib/arm/asm/setup.h +1 -1
@@ -11,7 +11,7 @@#include <asm/pgtable-hwdef.h> #define NR_CPUS 255 -extern u32 cpus[NR_CPUS ];/* per-cpu IDs (MPIDRs) */ +extern u64 cpus[NR_CPUS ];/* per-cpu IDs (MPIDRs) */ extern int nr_cpus;#define NR_MEM_REGIONS 8
lib/arm64/asm/processor.h +1 -1
@@ -78,7 +78,7 @@ static inline void local_irq_disable(void) asmvolatile ("msr daifset, #2" : : :"memory" ); } -static inline unsigned int get_mpidr (void ) +static inline uint64_t get_mpidr (void ) {return read_sysreg (mpidr_el1); }
lib/arm/setup.c +1 -1
@@ -24,7 +24,7 @@ extern unsigned long stacktop;extern void io_init (void );extern void setup_args_progname (const char *args); -u32 cpus[NR_CPUS ] = { [0 ...NR_CPUS -1 ] = (~0U ) }; +u64 cpus[NR_CPUS ] = { [0 ...NR_CPUS -1 ] = (u64 )~0 };int nr_cpus;struct mem_region mem_regions[NR_MEM_REGIONS ];
Signature · 1 line
2.9.3
Andrew Jones
AppliedQuoted 12 lines · Andrew Jones
Fix1, patches 1: SKIP if pci-testdev isn't available rather than FAIL
Fix2, patches 4,5: 64-bit MPIDRs will have 2 32-bit regs in DT Fix3, patches 2,3: While doing Fix2 I noticed a need for different/strict
setup orderAndrew Jones (5):
arm/pci-test: skip on pci/pci-testdev probe failurelib/arm/setup: fix and comment init orderlib/powerpc/setup: comment init dependencies
devicetree: cpu nodes may have 64-bit regs arm/arm64: support 64-bit MPIDRs
Quoted 15 lines
lib/arm/asm/processor.h | 2 +- lib/arm/asm/setup.h | 2 +- lib/arm64/asm/processor.h | 2 +- lib/devicetree.h | 2 +- lib/arm/setup.c | 13 +++++++++---- lib/devicetree.c | 9 +++++++-- lib/powerpc/setup.c | 6 +++++- lib/powerpc/smp.c | 2 +- arm/pci-test.c | 13 +++++++++---- powerpc/tm.c | 2 +- 10 files changed, 36 insertions(+), 17 deletions(-)Signature · 1 line
2.9.3
Applied to arm/next
Thanks,
drew