[U-Boot] [PATCH 01/10] thunderx: Calculate TCR dynamically

Mark Rutland mark.rutland at arm.com
Thu Feb 25 12:58:40 CET 2016


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.


More information about the U-Boot mailing list