linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: fix early_io_map for 64K pages
@ 2014-02-05 14:50 Rob Herring
  2014-02-05 14:52 ` Will Deacon
  2014-02-05 15:04 ` Mark Salter
  0 siblings, 2 replies; 5+ messages in thread
From: Rob Herring @ 2014-02-05 14:50 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <robh@kernel.org>

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 <msalter@redhat.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---

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(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index f557ebb..c41daa6 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -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));
 	}
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] arm64: fix early_io_map for 64K pages
  2014-02-05 14:50 [PATCH] arm64: fix early_io_map for 64K pages Rob Herring
@ 2014-02-05 14:52 ` Will Deacon
  2014-02-05 14:55   ` Catalin Marinas
  2014-02-05 15:05   ` Rob Herring
  2014-02-05 15:04 ` Mark Salter
  1 sibling, 2 replies; 5+ messages in thread
From: Will Deacon @ 2014-02-05 14:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Rob,

On Wed, Feb 05, 2014 at 02:50:29PM +0000, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> 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 <msalter@redhat.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---

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

Will

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] arm64: fix early_io_map for 64K pages
  2014-02-05 14:52 ` Will Deacon
@ 2014-02-05 14:55   ` Catalin Marinas
  2014-02-05 15:05   ` Rob Herring
  1 sibling, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2014-02-05 14:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 05, 2014 at 02:52:51PM +0000, Will Deacon wrote:
> On Wed, Feb 05, 2014 at 02:50:29PM +0000, Rob Herring wrote:
> > From: Rob Herring <robh@kernel.org>
> > 
> > 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 <msalter@redhat.com>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > Signed-off-by: Rob Herring <robh@kernel.org>
> > ---
> 
> 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).

-- 
Catalin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] arm64: fix early_io_map for 64K pages
  2014-02-05 14:50 [PATCH] arm64: fix early_io_map for 64K pages Rob Herring
  2014-02-05 14:52 ` Will Deacon
@ 2014-02-05 15:04 ` Mark Salter
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Salter @ 2014-02-05 15:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2014-02-05 at 08:50 -0600, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> 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 <msalter@redhat.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> 

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)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] arm64: fix early_io_map for 64K pages
  2014-02-05 14:52 ` Will Deacon
  2014-02-05 14:55   ` Catalin Marinas
@ 2014-02-05 15:05   ` Rob Herring
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Herring @ 2014-02-05 15:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 5, 2014 at 8:52 AM, Will Deacon <will.deacon@arm.com> wrote:
> Hi Rob,
>
> On Wed, Feb 05, 2014 at 02:50:29PM +0000, Rob Herring wrote:
>> From: Rob Herring <robh@kernel.org>
>>
>> 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 <msalter@redhat.com>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will.deacon@arm.com>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> ---
>
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-05 15:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-05 14:50 [PATCH] arm64: fix early_io_map for 64K pages Rob Herring
2014-02-05 14:52 ` Will Deacon
2014-02-05 14:55   ` Catalin Marinas
2014-02-05 15:05   ` Rob Herring
2014-02-05 15:04 ` Mark Salter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).