switch-l4t-atf/fdts/fvp-defs-dynamiq.dtsi
Alexei Fedorov 003faaa59f FVP: Add support for passing platform's topology to DTS
This patch adds support for passing FVP platform's topology
configuration to DTS files for compilation, which allows to
build DTBs with correct number of clusters and CPUs.
This removes non-existing clusters/CPUs from the compiled
device tree blob and fixes reported Linux errors when trying
to power on absent CPUs/PEs.
If DTS file is passed using FVP_HW_CONFIG_DTS build option from
the platform's makefile, FVP_CLUSTER_COUNT, FVP_MAX_CPUS_PER_CLUSTER
and FVP_MAX_PE_PER_CPU parameters are used, otherwise CI script will
use the default values from the corresponding DTS file.

Change-Id: Idcb45dc6ad5e3eaea18573aff1a01c9344404ab3
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-05-19 13:16:22 +00:00

290 lines
4.2 KiB
Plaintext

/*
* Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef FVP_DEFS_DYNAMIQ_DTSI
#define FVP_DEFS_DYNAMIQ_DTSI
/* Set default topology values if not passed from platform's makefile */
#ifdef FVP_CLUSTER_COUNT
#define CLUSTER_COUNT FVP_CLUSTER_COUNT
#else
#define CLUSTER_COUNT 1
#endif
#ifdef FVP_MAX_CPUS_PER_CLUSTER
#define CPUS_PER_CLUSTER FVP_MAX_CPUS_PER_CLUSTER
#else
#define CPUS_PER_CLUSTER 8
#endif
#define CONCAT(x, y) x##y
#define CONC(x, y) CONCAT(x, y)
/*
* n - CPU number
* r - MPID
*/
#define CPU(n, r) \
CPU##n:cpu@r## { \
device_type = "cpu"; \
compatible = "arm,armv8"; \
reg = <0x0 0x##r>; \
enable-method = "psci"; \
cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; \
next-level-cache = <&L2_0>; \
};
#if (PE_PER_CPU == 2)
#define THREAD(n) \
thread##n { \
cpu = <&CONC(CPU, __COUNTER__)>; \
};
#define CORE(n) \
core##n { \
THREAD(0) \
THREAD(1) \
};
#else /* PE_PER_CPU == 1 */
#define CORE(n) \
core##n { \
cpu = <&CPU##n>;\
};
#endif /* PE_PER_CORE */
#if (CPUS_PER_CLUSTER == 1)
#if (PE_PER_CPU == 1)
#define CPUS \
CPU(0, 0)
#else
#define CPUS \
CPU(0, 0) \
CPU(1, 1)
#endif
#define CLUSTER(n) \
cluster##n { \
CORE(0) \
};
#elif (CPUS_PER_CLUSTER == 2)
#if (PE_PER_CPU == 1)
#define CPUS \
CPU(0, 0) \
CPU(1, 100)
#else
#define CPUS \
CPU(0, 0) \
CPU(1, 1) \
CPU(2, 100) \
CPU(3, 101)
#endif
#define CLUSTER(n) \
cluster##n { \
CORE(0) \
CORE(1) \
};
#elif (CPUS_PER_CLUSTER == 3)
#if (PE_PER_CPU == 1)
#define CPUS \
CPU(0, 0) \
CPU(1, 100) \
CPU(2, 200)
#else
#define CPUS \
CPU(0, 0) \
CPU(1, 1) \
CPU(2, 100) \
CPU(3, 101) \
CPU(4, 200) \
CPU(5, 201)
#endif
#define CLUSTER(n) \
cluster##n { \
CORE(0) \
CORE(1) \
CORE(2) \
};
#elif (CPUS_PER_CLUSTER == 4)
#if (PE_PER_CPU == 1)
#define CPUS \
CPU(0, 0) \
CPU(1, 100) \
CPU(2, 200) \
CPU(3, 300)
#else
#define CPUS \
CPU(0, 0) \
CPU(1, 1) \
CPU(2, 100) \
CPU(3, 101) \
CPU(4, 200) \
CPU(5, 201) \
CPU(6, 300) \
CPU(7, 301)
#endif
#define CLUSTER(n) \
cluster##n { \
CORE(0) \
CORE(1) \
CORE(2) \
CORE(3) \
};
#elif (CPUS_PER_CLUSTER == 5)
#if (PE_PER_CPU == 1)
#define CPUS \
CPU(0, 0) \
CPU(1, 100) \
CPU(2, 200) \
CPU(3, 300) \
CPU(4, 400)
#else
#define CPUS \
CPU(0, 0) \
CPU(1, 1) \
CPU(2, 100) \
CPU(3, 101) \
CPU(4, 200) \
CPU(5, 201) \
CPU(6, 300) \
CPU(7, 301) \
CPU(8, 400) \
CPU(9, 401)
#endif
#define CLUSTER(n) \
cluster##n { \
CORE(0) \
CORE(1) \
CORE(2) \
CORE(3) \
CORE(4) \
};
#elif (CPUS_PER_CLUSTER == 6)
#if (PE_PER_CPU == 1)
#define CPUS \
CPU(0, 0) \
CPU(1, 100) \
CPU(2, 200) \
CPU(3, 300) \
CPU(4, 400) \
CPU(5, 500)
#else
#define CPUS \
CPU(0, 0) \
CPU(1, 1) \
CPU(2, 100) \
CPU(3, 101) \
CPU(4, 200) \
CPU(5, 201) \
CPU(6, 300) \
CPU(7, 301) \
CPU(8, 400) \
CPU(9, 401) \
CPU(10, 500) \
CPU(11, 501)
#endif
#define CLUSTER(n) \
cluster##n { \
CORE(0) \
CORE(1) \
CORE(2) \
CORE(3) \
CORE(4) \
CORE(5) \
};
#elif (CPUS_PER_CLUSTER == 7)
#if (PE_PER_CPU == 1)
#define CPUS \
CPU(0, 0) \
CPU(1, 100) \
CPU(2, 200) \
CPU(3, 300) \
CPU(4, 400) \
CPU(5, 500) \
CPU(6, 600)
#else
#define CPUS \
CPU(0, 0) \
CPU(1, 1) \
CPU(2, 100) \
CPU(3, 101) \
CPU(4, 200) \
CPU(5, 201) \
CPU(6, 300) \
CPU(7, 301) \
CPU(8, 400) \
CPU(9, 401) \
CPU(10, 500) \
CPU(11, 501) \
CPU(12, 600) \
CPU(13, 601)
#endif
#define CLUSTER(n) \
cluster##n { \
CORE(0) \
CORE(1) \
CORE(2) \
CORE(3) \
CORE(4) \
CORE(5) \
CORE(6) \
};
#else
#if (PE_PER_CPU == 1)
#define CPUS \
CPU(0, 0) \
CPU(1, 100) \
CPU(2, 200) \
CPU(3, 300) \
CPU(4, 400) \
CPU(5, 500) \
CPU(6, 600) \
CPU(7, 700)
#else
#define CPUS \
CPU(0, 0) \
CPU(1, 1) \
CPU(2, 100) \
CPU(3, 101) \
CPU(4, 200) \
CPU(5, 201) \
CPU(6, 300) \
CPU(7, 301) \
CPU(8, 400) \
CPU(9, 401) \
CPU(10, 500) \
CPU(11, 501) \
CPU(12, 600) \
CPU(13, 601) \
CPU(14, 700) \
CPU(15, 701)
#endif
#define CLUSTER(n) \
cluster##n { \
CORE(0) \
CORE(1) \
CORE(2) \
CORE(3) \
CORE(4) \
CORE(5) \
CORE(6) \
CORE(7) \
};
#endif /* CPUS_PER_CLUSTER */
#define CPU_MAP \
cpu-map { \
CLUSTER(0) \
};
#endif /* FVP_DEFS_DYNAMIQ_DTSI */