Skip to contentSkip to conversation

arm64: fix early_io_map for 64K pages

PATCH New Rob Herring 4 participants 5 messages Feb 5, 2014 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: fix early_io_map for 64K pages

From: Rob Herring <[email protected]>

earlyprintk is broken with 64KB pages. The problem is pgprot_default is not yet initialized when early_io_map is called, so the pte does not get marked as valid. Set the necessary page and access permission bits.

Cc Mark Salter <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>

---

I'm not sure this is really the best fix. Perhaps pgprot_default can be statically initialized to something useful instead?

Rob

 arch/arm64/mm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/mmu.c +1 -1
index f557ebb..c41daa6 100644
@@ -284,7 +284,7 @@ void __iomem * __init early_io_map(phys_addr_t phys, unsigned long virt)
 		if (pmd_none(*pmd))
 			return NULL;
 		pte = pte_offset_kernel(pmd, virt);
-		set_pte(pte, __pte((phys & mask) | PROT_DEVICE_nGnRE));
+		set_pte(pte, __pte((phys & mask) | PTE_TYPE_PAGE | PTE_AF | PROT_DEVICE_nGnRE));
 	} else {
 		set_pmd(pmd, __pmd((phys & mask) | PROT_SECT_DEVICE_nGnRE));
 	}
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 arm64: fix early_io_map for 64K pages

Hi Rob,

Quoted 11 lines · Rob Herring

From: Rob Herring <[email protected]>

earlyprintk is broken with 64KB pages. The problem is pgprot_default is not yet initialized when early_io_map is called, so the pte does not get marked as valid. Set the necessary page and access permission bits.

Cc Mark Salter <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>

---

I thought we fixed this in 4ce00dfcf19c by reverting the use of pgprot_default?

Will

maintainer
#2 lore raw

PATCH 1/1 arm64: fix early_io_map for 64K pages

Quoted 7 lines · Will Deacon
Quoted 6 lines · Rob Herring

From: Rob Herring <[email protected]>

earlyprintk is broken with 64KB pages. The problem is pgprot_default is not yet initialized when early_io_map is called, so the pte does not get marked as valid. Set the necessary page and access permission bits.

Quoted 8 lines
Quoted 5 lines
Cc Mark Salter <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>

---

I thought we fixed this in 4ce00dfcf19c by reverting the use of pgprot_default?

Indeed. We still need to fix the ioremap_cache() case where the shareability isn't set but I haven't yet decided what we do for SMP-on-UP in arm64 (if we always assume SMP, I would just get rid of pgprot_default entirely).

Signature · 1 line
Catalin
#3 lore raw

PATCH 1/1 arm64: fix early_io_map for 64K pages

In reply to Will Deacon
Quoted 9 lines · Will Deacon

Hi Rob,

Quoted 6 lines · Rob Herring

From: Rob Herring <[email protected]>

earlyprintk is broken with 64KB pages. The problem is pgprot_default is not yet initialized when early_io_map is called, so the pte does not get marked as valid. Set the necessary page and access permission bits.

Quoted 8 lines
Quoted 5 lines
Cc Mark Salter <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>

---

I thought we fixed this in 4ce00dfcf19c by reverting the use of pgprot_default?

Ah crap. I only checked the history on mmu.c and missed that fix. And I was so happy I found a kernel issue with qemu.

Rob

#4 lore raw

PATCH 1/1 arm64: fix early_io_map for 64K pages

In reply to Rob Herring
Quoted 6 lines · Rob Herring

From: Rob Herring <[email protected]>

earlyprintk is broken with 64KB pages. The problem is pgprot_default is not yet initialized when early_io_map is called, so the pte does not get marked as valid. Set the necessary page and access permission bits.

Quoted 6 lines
Cc Mark Salter <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>

---

FWIW, I had a patch in my early_ioremap series which initialized pgprot_default earlier in boot:

http://www.spinics.net/lists/arm-kernel/msg299656.html

(which reminds me to get v4 of that series out this week)