From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Rutland Date: Thu, 25 Feb 2016 11:58:40 +0000 Subject: [U-Boot] [PATCH 01/10] thunderx: Calculate TCR dynamically In-Reply-To: <56CDEACA.4080200@suse.de> References: <1456315904-113924-1-git-send-email-agraf@suse.de> <1456315904-113924-2-git-send-email-agraf@suse.de> <20160224133741.GC11579@leverpostej> <56CDEACA.4080200@suse.de> Message-ID: <20160225115840.GA10593@leverpostej> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Feb 24, 2016 at 06:39:22PM +0100, Alexander Graf wrote: > On 02/24/2016 02:37 PM, Mark Rutland wrote: > >On Wed, Feb 24, 2016 at 01:11:35PM +0100, Alexander Graf wrote: > >>+ /* Calculate the maximum physical (and thus virtual) address */ > >>+ if (max_addr > (1ULL << 44)) { > >>+ ips = 5; > >>+ va_bits = 48; > >>+ } else if (max_addr > (1ULL << 42)) { > >>+ ips = 4; > >>+ va_bits = 44; > >>+ } else if (max_addr > (1ULL << 40)) { > >>+ ips = 3; > >>+ va_bits = 42; > >>+ } else if (max_addr > (1ULL << 36)) { > >>+ ips = 2; > >>+ va_bits = 40; > >>+ } else if (max_addr > (1ULL << 32)) { > >>+ ips = 1; > >>+ va_bits = 36; > >>+ } else { > >>+ ips = 0; > >>+ va_bits = 32; > >>+ } > >In Linux we program IPS to the maximum PARange from ID_AA64MMFR0. > > > >If you did the same here you wouldn't have to iterate over all the > >memory map entries to determine the maximum PA you care about (though > >you may still need to do that for the VA size). > > Since we'd want to find the largest number for VA to trim one level > of page table if we can, I don't see how it would buy is much to > take the maximum supported PARange of the core into account. It would simply be a saving of lines, as you'd program the same IPS value regardless of max_addr (and you have to expect that PARange is sufficient regardless). Otherwise, yes, it doesn't buy you anything. Thanks, Mark.