Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753277AbbGXCw3 (ORCPT ); Thu, 23 Jul 2015 22:52:29 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:36303 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752208AbbGXCw1 (ORCPT ); Thu, 23 Jul 2015 22:52:27 -0400 Message-ID: <55B1A864.8040606@linaro.org> Date: Fri, 24 Jul 2015 10:52:20 +0800 From: Hanjun Guo User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Jonathan (Zhixiong) Zhang" , catalin.marinas@arm.com, will.deacon@arm.com, fu.wei@linaro.org, al.stone@linaro.org, "bp @ alien8 . de Matt Fleming" , rjw@rjwysocki.net CC: linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Ard Biesheuvel , Leif Lindholm Subject: Re: [PATCH V7 3/5] arm64: mm: add PROT_DEVICE_nGnRnE and PROT_NORMAL_WT References: <1437515960-16812-1-git-send-email-zjzhang@codeaurora.org> <1437515960-16812-4-git-send-email-zjzhang@codeaurora.org> In-Reply-To: <1437515960-16812-4-git-send-email-zjzhang@codeaurora.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3355 Lines: 83 +Cc Ard and Leif. On 07/22/2015 05:59 AM, Jonathan (Zhixiong) Zhang wrote: > From: "Jonathan (Zhixiong) Zhang" > > UEFI spec 2.5 section 2.3.6.1 defines that EFI_MEMORY_[UC|WC|WT|WB] are > possible EFI memory types for AArch64. Each of those EFI memory types > is mapped to a corresponding AArch64 memory type. So we need to define > PROT_DEVICE_nGnRnE and PROT_NORMWL_WT. > > MT_NORMAL_WT is defined, and its encoding is added to MAIR_EL1 when > initializing cpu. > > Change-Id: I20ac71ddf74c17e41769ecbb5f8c60eeefbb398a > Signed-off-by: Jonathan (Zhixiong) Zhang > --- > arch/arm64/include/asm/memory.h | 1 + > arch/arm64/include/asm/pgtable.h | 2 ++ > arch/arm64/mm/proc.S | 6 ++++-- > 3 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h > index f800d45ea226..4112b3d7468e 100644 > --- a/arch/arm64/include/asm/memory.h > +++ b/arch/arm64/include/asm/memory.h > @@ -100,6 +100,7 @@ > #define MT_DEVICE_GRE 2 > #define MT_NORMAL_NC 3 > #define MT_NORMAL 4 > +#define MT_NORMAL_WT 5 > > /* > * Memory types for Stage-2 translation > diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h > index 800ec0e87ed9..5c108ad13558 100644 > --- a/arch/arm64/include/asm/pgtable.h > +++ b/arch/arm64/include/asm/pgtable.h > @@ -61,8 +61,10 @@ extern void __pgd_error(const char *file, int line, unsigned long val); > #define PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF) > #endif > > +#define PROT_DEVICE_nGnRnE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRnE)) > #define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRE)) > #define PROT_NORMAL_NC (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_NORMAL_NC)) > +#define PROT_NORMAL_WT (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_NORMAL_WT)) > #define PROT_NORMAL (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_NORMAL)) > > #define PROT_SECT_DEVICE_nGnRE (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE)) > diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S > index 838266f5b056..23e265d732f8 100644 > --- a/arch/arm64/mm/proc.S > +++ b/arch/arm64/mm/proc.S > @@ -294,7 +294,7 @@ ENTRY(__cpu_setup) > msr cpacr_el1, x0 // Enable FP/ASIMD > msr mdscr_el1, xzr // Reset mdscr_el1 > /* > - * Memory region attributes for LPAE: > + * Memory region attributes for LPAE and EFI: > * > * n = AttrIndx[2:0] > * n MAIR > @@ -303,12 +303,14 @@ ENTRY(__cpu_setup) > * DEVICE_GRE 010 00001100 > * NORMAL_NC 011 01000100 > * NORMAL 100 11111111 > + * NORMAL_WT 101 10111011 > */ > ldr x5, =MAIR(0x00, MT_DEVICE_nGnRnE) | \ > MAIR(0x04, MT_DEVICE_nGnRE) | \ > MAIR(0x0c, MT_DEVICE_GRE) | \ > MAIR(0x44, MT_NORMAL_NC) | \ > - MAIR(0xff, MT_NORMAL) > + MAIR(0xff, MT_NORMAL) | \ > + MAIR(0xbb, MT_NORMAL_WT) > msr mair_el1, x5 > /* > * Prepare SCTLR > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/