From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Fri, 26 Feb 2016 16:44:27 +0100 Subject: [U-Boot] [PATCH v4 01/11] thunderx: Calculate TCR dynamically In-Reply-To: References: <1456447761-127289-1-git-send-email-agraf@suse.de> <1456447761-127289-2-git-send-email-agraf@suse.de> Message-ID: <56D072DB.8030801@suse.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 02/26/2016 04:39 PM, Simon Glass wrote: > Hi Alexander, > > On 26 February 2016 at 01:58, Alexander Graf wrote: >> >>> Am 26.02.2016 um 03:51 schrieb Simon Glass : >>> >>> Hi, >>> >>>> On 25 February 2016 at 17:49, Alexander Graf wrote: >>>> Based on the memory map we can determine a lot of hard coded fields of >>>> TCR, like the maximum VA and max PA we want to support. Calculate those >>>> dynamically to reduce the chance for pit falls. >>>> >>>> Signed-off-by: Alexander Graf >>>> --- >>>> arch/arm/cpu/armv8/cache_v8.c | 59 +++++++++++++++++++++++++++++++++++++++- >>>> arch/arm/include/asm/armv8/mmu.h | 6 +--- >>>> include/configs/thunderx_88xx.h | 3 -- >>>> 3 files changed, 59 insertions(+), 9 deletions(-) >>> This approach (extern variable) looks good to me. >>> >>> Reviewed-by: Simon Glass >>> >>> I didn't know ARRAY_SIZE() worked on external variables, so I leaned >>> something also. >> It doesn't. Could you please point me to a case where I'm still using ARRAY_SIZE in v4? I thought I had moved everything to null-terminating entries. > I imagined some gcc linker sizeof() magic. Oh well. > > See near the top of get_tcr() - the patch on this thread. In 1/11 the mem_map is still a locally set array which gets preinitialized to a constant array. That one is supported by ARRAY_SIZE. Later in "thunderx: Move mmu table into board file" I move the mem_map variable into board files and change all ARRAY_SIZE instances to loops that loop until they hit an empty entry. This is mostly to make review and bisectability easier, since that way only few things change at a time. Alex