From eff2f44430fcd452d2f5425566e109a8c517b1d1 Mon Sep 17 00:00:00 2001 From: Chandni Cherukuri Date: Tue, 16 Oct 2018 15:19:54 +0530 Subject: [PATCH 1/4] plat/css: allow platforms to define the system power domain level The CSS_SYSTEM_PWR_DMN_LVL macro that defines the system power domain level is fixed at ARM_PWR_LVL2 for all CSS platforms. However, the system power domain level can be different for CSS platforms that use multi-threaded CPUs. So, in preparation towards adding support for platforms that use multi-threaded CPUs, refactor the definition of CSS_SYSTEM_PWR_DMN_LVL such that CSS_SYSTEM_PWR_DMN_LVL is uniquely defined for each of the CSS platform. Change-Id: Ia837b13f6865e71da01780993c048b45b7f36d85 Signed-off-by: Chandni Cherukuri --- include/plat/arm/css/common/css_pm.h | 3 --- plat/arm/board/juno/include/platform_def.h | 3 +++ plat/arm/board/n1sdp/include/platform_def.h | 2 ++ plat/arm/board/sgi575/include/platform_def.h | 3 +++ plat/arm/board/sgiclarka/include/platform_def.h | 3 +++ plat/arm/css/sgm/include/sgm_base_platform_def.h | 4 ++++ 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/plat/arm/css/common/css_pm.h b/include/plat/arm/css/common/css_pm.h index eeb72de51..ff75c6916 100644 --- a/include/plat/arm/css/common/css_pm.h +++ b/include/plat/arm/css/common/css_pm.h @@ -11,9 +11,6 @@ #include #include -/* System power domain at level 2, as currently implemented by CSS platforms */ -#define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL2 - /* Macros to read the CSS power domain state */ #define CSS_CORE_PWR_STATE(state) (state)->pwr_domain_state[ARM_PWR_LVL0] #define CSS_CLUSTER_PWR_STATE(state) (state)->pwr_domain_state[ARM_PWR_LVL1] diff --git a/plat/arm/board/juno/include/platform_def.h b/plat/arm/board/juno/include/platform_def.h index 735e4a336..0414f6cc1 100644 --- a/plat/arm/board/juno/include/platform_def.h +++ b/plat/arm/board/juno/include/platform_def.h @@ -292,4 +292,7 @@ #define PLAT_ARM_PRIVATE_SDEI_EVENTS ARM_SDEI_PRIVATE_EVENTS #define PLAT_ARM_SHARED_SDEI_EVENTS ARM_SDEI_SHARED_EVENTS +/* System power domain level */ +#define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL2 + #endif /* PLATFORM_DEF_H */ diff --git a/plat/arm/board/n1sdp/include/platform_def.h b/plat/arm/board/n1sdp/include/platform_def.h index 3e4839781..fa639ca95 100644 --- a/plat/arm/board/n1sdp/include/platform_def.h +++ b/plat/arm/board/n1sdp/include/platform_def.h @@ -32,6 +32,8 @@ N1SDP_MAX_CPUS_PER_CLUSTER * \ N1SDP_MAX_PE_PER_CPU) +/* System power domain level */ +#define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL2 /* * PLAT_ARM_MMAP_ENTRIES depends on the number of entries in the diff --git a/plat/arm/board/sgi575/include/platform_def.h b/plat/arm/board/sgi575/include/platform_def.h index c06a0a1fa..394a2e829 100644 --- a/plat/arm/board/sgi575/include/platform_def.h +++ b/plat/arm/board/sgi575/include/platform_def.h @@ -20,4 +20,7 @@ #define SGI575_DMC620_BASE0 UL(0x4e000000) #define SGI575_DMC620_BASE1 UL(0x4e100000) +/* System power domain level */ +#define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL2 + #endif /* PLATFORM_DEF_H */ diff --git a/plat/arm/board/sgiclarka/include/platform_def.h b/plat/arm/board/sgiclarka/include/platform_def.h index ba6d0434b..6de15c432 100644 --- a/plat/arm/board/sgiclarka/include/platform_def.h +++ b/plat/arm/board/sgiclarka/include/platform_def.h @@ -20,4 +20,7 @@ #define SGICLARKA_DMC620_BASE0 UL(0x4e000000) #define SGICLARKA_DMC620_BASE1 UL(0x4e100000) +/* System power domain level */ +#define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL2 + #endif /* PLATFORM_DEF_H */ diff --git a/plat/arm/css/sgm/include/sgm_base_platform_def.h b/plat/arm/css/sgm/include/sgm_base_platform_def.h index a9795a484..2178f069a 100644 --- a/plat/arm/css/sgm/include/sgm_base_platform_def.h +++ b/plat/arm/css/sgm/include/sgm_base_platform_def.h @@ -239,4 +239,8 @@ */ #define PLAT_ARM_MEM_PROT_ADDR (V2M_FLASH0_BASE + \ V2M_FLASH0_SIZE - V2M_FLASH_BLOCK_SIZE) + +/* System power domain level */ +#define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL2 + #endif /* SGM_BASE_PLATFORM_DEF_H */ From 0e27faf4841beadd357dcc689fbf64a82a01eaeb Mon Sep 17 00:00:00 2001 From: Chandni Cherukuri Date: Tue, 16 Oct 2018 14:42:19 +0530 Subject: [PATCH 2/4] plat/arm/common: add an additional platform power level For platforms using multi-threaded CPUs, there can be upto four platform power domain levels. At present, there are three platform power domain levels that are defined for the CSS platforms. Define a fourth level 'ARM_PWR_LVL3' as well to provide support for an additional platform power domain level. Change-Id: I40cc17a10f4690a560776f504364fd7277a7e72a Signed-off-by: Chandni Cherukuri --- include/plat/arm/common/arm_def.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/plat/arm/common/arm_def.h b/include/plat/arm/common/arm_def.h index d02a4059a..cbac247fc 100644 --- a/include/plat/arm/common/arm_def.h +++ b/include/plat/arm/common/arm_def.h @@ -34,6 +34,7 @@ #define ARM_PWR_LVL0 MPIDR_AFFLVL0 #define ARM_PWR_LVL1 MPIDR_AFFLVL1 #define ARM_PWR_LVL2 MPIDR_AFFLVL2 +#define ARM_PWR_LVL3 MPIDR_AFFLVL3 /* * Macros for local power states in ARM platforms encoded by State-ID field From bd3d7b4ac4a0500c9e97e6e08ae6e99bb81c4dfb Mon Sep 17 00:00:00 2001 From: Chandni Cherukuri Date: Thu, 16 Aug 2018 13:45:17 +0530 Subject: [PATCH 3/4] plat/arm/sgi: override weak implementation of plat_arm_get_cpu_pe_count To support platforms which are based on multi-threaded CPUs, override the weak implementation of plat_arm_get_cpu_pe_count function to return the number of threads supported by the CPU used in the platform. Change-Id: Ia680773f1277b17e2d3d2414d87943dcece33e89 Signed-off-by: Chandni Cherukuri --- plat/arm/css/sgi/sgi_topology.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plat/arm/css/sgi/sgi_topology.c b/plat/arm/css/sgi/sgi_topology.c index 3b7a57ad2..e524f11f7 100644 --- a/plat/arm/css/sgi/sgi_topology.c +++ b/plat/arm/css/sgi/sgi_topology.c @@ -44,3 +44,11 @@ const uint32_t plat_css_core_pos_to_scmi_dmn_id_map[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; + +/****************************************************************************** + * Return the number of PE's supported by the CPU. + *****************************************************************************/ +unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr) +{ + return CSS_SGI_MAX_PE_PER_CPU; +} From a83d4bd765af515e74062425ca45012d4247945a Mon Sep 17 00:00:00 2001 From: Chandni Cherukuri Date: Tue, 16 Oct 2018 14:11:34 +0530 Subject: [PATCH 4/4] plat/arm/sgi: allow value of PLAT_MAX_PWR_LVL to be platform specific For platforms with multi-threaded CPUs, the number of power domains supported would be more than the value currently defined by PLAT_MAX_PWR_LVL. So move the PLAT_MAX_PWR_LVL macro to platform specific code and let the platform define the number of power domain levels. Change-Id: I21c0682e62b397860b2999031a0c9c5ce0d28eed Signed-off-by: Chandni Cherukuri --- plat/arm/board/sgi575/include/platform_def.h | 2 ++ plat/arm/board/sgiclarka/include/platform_def.h | 2 ++ plat/arm/css/sgi/include/sgi_base_platform_def.h | 2 -- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plat/arm/board/sgi575/include/platform_def.h b/plat/arm/board/sgi575/include/platform_def.h index 394a2e829..16e2898de 100644 --- a/plat/arm/board/sgi575/include/platform_def.h +++ b/plat/arm/board/sgi575/include/platform_def.h @@ -23,4 +23,6 @@ /* System power domain level */ #define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL2 +#define PLAT_MAX_PWR_LVL ARM_PWR_LVL1 + #endif /* PLATFORM_DEF_H */ diff --git a/plat/arm/board/sgiclarka/include/platform_def.h b/plat/arm/board/sgiclarka/include/platform_def.h index 6de15c432..39907e8bc 100644 --- a/plat/arm/board/sgiclarka/include/platform_def.h +++ b/plat/arm/board/sgiclarka/include/platform_def.h @@ -23,4 +23,6 @@ /* System power domain level */ #define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL2 +#define PLAT_MAX_PWR_LVL ARM_PWR_LVL1 + #endif /* PLATFORM_DEF_H */ diff --git a/plat/arm/css/sgi/include/sgi_base_platform_def.h b/plat/arm/css/sgi/include/sgi_base_platform_def.h index 1395373ce..8705d63b1 100644 --- a/plat/arm/css/sgi/include/sgi_base_platform_def.h +++ b/plat/arm/css/sgi/include/sgi_base_platform_def.h @@ -119,8 +119,6 @@ #define PLAT_ARM_NSRAM_BASE 0x06000000 #define PLAT_ARM_NSRAM_SIZE 0x00080000 /* 512KB */ -#define PLAT_MAX_PWR_LVL U(1) - #define PLAT_ARM_G1S_IRQ_PROPS(grp) CSS_G1S_IRQ_PROPS(grp) #define PLAT_ARM_G0_IRQ_PROPS(grp) ARM_G0_IRQ_PROPS(grp)