From 61531a274d3c3f47af9f5ae4c3220a4868e6a3c6 Mon Sep 17 00:00:00 2001 From: Soby Mathew Date: Tue, 14 Feb 2017 10:16:18 +0000 Subject: [PATCH 1/3] AArch32: Fix normal memory bakery compilation This patch fixes a compilation issue with bakery locks when PSCI library is compiled with USE_COHERENT_MEM = 0 build option. Change-Id: Ic7f6cf9f2bb37f8a946eafbee9cbc3bf0dc7e900 Signed-off-by: Soby Mathew --- lib/locks/bakery/bakery_lock_normal.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/locks/bakery/bakery_lock_normal.c b/lib/locks/bakery/bakery_lock_normal.c index 5a2fb0717a..a3a6c002f3 100644 --- a/lib/locks/bakery/bakery_lock_normal.c +++ b/lib/locks/bakery/bakery_lock_normal.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -178,8 +178,11 @@ void bakery_lock_get(bakery_lock_t *lock) unsigned int their_bakery_data; me = plat_my_core_pos(); - +#ifdef AARCH32 + is_cached = read_sctlr() & SCTLR_C_BIT; +#else is_cached = read_sctlr_el3() & SCTLR_C_BIT; +#endif /* Get a ticket */ my_ticket = bakery_get_ticket(lock, me, is_cached); @@ -231,7 +234,11 @@ void bakery_lock_get(bakery_lock_t *lock) void bakery_lock_release(bakery_lock_t *lock) { bakery_info_t *my_bakery_info; +#ifdef AARCH32 + unsigned int is_cached = read_sctlr() & SCTLR_C_BIT; +#else unsigned int is_cached = read_sctlr_el3() & SCTLR_C_BIT; +#endif my_bakery_info = get_bakery_info(plat_my_core_pos(), lock); From e40e075f4ddf63aa84d2aaacb807ed40438f1d24 Mon Sep 17 00:00:00 2001 From: Soby Mathew Date: Tue, 28 Feb 2017 22:58:29 +0000 Subject: [PATCH 2/3] AArch32: Fix conditional inclusion of bakery_locks Due to incorrect conditional compilation checks, bakery locks were excluded from the CCN driver and the power controller driver for FVP when BL32 was built as the EL3 Runtime Software in AArch32 mode. This patch corrects the same. Change-Id: Ib1f163d9167a5c38e4d622232c4835cad9c235aa Signed-off-by: Soby Mathew --- drivers/arm/ccn/ccn.c | 8 ++++---- include/plat/arm/common/plat_arm.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/arm/ccn/ccn.c b/drivers/arm/ccn/ccn.c index d739c6bf39..ca0618274d 100644 --- a/drivers/arm/ccn/ccn.c +++ b/drivers/arm/ccn/ccn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -38,7 +38,7 @@ #include "ccn_private.h" static const ccn_desc_t *ccn_plat_desc; -#ifdef IMAGE_BL31 +#if defined(IMAGE_BL31) || (defined(AARCH32) && defined(IMAGE_BL32)) DEFINE_BAKERY_LOCK(ccn_lock); #endif @@ -285,7 +285,7 @@ static void ccn_snoop_dvm_do_op(unsigned long long rn_id_map, assert(ccn_plat_desc); assert(ccn_plat_desc->periphbase); -#ifdef IMAGE_BL31 +#if defined(IMAGE_BL31) || (defined(AARCH32) && defined(IMAGE_BL32)) bakery_lock_get(&ccn_lock); #endif start_region_id = region_id; @@ -305,7 +305,7 @@ static void ccn_snoop_dvm_do_op(unsigned long long rn_id_map, rn_id_map); } -#ifdef IMAGE_BL31 +#if defined(IMAGE_BL31) || (defined(AARCH32) && defined(IMAGE_BL32)) bakery_lock_release(&ccn_lock); #endif } diff --git a/include/plat/arm/common/plat_arm.h b/include/plat/arm/common/plat_arm.h index e878f9ebf7..b199d060b0 100644 --- a/include/plat/arm/common/plat_arm.h +++ b/include/plat/arm/common/plat_arm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -64,7 +64,7 @@ void arm_setup_page_tables(uintptr_t total_base, #endif ); -#ifdef IMAGE_BL31 +#if defined(IMAGE_BL31) || (defined(AARCH32) && defined(IMAGE_BL32)) /* * Use this macro to instantiate lock before it is used in below * arm_lock_xxx() macros @@ -88,7 +88,7 @@ void arm_setup_page_tables(uintptr_t total_base, #define arm_lock_get() #define arm_lock_release() -#endif /* IMAGE_BL31 */ +#endif /* defined(IMAGE_BL31) || (defined(AARCH32) && defined(IMAGE_BL32)) */ #if ARM_RECOM_STATE_ID_ENC /* From a6b3954b2ffd695972ec099089cb2dde92ebaaa3 Mon Sep 17 00:00:00 2001 From: Soby Mathew Date: Tue, 14 Feb 2017 10:21:55 +0000 Subject: [PATCH 3/3] AArch32: Enable override of plat_set_my_stack/plat_get_my_stack This patch makes the default MP definitions of plat_get_my_stack() and plat_set_my_stack() as weak so that they can be overridden by the AArch32 Secure Payload if it requires. Change-Id: I3b6ddff5750443a776505e3023ff2934227592b6 Signed-off-by: Soby Mathew --- plat/common/aarch32/platform_mp_stack.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plat/common/aarch32/platform_mp_stack.S b/plat/common/aarch32/platform_mp_stack.S index a01543691f..0266e83c1a 100644 --- a/plat/common/aarch32/platform_mp_stack.S +++ b/plat/common/aarch32/platform_mp_stack.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -32,8 +32,8 @@ #include #include - .globl plat_get_my_stack - .globl plat_set_my_stack + .weak plat_get_my_stack + .weak plat_set_my_stack /* ----------------------------------------------------- * uintptr_t plat_get_my_stack (u_register_t mpidr)