Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 651ca7f4 authored by Paul Burton's avatar Paul Burton Committed by Ralf Baechle
Browse files

MIPS: print MAAR configuration during boot



Verifying that the MAAR configuration is as expected is useful when
debugging the performance of a system. Print out the memory regions
configured via MAAR along with their attributes.

Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Patchwork: https://patchwork.linux-mips.org/patch/11238/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent def3ab5d
Loading
Loading
Loading
Loading
+29 −0
Original line number Original line Diff line number Diff line
@@ -291,6 +291,7 @@ unsigned __weak platform_maar_init(unsigned num_pairs)
static void maar_init(void)
static void maar_init(void)
{
{
	unsigned num_maars, used, i;
	unsigned num_maars, used, i;
	phys_addr_t lower, upper, attr;


	if (!cpu_has_maar)
	if (!cpu_has_maar)
		return;
		return;
@@ -313,6 +314,34 @@ static void maar_init(void)
		write_c0_maar(0);
		write_c0_maar(0);
		back_to_back_c0_hazard();
		back_to_back_c0_hazard();
	}
	}

	pr_info("MAAR configuration:\n");
	for (i = 0; i < num_maars; i += 2) {
		write_c0_maari(i);
		back_to_back_c0_hazard();
		upper = read_c0_maar();

		write_c0_maari(i + 1);
		back_to_back_c0_hazard();
		lower = read_c0_maar();

		attr = lower & upper;
		lower = (lower & MIPS_MAAR_ADDR) << 4;
		upper = ((upper & MIPS_MAAR_ADDR) << 4) | 0xffff;

		pr_info("  [%d]: ", i / 2);
		if (!(attr & MIPS_MAAR_V)) {
			pr_cont("disabled\n");
			continue;
		}

		pr_cont("%pa-%pa", &lower, &upper);

		if (attr & MIPS_MAAR_S)
			pr_cont(" speculate");

		pr_cont("\n");
	}
}
}


#ifndef CONFIG_NEED_MULTIPLE_NODES
#ifndef CONFIG_NEED_MULTIPLE_NODES