Fix ThunderX2 write-combined PTE flag insanity

Change-Id: I59999a680b556acf3e22ac516f4758e3aee7f355
This commit is contained in:
Balazs Gerofi
2019-01-28 11:06:30 +09:00
committed by Dominique Martinet
parent 649059f2d2
commit 6ed2e5ffc1
4 changed files with 92 additions and 12 deletions

View File

@@ -16,6 +16,7 @@
#include <vdso.h>
#include <debug.h>
#include <rusage_private.h>
#include <cputype.h>
//#define DEBUG
@@ -1020,7 +1021,19 @@ static unsigned long attr_to_pageattr(enum ihk_mc_pt_attribute attr)
if (attr & PTATTR_UNCACHABLE) {
pte |= PROT_DEFAULT | PTE_ATTRINDX(MT_DEVICE_nGnRE);
} else if (attr & PTATTR_WRITE_COMBINED) {
pte |= PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL_NC);
switch (read_cpuid_id() & MIDR_CPU_MODEL_MASK) {
/*
* Fix up arm64 braindamage of using NORMAL_NC for write
* combining when Device GRE exists specifically for the
* purpose. Needed on ThunderX2.
*/
case MIDR_CPU_MODEL(ARM_CPU_IMP_BRCM, BRCM_CPU_PART_VULCAN):
case MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX2):
pte |= PROT_DEFAULT | PTE_ATTRINDX(MT_DEVICE_GRE);
break;
default:
pte |= PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL_NC);
}
} else {
pte |= PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL);
}